integrate Prettier with tslint (#1419)

* integrate prettier with tslint

* remove obsolte scripts

* update tsconfig

* fix lint issues

* fix lint errors

* more rules and fixes

* kebab case and lint fixes

* update helpers

* update util
This commit is contained in:
Denys Vuika
2020-04-19 23:29:20 +01:00
committed by GitHub
parent 6a84717a00
commit bf509843b7
96 changed files with 829 additions and 559 deletions
+2 -2
View File
@@ -179,7 +179,7 @@ export class DataTable extends Component {
getRowByName(name: string, location: string = ''): ElementFinder { getRowByName(name: string, location: string = ''): ElementFinder {
if (location) { if (location) {
return this.body.all(by.cssContainingText(DataTable.selectors.row, name)) return this.body.all(by.cssContainingText(DataTable.selectors.row, name))
.filter(async (elem) => await browser.isElementPresent(elem.element(by.cssContainingText(DataTable.selectors.cell, location)))) .filter(async (elem) => browser.isElementPresent(elem.element(by.cssContainingText(DataTable.selectors.cell, location))))
.first(); .first();
} }
return this.body.element(by.cssContainingText(DataTable.selectors.row, name)); return this.body.element(by.cssContainingText(DataTable.selectors.row, name));
@@ -444,7 +444,7 @@ export class DataTable extends Component {
getSearchResultsRowByName(name: string, location: string = ''): ElementFinder { getSearchResultsRowByName(name: string, location: string = ''): ElementFinder {
if (location) { if (location) {
return this.body.all(by.cssContainingText(DataTable.selectors.searchResultsRow, name)) return this.body.all(by.cssContainingText(DataTable.selectors.searchResultsRow, name))
.filter(async (elem) => await browser.isElementPresent(elem.element(by.cssContainingText(DataTable.selectors.searchResultsRowLine, location)))) .filter(async (elem) => browser.isElementPresent(elem.element(by.cssContainingText(DataTable.selectors.searchResultsRowLine, location))))
.first(); .first();
} }
return this.body.element(by.cssContainingText(DataTable.selectors.searchResultsRow, name)); return this.body.element(by.cssContainingText(DataTable.selectors.searchResultsRow, name));
@@ -27,6 +27,7 @@ import { ElementFinder, by, browser, ExpectedConditions as EC } from 'protractor
import { BROWSER_WAIT_TIMEOUT } from '../../configs'; import { BROWSER_WAIT_TIMEOUT } from '../../configs';
import { Component } from '../component'; import { Component } from '../component';
import * as moment from 'moment'; import * as moment from 'moment';
import { isPresentAndDisplayed } from '../../utilities/utils';
export class DateTimePicker extends Component { export class DateTimePicker extends Component {
private static selectors = { private static selectors = {
@@ -63,7 +64,9 @@ export class DateTimePicker extends Component {
} }
async isCalendarOpen(): Promise<boolean> { async isCalendarOpen(): Promise<boolean> {
return (await browser.element(this.rootElemLocator).isPresent()) && (await browser.element(this.rootElemLocator).isDisplayed()); const element = browser.element(this.rootElemLocator);
return isPresentAndDisplayed(element);
} }
async getDate(): Promise<string> { async getDate(): Promise<string> {
@@ -26,7 +26,7 @@
import { ElementFinder, by, browser, ExpectedConditions as EC, protractor } from 'protractor'; import { ElementFinder, by, browser, ExpectedConditions as EC, protractor } from 'protractor';
import { BROWSER_WAIT_TIMEOUT } from '../../configs'; import { BROWSER_WAIT_TIMEOUT } from '../../configs';
import { GenericDialog } from '../dialog/generic-dialog'; import { GenericDialog } from '../dialog/generic-dialog';
import { Utils } from '../../utilities/utils'; import { Utils, isPresentAndDisplayed } from '../../utilities/utils';
import { DropDownBreadcrumb } from '../breadcrumb/dropdown-breadcrumb'; import { DropDownBreadcrumb } from '../breadcrumb/dropdown-breadcrumb';
import { DataTable } from '../data-table/data-table'; import { DataTable } from '../data-table/data-table';
@@ -108,11 +108,11 @@ export class ContentNodeSelectorDialog extends GenericDialog {
} }
async isSearchInputPresent(): Promise<boolean> { async isSearchInputPresent(): Promise<boolean> {
return await this.searchInput.isPresent(); return this.searchInput.isPresent();
} }
async isSelectLocationDropdownDisplayed(): Promise<boolean> { async isSelectLocationDropdownDisplayed(): Promise<boolean> {
return (await this.locationDropDown.isPresent()) && (await this.locationDropDown.isDisplayed()); return isPresentAndDisplayed(this.locationDropDown);
} }
async isCopyButtonEnabled(): Promise<boolean> { async isCopyButtonEnabled(): Promise<boolean> {
@@ -130,6 +130,6 @@ export class ContentNodeSelectorDialog extends GenericDialog {
} }
async getToolbarTitle(): Promise<string> { async getToolbarTitle(): Promise<string> {
return await this.toolbarTitle.getText(); return this.toolbarTitle.getText();
} }
} }
@@ -26,6 +26,7 @@
import { ElementFinder, by, protractor, browser, ExpectedConditions as EC } from 'protractor'; import { ElementFinder, by, protractor, browser, ExpectedConditions as EC } from 'protractor';
import { BROWSER_WAIT_TIMEOUT } from '../../configs'; import { BROWSER_WAIT_TIMEOUT } from '../../configs';
import { GenericDialog } from '../dialog/generic-dialog'; import { GenericDialog } from '../dialog/generic-dialog';
import { isPresentAndDisplayed } from '../../utilities/utils';
export class CreateOrEditFolderDialog extends GenericDialog { export class CreateOrEditFolderDialog extends GenericDialog {
private static selectors = { private static selectors = {
@@ -55,7 +56,7 @@ export class CreateOrEditFolderDialog extends GenericDialog {
} }
async isValidationMessageDisplayed(): Promise<boolean> { async isValidationMessageDisplayed(): Promise<boolean> {
return (await this.validationMessage.isPresent()) && (await this.validationMessage.isDisplayed()); return isPresentAndDisplayed(this.validationMessage);
} }
async isUpdateButtonEnabled(): Promise<boolean> { async isUpdateButtonEnabled(): Promise<boolean> {
@@ -25,6 +25,7 @@
import { ElementFinder, by, protractor } from 'protractor'; import { ElementFinder, by, protractor } from 'protractor';
import { GenericDialog } from '../dialog/generic-dialog'; import { GenericDialog } from '../dialog/generic-dialog';
import { isPresentAndDisplayed } from '../../utilities/utils';
export class CreateFromTemplateDialog extends GenericDialog { export class CreateFromTemplateDialog extends GenericDialog {
private static selectors = { private static selectors = {
@@ -49,7 +50,7 @@ export class CreateFromTemplateDialog extends GenericDialog {
} }
async isValidationMessageDisplayed(): Promise<boolean> { async isValidationMessageDisplayed(): Promise<boolean> {
return (await this.validationMessage.isPresent()) && (await this.validationMessage.isDisplayed()); return isPresentAndDisplayed(this.validationMessage);
} }
async isCreateButtonEnabled(): Promise<boolean> { async isCreateButtonEnabled(): Promise<boolean> {
+3 -2
View File
@@ -25,6 +25,7 @@
import { ElementFinder, by, browser, ExpectedConditions as EC, Locator } from 'protractor'; import { ElementFinder, by, browser, ExpectedConditions as EC, Locator } from 'protractor';
import { BROWSER_WAIT_TIMEOUT } from '../../configs'; import { BROWSER_WAIT_TIMEOUT } from '../../configs';
import { isPresentAndDisplayed, isPresentAndEnabled } from '../../utilities/utils';
export abstract class GenericDialog { export abstract class GenericDialog {
private static locators = { private static locators = {
@@ -65,7 +66,7 @@ export abstract class GenericDialog {
} }
async isDialogOpen(): Promise<boolean> { async isDialogOpen(): Promise<boolean> {
return (await this.rootElem.isPresent()) && (await this.rootElem.isDisplayed()); return isPresentAndDisplayed(this.rootElem);
} }
async getTitle(): Promise<string> { async getTitle(): Promise<string> {
@@ -77,7 +78,7 @@ export abstract class GenericDialog {
} }
async isButtonEnabled(selector: Locator): Promise<boolean> { async isButtonEnabled(selector: Locator): Promise<boolean> {
return (await this.getActionButton(selector).isPresent()) && (await this.getActionButton(selector).isEnabled()); return isPresentAndEnabled(this.getActionButton(selector));
} }
async clickButton(selector: Locator): Promise<void> { async clickButton(selector: Locator): Promise<void> {
@@ -26,6 +26,7 @@
import { ElementFinder, ElementArrayFinder, by, browser, ExpectedConditions as EC } from 'protractor'; import { ElementFinder, ElementArrayFinder, by, browser, ExpectedConditions as EC } from 'protractor';
import { Component } from '../component'; import { Component } from '../component';
import { BROWSER_WAIT_TIMEOUT } from '../../configs'; import { BROWSER_WAIT_TIMEOUT } from '../../configs';
import { isPresentAndEnabled, isPresentAndDisplayed } from '../../utilities/utils';
export class ContentMetadata extends Component { export class ContentMetadata extends Component {
private static selectors = { private static selectors = {
@@ -66,14 +67,14 @@ export class ContentMetadata extends Component {
} }
async getVisiblePropertiesLabels() { async getVisiblePropertiesLabels() {
return await this.component.all(by.css(ContentMetadata.selectors.propertyLabel)) return this.component.all(by.css(ContentMetadata.selectors.propertyLabel))
.filter(async (elem) => await elem.isDisplayed()) .filter(async (elem) => elem.isDisplayed())
.map(async (elem) => await elem.getText()); .map(async (elem) => elem.getText());
} }
async getVisiblePropertiesValues() { async getVisiblePropertiesValues() {
return await this.component.all(by.css(ContentMetadata.selectors.propertyValue)) return this.component.all(by.css(ContentMetadata.selectors.propertyValue))
.filter(async (elem) => await elem.isDisplayed()) .filter(async (elem) => elem.isDisplayed())
.map(async (elem) => { .map(async (elem) => {
if (await elem.isElementPresent(by.css('.mat-checkbox'))) { if (await elem.isElementPresent(by.css('.mat-checkbox'))) {
if (await elem.isElementPresent(by.css('.mat-checkbox-checked'))) { if (await elem.isElementPresent(by.css('.mat-checkbox-checked'))) {
@@ -81,27 +82,27 @@ export class ContentMetadata extends Component {
} }
return false return false
} }
return await elem.getText(); return elem.getText();
}); });
} }
async isEditPropertiesButtonEnabled() { async isEditPropertiesButtonEnabled(): Promise<boolean> {
return (await browser.isElementPresent(this.editPropertiesButton)) && (await this.editPropertiesButton.isEnabled()); return isPresentAndEnabled(this.editPropertiesButton);
} }
async isLessInfoButtonEnabled() { async isLessInfoButtonEnabled(): Promise<boolean> {
return (await browser.isElementPresent(this.lessInfoButton)) && (await this.lessInfoButton.isEnabled()); return isPresentAndEnabled(this.lessInfoButton);
} }
async isMoreInfoButtonEnabled() { async isMoreInfoButtonEnabled(): Promise<boolean> {
return (await browser.isElementPresent(this.moreInfoButton)) && (await this.moreInfoButton.isEnabled()); return isPresentAndEnabled(this.moreInfoButton);
} }
async isLessInfoButtonDisplayed() { async isLessInfoButtonDisplayed() {
return browser.isElementPresent(this.lessInfoButton); return browser.isElementPresent(this.lessInfoButton);
} }
async isMoreInfoButtonDisplayed() { async isMoreInfoButtonDisplayed(): Promise<boolean> {
return browser.isElementPresent(this.moreInfoButton); return browser.isElementPresent(this.moreInfoButton);
} }
@@ -113,8 +114,8 @@ export class ContentMetadata extends Component {
await this.moreInfoButton.click(); await this.moreInfoButton.click();
} }
async isImagePropertiesPanelDisplayed() { async isImagePropertiesPanelDisplayed(): Promise<boolean> {
return (await browser.isElementPresent(this.imagePropertiesPanel)) && (await this.imagePropertiesPanel.isDisplayed()); return isPresentAndDisplayed(this.imagePropertiesPanel);
} }
async clickImagePropertiesPanel() { async clickImagePropertiesPanel() {
+7 -7
View File
@@ -27,7 +27,7 @@ import { ElementFinder, ElementArrayFinder, by, browser, ExpectedConditions as E
import { Logger } from '@alfresco/adf-testing'; import { Logger } from '@alfresco/adf-testing';
import { BROWSER_WAIT_TIMEOUT } from '../../configs'; import { BROWSER_WAIT_TIMEOUT } from '../../configs';
import { Component } from '../component'; import { Component } from '../component';
import { Utils } from '../../utilities/utils' import { Utils, isPresentAndEnabled } from '../../utilities/utils'
export class Menu extends Component { export class Menu extends Component {
private static selectors = { private static selectors = {
@@ -357,27 +357,27 @@ export class Menu extends Component {
} }
async isCreateFolderEnabled(): Promise<boolean> { async isCreateFolderEnabled(): Promise<boolean> {
return (await this.createFolderAction.isPresent()) && (await this.createFolderAction.isEnabled()); return isPresentAndEnabled(this.createFolderAction);
} }
async isCreateLibraryEnabled(): Promise<boolean> { async isCreateLibraryEnabled(): Promise<boolean> {
return (await this.createLibraryAction.isPresent()) && (await this.createLibraryAction.isEnabled()); return isPresentAndEnabled(this.createLibraryAction);
} }
async isUploadFileEnabled(): Promise<boolean> { async isUploadFileEnabled(): Promise<boolean> {
return (await this.uploadFileAction.isPresent()) && (await this.uploadFileAction.isEnabled()); return isPresentAndEnabled(this.uploadFileAction);
} }
async isUploadFolderEnabled(): Promise<boolean> { async isUploadFolderEnabled(): Promise<boolean> {
return (await this.uploadFolderAction.isPresent()) && (await this.uploadFolderAction.isEnabled()); return isPresentAndEnabled(this.uploadFolderAction);
} }
async isCreateFileFromTemplateEnabled(): Promise<boolean> { async isCreateFileFromTemplateEnabled(): Promise<boolean> {
return (await this.createFileFromTemplateAction.isPresent()) && (await this.createFileFromTemplateAction.isEnabled()); return isPresentAndEnabled(this.createFileFromTemplateAction);
} }
async isCreateFolderFromTemplateEnabled(): Promise<boolean> { async isCreateFolderFromTemplateEnabled(): Promise<boolean> {
return (await this.createFolderFromTemplateAction.isPresent()) && (await this.createFolderFromTemplateAction.isEnabled()); return isPresentAndEnabled(this.createFolderFromTemplateAction);
} }
async clickCreateFolder(): Promise<void> { async clickCreateFolder(): Promise<void> {
@@ -25,7 +25,7 @@
import { ElementFinder, by, protractor } from 'protractor'; import { ElementFinder, by, protractor } from 'protractor';
import { GenericFilterPanel } from './generic-filter-panel'; import { GenericFilterPanel } from './generic-filter-panel';
import { Utils } from '../../../utilities/utils'; import { Utils, isPresentAndDisplayed } from '../../../utilities/utils';
export class CreatedDateFilter extends GenericFilterPanel { export class CreatedDateFilter extends GenericFilterPanel {
constructor() { constructor() {
@@ -42,27 +42,27 @@ export class CreatedDateFilter extends GenericFilterPanel {
applyButton: ElementFinder = this.panel.element(by.css('.adf-facet-buttons [data-automation-id="date-range-apply-btn"]')); applyButton: ElementFinder = this.panel.element(by.css('.adf-facet-buttons [data-automation-id="date-range-apply-btn"]'));
async isFromFieldDisplayed(): Promise<boolean> { async isFromFieldDisplayed(): Promise<boolean> {
return (await this.fromField.isPresent()) && (await this.fromField.isDisplayed()); return isPresentAndDisplayed(this.fromField);
} }
async isFromErrorDisplayed(): Promise<boolean> { async isFromErrorDisplayed(): Promise<boolean> {
return (await this.fromFieldError.isPresent()) && (await this.fromFieldError.isDisplayed()); return isPresentAndDisplayed(this.fromFieldError);
} }
async isToFieldDisplayed(): Promise<boolean> { async isToFieldDisplayed(): Promise<boolean> {
return (await this.toField.isPresent()) && (await this.toField.isDisplayed()); return isPresentAndDisplayed(this.toField);
} }
async isToErrorDisplayed(): Promise<boolean> { async isToErrorDisplayed(): Promise<boolean> {
return (await this.toFieldError.isPresent()) && (await this.toFieldError.isDisplayed()); return isPresentAndDisplayed(this.toFieldError);
} }
async isClearButtonEnabled(): Promise<boolean> { async isClearButtonEnabled(): Promise<boolean> {
return await this.clearButton.isEnabled(); return this.clearButton.isEnabled();
} }
async isApplyButtonEnabled(): Promise<boolean> { async isApplyButtonEnabled(): Promise<boolean> {
return await this.applyButton.isEnabled(); return this.applyButton.isEnabled();
} }
async clickClearButton(): Promise<void> { async clickClearButton(): Promise<void> {
@@ -66,11 +66,11 @@ export class FacetFilter extends GenericFilterPanel {
} }
async isFilterFacetsDisplayed(): Promise<boolean> { async isFilterFacetsDisplayed(): Promise<boolean> {
return await this.facetsFilter.isDisplayed(); return this.facetsFilter.isDisplayed();
} }
async isClearButtonEnabled(): Promise<boolean> { async isClearButtonEnabled(): Promise<boolean> {
return await this.clearButton.isEnabled(); return this.clearButton.isEnabled();
} }
async clickClearButton(): Promise<void> { async clickClearButton(): Promise<void> {
@@ -80,7 +80,7 @@ export class FacetFilter extends GenericFilterPanel {
} }
async isFilterCategoryInputDisplayed(): Promise<boolean> { async isFilterCategoryInputDisplayed(): Promise<boolean> {
return await this.filterCategoryInput.isDisplayed(); return this.filterCategoryInput.isDisplayed();
} }
async checkCategory(name: string): Promise<void> { async checkCategory(name: string): Promise<void> {
@@ -24,6 +24,7 @@
*/ */
import { ElementFinder, by, browser } from 'protractor'; import { ElementFinder, by, browser } from 'protractor';
import { isPresentAndDisplayed } from '../../../utilities/utils';
export class GenericFilterPanel { export class GenericFilterPanel {
private filterName: string; private filterName: string;
@@ -49,11 +50,11 @@ export class GenericFilterPanel {
} }
async isPanelDisplayed(): Promise<boolean> { async isPanelDisplayed(): Promise<boolean> {
return (await browser.isElementPresent(this.panel)) && (await this.panel.isDisplayed()); return isPresentAndDisplayed(this.panel);
} }
async isPanelExpanded(): Promise<boolean> { async isPanelExpanded(): Promise<boolean> {
return (await this.panelExpanded.isPresent()) && (await this.panelExpanded.isDisplayed()); return isPresentAndDisplayed(this.panelExpanded);
} }
async expandPanel(): Promise<void> { async expandPanel(): Promise<void> {
+1 -1
View File
@@ -60,7 +60,7 @@ export class SizeFilter extends GenericFilterPanel {
} }
async isClearButtonEnabled(): Promise<boolean> { async isClearButtonEnabled(): Promise<boolean> {
return await this.clearButton.isEnabled(); return this.clearButton.isEnabled();
} }
async clickClearButton(): Promise<void> { async clickClearButton(): Promise<void> {
+2 -1
View File
@@ -28,6 +28,7 @@ import { Component } from '../component';
import { SizeFilter } from './filters/size-filter'; import { SizeFilter } from './filters/size-filter';
import { CreatedDateFilter } from './filters/created-date-filter'; import { CreatedDateFilter } from './filters/created-date-filter';
import { FacetFilter } from './filters/facet-filter'; import { FacetFilter } from './filters/facet-filter';
import { isPresentAndDisplayed } from '../../utilities/utils';
export class SearchFilters extends Component { export class SearchFilters extends Component {
private static selectors = { private static selectors = {
@@ -50,7 +51,7 @@ export class SearchFilters extends Component {
} }
async isSearchFiltersPanelDisplayed(): Promise<boolean> { async isSearchFiltersPanelDisplayed(): Promise<boolean> {
return (await this.mainPanel.isPresent()) && (await this.mainPanel.isDisplayed()); return isPresentAndDisplayed(this.mainPanel);
} }
async clickResetAllButton(): Promise<void> { async clickResetAllButton(): Promise<void> {
+4 -1
View File
@@ -63,7 +63,10 @@ export class SearchInput extends Component {
} }
async isSearchContainerDisplayed() { async isSearchContainerDisplayed() {
return (await this.searchContainer.isDisplayed()) && (await this.searchButton.isDisplayed()); const isContainerDisplayed = await this.searchContainer.isDisplayed();
const isSearchButtonDisplayed = await this.searchButton.isDisplayed();
return isContainerDisplayed && isSearchButtonDisplayed;
} }
async clickSearchButton() { async clickSearchButton() {
@@ -26,6 +26,7 @@
import { ElementFinder, by, browser, ExpectedConditions as EC, ElementArrayFinder } from 'protractor'; import { ElementFinder, by, browser, ExpectedConditions as EC, ElementArrayFinder } from 'protractor';
import { BROWSER_WAIT_TIMEOUT } from '../../configs'; import { BROWSER_WAIT_TIMEOUT } from '../../configs';
import { Component } from '../component'; import { Component } from '../component';
import { isPresentAndDisplayed } from '../../utilities/utils';
export class SearchSortingPicker extends Component { export class SearchSortingPicker extends Component {
private static selectors = { private static selectors = {
@@ -48,7 +49,7 @@ export class SearchSortingPicker extends Component {
} }
async isSortOrderButtonDisplayed(): Promise<boolean> { async isSortOrderButtonDisplayed(): Promise<boolean> {
return (await this.sortOrderButton.isPresent()) && (await this.sortOrderButton.isDisplayed()); return isPresentAndDisplayed(this.sortOrderButton);
} }
async getSortOrder(): Promise<'ASC' | 'DESC' | ''> { async getSortOrder(): Promise<'ASC' | 'DESC' | ''> {
@@ -64,15 +65,15 @@ export class SearchSortingPicker extends Component {
} }
async isSortByOptionDisplayed(): Promise<boolean> { async isSortByOptionDisplayed(): Promise<boolean> {
return (await this.sortByDropdownCollapsed.isPresent()) && (await this.sortByDropdownCollapsed.isDisplayed()); return isPresentAndDisplayed(this.sortByDropdownCollapsed);
} }
async isSortByDropdownExpanded(): Promise<boolean> { async isSortByDropdownExpanded(): Promise<boolean> {
return (await this.sortByDropdownExpanded.isPresent()) && (await this.sortByDropdownExpanded.isDisplayed()); return isPresentAndDisplayed(this.sortByDropdownExpanded);
} }
async getSelectedSortByOption(): Promise<string> { async getSelectedSortByOption(): Promise<string> {
return await this.sortByDropdownCollapsed.getText(); return this.sortByDropdownCollapsed.getText();
} }
async clickSortByDropdown(): Promise<void> { async clickSortByDropdown(): Promise<void> {
+1 -1
View File
@@ -79,7 +79,7 @@ export class Toolbar extends Component {
async getButtons(): Promise<string[]> { async getButtons(): Promise<string[]> {
return this.buttons.map(async elem => { return this.buttons.map(async elem => {
return await elem.getAttribute('title'); return elem.getAttribute('title');
}); });
} }
+2 -2
View File
@@ -52,11 +52,11 @@ export class SearchResultsPage extends BrowsingPage {
} }
async getResultsHeader(): Promise<string> { async getResultsHeader(): Promise<string> {
return await browser.element(by.css(SearchResultsPage.selectors.resultsContentHeader)).getText(); return browser.element(by.css(SearchResultsPage.selectors.resultsContentHeader)).getText();
} }
async getResultsFoundText(): Promise<string> { async getResultsFoundText(): Promise<string> {
return await this.infoText.getText(); return this.infoText.getText();
} }
async getResultsChipsValues(): Promise<string[]> { async getResultsChipsValues(): Promise<string[]> {
@@ -109,7 +109,7 @@ describe('Search results - libraries', () => {
}); });
afterAll(async (done) => { afterAll(async (done) => {
await Promise.all(<any>[ await Promise.all([
apis.admin.sites.deleteSites([ adminSite1, adminSite2, adminSite3, adminSite4, adminPrivate ]), apis.admin.sites.deleteSites([ adminSite1, adminSite2, adminSite3, adminSite4, adminPrivate ]),
apis.user.sites.deleteSites([ site1.id, site2.id, site3.id, site4.id, userSitePublic, userSiteModerated, userSitePrivate, siteRussian.id ]) apis.user.sites.deleteSites([ site1.id, site2.id, site3.id, site4.id, userSitePublic, userSiteModerated, userSitePrivate, siteRussian.id ])
]); ]);
+16 -16
View File
@@ -47,57 +47,57 @@ export class AdminActions {
search: SearchApi = new SearchApi(); search: SearchApi = new SearchApi();
async getDataDictionaryId(): Promise<string> { async getDataDictionaryId(): Promise<string> {
return await this.adminApi.nodes.getNodeIdFromParent('Data Dictionary', '-root-'); return this.adminApi.nodes.getNodeIdFromParent('Data Dictionary', '-root-');
} }
async getNodeTemplatesFolderId(): Promise<string> { async getNodeTemplatesFolderId(): Promise<string> {
return await this.adminApi.nodes.getNodeIdFromParent('Node Templates', await this.getDataDictionaryId()); return this.adminApi.nodes.getNodeIdFromParent('Node Templates', await this.getDataDictionaryId());
} }
async getSpaceTemplatesFolderId(): Promise<string> { async getSpaceTemplatesFolderId(): Promise<string> {
return await this.adminApi.nodes.getNodeIdFromParent('Space Templates', await this.getDataDictionaryId()); return this.adminApi.nodes.getNodeIdFromParent('Space Templates', await this.getDataDictionaryId());
} }
async createUser(user: PersonModel): Promise<PersonEntry> { async createUser(user: PersonModel): Promise<PersonEntry> {
return await this.adminApi.people.createUser(user); return this.adminApi.people.createUser(user);
} }
async createNodeTemplate(name: string, title: string = '', description: string = '', author: string = ''): Promise<NodeEntry> { async createNodeTemplate(name: string, title: string = '', description: string = '', author: string = ''): Promise<NodeEntry> {
const templatesRootFolderId: string = await this.getNodeTemplatesFolderId(); const templatesRootFolderId: string = await this.getNodeTemplatesFolderId();
return await this.adminApi.nodes.createFile(name, templatesRootFolderId, title, description, author); return this.adminApi.nodes.createFile(name, templatesRootFolderId, title, description, author);
} }
async createNodeTemplatesHierarchy(hierarchy: NodeContentTree): Promise<any> { async createNodeTemplatesHierarchy(hierarchy: NodeContentTree): Promise<any> {
return await this.adminApi.nodes.createContent(hierarchy, `Data Dictionary/Node Templates`); return this.adminApi.nodes.createContent(hierarchy, `Data Dictionary/Node Templates`);
} }
async createSpaceTemplate(name: string, title: string = '', description: string = ''): Promise<NodeEntry> { async createSpaceTemplate(name: string, title: string = '', description: string = ''): Promise<NodeEntry> {
const templatesRootFolderId: string = await this.getSpaceTemplatesFolderId(); const templatesRootFolderId: string = await this.getSpaceTemplatesFolderId();
return await this.adminApi.nodes.createFolder(name, templatesRootFolderId, title, description); return this.adminApi.nodes.createFolder(name, templatesRootFolderId, title, description);
} }
async createSpaceTemplatesHierarchy(hierarchy: NodeContentTree): Promise<any> { async createSpaceTemplatesHierarchy(hierarchy: NodeContentTree): Promise<any> {
return await this.adminApi.nodes.createContent(hierarchy, `Data Dictionary/Space Templates`); return this.adminApi.nodes.createContent(hierarchy, `Data Dictionary/Space Templates`);
} }
async removeUserAccessOnNodeTemplate(nodeName: string): Promise<NodeEntry> { async removeUserAccessOnNodeTemplate(nodeName: string): Promise<NodeEntry> {
const templatesRootFolderId = await this.getNodeTemplatesFolderId(); const templatesRootFolderId = await this.getNodeTemplatesFolderId();
const nodeId: string = await this.adminApi.nodes.getNodeIdFromParent(nodeName, templatesRootFolderId); const nodeId: string = await this.adminApi.nodes.getNodeIdFromParent(nodeName, templatesRootFolderId);
return await this.adminApi.nodes.setInheritPermissions(nodeId, false); return this.adminApi.nodes.setInheritPermissions(nodeId, false);
} }
async removeUserAccessOnSpaceTemplate(nodeName: string): Promise<NodeEntry> { async removeUserAccessOnSpaceTemplate(nodeName: string): Promise<NodeEntry> {
const templatesRootFolderId = await this.getSpaceTemplatesFolderId(); const templatesRootFolderId = await this.getSpaceTemplatesFolderId();
const nodeId: string = await this.adminApi.nodes.getNodeIdFromParent(nodeName, templatesRootFolderId); const nodeId: string = await this.adminApi.nodes.getNodeIdFromParent(nodeName, templatesRootFolderId);
return await this.adminApi.nodes.setInheritPermissions(nodeId, false); return this.adminApi.nodes.setInheritPermissions(nodeId, false);
} }
async cleanupNodeTemplatesFolder(): Promise<void> { async cleanupNodeTemplatesFolder(): Promise<void> {
return await this.adminApi.nodes.deleteNodeChildren(await this.getNodeTemplatesFolderId()); return this.adminApi.nodes.deleteNodeChildren(await this.getNodeTemplatesFolderId());
} }
async cleanupSpaceTemplatesFolder(): Promise<void> { async cleanupSpaceTemplatesFolder(): Promise<void> {
@@ -108,11 +108,11 @@ export class AdminActions {
const nodesToDelete = (await this.adminApi.nodes.getNodeChildren(spaceTemplatesNodeId)).list.entries const nodesToDelete = (await this.adminApi.nodes.getNodeChildren(spaceTemplatesNodeId)).list.entries
.filter(node => (node.entry.nodeType !== 'app:folderlink') && (node.entry.name !== 'Software Engineering Project')) .filter(node => (node.entry.nodeType !== 'app:folderlink') && (node.entry.name !== 'Software Engineering Project'))
.map(node => node.entry.id); .map(node => node.entry.id);
return await this.adminApi.nodes.deleteNodesById(nodesToDelete); return this.adminApi.nodes.deleteNodesById(nodesToDelete);
} }
async createLinkToFileId(originalFileId: string, destinationParentId: string): Promise<NodeEntry> { async createLinkToFileId(originalFileId: string, destinationParentId: string): Promise<NodeEntry> {
return await this.adminApi.nodes.createFileLink(originalFileId, destinationParentId); return this.adminApi.nodes.createFileLink(originalFileId, destinationParentId);
} }
async createLinkToFileName(originalFileName: string, originalFileParentId: string, destinationParentId?: string): Promise<NodeEntry> { async createLinkToFileName(originalFileName: string, originalFileParentId: string, destinationParentId?: string): Promise<NodeEntry> {
@@ -122,11 +122,11 @@ export class AdminActions {
const nodeId = await this.adminApi.nodes.getNodeIdFromParent(originalFileName, originalFileParentId); const nodeId = await this.adminApi.nodes.getNodeIdFromParent(originalFileName, originalFileParentId);
return await this.createLinkToFileId(nodeId, destinationParentId); return this.createLinkToFileId(nodeId, destinationParentId);
} }
async createLinkToFolderId(originalFolderId: string, destinationParentId: string): Promise<NodeEntry> { async createLinkToFolderId(originalFolderId: string, destinationParentId: string): Promise<NodeEntry> {
return await this.adminApi.nodes.createFolderLink(originalFolderId, destinationParentId); return this.adminApi.nodes.createFolderLink(originalFolderId, destinationParentId);
} }
async createLinkToFolderName(originalFolderName: string, originalFolderParentId: string, destinationParentId?: string): Promise<NodeEntry> { async createLinkToFolderName(originalFolderName: string, originalFolderParentId: string, destinationParentId?: string): Promise<NodeEntry> {
@@ -136,7 +136,7 @@ export class AdminActions {
const nodeId = await this.adminApi.nodes.getNodeIdFromParent(originalFolderName, originalFolderParentId); const nodeId = await this.adminApi.nodes.getNodeIdFromParent(originalFolderName, originalFolderParentId);
return await this.createLinkToFolderId(nodeId, destinationParentId); return this.createLinkToFolderId(nodeId, destinationParentId);
} }
} }
@@ -287,7 +287,7 @@ export class NodesApi extends RepoApi {
async createChildren(data: NodeBodyCreate[]): Promise<NodeEntry|any> { async createChildren(data: NodeBodyCreate[]): Promise<NodeEntry|any> {
try { try {
await this.apiAuth(); await this.apiAuth();
return await this.nodesApi.createNode('-my-', <any>data); return await this.nodesApi.createNode('-my-', data as any);
} catch (error) { } catch (error) {
this.handleError(`${this.constructor.name} ${this.createChildren.name}`, error); this.handleError(`${this.constructor.name} ${this.createChildren.name}`, error);
} }
@@ -443,9 +443,9 @@ export class NodesApi extends RepoApi {
// lock node // lock node
async lockFile(nodeId: string, lockType: string = 'ALLOW_OWNER_CHANGES'): Promise<NodeEntry|null> { async lockFile(nodeId: string, lockType: string = 'ALLOW_OWNER_CHANGES'): Promise<NodeEntry|null> {
const data = <NodeBodyLock>{ const data = {
type: lockType type: lockType
}; } as NodeBodyLock;
try { try {
await this.apiAuth(); await this.apiAuth();
@@ -25,7 +25,7 @@
import { PersonModel, Person } from './people-api-models'; import { PersonModel, Person } from './people-api-models';
import { RepoApi } from '../repo-api'; import { RepoApi } from '../repo-api';
import { PeopleApi as AdfPeopleApi} from '@alfresco/js-api'; import { PeopleApi as AdfPeopleApi } from '@alfresco/js-api';
export class PeopleApi extends RepoApi { export class PeopleApi extends RepoApi {
peopleApi = new AdfPeopleApi(this.alfrescoJsApi); peopleApi = new AdfPeopleApi(this.alfrescoJsApi);
@@ -53,7 +53,7 @@ export class SharedLinksApi extends RepoApi {
try { try {
return await ids.reduce(async (previous: any, current: any) => { return await ids.reduce(async (previous: any, current: any) => {
await previous; await previous;
return await this.shareFileById(current); return this.shareFileById(current);
}, Promise.resolve()); }, Promise.resolve());
} catch (error) { } catch (error) {
this.handleError(`${this.constructor.name} ${this.shareFilesByIds.name}`, error); this.handleError(`${this.constructor.name} ${this.shareFilesByIds.name}`, error);
@@ -97,12 +97,12 @@ export class SitesApi extends RepoApi {
} }
async createSite(title: string, visibility?: string, description?: string, siteId?: string): Promise<SiteEntry|null> { async createSite(title: string, visibility?: string, description?: string, siteId?: string): Promise<SiteEntry|null> {
const site = <SiteBody>{ const site = {
title, title,
visibility: visibility || SITE_VISIBILITY.PUBLIC, visibility: visibility || SITE_VISIBILITY.PUBLIC,
description: description, description: description,
id: siteId || title id: siteId || title
}; } as SiteBody;
try { try {
await this.apiAuth(); await this.apiAuth();
@@ -125,7 +125,7 @@ export class SitesApi extends RepoApi {
try { try {
return titles.reduce(async (previous: any, current: any) => { return titles.reduce(async (previous: any, current: any) => {
await previous; await previous;
return await this.createSite(current, visibility); return this.createSite(current, visibility);
}, Promise.resolve()); }, Promise.resolve());
} catch (error) { } catch (error) {
this.handleError(`${this.constructor.name} ${this.createSites.name}`, error); this.handleError(`${this.constructor.name} ${this.createSites.name}`, error);
@@ -149,7 +149,7 @@ export class SitesApi extends RepoApi {
try { try {
return siteIds.reduce(async (previous, current) => { return siteIds.reduce(async (previous, current) => {
await previous; await previous;
return await this.deleteSite(current, permanent); return this.deleteSite(current, permanent);
}, Promise.resolve()); }, Promise.resolve());
} catch (error) { } catch (error) {
this.handleError(`${this.constructor.name} ${this.deleteSites.name}`, error); this.handleError(`${this.constructor.name} ${this.deleteSites.name}`, error);
@@ -162,7 +162,7 @@ export class SitesApi extends RepoApi {
return await siteIds.reduce(async (previous, current) => { return await siteIds.reduce(async (previous, current) => {
await previous; await previous;
return await this.deleteSite(current, permanent); return this.deleteSite(current, permanent);
}, Promise.resolve()); }, Promise.resolve());
} catch (error) { } catch (error) {
this.handleError(`${this.constructor.name} ${this.deleteAllUserSites.name}`, error); this.handleError(`${this.constructor.name} ${this.deleteAllUserSites.name}`, error);
@@ -170,9 +170,9 @@ export class SitesApi extends RepoApi {
} }
async updateSiteMember(siteId: string, userId: string, role: string) { async updateSiteMember(siteId: string, userId: string, role: string) {
const siteRole = <SiteMemberRoleBody>{ const siteRole = {
role: role role: role
}; } as SiteMemberRoleBody;
try { try {
await this.apiAuth(); await this.apiAuth();
@@ -184,10 +184,10 @@ export class SitesApi extends RepoApi {
} }
async addSiteMember(siteId: string, userId: string, role: string) { async addSiteMember(siteId: string, userId: string, role: string) {
const memberBody = <SiteMemberBody>{ const memberBody = {
id: userId, id: userId,
role: role role: role
}; } as SiteMemberBody;
try { try {
await this.apiAuth(); await this.apiAuth();
@@ -26,7 +26,7 @@
import { RepoApi } from '../repo-api'; import { RepoApi } from '../repo-api';
import { Logger } from '@alfresco/adf-testing'; import { Logger } from '@alfresco/adf-testing';
import { Utils } from '../../../../utilities/utils'; import { Utils } from '../../../../utilities/utils';
import { TrashcanApi as AdfTrashcanApi} from '@alfresco/js-api'; import { TrashcanApi as AdfTrashcanApi } from '@alfresco/js-api';
export class TrashcanApi extends RepoApi { export class TrashcanApi extends RepoApi {
trashcanApi = new AdfTrashcanApi(this.alfrescoJsApi); trashcanApi = new AdfTrashcanApi(this.alfrescoJsApi);
@@ -73,7 +73,7 @@ export class TrashcanApi extends RepoApi {
return await ids.reduce(async (previous, current) => { return await ids.reduce(async (previous, current) => {
await previous; await previous;
return await this.permanentlyDelete(current); return this.permanentlyDelete(current);
}, Promise.resolve()); }, Promise.resolve());
} catch (error) { } catch (error) {
this.handleError(`${this.constructor.name} ${this.emptyTrash.name}`, error); this.handleError(`${this.constructor.name} ${this.emptyTrash.name}`, error);
+21 -1
View File
@@ -31,6 +31,26 @@ const path = require('path');
const fs = require('fs'); const fs = require('fs');
const StreamZip = require('node-stream-zip'); const StreamZip = require('node-stream-zip');
export const isPresentAndEnabled = async (element: ElementFinder): Promise<boolean> => {
const isPresent = await element.isPresent();
if (isPresent) {
return element.isEnabled();
}
return false;
};
export const isPresentAndDisplayed = async (element: ElementFinder): Promise<boolean> => {
const isPresent = await element.isPresent();
if (isPresent) {
return element.isDisplayed();
}
return false;
};
export class Utils { export class Utils {
static string257 = 'assembly doctor offender limit clearance inspiration baker fraud active apples trait brainstorm concept breaks down presidential \ static string257 = 'assembly doctor offender limit clearance inspiration baker fraud active apples trait brainstorm concept breaks down presidential \
reluctance summary communication patience books opponent banana economist head develop project swear unanimous read conservation'; reluctance summary communication patience books opponent banana economist head develop project swear unanimous read conservation';
@@ -56,7 +76,7 @@ export class Utils {
} }
static async getSessionStorage(): Promise<any> { static async getSessionStorage(): Promise<any> {
return await browser.executeScript('return window.sessionStorage.getItem("app.extension.config");'); return browser.executeScript('return window.sessionStorage.getItem("app.extension.config");');
} }
static async setSessionStorageFromConfig(configFileName: string): Promise<void> { static async setSessionStorageFromConfig(configFileName: string): Promise<void> {
+266 -27
View File
@@ -52,12 +52,12 @@
"integrity": "sha512-BdS1kmDlu2X9gy10zwjbCohTtp+P40cFEwOyt3QF+rV+XR5MHwHkqawFsw5MDxsXoYoomaB8AJFBdPKlQRS25A==" "integrity": "sha512-BdS1kmDlu2X9gy10zwjbCohTtp+P40cFEwOyt3QF+rV+XR5MHwHkqawFsw5MDxsXoYoomaB8AJFBdPKlQRS25A=="
}, },
"@angular-devkit/architect": { "@angular-devkit/architect": {
"version": "0.13.1", "version": "0.13.10",
"resolved": "https://registry.npmjs.org/@angular-devkit/architect/-/architect-0.13.1.tgz", "resolved": "https://registry.npmjs.org/@angular-devkit/architect/-/architect-0.13.10.tgz",
"integrity": "sha512-QDmIbqde75ZZSEFbw6Q6kQWq4cY6C7D67yujXw6XTyubDNAs1tyXJyxTIB8vjSlEKwRizTTDd/B0ZXVcke3Mvw==", "integrity": "sha512-FC+YmeXwFdNMmqnX1nIOkXBQMxWQSbgYz5crWcb7FtOWTNH1IgM/22tZ6lpf3kiAfTtBbnb7oTkA4Y69nUaoQg==",
"dev": true, "dev": true,
"requires": { "requires": {
"@angular-devkit/core": "7.3.1", "@angular-devkit/core": "7.3.10",
"rxjs": "6.3.3" "rxjs": "6.3.3"
}, },
"dependencies": { "dependencies": {
@@ -239,13 +239,13 @@
} }
}, },
"@angular-devkit/build-ng-packagr": { "@angular-devkit/build-ng-packagr": {
"version": "0.13.1", "version": "0.13.10",
"resolved": "https://registry.npmjs.org/@angular-devkit/build-ng-packagr/-/build-ng-packagr-0.13.1.tgz", "resolved": "https://registry.npmjs.org/@angular-devkit/build-ng-packagr/-/build-ng-packagr-0.13.10.tgz",
"integrity": "sha512-9qvdNvtlgJ3WDppbzwD9fOQzAsVogBlDeLE5zUH1ap+zcoyZEGjS1BKluiYSJ1u5Q5Nlfb3FSI/D1r9LuDQS/A==", "integrity": "sha512-e1HB39RT/tnQ9cwk6AhPhyJEaPIwt1O9pphbskeC4layUKzVqPK/Gay4pFhExDXO0vmY4ynqy3EhlllG+AZg/A==",
"dev": true, "dev": true,
"requires": { "requires": {
"@angular-devkit/architect": "0.13.1", "@angular-devkit/architect": "0.13.10",
"@angular-devkit/core": "7.3.1", "@angular-devkit/core": "7.3.10",
"rxjs": "6.3.3", "rxjs": "6.3.3",
"semver": "5.6.0" "semver": "5.6.0"
}, },
@@ -339,12 +339,12 @@
} }
}, },
"@angular-devkit/core": { "@angular-devkit/core": {
"version": "7.3.1", "version": "7.3.10",
"resolved": "https://registry.npmjs.org/@angular-devkit/core/-/core-7.3.1.tgz", "resolved": "https://registry.npmjs.org/@angular-devkit/core/-/core-7.3.10.tgz",
"integrity": "sha512-56XDWWfIzOAkEk69lBLgmCYybPUA4yjunhmMlCk7vVdb7gbQUyzNjFD04Uj0GjlejatAQ5F76tRwygD9C+3RXQ==", "integrity": "sha512-h8Yj2+UfBsPI7jZ8X88tImO/7RPgNWUcKF8Uq/J5eUSN6z0FMO0lluD4sM7X8aikb7RK8MwkwrqB/xfxvvkOow==",
"dev": true, "dev": true,
"requires": { "requires": {
"ajv": "6.7.0", "ajv": "6.9.1",
"chokidar": "2.0.4", "chokidar": "2.0.4",
"fast-json-stable-stringify": "2.0.0", "fast-json-stable-stringify": "2.0.0",
"rxjs": "6.3.3", "rxjs": "6.3.3",
@@ -352,9 +352,9 @@
}, },
"dependencies": { "dependencies": {
"ajv": { "ajv": {
"version": "6.7.0", "version": "6.9.1",
"resolved": "https://registry.npmjs.org/ajv/-/ajv-6.7.0.tgz", "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.9.1.tgz",
"integrity": "sha512-RZXPviBTtfmtka9n9sy1N5M5b82CbxWIR6HIis4s3WQTXDJamc/0gpCWNGz6EWdWp4DOfjzJfhz/AS9zVPjjWg==", "integrity": "sha512-XDN92U311aINL77ieWHmqCcNlwjoP5cHXDxIxbf2MaPYuCXOHS7gHH8jktxeK5omgd52XbSTX6a4Piwd1pQmzA==",
"dev": true, "dev": true,
"requires": { "requires": {
"fast-deep-equal": "^2.0.1", "fast-deep-equal": "^2.0.1",
@@ -4802,6 +4802,12 @@
"minimalistic-crypto-utils": "^1.0.0" "minimalistic-crypto-utils": "^1.0.0"
} }
}, },
"emoji-regex": {
"version": "8.0.0",
"resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz",
"integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==",
"dev": true
},
"emojis-list": { "emojis-list": {
"version": "2.1.0", "version": "2.1.0",
"resolved": "https://registry.npmjs.org/emojis-list/-/emojis-list-2.1.0.tgz", "resolved": "https://registry.npmjs.org/emojis-list/-/emojis-list-2.1.0.tgz",
@@ -4997,6 +5003,16 @@
"resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz",
"integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=" "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ="
}, },
"eslint-plugin-prettier": {
"version": "2.7.0",
"resolved": "https://registry.npmjs.org/eslint-plugin-prettier/-/eslint-plugin-prettier-2.7.0.tgz",
"integrity": "sha512-CStQYJgALoQBw3FsBzH0VOVDRnJ/ZimUlpLm226U8qgqYJfPOY/CPK6wyRInMxh73HSKg5wyRwdS4BVYYHwokA==",
"dev": true,
"requires": {
"fast-diff": "^1.1.1",
"jest-docblock": "^21.0.0"
}
},
"eslint-scope": { "eslint-scope": {
"version": "4.0.3", "version": "4.0.3",
"resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-4.0.3.tgz", "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-4.0.3.tgz",
@@ -5549,6 +5565,12 @@
"resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-2.0.1.tgz", "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-2.0.1.tgz",
"integrity": "sha1-ewUhjd+WZ79/Nwv3/bLLFf3Qqkk=" "integrity": "sha1-ewUhjd+WZ79/Nwv3/bLLFf3Qqkk="
}, },
"fast-diff": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/fast-diff/-/fast-diff-1.2.0.tgz",
"integrity": "sha512-xJuoT5+L99XlZ8twedaRf6Ax2TgQVxvgZOYoPKqZufmJib0tL2tegPBOZb1pVNgIhlqDlA0eO0c3wBvQcmzx4w==",
"dev": true
},
"fast-json-patch": { "fast-json-patch": {
"version": "2.2.1", "version": "2.2.1",
"resolved": "https://registry.npmjs.org/fast-json-patch/-/fast-json-patch-2.2.1.tgz", "resolved": "https://registry.npmjs.org/fast-json-patch/-/fast-json-patch-2.2.1.tgz",
@@ -7984,6 +8006,12 @@
"integrity": "sha1-43zwsX8ZnM4jvqcbIDk5Uka07E4=", "integrity": "sha1-43zwsX8ZnM4jvqcbIDk5Uka07E4=",
"dev": true "dev": true
}, },
"jest-docblock": {
"version": "21.2.0",
"resolved": "https://registry.npmjs.org/jest-docblock/-/jest-docblock-21.2.0.tgz",
"integrity": "sha512-5IZ7sY9dBAYSV+YjQ0Ovb540Ku7AO9Z5o2Cg789xj167iQuZ2cG+z0f3Uct6WeYLbU6aQiM2pCs7sZ+4dotydw==",
"dev": true
},
"js-base64": { "js-base64": {
"version": "2.5.1", "version": "2.5.1",
"resolved": "https://registry.npmjs.org/js-base64/-/js-base64-2.5.1.tgz", "resolved": "https://registry.npmjs.org/js-base64/-/js-base64-2.5.1.tgz",
@@ -11910,6 +11938,211 @@
"tslib": "^1.9.0" "tslib": "^1.9.0"
} }
}, },
"rxjs-tslint": {
"version": "0.1.8",
"resolved": "https://registry.npmjs.org/rxjs-tslint/-/rxjs-tslint-0.1.8.tgz",
"integrity": "sha512-4MNcco1pugjNyjkUkvJ9ngJSMCuwmyc1g6EkEYzlTK0PrZxm8xVaBeBz5aPLE3AzldQbYkOErOVAayUlzQkjAg==",
"dev": true,
"requires": {
"chalk": "^2.4.0",
"tslint": "^5.9.1",
"tsutils": "^2.25.0",
"typescript": ">=2.8.3",
"yargs": "^15.3.1"
},
"dependencies": {
"ansi-regex": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.0.tgz",
"integrity": "sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg==",
"dev": true
},
"ansi-styles": {
"version": "4.2.1",
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz",
"integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==",
"dev": true,
"requires": {
"@types/color-name": "^1.1.1",
"color-convert": "^2.0.1"
}
},
"camelcase": {
"version": "5.3.1",
"resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz",
"integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==",
"dev": true
},
"cliui": {
"version": "6.0.0",
"resolved": "https://registry.npmjs.org/cliui/-/cliui-6.0.0.tgz",
"integrity": "sha512-t6wbgtoCXvAzst7QgXxJYqPt0usEfbgQdftEPbLL/cvv6HPE5VgvqCuAIDR0NgU52ds6rFwqrgakNLrHEjCbrQ==",
"dev": true,
"requires": {
"string-width": "^4.2.0",
"strip-ansi": "^6.0.0",
"wrap-ansi": "^6.2.0"
}
},
"color-convert": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
"integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==",
"dev": true,
"requires": {
"color-name": "~1.1.4"
}
},
"color-name": {
"version": "1.1.4",
"resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
"integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==",
"dev": true
},
"find-up": {
"version": "4.1.0",
"resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz",
"integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==",
"dev": true,
"requires": {
"locate-path": "^5.0.0",
"path-exists": "^4.0.0"
}
},
"get-caller-file": {
"version": "2.0.5",
"resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz",
"integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==",
"dev": true
},
"is-fullwidth-code-point": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz",
"integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==",
"dev": true
},
"locate-path": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz",
"integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==",
"dev": true,
"requires": {
"p-locate": "^4.1.0"
}
},
"p-limit": {
"version": "2.3.0",
"resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz",
"integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==",
"dev": true,
"requires": {
"p-try": "^2.0.0"
}
},
"p-locate": {
"version": "4.1.0",
"resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz",
"integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==",
"dev": true,
"requires": {
"p-limit": "^2.2.0"
}
},
"p-try": {
"version": "2.2.0",
"resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz",
"integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==",
"dev": true
},
"path-exists": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz",
"integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==",
"dev": true
},
"require-main-filename": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-2.0.0.tgz",
"integrity": "sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg==",
"dev": true
},
"string-width": {
"version": "4.2.0",
"resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.0.tgz",
"integrity": "sha512-zUz5JD+tgqtuDjMhwIg5uFVV3dtqZ9yQJlZVfq4I01/K5Paj5UHj7VyrQOJvzawSVlKpObApbfD0Ed6yJc+1eg==",
"dev": true,
"requires": {
"emoji-regex": "^8.0.0",
"is-fullwidth-code-point": "^3.0.0",
"strip-ansi": "^6.0.0"
}
},
"strip-ansi": {
"version": "6.0.0",
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.0.tgz",
"integrity": "sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w==",
"dev": true,
"requires": {
"ansi-regex": "^5.0.0"
}
},
"tsutils": {
"version": "2.29.0",
"resolved": "https://registry.npmjs.org/tsutils/-/tsutils-2.29.0.tgz",
"integrity": "sha512-g5JVHCIJwzfISaXpXE1qvNalca5Jwob6FjI4AoPlqMusJ6ftFE7IkkFoMhVLRgK+4Kx3gkzb8UZK5t5yTTvEmA==",
"dev": true,
"requires": {
"tslib": "^1.8.1"
}
},
"which-module": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/which-module/-/which-module-2.0.0.tgz",
"integrity": "sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho=",
"dev": true
},
"wrap-ansi": {
"version": "6.2.0",
"resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-6.2.0.tgz",
"integrity": "sha512-r6lPcBGxZXlIcymEu7InxDMhdW0KDxpLgoFLcguasxCaJ/SOIZwINatK9KY/tf+ZrlywOKU0UDj3ATXUBfxJXA==",
"dev": true,
"requires": {
"ansi-styles": "^4.0.0",
"string-width": "^4.1.0",
"strip-ansi": "^6.0.0"
}
},
"yargs": {
"version": "15.3.1",
"resolved": "https://registry.npmjs.org/yargs/-/yargs-15.3.1.tgz",
"integrity": "sha512-92O1HWEjw27sBfgmXiixJWT5hRBp2eobqXicLtPBIDBhYB+1HpwZlXmbW2luivBJHBzki+7VyCLRtAkScbTBQA==",
"dev": true,
"requires": {
"cliui": "^6.0.0",
"decamelize": "^1.2.0",
"find-up": "^4.1.0",
"get-caller-file": "^2.0.1",
"require-directory": "^2.1.1",
"require-main-filename": "^2.0.0",
"set-blocking": "^2.0.0",
"string-width": "^4.2.0",
"which-module": "^2.0.0",
"y18n": "^4.0.0",
"yargs-parser": "^18.1.1"
}
},
"yargs-parser": {
"version": "18.1.3",
"resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-18.1.3.tgz",
"integrity": "sha512-o50j0JeToy/4K6OZcaQmW6lyXXKhq7csREXcDwk2omFPJEwUNOVtJKvmDr9EI1fAJZUyZcRF7kxGBWmRXudrCQ==",
"dev": true,
"requires": {
"camelcase": "^5.0.0",
"decamelize": "^1.2.0"
}
}
}
},
"rxjs-tslint-rules": { "rxjs-tslint-rules": {
"version": "4.30.1", "version": "4.30.1",
"resolved": "https://registry.npmjs.org/rxjs-tslint-rules/-/rxjs-tslint-rules-4.30.1.tgz", "resolved": "https://registry.npmjs.org/rxjs-tslint-rules/-/rxjs-tslint-rules-4.30.1.tgz",
@@ -13682,17 +13915,6 @@
"yn": "^3.0.0" "yn": "^3.0.0"
} }
}, },
"tsickle": {
"version": "0.34.0",
"resolved": "https://registry.npmjs.org/tsickle/-/tsickle-0.34.0.tgz",
"integrity": "sha512-O3wCPRtL18Hc/ZBnaiKwmmjVzeCWTOTpsi0btfC7FWL3RnXpxLPxD6hoJ0QEXuSfG/0QJk+MWNjqT9N6fOyyIg==",
"dev": true,
"requires": {
"minimist": "^1.2.0",
"mkdirp": "^0.5.1",
"source-map": "^0.7.3"
}
},
"tslib": { "tslib": {
"version": "1.11.1", "version": "1.11.1",
"resolved": "https://registry.npmjs.org/tslib/-/tslib-1.11.1.tgz", "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.11.1.tgz",
@@ -13751,6 +13973,23 @@
} }
} }
}, },
"tslint-config-prettier": {
"version": "1.18.0",
"resolved": "https://registry.npmjs.org/tslint-config-prettier/-/tslint-config-prettier-1.18.0.tgz",
"integrity": "sha512-xPw9PgNPLG3iKRxmK7DWr+Ea/SzrvfHtjFt5LBl61gk2UBG/DB9kCXRjv+xyIU1rUtnayLeMUVJBcMX8Z17nDg==",
"dev": true
},
"tslint-plugin-prettier": {
"version": "2.3.0",
"resolved": "https://registry.npmjs.org/tslint-plugin-prettier/-/tslint-plugin-prettier-2.3.0.tgz",
"integrity": "sha512-F9e4K03yc9xuvv+A0v1EmjcnDwpz8SpCD8HzqSDe0eyg34cBinwn9JjmnnRrNAs4HdleRQj7qijp+P/JTxt4vA==",
"dev": true,
"requires": {
"eslint-plugin-prettier": "^2.2.0",
"lines-and-columns": "^1.1.6",
"tslib": "^1.7.1"
}
},
"tsutils": { "tsutils": {
"version": "3.17.1", "version": "3.17.1",
"resolved": "https://registry.npmjs.org/tsutils/-/tsutils-3.17.1.tgz", "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-3.17.1.tgz",
+5 -5
View File
@@ -18,7 +18,7 @@
"build.e2e": "npm run build.extensions && npm run build.app -- --prod --configuration=e2e", "build.e2e": "npm run build.extensions && npm run build.app -- --prod --configuration=e2e",
"test": "ng test app --code-coverage", "test": "ng test app --code-coverage",
"test:ci": "npm run build.extensions && ng test adf-office-services-ext --watch=false && ng test app --code-coverage --watch=false", "test:ci": "npm run build.extensions && ng test adf-office-services-ext --watch=false && ng test app --code-coverage --watch=false",
"lint": "ng lint && npm run spellcheck && npm run format:check && npm run e2e.typecheck", "lint": "ng lint && npm run spellcheck && npm run e2e.typecheck",
"e2e.typecheck": "tsc -p ./e2e/tsconfig.e2e.typecheck.json", "e2e.typecheck": "tsc -p ./e2e/tsconfig.e2e.typecheck.json",
"e2e": "protractor --baseUrl=${TEST_BASE_URL:-http://localhost:8080/content-app} $SUITE", "e2e": "protractor --baseUrl=${TEST_BASE_URL:-http://localhost:8080/content-app} $SUITE",
"e2e.local": "protractor --baseUrl=http://localhost:4200 $SUITE", "e2e.local": "protractor --baseUrl=http://localhost:4200 $SUITE",
@@ -28,8 +28,6 @@
"e2e:docker": "./start.sh && npm run e2e && ./start.sh -d", "e2e:docker": "./start.sh && npm run e2e && ./start.sh -d",
"spellcheck": "cspell '{src,e2e,projects}/**/*.ts'", "spellcheck": "cspell '{src,e2e,projects}/**/*.ts'",
"inspect.bundle": "ng build app --prod --stats-json && npx webpack-bundle-analyzer dist/app/stats.json", "inspect.bundle": "ng build app --prod --stats-json && npx webpack-bundle-analyzer dist/app/stats.json",
"format:check": "prettier --check \"src/{app,environments}/**/*.{ts,js,css,scss,html}\"",
"format:fix": "prettier --write \"src/{app,environments}/**/*.{ts,js,css,scss,html}\"",
"build.tomcat": "npm run validate-config && npm run build.extensions && npm run build.app -- --prod --base-href ./ && jar -cvf docker/tomcat/artifacts/content-app.war -C dist/app/ .", "build.tomcat": "npm run validate-config && npm run build.extensions && npm run build.app -- --prod --base-href ./ && jar -cvf docker/tomcat/artifacts/content-app.war -C dist/app/ .",
"build.tomcat.e2e": "./build-tomcat-e2e.sh", "build.tomcat.e2e": "./build-tomcat-e2e.sh",
"e2e.tomcat": "protractor --baseUrl=http://localhost:8080/content-app/ $SUITE", "e2e.tomcat": "protractor --baseUrl=http://localhost:8080/content-app/ $SUITE",
@@ -77,7 +75,7 @@
}, },
"devDependencies": { "devDependencies": {
"@angular-devkit/build-angular": "~0.13.9", "@angular-devkit/build-angular": "~0.13.9",
"@angular-devkit/build-ng-packagr": "~0.13.0", "@angular-devkit/build-ng-packagr": "^0.13.10",
"@angular/cli": "^7.3.9", "@angular/cli": "^7.3.9",
"@angular/compiler-cli": "7.2.15", "@angular/compiler-cli": "7.2.15",
"@angular/language-service": "7.2.15", "@angular/language-service": "7.2.15",
@@ -112,12 +110,14 @@
"protractor": "5.4.2", "protractor": "5.4.2",
"protractor-screenshoter-plugin": "0.10.3", "protractor-screenshoter-plugin": "0.10.3",
"puppeteer": "2.1.1", "puppeteer": "2.1.1",
"rxjs-tslint": "^0.1.8",
"rxjs-tslint-rules": "^4.30.1", "rxjs-tslint-rules": "^4.30.1",
"selenium-webdriver": "4.0.0-alpha.1", "selenium-webdriver": "4.0.0-alpha.1",
"ts-node": "^8.0.3", "ts-node": "^8.0.3",
"tsickle": "0.34.0",
"tslib": "^1.11.1", "tslib": "^1.11.1",
"tslint": "^5.20.1", "tslint": "^5.20.1",
"tslint-config-prettier": "^1.18.0",
"tslint-plugin-prettier": "^2.3.0",
"typescript": "3.2.4", "typescript": "3.2.4",
"wait-on": "^4.0.1", "wait-on": "^4.0.1",
"webdriver-manager": "12.1.7" "webdriver-manager": "12.1.7"
@@ -28,8 +28,9 @@ import { ContextMenu } from '@alfresco/aca-shared/store';
import { fakeAsync, tick } from '@angular/core/testing'; import { fakeAsync, tick } from '@angular/core/testing';
describe('ContextActionsDirective', () => { describe('ContextActionsDirective', () => {
let directive; let directive: ContextActionsDirective;
const storeMock = <any>{
const storeMock: any = {
dispatch: jasmine.createSpy('dispatch') dispatch: jasmine.createSpy('dispatch')
}; };
@@ -52,7 +53,7 @@ describe('ContextActionsDirective', () => {
const fragment = document.createDocumentFragment(); const fragment = document.createDocumentFragment();
fragment.appendChild(el); fragment.appendChild(el);
const target = fragment.querySelector('div'); const target = fragment.querySelector('div');
const mouseEventMock = <any>{ preventDefault: () => {}, target }; const mouseEventMock: any = { preventDefault: () => {}, target };
directive.ngOnInit(); directive.ngOnInit();
@@ -88,7 +88,8 @@ export class ContextActionsDirective implements OnInit, OnDestroy {
} }
private getTarget(event: MouseEvent): Element { private getTarget(event: MouseEvent): Element {
return this.findAncestor(<Element>event.target, 'adf-datatable-cell'); const target = event.target as Element;
return this.findAncestor(target, 'adf-datatable-cell');
} }
private isSelected(target: Element): boolean { private isSelected(target: Element): boolean {
@@ -38,7 +38,7 @@ describe('AppRouteReuseStrategy', () => {
}); });
it('should allow detach if route is configured to be reused', () => { it('should allow detach if route is configured to be reused', () => {
const route = <any>{ const route: any = {
routeConfig: { routeConfig: {
data: { data: {
reuse: true reuse: true
@@ -46,11 +46,11 @@ describe('AppRouteReuseStrategy', () => {
path: 'tested-path' path: 'tested-path'
} }
}; };
expect(appRouteReuse.shouldDetach(<any>route)).toBe(true); expect(appRouteReuse.shouldDetach(route)).toBe(true);
}); });
it('should store on routeCache', () => { it('should store on routeCache', () => {
const route = <any>{ const route: any = {
url: [], url: [],
routeConfig: { routeConfig: {
data: { data: {
@@ -63,11 +63,11 @@ describe('AppRouteReuseStrategy', () => {
children: [] children: []
}; };
appRouteReuse.store(route, { route: {} }); appRouteReuse.store(route, { route: {} });
expect(appRouteReuse.shouldAttach(<any>route)).toBe(true); expect(appRouteReuse.shouldAttach(route)).toBe(true);
}); });
it('should clear routeCache on resetCache', () => { it('should clear routeCache on resetCache', () => {
const route = <any>{ const route: any = {
url: [], url: [],
routeConfig: { routeConfig: {
data: { data: {
@@ -81,6 +81,6 @@ describe('AppRouteReuseStrategy', () => {
}; };
appRouteReuse.store(route, { route: {} }); appRouteReuse.store(route, { route: {} });
appRouteReuse.resetCache(); appRouteReuse.resetCache();
expect(appRouteReuse.shouldAttach(<any>route)).toBe(false); expect(appRouteReuse.shouldAttach(route)).toBe(false);
}); });
}); });
@@ -91,6 +91,6 @@ describe('AppService', () => {
isReady = value; isReady = value;
}); });
auth.onLogin.next(); auth.onLogin.next();
await expect(<any>isReady).toEqual(true); await expect(isReady).toEqual(true);
}); });
}); });
@@ -259,7 +259,7 @@ export class ContentApiService {
addFavorite(nodes: Array<MinimalNodeEntity>): Observable<FavoriteEntry> { addFavorite(nodes: Array<MinimalNodeEntity>): Observable<FavoriteEntry> {
const payload: FavoriteBody[] = nodes.map(node => { const payload: FavoriteBody[] = nodes.map(node => {
const { isFolder, nodeId, id } = <any>node.entry; const { isFolder, nodeId, id } = node.entry as any;
const siteId = node.entry['guid']; const siteId = node.entry['guid'];
const type = siteId ? 'site' : isFolder ? 'folder' : 'file'; const type = siteId ? 'site' : isFolder ? 'folder' : 'file';
const guid = siteId || nodeId || id; const guid = siteId || nodeId || id;
@@ -273,7 +273,7 @@ export class ContentApiService {
}; };
}); });
return from(this.api.favoritesApi.addFavorite('-me-', <any>payload)); return from(this.api.favoritesApi.addFavorite('-me-', payload as any));
} }
removeFavorite(nodes: Array<MinimalNodeEntity>): Observable<any> { removeFavorite(nodes: Array<MinimalNodeEntity>): Observable<any> {
@@ -90,7 +90,7 @@ export class RouterEffects {
const { path, id } = node; const { path, id } = node;
if (path && path.name && path.elements) { if (path && path.name && path.elements) {
const isLibraryPath = this.isLibraryContent(<PathInfoEntity>path); const isLibraryPath = this.isLibraryContent(path);
const parent = path.elements[path.elements.length - 1]; const parent = path.elements[path.elements.length - 1];
const area = isLibraryPath ? '/libraries' : '/personal-files'; const area = isLibraryPath ? '/libraries' : '/personal-files';
@@ -115,7 +115,7 @@ export class RouterEffects {
const { path } = node; const { path } = node;
if (path && path.name && path.elements) { if (path && path.name && path.elements) {
const isLibraryPath = this.isLibraryContent(<PathInfoEntity>path); const isLibraryPath = this.isLibraryContent(path);
const parent = path.elements[path.elements.length - 1]; const parent = path.elements[path.elements.length - 1];
const area = isLibraryPath ? '/libraries' : '/personal-files'; const area = isLibraryPath ? '/libraries' : '/personal-files';
@@ -2,7 +2,7 @@
"$schema": "../../node_modules/ng-packagr/ng-package.schema.json", "$schema": "../../node_modules/ng-packagr/ng-package.schema.json",
"dest": "../../dist/@alfresco/adf-office-services-ext", "dest": "../../dist/@alfresco/adf-office-services-ext",
"lib": { "lib": {
"entryFile": "src/public_api.ts", "entryFile": "src/public-api.ts",
"flatModuleFile": "adf-office-services-ext", "flatModuleFile": "adf-office-services-ext",
"umdModuleIds": { "umdModuleIds": {
"@alfresco/js-api": "@alfresco/js-api", "@alfresco/js-api": "@alfresco/js-api",
@@ -81,7 +81,7 @@ export class AosEditOnlineService {
private onAlreadyLockedNotification(nodeId: string, lockOwner: string) { private onAlreadyLockedNotification(nodeId: string, lockOwner: string) {
this.notificationService.openSnackMessage( this.notificationService.openSnackMessage(
`Document {nodeId} locked by {lockOwner}`, `Document ${nodeId} locked by ${lockOwner}`,
3000 3000
); );
} }
@@ -155,12 +155,12 @@ export class AosEditOnlineService {
} }
private isFile(node: MinimalNodeEntryEntity): boolean { private isFile(node: MinimalNodeEntryEntity): boolean {
const implicitFile = (<any>node).nodeId || (<any>node).guid; const implicitFile = (node as any).nodeId || (node as any).guid;
return !!implicitFile || node.isFile; return !!implicitFile || node.isFile;
} }
private getNodeId(node: MinimalNodeEntryEntity): string { private getNodeId(node: MinimalNodeEntryEntity): string {
return (<any>node).nodeId || (<any>node).guid || node.id; return (node as any).nodeId || (node as any).guid || node.id;
} }
} }
@@ -36,7 +36,7 @@ describe('evaluators', () => {
} }
}; };
expect(canOpenWithOffice(context, null)).toBeFalsy(); expect(canOpenWithOffice(context)).toBeFalsy();
}); });
it('should return [false] if no selection present', () => { it('should return [false] if no selection present', () => {
@@ -23,13 +23,10 @@
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>. * along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/ */
import { RuleContext, RuleParameter } from '@alfresco/adf-extensions'; import { RuleContext } from '@alfresco/adf-extensions';
import { getFileExtension, supportedExtensions } from './utils'; import { getFileExtension, supportedExtensions } from './utils';
export function canOpenWithOffice( export function canOpenWithOffice(context: RuleContext): boolean {
context: RuleContext,
...args: RuleParameter[]
): boolean {
if ( if (
context.navigation && context.navigation &&
context.navigation.url && context.navigation.url &&
+6 -6
View File
@@ -83,42 +83,42 @@ describe('AppComponent', () => {
describe('onFileUploadedError', () => { describe('onFileUploadedError', () => {
it('should dispatch 403 error message', () => { it('should dispatch 403 error message', () => {
component.onFileUploadedError(<any>{ error: { status: 403 } }); component.onFileUploadedError({ error: { status: 403 } } as any);
expect(storeMock.dispatch['calls'].argsFor(0)[0].payload).toBe( expect(storeMock.dispatch['calls'].argsFor(0)[0].payload).toBe(
'APP.MESSAGES.UPLOAD.ERROR.403' 'APP.MESSAGES.UPLOAD.ERROR.403'
); );
}); });
it('should dispatch 404 error message', () => { it('should dispatch 404 error message', () => {
component.onFileUploadedError(<any>{ error: { status: 404 } }); component.onFileUploadedError({ error: { status: 404 } } as any);
expect(storeMock.dispatch['calls'].argsFor(0)[0].payload).toBe( expect(storeMock.dispatch['calls'].argsFor(0)[0].payload).toBe(
'APP.MESSAGES.UPLOAD.ERROR.404' 'APP.MESSAGES.UPLOAD.ERROR.404'
); );
}); });
it('should dispatch 409 error message', () => { it('should dispatch 409 error message', () => {
component.onFileUploadedError(<any>{ error: { status: 409 } }); component.onFileUploadedError({ error: { status: 409 } } as any);
expect(storeMock.dispatch['calls'].argsFor(0)[0].payload).toBe( expect(storeMock.dispatch['calls'].argsFor(0)[0].payload).toBe(
'APP.MESSAGES.UPLOAD.ERROR.CONFLICT' 'APP.MESSAGES.UPLOAD.ERROR.CONFLICT'
); );
}); });
it('should dispatch 500 error message', () => { it('should dispatch 500 error message', () => {
component.onFileUploadedError(<any>{ error: { status: 500 } }); component.onFileUploadedError({ error: { status: 500 } } as any);
expect(storeMock.dispatch['calls'].argsFor(0)[0].payload).toBe( expect(storeMock.dispatch['calls'].argsFor(0)[0].payload).toBe(
'APP.MESSAGES.UPLOAD.ERROR.500' 'APP.MESSAGES.UPLOAD.ERROR.500'
); );
}); });
it('should dispatch 504 error message', () => { it('should dispatch 504 error message', () => {
component.onFileUploadedError(<any>{ error: { status: 504 } }); component.onFileUploadedError({ error: { status: 504 } } as any);
expect(storeMock.dispatch['calls'].argsFor(0)[0].payload).toBe( expect(storeMock.dispatch['calls'].argsFor(0)[0].payload).toBe(
'APP.MESSAGES.UPLOAD.ERROR.504' 'APP.MESSAGES.UPLOAD.ERROR.504'
); );
}); });
it('should dispatch generic error message', () => { it('should dispatch generic error message', () => {
component.onFileUploadedError(<any>{ error: { status: 999 } }); component.onFileUploadedError({ error: { status: 999 } } as any);
expect(storeMock.dispatch['calls'].argsFor(0)[0].payload).toBe( expect(storeMock.dispatch['calls'].argsFor(0)[0].payload).toBe(
'APP.MESSAGES.UPLOAD.ERROR.GENERIC' 'APP.MESSAGES.UPLOAD.ERROR.GENERIC'
); );
@@ -30,7 +30,7 @@ describe('ToggleSharedComponent', () => {
let component; let component;
let entry; let entry;
const storeMock = { const storeMock: any = {
select: () => of({ first: { entry } }), select: () => of({ first: { entry } }),
dispatch: jasmine.createSpy('dispatch') dispatch: jasmine.createSpy('dispatch')
}; };
@@ -42,7 +42,7 @@ describe('ToggleSharedComponent', () => {
} }
}; };
component = new ToggleSharedComponent(<any>storeMock); component = new ToggleSharedComponent(storeMock);
}); });
it('should get Store selection entry on initialization', done => { it('should get Store selection entry on initialization', done => {
@@ -53,7 +53,7 @@ export class ToggleSharedComponent implements OnInit {
if ( if (
selection.first && selection.first &&
selection.first.entry && selection.first.entry &&
(<any>selection.first.entry).sharedByUser (selection.first.entry as any).sharedByUser
) { ) {
return true; return true;
} }
@@ -56,7 +56,7 @@ describe('ContextMenuComponent', () => {
component = fixture.componentInstance; component = fixture.componentInstance;
extensionsService = TestBed.get(AppExtensionService); extensionsService = TestBed.get(AppExtensionService);
contextItem = <any>{ contextItem = {
type: 'button', type: 'button',
id: 'action-button', id: 'action-button',
title: 'Test Button', title: 'Test Button',
@@ -102,7 +102,7 @@ describe('CurrentUserComponent', () => {
}); });
it('should set menu actions', () => { it('should set menu actions', () => {
const actions = <any>[ const actions: any[] = [
{ {
id: 'action-id' id: 'action-id'
} }
@@ -141,7 +141,7 @@ describe('FavoriteLibrariesComponent', () => {
it('does not navigate when id is not passed', () => { it('does not navigate when id is not passed', () => {
spyOn(router, 'navigate').and.stub(); spyOn(router, 'navigate').and.stub();
component.navigateTo(<any>{ entry: { guid: 'guid' } }); component.navigateTo({ entry: { guid: 'guid' } } as any);
expect(router.navigate).toHaveBeenCalledWith(['libraries', 'libraryId']); expect(router.navigate).toHaveBeenCalledWith(['libraries', 'libraryId']);
}); });
@@ -69,7 +69,7 @@ describe('FavoritesComponent', () => {
} }
}; };
node = <any>{ node = {
id: 'folder-node', id: 'folder-node',
isFolder: true, isFolder: true,
isFile: false, isFile: false,
@@ -171,7 +171,7 @@ describe('FavoritesComponent', () => {
})); }));
it('should navigate if node is folder', () => { it('should navigate if node is folder', () => {
const nodeEntity = <any>{ entry: { isFolder: true } }; const nodeEntity: any = { entry: { isFolder: true } };
spyOn(component, 'navigate').and.stub(); spyOn(component, 'navigate').and.stub();
fixture.detectChanges(); fixture.detectChanges();
@@ -180,7 +180,7 @@ describe('FavoritesComponent', () => {
}); });
it('should call showPreview if node is file', () => { it('should call showPreview if node is file', () => {
const nodeEntity = <any>{ entry: { isFile: true } }; const nodeEntity: any = { entry: { isFile: true } };
spyOn(component, 'showPreview').and.stub(); spyOn(component, 'showPreview').and.stub();
fixture.detectChanges(); fixture.detectChanges();
@@ -148,12 +148,12 @@ describe('FilesComponent', () => {
}); });
it('should call refresh onContentCopied event if parent is the same', () => { it('should call refresh onContentCopied event if parent is the same', () => {
const nodes = [ const nodes: any[] = [
<any>{ entry: { parentId: '1' } }, { entry: { parentId: '1' } },
<any>{ entry: { parentId: '2' } } { entry: { parentId: '2' } }
]; ];
component.node = <any>{ id: '1' }; component.node = { id: '1' } as any;
nodeActionsService.contentCopied.next(nodes); nodeActionsService.contentCopied.next(nodes);
@@ -161,12 +161,12 @@ describe('FilesComponent', () => {
}); });
it('should not call refresh onContentCopied event when parent mismatch', () => { it('should not call refresh onContentCopied event when parent mismatch', () => {
const nodes = [ const nodes: any[] = [
<any>{ entry: { parentId: '1' } }, { entry: { parentId: '1' } },
<any>{ entry: { parentId: '2' } } { entry: { parentId: '2' } }
]; ];
component.node = <any>{ id: '3' }; component.node = { id: '3' } as any;
nodeActionsService.contentCopied.next(nodes); nodeActionsService.contentCopied.next(nodes);
@@ -174,10 +174,10 @@ describe('FilesComponent', () => {
}); });
it('should call refresh on fileUploadComplete event if parent node match', fakeAsync(() => { it('should call refresh on fileUploadComplete event if parent node match', fakeAsync(() => {
const file = { file: { options: { parentId: 'parentId' } } }; const file: any = { file: { options: { parentId: 'parentId' } } };
component.node = <any>{ id: 'parentId' }; component.node = { id: 'parentId' } as any;
uploadService.fileUploadComplete.next(<any>file); uploadService.fileUploadComplete.next(file);
tick(500); tick(500);
@@ -185,10 +185,10 @@ describe('FilesComponent', () => {
})); }));
it('should not call refresh on fileUploadComplete event if parent mismatch', fakeAsync(() => { it('should not call refresh on fileUploadComplete event if parent mismatch', fakeAsync(() => {
const file = { file: { options: { parentId: 'otherId' } } }; const file: any = { file: { options: { parentId: 'otherId' } } };
component.node = <any>{ id: 'parentId' }; component.node = { id: 'parentId' } as any;
uploadService.fileUploadComplete.next(<any>file); uploadService.fileUploadComplete.next(file);
tick(500); tick(500);
@@ -196,10 +196,10 @@ describe('FilesComponent', () => {
})); }));
it('should call refresh on fileUploadDeleted event if parent node match', fakeAsync(() => { it('should call refresh on fileUploadDeleted event if parent node match', fakeAsync(() => {
const file = { file: { options: { parentId: 'parentId' } } }; const file: any = { file: { options: { parentId: 'parentId' } } };
component.node = <any>{ id: 'parentId' }; component.node = { id: 'parentId' } as any;
uploadService.fileUploadDeleted.next(<any>file); uploadService.fileUploadDeleted.next(file);
tick(500); tick(500);
@@ -208,7 +208,7 @@ describe('FilesComponent', () => {
it('should not call refresh on fileUploadDeleted event if parent mismatch', fakeAsync(() => { it('should not call refresh on fileUploadDeleted event if parent mismatch', fakeAsync(() => {
const file: any = { file: { options: { parentId: 'otherId' } } }; const file: any = { file: { options: { parentId: 'otherId' } } };
component.node = <any>{ id: 'parentId' }; component.node = { id: 'parentId' } as any;
uploadService.fileUploadDeleted.next(file); uploadService.fileUploadDeleted.next(file);
@@ -258,11 +258,11 @@ describe('FilesComponent', () => {
}); });
it('should navigate home if node is root', () => { it('should navigate home if node is root', () => {
component.node = <any>{ component.node = {
path: { path: {
elements: [{ id: 'node-id' }] elements: [{ id: 'node-id' }]
} }
}; } as any;
router.url = '/personal-files'; router.url = '/personal-files';
component.navigate(node.id); component.navigate(node.id);
@@ -273,19 +273,19 @@ describe('FilesComponent', () => {
describe('isSiteContainer', () => { describe('isSiteContainer', () => {
it('should return false if node has no aspectNames', () => { it('should return false if node has no aspectNames', () => {
const mock = <any>{ aspectNames: [] }; const mock: any = { aspectNames: [] };
expect(component.isSiteContainer(mock)).toBe(false); expect(component.isSiteContainer(mock)).toBe(false);
}); });
it('should return false if node is not site container', () => { it('should return false if node is not site container', () => {
const mock = <any>{ aspectNames: ['something-else'] }; const mock: any = { aspectNames: ['something-else'] };
expect(component.isSiteContainer(mock)).toBe(false); expect(component.isSiteContainer(mock)).toBe(false);
}); });
it('should return true if node is a site container', () => { it('should return true if node is a site container', () => {
const mock = <any>{ aspectNames: ['st:siteContainer'] }; const mock: any = { aspectNames: ['st:siteContainer'] };
expect(component.isSiteContainer(mock)).toBe(true); expect(component.isSiteContainer(mock)).toBe(true);
}); });
+1 -1
View File
@@ -207,7 +207,7 @@ export class FilesComponent extends PageComponent implements OnInit, OnDestroy {
displayFolderParent(filePath = '', index: number) { displayFolderParent(filePath = '', index: number) {
const parentName = filePath.split('/')[index]; const parentName = filePath.split('/')[index];
const currentFoldersDisplayed = const currentFoldersDisplayed =
<ShareDataRow[]>this.documentList.data.getRows() || []; (this.documentList.data.getRows() as ShareDataRow[]) || [];
const alreadyDisplayedParentFolder = currentFoldersDisplayed.find( const alreadyDisplayedParentFolder = currentFoldersDisplayed.find(
row => row.node.entry.isFolder && row.node.entry.name === parentName row => row.node.entry.isFolder && row.node.entry.name === parentName
@@ -51,7 +51,7 @@ describe('CommentsTabComponent', () => {
component = fixture.componentInstance; component = fixture.componentInstance;
checked = null; checked = null;
permissionsMock.check.and.callFake((source, permissions) => { permissionsMock.check.and.callFake((_source, permissions) => {
checked = permissions; checked = permissions;
return true; return true;
}); });
@@ -68,44 +68,44 @@ describe('CommentsTabComponent', () => {
}); });
it('should return [false] if node selected is neither file or folder', () => { it('should return [false] if node selected is neither file or folder', () => {
const testNode = { const testNode: any = {
id: 'test-node-id', id: 'test-node-id',
isFile: false, isFile: false,
isFolder: false isFolder: false
}; };
component.node = <any>testNode; component.node = testNode;
expect(component.canUpdateNode).toBe(false); expect(component.canUpdateNode).toBe(false);
}); });
it('should return [false] if node selected is a locked file', () => { it('should return [false] if node selected is a locked file', () => {
const testNode = { const testNode: any = {
id: 'test-node-id', id: 'test-node-id',
isFile: true, isFile: true,
isFolder: false, isFolder: false,
isLocked: true isLocked: true
}; };
component.node = <any>testNode; component.node = testNode;
expect(component.canUpdateNode).toBe(false); expect(component.canUpdateNode).toBe(false);
}); });
it('should check [update] permission if node selected is a not locked file', () => { it('should check [update] permission if node selected is a not locked file', () => {
const testNode = { const testNode: any = {
id: 'test-node-id', id: 'test-node-id',
isFile: true, isFile: true,
isFolder: false isFolder: false
}; };
component.node = <any>testNode; component.node = testNode;
expect(component.canUpdateNode).toBe(true); expect(component.canUpdateNode).toBe(true);
expect(checked).toContain('update'); expect(checked).toContain('update');
}); });
it('should check [update] permission if node selected is a folder', () => { it('should check [update] permission if node selected is a folder', () => {
const testNode = { const testNode: any = {
id: 'test-node-id', id: 'test-node-id',
isFile: false, isFile: false,
isFolder: true isFolder: true
}; };
component.node = <any>testNode; component.node = testNode;
expect(component.canUpdateNode).toBe(true); expect(component.canUpdateNode).toBe(true);
expect(checked).toContain('update'); expect(checked).toContain('update');
}); });
@@ -65,7 +65,7 @@ describe('InfoDrawerComponent', () => {
appExtensionService = TestBed.get(AppExtensionService); appExtensionService = TestBed.get(AppExtensionService);
contentApiService = TestBed.get(ContentApiService); contentApiService = TestBed.get(ContentApiService);
tab = <any>{ title: 'tab1' }; tab = { title: 'tab1' };
spyOn(appExtensionService, 'getSidebarTabs').and.returnValue([tab]); spyOn(appExtensionService, 'getSidebarTabs').and.returnValue([tab]);
}); });
@@ -90,7 +90,7 @@ describe('InfoDrawerComponent', () => {
it('should set displayNode when node is library', async(() => { it('should set displayNode when node is library', async(() => {
spyOn(contentApiService, 'getNodeInfo'); spyOn(contentApiService, 'getNodeInfo');
const nodeMock = <any>{ const nodeMock: any = {
entry: { id: 'nodeId' }, entry: { id: 'nodeId' },
isLibrary: true isLibrary: true
}; };
@@ -104,9 +104,9 @@ describe('InfoDrawerComponent', () => {
})); }));
it('should call getNodeInfo() when node is a shared file', async(() => { it('should call getNodeInfo() when node is a shared file', async(() => {
const response = <any>{ entry: { id: 'nodeId' } }; const response: any = { entry: { id: 'nodeId' } };
spyOn(contentApiService, 'getNodeInfo').and.returnValue(of(response)); spyOn(contentApiService, 'getNodeInfo').and.returnValue(of(response));
const nodeMock = <any>{ entry: { nodeId: 'nodeId' }, isLibrary: false }; const nodeMock: any = { entry: { nodeId: 'nodeId' }, isLibrary: false };
component.node = nodeMock; component.node = nodeMock;
fixture.detectChanges(); fixture.detectChanges();
@@ -117,9 +117,9 @@ describe('InfoDrawerComponent', () => {
})); }));
it('should call getNodeInfo() when node is a favorite file', async(() => { it('should call getNodeInfo() when node is a favorite file', async(() => {
const response = <any>{ entry: { id: 'nodeId' } }; const response: any = { entry: { id: 'nodeId' } };
spyOn(contentApiService, 'getNodeInfo').and.returnValue(of(response)); spyOn(contentApiService, 'getNodeInfo').and.returnValue(of(response));
const nodeMock = <any>{ const nodeMock: any = {
entry: { id: 'nodeId', guid: 'guidId' }, entry: { id: 'nodeId', guid: 'guidId' },
isLibrary: false isLibrary: false
}; };
@@ -133,9 +133,9 @@ describe('InfoDrawerComponent', () => {
})); }));
it('should call getNodeInfo() when node is a recent file', async(() => { it('should call getNodeInfo() when node is a recent file', async(() => {
const response = <any>{ entry: { id: 'nodeId' } }; const response: any = { entry: { id: 'nodeId' } };
spyOn(contentApiService, 'getNodeInfo').and.returnValue(of(response)); spyOn(contentApiService, 'getNodeInfo').and.returnValue(of(response));
const nodeMock = <any>{ const nodeMock: any = {
entry: { entry: {
id: 'nodeId', id: 'nodeId',
content: { mimeType: 'image/jpeg' } content: { mimeType: 'image/jpeg' }
@@ -59,8 +59,8 @@ export class InfoDrawerComponent implements OnChanges, OnInit, OnDestroy {
displayNode: MinimalNodeEntryEntity | SiteEntry; displayNode: MinimalNodeEntryEntity | SiteEntry;
tabs: Array<SidebarTabRef> = []; tabs: Array<SidebarTabRef> = [];
@HostListener('keydown.escape', ['$event']) @HostListener('keydown.escape')
onEscapeKeyboardEvent(event: KeyboardEvent): void { onEscapeKeyboardEvent(): void {
this.close(); this.close();
} }
@@ -33,7 +33,7 @@ import { Store } from '@ngrx/store';
import { UpdateLibraryAction } from '@alfresco/aca-shared/store'; import { UpdateLibraryAction } from '@alfresco/aca-shared/store';
import { AppTestingModule } from '../../../testing/app-testing.module'; import { AppTestingModule } from '../../../testing/app-testing.module';
import { NO_ERRORS_SCHEMA } from '@angular/core'; import { NO_ERRORS_SCHEMA } from '@angular/core';
import { Site, SiteBody } from '@alfresco/js-api'; import { Site } from '@alfresco/js-api';
import { AlfrescoApiService, AlfrescoApiServiceMock } from '@alfresco/adf-core'; import { AlfrescoApiService, AlfrescoApiServiceMock } from '@alfresco/adf-core';
describe('LibraryMetadataFormComponent', () => { describe('LibraryMetadataFormComponent', () => {
@@ -71,10 +71,10 @@ describe('LibraryMetadataFormComponent', () => {
visibility: 'PRIVATE' visibility: 'PRIVATE'
}; };
component.node = { component.node = {
entry: <Site>{ entry: {
id: 'libraryId', id: 'libraryId',
...siteEntryModel ...siteEntryModel
} } as Site
}; };
fixture.detectChanges(); fixture.detectChanges();
@@ -95,10 +95,10 @@ describe('LibraryMetadataFormComponent', () => {
}; };
component.node = { component.node = {
entry: <Site>{ entry: {
id: 'libraryId', id: 'libraryId',
...siteEntryModel ...siteEntryModel
} } as Site
}; };
fixture.detectChanges(); fixture.detectChanges();
@@ -106,10 +106,10 @@ describe('LibraryMetadataFormComponent', () => {
expect(component.form.value).toEqual(siteEntryModel); expect(component.form.value).toEqual(siteEntryModel);
component.node = { component.node = {
entry: <Site>{ entry: {
id: 'libraryId', id: 'libraryId',
...newSiteEntryModel ...newSiteEntryModel
} } as Site
}; };
component.ngOnChanges(); component.ngOnChanges();
@@ -124,11 +124,11 @@ describe('LibraryMetadataFormComponent', () => {
visibility: 'PRIVATE' visibility: 'PRIVATE'
}; };
component.node = { component.node = {
entry: <Site>{ entry: {
id: 'libraryId', id: 'libraryId',
role: 'SiteManager', role: 'SiteManager',
...siteEntryModel ...siteEntryModel
} } as Site
}; };
fixture.detectChanges(); fixture.detectChanges();
@@ -136,7 +136,7 @@ describe('LibraryMetadataFormComponent', () => {
component.update(); component.update();
expect(storeMock.dispatch).toHaveBeenCalledWith( expect(storeMock.dispatch).toHaveBeenCalledWith(
new UpdateLibraryAction(<SiteBody>siteEntryModel) new UpdateLibraryAction(siteEntryModel)
); );
}); });
@@ -147,11 +147,11 @@ describe('LibraryMetadataFormComponent', () => {
visibility: 'PRIVATE' visibility: 'PRIVATE'
}; };
component.node = { component.node = {
entry: <Site>{ entry: {
id: 'libraryId', id: 'libraryId',
role: 'Consumer', role: 'Consumer',
...siteEntryModel ...siteEntryModel
} } as Site
}; };
fixture.detectChanges(); fixture.detectChanges();
@@ -159,7 +159,7 @@ describe('LibraryMetadataFormComponent', () => {
component.update(); component.update();
expect(storeMock.dispatch).not.toHaveBeenCalledWith( expect(storeMock.dispatch).not.toHaveBeenCalledWith(
new UpdateLibraryAction(<SiteBody>siteEntryModel) new UpdateLibraryAction(siteEntryModel)
); );
}); });
@@ -170,11 +170,11 @@ describe('LibraryMetadataFormComponent', () => {
visibility: 'PRIVATE' visibility: 'PRIVATE'
}; };
component.node = { component.node = {
entry: <Site>{ entry: {
id: 'libraryId', id: 'libraryId',
role: 'SiteManager', role: 'SiteManager',
...siteEntryModel ...siteEntryModel
} } as Site
}; };
fixture.detectChanges(); fixture.detectChanges();
@@ -184,7 +184,7 @@ describe('LibraryMetadataFormComponent', () => {
component.update(); component.update();
expect(storeMock.dispatch).not.toHaveBeenCalledWith( expect(storeMock.dispatch).not.toHaveBeenCalledWith(
new UpdateLibraryAction(<SiteBody>siteEntryModel) new UpdateLibraryAction(siteEntryModel)
); );
}); });
@@ -205,10 +205,10 @@ describe('LibraryMetadataFormComponent', () => {
visibility: 'PRIVATE' visibility: 'PRIVATE'
}; };
component.node = { component.node = {
entry: <Site>{ entry: {
id: 'libraryId', id: 'libraryId',
...siteEntryModel ...siteEntryModel
} } as Site
}; };
fixture.detectChanges(); fixture.detectChanges();
@@ -241,10 +241,10 @@ describe('LibraryMetadataFormComponent', () => {
}; };
component.node = { component.node = {
entry: <Site>{ entry: {
id: 'libraryId', id: 'libraryId',
...siteEntryModel ...siteEntryModel
} } as Site
}; };
fixture.detectChanges(); fixture.detectChanges();
@@ -272,10 +272,10 @@ describe('LibraryMetadataFormComponent', () => {
}; };
component.node = { component.node = {
entry: <Site>{ entry: {
id: 'libraryId', id: 'libraryId',
...siteEntryModel ...siteEntryModel
} } as Site
}; };
fixture.detectChanges(); fixture.detectChanges();
@@ -303,10 +303,10 @@ describe('LibraryMetadataFormComponent', () => {
}; };
component.node = { component.node = {
entry: <Site>{ entry: {
id: 'libraryId', id: 'libraryId',
...siteEntryModel ...siteEntryModel
} } as Site
}; };
fixture.detectChanges(); fixture.detectChanges();
@@ -90,43 +90,43 @@ describe('MetadataTabComponent', () => {
}); });
it('should return true if node is not locked and has update permission', () => { it('should return true if node is not locked and has update permission', () => {
const node = <Node>{ const node = {
isLocked: false, isLocked: false,
allowableOperations: ['update'] allowableOperations: ['update']
}; } as Node;
component.node = node; component.node = node;
expect(component.canUpdateNode).toBe(true); expect(component.canUpdateNode).toBe(true);
}); });
it('should return false if node is locked', () => { it('should return false if node is locked', () => {
const node = <Node>{ const node = {
isLocked: true, isLocked: true,
allowableOperations: ['update'] allowableOperations: ['update']
}; } as Node;
component.node = node; component.node = node;
expect(component.canUpdateNode).toBe(false); expect(component.canUpdateNode).toBe(false);
}); });
it('should return false if node has no update permission', () => { it('should return false if node has no update permission', () => {
const node = <Node>{ const node = {
isLocked: false, isLocked: false,
allowableOperations: ['other'] allowableOperations: ['other']
}; } as Node;
component.node = node; component.node = node;
expect(component.canUpdateNode).toBe(false); expect(component.canUpdateNode).toBe(false);
}); });
it('should return false if node has read only property', () => { it('should return false if node has read only property', () => {
const node = <Node>{ const node = {
isLocked: false, isLocked: false,
allowableOperations: ['update'], allowableOperations: ['update'],
properties: { properties: {
'cm:lockType': 'WRITE_LOCK' 'cm:lockType': 'WRITE_LOCK'
} }
}; } as Node;
component.node = node; component.node = node;
expect(component.canUpdateNode).toBe(false); expect(component.canUpdateNode).toBe(false);
@@ -65,7 +65,7 @@ export class VersionsTabComponent implements OnInit, OnChanges {
} }
private updateState() { private updateState() {
if (this.node && (<any>this.node).nodeId) { if (this.node && (this.node as any).nodeId) {
// workaround for shared files type. // workaround for shared files type.
this.isFileSelected = true; this.isFileSelected = true;
} else { } else {
@@ -142,7 +142,7 @@ describe('AppLayoutComponent', () => {
}); });
it('should reset selection before navigation', () => { it('should reset selection before navigation', () => {
const selection = [<any>{ entry: { id: 'nodeId', name: 'name' } }]; const selection: any[] = [{ entry: { id: 'nodeId', name: 'name' } }];
spyOn(store, 'dispatch').and.stub(); spyOn(store, 'dispatch').and.stub();
fixture.detectChanges(); fixture.detectChanges();
store.dispatch(new SetSelectedNodesAction(selection)); store.dispatch(new SetSelectedNodesAction(selection));
@@ -164,7 +164,7 @@ describe('AppLayoutComponent', () => {
spyOn(component.layout.container, 'toggleMenu'); spyOn(component.layout.container, 'toggleMenu');
fixture.detectChanges(); fixture.detectChanges();
component.hideMenu(<any>{ preventDefault: () => {} }); component.hideMenu({ preventDefault: () => {} } as any);
expect(component.layout.container.toggleMenu).toHaveBeenCalled(); expect(component.layout.container.toggleMenu).toHaveBeenCalled();
}); });
@@ -180,7 +180,7 @@ describe('AppLayoutComponent', () => {
spyOn(component.layout.container, 'toggleMenu'); spyOn(component.layout.container, 'toggleMenu');
fixture.detectChanges(); fixture.detectChanges();
component.hideMenu(<any>{ preventDefault: () => {} }); component.hideMenu({ preventDefault: () => {} } as any);
expect(component.layout.container.toggleMenu).toHaveBeenCalled(); expect(component.layout.container.toggleMenu).toHaveBeenCalled();
}); });
+1 -1
View File
@@ -115,7 +115,7 @@ export abstract class PageComponent implements OnInit, OnDestroy {
showPreview(node: MinimalNodeEntity, extras?: ViewNodeExtras) { showPreview(node: MinimalNodeEntity, extras?: ViewNodeExtras) {
if (node && node.entry) { if (node && node.entry) {
const id = const id =
(<any>node).entry.nodeId || (<any>node).entry.guid || node.entry.id; (node as any).entry.nodeId || (node as any).entry.guid || node.entry.id;
this.store.dispatch(new ViewNodeAction(id, extras)); this.store.dispatch(new ViewNodeAction(id, extras));
} }
@@ -737,7 +737,7 @@ describe('PreviewComponent', () => {
it('should emit nodeUpdated event on fileUploadComplete event', fakeAsync(() => { it('should emit nodeUpdated event on fileUploadComplete event', fakeAsync(() => {
spyOn(alfrescoApiService.nodeUpdated, 'next'); spyOn(alfrescoApiService.nodeUpdated, 'next');
fixture.detectChanges(); fixture.detectChanges();
uploadService.fileUploadComplete.next(<any>{ data: { entry: {} } }); uploadService.fileUploadComplete.next({ data: { entry: {} } } as any);
tick(300); tick(300);
expect(alfrescoApiService.nodeUpdated.next).toHaveBeenCalled(); expect(alfrescoApiService.nodeUpdated.next).toHaveBeenCalled();
@@ -119,7 +119,7 @@ describe('RecentFilesComponent', () => {
})); }));
it('should call showPreview method', () => { it('should call showPreview method', () => {
const node = <any>{ entry: {} }; const node: any = { entry: {} };
spyOn(component, 'showPreview'); spyOn(component, 'showPreview');
fixture.detectChanges(); fixture.detectChanges();
@@ -52,6 +52,7 @@ export class SearchInputControlComponent implements OnDestroy {
/** Emitted when the search is submitted pressing ENTER button. /** Emitted when the search is submitted pressing ENTER button.
* The search term is provided as value of the event. * The search term is provided as value of the event.
*/ */
// tslint:disable-next-line: no-output-native
@Output() @Output()
submit: EventEmitter<any> = new EventEmitter(); submit: EventEmitter<any> = new EventEmitter();
@@ -99,7 +99,7 @@ describe('SearchInputComponent', () => {
done(); done();
}) })
); );
component.onSearchSubmit(<any>{ target: { value: searchedTerm } }); component.onSearchSubmit({ target: { value: searchedTerm } });
tick(); tick();
})); }));
@@ -112,7 +112,7 @@ describe('SearchInputComponent', () => {
done(); done();
}) })
); );
component.onSearchSubmit(<any>{ target: { value: searchedTerm } }); component.onSearchSubmit({ target: { value: searchedTerm } });
tick(); tick();
})); }));
}); });
@@ -122,7 +122,7 @@ export class SettingsComponent implements OnInit {
null null
); );
this.form.reset(<RepositoryConfig>{ this.form.reset({
ecmHost: ecmHost:
this.storage.getItem('ecmHost') || this.storage.getItem('ecmHost') ||
this.appConfig.get<string>('ecmHost'), this.appConfig.get<string>('ecmHost'),
@@ -126,7 +126,7 @@ describe('SharedFilesComponent', () => {
})); }));
it('should call showPreview method', () => { it('should call showPreview method', () => {
const node = <any>{ entry: {} }; const node: any = { entry: {} };
spyOn(component, 'showPreview'); spyOn(component, 'showPreview');
fixture.detectChanges(); fixture.detectChanges();
@@ -102,7 +102,7 @@ describe('SharedLinkViewComponent', () => {
tick(); tick();
expect(storeMock.dispatch).toHaveBeenCalledWith( expect(storeMock.dispatch).toHaveBeenCalledWith(
new SetSelectedNodesAction([<any>{ entry: { id: 'shared-id' } }]) new SetSelectedNodesAction([{ entry: { id: 'shared-id' } } as any])
); );
})); }));
@@ -70,7 +70,7 @@ export class SharedLinkViewComponent implements OnInit {
) )
.subscribe(([sharedEntry, sharedId]: [SharedLinkEntry, string]) => { .subscribe(([sharedEntry, sharedId]: [SharedLinkEntry, string]) => {
if (sharedEntry) { if (sharedEntry) {
this.store.dispatch(new SetSelectedNodesAction([<any>sharedEntry])); this.store.dispatch(new SetSelectedNodesAction([sharedEntry as any]));
} }
this.sharedLinkId = sharedId; this.sharedLinkId = sharedId;
}); });
@@ -52,7 +52,7 @@ export class ButtonMenuComponent implements OnInit {
this.cd.detectChanges(); this.cd.detectChanges();
} }
trackById(index: number, obj: { id: string }) { trackById(_index: number, obj: { id: string }) {
return obj.id; return obj.id;
} }
} }
@@ -46,7 +46,7 @@ export class ExpandMenuComponent implements OnInit {
this.cd.detectChanges(); this.cd.detectChanges();
} }
trackById(index: number, obj: { id: string }) { trackById(_index: number, obj: { id: string }) {
return obj.id; return obj.id;
} }
} }
@@ -27,7 +27,7 @@ import { ActionDirective } from './action.directive';
describe('ActionDirective', () => { describe('ActionDirective', () => {
let directive: ActionDirective; let directive: ActionDirective;
const routeMock = <any>{ const routeMock: any = {
navigate: jasmine.createSpy('navigate'), navigate: jasmine.createSpy('navigate'),
parseUrl: () => ({ parseUrl: () => ({
root: { root: {
@@ -35,7 +35,7 @@ describe('ActionDirective', () => {
} }
}) })
}; };
const storeMock = <any>{ const storeMock: any = {
dispatch: jasmine.createSpy('dispatch') dispatch: jasmine.createSpy('dispatch')
}; };
@@ -51,10 +51,10 @@ class RouterStub {
} }
describe('AcaExpansionPanel', () => { describe('AcaExpansionPanel', () => {
const mockStore = <any>{ const mockStore: any = {
dispatch: jasmine.createSpy('dispatch') dispatch: jasmine.createSpy('dispatch')
}; };
const mockMatExpansionPanel = <any>{ const mockMatExpansionPanel: any = {
expanded: false, expanded: false,
children: [] children: []
}; };
@@ -51,10 +51,10 @@ class RouterStub {
} }
describe('MenuPanelDirective', () => { describe('MenuPanelDirective', () => {
const mockStore = <any>{ const mockStore: any = {
dispatch: jasmine.createSpy('dispatch') dispatch: jasmine.createSpy('dispatch')
}; };
const mockMatExpansionPanel = <any>{ const mockMatExpansionPanel: any = {
expanded: false, expanded: false,
children: [] children: []
}; };
@@ -33,7 +33,7 @@ describe('SidenavComponent', () => {
let fixture: ComponentFixture<SidenavComponent>; let fixture: ComponentFixture<SidenavComponent>;
let component: SidenavComponent; let component: SidenavComponent;
let extensionService: AppExtensionService; let extensionService: AppExtensionService;
const navbarMock = <any>[ const navbarMock: any = [
{ {
items: [ items: [
{ {
@@ -63,7 +63,7 @@ describe('SidenavComponent', () => {
})); }));
it('should set the sidenav data', async(() => { it('should set the sidenav data', async(() => {
expect(component.groups).toEqual(<any>[ expect(component.groups).toEqual([
{ {
items: [ items: [
{ {
@@ -71,7 +71,7 @@ describe('SidenavComponent', () => {
url: '/route' url: '/route'
} }
] ]
} } as any
]); ]);
})); }));
}); });
@@ -77,7 +77,7 @@ export class ToggleFavoriteLibraryComponent implements OnInit {
map(selection => { map(selection => {
// favorite libraries list should already be marked as favorite // favorite libraries list should already be marked as favorite
if (selection.library && isFavoriteLibraries) { if (selection.library && isFavoriteLibraries) {
(<any>selection.library).isFavorite = true; (selection.library as any).isFavorite = true;
return selection; return selection;
} }
return selection; return selection;
@@ -38,7 +38,7 @@ describe('ToggleFavoriteComponent', () => {
const mockRouter = { const mockRouter = {
url: 'some-url' url: 'some-url'
}; };
const mockStore = <any>{ const mockStore: any = {
dispatch: jasmine.createSpy('dispatch'), dispatch: jasmine.createSpy('dispatch'),
select: jasmine.createSpy('select').and.returnValue( select: jasmine.createSpy('select').and.returnValue(
of({ of({
@@ -85,7 +85,7 @@ export class ToggleJoinLibraryButtonComponent {
if (event.updatedEntry) { if (event.updatedEntry) {
this.store.dispatch( this.store.dispatch(
new SetSelectedNodesAction([ new SetSelectedNodesAction([
<any>{ entry: event.updatedEntry, isLibrary: true } { entry: event.updatedEntry, isLibrary: true } as any
]) ])
); );
} }
@@ -36,7 +36,7 @@ describe('ToggleFavoriteComponent', () => {
const mockRouter = { const mockRouter = {
url: 'some-url' url: 'some-url'
}; };
const mockStore = <any>{ const mockStore: any = {
dispatch: jasmine.createSpy('dispatch'), dispatch: jasmine.createSpy('dispatch'),
select: jasmine.createSpy('select').and.returnValue( select: jasmine.createSpy('select').and.returnValue(
of({ of({
@@ -66,8 +66,8 @@ export class ViewNodeComponent {
.pipe(take(1)) .pipe(take(1))
.subscribe(selection => { .subscribe(selection => {
const id = const id =
(<SharedLinkEntry>selection.file).entry.nodeId || (selection.file as SharedLinkEntry).entry.nodeId ||
(<any>selection.file).entry.guid || (selection.file as any).entry.guid ||
selection.file.entry.id; selection.file.entry.id;
this.store.dispatch( this.store.dispatch(
@@ -68,10 +68,10 @@ describe('TrashcanComponent', () => {
alfrescoApi = TestBed.get(AlfrescoApiService); alfrescoApi = TestBed.get(AlfrescoApiService);
alfrescoApi.reset(); alfrescoApi.reset();
component.documentList = <any>{ component.documentList = {
reload: jasmine.createSpy('reload'), reload: jasmine.createSpy('reload'),
resetSelection: jasmine.createSpy('resetSelection') resetSelection: jasmine.createSpy('resetSelection')
}; } as any;
}); });
beforeEach(() => { beforeEach(() => {
@@ -30,7 +30,7 @@ import { SetSelectedNodesAction } from '@alfresco/aca-shared/store';
describe('DocumentListDirective', () => { describe('DocumentListDirective', () => {
let documentListDirective; let documentListDirective;
const documentListMock = <any>{ const documentListMock: any = {
currentFolderId: '', currentFolderId: '',
stickyHeader: false, stickyHeader: false,
includeFields: [], includeFields: [],
@@ -44,20 +44,20 @@ describe('DocumentListDirective', () => {
ready: new Subject<any>() ready: new Subject<any>()
}; };
const storeMock = <any>{ const storeMock: any = {
dispatch: jasmine.createSpy('dispatch') dispatch: jasmine.createSpy('dispatch')
}; };
const mockRouter = <any>{ const mockRouter: any = {
url: '' url: ''
}; };
const contentManagementServiceMock = <any>{ const contentManagementServiceMock: any = {
reload: new Subject<any>(), reload: new Subject<any>(),
reset: new Subject<any>() reset: new Subject<any>()
}; };
const mockRoute = <any>{ const mockRoute: any = {
snapshot: { snapshot: {
data: { data: {
sortingPreferenceKey: null sortingPreferenceKey: null
@@ -65,7 +65,7 @@ describe('DocumentListDirective', () => {
} }
}; };
const userPreferencesServiceMock = <any>{ const userPreferencesServiceMock: any = {
set: jasmine.createSpy('set'), set: jasmine.createSpy('set'),
get: jasmine.createSpy('get') get: jasmine.createSpy('get')
}; };
@@ -109,7 +109,7 @@ describe('DocumentListDirective', () => {
documentListMock.ready.next(); documentListMock.ready.next();
expect(storeMock.dispatch).toHaveBeenCalledWith( expect(storeMock.dispatch).toHaveBeenCalledWith(
new SetSelectedNodesAction([<any>{ isLibrary: true }]) new SetSelectedNodesAction([{ isLibrary: true } as any])
); );
}); });
@@ -48,8 +48,9 @@ export class LibraryFavoriteDirective implements OnChanges {
@Input('acaFavoriteLibrary') @Input('acaFavoriteLibrary')
library: any = null; library: any = null;
@Output() toggle: EventEmitter<any> = new EventEmitter(); @Output() toggle = new EventEmitter<any>();
@Output() error: EventEmitter<any> = new EventEmitter(); // tslint:disable-next-line: no-output-native
@Output() error = new EventEmitter<any>();
private targetLibrary = null; private targetLibrary = null;
@@ -62,12 +62,12 @@ export class LibraryMembershipDirective implements OnChanges {
@Input('acaLibraryMembership') @Input('acaLibraryMembership')
selection: SiteEntry = null; selection: SiteEntry = null;
@Output() toggle: EventEmitter< @Output()
LibraryMembershipToggleEvent toggle = new EventEmitter<LibraryMembershipToggleEvent>();
> = new EventEmitter();
@Output() error: EventEmitter< // tslint:disable-next-line: no-output-native
LibraryMembershipErrorEvent @Output()
> = new EventEmitter(); error = new EventEmitter<LibraryMembershipErrorEvent>();
@HostListener('click') @HostListener('click')
onClick() { onClick() {
@@ -187,9 +187,10 @@ export class LibraryMembershipDirective implements OnChanges {
} }
private joinLibraryRequest() { private joinLibraryRequest() {
const memberBody = <SiteMembershipRequestBody>{ const memberBody = {
id: this.targetSite.id id: this.targetSite.id
}; } as SiteMembershipRequestBody;
return from( return from(
this.alfrescoApiService.peopleApi.addSiteMembershipRequest( this.alfrescoApiService.peopleApi.addSiteMembershipRequest(
'-me-', '-me-',
+3 -3
View File
@@ -30,7 +30,7 @@ import {
Input, Input,
Output Output
} from '@angular/core'; } from '@angular/core';
import { NodeEntry, NodeBodyLock, SharedLinkEntry } from '@alfresco/js-api'; import { NodeEntry, SharedLinkEntry } from '@alfresco/js-api';
import { AlfrescoApiService } from '@alfresco/adf-core'; import { AlfrescoApiService } from '@alfresco/adf-core';
import { isLocked } from '@alfresco/aca-shared'; import { isLocked } from '@alfresco/aca-shared';
@@ -58,7 +58,7 @@ export class LockNodeDirective {
} }
private async toggleLock(node: NodeEntry | SharedLinkEntry) { private async toggleLock(node: NodeEntry | SharedLinkEntry) {
const id = (<SharedLinkEntry>node).entry.nodeId || node.entry.id; const id = (node as SharedLinkEntry).entry.nodeId || node.entry.id;
if (isLocked(this.node)) { if (isLocked(this.node)) {
try { try {
@@ -82,7 +82,7 @@ export class LockNodeDirective {
} }
private lockNode(nodeId: string) { private lockNode(nodeId: string) {
return this.alfrescoApiService.nodesApi.lockNode(nodeId, <NodeBodyLock>{ return this.alfrescoApiService.nodesApi.lockNode(nodeId, {
type: 'ALLOW_OWNER_CHANGES', type: 'ALLOW_OWNER_CHANGES',
lifetime: 'PERSISTENT' lifetime: 'PERSISTENT'
}); });
+2 -2
View File
@@ -647,7 +647,7 @@ describe('AppExtensionService', () => {
it('should reduce empty menus', () => { it('should reduce empty menus', () => {
const actions = [ const actions = [
<any>{ id: '1', type: ContentActionType.button }, { id: '1', type: ContentActionType.button },
{ {
id: '2', id: '2',
type: ContentActionType.menu type: ContentActionType.menu
@@ -784,7 +784,7 @@ describe('AppExtensionService', () => {
} }
}); });
expect(service.getSharedLinkViewerToolbarActions()).toEqual(<any>actions); expect(service.getSharedLinkViewerToolbarActions()).toEqual(actions);
}); });
}); });
+6 -4
View File
@@ -220,14 +220,14 @@ export class AppExtensionService implements RuleContext {
); );
if (config.features && config.features.viewer) { if (config.features && config.features.viewer) {
this.viewerRules = <ViewerRules>(config.features.viewer['rules'] || {}); this.viewerRules = (config.features.viewer['rules'] as ViewerRules) || {};
} }
this.registerIcons(config); this.registerIcons(config);
const references = (config.$references || []) const references = (config.$references || [])
.filter(entry => typeof entry === 'object') .filter(entry => typeof entry === 'object')
.map(entry => <ExtensionRef>entry); .map(entry => entry as ExtensionRef);
this._references.next(references); this._references.next(references);
} }
@@ -383,7 +383,7 @@ export class AppExtensionService implements RuleContext {
} }
getSidebarTabs(): Array<SidebarTabRef> { getSidebarTabs(): Array<SidebarTabRef> {
return this.sidebar.filter(action => this.filterVisible(<any>action)); return this.sidebar.filter(action => this.filterVisible(action));
} }
getComponentById(id: string): Type<{}> { getComponentById(id: string): Type<{}> {
@@ -523,7 +523,9 @@ export class AppExtensionService implements RuleContext {
}; };
} }
filterVisible(action: ContentActionRef | SettingsGroupRef): boolean { filterVisible(
action: ContentActionRef | SettingsGroupRef | SidebarTabRef
): boolean {
if (action && action.rules && action.rules.visible) { if (action && action.rules && action.rules.visible) {
return this.extensions.evaluateRule(action.rules.visible, this); return this.extensions.evaluateRule(action.rules.visible, this);
} }
@@ -40,7 +40,9 @@ import {
CopyNodesAction, CopyNodesAction,
ShareNodeAction, ShareNodeAction,
SetSelectedNodesAction, SetSelectedNodesAction,
UnlockWriteAction UnlockWriteAction,
SnackbarActionTypes,
RouterActionTypes
} from '@alfresco/aca-shared/store'; } from '@alfresco/aca-shared/store';
import { map } from 'rxjs/operators'; import { map } from 'rxjs/operators';
import { NodeEffects } from '../store/effects/node.effects'; import { NodeEffects } from '../store/effects/node.effects';
@@ -52,10 +54,6 @@ import { NodeActionsService } from './node-actions.service';
import { TranslationService, AlfrescoApiService } from '@alfresco/adf-core'; import { TranslationService, AlfrescoApiService } from '@alfresco/adf-core';
import { MatDialog } from '@angular/material/dialog'; import { MatDialog } from '@angular/material/dialog';
import { MatSnackBar } from '@angular/material/snack-bar'; import { MatSnackBar } from '@angular/material/snack-bar';
import {
SnackbarActionTypes,
RouterActionTypes
} from '../../../projects/aca-shared/store/src/public_api';
describe('ContentManagementService', () => { describe('ContentManagementService', () => {
let dialog: MatDialog; let dialog: MatDialog;
@@ -95,13 +93,13 @@ describe('ContentManagementService', () => {
of('OPERATION.SUCCES.CONTENT.COPY') of('OPERATION.SUCCES.CONTENT.COPY')
); );
const selection = [ const selection: any[] = [
<any>{ entry: { id: 'node-to-copy-id', name: 'name' } } { entry: { id: 'node-to-copy-id', name: 'name' } }
]; ];
const createdItems = [{ entry: { id: 'copy-id', name: 'name' } }]; const createdItems: any[] = [{ entry: { id: 'copy-id', name: 'name' } }];
store.dispatch(new CopyNodesAction(selection)); store.dispatch(new CopyNodesAction(selection));
nodeActions.contentCopied.next(<any>createdItems); nodeActions.contentCopied.next(createdItems);
expect(nodeActions.copyNodes).toHaveBeenCalled(); expect(nodeActions.copyNodes).toHaveBeenCalled();
expect(snackBar.open['calls'].argsFor(0)[0]).toBe( expect(snackBar.open['calls'].argsFor(0)[0]).toBe(
@@ -114,13 +112,13 @@ describe('ContentManagementService', () => {
of('OPERATION.SUCCES.CONTENT.COPY') of('OPERATION.SUCCES.CONTENT.COPY')
); );
const selection = [ const selection: any[] = [
<any>{ entry: { id: 'node-to-copy-1', name: 'name1' } }, { entry: { id: 'node-to-copy-1', name: 'name1' } },
<any>{ entry: { id: 'node-to-copy-2', name: 'name2' } } { entry: { id: 'node-to-copy-2', name: 'name2' } }
]; ];
const createdItems = [ const createdItems: any[] = [
<any>{ entry: { id: 'copy-of-node-1', name: 'name1' } }, { entry: { id: 'copy-of-node-1', name: 'name1' } },
<any>{ entry: { id: 'copy-of-node-2', name: 'name2' } } { entry: { id: 'copy-of-node-2', name: 'name2' } }
]; ];
store.dispatch(new CopyNodesAction(selection)); store.dispatch(new CopyNodesAction(selection));
@@ -137,12 +135,12 @@ describe('ContentManagementService', () => {
of('OPERATION.SUCCES.CONTENT.COPY') of('OPERATION.SUCCES.CONTENT.COPY')
); );
const selection = [ const selection: any[] = [
<any>{ entry: { id: 'node-to-copy-1', name: 'name1' } }, { entry: { id: 'node-to-copy-1', name: 'name1' } },
<any>{ entry: { id: 'node-to-copy-2', name: 'name2' } } { entry: { id: 'node-to-copy-2', name: 'name2' } }
]; ];
const createdItems = [ const createdItems: any[] = [
<any>{ entry: { id: 'copy-of-node-1', name: 'name1' } } { entry: { id: 'copy-of-node-1', name: 'name1' } }
]; ];
store.dispatch(new CopyNodesAction(selection)); store.dispatch(new CopyNodesAction(selection));
@@ -159,14 +157,14 @@ describe('ContentManagementService', () => {
of('OPERATION.SUCCES.CONTENT.COPY') of('OPERATION.SUCCES.CONTENT.COPY')
); );
const selection = [ const selection: any[] = [
<any>{ entry: { id: 'node-to-copy-0', name: 'name0' } }, { entry: { id: 'node-to-copy-0', name: 'name0' } },
<any>{ entry: { id: 'node-to-copy-1', name: 'name1' } }, { entry: { id: 'node-to-copy-1', name: 'name1' } },
<any>{ entry: { id: 'node-to-copy-2', name: 'name2' } } { entry: { id: 'node-to-copy-2', name: 'name2' } }
]; ];
const createdItems = [ const createdItems: any[] = [
<any>{ entry: { id: 'copy-of-node-0', name: 'name0' } }, { entry: { id: 'copy-of-node-0', name: 'name0' } },
<any>{ entry: { id: 'copy-of-node-1', name: 'name1' } } { entry: { id: 'copy-of-node-1', name: 'name1' } }
]; ];
store.dispatch(new CopyNodesAction(selection)); store.dispatch(new CopyNodesAction(selection));
@@ -183,15 +181,15 @@ describe('ContentManagementService', () => {
of('OPERATION.SUCCES.CONTENT.COPY') of('OPERATION.SUCCES.CONTENT.COPY')
); );
const selection = [ const selection: any[] = [
<any>{ entry: { id: 'node-to-copy-0', name: 'name0' } }, { entry: { id: 'node-to-copy-0', name: 'name0' } },
<any>{ entry: { id: 'node-to-copy-1', name: 'name1' } }, { entry: { id: 'node-to-copy-1', name: 'name1' } },
<any>{ entry: { id: 'node-to-copy-2', name: 'name2' } } { entry: { id: 'node-to-copy-2', name: 'name2' } }
]; ];
const createdItems = []; const createdItems: any[] = [];
store.dispatch(new CopyNodesAction(selection)); store.dispatch(new CopyNodesAction(selection));
nodeActions.contentCopied.next(<any>createdItems); nodeActions.contentCopied.next(createdItems);
expect(nodeActions.copyNodes).toHaveBeenCalled(); expect(nodeActions.copyNodes).toHaveBeenCalled();
expect(snackBar.open['calls'].argsFor(0)[0]).toBe( expect(snackBar.open['calls'].argsFor(0)[0]).toBe(
@@ -204,11 +202,13 @@ describe('ContentManagementService', () => {
of('OPERATION.SUCCES.CONTENT.COPY') of('OPERATION.SUCCES.CONTENT.COPY')
); );
const selection = [<any>{ entry: { id: 'node-to-copy', name: 'name' } }]; const selection: any[] = [
const createdItems = []; { entry: { id: 'node-to-copy', name: 'name' } }
];
const createdItems: any[] = [];
store.dispatch(new CopyNodesAction(selection)); store.dispatch(new CopyNodesAction(selection));
nodeActions.contentCopied.next(<any>createdItems); nodeActions.contentCopied.next(createdItems);
expect(nodeActions.copyNodes).toHaveBeenCalled(); expect(nodeActions.copyNodes).toHaveBeenCalled();
expect(snackBar.open['calls'].argsFor(0)[0]).toBe( expect(snackBar.open['calls'].argsFor(0)[0]).toBe(
@@ -219,8 +219,8 @@ describe('ContentManagementService', () => {
it('notifies error if success message was not emitted', () => { it('notifies error if success message was not emitted', () => {
spyOn(nodeActions, 'copyNodes').and.returnValue(of('')); spyOn(nodeActions, 'copyNodes').and.returnValue(of(''));
const selection = [ const selection: any[] = [
<any>{ entry: { id: 'node-to-copy-id', name: 'name' } } { entry: { id: 'node-to-copy-id', name: 'name' } }
]; ];
store.dispatch(new CopyNodesAction(selection)); store.dispatch(new CopyNodesAction(selection));
@@ -237,7 +237,7 @@ describe('ContentManagementService', () => {
throwError(new Error(JSON.stringify({ error: { statusCode: 403 } }))) throwError(new Error(JSON.stringify({ error: { statusCode: 403 } })))
); );
const selection = [<any>{ entry: { id: '1', name: 'name' } }]; const selection: any[] = [{ entry: { id: '1', name: 'name' } }];
store.dispatch(new CopyNodesAction(selection)); store.dispatch(new CopyNodesAction(selection));
expect(nodeActions.copyNodes).toHaveBeenCalled(); expect(nodeActions.copyNodes).toHaveBeenCalled();
@@ -251,7 +251,7 @@ describe('ContentManagementService', () => {
throwError(new Error(JSON.stringify({ error: { statusCode: 404 } }))) throwError(new Error(JSON.stringify({ error: { statusCode: 404 } })))
); );
const selection = [<any>{ entry: { id: '1', name: 'name' } }]; const selection: any[] = [{ entry: { id: '1', name: 'name' } }];
store.dispatch(new CopyNodesAction(selection)); store.dispatch(new CopyNodesAction(selection));
@@ -276,13 +276,13 @@ describe('ContentManagementService', () => {
it('should delete the newly created node on Undo action', () => { it('should delete the newly created node on Undo action', () => {
spyOn(contentApi, 'deleteNode').and.returnValue(of(null)); spyOn(contentApi, 'deleteNode').and.returnValue(of(null));
const selection = [ const selection: any[] = [
<any>{ entry: { id: 'node-to-copy-id', name: 'name' } } { entry: { id: 'node-to-copy-id', name: 'name' } }
]; ];
const createdItems = [{ entry: { id: 'copy-id', name: 'name' } }]; const createdItems: any[] = [{ entry: { id: 'copy-id', name: 'name' } }];
store.dispatch(new CopyNodesAction(selection)); store.dispatch(new CopyNodesAction(selection));
nodeActions.contentCopied.next(<any>createdItems); nodeActions.contentCopied.next(createdItems);
expect(nodeActions.copyNodes).toHaveBeenCalled(); expect(nodeActions.copyNodes).toHaveBeenCalled();
expect(snackBar.open['calls'].argsFor(0)[0]).toBe( expect(snackBar.open['calls'].argsFor(0)[0]).toBe(
@@ -300,9 +300,9 @@ describe('ContentManagementService', () => {
of(null) of(null)
); );
const selection = [ const selection: any[] = [
<any>{ entry: { id: 'node-to-copy-1', name: 'name1' } }, { entry: { id: 'node-to-copy-1', name: 'name1' } },
<any>{ {
entry: { entry: {
id: 'node-to-copy-2', id: 'node-to-copy-2',
name: 'folder-with-name-already-existing-on-destination' name: 'folder-with-name-already-existing-on-destination'
@@ -311,7 +311,7 @@ describe('ContentManagementService', () => {
]; ];
const id1 = 'copy-of-node-1'; const id1 = 'copy-of-node-1';
const id2 = 'copy-of-child-of-node-2'; const id2 = 'copy-of-child-of-node-2';
const createdItems = [ const createdItems: any[] = [
{ entry: { id: id1, name: 'name1' } }, { entry: { id: id1, name: 'name1' } },
[ [
{ {
@@ -325,7 +325,7 @@ describe('ContentManagementService', () => {
]; ];
store.dispatch(new CopyNodesAction(selection)); store.dispatch(new CopyNodesAction(selection));
nodeActions.contentCopied.next(<any>createdItems); nodeActions.contentCopied.next(createdItems);
expect(nodeActions.copyNodes).toHaveBeenCalled(); expect(nodeActions.copyNodes).toHaveBeenCalled();
expect(snackBar.open['calls'].argsFor(0)[0]).toBe( expect(snackBar.open['calls'].argsFor(0)[0]).toBe(
@@ -342,10 +342,10 @@ describe('ContentManagementService', () => {
it('notifies when error occurs on Undo action', () => { it('notifies when error occurs on Undo action', () => {
spyOn(contentApi, 'deleteNode').and.returnValue(throwError(null)); spyOn(contentApi, 'deleteNode').and.returnValue(throwError(null));
const selection = [ const selection: any[] = [
<any>{ entry: { id: 'node-to-copy-id', name: 'name' } } { entry: { id: 'node-to-copy-id', name: 'name' } }
]; ];
const createdItems = [<any>{ entry: { id: 'copy-id', name: 'name' } }]; const createdItems: any[] = [{ entry: { id: 'copy-id', name: 'name' } }];
store.dispatch(new CopyNodesAction(selection)); store.dispatch(new CopyNodesAction(selection));
nodeActions.contentCopied.next(createdItems); nodeActions.contentCopied.next(createdItems);
@@ -362,10 +362,10 @@ describe('ContentManagementService', () => {
throwError(new Error('oops!')) throwError(new Error('oops!'))
); );
const selection = [ const selection: any[] = [
<any>{ entry: { id: 'node-to-copy-id', name: 'name' } } { entry: { id: 'node-to-copy-id', name: 'name' } }
]; ];
const createdItems = [<any>{ entry: { id: 'copy-id', name: 'name' } }]; const createdItems: any[] = [{ entry: { id: 'copy-id', name: 'name' } }];
store.dispatch(new CopyNodesAction(selection)); store.dispatch(new CopyNodesAction(selection));
nodeActions.contentCopied.next(createdItems); nodeActions.contentCopied.next(createdItems);
@@ -382,10 +382,10 @@ describe('ContentManagementService', () => {
throwError(new Error(JSON.stringify({ error: { statusCode: 403 } }))) throwError(new Error(JSON.stringify({ error: { statusCode: 403 } })))
); );
const selection = [ const selection: any[] = [
<any>{ entry: { id: 'node-to-copy-id', name: 'name' } } { entry: { id: 'node-to-copy-id', name: 'name' } }
]; ];
const createdItems = [<any>{ entry: { id: 'copy-id', name: 'name' } }]; const createdItems: any[] = [{ entry: { id: 'copy-id', name: 'name' } }];
store.dispatch(new CopyNodesAction(selection)); store.dispatch(new CopyNodesAction(selection));
nodeActions.contentCopied.next(createdItems); nodeActions.contentCopied.next(createdItems);
@@ -469,7 +469,7 @@ describe('ContentManagementService', () => {
}); });
it('notifies partial move of a node', () => { it('notifies partial move of a node', () => {
const nodes = [<any>{ entry: { id: '1', name: 'name' } }]; const nodes: any[] = [{ entry: { id: '1', name: 'name' } }];
const moveResponse = { const moveResponse = {
succeeded: [], succeeded: [],
failed: [], failed: [],
@@ -493,9 +493,9 @@ describe('ContentManagementService', () => {
}); });
it('notifies partial move of multiple nodes', () => { it('notifies partial move of multiple nodes', () => {
const nodes = [ const nodes: any[] = [
<any>{ entry: { id: '1', name: 'name' } }, { entry: { id: '1', name: 'name' } },
<any>{ entry: { id: '2', name: 'name2' } } { entry: { id: '2', name: 'name2' } }
]; ];
const moveResponse = { const moveResponse = {
succeeded: [], succeeded: [],
@@ -520,9 +520,9 @@ describe('ContentManagementService', () => {
}); });
it('notifies successful move and the number of nodes that could not be moved', () => { it('notifies successful move and the number of nodes that could not be moved', () => {
const nodes = [ const nodes: any[] = [
<any>{ entry: { id: '1', name: 'name' } }, { entry: { id: '1', name: 'name' } },
<any>{ entry: { id: '2', name: 'name2' } } { entry: { id: '2', name: 'name2' } }
]; ];
const moveResponse = { const moveResponse = {
succeeded: [nodes[0]], succeeded: [nodes[0]],
@@ -546,9 +546,9 @@ describe('ContentManagementService', () => {
}); });
it('notifies successful move and the number of partially moved ones', () => { it('notifies successful move and the number of partially moved ones', () => {
const nodes = [ const nodes: any[] = [
<any>{ entry: { id: '1', name: 'name' } }, { entry: { id: '1', name: 'name' } },
<any>{ entry: { id: '2', name: 'name2' } } { entry: { id: '2', name: 'name2' } }
]; ];
const moveResponse = { const moveResponse = {
succeeded: [nodes[0]], succeeded: [nodes[0]],
@@ -571,7 +571,7 @@ describe('ContentManagementService', () => {
}); });
it('notifies error if success message was not emitted', () => { it('notifies error if success message was not emitted', () => {
const nodes = [<any>{ entry: { id: 'node-to-move-id', name: 'name' } }]; const nodes: any[] = [{ entry: { id: 'node-to-move-id', name: 'name' } }];
const moveResponse = { const moveResponse = {
succeeded: [], succeeded: [],
failed: [], failed: [],
@@ -594,7 +594,7 @@ describe('ContentManagementService', () => {
throwError(new Error(JSON.stringify({ error: { statusCode: 403 } }))) throwError(new Error(JSON.stringify({ error: { statusCode: 403 } })))
); );
const selection = [<any>{ entry: { id: '1', name: 'name' } }]; const selection: any[] = [{ entry: { id: '1', name: 'name' } }];
store.dispatch(new MoveNodesAction(selection)); store.dispatch(new MoveNodesAction(selection));
expect(nodeActions.moveNodes).toHaveBeenCalled(); expect(nodeActions.moveNodes).toHaveBeenCalled();
@@ -608,7 +608,7 @@ describe('ContentManagementService', () => {
throwError(new Error(JSON.stringify({ error: { statusCode: 404 } }))) throwError(new Error(JSON.stringify({ error: { statusCode: 404 } })))
); );
const selection = [<any>{ entry: { id: '1', name: 'name' } }]; const selection: any[] = [{ entry: { id: '1', name: 'name' } }];
store.dispatch(new MoveNodesAction(selection)); store.dispatch(new MoveNodesAction(selection));
expect(nodeActions.moveNodes).toHaveBeenCalled(); expect(nodeActions.moveNodes).toHaveBeenCalled();
@@ -622,7 +622,7 @@ describe('ContentManagementService', () => {
throwError(new Error(JSON.stringify({ error: { statusCode: 409 } }))) throwError(new Error(JSON.stringify({ error: { statusCode: 409 } })))
); );
const selection = [<any>{ entry: { id: '1', name: 'name' } }]; const selection: any[] = [{ entry: { id: '1', name: 'name' } }];
store.dispatch(new MoveNodesAction(selection)); store.dispatch(new MoveNodesAction(selection));
expect(nodeActions.moveNodes).toHaveBeenCalled(); expect(nodeActions.moveNodes).toHaveBeenCalled();
@@ -632,7 +632,7 @@ describe('ContentManagementService', () => {
}); });
it('notifies error if move response has only failed items', () => { it('notifies error if move response has only failed items', () => {
const nodes = [<any>{ entry: { id: '1', name: 'name' } }]; const nodes: any[] = [{ entry: { id: '1', name: 'name' } }];
const moveResponse = { const moveResponse = {
succeeded: [], succeeded: [],
failed: [{}], failed: [{}],
@@ -684,7 +684,7 @@ describe('ContentManagementService', () => {
const node = { const node = {
entry: { id: 'node-to-move-id', name: 'name', parentId: initialParent } entry: { id: 'node-to-move-id', name: 'name', parentId: initialParent }
}; };
const selection = [<any>node]; const selection: any[] = [node];
spyOn(nodeActions, 'moveNodeAction').and.returnValue(of({})); spyOn(nodeActions, 'moveNodeAction').and.returnValue(of({}));
@@ -694,7 +694,7 @@ describe('ContentManagementService', () => {
partiallySucceeded: [], partiallySucceeded: [],
succeeded: [{ itemMoved: node, initialParentId: initialParent }] succeeded: [{ itemMoved: node, initialParentId: initialParent }]
}; };
nodeActions.contentMoved.next(<any>movedItems); nodeActions.contentMoved.next(movedItems);
expect(nodeActions.moveNodeAction).toHaveBeenCalledWith( expect(nodeActions.moveNodeAction).toHaveBeenCalledWith(
movedItems.succeeded[0].itemMoved.entry, movedItems.succeeded[0].itemMoved.entry,
@@ -715,7 +715,7 @@ describe('ContentManagementService', () => {
parentId: initialParent parentId: initialParent
} }
}; };
const selection = [<any>node]; const selection: any[] = [node];
spyOn(nodeActions, 'moveNodeAction').and.returnValue(of({})); spyOn(nodeActions, 'moveNodeAction').and.returnValue(of({}));
@@ -726,7 +726,7 @@ describe('ContentManagementService', () => {
}; };
store.dispatch(new MoveNodesAction(selection)); store.dispatch(new MoveNodesAction(selection));
nodeActions.contentMoved.next(<any>movedItems); nodeActions.contentMoved.next(movedItems);
expect(nodeActions.moveNodeAction).toHaveBeenCalledWith( expect(nodeActions.moveNodeAction).toHaveBeenCalledWith(
node.entry, node.entry,
@@ -750,7 +750,7 @@ describe('ContentManagementService', () => {
isFolder: true isFolder: true
} }
}; };
const selection = [<any>node]; const selection: any[] = [node];
const itemMoved = {}; // folder was empty const itemMoved = {}; // folder was empty
nodeActions.moveDeletedEntries = [node]; // folder got deleted nodeActions.moveDeletedEntries = [node]; // folder got deleted
@@ -762,7 +762,7 @@ describe('ContentManagementService', () => {
}; };
store.dispatch(new MoveNodesAction(selection)); store.dispatch(new MoveNodesAction(selection));
nodeActions.contentMoved.next(<any>movedItems); nodeActions.contentMoved.next(movedItems);
expect(contentApi.restoreNode).toHaveBeenCalled(); expect(contentApi.restoreNode).toHaveBeenCalled();
expect(snackBar.open['calls'].argsFor(0)[0]).toBe( expect(snackBar.open['calls'].argsFor(0)[0]).toBe(
@@ -775,7 +775,7 @@ describe('ContentManagementService', () => {
actions$.pipe( actions$.pipe(
ofType<SnackbarErrorAction>(SnackbarActionTypes.Error), ofType<SnackbarErrorAction>(SnackbarActionTypes.Error),
map(action => done()) map(() => done())
); );
const initialParent = 'parent-id-0'; const initialParent = 'parent-id-0';
@@ -786,7 +786,7 @@ describe('ContentManagementService', () => {
parentId: initialParent parentId: initialParent
} }
}; };
const selection = [<any>node]; const selection: any[] = [node];
const afterMoveParentId = 'parent-id-1'; const afterMoveParentId = 'parent-id-1';
const childMoved = { const childMoved = {
@@ -805,7 +805,7 @@ describe('ContentManagementService', () => {
}; };
store.dispatch(new MoveNodesAction(selection)); store.dispatch(new MoveNodesAction(selection));
nodeActions.contentMoved.next(<any>movedItems); nodeActions.contentMoved.next(movedItems);
expect(contentApi.restoreNode).toHaveBeenCalled(); expect(contentApi.restoreNode).toHaveBeenCalled();
})); }));
@@ -817,7 +817,7 @@ describe('ContentManagementService', () => {
actions$.pipe( actions$.pipe(
ofType<SnackbarErrorAction>(SnackbarActionTypes.Error), ofType<SnackbarErrorAction>(SnackbarActionTypes.Error),
map(action => done()) map(() => done())
); );
const initialParent = 'parent-id-0'; const initialParent = 'parent-id-0';
@@ -838,7 +838,7 @@ describe('ContentManagementService', () => {
}; };
store.dispatch(new MoveNodesAction(selection)); store.dispatch(new MoveNodesAction(selection));
nodeActions.contentMoved.next(<any>movedItems); nodeActions.contentMoved.next(movedItems);
expect(contentApi.restoreNode).toHaveBeenCalled(); expect(contentApi.restoreNode).toHaveBeenCalled();
})); }));
@@ -850,14 +850,14 @@ describe('ContentManagementService', () => {
actions$.pipe( actions$.pipe(
ofType<SnackbarErrorAction>(SnackbarActionTypes.Error), ofType<SnackbarErrorAction>(SnackbarActionTypes.Error),
map(action => done()) map(() => done())
); );
const initialParent = 'parent-id-0'; const initialParent = 'parent-id-0';
const node = { const node = {
entry: { id: 'node-to-move-id', name: 'name', parentId: initialParent } entry: { id: 'node-to-move-id', name: 'name', parentId: initialParent }
}; };
const selection = [<any>node]; const selection: any[] = [node];
const childMoved = { const childMoved = {
entry: { id: 'child-of-node-to-move-id', name: 'child-name' } entry: { id: 'child-of-node-to-move-id', name: 'child-name' }
@@ -871,7 +871,7 @@ describe('ContentManagementService', () => {
}; };
store.dispatch(new MoveNodesAction(selection)); store.dispatch(new MoveNodesAction(selection));
nodeActions.contentMoved.next(<any>movedItems); nodeActions.contentMoved.next(movedItems);
expect(nodeActions.moveNodes).toHaveBeenCalled(); expect(nodeActions.moveNodes).toHaveBeenCalled();
expect(contentApi.restoreNode).toHaveBeenCalled(); expect(contentApi.restoreNode).toHaveBeenCalled();
@@ -884,12 +884,10 @@ describe('ContentManagementService', () => {
actions$.pipe( actions$.pipe(
ofType<SnackbarInfoAction>(SnackbarActionTypes.Info), ofType<SnackbarInfoAction>(SnackbarActionTypes.Info),
map(action => { map(() => done())
done();
})
); );
const selection = [<any>{ entry: { id: '1', name: 'name1' } }]; const selection: any[] = [{ entry: { id: '1', name: 'name1' } }];
store.dispatch(new DeleteNodesAction(selection)); store.dispatch(new DeleteNodesAction(selection));
})); }));
@@ -899,12 +897,12 @@ describe('ContentManagementService', () => {
actions$.pipe( actions$.pipe(
ofType<SnackbarErrorAction>(SnackbarActionTypes.Error), ofType<SnackbarErrorAction>(SnackbarActionTypes.Error),
map(action => { map(() => {
done(); done();
}) })
); );
const selection = [<any>{ entry: { id: '1', name: 'name1' } }]; const selection: any[] = [{ entry: { id: '1', name: 'name1' } }];
store.dispatch(new DeleteNodesAction(selection)); store.dispatch(new DeleteNodesAction(selection));
})); }));
@@ -914,14 +912,12 @@ describe('ContentManagementService', () => {
actions$.pipe( actions$.pipe(
ofType<SnackbarInfoAction>(SnackbarActionTypes.Info), ofType<SnackbarInfoAction>(SnackbarActionTypes.Info),
map(action => { map(() => done())
done();
})
); );
const selection = [ const selection: any[] = [
<any>{ entry: { id: '1', name: 'name1' } }, { entry: { id: '1', name: 'name1' } },
<any>{ entry: { id: '2', name: 'name2' } } { entry: { id: '2', name: 'name2' } }
]; ];
store.dispatch(new DeleteNodesAction(selection)); store.dispatch(new DeleteNodesAction(selection));
@@ -932,14 +928,12 @@ describe('ContentManagementService', () => {
actions$.pipe( actions$.pipe(
ofType<SnackbarErrorAction>(SnackbarActionTypes.Error), ofType<SnackbarErrorAction>(SnackbarActionTypes.Error),
map(action => { map(() => done())
done();
})
); );
const selection = [ const selection: any[] = [
<any>{ entry: { id: '1', name: 'name1' } }, { entry: { id: '1', name: 'name1' } },
<any>{ entry: { id: '2', name: 'name2' } } { entry: { id: '2', name: 'name2' } }
]; ];
store.dispatch(new DeleteNodesAction(selection)); store.dispatch(new DeleteNodesAction(selection));
@@ -956,14 +950,12 @@ describe('ContentManagementService', () => {
actions$.pipe( actions$.pipe(
ofType<SnackbarWarningAction>(SnackbarActionTypes.Warning), ofType<SnackbarWarningAction>(SnackbarActionTypes.Warning),
map(action => { map(() => done())
done();
})
); );
const selection = [ const selection: any[] = [
<any>{ entry: { id: '1', name: 'name1' } }, { entry: { id: '1', name: 'name1' } },
<any>{ entry: { id: '2', name: 'name2' } } { entry: { id: '2', name: 'name2' } }
]; ];
store.dispatch(new DeleteNodesAction(selection)); store.dispatch(new DeleteNodesAction(selection));
@@ -988,15 +980,13 @@ describe('ContentManagementService', () => {
actions$.pipe( actions$.pipe(
ofType<SnackbarWarningAction>(SnackbarActionTypes.Warning), ofType<SnackbarWarningAction>(SnackbarActionTypes.Warning),
map(action => { map(() => done())
done();
})
); );
const selection = [ const selection: any[] = [
<any>{ entry: { id: '1', name: 'name1' } }, { entry: { id: '1', name: 'name1' } },
<any>{ entry: { id: '2', name: 'name2' } }, { entry: { id: '2', name: 'name2' } },
<any>{ entry: { id: '3', name: 'name3' } } { entry: { id: '3', name: 'name3' } }
]; ];
store.dispatch(new DeleteNodesAction(selection)); store.dispatch(new DeleteNodesAction(selection));
@@ -1022,7 +1012,7 @@ describe('ContentManagementService', () => {
it('call purge nodes if selection is not empty', fakeAsync(() => { it('call purge nodes if selection is not empty', fakeAsync(() => {
spyOn(contentApi, 'purgeDeletedNode').and.returnValue(of({})); spyOn(contentApi, 'purgeDeletedNode').and.returnValue(of({}));
const selection = [<any>{ entry: { id: '1' } }]; const selection: any[] = [{ entry: { id: '1' } }];
store.dispatch(new PurgeDeletedNodesAction(selection)); store.dispatch(new PurgeDeletedNodesAction(selection));
expect(contentApi.purgeDeletedNode).toHaveBeenCalled(); expect(contentApi.purgeDeletedNode).toHaveBeenCalled();
@@ -1032,9 +1022,7 @@ describe('ContentManagementService', () => {
it('raises warning on multiple fail and one success', fakeAsync(done => { it('raises warning on multiple fail and one success', fakeAsync(done => {
actions$.pipe( actions$.pipe(
ofType<SnackbarWarningAction>(SnackbarActionTypes.Warning), ofType<SnackbarWarningAction>(SnackbarActionTypes.Warning),
map((action: SnackbarWarningAction) => { map(() => done())
done();
})
); );
spyOn(contentApi, 'purgeDeletedNode').and.callFake(id => { spyOn(contentApi, 'purgeDeletedNode').and.callFake(id => {
@@ -1053,10 +1041,10 @@ describe('ContentManagementService', () => {
return of(null); return of(null);
}); });
const selection = [ const selection: any[] = [
<any>{ entry: { id: '1', name: 'name1' } }, { entry: { id: '1', name: 'name1' } },
<any>{ entry: { id: '2', name: 'name2' } }, { entry: { id: '2', name: 'name2' } },
<any>{ entry: { id: '3', name: 'name3' } } { entry: { id: '3', name: 'name3' } }
]; ];
store.dispatch(new PurgeDeletedNodesAction(selection)); store.dispatch(new PurgeDeletedNodesAction(selection));
@@ -1065,9 +1053,7 @@ describe('ContentManagementService', () => {
it('raises warning on multiple success and multiple fail', fakeAsync(done => { it('raises warning on multiple success and multiple fail', fakeAsync(done => {
actions$.pipe( actions$.pipe(
ofType<SnackbarWarningAction>(SnackbarActionTypes.Warning), ofType<SnackbarWarningAction>(SnackbarActionTypes.Warning),
map((action: SnackbarWarningAction) => { map(() => done())
done();
})
); );
spyOn(contentApi, 'purgeDeletedNode').and.callFake(id => { spyOn(contentApi, 'purgeDeletedNode').and.callFake(id => {
@@ -1090,11 +1076,11 @@ describe('ContentManagementService', () => {
return of(null); return of(null);
}); });
const selection = [ const selection: any[] = [
<any>{ entry: { id: '1', name: 'name1' } }, { entry: { id: '1', name: 'name1' } },
<any>{ entry: { id: '2', name: 'name2' } }, { entry: { id: '2', name: 'name2' } },
<any>{ entry: { id: '3', name: 'name3' } }, { entry: { id: '3', name: 'name3' } },
<any>{ entry: { id: '4', name: 'name4' } } { entry: { id: '4', name: 'name4' } }
]; ];
store.dispatch(new PurgeDeletedNodesAction(selection)); store.dispatch(new PurgeDeletedNodesAction(selection));
@@ -1103,14 +1089,12 @@ describe('ContentManagementService', () => {
it('raises info on one selected node success', fakeAsync(done => { it('raises info on one selected node success', fakeAsync(done => {
actions$.pipe( actions$.pipe(
ofType<SnackbarInfoAction>(SnackbarActionTypes.Info), ofType<SnackbarInfoAction>(SnackbarActionTypes.Info),
map((action: SnackbarInfoAction) => { map(() => done())
done();
})
); );
spyOn(contentApi, 'purgeDeletedNode').and.returnValue(of({})); spyOn(contentApi, 'purgeDeletedNode').and.returnValue(of({}));
const selection = [<any>{ entry: { id: '1', name: 'name1' } }]; const selection: any[] = [{ entry: { id: '1', name: 'name1' } }];
store.dispatch(new PurgeDeletedNodesAction(selection)); store.dispatch(new PurgeDeletedNodesAction(selection));
})); }));
@@ -1118,14 +1102,12 @@ describe('ContentManagementService', () => {
it('raises error on one selected node fail', fakeAsync(done => { it('raises error on one selected node fail', fakeAsync(done => {
actions$.pipe( actions$.pipe(
ofType<SnackbarErrorAction>(SnackbarActionTypes.Error), ofType<SnackbarErrorAction>(SnackbarActionTypes.Error),
map((action: SnackbarErrorAction) => { map(() => done())
done();
})
); );
spyOn(contentApi, 'purgeDeletedNode').and.returnValue(throwError({})); spyOn(contentApi, 'purgeDeletedNode').and.returnValue(throwError({}));
const selection = [<any>{ entry: { id: '1', name: 'name1' } }]; const selection: any[] = [{ entry: { id: '1', name: 'name1' } }];
store.dispatch(new PurgeDeletedNodesAction(selection)); store.dispatch(new PurgeDeletedNodesAction(selection));
})); }));
@@ -1133,9 +1115,7 @@ describe('ContentManagementService', () => {
it('raises info on all nodes success', fakeAsync(done => { it('raises info on all nodes success', fakeAsync(done => {
actions$.pipe( actions$.pipe(
ofType<SnackbarInfoAction>(SnackbarActionTypes.Info), ofType<SnackbarInfoAction>(SnackbarActionTypes.Info),
map((action: SnackbarInfoAction) => { map(() => done())
done();
})
); );
spyOn(contentApi, 'purgeDeletedNode').and.callFake(id => { spyOn(contentApi, 'purgeDeletedNode').and.callFake(id => {
if (id === '1') { if (id === '1') {
@@ -1149,9 +1129,9 @@ describe('ContentManagementService', () => {
return of(null); return of(null);
}); });
const selection = [ const selection: any[] = [
<any>{ entry: { id: '1', name: 'name1' } }, { entry: { id: '1', name: 'name1' } },
<any>{ entry: { id: '2', name: 'name2' } } { entry: { id: '2', name: 'name2' } }
]; ];
store.dispatch(new PurgeDeletedNodesAction(selection)); store.dispatch(new PurgeDeletedNodesAction(selection));
@@ -1160,9 +1140,7 @@ describe('ContentManagementService', () => {
it('raises error on all nodes fail', fakeAsync(done => { it('raises error on all nodes fail', fakeAsync(done => {
actions$.pipe( actions$.pipe(
ofType<SnackbarErrorAction>(SnackbarActionTypes.Error), ofType<SnackbarErrorAction>(SnackbarActionTypes.Error),
map((action: SnackbarErrorAction) => { map(() => done())
done();
})
); );
spyOn(contentApi, 'purgeDeletedNode').and.callFake(id => { spyOn(contentApi, 'purgeDeletedNode').and.callFake(id => {
if (id === '1') { if (id === '1') {
@@ -1176,9 +1154,9 @@ describe('ContentManagementService', () => {
return of({}); return of({});
}); });
const selection = [ const selection: any[] = [
<any>{ entry: { id: '1', name: 'name1' } }, { entry: { id: '1', name: 'name1' } },
<any>{ entry: { id: '2', name: 'name2' } } { entry: { id: '2', name: 'name2' } }
]; ];
store.dispatch(new PurgeDeletedNodesAction(selection)); store.dispatch(new PurgeDeletedNodesAction(selection));
@@ -1190,7 +1168,7 @@ describe('ContentManagementService', () => {
it('does not restore nodes if no selection', () => { it('does not restore nodes if no selection', () => {
spyOn(contentApi, 'restoreNode'); spyOn(contentApi, 'restoreNode');
const selection = []; const selection: any[] = [];
store.dispatch(new RestoreDeletedNodesAction(selection)); store.dispatch(new RestoreDeletedNodesAction(selection));
expect(contentApi.restoreNode).not.toHaveBeenCalled(); expect(contentApi.restoreNode).not.toHaveBeenCalled();
@@ -1199,7 +1177,7 @@ describe('ContentManagementService', () => {
it('does not restore nodes if selection has nodes without path', () => { it('does not restore nodes if selection has nodes without path', () => {
spyOn(contentApi, 'restoreNode'); spyOn(contentApi, 'restoreNode');
const selection = [<any>{ entry: { id: '1' } }]; const selection: any[] = [{ entry: { id: '1' } }];
store.dispatch(new RestoreDeletedNodesAction(selection)); store.dispatch(new RestoreDeletedNodesAction(selection));
@@ -1223,8 +1201,8 @@ describe('ContentManagementService', () => {
] ]
}; };
const selection = [ const selection: any[] = [
<any>{ {
entry: { entry: {
id: '1', id: '1',
path path
@@ -1259,8 +1237,8 @@ describe('ContentManagementService', () => {
] ]
}; };
const selection = [ const selection: any[] = [
<any>{ {
entry: { entry: {
id: '1', id: '1',
path path
@@ -1290,7 +1268,7 @@ describe('ContentManagementService', () => {
actions$.pipe( actions$.pipe(
ofType<SnackbarErrorAction>(SnackbarActionTypes.Error), ofType<SnackbarErrorAction>(SnackbarActionTypes.Error),
map(action => done()) map(() => done())
); );
spyOn(contentApi, 'restoreNode').and.callFake(id => { spyOn(contentApi, 'restoreNode').and.callFake(id => {
@@ -1318,10 +1296,10 @@ describe('ContentManagementService', () => {
] ]
}; };
const selection = [ const selection: any[] = [
<any>{ entry: { id: '1', name: 'name1', path } }, { entry: { id: '1', name: 'name1', path } },
<any>{ entry: { id: '2', name: 'name2', path } }, { entry: { id: '2', name: 'name2', path } },
<any>{ entry: { id: '3', name: 'name3', path } } { entry: { id: '3', name: 'name3', path } }
]; ];
store.dispatch(new RestoreDeletedNodesAction(selection)); store.dispatch(new RestoreDeletedNodesAction(selection));
@@ -1333,7 +1311,7 @@ describe('ContentManagementService', () => {
actions$.pipe( actions$.pipe(
ofType<SnackbarErrorAction>(SnackbarActionTypes.Error), ofType<SnackbarErrorAction>(SnackbarActionTypes.Error),
map(action => done()) map(() => done())
); );
const path = { const path = {
@@ -1345,7 +1323,7 @@ describe('ContentManagementService', () => {
] ]
}; };
const selection = [<any>{ entry: { id: '1', name: 'name1', path } }]; const selection: any[] = [{ entry: { id: '1', name: 'name1', path } }];
store.dispatch(new RestoreDeletedNodesAction(selection)); store.dispatch(new RestoreDeletedNodesAction(selection));
})); }));
@@ -1357,7 +1335,7 @@ describe('ContentManagementService', () => {
actions$.pipe( actions$.pipe(
ofType<SnackbarErrorAction>(SnackbarActionTypes.Error), ofType<SnackbarErrorAction>(SnackbarActionTypes.Error),
map(action => done()) map(() => done())
); );
const path = { const path = {
@@ -1369,7 +1347,7 @@ describe('ContentManagementService', () => {
] ]
}; };
const selection = [<any>{ entry: { id: '1', name: 'name1', path } }]; const selection: any[] = [{ entry: { id: '1', name: 'name1', path } }];
store.dispatch(new RestoreDeletedNodesAction(selection)); store.dispatch(new RestoreDeletedNodesAction(selection));
})); }));
@@ -1381,7 +1359,7 @@ describe('ContentManagementService', () => {
actions$.pipe( actions$.pipe(
ofType<SnackbarErrorAction>(SnackbarActionTypes.Error), ofType<SnackbarErrorAction>(SnackbarActionTypes.Error),
map(action => done()) map(() => done())
); );
const path = { const path = {
@@ -1393,7 +1371,7 @@ describe('ContentManagementService', () => {
] ]
}; };
const selection = [<any>{ entry: { id: '1', name: 'name1', path } }]; const selection: any[] = [{ entry: { id: '1', name: 'name1', path } }];
store.dispatch(new RestoreDeletedNodesAction(selection)); store.dispatch(new RestoreDeletedNodesAction(selection));
})); }));
@@ -1413,7 +1391,7 @@ describe('ContentManagementService', () => {
actions$.pipe( actions$.pipe(
ofType<SnackbarInfoAction>(SnackbarActionTypes.Info), ofType<SnackbarInfoAction>(SnackbarActionTypes.Info),
map(action => done()) map(() => done())
); );
const path = { const path = {
@@ -1425,9 +1403,9 @@ describe('ContentManagementService', () => {
] ]
}; };
const selection = [ const selection: any[] = [
<any>{ entry: { id: '1', name: 'name1', path } }, { entry: { id: '1', name: 'name1', path } },
<any>{ entry: { id: '2', name: 'name2', path } } { entry: { id: '2', name: 'name2', path } }
]; ];
store.dispatch(new RestoreDeletedNodesAction(selection)); store.dispatch(new RestoreDeletedNodesAction(selection));
@@ -1438,7 +1416,7 @@ describe('ContentManagementService', () => {
actions$.pipe( actions$.pipe(
ofType<SnackbarInfoAction>(SnackbarActionTypes.Info), ofType<SnackbarInfoAction>(SnackbarActionTypes.Info),
map(action => done()) map(() => done())
); );
const path = { const path = {
@@ -1450,7 +1428,7 @@ describe('ContentManagementService', () => {
] ]
}; };
const selection = [<any>{ entry: { id: '1', name: 'name1', path } }]; const selection: any[] = [{ entry: { id: '1', name: 'name1', path } }];
store.dispatch(new RestoreDeletedNodesAction(selection)); store.dispatch(new RestoreDeletedNodesAction(selection));
})); }));
@@ -1460,7 +1438,7 @@ describe('ContentManagementService', () => {
actions$.pipe( actions$.pipe(
ofType<NavigateRouteAction>(RouterActionTypes.NavigateRoute), ofType<NavigateRouteAction>(RouterActionTypes.NavigateRoute),
map(action => done()) map(() => done())
); );
const path = { const path = {
@@ -1472,8 +1450,8 @@ describe('ContentManagementService', () => {
] ]
}; };
const selection = [ const selection: any[] = [
<any>{ {
entry: { entry: {
id: '1', id: '1',
name: 'name1', name: 'name1',
@@ -1489,7 +1467,7 @@ describe('ContentManagementService', () => {
describe('Share Node', () => { describe('Share Node', () => {
it('should open dialog for nodes without requesting getNodeInfo', fakeAsync(() => { it('should open dialog for nodes without requesting getNodeInfo', fakeAsync(() => {
const node = <any>{ entry: { id: '1', name: 'name1' } }; const node: any = { entry: { id: '1', name: 'name1' } };
spyOn(contentApi, 'getNodeInfo').and.returnValue(of({})); spyOn(contentApi, 'getNodeInfo').and.returnValue(of({}));
spyOn(dialog, 'open').and.returnValue({ spyOn(dialog, 'open').and.returnValue({
afterClosed() { afterClosed() {
@@ -1504,7 +1482,7 @@ describe('ContentManagementService', () => {
})); }));
it('should open dialog with getNodeInfo data when `id` property is missing', fakeAsync(() => { it('should open dialog with getNodeInfo data when `id` property is missing', fakeAsync(() => {
const node = <any>{ entry: { nodeId: '1', name: 'name1' } }; const node: any = { entry: { nodeId: '1', name: 'name1' } };
spyOn(contentApi, 'getNodeInfo').and.returnValue(of({})); spyOn(contentApi, 'getNodeInfo').and.returnValue(of({}));
spyOn(dialog, 'open').and.returnValue({ spyOn(dialog, 'open').and.returnValue({
afterClosed() { afterClosed() {
@@ -1519,7 +1497,7 @@ describe('ContentManagementService', () => {
})); }));
it('should update node selection after dialog is closed', fakeAsync(() => { it('should update node selection after dialog is closed', fakeAsync(() => {
const node = <any>{ entry: { id: '1', name: 'name1' } }; const node: any = { entry: { id: '1', name: 'name1' } };
spyOn(store, 'dispatch').and.callThrough(); spyOn(store, 'dispatch').and.callThrough();
spyOn(dialog, 'open').and.returnValue({ spyOn(dialog, 'open').and.returnValue({
afterClosed() { afterClosed() {
@@ -1535,7 +1513,7 @@ describe('ContentManagementService', () => {
})); }));
it('should emit event when node is un-shared', fakeAsync(() => { it('should emit event when node is un-shared', fakeAsync(() => {
const node = <any>{ entry: { id: '1', name: 'name1' } }; const node: any = { entry: { id: '1', name: 'name1' } };
spyOn(contentManagementService.linksUnshared, 'next').and.callThrough(); spyOn(contentManagementService.linksUnshared, 'next').and.callThrough();
spyOn(dialog, 'open').and.returnValue({ spyOn(dialog, 'open').and.returnValue({
afterClosed: () => of(node) afterClosed: () => of(node)
@@ -1562,9 +1540,9 @@ describe('ContentManagementService', () => {
expect(contentApi.unlockNode).toHaveBeenCalled(); expect(contentApi.unlockNode).toHaveBeenCalled();
})); }));
it('should raise error when unlock node fails', fakeAsync(done => { it('should raise error when unlock node fails', fakeAsync(() => {
spyOn(contentApi, 'unlockNode').and.callFake( spyOn(contentApi, 'unlockNode').and.callFake(
() => new Promise((resolve, reject) => reject('error')) () => new Promise((_resolve, reject) => reject('error'))
); );
spyOn(store, 'dispatch').and.callThrough(); spyOn(store, 'dispatch').and.callThrough();
store.dispatch( store.dispatch(
@@ -1593,7 +1571,7 @@ describe('ContentManagementService', () => {
}); });
it('should return dialog instance reference', () => { it('should return dialog instance reference', () => {
const mockDialogInstance = <any>{ afterClose: () => {} }; const mockDialogInstance: any = { afterClose: () => {} };
spyOn(dialog, 'open').and.returnValue(mockDialogInstance); spyOn(dialog, 'open').and.returnValue(mockDialogInstance);
@@ -1605,11 +1583,11 @@ describe('ContentManagementService', () => {
describe('editFolder', () => { describe('editFolder', () => {
it('should open dialog with FolderDialogComponent instance', () => { it('should open dialog with FolderDialogComponent instance', () => {
const mockDialogInstance = <any>{ const mockDialogInstance: any = {
componentInstance: { error: of() }, componentInstance: { error: of() },
afterClosed: () => of() afterClosed: () => of()
}; };
const node = <any>{ entry: { id: '1', name: 'name1', isFolder: true } }; const node: any = { entry: { id: '1', name: 'name1', isFolder: true } };
spyOn(dialog, 'open').and.returnValue(mockDialogInstance); spyOn(dialog, 'open').and.returnValue(mockDialogInstance);
contentManagementService.editFolder(node); contentManagementService.editFolder(node);
@@ -1620,11 +1598,11 @@ describe('ContentManagementService', () => {
}); });
it('should raise error when edit operation fails', fakeAsync(() => { it('should raise error when edit operation fails', fakeAsync(() => {
const mockDialogInstance = <any>{ const mockDialogInstance: any = {
componentInstance: { error: new Subject<any>() }, componentInstance: { error: new Subject<any>() },
afterClosed: () => of() afterClosed: () => of()
}; };
const node = <any>{ entry: { id: '1', name: 'name1', isFolder: true } }; const node: any = { entry: { id: '1', name: 'name1', isFolder: true } };
spyOn(dialog, 'open').and.returnValue(mockDialogInstance); spyOn(dialog, 'open').and.returnValue(mockDialogInstance);
spyOn(store, 'dispatch').and.callThrough(); spyOn(store, 'dispatch').and.callThrough();
@@ -1638,9 +1616,9 @@ describe('ContentManagementService', () => {
})); }));
it('should call nodeUpdated event with edited node data', fakeAsync(() => { it('should call nodeUpdated event with edited node data', fakeAsync(() => {
const node = <any>{ entry: { id: '1', name: 'name1' } }; const node: any = { entry: { id: '1', name: 'name1' } };
const newNode = <any>{ entry: { id: '1', name: 'name-edited' } }; const newNode: any = { entry: { id: '1', name: 'name-edited' } };
const mockDialogInstance = <any>{ const mockDialogInstance: any = {
componentInstance: { error: new Subject<any>() }, componentInstance: { error: new Subject<any>() },
afterClosed: () => of(newNode) afterClosed: () => of(newNode)
}; };
@@ -128,7 +128,7 @@ export class ContentManagementService {
managePermissions(node: MinimalNodeEntity): void { managePermissions(node: MinimalNodeEntity): void {
if (node && node.entry) { if (node && node.entry) {
const { nodeId, id } = <any>node.entry; const { nodeId, id } = node.entry as any;
const siteId = node.entry['guid']; const siteId = node.entry['guid'];
const targetId = siteId || nodeId || id; const targetId = siteId || nodeId || id;
@@ -149,7 +149,7 @@ export class ContentManagementService {
manageVersions(node: any) { manageVersions(node: any) {
if (node && node.entry) { if (node && node.entry) {
// shared and favorite // shared and favorite
const id = node.entry.nodeId || (<any>node).entry.guid; const id = node.entry.nodeId || (node as any).entry.guid;
if (id) { if (id) {
this.contentApi.getNodeInfo(id).subscribe(entry => { this.contentApi.getNodeInfo(id).subscribe(entry => {
@@ -185,7 +185,7 @@ export class ContentManagementService {
shareNode(node: any): void { shareNode(node: any): void {
if (node && node.entry) { if (node && node.entry) {
// shared and favorite // shared and favorite
const id = node.entry.nodeId || (<any>node).entry.guid; const id = node.entry.nodeId || (node as any).entry.guid;
if (id) { if (id) {
this.contentApi.getNodeInfo(id).subscribe(entry => { this.contentApi.getNodeInfo(id).subscribe(entry => {
@@ -389,7 +389,7 @@ export class ContentManagementService {
if (result === true) { if (result === true) {
const nodesToDelete: NodeInfo[] = nodes.map(node => { const nodesToDelete: NodeInfo[] = nodes.map(node => {
const { name } = node.entry; const { name } = node.entry;
const id = (<any>node).entry.nodeId || node.entry.id; const id = (node as any).entry.nodeId || node.entry.id;
return { return {
id, id,
@@ -1168,9 +1168,9 @@ export class ContentManagementService {
return this.store.select(getAppSelection).pipe( return this.store.select(getAppSelection).pipe(
take(1), take(1),
flatMap(({ file }) => { flatMap(({ file }) => {
const id = (<any>file).entry.nodeId || (<any>file).entry.guid; const id = (file as any).entry.nodeId || (file as any).entry.guid;
if (!id) { if (!id) {
return of(<any>file.entry); return of(file.entry);
} else { } else {
return this.contentApi.getNodeInfo(id); return this.contentApi.getNodeInfo(id);
} }
+10 -10
View File
@@ -44,7 +44,7 @@ class TestNode {
nodeType?: string, nodeType?: string,
properties?: any properties?: any
) { ) {
this.entry = <any>{}; this.entry = {} as any;
this.entry.id = id || 'node-id'; this.entry.id = id || 'node-id';
this.entry.isFile = isFile; this.entry.isFile = isFile;
this.entry.isFolder = !isFile; this.entry.isFolder = !isFile;
@@ -86,7 +86,7 @@ describe('NodeActionsService', () => {
isForbidden: boolean = false, isForbidden: boolean = false,
nameExistingOnDestination?: string nameExistingOnDestination?: string
) => { ) => {
return (entryId, options) => { return (_entryId, options) => {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
if (isForbidden) { if (isForbidden) {
reject(permissionError); reject(permissionError);
@@ -106,7 +106,7 @@ describe('NodeActionsService', () => {
familyNodes: { parentNodeId: string; nodeChildren: any[] }[], familyNodes: { parentNodeId: string; nodeChildren: any[] }[],
isForbidden: boolean = false isForbidden: boolean = false
) => { ) => {
return (parentId, options) => { return parentId => {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
if (isForbidden) { if (isForbidden) {
reject(permissionError); reject(permissionError);
@@ -241,14 +241,14 @@ describe('NodeActionsService', () => {
describe('getEntryParentId', () => { describe('getEntryParentId', () => {
it('should return the parentId, if that exists on the node entry', () => { it('should return the parentId, if that exists on the node entry', () => {
const parentID = 'parent-id'; const parentID = 'parent-id';
const entry = <any>{ nodeId: '1234', parentId: parentID }; const entry: any = { nodeId: '1234', parentId: parentID };
expect(service.getEntryParentId(entry)).toBe(parentID); expect(service.getEntryParentId(entry)).toBe(parentID);
}); });
it('should give the last element in path property, if parentId is missing and path exists on the node entry', () => { it('should give the last element in path property, if parentId is missing and path exists on the node entry', () => {
const firstParentId = 'parent-0-id'; const firstParentId = 'parent-0-id';
const entry = <any>{ const entry: any = {
nodeId: '1234', nodeId: '1234',
path: { elements: [{ id: 'parent-1-id' }, { id: firstParentId }] } path: { elements: [{ id: 'parent-1-id' }, { id: firstParentId }] }
}; };
@@ -270,7 +270,7 @@ describe('NodeActionsService', () => {
const dialog = TestBed.get(MatDialog); const dialog = TestBed.get(MatDialog);
spyOn(dialog, 'open').and.callFake( spyOn(dialog, 'open').and.callFake(
(contentNodeSelectorComponent: any, data: any) => { (_contentNodeSelectorComponent: any, data: any) => {
testContentNodeSelectorComponentData = data; testContentNodeSelectorComponentData = data;
return { componentInstance: {} }; return { componentInstance: {} };
} }
@@ -361,7 +361,7 @@ describe('NodeActionsService', () => {
let testContentNodeSelectorComponentData; let testContentNodeSelectorComponentData;
const dialog = TestBed.get(MatDialog); const dialog = TestBed.get(MatDialog);
const spyOnDialog = spyOn(dialog, 'open').and.callFake( const spyOnDialog = spyOn(dialog, 'open').and.callFake(
(contentNodeSelectorComponent: any, data: any) => { (_contentNodeSelectorComponent: any, data: any) => {
testContentNodeSelectorComponentData = data; testContentNodeSelectorComponentData = data;
return { componentInstance: {} }; return { componentInstance: {} };
} }
@@ -415,7 +415,7 @@ describe('NodeActionsService', () => {
let testContentNodeSelectorComponentData; let testContentNodeSelectorComponentData;
const dialog = TestBed.get(MatDialog); const dialog = TestBed.get(MatDialog);
spyOn(dialog, 'open').and.callFake( spyOn(dialog, 'open').and.callFake(
(contentNodeSelectorComponent: any, data: any) => { (_contentNodeSelectorComponent: any, data: any) => {
testContentNodeSelectorComponentData = data; testContentNodeSelectorComponentData = data;
return { componentInstance: {} }; return { componentInstance: {} };
} }
@@ -445,7 +445,7 @@ describe('NodeActionsService', () => {
let testContentNodeSelectorComponentData; let testContentNodeSelectorComponentData;
const dialog = TestBed.get(MatDialog); const dialog = TestBed.get(MatDialog);
spyOn(dialog, 'open').and.callFake( spyOn(dialog, 'open').and.callFake(
(contentNodeSelectorComponent: any, data: any) => { (_contentNodeSelectorComponent: any, data: any) => {
testContentNodeSelectorComponentData = data; testContentNodeSelectorComponentData = data;
return { componentInstance: {} }; return { componentInstance: {} };
} }
@@ -1075,7 +1075,7 @@ describe('NodeActionsService', () => {
spyOnDocumentListServiceAction = spyOn( spyOnDocumentListServiceAction = spyOn(
documentListService, documentListService,
'moveNode' 'moveNode'
).and.callFake((contentEntryId, selectionId) => { ).and.callFake(contentEntryId => {
if (contentEntryId === parentFolderToMove.entry.id) { if (contentEntryId === parentFolderToMove.entry.id) {
return throwError(conflictError); return throwError(conflictError);
} }
+5 -6
View File
@@ -45,7 +45,6 @@ import {
MinimalNodeEntity, MinimalNodeEntity,
MinimalNodeEntryEntity, MinimalNodeEntryEntity,
SitePaging, SitePaging,
Site,
NodeChildAssociationPaging NodeChildAssociationPaging
} from '@alfresco/js-api'; } from '@alfresco/js-api';
import { ContentApiService } from '@alfresco/aca-shared'; import { ContentApiService } from '@alfresco/aca-shared';
@@ -231,7 +230,7 @@ export class NodeActionsService {
list: { list: {
entries: [ entries: [
{ {
entry: <Site>{ entry: {
guid: '-my-', guid: '-my-',
title: this.translation.instant( title: this.translation.instant(
'APP.BROWSE.PERSONAL.SIDENAV_LINK.LABEL' 'APP.BROWSE.PERSONAL.SIDENAV_LINK.LABEL'
@@ -239,7 +238,7 @@ export class NodeActionsService {
} }
}, },
{ {
entry: <Site>{ entry: {
guid: '-mysites-', guid: '-mysites-',
title: this.translation.instant( title: this.translation.instant(
'APP.BROWSE.LIBRARIES.SIDENAV_LINK.LABEL' 'APP.BROWSE.LIBRARIES.SIDENAV_LINK.LABEL'
@@ -267,7 +266,7 @@ export class NodeActionsService {
excludeSiteContent: ContentNodeDialogService.nonDocumentSiteContent excludeSiteContent: ContentNodeDialogService.nonDocumentSiteContent
}; };
this.dialog.open(ContentNodeSelectorComponent, <any>{ this.dialog.open(ContentNodeSelectorComponent, {
data, data,
panelClass: 'adf-content-node-selector-dialog', panelClass: 'adf-content-node-selector-dialog',
width: '630px' width: '630px'
@@ -344,10 +343,10 @@ export class NodeActionsService {
} }
} }
} else if (node === null && this.isSitesDestinationAvailable) { } else if (node === null && this.isSitesDestinationAvailable) {
node = <any>{ node = {
name: this.translation.instant('APP.BROWSE.LIBRARIES.TITLE'), name: this.translation.instant('APP.BROWSE.LIBRARIES.TITLE'),
path: { elements: [] } path: { elements: [] }
}; } as any;
} }
return node; return node;
+2 -6
View File
@@ -24,11 +24,7 @@
*/ */
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { import { MatDialog, MatDialogRef } from '@angular/material/dialog';
MatDialog,
MatDialogConfig,
MatDialogRef
} from '@angular/material/dialog';
import { CreateFromTemplateDialogComponent } from '../dialogs/node-template/create-from-template.dialog'; import { CreateFromTemplateDialogComponent } from '../dialogs/node-template/create-from-template.dialog';
import { Subject, from, of } from 'rxjs'; import { Subject, from, of } from 'rxjs';
import { import {
@@ -105,7 +101,7 @@ export class NodeTemplateService {
data.currentFolderId = entry.id; data.currentFolderId = entry.id;
return this.dialog return this.dialog
.open(ContentNodeSelectorComponent, <MatDialogConfig>{ .open(ContentNodeSelectorComponent, {
data, data,
panelClass: [ panelClass: [
'adf-content-node-selector-dialog', 'adf-content-node-selector-dialog',
+1 -1
View File
@@ -69,7 +69,7 @@ export class DownloadEffects {
private downloadNodes(toDownload: Array<MinimalNodeEntity>) { private downloadNodes(toDownload: Array<MinimalNodeEntity>) {
const nodes = toDownload.map(node => { const nodes = toDownload.map(node => {
const { id, nodeId, name, isFile, isFolder } = <any>node.entry; const { id, nodeId, name, isFile, isFolder } = node.entry as any;
return { return {
id: this.isSharedLinkPreview ? id : nodeId || id, id: this.isSharedLinkPreview ? id : nodeId || id,
+3 -3
View File
@@ -107,7 +107,7 @@ describe('UploadEffects', () => {
it('should dispatch the unlock write action for a locked file', () => { it('should dispatch the unlock write action for a locked file', () => {
const file: FileModel = new FileModel( const file: FileModel = new FileModel(
<File>{ name: 'file1.png', size: 10 }, { name: 'file1.png', size: 10 } as File,
null, null,
'file1' 'file1'
); );
@@ -137,7 +137,7 @@ describe('UploadEffects', () => {
it('should dispatch only one unlock action for a locked file', () => { it('should dispatch only one unlock action for a locked file', () => {
const file: FileModel = new FileModel( const file: FileModel = new FileModel(
<File>{ name: 'file1.png', size: 10 }, { name: 'file1.png', size: 10 } as File,
null, null,
'file1' 'file1'
); );
@@ -171,7 +171,7 @@ describe('UploadEffects', () => {
it('should dispatch no actions if file is not locked', () => { it('should dispatch no actions if file is not locked', () => {
const file: FileModel = new FileModel( const file: FileModel = new FileModel(
<File>{ name: 'file1.png', size: 10 }, { name: 'file1.png', size: 10 } as File,
null, null,
'file1' 'file1'
); );
+5 -11
View File
@@ -135,17 +135,14 @@ export class UploadEffects {
) )
.subscribe(([form, node]) => { .subscribe(([form, node]) => {
if (form && node) { if (form && node) {
const file = this.fileVersionInput.files[0]; const file: any = this.fileVersionInput.files[0];
const fileModel = new FileModel( const fileModel = new FileModel(
file, file,
{ {
comment: form.comment, comment: form.comment,
majorVersion: form.version, majorVersion: form.version,
parentId: node.parentId, parentId: node.parentId,
path: ((<any>file).webkitRelativePath || '').replace( path: (file.webkitRelativePath || '').replace(/\/[^\/]*$/, ''),
/\/[^\/]*$/,
''
),
newVersion: true, newVersion: true,
nodeType: 'cm:content' nodeType: 'cm:content'
}, },
@@ -164,14 +161,11 @@ export class UploadEffects {
.pipe(take(1)) .pipe(take(1))
.subscribe(node => { .subscribe(node => {
if (node && node.id) { if (node && node.id) {
const input = <HTMLInputElement>event.currentTarget; const input = event.currentTarget as HTMLInputElement;
const files = FileUtils.toFileArray(input.files).map(file => { const files = FileUtils.toFileArray(input.files).map((file: any) => {
return new FileModel(file, { return new FileModel(file, {
parentId: node.id, parentId: node.id,
path: ((<any>file).webkitRelativePath || '').replace( path: (file.webkitRelativePath || '').replace(/\/[^\/]*$/, ''),
/\/[^\/]*$/,
''
),
nodeType: 'cm:content' nodeType: 'cm:content'
}); });
}); });
+3 -5
View File
@@ -113,7 +113,7 @@ export class ViewerEffects {
ofType<ViewFileAction>(ViewerActionTypes.ViewFile), ofType<ViewFileAction>(ViewerActionTypes.ViewFile),
map(action => { map(action => {
if (action.payload && action.payload.entry) { if (action.payload && action.payload.entry) {
const { id, nodeId, isFile } = <any>action.payload.entry; const { id, nodeId, isFile } = action.payload.entry as any;
if ( if (
this.extensions.canPreviewNode(action.payload) && this.extensions.canPreviewNode(action.payload) &&
@@ -127,7 +127,7 @@ export class ViewerEffects {
.pipe(take(1)) .pipe(take(1))
.subscribe(result => { .subscribe(result => {
if (result.selection && result.selection.file) { if (result.selection && result.selection.file) {
const { id, nodeId, isFile } = <any>result.selection.file.entry; const { id, nodeId, isFile } = result.selection.file.entry as any;
if ( if (
this.extensions.canPreviewNode(action.payload) && this.extensions.canPreviewNode(action.payload) &&
@@ -165,10 +165,8 @@ export class ViewerEffects {
} }
enterFullScreen() { enterFullScreen() {
const container = <any>( const container: any = document.documentElement.querySelector(
document.documentElement.querySelector(
'.adf-viewer__fullscreen-container' '.adf-viewer__fullscreen-container'
)
); );
if (container) { if (container) {
if (container.requestFullscreen) { if (container.requestFullscreen) {
+3 -3
View File
@@ -50,11 +50,11 @@ export const INITIAL_APP_STATE: AppState = {
infoDrawerMetadataAspect: '', infoDrawerMetadataAspect: '',
showFacetFilter: true, showFacetFilter: true,
documentDisplayMode: 'list', documentDisplayMode: 'list',
repository: <any>{ repository: {
status: <any>{ status: {
isQuickShareEnabled: true isQuickShareEnabled: true
} }
} } as any
}; };
export const INITIAL_STATE: AppStore = { export const INITIAL_STATE: AppStore = {
+16 -13
View File
@@ -50,7 +50,7 @@ export function appReducer(
switch (action.type) { switch (action.type) {
case AppActionTypes.SetInitialState: case AppActionTypes.SetInitialState:
newState = Object.assign({}, (<SetInitialStateAction>action).payload); newState = Object.assign({}, (action as SetInitialStateAction).payload);
break; break;
case AppActionTypes.SetSettingsParameter: case AppActionTypes.SetSettingsParameter:
newState = handleSettingsUpdate( newState = handleSettingsUpdate(
@@ -65,33 +65,37 @@ export function appReducer(
}; };
break; break;
case NodeActionTypes.SetSelection: case NodeActionTypes.SetSelection:
newState = updateSelectedNodes(state, <SetSelectedNodesAction>action); newState = updateSelectedNodes(state, action as SetSelectedNodesAction);
break; break;
case AppActionTypes.SetUserProfile: case AppActionTypes.SetUserProfile:
newState = updateUser(state, <SetUserProfileAction>action); newState = updateUser(state, action as SetUserProfileAction);
break; break;
case AppActionTypes.SetCurrentFolder: case AppActionTypes.SetCurrentFolder:
newState = updateCurrentFolder(state, <SetCurrentFolderAction>action); newState = updateCurrentFolder(state, action as SetCurrentFolderAction);
break; break;
case AppActionTypes.SetCurrentUrl: case AppActionTypes.SetCurrentUrl:
newState = updateCurrentUrl(state, <SetCurrentUrlAction>action); newState = updateCurrentUrl(state, action as SetCurrentUrlAction);
break; break;
case AppActionTypes.ToggleInfoDrawer: case AppActionTypes.ToggleInfoDrawer:
newState = toggleInfoDrawer(state); newState = toggleInfoDrawer(state);
break; break;
case AppActionTypes.SetInfoDrawerState: case AppActionTypes.SetInfoDrawerState:
newState = setInfoDrawer(state, <SetInfoDrawerStateAction>action); newState = setInfoDrawer(state, action as SetInfoDrawerStateAction);
break; break;
case AppActionTypes.SetInfoDrawerMetadataAspect: case AppActionTypes.SetInfoDrawerMetadataAspect:
newState = setInfoDrawerAspect(state, <SetInfoDrawerMetadataAspectAction>( newState = setInfoDrawerAspect(
action state,
)); action as SetInfoDrawerMetadataAspectAction
);
break; break;
case AppActionTypes.ToggleDocumentDisplayMode: case AppActionTypes.ToggleDocumentDisplayMode:
newState = toggleDocumentDisplayMode(state); newState = toggleDocumentDisplayMode(state);
break; break;
case AppActionTypes.SetRepositoryInfo: case AppActionTypes.SetRepositoryInfo:
newState = updateRepositoryStatus(state, <SetRepositoryInfoAction>action); newState = updateRepositoryStatus(
state,
action as SetRepositoryInfoAction
);
break; break;
case SearchActionTypes.ToggleFilter: case SearchActionTypes.ToggleFilter:
newState = toggleSearchFilter(state); newState = toggleSearchFilter(state);
@@ -138,11 +142,10 @@ function updateUser(state: AppState, action: SetUserProfileAction): AppState {
const userName = `${firstName} ${lastName}`; const userName = `${firstName} ${lastName}`;
const initials = [firstName[0], lastName[0]].join(''); const initials = [firstName[0], lastName[0]].join('');
const capabilities = (<any>user).capabilities; const capabilities = user.capabilities;
const isAdmin = capabilities ? capabilities.isAdmin : true; const isAdmin = capabilities ? capabilities.isAdmin : true;
// todo: remove <any> newState.user = {
newState.user = <any>{
firstName, firstName,
lastName, lastName,
userName, userName,
+4 -3
View File
@@ -11,6 +11,7 @@
"emitDecoratorMetadata": true, "emitDecoratorMetadata": true,
"experimentalDecorators": true, "experimentalDecorators": true,
"noUnusedLocals": true, "noUnusedLocals": true,
"noUnusedParameters": true,
"noImplicitReturns": true, "noImplicitReturns": true,
"target": "es5", "target": "es5",
"resolveJsonModule": true, "resolveJsonModule": true,
@@ -19,13 +20,13 @@
"paths": { "paths": {
"@alfresco/aca-shared": ["projects/aca-shared/src/public-api.ts"], "@alfresco/aca-shared": ["projects/aca-shared/src/public-api.ts"],
"@alfresco/aca-shared/store": [ "@alfresco/aca-shared/store": [
"projects/aca-shared/store/src/public_api.ts" "projects/aca-shared/store/src/public-api.ts"
], ],
"@alfresco/aca-shared/rules": [ "@alfresco/aca-shared/rules": [
"projects/aca-shared/rules/src/public_api.ts" "projects/aca-shared/rules/src/public-api.ts"
], ],
"@alfresco/adf-office-services-ext": [ "@alfresco/adf-office-services-ext": [
"projects/adf-office-services-ext/src/public_api.ts" "projects/adf-office-services-ext/src/public-api.ts"
] ]
} }
}, },
+28 -3
View File
@@ -1,10 +1,16 @@
{ {
"rulesDirectory": [ "rulesDirectory": [
"node_modules/codelyzer", "node_modules/codelyzer",
"node_modules/rxjs-tslint",
"node_modules/adf-tslint-rules" "node_modules/adf-tslint-rules"
], ],
"extends": ["rxjs-tslint-rules"], "extends": [
"tslint-plugin-prettier",
"tslint-config-prettier",
"rxjs-tslint-rules"
],
"rules": { "rules": {
"prettier": true,
"adf-license-banner": [true, "**/*.ts", "./license-header.txt"], "adf-license-banner": [true, "**/*.ts", "./license-header.txt"],
"ban": [ "ban": [
true, true,
@@ -64,7 +70,9 @@
"check-decl", "check-decl",
"check-operator", "check-operator",
"check-separator", "check-separator",
"check-type" "check-type",
"check-typecast",
"check-module"
], ],
"directive-selector": [true, "attribute", "aca", "camelCase"], "directive-selector": [true, "attribute", "aca", "camelCase"],
"component-selector": [ "component-selector": [
@@ -93,7 +101,18 @@
"template-mouse-events-have-key-events": true, "template-mouse-events-have-key-events": true,
"template-no-autofocus": true, "template-no-autofocus": true,
"template-no-distracting-elements": true, "template-no-distracting-elements": true,
"template-banana-in-box": true,
"template-no-negated-async": false,
"no-conflicting-lifecycle": true,
"no-output-native": true,
"no-output-on-prefix": true,
"use-lifecycle-interface": true,
"rxjs-collapse-imports": true,
"rxjs-pipeable-operators-only": true,
"rxjs-no-static-observable-methods": true,
"rxjs-proper-imports": true,
"rxjs-ban-operators": { "rxjs-ban-operators": {
"severity": "error" "severity": "error"
}, },
@@ -137,6 +156,12 @@
} }
], ],
"severity": "error" "severity": "error"
} },
"no-return-await": true,
"file-name-casing": [
true,
"kebab-case"
]
} }
} }