diff --git a/docs/features/file-viewer.md b/docs/features/file-viewer.md index 83b203208..7497eea6f 100644 --- a/docs/features/file-viewer.md +++ b/docs/features/file-viewer.md @@ -106,7 +106,7 @@ import { Router } from '@angular/router'; @Component({...}) export class CustomComponent { - constructor(private store: Store, private router: Router) + constructor(private store: Store, private router: Router) {} viewNode(nodeId: string) { this.store.dispatch(new ViewNodeAction(nodeId, { location: this.router.url })); diff --git a/e2e/suites/extensions/ext-document-list.test.ts b/e2e/suites/extensions/ext-document-list.test.ts index 70513c3f9..a6740e5ad 100644 --- a/e2e/suites/extensions/ext-document-list.test.ts +++ b/e2e/suites/extensions/ext-document-list.test.ts @@ -84,7 +84,7 @@ describe('Extensions - DocumentList presets', () => { const expectedColumns = testData.filter((item) => !item.disabled).map((data) => data.label); const actualColumns = await dataTable.getColumnHeadersText(); - expect(actualColumns).toEqual(expectedColumns); + await expect(actualColumns).toEqual(expectedColumns); }); it('[C286699] Disabled items are not shown', async () => { diff --git a/e2e/suites/list-views/favorites.test.ts b/e2e/suites/list-views/favorites.test.ts index 10c73cc09..eea5712e4 100755 --- a/e2e/suites/list-views/favorites.test.ts +++ b/e2e/suites/list-views/favorites.test.ts @@ -88,14 +88,14 @@ describe('Favorites', () => { const expectedColumns = ['Name', 'Location', 'Size', 'Modified', 'Modified by']; const actualColumns = await dataTable.getColumnHeadersText(); - expect(actualColumns).toEqual(expectedColumns); + await expect(actualColumns).toEqual(expectedColumns); }); it('[C213226] displays the favorite files and folders', async () => { - expect(await dataTable.getRowsCount()).toEqual(4, 'Incorrect number of items displayed'); - expect(await dataTable.isItemPresent(fileName1)).toBe(true, `${fileName1} not displayed`); - expect(await dataTable.isItemPresent(fileName2)).toBe(true, `${fileName2} not displayed`); - expect(await dataTable.isItemPresent(favFolderName)).toBe(true, `${favFolderName} not displayed`); + await expect(await dataTable.getRowsCount()).toEqual(4, 'Incorrect number of items displayed'); + await expect(await dataTable.isItemPresent(fileName1)).toBe(true, `${fileName1} not displayed`); + await expect(await dataTable.isItemPresent(fileName2)).toBe(true, `${fileName2} not displayed`); + await expect(await dataTable.isItemPresent(favFolderName)).toBe(true, `${favFolderName} not displayed`); }); it(`[C213228] deleted favorite file does not appear`, async () => { @@ -120,12 +120,12 @@ describe('Favorites', () => { it('[C213650] Location column redirect - item in user Home', async () => { await dataTable.clickItemLocation(favFolderName); - expect(await breadcrumb.getAllItems()).toEqual(['Personal Files']); + await expect(await breadcrumb.getAllItems()).toEqual(['Personal Files']); }); it('[C280484] Location column redirect - file in folder', async () => { await dataTable.clickItemLocation(fileName2); - expect(await breadcrumb.getAllItems()).toEqual(['Personal Files', parentFolder]); + await expect(await breadcrumb.getAllItems()).toEqual(['Personal Files', parentFolder]); }); it('[C280485] Location column redirect - file in site', async () => { diff --git a/e2e/suites/list-views/file-libraries.test.ts b/e2e/suites/list-views/file-libraries.test.ts index 47bda919e..41bb25d17 100755 --- a/e2e/suites/list-views/file-libraries.test.ts +++ b/e2e/suites/list-views/file-libraries.test.ts @@ -103,7 +103,7 @@ describe('File Libraries', () => { const expectedColumns = ['Name', 'Description', 'My Role', 'Visibility']; const actualColumns = await dataTable.getColumnHeadersText(); - expect(actualColumns).toEqual(expectedColumns); + await expect(actualColumns).toEqual(expectedColumns); }); it('[C280501] User can see only the sites he is a member of', async () => { @@ -123,7 +123,7 @@ describe('File Libraries', () => { const sitesList = await dataTable.getSitesNameAndVisibility(); for (const site of Object.keys(expectedSitesVisibility)) { - expect(sitesList[site]).toEqual(expectedSitesVisibility[site]); + await expect(sitesList[site]).toEqual(expectedSitesVisibility[site]); } }); @@ -138,14 +138,14 @@ describe('File Libraries', () => { const sitesList = await dataTable.getSitesNameAndRole(); for (const site of Object.keys(expectedSitesRoles)) { - expect(sitesList[site]).toEqual(expectedSitesRoles[site]); + await expect(sitesList[site]).toEqual(expectedSitesRoles[site]); } }); it('[C217098] Site ID is displayed when two sites have the same name', async () => { const expectedSites = [`${siteName} (${siteId1})`, `${siteName} (${siteId2})`]; const actualSites = await dataTable.getCellsContainingName(siteName); - expect(actualSites.sort()).toEqual(expectedSites.sort()); + await expect(actualSites.sort()).toEqual(expectedSites.sort()); }); it('[C217096] Tooltip for sites without description', async () => { @@ -169,7 +169,7 @@ describe('File Libraries', () => { const expectedColumns = ['Name', 'Description', 'My Role', 'Visibility']; const actualColumns = await dataTable.getColumnHeadersText(); - expect(actualColumns).toEqual(expectedColumns); + await expect(actualColumns).toEqual(expectedColumns); }); it('[C289897] User can see only his favorite sites', async () => { diff --git a/e2e/suites/list-views/personal-files.test.ts b/e2e/suites/list-views/personal-files.test.ts index caebbf455..fde44ef7d 100755 --- a/e2e/suites/list-views/personal-files.test.ts +++ b/e2e/suites/list-views/personal-files.test.ts @@ -88,15 +88,15 @@ describe('Personal Files', () => { const expectedColumns = ['Name', 'Size', 'Modified', 'Modified by']; const actualColumns = await dataTable.getColumnHeadersText(); - expect(actualColumns).toEqual(expectedColumns); + await expect(actualColumns).toEqual(expectedColumns); }); it('[C217143] has default sorted column', async () => { - expect(await dataTable.getSortedColumnHeaderText()).toBe('Name'); + await expect(await dataTable.getSortedColumnHeaderText()).toBe('Name'); }); it('[C213242] has user created content', async () => { - expect(await dataTable.isItemPresent(userFolder)).toBe(true, 'user folder not displayed'); + await expect(await dataTable.isItemPresent(userFolder)).toBe(true, 'user folder not displayed'); }); it('[C213244] navigates to folder', async () => { diff --git a/e2e/suites/list-views/recent-files.test.ts b/e2e/suites/list-views/recent-files.test.ts index dab99a457..47340fa0c 100755 --- a/e2e/suites/list-views/recent-files.test.ts +++ b/e2e/suites/list-views/recent-files.test.ts @@ -84,7 +84,7 @@ describe('Recent Files', () => { const expectedColumns = ['Name', 'Location', 'Size', 'Modified']; const actualColumns = await dataTable.getColumnHeadersText(); - expect(actualColumns).toEqual(expectedColumns); + await expect(actualColumns).toEqual(expectedColumns); }); it('[C213171] default sorting column', async () => { @@ -117,7 +117,7 @@ describe('Recent Files', () => { it('[C213176] Location column redirect - file in user Home', async () => { await dataTable.clickItemLocation(fileName2); - expect(await breadcrumb.getAllItems()).toEqual(['Personal Files']); + await expect(await breadcrumb.getAllItems()).toEqual(['Personal Files']); }); it('[C280486] Location column redirect - file in folder', async () => { diff --git a/e2e/suites/list-views/shared-files.test.ts b/e2e/suites/list-views/shared-files.test.ts index aa96ed4fa..b55544b3c 100755 --- a/e2e/suites/list-views/shared-files.test.ts +++ b/e2e/suites/list-views/shared-files.test.ts @@ -97,7 +97,7 @@ describe('Shared Files', () => { const expectedColumns = ['Name', 'Location', 'Size', 'Modified', 'Modified by', 'Shared by']; const actualColumns = await dataTable.getColumnHeadersText(); - expect(actualColumns).toEqual(expectedColumns); + await expect(actualColumns).toEqual(expectedColumns); }); it('[C213115] default sorting column', async () => { @@ -126,7 +126,7 @@ describe('Shared Files', () => { it('[C213666] Location column redirect - file in user Home', async () => { await dataTable.clickItemLocation(file4User); - expect(await breadcrumb.getAllItems()).toEqual(['Personal Files']); + await expect(await breadcrumb.getAllItems()).toEqual(['Personal Files']); }); it('[C280490] Location column redirect - file in folder', async () => { diff --git a/e2e/suites/list-views/trash.test.ts b/e2e/suites/list-views/trash.test.ts index 799edf8fc..4101a0a4c 100755 --- a/e2e/suites/list-views/trash.test.ts +++ b/e2e/suites/list-views/trash.test.ts @@ -108,7 +108,7 @@ describe('Trash', () => { const expectedColumns = ['Name', 'Location', 'Size', 'Deleted', 'Deleted by']; const actualColumns = await dataTable.getColumnHeadersText(); - expect(actualColumns).toEqual(expectedColumns); + await expect(actualColumns).toEqual(expectedColumns); }); it('[C280493] displays the files and folders deleted by everyone', async () => { @@ -135,7 +135,7 @@ describe('Trash', () => { const expectedColumns = ['Name', 'Location', 'Size', 'Deleted']; const actualColumns = await dataTable.getColumnHeadersText(); - expect(actualColumns).toEqual(expectedColumns); + await expect(actualColumns).toEqual(expectedColumns); }); it('[C213218] displays the files and folders deleted by the user', async () => { diff --git a/e2e/suites/pagination/multiple-pages-files.test.ts b/e2e/suites/pagination/multiple-pages-files.test.ts index 6c73abb20..e84e30610 100644 --- a/e2e/suites/pagination/multiple-pages-files.test.ts +++ b/e2e/suites/pagination/multiple-pages-files.test.ts @@ -80,7 +80,7 @@ describe('Pagination on multiple pages : ', () => { describe('on Search Results', () => { beforeAll(async () => { - userApi.search.waitForApi(username, { expect: initialSearchTotalItems + 101 }); + await userApi.search.waitForApi(username, { expect: initialSearchTotalItems + 101 }); }, 120000); searchResultsTests(username); }); diff --git a/e2e/suites/search/search-results-libraries.test.ts b/e2e/suites/search/search-results-libraries.test.ts index fc54ff1cb..2398b536b 100644 --- a/e2e/suites/search/search-results-libraries.test.ts +++ b/e2e/suites/search/search-results-libraries.test.ts @@ -172,7 +172,7 @@ describe('Search results - libraries', () => { const expectedColumns = ['Name', 'Description', 'My Role', 'Visibility']; const actualColumns = await dataTable.getColumnHeadersText(); - expect(actualColumns).toEqual(expectedColumns); + await expect(actualColumns).toEqual(expectedColumns); }); it('[C290017] Library visibility is correctly displayed', async () => { diff --git a/package.json b/package.json index a9dbd9848..f0ce5dd88 100644 --- a/package.json +++ b/package.json @@ -86,6 +86,7 @@ "ajv-cli": "^3.3.0", "codelyzer": "^6.0.0", "commander": "^6.0.0", + "connect-history-api-fallback": "^1.6.0", "cpr": "^3.0.1", "cspell": "^4.1.0", "dotenv": "^8.2.0", diff --git a/projects/aca-shared/rules/src/app.rules.ts b/projects/aca-shared/rules/src/app.rules.ts index 0468070aa..bb1672982 100644 --- a/projects/aca-shared/rules/src/app.rules.ts +++ b/projects/aca-shared/rules/src/app.rules.ts @@ -103,7 +103,7 @@ export function isShared(context: RuleContext): boolean { return true; } - if ((navigation.isNotTrashcan(context), !context.selection.isEmpty && context.selection.file)) { + if (navigation.isNotTrashcan(context) && !context.selection.isEmpty && context.selection.file) { return !!(context.selection.file.entry && context.selection.file.entry.properties && context.selection.file.entry.properties['qshare:sharedId']); } diff --git a/projects/aca-shared/src/lib/services/content-api.service.ts b/projects/aca-shared/src/lib/services/content-api.service.ts index dd91cc5d1..edf4c7e2e 100644 --- a/projects/aca-shared/src/lib/services/content-api.service.ts +++ b/projects/aca-shared/src/lib/services/content-api.service.ts @@ -126,6 +126,7 @@ export class ContentApiService { /** * Gets information about a user identified by their username. * @param personId ID of the target user + * @param options Api options * @returns User information */ getPerson(personId: string, options?: { fields?: Array }): Observable { @@ -138,6 +139,7 @@ export class ContentApiService { * @param nodeId The id of the node to be copied * @param targetParentId The id of the folder-node where the node have to be copied to * @param name The new name for the copy that would be added on the destination folder + * @param opts Api options */ copyNode(nodeId: string, targetParentId: string, name?: string, opts?: { include?: Array; fields?: Array }): Observable { return from(this.api.nodesApi.copyNode(nodeId, { targetParentId, name }, opts)); diff --git a/projects/aca-shared/src/lib/services/router.extension.service.spec.ts b/projects/aca-shared/src/lib/services/router.extension.service.spec.ts index ddb26175a..37a0b4a6c 100644 --- a/projects/aca-shared/src/lib/services/router.extension.service.spec.ts +++ b/projects/aca-shared/src/lib/services/router.extension.service.spec.ts @@ -77,9 +77,9 @@ describe('RouterExtensionService', () => { ] }); - extensionService = TestBed.get(ExtensionService); - service = TestBed.get(RouterExtensionService); - router = TestBed.get(Router); + extensionService = TestBed.inject(ExtensionService); + service = TestBed.inject(RouterExtensionService); + router = TestBed.inject(Router); router.config = [ { path: 'login', component: {} as Type }, { path: 'settings', component: {} as Type }, diff --git a/projects/aca-testing-shared/src/components/breadcrumb/breadcrumb.ts b/projects/aca-testing-shared/src/components/breadcrumb/breadcrumb.ts index 7d8f337b5..9dd54993e 100755 --- a/projects/aca-testing-shared/src/components/breadcrumb/breadcrumb.ts +++ b/projects/aca-testing-shared/src/components/breadcrumb/breadcrumb.ts @@ -34,11 +34,10 @@ export class Breadcrumb extends Component { } async getAllItems(): Promise { - const items: string[] = await this.items.map(async (elem) => { + return this.items.map(async (elem) => { const str = await elem.getText(); return str.split('\nchevron_right')[0]; }); - return items; } async clickItem(name: string): Promise { diff --git a/projects/aca-testing-shared/src/components/breadcrumb/dropdown-breadcrumb.ts b/projects/aca-testing-shared/src/components/breadcrumb/dropdown-breadcrumb.ts index 7b6fe15cd..119bb0576 100755 --- a/projects/aca-testing-shared/src/components/breadcrumb/dropdown-breadcrumb.ts +++ b/projects/aca-testing-shared/src/components/breadcrumb/dropdown-breadcrumb.ts @@ -23,7 +23,7 @@ * along with Alfresco. If not, see . */ -import { by, browser } from 'protractor'; +import { browser, by } from 'protractor'; import { Component } from '../component'; import { waitForPresence, waitForStaleness } from '../../utilities/utils'; @@ -57,9 +57,8 @@ export class DropDownBreadcrumb extends Component { } async getPathItems(): Promise { - const items: string[] = await this.pathItems.map(async (elem) => { + return this.pathItems.map(async (elem) => { return elem.getText(); }); - return items; } } diff --git a/projects/aca-testing-shared/src/components/component.ts b/projects/aca-testing-shared/src/components/component.ts index 8d803a94f..dbf8d668f 100755 --- a/projects/aca-testing-shared/src/components/component.ts +++ b/projects/aca-testing-shared/src/components/component.ts @@ -45,7 +45,7 @@ export abstract class Component { return root.all(by.css(css)); } - constructor(selector: string, ancestor?: string) { + protected constructor(selector: string, ancestor?: string) { const locator = selector; this.component = ancestor ? browser.$$(ancestor).first().$$(locator).first() : browser.$$(locator).first(); diff --git a/projects/aca-testing-shared/src/components/data-table/data-table.ts b/projects/aca-testing-shared/src/components/data-table/data-table.ts index 2c99f1817..6f257c8e7 100755 --- a/projects/aca-testing-shared/src/components/data-table/data-table.ts +++ b/projects/aca-testing-shared/src/components/data-table/data-table.ts @@ -23,12 +23,12 @@ * along with Alfresco. If not, see . */ -import { ElementFinder, ElementArrayFinder, by, browser, protractor } from 'protractor'; +import { browser, by, ElementArrayFinder, ElementFinder, protractor } from 'protractor'; import { Logger } from '@alfresco/adf-testing'; import { BROWSER_WAIT_TIMEOUT } from '../../configs'; import { Component } from '../component'; import { Menu } from '../menu/menu'; -import { Utils, waitForPresence, waitForClickable } from '../../utilities/utils'; +import { Utils, waitForClickable, waitForPresence } from '../../utilities/utils'; export class DataTable extends Component { private static selectors = { @@ -146,10 +146,9 @@ export class DataTable extends Component { } async getSelectedRowsNames(): Promise { - const rowsText: string[] = await this.getSelectedRows().map((row) => { + return this.getSelectedRows().map((row) => { return row.element(by.css('.adf-datatable-cell[title="Name"]')).getText(); }); - return rowsText; } async getSelectedRowsCount(): Promise { @@ -358,10 +357,9 @@ export class DataTable extends Component { async getCellsContainingName(name: string): Promise { const rows = this.getRows().all(by.cssContainingText(DataTable.selectors.cell, name)); - const cellsText: string[] = await rows.map(async (cell) => { + return rows.map(async (cell) => { return cell.getText(); }); - return cellsText; } async hasContextMenu(): Promise { @@ -378,12 +376,11 @@ export class DataTable extends Component { } private async getEntireDataTableText(): Promise { - const text: string[] = await this.getRows().map((row) => { + return this.getRows().map((row) => { return row.all(by.css(DataTable.selectors.cell)).map(async (cell) => { return cell.getText(); }); }); - return text; } async getSitesNameAndVisibility(): Promise { diff --git a/projects/aca-testing-shared/src/components/dialog/generic-dialog.ts b/projects/aca-testing-shared/src/components/dialog/generic-dialog.ts index ed2f8151a..196ae76d4 100644 --- a/projects/aca-testing-shared/src/components/dialog/generic-dialog.ts +++ b/projects/aca-testing-shared/src/components/dialog/generic-dialog.ts @@ -27,7 +27,7 @@ import { ElementFinder, by, browser, Locator } from 'protractor'; import { isPresentAndDisplayed, waitForPresence, waitForVisibility, waitForStaleness } from '../../utilities/utils'; export abstract class GenericDialog { - constructor(private rootCssSelector?: string) {} + protected constructor(private rootCssSelector?: string) {} get rootElem(): ElementFinder { return browser.element(by.css(this.rootCssSelector)); diff --git a/projects/aca-testing-shared/src/components/menu/menu.ts b/projects/aca-testing-shared/src/components/menu/menu.ts index 3a497d263..de159841b 100755 --- a/projects/aca-testing-shared/src/components/menu/menu.ts +++ b/projects/aca-testing-shared/src/components/menu/menu.ts @@ -117,11 +117,10 @@ export class Menu extends Component { } async getMenuItems(): Promise { - const items: string[] = await this.items.map(async (elem) => { + return this.items.map(async (elem) => { const span = elem.element(by.css('span')); return span.getText(); }); - return items; } async clickNthItem(nth: number): Promise { @@ -194,8 +193,7 @@ export class Menu extends Component { async isMenuItemDisabled(title: string): Promise { try { const item = this.getItemByLabel(title); - const disabled = await item.getAttribute('disabled'); - return disabled; + return await item.getAttribute('disabled'); } catch (error) { Logger.error('----- isMenuItemDisabled catch: ', error); return null; diff --git a/projects/aca-testing-shared/src/components/search/filters/created-date-filter.ts b/projects/aca-testing-shared/src/components/search/filters/created-date-filter.ts index ef98340f0..684d5215b 100755 --- a/projects/aca-testing-shared/src/components/search/filters/created-date-filter.ts +++ b/projects/aca-testing-shared/src/components/search/filters/created-date-filter.ts @@ -79,8 +79,7 @@ export class CreatedDateFilter extends GenericFilterPanel { async getFromValue(): Promise { try { - const value = await this.fromInput.getAttribute('value'); - return value; + return await this.fromInput.getAttribute('value'); } catch (error) { return ''; } @@ -88,8 +87,7 @@ export class CreatedDateFilter extends GenericFilterPanel { async getFromError(): Promise { try { - const error = await this.fromFieldError.getText(); - return error; + return await this.fromFieldError.getText(); } catch (err) { return ''; } @@ -97,8 +95,7 @@ export class CreatedDateFilter extends GenericFilterPanel { async getToValue(): Promise { try { - const value = await this.toInput.getAttribute('value'); - return value; + return await this.toInput.getAttribute('value'); } catch (err) { return ''; } @@ -106,8 +103,7 @@ export class CreatedDateFilter extends GenericFilterPanel { async getToError(): Promise { try { - const error = await this.toFieldError.getText(); - return error; + return await this.toFieldError.getText(); } catch (err) { return ''; } diff --git a/projects/aca-testing-shared/src/components/search/filters/facet-filter.ts b/projects/aca-testing-shared/src/components/search/filters/facet-filter.ts index 47b13f915..9bf2f7322 100755 --- a/projects/aca-testing-shared/src/components/search/filters/facet-filter.ts +++ b/projects/aca-testing-shared/src/components/search/filters/facet-filter.ts @@ -52,17 +52,15 @@ export class FacetFilter extends GenericFilterPanel { } async getFiltersValues(): Promise { - const list: string[] = await this.facets.map((option) => { + return this.facets.map((option) => { return option.getText(); }); - return list; } async getFiltersCheckedValues(): Promise { - const list: string[] = await this.selectedFacets.map((option) => { + return this.selectedFacets.map((option) => { return option.getText(); }); - return list; } async resetPanel(): Promise { diff --git a/projects/aca-testing-shared/src/components/search/filters/size-filter.ts b/projects/aca-testing-shared/src/components/search/filters/size-filter.ts index ea13918ac..139e38851 100755 --- a/projects/aca-testing-shared/src/components/search/filters/size-filter.ts +++ b/projects/aca-testing-shared/src/components/search/filters/size-filter.ts @@ -36,17 +36,15 @@ export class SizeFilter extends GenericFilterPanel { clearButton: ElementFinder = this.panel.element(by.cssContainingText('.adf-facet-buttons button', 'Clear all')); async getFiltersValues(): Promise { - const list: string[] = await this.facets.map((option) => { + return this.facets.map((option) => { return option.getText(); }); - return list; } async getFiltersCheckedValues(): Promise { - const list: string[] = await this.selectedFacets.map((option) => { + return this.selectedFacets.map((option) => { return option.getText(); }); - return list; } async resetPanel(): Promise { diff --git a/projects/aca-testing-shared/src/components/search/search-sorting-picker.ts b/projects/aca-testing-shared/src/components/search/search-sorting-picker.ts index 44804a8a2..eb4105b40 100755 --- a/projects/aca-testing-shared/src/components/search/search-sorting-picker.ts +++ b/projects/aca-testing-shared/src/components/search/search-sorting-picker.ts @@ -78,10 +78,9 @@ export class SearchSortingPicker extends Component { } async getSortByOptionsList(): Promise { - const list: string[] = await this.sortByList.map(async (option) => { + return this.sortByList.map(async (option) => { return option.getText(); }); - return list; } async sortBy(option: SortByType): Promise { diff --git a/projects/aca-testing-shared/src/pages/search-results-page.ts b/projects/aca-testing-shared/src/pages/search-results-page.ts index 340b090c9..5b7c0a7c1 100755 --- a/projects/aca-testing-shared/src/pages/search-results-page.ts +++ b/projects/aca-testing-shared/src/pages/search-results-page.ts @@ -46,10 +46,9 @@ export class SearchResultsPage extends BrowsingPage { async getResultsChipsValues(): Promise { const chips = this.chipList.all(by.css('.mat-chip')); - const chipsValues: string[] = await chips.map(async (elem) => { + return chips.map(async (elem) => { return (await elem.getText()).replace(`\ncancel`, ''); }); - return chipsValues; } async removeChip(chipName: string): Promise { diff --git a/projects/aca-testing-shared/src/utilities/repo-client/apis/favorites/favorites-api.ts b/projects/aca-testing-shared/src/utilities/repo-client/apis/favorites/favorites-api.ts index 09dc19f75..8af248c13 100755 --- a/projects/aca-testing-shared/src/utilities/repo-client/apis/favorites/favorites-api.ts +++ b/projects/aca-testing-shared/src/utilities/repo-client/apis/favorites/favorites-api.ts @@ -128,7 +128,7 @@ export class FavoritesApi extends RepoApi { } async isFavoriteWithRetry(nodeId: string, data: { expect: boolean }) { - let isFavorite: boolean; + let isFavorite = false; try { const favorite = async () => { isFavorite = await this.isFavorite(nodeId); diff --git a/projects/aca-testing-shared/src/utilities/repo-client/apis/nodes/nodes-api.ts b/projects/aca-testing-shared/src/utilities/repo-client/apis/nodes/nodes-api.ts index 590a71ef6..342176b91 100755 --- a/projects/aca-testing-shared/src/utilities/repo-client/apis/nodes/nodes-api.ts +++ b/projects/aca-testing-shared/src/utilities/repo-client/apis/nodes/nodes-api.ts @@ -49,8 +49,7 @@ export class NodesApi extends RepoApi { async getNodeById(id: string): Promise { try { await this.apiAuth(); - const node = await this.nodesApi.getNode(id); - return node; + return await this.nodesApi.getNode(id); } catch (error) { this.handleError(`${this.constructor.name} ${this.getNodeById.name}`, error); return null; @@ -525,7 +524,7 @@ export class NodesApi extends RepoApi { expect: expect, retry: 5 }; - let isLocked: boolean; + let isLocked = false; try { const locked = async () => { isLocked = (await this.getLockType(nodeId)) === 'WRITE_LOCK'; diff --git a/projects/aca-testing-shared/src/utilities/repo-client/apis/repo-api.ts b/projects/aca-testing-shared/src/utilities/repo-client/apis/repo-api.ts index 0da29219d..701dd3f73 100644 --- a/projects/aca-testing-shared/src/utilities/repo-client/apis/repo-api.ts +++ b/projects/aca-testing-shared/src/utilities/repo-client/apis/repo-api.ts @@ -30,7 +30,7 @@ import { Logger } from '@alfresco/adf-testing'; export abstract class RepoApi { alfrescoJsApi = new AlfrescoApi(); - constructor(private username: string = browser.params.ADMIN_USERNAME, private password: string = browser.params.ADMIN_PASSWORD) { + protected constructor(private username: string = browser.params.ADMIN_USERNAME, private password: string = browser.params.ADMIN_PASSWORD) { this.alfrescoJsApi.setConfig(browser.params.config); } diff --git a/protractor.conf.js b/protractor.conf.js index f0b8a715b..18ab46aee 100755 --- a/protractor.conf.js +++ b/protractor.conf.js @@ -28,13 +28,13 @@ const MAX_RETRIES = process.env.MAX_RETRIES || 1; function rmDir(dirPath) { try { - var files = fs.readdirSync(dirPath); + const files = fs.readdirSync(dirPath); } catch (e) { return; } if (files.length > 0) - for (var i = 0; i < files.length; i++) { - var filePath = dirPath + '/' + files[i]; + for (let i = 0; i < files.length; i++) { + const filePath = dirPath + '/' + files[i]; if (fs.statSync(filePath).isFile()) fs.unlinkSync(filePath); else rmDir(filePath); } diff --git a/scripts/clireader/boolean-param.ts b/scripts/clireader/boolean-param.ts index d38748f35..09866ff40 100644 --- a/scripts/clireader/boolean-param.ts +++ b/scripts/clireader/boolean-param.ts @@ -7,7 +7,7 @@ */ import { ParamType } from './params'; -import { BaseParamOptions, CommanderOptionParams, BaseParam } from './base-param'; +import { CommanderOptionParams, BaseParam } from './base-param'; export class BooleanParam extends BaseParam { protected type = ParamType.confirm; diff --git a/scripts/clireader/input-param.ts b/scripts/clireader/input-param.ts index c5d40e594..1f1e4459d 100644 --- a/scripts/clireader/input-param.ts +++ b/scripts/clireader/input-param.ts @@ -7,7 +7,7 @@ */ import { ParamType } from './params'; -import { BaseParam, BaseParamOptions, CommanderOptionParams } from './base-param'; +import { BaseParam, CommanderOptionParams } from './base-param'; export class InputParam extends BaseParam { protected type = ParamType.input; diff --git a/src/app/components/files/files.component.ts b/src/app/components/files/files.component.ts index 8dcf6a469..cbde62dd9 100644 --- a/src/app/components/files/files.component.ts +++ b/src/app/components/files/files.component.ts @@ -36,6 +36,7 @@ import { SetCurrentFolderAction, isAdmin, AppStore, UploadFileVersionAction } fr import { BreakpointObserver, Breakpoints } from '@angular/cdk/layout'; import { debounceTime, takeUntil } from 'rxjs/operators'; import { FilterSearch, ShareDataRow } from '@alfresco/adf-content-services'; +import { DocumentListPresetRef } from '@alfresco/adf-extensions'; @Component({ templateUrl: './files.component.html' @@ -49,7 +50,7 @@ export class FilesComponent extends PageComponent implements OnInit, OnDestroy { private nodePath: PathElement[]; - columns: any[] = []; + columns: DocumentListPresetRef[] = []; constructor( private router: Router, diff --git a/src/app/components/info-drawer/comments-tab/comments-tab.component.spec.ts b/src/app/components/info-drawer/comments-tab/comments-tab.component.spec.ts index e4e51443f..2abf4c169 100644 --- a/src/app/components/info-drawer/comments-tab/comments-tab.component.spec.ts +++ b/src/app/components/info-drawer/comments-tab/comments-tab.component.spec.ts @@ -28,6 +28,7 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; import { AppTestingModule } from '../../../testing/app-testing.module'; import { NO_ERRORS_SCHEMA } from '@angular/core'; import { NodePermissionService } from '@alfresco/aca-shared'; +import { Node } from '@alfresco/js-api'; describe('CommentsTabComponent', () => { let component: CommentsTabComponent; @@ -66,44 +67,40 @@ describe('CommentsTabComponent', () => { }); it('should return [false] if node selected is neither file or folder', () => { - const testNode: any = { + component.node = { id: 'test-node-id', isFile: false, isFolder: false - }; - component.node = testNode; + } as Node; expect(component.canUpdateNode).toBe(false); }); it('should return [false] if node selected is a locked file', () => { - const testNode: any = { + component.node = { id: 'test-node-id', isFile: true, isFolder: false, isLocked: true - }; - component.node = testNode; + } as Node; expect(component.canUpdateNode).toBe(false); }); it('should check [update] permission if node selected is a not locked file', () => { - const testNode: any = { + component.node = { id: 'test-node-id', isFile: true, isFolder: false - }; - component.node = testNode; + } as Node; expect(component.canUpdateNode).toBe(true); expect(checked).toContain('update'); }); it('should check [update] permission if node selected is a folder', () => { - const testNode: any = { + component.node = { id: 'test-node-id', isFile: false, isFolder: true - }; - component.node = testNode; + } as Node; expect(component.canUpdateNode).toBe(true); expect(checked).toContain('update'); }); diff --git a/src/app/components/page.component.ts b/src/app/components/page.component.ts index 2fa105e10..8514a406b 100644 --- a/src/app/components/page.component.ts +++ b/src/app/components/page.component.ts @@ -70,7 +70,7 @@ export abstract class PageComponent implements OnInit, OnDestroy, OnChanges { protected subscriptions: Subscription[] = []; - constructor(protected store: Store, protected extensions: AppExtensionService, protected content: ContentManagementService) {} + protected constructor(protected store: Store, protected extensions: AppExtensionService, protected content: ContentManagementService) {} ngOnInit() { this.sharedPreviewUrl$ = this.store.select(getSharedUrl); diff --git a/src/app/components/preview/preview.component.ts b/src/app/components/preview/preview.component.ts index 2c025ffc2..b4d0b1926 100644 --- a/src/app/components/preview/preview.component.ts +++ b/src/app/components/preview/preview.component.ts @@ -177,10 +177,10 @@ export class PreviewComponent extends PageComponent implements OnInit, OnDestroy this.nodeId = this.node.id; return; } - this.router.navigate([this.previewLocation, id]); + await this.router.navigate([this.previewLocation, id]); } catch (err) { if (!err || err.status !== 401) { - this.router.navigate([this.previewLocation, id]); + await this.router.navigate([this.previewLocation, id]); } } } diff --git a/src/app/components/shared-link-view/shared-link-view.component.ts b/src/app/components/shared-link-view/shared-link-view.component.ts index e790075ea..90ca86894 100644 --- a/src/app/components/shared-link-view/shared-link-view.component.ts +++ b/src/app/components/shared-link-view/shared-link-view.component.ts @@ -31,7 +31,7 @@ import { Component, OnInit, ViewEncapsulation } from '@angular/core'; import { ActivatedRoute } from '@angular/router'; import { Store } from '@ngrx/store'; import { forkJoin, from, of } from 'rxjs'; -import { catchError, flatMap } from 'rxjs/operators'; +import { catchError, mergeMap } from 'rxjs/operators'; import { AppExtensionService } from '@alfresco/aca-shared'; @Component({ @@ -55,8 +55,10 @@ export class SharedLinkViewComponent implements OnInit { ngOnInit() { this.route.params .pipe( - flatMap((params) => - forkJoin(from(this.alfrescoApiService.sharedLinksApi.getSharedLink(params.id)), of(params.id)).pipe(catchError(() => of([null, params.id]))) + mergeMap((params) => + forkJoin([from(this.alfrescoApiService.sharedLinksApi.getSharedLink(params.id)), of(params.id)]).pipe( + catchError(() => of([null, params.id])) + ) ) ) .subscribe(([sharedEntry, sharedId]: [SharedLinkEntry, string]) => { diff --git a/src/app/components/sidenav/components/button-menu.component.spec.ts b/src/app/components/sidenav/components/button-menu.component.spec.ts index aaa06e59d..f1d79a4a3 100644 --- a/src/app/components/sidenav/components/button-menu.component.spec.ts +++ b/src/app/components/sidenav/components/button-menu.component.spec.ts @@ -56,7 +56,10 @@ describe('ButtonMenuComponent', () => { it('should render action item', () => { component.item = { id: 'test-action-button', - url: 'dummy' + url: 'dummy', + icon: null, + title: null, + route: null }; fixture.detectChanges(); @@ -68,16 +71,23 @@ describe('ButtonMenuComponent', () => { it('should render action item with children', () => { component.item = { id: 'test-action-button', + icon: null, + title: null, + route: null, children: [ { id: 'child-1', title: 'child-1', - url: 'dummy' + url: 'dummy', + icon: null, + route: null }, { id: 'child-2', title: 'child-2', - url: 'dummy' + url: 'dummy', + icon: null, + route: null } ] }; diff --git a/src/app/components/sidenav/components/button-menu.component.ts b/src/app/components/sidenav/components/button-menu.component.ts index b38a11dfc..aaa976b6c 100644 --- a/src/app/components/sidenav/components/button-menu.component.ts +++ b/src/app/components/sidenav/components/button-menu.component.ts @@ -25,6 +25,7 @@ import { Component, Input, ViewEncapsulation, OnInit, ChangeDetectorRef } from '@angular/core'; import { OverlayContainer } from '@angular/cdk/overlay'; +import { NavBarLinkRef } from '@alfresco/adf-extensions'; @Component({ selector: 'app-button-menu', @@ -33,7 +34,8 @@ import { OverlayContainer } from '@angular/cdk/overlay'; encapsulation: ViewEncapsulation.None }) export class ButtonMenuComponent implements OnInit { - @Input() item; + @Input() + item: NavBarLinkRef; constructor(private cd: ChangeDetectorRef, private overlayContainer: OverlayContainer) { this.overlayContainer.getContainerElement().classList.add('aca-menu-panel'); diff --git a/src/app/components/toolbar/view-node/view-node.component.ts b/src/app/components/toolbar/view-node/view-node.component.ts index 7528d9e66..7f8504197 100644 --- a/src/app/components/toolbar/view-node/view-node.component.ts +++ b/src/app/components/toolbar/view-node/view-node.component.ts @@ -52,7 +52,7 @@ import { SharedLinkEntry } from '@alfresco/js-api'; host: { class: 'app-view-node' } }) export class ViewNodeComponent { - @Input() data: any; + @Input() data: { title?: string; menuButton?: boolean; iconButton?: boolean }; constructor(private store: Store, private router: Router) {} diff --git a/src/app/services/content-management.service.spec.ts b/src/app/services/content-management.service.spec.ts index 3fc6338df..054497801 100644 --- a/src/app/services/content-management.service.spec.ts +++ b/src/app/services/content-management.service.spec.ts @@ -102,7 +102,7 @@ describe('ContentManagementService', () => { store.dispatch(new CopyNodesAction(selection)); nodeActions.contentCopied.next(createdItems); - subject.next('OPERATION.SUCCES.CONTENT.COPY'); + subject.next('OPERATION.SUCCESS.CONTENT.COPY'); expect(nodeActions.copyNodes).toHaveBeenCalled(); expect(snackBar.open['calls'].argsFor(0)[0]).toBe('APP.MESSAGES.INFO.NODE_COPY.SINGULAR'); @@ -116,7 +116,7 @@ describe('ContentManagementService', () => { store.dispatch(new CopyNodesAction(selection)); nodeActions.contentCopied.next(createdItems); - subject.next('OPERATION.SUCCES.CONTENT.COPY'); + subject.next('OPERATION.SUCCESS.CONTENT.COPY'); expect(nodeActions.copyNodes).toHaveBeenCalled(); expect(snackBar.open['calls'].argsFor(0)[0]).toBe('APP.MESSAGES.INFO.NODE_COPY.PLURAL'); @@ -130,7 +130,7 @@ describe('ContentManagementService', () => { store.dispatch(new CopyNodesAction(selection)); nodeActions.contentCopied.next(createdItems); - subject.next('OPERATION.SUCCES.CONTENT.COPY'); + subject.next('OPERATION.SUCCESS.CONTENT.COPY'); expect(nodeActions.copyNodes).toHaveBeenCalled(); expect(snackBar.open['calls'].argsFor(0)[0]).toBe('APP.MESSAGES.INFO.NODE_COPY.PARTIAL_SINGULAR'); @@ -148,7 +148,7 @@ describe('ContentManagementService', () => { store.dispatch(new CopyNodesAction(selection)); nodeActions.contentCopied.next(createdItems); - subject.next('OPERATION.SUCCES.CONTENT.COPY'); + subject.next('OPERATION.SUCCESS.CONTENT.COPY'); expect(nodeActions.copyNodes).toHaveBeenCalled(); expect(snackBar.open['calls'].argsFor(0)[0]).toBe('APP.MESSAGES.INFO.NODE_COPY.PARTIAL_PLURAL'); @@ -166,7 +166,7 @@ describe('ContentManagementService', () => { store.dispatch(new CopyNodesAction(selection)); nodeActions.contentCopied.next(createdItems); - subject.next('OPERATION.SUCCES.CONTENT.COPY'); + subject.next('OPERATION.SUCCESS.CONTENT.COPY'); expect(nodeActions.copyNodes).toHaveBeenCalled(); expect(snackBar.open['calls'].argsFor(0)[0]).toBe('APP.MESSAGES.INFO.NODE_COPY.FAIL_PLURAL'); @@ -180,7 +180,7 @@ describe('ContentManagementService', () => { store.dispatch(new CopyNodesAction(selection)); nodeActions.contentCopied.next(createdItems); - subject.next('OPERATION.SUCCES.CONTENT.COPY'); + subject.next('OPERATION.SUCCESS.CONTENT.COPY'); expect(nodeActions.copyNodes).toHaveBeenCalled(); expect(snackBar.open['calls'].argsFor(0)[0]).toBe('APP.MESSAGES.INFO.NODE_COPY.FAIL_SINGULAR'); @@ -242,7 +242,7 @@ describe('ContentManagementService', () => { const createdItems: any[] = [{ entry: { id: 'copy-id', name: 'name' } }]; store.dispatch(new CopyNodesAction(selection)); - nodeActions.copyNodes(null).next('OPERATION.SUCCES.CONTENT.COPY'); + nodeActions.copyNodes(null).next('OPERATION.SUCCESS.CONTENT.COPY'); nodeActions.contentCopied.next(createdItems); expect(nodeActions.copyNodes).toHaveBeenCalled(); @@ -279,7 +279,7 @@ describe('ContentManagementService', () => { ]; store.dispatch(new CopyNodesAction(selection)); - nodeActions.copyNodes(null).next('OPERATION.SUCCES.CONTENT.COPY'); + nodeActions.copyNodes(null).next('OPERATION.SUCCESS.CONTENT.COPY'); nodeActions.contentCopied.next(createdItems); expect(nodeActions.copyNodes).toHaveBeenCalled(); @@ -299,7 +299,7 @@ describe('ContentManagementService', () => { const createdItems: any[] = [{ entry: { id: 'copy-id', name: 'name' } }]; store.dispatch(new CopyNodesAction(selection)); - nodeActions.copyNodes(null).next('OPERATION.SUCCES.CONTENT.COPY'); + nodeActions.copyNodes(null).next('OPERATION.SUCCESS.CONTENT.COPY'); nodeActions.contentCopied.next(createdItems); expect(nodeActions.copyNodes).toHaveBeenCalled(); @@ -314,7 +314,7 @@ describe('ContentManagementService', () => { const createdItems: any[] = [{ entry: { id: 'copy-id', name: 'name' } }]; store.dispatch(new CopyNodesAction(selection)); - nodeActions.copyNodes(null).next('OPERATION.SUCCES.CONTENT.COPY'); + nodeActions.copyNodes(null).next('OPERATION.SUCCESS.CONTENT.COPY'); nodeActions.contentCopied.next(createdItems); expect(nodeActions.copyNodes).toHaveBeenCalled(); @@ -329,7 +329,7 @@ describe('ContentManagementService', () => { const createdItems: any[] = [{ entry: { id: 'copy-id', name: 'name' } }]; store.dispatch(new CopyNodesAction(selection)); - nodeActions.copyNodes(null).next('OPERATION.SUCCES.CONTENT.COPY'); + nodeActions.copyNodes(null).next('OPERATION.SUCCESS.CONTENT.COPY'); nodeActions.contentCopied.next(createdItems); expect(nodeActions.copyNodes).toHaveBeenCalled(); @@ -375,7 +375,7 @@ describe('ContentManagementService', () => { const selection: any = node; store.dispatch(new MoveNodesAction(selection)); - nodeActions.moveNodes(null).next('OPERATION.SUCCES.CONTENT.MOVE'); + nodeActions.moveNodes(null).next('OPERATION.SUCCESS.CONTENT.MOVE'); nodeActions.contentMoved.next(moveResponse); expect(nodeActions.moveNodes).toHaveBeenCalled(); @@ -396,7 +396,7 @@ describe('ContentManagementService', () => { const selection: any = nodes; store.dispatch(new MoveNodesAction(selection)); - nodeActions.moveNodes(null).next('OPERATION.SUCCES.CONTENT.MOVE'); + nodeActions.moveNodes(null).next('OPERATION.SUCCESS.CONTENT.MOVE'); nodeActions.contentMoved.next(moveResponse); expect(nodeActions.moveNodes).toHaveBeenCalled(); @@ -414,10 +414,8 @@ describe('ContentManagementService', () => { spyOn(nodeActions, 'moveNodes').and.returnValue(subject); spyOn(nodeActions, 'processResponse').and.returnValue(moveResponse); - const selection = nodes; - - store.dispatch(new MoveNodesAction(selection)); - nodeActions.moveNodes(null).next('OPERATION.SUCCES.CONTENT.MOVE'); + store.dispatch(new MoveNodesAction(nodes)); + nodeActions.moveNodes(null).next('OPERATION.SUCCESS.CONTENT.MOVE'); nodeActions.contentMoved.next(moveResponse); expect(nodeActions.moveNodes).toHaveBeenCalled(); @@ -435,10 +433,8 @@ describe('ContentManagementService', () => { spyOn(nodeActions, 'moveNodes').and.returnValue(subject); spyOn(nodeActions, 'processResponse').and.returnValue(moveResponse); - const selection = nodes; - - store.dispatch(new MoveNodesAction(selection)); - nodeActions.moveNodes(null).next('OPERATION.SUCCES.CONTENT.MOVE'); + store.dispatch(new MoveNodesAction(nodes)); + nodeActions.moveNodes(null).next('OPERATION.SUCCESS.CONTENT.MOVE'); nodeActions.contentMoved.next(moveResponse); expect(nodeActions.moveNodes).toHaveBeenCalled(); @@ -457,7 +453,7 @@ describe('ContentManagementService', () => { spyOn(nodeActions, 'processResponse').and.returnValue(moveResponse); store.dispatch(new MoveNodesAction(nodes)); - nodeActions.moveNodes(null).next('OPERATION.SUCCES.CONTENT.MOVE'); + nodeActions.moveNodes(null).next('OPERATION.SUCCESS.CONTENT.MOVE'); nodeActions.contentMoved.next(moveResponse); expect(nodeActions.moveNodes).toHaveBeenCalled(); @@ -476,7 +472,7 @@ describe('ContentManagementService', () => { spyOn(nodeActions, 'processResponse').and.returnValue(moveResponse); store.dispatch(new MoveNodesAction(nodes)); - nodeActions.moveNodes(null).next('OPERATION.SUCCES.CONTENT.MOVE'); + nodeActions.moveNodes(null).next('OPERATION.SUCCESS.CONTENT.MOVE'); nodeActions.contentMoved.next(moveResponse); expect(nodeActions.moveNodes).toHaveBeenCalled(); @@ -546,7 +542,7 @@ describe('ContentManagementService', () => { spyOn(nodeActions, 'processResponse').and.returnValue(moveResponse); store.dispatch(new MoveNodesAction(nodes)); - nodeActions.moveNodes(null).next('OPERATION.SUCCES.CONTENT.MOVE'); + nodeActions.moveNodes(null).next('OPERATION.SUCCESS.CONTENT.MOVE'); nodeActions.contentMoved.next(moveResponse); expect(nodeActions.moveNodes).toHaveBeenCalled(); @@ -592,7 +588,7 @@ describe('ContentManagementService', () => { spyOn(nodeActions, 'moveNodeAction').and.returnValue(of({})); store.dispatch(new MoveNodesAction(selection)); - nodeActions.moveNodes(null).next('OPERATION.SUCCES.CONTENT.MOVE'); + nodeActions.moveNodes(null).next('OPERATION.SUCCESS.CONTENT.MOVE'); const movedItems = { failed: [], partiallySucceeded: [], @@ -625,7 +621,7 @@ describe('ContentManagementService', () => { }; store.dispatch(new MoveNodesAction(selection)); - nodeActions.moveNodes(null).next('OPERATION.SUCCES.CONTENT.MOVE'); + nodeActions.moveNodes(null).next('OPERATION.SUCCESS.CONTENT.MOVE'); nodeActions.contentMoved.next(movedItems); expect(nodeActions.moveNodeAction).toHaveBeenCalledWith(node.entry, initialParent); @@ -657,7 +653,7 @@ describe('ContentManagementService', () => { }; store.dispatch(new MoveNodesAction(selection)); - nodeActions.moveNodes(null).next('OPERATION.SUCCES.CONTENT.MOVE'); + nodeActions.moveNodes(null).next('OPERATION.SUCCESS.CONTENT.MOVE'); nodeActions.contentMoved.next(movedItems); expect(contentApi.restoreNode).toHaveBeenCalled(); @@ -699,7 +695,7 @@ describe('ContentManagementService', () => { }; store.dispatch(new MoveNodesAction(selection)); - nodeActions.moveNodes(null).next('OPERATION.SUCCES.CONTENT.MOVE'); + nodeActions.moveNodes(null).next('OPERATION.SUCCESS.CONTENT.MOVE'); nodeActions.contentMoved.next(movedItems); expect(contentApi.restoreNode).toHaveBeenCalled(); @@ -731,7 +727,7 @@ describe('ContentManagementService', () => { }; store.dispatch(new MoveNodesAction(selection)); - nodeActions.moveNodes(null).next('OPERATION.SUCCES.CONTENT.MOVE'); + nodeActions.moveNodes(null).next('OPERATION.SUCCESS.CONTENT.MOVE'); nodeActions.contentMoved.next(movedItems); expect(contentApi.restoreNode).toHaveBeenCalled(); @@ -763,7 +759,7 @@ describe('ContentManagementService', () => { }; store.dispatch(new MoveNodesAction(selection)); - nodeActions.moveNodes(null).next('OPERATION.SUCCES.CONTENT.MOVE'); + nodeActions.moveNodes(null).next('OPERATION.SUCCESS.CONTENT.MOVE'); nodeActions.contentMoved.next(movedItems); expect(nodeActions.moveNodes).toHaveBeenCalled(); diff --git a/src/app/services/content-management.service.ts b/src/app/services/content-management.service.ts index 2033c76e9..e6a35720b 100644 --- a/src/app/services/content-management.service.ts +++ b/src/app/services/content-management.service.ts @@ -59,7 +59,7 @@ import { MatDialog } from '@angular/material/dialog'; import { MatSnackBar } from '@angular/material/snack-bar'; import { Store } from '@ngrx/store'; import { forkJoin, Observable, of, Subject, zip } from 'rxjs'; -import { catchError, flatMap, map, mergeMap, take, tap } from 'rxjs/operators'; +import { catchError, map, mergeMap, take, tap } from 'rxjs/operators'; import { NodePermissionsDialogComponent } from '../components/permissions/permission-dialog/node-permissions.dialog'; import { NodeVersionsDialogComponent } from '../dialogs/node-versions/node-versions.dialog'; import { NodeActionsService } from './node-actions.service'; @@ -1031,7 +1031,7 @@ export class ContentManagementService { getNodeInfo(): Observable { return this.store.select(getAppSelection).pipe( take(1), - flatMap(({ file }) => { + mergeMap(({ file }) => { const id = (file as any).entry.nodeId || (file as any).entry.guid; if (!id) { return of(file.entry); diff --git a/src/app/services/node-actions.service.spec.ts b/src/app/services/node-actions.service.spec.ts index 35e31e64d..95eaef505 100644 --- a/src/app/services/node-actions.service.spec.ts +++ b/src/app/services/node-actions.service.spec.ts @@ -356,7 +356,7 @@ describe('NodeActionsService', () => { const spyOnDestinationPicker = spyOn(service, 'getContentNodeSelection').and.callThrough(); spyOn(service, 'getEntryParentId').and.returnValue('parent-id'); - let dialogData: any; + let dialogData = null; const spyOnDialog = spyOn(dialog, 'open').and.callFake((_contentNodeSelectorComponent: any, data: any) => { dialogData = data; return { componentInstance: {} } as MatDialogRef; diff --git a/src/app/services/node-actions.service.ts b/src/app/services/node-actions.service.ts index c091c3b37..b0cc1f00b 100644 --- a/src/app/services/node-actions.service.ts +++ b/src/app/services/node-actions.service.ts @@ -118,7 +118,7 @@ export class NodeActionsService { } action$.subscribe((newContent) => { - observable.next(`OPERATION.SUCCES.${type.toUpperCase()}.${action.toUpperCase()}`); + observable.next(`OPERATION.SUCCESS.${type.toUpperCase()}.${action.toUpperCase()}`); const processedData = this.processResponse(newContent); if (action === BatchOperationType.copy) { diff --git a/src/app/store/effects/app.effects.ts b/src/app/store/effects/app.effects.ts index f697ed04c..dcd89bc11 100644 --- a/src/app/store/effects/app.effects.ts +++ b/src/app/store/effects/app.effects.ts @@ -62,7 +62,7 @@ export class AppEffects { }) ); - private redirectToLogin() { - this.router.navigate(['login']); + private redirectToLogin(): Promise { + return this.router.navigate(['login']); } } diff --git a/src/app/store/reducers/app.reducer.ts b/src/app/store/reducers/app.reducer.ts index d42ef7d46..432d48b0e 100644 --- a/src/app/store/reducers/app.reducer.ts +++ b/src/app/store/reducers/app.reducer.ts @@ -212,7 +212,7 @@ function updateSelectedNodes(state: AppState, action: SetSelectedNodesAction): A if (nodes.length === 1) { file = nodes.find((entity: any) => { // workaround Shared - return entity.entry.isFile || entity.entry.nodeId || entity.entry.sharedByUser ? true : false; + return !!(entity.entry.isFile || entity.entry.nodeId || entity.entry.sharedByUser); }); folder = nodes.find((entity: any) => entity.entry.isFolder); } @@ -266,7 +266,7 @@ function handleSettingsUpdate(state: AppState, action: SetSettingsParameterActio const { payload } = action; if (payload.name === 'languagePicker') { - newState.languagePicker = payload.value ? true : false; + newState.languagePicker = !!payload.value; } return newState; } diff --git a/src/typings.d.ts b/src/typings.d.ts index 8d49f37f9..44235944d 100644 --- a/src/typings.d.ts +++ b/src/typings.d.ts @@ -28,5 +28,3 @@ declare var module: NodeModule; interface NodeModule { id: string; } - -interface WebKitFileEntry {}