[ACA-2022] navigation fixes (#830)

* navigation fixes

* test fixes
This commit is contained in:
Denys Vuika
2018-11-26 18:20:30 +00:00
committed by GitHub
parent 8952be634f
commit 18b4c1bc8a
5 changed files with 37 additions and 16 deletions

View File

@@ -77,7 +77,7 @@ describe('Empty list views', () => {
await page.clickRecentFiles();
expect(await dataTable.isEmptyList()).toBe(true, 'list is not empty');
expect(await dataTable.getEmptyStateTitle()).toContain('No recent files');
expect(await dataTable.getEmptyStateSubtitle()).toContain('Items you upload or edit in the last 30 days are shown here.');
expect(await dataTable.getEmptyStateSubtitle()).toContain('Items you uploaded or edited in the last 30 days are shown here.');
});
it('empty Favorites - [C280133]', async () => {

View File

@@ -131,19 +131,19 @@ describe('Special permissions', () => {
it(`on Recent Files - [C213178]`, async () => {
await page.clickRecentFilesAndWait();
expect(await dataTable.countRows()).toBe(1, 'Incorrect number of items');
expect(await dataTable.getItemLocation(fileName)).toEqual('');
expect(await dataTable.getItemLocation(fileName)).toEqual('Unknown');
});
it(`on Favorites - [C213672]`, async () => {
await page.clickFavoritesAndWait();
expect(await dataTable.countRows()).toBe(1, 'Incorrect number of items');
expect(await dataTable.getItemLocation(fileName)).toEqual('');
expect(await dataTable.getItemLocation(fileName)).toEqual('Unknown');
});
it(`on Shared Files - [C213668]`, async () => {
await page.clickSharedFilesAndWait();
expect(await dataTable.countRows()).toBe(1, 'Incorrect number of items');
expect(await dataTable.getItemLocation(fileName)).toEqual('');
expect(await dataTable.getItemLocation(fileName)).toEqual('Unknown');
});
});
});

View File

@@ -43,7 +43,7 @@ import { ContentApiService } from '../../../services/content-api.service';
selector: 'aca-location-link',
template: `
<a href="" [title]="nodeLocation$ | async" (click)="goToLocation()">
{{ displayText | async }}
{{ displayText | async | translate }}
</a>
`,
changeDetection: ChangeDetectionStrategy.OnPush,
@@ -53,7 +53,7 @@ import { ContentApiService } from '../../../services/content-api.service';
export class LocationLinkComponent implements OnInit {
private _path: PathInfo;
nodeLocation$ = new BehaviorSubject(null);
nodeLocation$ = new BehaviorSubject('');
@Input()
context: any;
@@ -93,6 +93,8 @@ export class LocationLinkComponent implements OnInit {
if (path && path.name && path.elements) {
this.displayText = this.getDisplayText(path);
this._path = path;
} else {
this.displayText = of('APP.BROWSE.SEARCH.UNKNOWN_LOCATION');
}
}
}
@@ -142,6 +144,10 @@ export class LocationLinkComponent implements OnInit {
// todo: review once 5.2.3 is out
private getTooltip(path: PathInfo) {
if (!path) {
return;
}
let result: string = null;
const elements = path.elements.map(e => Object.assign({}, e));

View File

@@ -36,12 +36,19 @@ import {
NavigateToFolder,
NAVIGATE_FOLDER,
NavigateUrlAction,
NAVIGATE_URL
NAVIGATE_URL,
SnackbarErrorAction
} from '../actions';
import { AppStore } from '../states/app.state';
import { Store } from '@ngrx/store';
@Injectable()
export class RouterEffects {
constructor(private actions$: Actions, private router: Router) {}
constructor(
private store: Store<AppStore>,
private actions$: Actions,
private router: Router
) {}
@Effect({ dispatch: false })
navigateUrl$ = this.actions$.pipe(
@@ -97,11 +104,13 @@ export class RouterEffects {
// parent.id could be 'Site' folder or child as 'documentLibrary'
link = [area, parent.name === 'Sites' ? {} : id];
}
}
setTimeout(() => {
this.router.navigate(link);
}, 10);
} else {
this.router.navigate(['/personal-files', node.id]);
}
}
private navigateToParentFolder(node: MinimalNodeEntryEntity) {
@@ -120,11 +129,15 @@ export class RouterEffects {
// parent.id could be 'Site' folder or child as 'documentLibrary'
link = [area, parent.name === 'Sites' ? {} : parent.id];
}
}
setTimeout(() => {
this.router.navigate(link);
}, 10);
} else {
this.store.dispatch(
new SnackbarErrorAction('APP.MESSAGES.ERRORS.CANNOT_NAVIGATE_LOCATION')
);
}
}
private isLibraryContent(path: PathInfoEntity): boolean {

View File

@@ -168,6 +168,7 @@
"LOCATION": "Location",
"SIZE": "Size"
},
"UNKNOWN_LOCATION": "Unknown",
"NO_RESULTS": "Your search returned 0 results"
},
"SEARCH_LIBRARIES": {
@@ -250,6 +251,7 @@
},
"MESSAGES": {
"ERRORS":{
"CANNOT_NAVIGATE_LOCATION": "Cannot navigate location",
"MISSING_CONTENT": "This item no longer exists or you don't have permission to view it.",
"GENERIC": "The action was unsuccessful. Try again or contact your IT Team.",
"CONFLICT": "This name is already in use, try a different name.",