mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2025-05-12 17:04:46 +00:00
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:
parent
6a84717a00
commit
bf509843b7
@ -179,7 +179,7 @@ export class DataTable extends Component {
|
||||
getRowByName(name: string, location: string = ''): ElementFinder {
|
||||
if (location) {
|
||||
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();
|
||||
}
|
||||
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 {
|
||||
if (location) {
|
||||
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();
|
||||
}
|
||||
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 { Component } from '../component';
|
||||
import * as moment from 'moment';
|
||||
import { isPresentAndDisplayed } from '../../utilities/utils';
|
||||
|
||||
export class DateTimePicker extends Component {
|
||||
private static selectors = {
|
||||
@ -63,7 +64,9 @@ export class DateTimePicker extends Component {
|
||||
}
|
||||
|
||||
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> {
|
||||
|
@ -26,7 +26,7 @@
|
||||
import { ElementFinder, by, browser, ExpectedConditions as EC, protractor } from 'protractor';
|
||||
import { BROWSER_WAIT_TIMEOUT } from '../../configs';
|
||||
import { GenericDialog } from '../dialog/generic-dialog';
|
||||
import { Utils } from '../../utilities/utils';
|
||||
import { Utils, isPresentAndDisplayed } from '../../utilities/utils';
|
||||
import { DropDownBreadcrumb } from '../breadcrumb/dropdown-breadcrumb';
|
||||
import { DataTable } from '../data-table/data-table';
|
||||
|
||||
@ -108,11 +108,11 @@ export class ContentNodeSelectorDialog extends GenericDialog {
|
||||
}
|
||||
|
||||
async isSearchInputPresent(): Promise<boolean> {
|
||||
return await this.searchInput.isPresent();
|
||||
return this.searchInput.isPresent();
|
||||
}
|
||||
|
||||
async isSelectLocationDropdownDisplayed(): Promise<boolean> {
|
||||
return (await this.locationDropDown.isPresent()) && (await this.locationDropDown.isDisplayed());
|
||||
return isPresentAndDisplayed(this.locationDropDown);
|
||||
}
|
||||
|
||||
async isCopyButtonEnabled(): Promise<boolean> {
|
||||
@ -130,6 +130,6 @@ export class ContentNodeSelectorDialog extends GenericDialog {
|
||||
}
|
||||
|
||||
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 { BROWSER_WAIT_TIMEOUT } from '../../configs';
|
||||
import { GenericDialog } from '../dialog/generic-dialog';
|
||||
import { isPresentAndDisplayed } from '../../utilities/utils';
|
||||
|
||||
export class CreateOrEditFolderDialog extends GenericDialog {
|
||||
private static selectors = {
|
||||
@ -55,7 +56,7 @@ export class CreateOrEditFolderDialog extends GenericDialog {
|
||||
}
|
||||
|
||||
async isValidationMessageDisplayed(): Promise<boolean> {
|
||||
return (await this.validationMessage.isPresent()) && (await this.validationMessage.isDisplayed());
|
||||
return isPresentAndDisplayed(this.validationMessage);
|
||||
}
|
||||
|
||||
async isUpdateButtonEnabled(): Promise<boolean> {
|
||||
|
@ -25,6 +25,7 @@
|
||||
|
||||
import { ElementFinder, by, protractor } from 'protractor';
|
||||
import { GenericDialog } from '../dialog/generic-dialog';
|
||||
import { isPresentAndDisplayed } from '../../utilities/utils';
|
||||
|
||||
export class CreateFromTemplateDialog extends GenericDialog {
|
||||
private static selectors = {
|
||||
@ -49,7 +50,7 @@ export class CreateFromTemplateDialog extends GenericDialog {
|
||||
}
|
||||
|
||||
async isValidationMessageDisplayed(): Promise<boolean> {
|
||||
return (await this.validationMessage.isPresent()) && (await this.validationMessage.isDisplayed());
|
||||
return isPresentAndDisplayed(this.validationMessage);
|
||||
}
|
||||
|
||||
async isCreateButtonEnabled(): Promise<boolean> {
|
||||
|
@ -25,6 +25,7 @@
|
||||
|
||||
import { ElementFinder, by, browser, ExpectedConditions as EC, Locator } from 'protractor';
|
||||
import { BROWSER_WAIT_TIMEOUT } from '../../configs';
|
||||
import { isPresentAndDisplayed, isPresentAndEnabled } from '../../utilities/utils';
|
||||
|
||||
export abstract class GenericDialog {
|
||||
private static locators = {
|
||||
@ -65,7 +66,7 @@ export abstract class GenericDialog {
|
||||
}
|
||||
|
||||
async isDialogOpen(): Promise<boolean> {
|
||||
return (await this.rootElem.isPresent()) && (await this.rootElem.isDisplayed());
|
||||
return isPresentAndDisplayed(this.rootElem);
|
||||
}
|
||||
|
||||
async getTitle(): Promise<string> {
|
||||
@ -77,7 +78,7 @@ export abstract class GenericDialog {
|
||||
}
|
||||
|
||||
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> {
|
||||
|
@ -26,6 +26,7 @@
|
||||
import { ElementFinder, ElementArrayFinder, by, browser, ExpectedConditions as EC } from 'protractor';
|
||||
import { Component } from '../component';
|
||||
import { BROWSER_WAIT_TIMEOUT } from '../../configs';
|
||||
import { isPresentAndEnabled, isPresentAndDisplayed } from '../../utilities/utils';
|
||||
|
||||
export class ContentMetadata extends Component {
|
||||
private static selectors = {
|
||||
@ -66,14 +67,14 @@ export class ContentMetadata extends Component {
|
||||
}
|
||||
|
||||
async getVisiblePropertiesLabels() {
|
||||
return await this.component.all(by.css(ContentMetadata.selectors.propertyLabel))
|
||||
.filter(async (elem) => await elem.isDisplayed())
|
||||
.map(async (elem) => await elem.getText());
|
||||
return this.component.all(by.css(ContentMetadata.selectors.propertyLabel))
|
||||
.filter(async (elem) => elem.isDisplayed())
|
||||
.map(async (elem) => elem.getText());
|
||||
}
|
||||
|
||||
async getVisiblePropertiesValues() {
|
||||
return await this.component.all(by.css(ContentMetadata.selectors.propertyValue))
|
||||
.filter(async (elem) => await elem.isDisplayed())
|
||||
return this.component.all(by.css(ContentMetadata.selectors.propertyValue))
|
||||
.filter(async (elem) => elem.isDisplayed())
|
||||
.map(async (elem) => {
|
||||
if (await elem.isElementPresent(by.css('.mat-checkbox'))) {
|
||||
if (await elem.isElementPresent(by.css('.mat-checkbox-checked'))) {
|
||||
@ -81,27 +82,27 @@ export class ContentMetadata extends Component {
|
||||
}
|
||||
return false
|
||||
}
|
||||
return await elem.getText();
|
||||
return elem.getText();
|
||||
});
|
||||
}
|
||||
|
||||
async isEditPropertiesButtonEnabled() {
|
||||
return (await browser.isElementPresent(this.editPropertiesButton)) && (await this.editPropertiesButton.isEnabled());
|
||||
async isEditPropertiesButtonEnabled(): Promise<boolean> {
|
||||
return isPresentAndEnabled(this.editPropertiesButton);
|
||||
}
|
||||
|
||||
async isLessInfoButtonEnabled() {
|
||||
return (await browser.isElementPresent(this.lessInfoButton)) && (await this.lessInfoButton.isEnabled());
|
||||
async isLessInfoButtonEnabled(): Promise<boolean> {
|
||||
return isPresentAndEnabled(this.lessInfoButton);
|
||||
}
|
||||
|
||||
async isMoreInfoButtonEnabled() {
|
||||
return (await browser.isElementPresent(this.moreInfoButton)) && (await this.moreInfoButton.isEnabled());
|
||||
async isMoreInfoButtonEnabled(): Promise<boolean> {
|
||||
return isPresentAndEnabled(this.moreInfoButton);
|
||||
}
|
||||
|
||||
async isLessInfoButtonDisplayed() {
|
||||
return browser.isElementPresent(this.lessInfoButton);
|
||||
}
|
||||
|
||||
async isMoreInfoButtonDisplayed() {
|
||||
async isMoreInfoButtonDisplayed(): Promise<boolean> {
|
||||
return browser.isElementPresent(this.moreInfoButton);
|
||||
}
|
||||
|
||||
@ -113,8 +114,8 @@ export class ContentMetadata extends Component {
|
||||
await this.moreInfoButton.click();
|
||||
}
|
||||
|
||||
async isImagePropertiesPanelDisplayed() {
|
||||
return (await browser.isElementPresent(this.imagePropertiesPanel)) && (await this.imagePropertiesPanel.isDisplayed());
|
||||
async isImagePropertiesPanelDisplayed(): Promise<boolean> {
|
||||
return isPresentAndDisplayed(this.imagePropertiesPanel);
|
||||
}
|
||||
|
||||
async clickImagePropertiesPanel() {
|
||||
|
@ -27,7 +27,7 @@ import { ElementFinder, ElementArrayFinder, by, browser, ExpectedConditions as E
|
||||
import { Logger } from '@alfresco/adf-testing';
|
||||
import { BROWSER_WAIT_TIMEOUT } from '../../configs';
|
||||
import { Component } from '../component';
|
||||
import { Utils } from '../../utilities/utils'
|
||||
import { Utils, isPresentAndEnabled } from '../../utilities/utils'
|
||||
|
||||
export class Menu extends Component {
|
||||
private static selectors = {
|
||||
@ -357,27 +357,27 @@ export class Menu extends Component {
|
||||
}
|
||||
|
||||
async isCreateFolderEnabled(): Promise<boolean> {
|
||||
return (await this.createFolderAction.isPresent()) && (await this.createFolderAction.isEnabled());
|
||||
return isPresentAndEnabled(this.createFolderAction);
|
||||
}
|
||||
|
||||
async isCreateLibraryEnabled(): Promise<boolean> {
|
||||
return (await this.createLibraryAction.isPresent()) && (await this.createLibraryAction.isEnabled());
|
||||
return isPresentAndEnabled(this.createLibraryAction);
|
||||
}
|
||||
|
||||
async isUploadFileEnabled(): Promise<boolean> {
|
||||
return (await this.uploadFileAction.isPresent()) && (await this.uploadFileAction.isEnabled());
|
||||
return isPresentAndEnabled(this.uploadFileAction);
|
||||
}
|
||||
|
||||
async isUploadFolderEnabled(): Promise<boolean> {
|
||||
return (await this.uploadFolderAction.isPresent()) && (await this.uploadFolderAction.isEnabled());
|
||||
return isPresentAndEnabled(this.uploadFolderAction);
|
||||
}
|
||||
|
||||
async isCreateFileFromTemplateEnabled(): Promise<boolean> {
|
||||
return (await this.createFileFromTemplateAction.isPresent()) && (await this.createFileFromTemplateAction.isEnabled());
|
||||
return isPresentAndEnabled(this.createFileFromTemplateAction);
|
||||
}
|
||||
|
||||
async isCreateFolderFromTemplateEnabled(): Promise<boolean> {
|
||||
return (await this.createFolderFromTemplateAction.isPresent()) && (await this.createFolderFromTemplateAction.isEnabled());
|
||||
return isPresentAndEnabled(this.createFolderFromTemplateAction);
|
||||
}
|
||||
|
||||
async clickCreateFolder(): Promise<void> {
|
||||
|
@ -25,7 +25,7 @@
|
||||
|
||||
import { ElementFinder, by, protractor } from 'protractor';
|
||||
import { GenericFilterPanel } from './generic-filter-panel';
|
||||
import { Utils } from '../../../utilities/utils';
|
||||
import { Utils, isPresentAndDisplayed } from '../../../utilities/utils';
|
||||
|
||||
export class CreatedDateFilter extends GenericFilterPanel {
|
||||
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"]'));
|
||||
|
||||
async isFromFieldDisplayed(): Promise<boolean> {
|
||||
return (await this.fromField.isPresent()) && (await this.fromField.isDisplayed());
|
||||
return isPresentAndDisplayed(this.fromField);
|
||||
}
|
||||
|
||||
async isFromErrorDisplayed(): Promise<boolean> {
|
||||
return (await this.fromFieldError.isPresent()) && (await this.fromFieldError.isDisplayed());
|
||||
return isPresentAndDisplayed(this.fromFieldError);
|
||||
}
|
||||
|
||||
async isToFieldDisplayed(): Promise<boolean> {
|
||||
return (await this.toField.isPresent()) && (await this.toField.isDisplayed());
|
||||
return isPresentAndDisplayed(this.toField);
|
||||
}
|
||||
|
||||
async isToErrorDisplayed(): Promise<boolean> {
|
||||
return (await this.toFieldError.isPresent()) && (await this.toFieldError.isDisplayed());
|
||||
return isPresentAndDisplayed(this.toFieldError);
|
||||
}
|
||||
|
||||
async isClearButtonEnabled(): Promise<boolean> {
|
||||
return await this.clearButton.isEnabled();
|
||||
return this.clearButton.isEnabled();
|
||||
}
|
||||
|
||||
async isApplyButtonEnabled(): Promise<boolean> {
|
||||
return await this.applyButton.isEnabled();
|
||||
return this.applyButton.isEnabled();
|
||||
}
|
||||
|
||||
async clickClearButton(): Promise<void> {
|
||||
|
@ -66,11 +66,11 @@ export class FacetFilter extends GenericFilterPanel {
|
||||
}
|
||||
|
||||
async isFilterFacetsDisplayed(): Promise<boolean> {
|
||||
return await this.facetsFilter.isDisplayed();
|
||||
return this.facetsFilter.isDisplayed();
|
||||
}
|
||||
|
||||
async isClearButtonEnabled(): Promise<boolean> {
|
||||
return await this.clearButton.isEnabled();
|
||||
return this.clearButton.isEnabled();
|
||||
}
|
||||
|
||||
async clickClearButton(): Promise<void> {
|
||||
@ -80,7 +80,7 @@ export class FacetFilter extends GenericFilterPanel {
|
||||
}
|
||||
|
||||
async isFilterCategoryInputDisplayed(): Promise<boolean> {
|
||||
return await this.filterCategoryInput.isDisplayed();
|
||||
return this.filterCategoryInput.isDisplayed();
|
||||
}
|
||||
|
||||
async checkCategory(name: string): Promise<void> {
|
||||
|
@ -24,6 +24,7 @@
|
||||
*/
|
||||
|
||||
import { ElementFinder, by, browser } from 'protractor';
|
||||
import { isPresentAndDisplayed } from '../../../utilities/utils';
|
||||
|
||||
export class GenericFilterPanel {
|
||||
private filterName: string;
|
||||
@ -49,11 +50,11 @@ export class GenericFilterPanel {
|
||||
}
|
||||
|
||||
async isPanelDisplayed(): Promise<boolean> {
|
||||
return (await browser.isElementPresent(this.panel)) && (await this.panel.isDisplayed());
|
||||
return isPresentAndDisplayed(this.panel);
|
||||
}
|
||||
|
||||
async isPanelExpanded(): Promise<boolean> {
|
||||
return (await this.panelExpanded.isPresent()) && (await this.panelExpanded.isDisplayed());
|
||||
return isPresentAndDisplayed(this.panelExpanded);
|
||||
}
|
||||
|
||||
async expandPanel(): Promise<void> {
|
||||
|
@ -60,7 +60,7 @@ export class SizeFilter extends GenericFilterPanel {
|
||||
}
|
||||
|
||||
async isClearButtonEnabled(): Promise<boolean> {
|
||||
return await this.clearButton.isEnabled();
|
||||
return this.clearButton.isEnabled();
|
||||
}
|
||||
|
||||
async clickClearButton(): Promise<void> {
|
||||
|
@ -28,6 +28,7 @@ import { Component } from '../component';
|
||||
import { SizeFilter } from './filters/size-filter';
|
||||
import { CreatedDateFilter } from './filters/created-date-filter';
|
||||
import { FacetFilter } from './filters/facet-filter';
|
||||
import { isPresentAndDisplayed } from '../../utilities/utils';
|
||||
|
||||
export class SearchFilters extends Component {
|
||||
private static selectors = {
|
||||
@ -50,7 +51,7 @@ export class SearchFilters extends Component {
|
||||
}
|
||||
|
||||
async isSearchFiltersPanelDisplayed(): Promise<boolean> {
|
||||
return (await this.mainPanel.isPresent()) && (await this.mainPanel.isDisplayed());
|
||||
return isPresentAndDisplayed(this.mainPanel);
|
||||
}
|
||||
|
||||
async clickResetAllButton(): Promise<void> {
|
||||
|
@ -63,7 +63,10 @@ export class SearchInput extends Component {
|
||||
}
|
||||
|
||||
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() {
|
||||
|
@ -26,6 +26,7 @@
|
||||
import { ElementFinder, by, browser, ExpectedConditions as EC, ElementArrayFinder } from 'protractor';
|
||||
import { BROWSER_WAIT_TIMEOUT } from '../../configs';
|
||||
import { Component } from '../component';
|
||||
import { isPresentAndDisplayed } from '../../utilities/utils';
|
||||
|
||||
export class SearchSortingPicker extends Component {
|
||||
private static selectors = {
|
||||
@ -48,7 +49,7 @@ export class SearchSortingPicker extends Component {
|
||||
}
|
||||
|
||||
async isSortOrderButtonDisplayed(): Promise<boolean> {
|
||||
return (await this.sortOrderButton.isPresent()) && (await this.sortOrderButton.isDisplayed());
|
||||
return isPresentAndDisplayed(this.sortOrderButton);
|
||||
}
|
||||
|
||||
async getSortOrder(): Promise<'ASC' | 'DESC' | ''> {
|
||||
@ -64,15 +65,15 @@ export class SearchSortingPicker extends Component {
|
||||
}
|
||||
|
||||
async isSortByOptionDisplayed(): Promise<boolean> {
|
||||
return (await this.sortByDropdownCollapsed.isPresent()) && (await this.sortByDropdownCollapsed.isDisplayed());
|
||||
return isPresentAndDisplayed(this.sortByDropdownCollapsed);
|
||||
}
|
||||
|
||||
async isSortByDropdownExpanded(): Promise<boolean> {
|
||||
return (await this.sortByDropdownExpanded.isPresent()) && (await this.sortByDropdownExpanded.isDisplayed());
|
||||
return isPresentAndDisplayed(this.sortByDropdownExpanded);
|
||||
}
|
||||
|
||||
async getSelectedSortByOption(): Promise<string> {
|
||||
return await this.sortByDropdownCollapsed.getText();
|
||||
return this.sortByDropdownCollapsed.getText();
|
||||
}
|
||||
|
||||
async clickSortByDropdown(): Promise<void> {
|
||||
|
@ -79,7 +79,7 @@ export class Toolbar extends Component {
|
||||
|
||||
async getButtons(): Promise<string[]> {
|
||||
return this.buttons.map(async elem => {
|
||||
return await elem.getAttribute('title');
|
||||
return elem.getAttribute('title');
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -52,11 +52,11 @@ export class SearchResultsPage extends BrowsingPage {
|
||||
}
|
||||
|
||||
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> {
|
||||
return await this.infoText.getText();
|
||||
return this.infoText.getText();
|
||||
}
|
||||
|
||||
async getResultsChipsValues(): Promise<string[]> {
|
||||
|
@ -109,7 +109,7 @@ describe('Search results - libraries', () => {
|
||||
});
|
||||
|
||||
afterAll(async (done) => {
|
||||
await Promise.all(<any>[
|
||||
await Promise.all([
|
||||
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 ])
|
||||
]);
|
||||
|
@ -47,57 +47,57 @@ export class AdminActions {
|
||||
search: SearchApi = new SearchApi();
|
||||
|
||||
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> {
|
||||
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> {
|
||||
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> {
|
||||
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> {
|
||||
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> {
|
||||
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> {
|
||||
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> {
|
||||
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> {
|
||||
const templatesRootFolderId = await this.getNodeTemplatesFolderId();
|
||||
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> {
|
||||
const templatesRootFolderId = await this.getSpaceTemplatesFolderId();
|
||||
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> {
|
||||
return await this.adminApi.nodes.deleteNodeChildren(await this.getNodeTemplatesFolderId());
|
||||
return this.adminApi.nodes.deleteNodeChildren(await this.getNodeTemplatesFolderId());
|
||||
}
|
||||
|
||||
async cleanupSpaceTemplatesFolder(): Promise<void> {
|
||||
@ -108,11 +108,11 @@ export class AdminActions {
|
||||
const nodesToDelete = (await this.adminApi.nodes.getNodeChildren(spaceTemplatesNodeId)).list.entries
|
||||
.filter(node => (node.entry.nodeType !== 'app:folderlink') && (node.entry.name !== 'Software Engineering Project'))
|
||||
.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> {
|
||||
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> {
|
||||
@ -122,11 +122,11 @@ export class AdminActions {
|
||||
|
||||
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> {
|
||||
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> {
|
||||
@ -136,7 +136,7 @@ export class AdminActions {
|
||||
|
||||
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> {
|
||||
try {
|
||||
await this.apiAuth();
|
||||
return await this.nodesApi.createNode('-my-', <any>data);
|
||||
return await this.nodesApi.createNode('-my-', data as any);
|
||||
} catch (error) {
|
||||
this.handleError(`${this.constructor.name} ${this.createChildren.name}`, error);
|
||||
}
|
||||
@ -443,9 +443,9 @@ export class NodesApi extends RepoApi {
|
||||
|
||||
// lock node
|
||||
async lockFile(nodeId: string, lockType: string = 'ALLOW_OWNER_CHANGES'): Promise<NodeEntry|null> {
|
||||
const data = <NodeBodyLock>{
|
||||
const data = {
|
||||
type: lockType
|
||||
};
|
||||
} as NodeBodyLock;
|
||||
|
||||
try {
|
||||
await this.apiAuth();
|
||||
|
@ -25,7 +25,7 @@
|
||||
|
||||
import { PersonModel, Person } from './people-api-models';
|
||||
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 {
|
||||
peopleApi = new AdfPeopleApi(this.alfrescoJsApi);
|
||||
|
@ -53,7 +53,7 @@ export class SharedLinksApi extends RepoApi {
|
||||
try {
|
||||
return await ids.reduce(async (previous: any, current: any) => {
|
||||
await previous;
|
||||
return await this.shareFileById(current);
|
||||
return this.shareFileById(current);
|
||||
}, Promise.resolve());
|
||||
} catch (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> {
|
||||
const site = <SiteBody>{
|
||||
const site = {
|
||||
title,
|
||||
visibility: visibility || SITE_VISIBILITY.PUBLIC,
|
||||
description: description,
|
||||
id: siteId || title
|
||||
};
|
||||
} as SiteBody;
|
||||
|
||||
try {
|
||||
await this.apiAuth();
|
||||
@ -125,7 +125,7 @@ export class SitesApi extends RepoApi {
|
||||
try {
|
||||
return titles.reduce(async (previous: any, current: any) => {
|
||||
await previous;
|
||||
return await this.createSite(current, visibility);
|
||||
return this.createSite(current, visibility);
|
||||
}, Promise.resolve());
|
||||
} catch (error) {
|
||||
this.handleError(`${this.constructor.name} ${this.createSites.name}`, error);
|
||||
@ -149,7 +149,7 @@ export class SitesApi extends RepoApi {
|
||||
try {
|
||||
return siteIds.reduce(async (previous, current) => {
|
||||
await previous;
|
||||
return await this.deleteSite(current, permanent);
|
||||
return this.deleteSite(current, permanent);
|
||||
}, Promise.resolve());
|
||||
} catch (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) => {
|
||||
await previous;
|
||||
return await this.deleteSite(current, permanent);
|
||||
return this.deleteSite(current, permanent);
|
||||
}, Promise.resolve());
|
||||
} catch (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) {
|
||||
const siteRole = <SiteMemberRoleBody>{
|
||||
const siteRole = {
|
||||
role: role
|
||||
};
|
||||
} as SiteMemberRoleBody;
|
||||
|
||||
try {
|
||||
await this.apiAuth();
|
||||
@ -184,10 +184,10 @@ export class SitesApi extends RepoApi {
|
||||
}
|
||||
|
||||
async addSiteMember(siteId: string, userId: string, role: string) {
|
||||
const memberBody = <SiteMemberBody>{
|
||||
const memberBody = {
|
||||
id: userId,
|
||||
role: role
|
||||
};
|
||||
} as SiteMemberBody;
|
||||
|
||||
try {
|
||||
await this.apiAuth();
|
||||
|
@ -26,7 +26,7 @@
|
||||
import { RepoApi } from '../repo-api';
|
||||
import { Logger } from '@alfresco/adf-testing';
|
||||
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 {
|
||||
trashcanApi = new AdfTrashcanApi(this.alfrescoJsApi);
|
||||
@ -73,7 +73,7 @@ export class TrashcanApi extends RepoApi {
|
||||
|
||||
return await ids.reduce(async (previous, current) => {
|
||||
await previous;
|
||||
return await this.permanentlyDelete(current);
|
||||
return this.permanentlyDelete(current);
|
||||
}, Promise.resolve());
|
||||
} catch (error) {
|
||||
this.handleError(`${this.constructor.name} ${this.emptyTrash.name}`, error);
|
||||
|
@ -31,6 +31,26 @@ const path = require('path');
|
||||
const fs = require('fs');
|
||||
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 {
|
||||
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';
|
||||
@ -56,7 +76,7 @@ export class Utils {
|
||||
}
|
||||
|
||||
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> {
|
||||
|
293
package-lock.json
generated
293
package-lock.json
generated
@ -52,12 +52,12 @@
|
||||
"integrity": "sha512-BdS1kmDlu2X9gy10zwjbCohTtp+P40cFEwOyt3QF+rV+XR5MHwHkqawFsw5MDxsXoYoomaB8AJFBdPKlQRS25A=="
|
||||
},
|
||||
"@angular-devkit/architect": {
|
||||
"version": "0.13.1",
|
||||
"resolved": "https://registry.npmjs.org/@angular-devkit/architect/-/architect-0.13.1.tgz",
|
||||
"integrity": "sha512-QDmIbqde75ZZSEFbw6Q6kQWq4cY6C7D67yujXw6XTyubDNAs1tyXJyxTIB8vjSlEKwRizTTDd/B0ZXVcke3Mvw==",
|
||||
"version": "0.13.10",
|
||||
"resolved": "https://registry.npmjs.org/@angular-devkit/architect/-/architect-0.13.10.tgz",
|
||||
"integrity": "sha512-FC+YmeXwFdNMmqnX1nIOkXBQMxWQSbgYz5crWcb7FtOWTNH1IgM/22tZ6lpf3kiAfTtBbnb7oTkA4Y69nUaoQg==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@angular-devkit/core": "7.3.1",
|
||||
"@angular-devkit/core": "7.3.10",
|
||||
"rxjs": "6.3.3"
|
||||
},
|
||||
"dependencies": {
|
||||
@ -239,13 +239,13 @@
|
||||
}
|
||||
},
|
||||
"@angular-devkit/build-ng-packagr": {
|
||||
"version": "0.13.1",
|
||||
"resolved": "https://registry.npmjs.org/@angular-devkit/build-ng-packagr/-/build-ng-packagr-0.13.1.tgz",
|
||||
"integrity": "sha512-9qvdNvtlgJ3WDppbzwD9fOQzAsVogBlDeLE5zUH1ap+zcoyZEGjS1BKluiYSJ1u5Q5Nlfb3FSI/D1r9LuDQS/A==",
|
||||
"version": "0.13.10",
|
||||
"resolved": "https://registry.npmjs.org/@angular-devkit/build-ng-packagr/-/build-ng-packagr-0.13.10.tgz",
|
||||
"integrity": "sha512-e1HB39RT/tnQ9cwk6AhPhyJEaPIwt1O9pphbskeC4layUKzVqPK/Gay4pFhExDXO0vmY4ynqy3EhlllG+AZg/A==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@angular-devkit/architect": "0.13.1",
|
||||
"@angular-devkit/core": "7.3.1",
|
||||
"@angular-devkit/architect": "0.13.10",
|
||||
"@angular-devkit/core": "7.3.10",
|
||||
"rxjs": "6.3.3",
|
||||
"semver": "5.6.0"
|
||||
},
|
||||
@ -339,12 +339,12 @@
|
||||
}
|
||||
},
|
||||
"@angular-devkit/core": {
|
||||
"version": "7.3.1",
|
||||
"resolved": "https://registry.npmjs.org/@angular-devkit/core/-/core-7.3.1.tgz",
|
||||
"integrity": "sha512-56XDWWfIzOAkEk69lBLgmCYybPUA4yjunhmMlCk7vVdb7gbQUyzNjFD04Uj0GjlejatAQ5F76tRwygD9C+3RXQ==",
|
||||
"version": "7.3.10",
|
||||
"resolved": "https://registry.npmjs.org/@angular-devkit/core/-/core-7.3.10.tgz",
|
||||
"integrity": "sha512-h8Yj2+UfBsPI7jZ8X88tImO/7RPgNWUcKF8Uq/J5eUSN6z0FMO0lluD4sM7X8aikb7RK8MwkwrqB/xfxvvkOow==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"ajv": "6.7.0",
|
||||
"ajv": "6.9.1",
|
||||
"chokidar": "2.0.4",
|
||||
"fast-json-stable-stringify": "2.0.0",
|
||||
"rxjs": "6.3.3",
|
||||
@ -352,9 +352,9 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"ajv": {
|
||||
"version": "6.7.0",
|
||||
"resolved": "https://registry.npmjs.org/ajv/-/ajv-6.7.0.tgz",
|
||||
"integrity": "sha512-RZXPviBTtfmtka9n9sy1N5M5b82CbxWIR6HIis4s3WQTXDJamc/0gpCWNGz6EWdWp4DOfjzJfhz/AS9zVPjjWg==",
|
||||
"version": "6.9.1",
|
||||
"resolved": "https://registry.npmjs.org/ajv/-/ajv-6.9.1.tgz",
|
||||
"integrity": "sha512-XDN92U311aINL77ieWHmqCcNlwjoP5cHXDxIxbf2MaPYuCXOHS7gHH8jktxeK5omgd52XbSTX6a4Piwd1pQmzA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"fast-deep-equal": "^2.0.1",
|
||||
@ -4802,6 +4802,12 @@
|
||||
"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": {
|
||||
"version": "2.1.0",
|
||||
"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",
|
||||
"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": {
|
||||
"version": "4.0.3",
|
||||
"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",
|
||||
"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": {
|
||||
"version": "2.2.1",
|
||||
"resolved": "https://registry.npmjs.org/fast-json-patch/-/fast-json-patch-2.2.1.tgz",
|
||||
@ -7984,6 +8006,12 @@
|
||||
"integrity": "sha1-43zwsX8ZnM4jvqcbIDk5Uka07E4=",
|
||||
"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": {
|
||||
"version": "2.5.1",
|
||||
"resolved": "https://registry.npmjs.org/js-base64/-/js-base64-2.5.1.tgz",
|
||||
@ -11910,6 +11938,211 @@
|
||||
"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": {
|
||||
"version": "4.30.1",
|
||||
"resolved": "https://registry.npmjs.org/rxjs-tslint-rules/-/rxjs-tslint-rules-4.30.1.tgz",
|
||||
@ -13682,17 +13915,6 @@
|
||||
"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": {
|
||||
"version": "1.11.1",
|
||||
"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": {
|
||||
"version": "3.17.1",
|
||||
"resolved": "https://registry.npmjs.org/tsutils/-/tsutils-3.17.1.tgz",
|
||||
|
10
package.json
10
package.json
@ -18,7 +18,7 @@
|
||||
"build.e2e": "npm run build.extensions && npm run build.app -- --prod --configuration=e2e",
|
||||
"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",
|
||||
"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": "protractor --baseUrl=${TEST_BASE_URL:-http://localhost:8080/content-app} $SUITE",
|
||||
"e2e.local": "protractor --baseUrl=http://localhost:4200 $SUITE",
|
||||
@ -28,8 +28,6 @@
|
||||
"e2e:docker": "./start.sh && npm run e2e && ./start.sh -d",
|
||||
"spellcheck": "cspell '{src,e2e,projects}/**/*.ts'",
|
||||
"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.e2e": "./build-tomcat-e2e.sh",
|
||||
"e2e.tomcat": "protractor --baseUrl=http://localhost:8080/content-app/ $SUITE",
|
||||
@ -77,7 +75,7 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"@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/compiler-cli": "7.2.15",
|
||||
"@angular/language-service": "7.2.15",
|
||||
@ -112,12 +110,14 @@
|
||||
"protractor": "5.4.2",
|
||||
"protractor-screenshoter-plugin": "0.10.3",
|
||||
"puppeteer": "2.1.1",
|
||||
"rxjs-tslint": "^0.1.8",
|
||||
"rxjs-tslint-rules": "^4.30.1",
|
||||
"selenium-webdriver": "4.0.0-alpha.1",
|
||||
"ts-node": "^8.0.3",
|
||||
"tsickle": "0.34.0",
|
||||
"tslib": "^1.11.1",
|
||||
"tslint": "^5.20.1",
|
||||
"tslint-config-prettier": "^1.18.0",
|
||||
"tslint-plugin-prettier": "^2.3.0",
|
||||
"typescript": "3.2.4",
|
||||
"wait-on": "^4.0.1",
|
||||
"webdriver-manager": "12.1.7"
|
||||
|
@ -28,8 +28,9 @@ import { ContextMenu } from '@alfresco/aca-shared/store';
|
||||
import { fakeAsync, tick } from '@angular/core/testing';
|
||||
|
||||
describe('ContextActionsDirective', () => {
|
||||
let directive;
|
||||
const storeMock = <any>{
|
||||
let directive: ContextActionsDirective;
|
||||
|
||||
const storeMock: any = {
|
||||
dispatch: jasmine.createSpy('dispatch')
|
||||
};
|
||||
|
||||
@ -52,7 +53,7 @@ describe('ContextActionsDirective', () => {
|
||||
const fragment = document.createDocumentFragment();
|
||||
fragment.appendChild(el);
|
||||
const target = fragment.querySelector('div');
|
||||
const mouseEventMock = <any>{ preventDefault: () => {}, target };
|
||||
const mouseEventMock: any = { preventDefault: () => {}, target };
|
||||
|
||||
directive.ngOnInit();
|
||||
|
||||
|
@ -88,7 +88,8 @@ export class ContextActionsDirective implements OnInit, OnDestroy {
|
||||
}
|
||||
|
||||
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 {
|
||||
|
@ -38,7 +38,7 @@ describe('AppRouteReuseStrategy', () => {
|
||||
});
|
||||
|
||||
it('should allow detach if route is configured to be reused', () => {
|
||||
const route = <any>{
|
||||
const route: any = {
|
||||
routeConfig: {
|
||||
data: {
|
||||
reuse: true
|
||||
@ -46,11 +46,11 @@ describe('AppRouteReuseStrategy', () => {
|
||||
path: 'tested-path'
|
||||
}
|
||||
};
|
||||
expect(appRouteReuse.shouldDetach(<any>route)).toBe(true);
|
||||
expect(appRouteReuse.shouldDetach(route)).toBe(true);
|
||||
});
|
||||
|
||||
it('should store on routeCache', () => {
|
||||
const route = <any>{
|
||||
const route: any = {
|
||||
url: [],
|
||||
routeConfig: {
|
||||
data: {
|
||||
@ -63,11 +63,11 @@ describe('AppRouteReuseStrategy', () => {
|
||||
children: []
|
||||
};
|
||||
appRouteReuse.store(route, { route: {} });
|
||||
expect(appRouteReuse.shouldAttach(<any>route)).toBe(true);
|
||||
expect(appRouteReuse.shouldAttach(route)).toBe(true);
|
||||
});
|
||||
|
||||
it('should clear routeCache on resetCache', () => {
|
||||
const route = <any>{
|
||||
const route: any = {
|
||||
url: [],
|
||||
routeConfig: {
|
||||
data: {
|
||||
@ -81,6 +81,6 @@ describe('AppRouteReuseStrategy', () => {
|
||||
};
|
||||
appRouteReuse.store(route, { route: {} });
|
||||
appRouteReuse.resetCache();
|
||||
expect(appRouteReuse.shouldAttach(<any>route)).toBe(false);
|
||||
expect(appRouteReuse.shouldAttach(route)).toBe(false);
|
||||
});
|
||||
});
|
||||
|
@ -91,6 +91,6 @@ describe('AppService', () => {
|
||||
isReady = value;
|
||||
});
|
||||
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> {
|
||||
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 type = siteId ? 'site' : isFolder ? 'folder' : 'file';
|
||||
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> {
|
||||
|
@ -90,7 +90,7 @@ export class RouterEffects {
|
||||
const { path, id } = node;
|
||||
|
||||
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 area = isLibraryPath ? '/libraries' : '/personal-files';
|
||||
@ -115,7 +115,7 @@ export class RouterEffects {
|
||||
const { path } = node;
|
||||
|
||||
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 area = isLibraryPath ? '/libraries' : '/personal-files';
|
||||
|
@ -2,7 +2,7 @@
|
||||
"$schema": "../../node_modules/ng-packagr/ng-package.schema.json",
|
||||
"dest": "../../dist/@alfresco/adf-office-services-ext",
|
||||
"lib": {
|
||||
"entryFile": "src/public_api.ts",
|
||||
"entryFile": "src/public-api.ts",
|
||||
"flatModuleFile": "adf-office-services-ext",
|
||||
"umdModuleIds": {
|
||||
"@alfresco/js-api": "@alfresco/js-api",
|
||||
|
@ -81,7 +81,7 @@ export class AosEditOnlineService {
|
||||
|
||||
private onAlreadyLockedNotification(nodeId: string, lockOwner: string) {
|
||||
this.notificationService.openSnackMessage(
|
||||
`Document {nodeId} locked by {lockOwner}`,
|
||||
`Document ${nodeId} locked by ${lockOwner}`,
|
||||
3000
|
||||
);
|
||||
}
|
||||
@ -155,12 +155,12 @@ export class AosEditOnlineService {
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
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', () => {
|
||||
|
@ -23,13 +23,10 @@
|
||||
* 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';
|
||||
|
||||
export function canOpenWithOffice(
|
||||
context: RuleContext,
|
||||
...args: RuleParameter[]
|
||||
): boolean {
|
||||
export function canOpenWithOffice(context: RuleContext): boolean {
|
||||
if (
|
||||
context.navigation &&
|
||||
context.navigation.url &&
|
||||
|
@ -83,42 +83,42 @@ describe('AppComponent', () => {
|
||||
|
||||
describe('onFileUploadedError', () => {
|
||||
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(
|
||||
'APP.MESSAGES.UPLOAD.ERROR.403'
|
||||
);
|
||||
});
|
||||
|
||||
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(
|
||||
'APP.MESSAGES.UPLOAD.ERROR.404'
|
||||
);
|
||||
});
|
||||
|
||||
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(
|
||||
'APP.MESSAGES.UPLOAD.ERROR.CONFLICT'
|
||||
);
|
||||
});
|
||||
|
||||
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(
|
||||
'APP.MESSAGES.UPLOAD.ERROR.500'
|
||||
);
|
||||
});
|
||||
|
||||
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(
|
||||
'APP.MESSAGES.UPLOAD.ERROR.504'
|
||||
);
|
||||
});
|
||||
|
||||
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(
|
||||
'APP.MESSAGES.UPLOAD.ERROR.GENERIC'
|
||||
);
|
||||
|
@ -30,7 +30,7 @@ describe('ToggleSharedComponent', () => {
|
||||
let component;
|
||||
let entry;
|
||||
|
||||
const storeMock = {
|
||||
const storeMock: any = {
|
||||
select: () => of({ first: { entry } }),
|
||||
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 => {
|
||||
|
@ -53,7 +53,7 @@ export class ToggleSharedComponent implements OnInit {
|
||||
if (
|
||||
selection.first &&
|
||||
selection.first.entry &&
|
||||
(<any>selection.first.entry).sharedByUser
|
||||
(selection.first.entry as any).sharedByUser
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
|
@ -56,7 +56,7 @@ describe('ContextMenuComponent', () => {
|
||||
component = fixture.componentInstance;
|
||||
extensionsService = TestBed.get(AppExtensionService);
|
||||
|
||||
contextItem = <any>{
|
||||
contextItem = {
|
||||
type: 'button',
|
||||
id: 'action-button',
|
||||
title: 'Test Button',
|
||||
|
@ -102,7 +102,7 @@ describe('CurrentUserComponent', () => {
|
||||
});
|
||||
|
||||
it('should set menu actions', () => {
|
||||
const actions = <any>[
|
||||
const actions: any[] = [
|
||||
{
|
||||
id: 'action-id'
|
||||
}
|
||||
|
@ -141,7 +141,7 @@ describe('FavoriteLibrariesComponent', () => {
|
||||
|
||||
it('does not navigate when id is not passed', () => {
|
||||
spyOn(router, 'navigate').and.stub();
|
||||
component.navigateTo(<any>{ entry: { guid: 'guid' } });
|
||||
component.navigateTo({ entry: { guid: 'guid' } } as any);
|
||||
|
||||
expect(router.navigate).toHaveBeenCalledWith(['libraries', 'libraryId']);
|
||||
});
|
||||
|
@ -69,7 +69,7 @@ describe('FavoritesComponent', () => {
|
||||
}
|
||||
};
|
||||
|
||||
node = <any>{
|
||||
node = {
|
||||
id: 'folder-node',
|
||||
isFolder: true,
|
||||
isFile: false,
|
||||
@ -171,7 +171,7 @@ describe('FavoritesComponent', () => {
|
||||
}));
|
||||
|
||||
it('should navigate if node is folder', () => {
|
||||
const nodeEntity = <any>{ entry: { isFolder: true } };
|
||||
const nodeEntity: any = { entry: { isFolder: true } };
|
||||
spyOn(component, 'navigate').and.stub();
|
||||
fixture.detectChanges();
|
||||
|
||||
@ -180,7 +180,7 @@ describe('FavoritesComponent', () => {
|
||||
});
|
||||
|
||||
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();
|
||||
fixture.detectChanges();
|
||||
|
||||
|
@ -148,12 +148,12 @@ describe('FilesComponent', () => {
|
||||
});
|
||||
|
||||
it('should call refresh onContentCopied event if parent is the same', () => {
|
||||
const nodes = [
|
||||
<any>{ entry: { parentId: '1' } },
|
||||
<any>{ entry: { parentId: '2' } }
|
||||
const nodes: any[] = [
|
||||
{ entry: { parentId: '1' } },
|
||||
{ entry: { parentId: '2' } }
|
||||
];
|
||||
|
||||
component.node = <any>{ id: '1' };
|
||||
component.node = { id: '1' } as any;
|
||||
|
||||
nodeActionsService.contentCopied.next(nodes);
|
||||
|
||||
@ -161,12 +161,12 @@ describe('FilesComponent', () => {
|
||||
});
|
||||
|
||||
it('should not call refresh onContentCopied event when parent mismatch', () => {
|
||||
const nodes = [
|
||||
<any>{ entry: { parentId: '1' } },
|
||||
<any>{ entry: { parentId: '2' } }
|
||||
const nodes: any[] = [
|
||||
{ entry: { parentId: '1' } },
|
||||
{ entry: { parentId: '2' } }
|
||||
];
|
||||
|
||||
component.node = <any>{ id: '3' };
|
||||
component.node = { id: '3' } as any;
|
||||
|
||||
nodeActionsService.contentCopied.next(nodes);
|
||||
|
||||
@ -174,10 +174,10 @@ describe('FilesComponent', () => {
|
||||
});
|
||||
|
||||
it('should call refresh on fileUploadComplete event if parent node match', fakeAsync(() => {
|
||||
const file = { file: { options: { parentId: 'parentId' } } };
|
||||
component.node = <any>{ id: 'parentId' };
|
||||
const file: any = { file: { options: { parentId: 'parentId' } } };
|
||||
component.node = { id: 'parentId' } as any;
|
||||
|
||||
uploadService.fileUploadComplete.next(<any>file);
|
||||
uploadService.fileUploadComplete.next(file);
|
||||
|
||||
tick(500);
|
||||
|
||||
@ -185,10 +185,10 @@ describe('FilesComponent', () => {
|
||||
}));
|
||||
|
||||
it('should not call refresh on fileUploadComplete event if parent mismatch', fakeAsync(() => {
|
||||
const file = { file: { options: { parentId: 'otherId' } } };
|
||||
component.node = <any>{ id: 'parentId' };
|
||||
const file: any = { file: { options: { parentId: 'otherId' } } };
|
||||
component.node = { id: 'parentId' } as any;
|
||||
|
||||
uploadService.fileUploadComplete.next(<any>file);
|
||||
uploadService.fileUploadComplete.next(file);
|
||||
|
||||
tick(500);
|
||||
|
||||
@ -196,10 +196,10 @@ describe('FilesComponent', () => {
|
||||
}));
|
||||
|
||||
it('should call refresh on fileUploadDeleted event if parent node match', fakeAsync(() => {
|
||||
const file = { file: { options: { parentId: 'parentId' } } };
|
||||
component.node = <any>{ id: 'parentId' };
|
||||
const file: any = { file: { options: { parentId: 'parentId' } } };
|
||||
component.node = { id: 'parentId' } as any;
|
||||
|
||||
uploadService.fileUploadDeleted.next(<any>file);
|
||||
uploadService.fileUploadDeleted.next(file);
|
||||
|
||||
tick(500);
|
||||
|
||||
@ -208,7 +208,7 @@ describe('FilesComponent', () => {
|
||||
|
||||
it('should not call refresh on fileUploadDeleted event if parent mismatch', fakeAsync(() => {
|
||||
const file: any = { file: { options: { parentId: 'otherId' } } };
|
||||
component.node = <any>{ id: 'parentId' };
|
||||
component.node = { id: 'parentId' } as any;
|
||||
|
||||
uploadService.fileUploadDeleted.next(file);
|
||||
|
||||
@ -258,11 +258,11 @@ describe('FilesComponent', () => {
|
||||
});
|
||||
|
||||
it('should navigate home if node is root', () => {
|
||||
component.node = <any>{
|
||||
component.node = {
|
||||
path: {
|
||||
elements: [{ id: 'node-id' }]
|
||||
}
|
||||
};
|
||||
} as any;
|
||||
|
||||
router.url = '/personal-files';
|
||||
component.navigate(node.id);
|
||||
@ -273,19 +273,19 @@ describe('FilesComponent', () => {
|
||||
|
||||
describe('isSiteContainer', () => {
|
||||
it('should return false if node has no aspectNames', () => {
|
||||
const mock = <any>{ aspectNames: [] };
|
||||
const mock: any = { aspectNames: [] };
|
||||
|
||||
expect(component.isSiteContainer(mock)).toBe(false);
|
||||
});
|
||||
|
||||
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);
|
||||
});
|
||||
|
||||
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);
|
||||
});
|
||||
|
@ -207,7 +207,7 @@ export class FilesComponent extends PageComponent implements OnInit, OnDestroy {
|
||||
displayFolderParent(filePath = '', index: number) {
|
||||
const parentName = filePath.split('/')[index];
|
||||
const currentFoldersDisplayed =
|
||||
<ShareDataRow[]>this.documentList.data.getRows() || [];
|
||||
(this.documentList.data.getRows() as ShareDataRow[]) || [];
|
||||
|
||||
const alreadyDisplayedParentFolder = currentFoldersDisplayed.find(
|
||||
row => row.node.entry.isFolder && row.node.entry.name === parentName
|
||||
|
@ -51,7 +51,7 @@ describe('CommentsTabComponent', () => {
|
||||
component = fixture.componentInstance;
|
||||
|
||||
checked = null;
|
||||
permissionsMock.check.and.callFake((source, permissions) => {
|
||||
permissionsMock.check.and.callFake((_source, permissions) => {
|
||||
checked = permissions;
|
||||
return true;
|
||||
});
|
||||
@ -68,44 +68,44 @@ describe('CommentsTabComponent', () => {
|
||||
});
|
||||
|
||||
it('should return [false] if node selected is neither file or folder', () => {
|
||||
const testNode = {
|
||||
const testNode: any = {
|
||||
id: 'test-node-id',
|
||||
isFile: false,
|
||||
isFolder: false
|
||||
};
|
||||
component.node = <any>testNode;
|
||||
component.node = testNode;
|
||||
expect(component.canUpdateNode).toBe(false);
|
||||
});
|
||||
|
||||
it('should return [false] if node selected is a locked file', () => {
|
||||
const testNode = {
|
||||
const testNode: any = {
|
||||
id: 'test-node-id',
|
||||
isFile: true,
|
||||
isFolder: false,
|
||||
isLocked: true
|
||||
};
|
||||
component.node = <any>testNode;
|
||||
component.node = testNode;
|
||||
expect(component.canUpdateNode).toBe(false);
|
||||
});
|
||||
|
||||
it('should check [update] permission if node selected is a not locked file', () => {
|
||||
const testNode = {
|
||||
const testNode: any = {
|
||||
id: 'test-node-id',
|
||||
isFile: true,
|
||||
isFolder: false
|
||||
};
|
||||
component.node = <any>testNode;
|
||||
component.node = testNode;
|
||||
expect(component.canUpdateNode).toBe(true);
|
||||
expect(checked).toContain('update');
|
||||
});
|
||||
|
||||
it('should check [update] permission if node selected is a folder', () => {
|
||||
const testNode = {
|
||||
const testNode: any = {
|
||||
id: 'test-node-id',
|
||||
isFile: false,
|
||||
isFolder: true
|
||||
};
|
||||
component.node = <any>testNode;
|
||||
component.node = testNode;
|
||||
expect(component.canUpdateNode).toBe(true);
|
||||
expect(checked).toContain('update');
|
||||
});
|
||||
|
@ -65,7 +65,7 @@ describe('InfoDrawerComponent', () => {
|
||||
appExtensionService = TestBed.get(AppExtensionService);
|
||||
contentApiService = TestBed.get(ContentApiService);
|
||||
|
||||
tab = <any>{ title: 'tab1' };
|
||||
tab = { title: 'tab1' };
|
||||
spyOn(appExtensionService, 'getSidebarTabs').and.returnValue([tab]);
|
||||
});
|
||||
|
||||
@ -90,7 +90,7 @@ describe('InfoDrawerComponent', () => {
|
||||
|
||||
it('should set displayNode when node is library', async(() => {
|
||||
spyOn(contentApiService, 'getNodeInfo');
|
||||
const nodeMock = <any>{
|
||||
const nodeMock: any = {
|
||||
entry: { id: 'nodeId' },
|
||||
isLibrary: true
|
||||
};
|
||||
@ -104,9 +104,9 @@ describe('InfoDrawerComponent', () => {
|
||||
}));
|
||||
|
||||
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));
|
||||
const nodeMock = <any>{ entry: { nodeId: 'nodeId' }, isLibrary: false };
|
||||
const nodeMock: any = { entry: { nodeId: 'nodeId' }, isLibrary: false };
|
||||
component.node = nodeMock;
|
||||
|
||||
fixture.detectChanges();
|
||||
@ -117,9 +117,9 @@ describe('InfoDrawerComponent', () => {
|
||||
}));
|
||||
|
||||
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));
|
||||
const nodeMock = <any>{
|
||||
const nodeMock: any = {
|
||||
entry: { id: 'nodeId', guid: 'guidId' },
|
||||
isLibrary: false
|
||||
};
|
||||
@ -133,9 +133,9 @@ describe('InfoDrawerComponent', () => {
|
||||
}));
|
||||
|
||||
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));
|
||||
const nodeMock = <any>{
|
||||
const nodeMock: any = {
|
||||
entry: {
|
||||
id: 'nodeId',
|
||||
content: { mimeType: 'image/jpeg' }
|
||||
|
@ -59,8 +59,8 @@ export class InfoDrawerComponent implements OnChanges, OnInit, OnDestroy {
|
||||
displayNode: MinimalNodeEntryEntity | SiteEntry;
|
||||
tabs: Array<SidebarTabRef> = [];
|
||||
|
||||
@HostListener('keydown.escape', ['$event'])
|
||||
onEscapeKeyboardEvent(event: KeyboardEvent): void {
|
||||
@HostListener('keydown.escape')
|
||||
onEscapeKeyboardEvent(): void {
|
||||
this.close();
|
||||
}
|
||||
|
||||
|
@ -33,7 +33,7 @@ import { Store } from '@ngrx/store';
|
||||
import { UpdateLibraryAction } from '@alfresco/aca-shared/store';
|
||||
import { AppTestingModule } from '../../../testing/app-testing.module';
|
||||
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';
|
||||
|
||||
describe('LibraryMetadataFormComponent', () => {
|
||||
@ -71,10 +71,10 @@ describe('LibraryMetadataFormComponent', () => {
|
||||
visibility: 'PRIVATE'
|
||||
};
|
||||
component.node = {
|
||||
entry: <Site>{
|
||||
entry: {
|
||||
id: 'libraryId',
|
||||
...siteEntryModel
|
||||
}
|
||||
} as Site
|
||||
};
|
||||
fixture.detectChanges();
|
||||
|
||||
@ -95,10 +95,10 @@ describe('LibraryMetadataFormComponent', () => {
|
||||
};
|
||||
|
||||
component.node = {
|
||||
entry: <Site>{
|
||||
entry: {
|
||||
id: 'libraryId',
|
||||
...siteEntryModel
|
||||
}
|
||||
} as Site
|
||||
};
|
||||
|
||||
fixture.detectChanges();
|
||||
@ -106,10 +106,10 @@ describe('LibraryMetadataFormComponent', () => {
|
||||
expect(component.form.value).toEqual(siteEntryModel);
|
||||
|
||||
component.node = {
|
||||
entry: <Site>{
|
||||
entry: {
|
||||
id: 'libraryId',
|
||||
...newSiteEntryModel
|
||||
}
|
||||
} as Site
|
||||
};
|
||||
|
||||
component.ngOnChanges();
|
||||
@ -124,11 +124,11 @@ describe('LibraryMetadataFormComponent', () => {
|
||||
visibility: 'PRIVATE'
|
||||
};
|
||||
component.node = {
|
||||
entry: <Site>{
|
||||
entry: {
|
||||
id: 'libraryId',
|
||||
role: 'SiteManager',
|
||||
...siteEntryModel
|
||||
}
|
||||
} as Site
|
||||
};
|
||||
|
||||
fixture.detectChanges();
|
||||
@ -136,7 +136,7 @@ describe('LibraryMetadataFormComponent', () => {
|
||||
component.update();
|
||||
|
||||
expect(storeMock.dispatch).toHaveBeenCalledWith(
|
||||
new UpdateLibraryAction(<SiteBody>siteEntryModel)
|
||||
new UpdateLibraryAction(siteEntryModel)
|
||||
);
|
||||
});
|
||||
|
||||
@ -147,11 +147,11 @@ describe('LibraryMetadataFormComponent', () => {
|
||||
visibility: 'PRIVATE'
|
||||
};
|
||||
component.node = {
|
||||
entry: <Site>{
|
||||
entry: {
|
||||
id: 'libraryId',
|
||||
role: 'Consumer',
|
||||
...siteEntryModel
|
||||
}
|
||||
} as Site
|
||||
};
|
||||
|
||||
fixture.detectChanges();
|
||||
@ -159,7 +159,7 @@ describe('LibraryMetadataFormComponent', () => {
|
||||
component.update();
|
||||
|
||||
expect(storeMock.dispatch).not.toHaveBeenCalledWith(
|
||||
new UpdateLibraryAction(<SiteBody>siteEntryModel)
|
||||
new UpdateLibraryAction(siteEntryModel)
|
||||
);
|
||||
});
|
||||
|
||||
@ -170,11 +170,11 @@ describe('LibraryMetadataFormComponent', () => {
|
||||
visibility: 'PRIVATE'
|
||||
};
|
||||
component.node = {
|
||||
entry: <Site>{
|
||||
entry: {
|
||||
id: 'libraryId',
|
||||
role: 'SiteManager',
|
||||
...siteEntryModel
|
||||
}
|
||||
} as Site
|
||||
};
|
||||
|
||||
fixture.detectChanges();
|
||||
@ -184,7 +184,7 @@ describe('LibraryMetadataFormComponent', () => {
|
||||
component.update();
|
||||
|
||||
expect(storeMock.dispatch).not.toHaveBeenCalledWith(
|
||||
new UpdateLibraryAction(<SiteBody>siteEntryModel)
|
||||
new UpdateLibraryAction(siteEntryModel)
|
||||
);
|
||||
});
|
||||
|
||||
@ -205,10 +205,10 @@ describe('LibraryMetadataFormComponent', () => {
|
||||
visibility: 'PRIVATE'
|
||||
};
|
||||
component.node = {
|
||||
entry: <Site>{
|
||||
entry: {
|
||||
id: 'libraryId',
|
||||
...siteEntryModel
|
||||
}
|
||||
} as Site
|
||||
};
|
||||
fixture.detectChanges();
|
||||
|
||||
@ -241,10 +241,10 @@ describe('LibraryMetadataFormComponent', () => {
|
||||
};
|
||||
|
||||
component.node = {
|
||||
entry: <Site>{
|
||||
entry: {
|
||||
id: 'libraryId',
|
||||
...siteEntryModel
|
||||
}
|
||||
} as Site
|
||||
};
|
||||
|
||||
fixture.detectChanges();
|
||||
@ -272,10 +272,10 @@ describe('LibraryMetadataFormComponent', () => {
|
||||
};
|
||||
|
||||
component.node = {
|
||||
entry: <Site>{
|
||||
entry: {
|
||||
id: 'libraryId',
|
||||
...siteEntryModel
|
||||
}
|
||||
} as Site
|
||||
};
|
||||
|
||||
fixture.detectChanges();
|
||||
@ -303,10 +303,10 @@ describe('LibraryMetadataFormComponent', () => {
|
||||
};
|
||||
|
||||
component.node = {
|
||||
entry: <Site>{
|
||||
entry: {
|
||||
id: 'libraryId',
|
||||
...siteEntryModel
|
||||
}
|
||||
} as Site
|
||||
};
|
||||
|
||||
fixture.detectChanges();
|
||||
|
@ -90,43 +90,43 @@ describe('MetadataTabComponent', () => {
|
||||
});
|
||||
|
||||
it('should return true if node is not locked and has update permission', () => {
|
||||
const node = <Node>{
|
||||
const node = {
|
||||
isLocked: false,
|
||||
allowableOperations: ['update']
|
||||
};
|
||||
} as Node;
|
||||
|
||||
component.node = node;
|
||||
expect(component.canUpdateNode).toBe(true);
|
||||
});
|
||||
|
||||
it('should return false if node is locked', () => {
|
||||
const node = <Node>{
|
||||
const node = {
|
||||
isLocked: true,
|
||||
allowableOperations: ['update']
|
||||
};
|
||||
} as Node;
|
||||
|
||||
component.node = node;
|
||||
expect(component.canUpdateNode).toBe(false);
|
||||
});
|
||||
|
||||
it('should return false if node has no update permission', () => {
|
||||
const node = <Node>{
|
||||
const node = {
|
||||
isLocked: false,
|
||||
allowableOperations: ['other']
|
||||
};
|
||||
} as Node;
|
||||
|
||||
component.node = node;
|
||||
expect(component.canUpdateNode).toBe(false);
|
||||
});
|
||||
|
||||
it('should return false if node has read only property', () => {
|
||||
const node = <Node>{
|
||||
const node = {
|
||||
isLocked: false,
|
||||
allowableOperations: ['update'],
|
||||
properties: {
|
||||
'cm:lockType': 'WRITE_LOCK'
|
||||
}
|
||||
};
|
||||
} as Node;
|
||||
|
||||
component.node = node;
|
||||
expect(component.canUpdateNode).toBe(false);
|
||||
|
@ -65,7 +65,7 @@ export class VersionsTabComponent implements OnInit, OnChanges {
|
||||
}
|
||||
|
||||
private updateState() {
|
||||
if (this.node && (<any>this.node).nodeId) {
|
||||
if (this.node && (this.node as any).nodeId) {
|
||||
// workaround for shared files type.
|
||||
this.isFileSelected = true;
|
||||
} else {
|
||||
|
@ -142,7 +142,7 @@ describe('AppLayoutComponent', () => {
|
||||
});
|
||||
|
||||
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();
|
||||
fixture.detectChanges();
|
||||
store.dispatch(new SetSelectedNodesAction(selection));
|
||||
@ -164,7 +164,7 @@ describe('AppLayoutComponent', () => {
|
||||
spyOn(component.layout.container, 'toggleMenu');
|
||||
fixture.detectChanges();
|
||||
|
||||
component.hideMenu(<any>{ preventDefault: () => {} });
|
||||
component.hideMenu({ preventDefault: () => {} } as any);
|
||||
|
||||
expect(component.layout.container.toggleMenu).toHaveBeenCalled();
|
||||
});
|
||||
@ -180,7 +180,7 @@ describe('AppLayoutComponent', () => {
|
||||
spyOn(component.layout.container, 'toggleMenu');
|
||||
fixture.detectChanges();
|
||||
|
||||
component.hideMenu(<any>{ preventDefault: () => {} });
|
||||
component.hideMenu({ preventDefault: () => {} } as any);
|
||||
|
||||
expect(component.layout.container.toggleMenu).toHaveBeenCalled();
|
||||
});
|
||||
|
@ -115,7 +115,7 @@ export abstract class PageComponent implements OnInit, OnDestroy {
|
||||
showPreview(node: MinimalNodeEntity, extras?: ViewNodeExtras) {
|
||||
if (node && node.entry) {
|
||||
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));
|
||||
}
|
||||
|
@ -737,7 +737,7 @@ describe('PreviewComponent', () => {
|
||||
it('should emit nodeUpdated event on fileUploadComplete event', fakeAsync(() => {
|
||||
spyOn(alfrescoApiService.nodeUpdated, 'next');
|
||||
fixture.detectChanges();
|
||||
uploadService.fileUploadComplete.next(<any>{ data: { entry: {} } });
|
||||
uploadService.fileUploadComplete.next({ data: { entry: {} } } as any);
|
||||
tick(300);
|
||||
|
||||
expect(alfrescoApiService.nodeUpdated.next).toHaveBeenCalled();
|
||||
|
@ -119,7 +119,7 @@ describe('RecentFilesComponent', () => {
|
||||
}));
|
||||
|
||||
it('should call showPreview method', () => {
|
||||
const node = <any>{ entry: {} };
|
||||
const node: any = { entry: {} };
|
||||
spyOn(component, 'showPreview');
|
||||
fixture.detectChanges();
|
||||
|
||||
|
@ -52,6 +52,7 @@ export class SearchInputControlComponent implements OnDestroy {
|
||||
/** Emitted when the search is submitted pressing ENTER button.
|
||||
* The search term is provided as value of the event.
|
||||
*/
|
||||
// tslint:disable-next-line: no-output-native
|
||||
@Output()
|
||||
submit: EventEmitter<any> = new EventEmitter();
|
||||
|
||||
|
@ -99,7 +99,7 @@ describe('SearchInputComponent', () => {
|
||||
done();
|
||||
})
|
||||
);
|
||||
component.onSearchSubmit(<any>{ target: { value: searchedTerm } });
|
||||
component.onSearchSubmit({ target: { value: searchedTerm } });
|
||||
tick();
|
||||
}));
|
||||
|
||||
@ -112,7 +112,7 @@ describe('SearchInputComponent', () => {
|
||||
done();
|
||||
})
|
||||
);
|
||||
component.onSearchSubmit(<any>{ target: { value: searchedTerm } });
|
||||
component.onSearchSubmit({ target: { value: searchedTerm } });
|
||||
tick();
|
||||
}));
|
||||
});
|
||||
|
@ -122,7 +122,7 @@ export class SettingsComponent implements OnInit {
|
||||
null
|
||||
);
|
||||
|
||||
this.form.reset(<RepositoryConfig>{
|
||||
this.form.reset({
|
||||
ecmHost:
|
||||
this.storage.getItem('ecmHost') ||
|
||||
this.appConfig.get<string>('ecmHost'),
|
||||
|
@ -126,7 +126,7 @@ describe('SharedFilesComponent', () => {
|
||||
}));
|
||||
|
||||
it('should call showPreview method', () => {
|
||||
const node = <any>{ entry: {} };
|
||||
const node: any = { entry: {} };
|
||||
spyOn(component, 'showPreview');
|
||||
fixture.detectChanges();
|
||||
|
||||
|
@ -102,7 +102,7 @@ describe('SharedLinkViewComponent', () => {
|
||||
tick();
|
||||
|
||||
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]) => {
|
||||
if (sharedEntry) {
|
||||
this.store.dispatch(new SetSelectedNodesAction([<any>sharedEntry]));
|
||||
this.store.dispatch(new SetSelectedNodesAction([sharedEntry as any]));
|
||||
}
|
||||
this.sharedLinkId = sharedId;
|
||||
});
|
||||
|
@ -52,7 +52,7 @@ export class ButtonMenuComponent implements OnInit {
|
||||
this.cd.detectChanges();
|
||||
}
|
||||
|
||||
trackById(index: number, obj: { id: string }) {
|
||||
trackById(_index: number, obj: { id: string }) {
|
||||
return obj.id;
|
||||
}
|
||||
}
|
||||
|
@ -46,7 +46,7 @@ export class ExpandMenuComponent implements OnInit {
|
||||
this.cd.detectChanges();
|
||||
}
|
||||
|
||||
trackById(index: number, obj: { id: string }) {
|
||||
trackById(_index: number, obj: { id: string }) {
|
||||
return obj.id;
|
||||
}
|
||||
}
|
||||
|
@ -27,7 +27,7 @@ import { ActionDirective } from './action.directive';
|
||||
|
||||
describe('ActionDirective', () => {
|
||||
let directive: ActionDirective;
|
||||
const routeMock = <any>{
|
||||
const routeMock: any = {
|
||||
navigate: jasmine.createSpy('navigate'),
|
||||
parseUrl: () => ({
|
||||
root: {
|
||||
@ -35,7 +35,7 @@ describe('ActionDirective', () => {
|
||||
}
|
||||
})
|
||||
};
|
||||
const storeMock = <any>{
|
||||
const storeMock: any = {
|
||||
dispatch: jasmine.createSpy('dispatch')
|
||||
};
|
||||
|
||||
|
@ -51,10 +51,10 @@ class RouterStub {
|
||||
}
|
||||
|
||||
describe('AcaExpansionPanel', () => {
|
||||
const mockStore = <any>{
|
||||
const mockStore: any = {
|
||||
dispatch: jasmine.createSpy('dispatch')
|
||||
};
|
||||
const mockMatExpansionPanel = <any>{
|
||||
const mockMatExpansionPanel: any = {
|
||||
expanded: false,
|
||||
children: []
|
||||
};
|
||||
|
@ -51,10 +51,10 @@ class RouterStub {
|
||||
}
|
||||
|
||||
describe('MenuPanelDirective', () => {
|
||||
const mockStore = <any>{
|
||||
const mockStore: any = {
|
||||
dispatch: jasmine.createSpy('dispatch')
|
||||
};
|
||||
const mockMatExpansionPanel = <any>{
|
||||
const mockMatExpansionPanel: any = {
|
||||
expanded: false,
|
||||
children: []
|
||||
};
|
||||
|
@ -33,7 +33,7 @@ describe('SidenavComponent', () => {
|
||||
let fixture: ComponentFixture<SidenavComponent>;
|
||||
let component: SidenavComponent;
|
||||
let extensionService: AppExtensionService;
|
||||
const navbarMock = <any>[
|
||||
const navbarMock: any = [
|
||||
{
|
||||
items: [
|
||||
{
|
||||
@ -63,7 +63,7 @@ describe('SidenavComponent', () => {
|
||||
}));
|
||||
|
||||
it('should set the sidenav data', async(() => {
|
||||
expect(component.groups).toEqual(<any>[
|
||||
expect(component.groups).toEqual([
|
||||
{
|
||||
items: [
|
||||
{
|
||||
@ -71,7 +71,7 @@ describe('SidenavComponent', () => {
|
||||
url: '/route'
|
||||
}
|
||||
]
|
||||
}
|
||||
} as any
|
||||
]);
|
||||
}));
|
||||
});
|
||||
|
@ -77,7 +77,7 @@ export class ToggleFavoriteLibraryComponent implements OnInit {
|
||||
map(selection => {
|
||||
// favorite libraries list should already be marked as favorite
|
||||
if (selection.library && isFavoriteLibraries) {
|
||||
(<any>selection.library).isFavorite = true;
|
||||
(selection.library as any).isFavorite = true;
|
||||
return selection;
|
||||
}
|
||||
return selection;
|
||||
|
@ -38,7 +38,7 @@ describe('ToggleFavoriteComponent', () => {
|
||||
const mockRouter = {
|
||||
url: 'some-url'
|
||||
};
|
||||
const mockStore = <any>{
|
||||
const mockStore: any = {
|
||||
dispatch: jasmine.createSpy('dispatch'),
|
||||
select: jasmine.createSpy('select').and.returnValue(
|
||||
of({
|
||||
|
@ -85,7 +85,7 @@ export class ToggleJoinLibraryButtonComponent {
|
||||
if (event.updatedEntry) {
|
||||
this.store.dispatch(
|
||||
new SetSelectedNodesAction([
|
||||
<any>{ entry: event.updatedEntry, isLibrary: true }
|
||||
{ entry: event.updatedEntry, isLibrary: true } as any
|
||||
])
|
||||
);
|
||||
}
|
||||
|
@ -36,7 +36,7 @@ describe('ToggleFavoriteComponent', () => {
|
||||
const mockRouter = {
|
||||
url: 'some-url'
|
||||
};
|
||||
const mockStore = <any>{
|
||||
const mockStore: any = {
|
||||
dispatch: jasmine.createSpy('dispatch'),
|
||||
select: jasmine.createSpy('select').and.returnValue(
|
||||
of({
|
||||
|
@ -66,8 +66,8 @@ export class ViewNodeComponent {
|
||||
.pipe(take(1))
|
||||
.subscribe(selection => {
|
||||
const id =
|
||||
(<SharedLinkEntry>selection.file).entry.nodeId ||
|
||||
(<any>selection.file).entry.guid ||
|
||||
(selection.file as SharedLinkEntry).entry.nodeId ||
|
||||
(selection.file as any).entry.guid ||
|
||||
selection.file.entry.id;
|
||||
|
||||
this.store.dispatch(
|
||||
|
@ -68,10 +68,10 @@ describe('TrashcanComponent', () => {
|
||||
alfrescoApi = TestBed.get(AlfrescoApiService);
|
||||
alfrescoApi.reset();
|
||||
|
||||
component.documentList = <any>{
|
||||
component.documentList = {
|
||||
reload: jasmine.createSpy('reload'),
|
||||
resetSelection: jasmine.createSpy('resetSelection')
|
||||
};
|
||||
} as any;
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
|
@ -30,7 +30,7 @@ import { SetSelectedNodesAction } from '@alfresco/aca-shared/store';
|
||||
describe('DocumentListDirective', () => {
|
||||
let documentListDirective;
|
||||
|
||||
const documentListMock = <any>{
|
||||
const documentListMock: any = {
|
||||
currentFolderId: '',
|
||||
stickyHeader: false,
|
||||
includeFields: [],
|
||||
@ -44,20 +44,20 @@ describe('DocumentListDirective', () => {
|
||||
ready: new Subject<any>()
|
||||
};
|
||||
|
||||
const storeMock = <any>{
|
||||
const storeMock: any = {
|
||||
dispatch: jasmine.createSpy('dispatch')
|
||||
};
|
||||
|
||||
const mockRouter = <any>{
|
||||
const mockRouter: any = {
|
||||
url: ''
|
||||
};
|
||||
|
||||
const contentManagementServiceMock = <any>{
|
||||
const contentManagementServiceMock: any = {
|
||||
reload: new Subject<any>(),
|
||||
reset: new Subject<any>()
|
||||
};
|
||||
|
||||
const mockRoute = <any>{
|
||||
const mockRoute: any = {
|
||||
snapshot: {
|
||||
data: {
|
||||
sortingPreferenceKey: null
|
||||
@ -65,7 +65,7 @@ describe('DocumentListDirective', () => {
|
||||
}
|
||||
};
|
||||
|
||||
const userPreferencesServiceMock = <any>{
|
||||
const userPreferencesServiceMock: any = {
|
||||
set: jasmine.createSpy('set'),
|
||||
get: jasmine.createSpy('get')
|
||||
};
|
||||
@ -109,7 +109,7 @@ describe('DocumentListDirective', () => {
|
||||
documentListMock.ready.next();
|
||||
|
||||
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')
|
||||
library: any = null;
|
||||
|
||||
@Output() toggle: EventEmitter<any> = new EventEmitter();
|
||||
@Output() error: EventEmitter<any> = new EventEmitter();
|
||||
@Output() toggle = new EventEmitter<any>();
|
||||
// tslint:disable-next-line: no-output-native
|
||||
@Output() error = new EventEmitter<any>();
|
||||
|
||||
private targetLibrary = null;
|
||||
|
||||
|
@ -62,12 +62,12 @@ export class LibraryMembershipDirective implements OnChanges {
|
||||
@Input('acaLibraryMembership')
|
||||
selection: SiteEntry = null;
|
||||
|
||||
@Output() toggle: EventEmitter<
|
||||
LibraryMembershipToggleEvent
|
||||
> = new EventEmitter();
|
||||
@Output() error: EventEmitter<
|
||||
LibraryMembershipErrorEvent
|
||||
> = new EventEmitter();
|
||||
@Output()
|
||||
toggle = new EventEmitter<LibraryMembershipToggleEvent>();
|
||||
|
||||
// tslint:disable-next-line: no-output-native
|
||||
@Output()
|
||||
error = new EventEmitter<LibraryMembershipErrorEvent>();
|
||||
|
||||
@HostListener('click')
|
||||
onClick() {
|
||||
@ -187,9 +187,10 @@ export class LibraryMembershipDirective implements OnChanges {
|
||||
}
|
||||
|
||||
private joinLibraryRequest() {
|
||||
const memberBody = <SiteMembershipRequestBody>{
|
||||
const memberBody = {
|
||||
id: this.targetSite.id
|
||||
};
|
||||
} as SiteMembershipRequestBody;
|
||||
|
||||
return from(
|
||||
this.alfrescoApiService.peopleApi.addSiteMembershipRequest(
|
||||
'-me-',
|
||||
|
@ -30,7 +30,7 @@ import {
|
||||
Input,
|
||||
Output
|
||||
} 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 { isLocked } from '@alfresco/aca-shared';
|
||||
|
||||
@ -58,7 +58,7 @@ export class LockNodeDirective {
|
||||
}
|
||||
|
||||
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)) {
|
||||
try {
|
||||
@ -82,7 +82,7 @@ export class LockNodeDirective {
|
||||
}
|
||||
|
||||
private lockNode(nodeId: string) {
|
||||
return this.alfrescoApiService.nodesApi.lockNode(nodeId, <NodeBodyLock>{
|
||||
return this.alfrescoApiService.nodesApi.lockNode(nodeId, {
|
||||
type: 'ALLOW_OWNER_CHANGES',
|
||||
lifetime: 'PERSISTENT'
|
||||
});
|
||||
|
@ -647,7 +647,7 @@ describe('AppExtensionService', () => {
|
||||
|
||||
it('should reduce empty menus', () => {
|
||||
const actions = [
|
||||
<any>{ id: '1', type: ContentActionType.button },
|
||||
{ id: '1', type: ContentActionType.button },
|
||||
{
|
||||
id: '2',
|
||||
type: ContentActionType.menu
|
||||
@ -784,7 +784,7 @@ describe('AppExtensionService', () => {
|
||||
}
|
||||
});
|
||||
|
||||
expect(service.getSharedLinkViewerToolbarActions()).toEqual(<any>actions);
|
||||
expect(service.getSharedLinkViewerToolbarActions()).toEqual(actions);
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -220,14 +220,14 @@ export class AppExtensionService implements RuleContext {
|
||||
);
|
||||
|
||||
if (config.features && config.features.viewer) {
|
||||
this.viewerRules = <ViewerRules>(config.features.viewer['rules'] || {});
|
||||
this.viewerRules = (config.features.viewer['rules'] as ViewerRules) || {};
|
||||
}
|
||||
|
||||
this.registerIcons(config);
|
||||
|
||||
const references = (config.$references || [])
|
||||
.filter(entry => typeof entry === 'object')
|
||||
.map(entry => <ExtensionRef>entry);
|
||||
.map(entry => entry as ExtensionRef);
|
||||
this._references.next(references);
|
||||
}
|
||||
|
||||
@ -383,7 +383,7 @@ export class AppExtensionService implements RuleContext {
|
||||
}
|
||||
|
||||
getSidebarTabs(): Array<SidebarTabRef> {
|
||||
return this.sidebar.filter(action => this.filterVisible(<any>action));
|
||||
return this.sidebar.filter(action => this.filterVisible(action));
|
||||
}
|
||||
|
||||
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) {
|
||||
return this.extensions.evaluateRule(action.rules.visible, this);
|
||||
}
|
||||
|
@ -40,7 +40,9 @@ import {
|
||||
CopyNodesAction,
|
||||
ShareNodeAction,
|
||||
SetSelectedNodesAction,
|
||||
UnlockWriteAction
|
||||
UnlockWriteAction,
|
||||
SnackbarActionTypes,
|
||||
RouterActionTypes
|
||||
} from '@alfresco/aca-shared/store';
|
||||
import { map } from 'rxjs/operators';
|
||||
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 { MatDialog } from '@angular/material/dialog';
|
||||
import { MatSnackBar } from '@angular/material/snack-bar';
|
||||
import {
|
||||
SnackbarActionTypes,
|
||||
RouterActionTypes
|
||||
} from '../../../projects/aca-shared/store/src/public_api';
|
||||
|
||||
describe('ContentManagementService', () => {
|
||||
let dialog: MatDialog;
|
||||
@ -95,13 +93,13 @@ describe('ContentManagementService', () => {
|
||||
of('OPERATION.SUCCES.CONTENT.COPY')
|
||||
);
|
||||
|
||||
const selection = [
|
||||
<any>{ entry: { id: 'node-to-copy-id', name: 'name' } }
|
||||
const selection: any[] = [
|
||||
{ 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));
|
||||
nodeActions.contentCopied.next(<any>createdItems);
|
||||
nodeActions.contentCopied.next(createdItems);
|
||||
|
||||
expect(nodeActions.copyNodes).toHaveBeenCalled();
|
||||
expect(snackBar.open['calls'].argsFor(0)[0]).toBe(
|
||||
@ -114,13 +112,13 @@ describe('ContentManagementService', () => {
|
||||
of('OPERATION.SUCCES.CONTENT.COPY')
|
||||
);
|
||||
|
||||
const selection = [
|
||||
<any>{ entry: { id: 'node-to-copy-1', name: 'name1' } },
|
||||
<any>{ entry: { id: 'node-to-copy-2', name: 'name2' } }
|
||||
const selection: any[] = [
|
||||
{ entry: { id: 'node-to-copy-1', name: 'name1' } },
|
||||
{ entry: { id: 'node-to-copy-2', name: 'name2' } }
|
||||
];
|
||||
const createdItems = [
|
||||
<any>{ entry: { id: 'copy-of-node-1', name: 'name1' } },
|
||||
<any>{ entry: { id: 'copy-of-node-2', name: 'name2' } }
|
||||
const createdItems: any[] = [
|
||||
{ entry: { id: 'copy-of-node-1', name: 'name1' } },
|
||||
{ entry: { id: 'copy-of-node-2', name: 'name2' } }
|
||||
];
|
||||
|
||||
store.dispatch(new CopyNodesAction(selection));
|
||||
@ -137,12 +135,12 @@ describe('ContentManagementService', () => {
|
||||
of('OPERATION.SUCCES.CONTENT.COPY')
|
||||
);
|
||||
|
||||
const selection = [
|
||||
<any>{ entry: { id: 'node-to-copy-1', name: 'name1' } },
|
||||
<any>{ entry: { id: 'node-to-copy-2', name: 'name2' } }
|
||||
const selection: any[] = [
|
||||
{ entry: { id: 'node-to-copy-1', name: 'name1' } },
|
||||
{ entry: { id: 'node-to-copy-2', name: 'name2' } }
|
||||
];
|
||||
const createdItems = [
|
||||
<any>{ entry: { id: 'copy-of-node-1', name: 'name1' } }
|
||||
const createdItems: any[] = [
|
||||
{ entry: { id: 'copy-of-node-1', name: 'name1' } }
|
||||
];
|
||||
|
||||
store.dispatch(new CopyNodesAction(selection));
|
||||
@ -159,14 +157,14 @@ describe('ContentManagementService', () => {
|
||||
of('OPERATION.SUCCES.CONTENT.COPY')
|
||||
);
|
||||
|
||||
const selection = [
|
||||
<any>{ entry: { id: 'node-to-copy-0', name: 'name0' } },
|
||||
<any>{ entry: { id: 'node-to-copy-1', name: 'name1' } },
|
||||
<any>{ entry: { id: 'node-to-copy-2', name: 'name2' } }
|
||||
const selection: any[] = [
|
||||
{ entry: { id: 'node-to-copy-0', name: 'name0' } },
|
||||
{ entry: { id: 'node-to-copy-1', name: 'name1' } },
|
||||
{ entry: { id: 'node-to-copy-2', name: 'name2' } }
|
||||
];
|
||||
const createdItems = [
|
||||
<any>{ entry: { id: 'copy-of-node-0', name: 'name0' } },
|
||||
<any>{ entry: { id: 'copy-of-node-1', name: 'name1' } }
|
||||
const createdItems: any[] = [
|
||||
{ entry: { id: 'copy-of-node-0', name: 'name0' } },
|
||||
{ entry: { id: 'copy-of-node-1', name: 'name1' } }
|
||||
];
|
||||
|
||||
store.dispatch(new CopyNodesAction(selection));
|
||||
@ -183,15 +181,15 @@ describe('ContentManagementService', () => {
|
||||
of('OPERATION.SUCCES.CONTENT.COPY')
|
||||
);
|
||||
|
||||
const selection = [
|
||||
<any>{ entry: { id: 'node-to-copy-0', name: 'name0' } },
|
||||
<any>{ entry: { id: 'node-to-copy-1', name: 'name1' } },
|
||||
<any>{ entry: { id: 'node-to-copy-2', name: 'name2' } }
|
||||
const selection: any[] = [
|
||||
{ entry: { id: 'node-to-copy-0', name: 'name0' } },
|
||||
{ entry: { id: 'node-to-copy-1', name: 'name1' } },
|
||||
{ entry: { id: 'node-to-copy-2', name: 'name2' } }
|
||||
];
|
||||
const createdItems = [];
|
||||
const createdItems: any[] = [];
|
||||
|
||||
store.dispatch(new CopyNodesAction(selection));
|
||||
nodeActions.contentCopied.next(<any>createdItems);
|
||||
nodeActions.contentCopied.next(createdItems);
|
||||
|
||||
expect(nodeActions.copyNodes).toHaveBeenCalled();
|
||||
expect(snackBar.open['calls'].argsFor(0)[0]).toBe(
|
||||
@ -204,11 +202,13 @@ describe('ContentManagementService', () => {
|
||||
of('OPERATION.SUCCES.CONTENT.COPY')
|
||||
);
|
||||
|
||||
const selection = [<any>{ entry: { id: 'node-to-copy', name: 'name' } }];
|
||||
const createdItems = [];
|
||||
const selection: any[] = [
|
||||
{ entry: { id: 'node-to-copy', name: 'name' } }
|
||||
];
|
||||
const createdItems: any[] = [];
|
||||
|
||||
store.dispatch(new CopyNodesAction(selection));
|
||||
nodeActions.contentCopied.next(<any>createdItems);
|
||||
nodeActions.contentCopied.next(createdItems);
|
||||
|
||||
expect(nodeActions.copyNodes).toHaveBeenCalled();
|
||||
expect(snackBar.open['calls'].argsFor(0)[0]).toBe(
|
||||
@ -219,8 +219,8 @@ describe('ContentManagementService', () => {
|
||||
it('notifies error if success message was not emitted', () => {
|
||||
spyOn(nodeActions, 'copyNodes').and.returnValue(of(''));
|
||||
|
||||
const selection = [
|
||||
<any>{ entry: { id: 'node-to-copy-id', name: 'name' } }
|
||||
const selection: any[] = [
|
||||
{ entry: { id: 'node-to-copy-id', name: 'name' } }
|
||||
];
|
||||
|
||||
store.dispatch(new CopyNodesAction(selection));
|
||||
@ -237,7 +237,7 @@ describe('ContentManagementService', () => {
|
||||
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));
|
||||
|
||||
expect(nodeActions.copyNodes).toHaveBeenCalled();
|
||||
@ -251,7 +251,7 @@ describe('ContentManagementService', () => {
|
||||
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));
|
||||
|
||||
@ -276,13 +276,13 @@ describe('ContentManagementService', () => {
|
||||
it('should delete the newly created node on Undo action', () => {
|
||||
spyOn(contentApi, 'deleteNode').and.returnValue(of(null));
|
||||
|
||||
const selection = [
|
||||
<any>{ entry: { id: 'node-to-copy-id', name: 'name' } }
|
||||
const selection: any[] = [
|
||||
{ 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));
|
||||
nodeActions.contentCopied.next(<any>createdItems);
|
||||
nodeActions.contentCopied.next(createdItems);
|
||||
|
||||
expect(nodeActions.copyNodes).toHaveBeenCalled();
|
||||
expect(snackBar.open['calls'].argsFor(0)[0]).toBe(
|
||||
@ -300,9 +300,9 @@ describe('ContentManagementService', () => {
|
||||
of(null)
|
||||
);
|
||||
|
||||
const selection = [
|
||||
<any>{ entry: { id: 'node-to-copy-1', name: 'name1' } },
|
||||
<any>{
|
||||
const selection: any[] = [
|
||||
{ entry: { id: 'node-to-copy-1', name: 'name1' } },
|
||||
{
|
||||
entry: {
|
||||
id: 'node-to-copy-2',
|
||||
name: 'folder-with-name-already-existing-on-destination'
|
||||
@ -311,7 +311,7 @@ describe('ContentManagementService', () => {
|
||||
];
|
||||
const id1 = 'copy-of-node-1';
|
||||
const id2 = 'copy-of-child-of-node-2';
|
||||
const createdItems = [
|
||||
const createdItems: any[] = [
|
||||
{ entry: { id: id1, name: 'name1' } },
|
||||
[
|
||||
{
|
||||
@ -325,7 +325,7 @@ describe('ContentManagementService', () => {
|
||||
];
|
||||
|
||||
store.dispatch(new CopyNodesAction(selection));
|
||||
nodeActions.contentCopied.next(<any>createdItems);
|
||||
nodeActions.contentCopied.next(createdItems);
|
||||
|
||||
expect(nodeActions.copyNodes).toHaveBeenCalled();
|
||||
expect(snackBar.open['calls'].argsFor(0)[0]).toBe(
|
||||
@ -342,10 +342,10 @@ describe('ContentManagementService', () => {
|
||||
it('notifies when error occurs on Undo action', () => {
|
||||
spyOn(contentApi, 'deleteNode').and.returnValue(throwError(null));
|
||||
|
||||
const selection = [
|
||||
<any>{ entry: { id: 'node-to-copy-id', name: 'name' } }
|
||||
const selection: any[] = [
|
||||
{ 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));
|
||||
nodeActions.contentCopied.next(createdItems);
|
||||
@ -362,10 +362,10 @@ describe('ContentManagementService', () => {
|
||||
throwError(new Error('oops!'))
|
||||
);
|
||||
|
||||
const selection = [
|
||||
<any>{ entry: { id: 'node-to-copy-id', name: 'name' } }
|
||||
const selection: any[] = [
|
||||
{ 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));
|
||||
nodeActions.contentCopied.next(createdItems);
|
||||
@ -382,10 +382,10 @@ describe('ContentManagementService', () => {
|
||||
throwError(new Error(JSON.stringify({ error: { statusCode: 403 } })))
|
||||
);
|
||||
|
||||
const selection = [
|
||||
<any>{ entry: { id: 'node-to-copy-id', name: 'name' } }
|
||||
const selection: any[] = [
|
||||
{ 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));
|
||||
nodeActions.contentCopied.next(createdItems);
|
||||
@ -469,7 +469,7 @@ describe('ContentManagementService', () => {
|
||||
});
|
||||
|
||||
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 = {
|
||||
succeeded: [],
|
||||
failed: [],
|
||||
@ -493,9 +493,9 @@ describe('ContentManagementService', () => {
|
||||
});
|
||||
|
||||
it('notifies partial move of multiple nodes', () => {
|
||||
const nodes = [
|
||||
<any>{ entry: { id: '1', name: 'name' } },
|
||||
<any>{ entry: { id: '2', name: 'name2' } }
|
||||
const nodes: any[] = [
|
||||
{ entry: { id: '1', name: 'name' } },
|
||||
{ entry: { id: '2', name: 'name2' } }
|
||||
];
|
||||
const moveResponse = {
|
||||
succeeded: [],
|
||||
@ -520,9 +520,9 @@ describe('ContentManagementService', () => {
|
||||
});
|
||||
|
||||
it('notifies successful move and the number of nodes that could not be moved', () => {
|
||||
const nodes = [
|
||||
<any>{ entry: { id: '1', name: 'name' } },
|
||||
<any>{ entry: { id: '2', name: 'name2' } }
|
||||
const nodes: any[] = [
|
||||
{ entry: { id: '1', name: 'name' } },
|
||||
{ entry: { id: '2', name: 'name2' } }
|
||||
];
|
||||
const moveResponse = {
|
||||
succeeded: [nodes[0]],
|
||||
@ -546,9 +546,9 @@ describe('ContentManagementService', () => {
|
||||
});
|
||||
|
||||
it('notifies successful move and the number of partially moved ones', () => {
|
||||
const nodes = [
|
||||
<any>{ entry: { id: '1', name: 'name' } },
|
||||
<any>{ entry: { id: '2', name: 'name2' } }
|
||||
const nodes: any[] = [
|
||||
{ entry: { id: '1', name: 'name' } },
|
||||
{ entry: { id: '2', name: 'name2' } }
|
||||
];
|
||||
const moveResponse = {
|
||||
succeeded: [nodes[0]],
|
||||
@ -571,7 +571,7 @@ describe('ContentManagementService', () => {
|
||||
});
|
||||
|
||||
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 = {
|
||||
succeeded: [],
|
||||
failed: [],
|
||||
@ -594,7 +594,7 @@ describe('ContentManagementService', () => {
|
||||
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));
|
||||
|
||||
expect(nodeActions.moveNodes).toHaveBeenCalled();
|
||||
@ -608,7 +608,7 @@ describe('ContentManagementService', () => {
|
||||
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));
|
||||
|
||||
expect(nodeActions.moveNodes).toHaveBeenCalled();
|
||||
@ -622,7 +622,7 @@ describe('ContentManagementService', () => {
|
||||
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));
|
||||
|
||||
expect(nodeActions.moveNodes).toHaveBeenCalled();
|
||||
@ -632,7 +632,7 @@ describe('ContentManagementService', () => {
|
||||
});
|
||||
|
||||
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 = {
|
||||
succeeded: [],
|
||||
failed: [{}],
|
||||
@ -684,7 +684,7 @@ describe('ContentManagementService', () => {
|
||||
const node = {
|
||||
entry: { id: 'node-to-move-id', name: 'name', parentId: initialParent }
|
||||
};
|
||||
const selection = [<any>node];
|
||||
const selection: any[] = [node];
|
||||
|
||||
spyOn(nodeActions, 'moveNodeAction').and.returnValue(of({}));
|
||||
|
||||
@ -694,7 +694,7 @@ describe('ContentManagementService', () => {
|
||||
partiallySucceeded: [],
|
||||
succeeded: [{ itemMoved: node, initialParentId: initialParent }]
|
||||
};
|
||||
nodeActions.contentMoved.next(<any>movedItems);
|
||||
nodeActions.contentMoved.next(movedItems);
|
||||
|
||||
expect(nodeActions.moveNodeAction).toHaveBeenCalledWith(
|
||||
movedItems.succeeded[0].itemMoved.entry,
|
||||
@ -715,7 +715,7 @@ describe('ContentManagementService', () => {
|
||||
parentId: initialParent
|
||||
}
|
||||
};
|
||||
const selection = [<any>node];
|
||||
const selection: any[] = [node];
|
||||
|
||||
spyOn(nodeActions, 'moveNodeAction').and.returnValue(of({}));
|
||||
|
||||
@ -726,7 +726,7 @@ describe('ContentManagementService', () => {
|
||||
};
|
||||
|
||||
store.dispatch(new MoveNodesAction(selection));
|
||||
nodeActions.contentMoved.next(<any>movedItems);
|
||||
nodeActions.contentMoved.next(movedItems);
|
||||
|
||||
expect(nodeActions.moveNodeAction).toHaveBeenCalledWith(
|
||||
node.entry,
|
||||
@ -750,7 +750,7 @@ describe('ContentManagementService', () => {
|
||||
isFolder: true
|
||||
}
|
||||
};
|
||||
const selection = [<any>node];
|
||||
const selection: any[] = [node];
|
||||
|
||||
const itemMoved = {}; // folder was empty
|
||||
nodeActions.moveDeletedEntries = [node]; // folder got deleted
|
||||
@ -762,7 +762,7 @@ describe('ContentManagementService', () => {
|
||||
};
|
||||
|
||||
store.dispatch(new MoveNodesAction(selection));
|
||||
nodeActions.contentMoved.next(<any>movedItems);
|
||||
nodeActions.contentMoved.next(movedItems);
|
||||
|
||||
expect(contentApi.restoreNode).toHaveBeenCalled();
|
||||
expect(snackBar.open['calls'].argsFor(0)[0]).toBe(
|
||||
@ -775,7 +775,7 @@ describe('ContentManagementService', () => {
|
||||
|
||||
actions$.pipe(
|
||||
ofType<SnackbarErrorAction>(SnackbarActionTypes.Error),
|
||||
map(action => done())
|
||||
map(() => done())
|
||||
);
|
||||
|
||||
const initialParent = 'parent-id-0';
|
||||
@ -786,7 +786,7 @@ describe('ContentManagementService', () => {
|
||||
parentId: initialParent
|
||||
}
|
||||
};
|
||||
const selection = [<any>node];
|
||||
const selection: any[] = [node];
|
||||
|
||||
const afterMoveParentId = 'parent-id-1';
|
||||
const childMoved = {
|
||||
@ -805,7 +805,7 @@ describe('ContentManagementService', () => {
|
||||
};
|
||||
|
||||
store.dispatch(new MoveNodesAction(selection));
|
||||
nodeActions.contentMoved.next(<any>movedItems);
|
||||
nodeActions.contentMoved.next(movedItems);
|
||||
|
||||
expect(contentApi.restoreNode).toHaveBeenCalled();
|
||||
}));
|
||||
@ -817,7 +817,7 @@ describe('ContentManagementService', () => {
|
||||
|
||||
actions$.pipe(
|
||||
ofType<SnackbarErrorAction>(SnackbarActionTypes.Error),
|
||||
map(action => done())
|
||||
map(() => done())
|
||||
);
|
||||
|
||||
const initialParent = 'parent-id-0';
|
||||
@ -838,7 +838,7 @@ describe('ContentManagementService', () => {
|
||||
};
|
||||
|
||||
store.dispatch(new MoveNodesAction(selection));
|
||||
nodeActions.contentMoved.next(<any>movedItems);
|
||||
nodeActions.contentMoved.next(movedItems);
|
||||
|
||||
expect(contentApi.restoreNode).toHaveBeenCalled();
|
||||
}));
|
||||
@ -850,14 +850,14 @@ describe('ContentManagementService', () => {
|
||||
|
||||
actions$.pipe(
|
||||
ofType<SnackbarErrorAction>(SnackbarActionTypes.Error),
|
||||
map(action => done())
|
||||
map(() => done())
|
||||
);
|
||||
|
||||
const initialParent = 'parent-id-0';
|
||||
const node = {
|
||||
entry: { id: 'node-to-move-id', name: 'name', parentId: initialParent }
|
||||
};
|
||||
const selection = [<any>node];
|
||||
const selection: any[] = [node];
|
||||
|
||||
const childMoved = {
|
||||
entry: { id: 'child-of-node-to-move-id', name: 'child-name' }
|
||||
@ -871,7 +871,7 @@ describe('ContentManagementService', () => {
|
||||
};
|
||||
|
||||
store.dispatch(new MoveNodesAction(selection));
|
||||
nodeActions.contentMoved.next(<any>movedItems);
|
||||
nodeActions.contentMoved.next(movedItems);
|
||||
|
||||
expect(nodeActions.moveNodes).toHaveBeenCalled();
|
||||
expect(contentApi.restoreNode).toHaveBeenCalled();
|
||||
@ -884,12 +884,10 @@ describe('ContentManagementService', () => {
|
||||
|
||||
actions$.pipe(
|
||||
ofType<SnackbarInfoAction>(SnackbarActionTypes.Info),
|
||||
map(action => {
|
||||
done();
|
||||
})
|
||||
map(() => done())
|
||||
);
|
||||
|
||||
const selection = [<any>{ entry: { id: '1', name: 'name1' } }];
|
||||
const selection: any[] = [{ entry: { id: '1', name: 'name1' } }];
|
||||
|
||||
store.dispatch(new DeleteNodesAction(selection));
|
||||
}));
|
||||
@ -899,12 +897,12 @@ describe('ContentManagementService', () => {
|
||||
|
||||
actions$.pipe(
|
||||
ofType<SnackbarErrorAction>(SnackbarActionTypes.Error),
|
||||
map(action => {
|
||||
map(() => {
|
||||
done();
|
||||
})
|
||||
);
|
||||
|
||||
const selection = [<any>{ entry: { id: '1', name: 'name1' } }];
|
||||
const selection: any[] = [{ entry: { id: '1', name: 'name1' } }];
|
||||
|
||||
store.dispatch(new DeleteNodesAction(selection));
|
||||
}));
|
||||
@ -914,14 +912,12 @@ describe('ContentManagementService', () => {
|
||||
|
||||
actions$.pipe(
|
||||
ofType<SnackbarInfoAction>(SnackbarActionTypes.Info),
|
||||
map(action => {
|
||||
done();
|
||||
})
|
||||
map(() => done())
|
||||
);
|
||||
|
||||
const selection = [
|
||||
<any>{ entry: { id: '1', name: 'name1' } },
|
||||
<any>{ entry: { id: '2', name: 'name2' } }
|
||||
const selection: any[] = [
|
||||
{ entry: { id: '1', name: 'name1' } },
|
||||
{ entry: { id: '2', name: 'name2' } }
|
||||
];
|
||||
|
||||
store.dispatch(new DeleteNodesAction(selection));
|
||||
@ -932,14 +928,12 @@ describe('ContentManagementService', () => {
|
||||
|
||||
actions$.pipe(
|
||||
ofType<SnackbarErrorAction>(SnackbarActionTypes.Error),
|
||||
map(action => {
|
||||
done();
|
||||
})
|
||||
map(() => done())
|
||||
);
|
||||
|
||||
const selection = [
|
||||
<any>{ entry: { id: '1', name: 'name1' } },
|
||||
<any>{ entry: { id: '2', name: 'name2' } }
|
||||
const selection: any[] = [
|
||||
{ entry: { id: '1', name: 'name1' } },
|
||||
{ entry: { id: '2', name: 'name2' } }
|
||||
];
|
||||
|
||||
store.dispatch(new DeleteNodesAction(selection));
|
||||
@ -956,14 +950,12 @@ describe('ContentManagementService', () => {
|
||||
|
||||
actions$.pipe(
|
||||
ofType<SnackbarWarningAction>(SnackbarActionTypes.Warning),
|
||||
map(action => {
|
||||
done();
|
||||
})
|
||||
map(() => done())
|
||||
);
|
||||
|
||||
const selection = [
|
||||
<any>{ entry: { id: '1', name: 'name1' } },
|
||||
<any>{ entry: { id: '2', name: 'name2' } }
|
||||
const selection: any[] = [
|
||||
{ entry: { id: '1', name: 'name1' } },
|
||||
{ entry: { id: '2', name: 'name2' } }
|
||||
];
|
||||
|
||||
store.dispatch(new DeleteNodesAction(selection));
|
||||
@ -988,15 +980,13 @@ describe('ContentManagementService', () => {
|
||||
|
||||
actions$.pipe(
|
||||
ofType<SnackbarWarningAction>(SnackbarActionTypes.Warning),
|
||||
map(action => {
|
||||
done();
|
||||
})
|
||||
map(() => done())
|
||||
);
|
||||
|
||||
const selection = [
|
||||
<any>{ entry: { id: '1', name: 'name1' } },
|
||||
<any>{ entry: { id: '2', name: 'name2' } },
|
||||
<any>{ entry: { id: '3', name: 'name3' } }
|
||||
const selection: any[] = [
|
||||
{ entry: { id: '1', name: 'name1' } },
|
||||
{ entry: { id: '2', name: 'name2' } },
|
||||
{ entry: { id: '3', name: 'name3' } }
|
||||
];
|
||||
|
||||
store.dispatch(new DeleteNodesAction(selection));
|
||||
@ -1022,7 +1012,7 @@ describe('ContentManagementService', () => {
|
||||
it('call purge nodes if selection is not empty', fakeAsync(() => {
|
||||
spyOn(contentApi, 'purgeDeletedNode').and.returnValue(of({}));
|
||||
|
||||
const selection = [<any>{ entry: { id: '1' } }];
|
||||
const selection: any[] = [{ entry: { id: '1' } }];
|
||||
store.dispatch(new PurgeDeletedNodesAction(selection));
|
||||
|
||||
expect(contentApi.purgeDeletedNode).toHaveBeenCalled();
|
||||
@ -1032,9 +1022,7 @@ describe('ContentManagementService', () => {
|
||||
it('raises warning on multiple fail and one success', fakeAsync(done => {
|
||||
actions$.pipe(
|
||||
ofType<SnackbarWarningAction>(SnackbarActionTypes.Warning),
|
||||
map((action: SnackbarWarningAction) => {
|
||||
done();
|
||||
})
|
||||
map(() => done())
|
||||
);
|
||||
|
||||
spyOn(contentApi, 'purgeDeletedNode').and.callFake(id => {
|
||||
@ -1053,10 +1041,10 @@ describe('ContentManagementService', () => {
|
||||
return of(null);
|
||||
});
|
||||
|
||||
const selection = [
|
||||
<any>{ entry: { id: '1', name: 'name1' } },
|
||||
<any>{ entry: { id: '2', name: 'name2' } },
|
||||
<any>{ entry: { id: '3', name: 'name3' } }
|
||||
const selection: any[] = [
|
||||
{ entry: { id: '1', name: 'name1' } },
|
||||
{ entry: { id: '2', name: 'name2' } },
|
||||
{ entry: { id: '3', name: 'name3' } }
|
||||
];
|
||||
|
||||
store.dispatch(new PurgeDeletedNodesAction(selection));
|
||||
@ -1065,9 +1053,7 @@ describe('ContentManagementService', () => {
|
||||
it('raises warning on multiple success and multiple fail', fakeAsync(done => {
|
||||
actions$.pipe(
|
||||
ofType<SnackbarWarningAction>(SnackbarActionTypes.Warning),
|
||||
map((action: SnackbarWarningAction) => {
|
||||
done();
|
||||
})
|
||||
map(() => done())
|
||||
);
|
||||
|
||||
spyOn(contentApi, 'purgeDeletedNode').and.callFake(id => {
|
||||
@ -1090,11 +1076,11 @@ describe('ContentManagementService', () => {
|
||||
return of(null);
|
||||
});
|
||||
|
||||
const selection = [
|
||||
<any>{ entry: { id: '1', name: 'name1' } },
|
||||
<any>{ entry: { id: '2', name: 'name2' } },
|
||||
<any>{ entry: { id: '3', name: 'name3' } },
|
||||
<any>{ entry: { id: '4', name: 'name4' } }
|
||||
const selection: any[] = [
|
||||
{ entry: { id: '1', name: 'name1' } },
|
||||
{ entry: { id: '2', name: 'name2' } },
|
||||
{ entry: { id: '3', name: 'name3' } },
|
||||
{ entry: { id: '4', name: 'name4' } }
|
||||
];
|
||||
|
||||
store.dispatch(new PurgeDeletedNodesAction(selection));
|
||||
@ -1103,14 +1089,12 @@ describe('ContentManagementService', () => {
|
||||
it('raises info on one selected node success', fakeAsync(done => {
|
||||
actions$.pipe(
|
||||
ofType<SnackbarInfoAction>(SnackbarActionTypes.Info),
|
||||
map((action: SnackbarInfoAction) => {
|
||||
done();
|
||||
})
|
||||
map(() => done())
|
||||
);
|
||||
|
||||
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));
|
||||
}));
|
||||
@ -1118,14 +1102,12 @@ describe('ContentManagementService', () => {
|
||||
it('raises error on one selected node fail', fakeAsync(done => {
|
||||
actions$.pipe(
|
||||
ofType<SnackbarErrorAction>(SnackbarActionTypes.Error),
|
||||
map((action: SnackbarErrorAction) => {
|
||||
done();
|
||||
})
|
||||
map(() => done())
|
||||
);
|
||||
|
||||
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));
|
||||
}));
|
||||
@ -1133,9 +1115,7 @@ describe('ContentManagementService', () => {
|
||||
it('raises info on all nodes success', fakeAsync(done => {
|
||||
actions$.pipe(
|
||||
ofType<SnackbarInfoAction>(SnackbarActionTypes.Info),
|
||||
map((action: SnackbarInfoAction) => {
|
||||
done();
|
||||
})
|
||||
map(() => done())
|
||||
);
|
||||
spyOn(contentApi, 'purgeDeletedNode').and.callFake(id => {
|
||||
if (id === '1') {
|
||||
@ -1149,9 +1129,9 @@ describe('ContentManagementService', () => {
|
||||
return of(null);
|
||||
});
|
||||
|
||||
const selection = [
|
||||
<any>{ entry: { id: '1', name: 'name1' } },
|
||||
<any>{ entry: { id: '2', name: 'name2' } }
|
||||
const selection: any[] = [
|
||||
{ entry: { id: '1', name: 'name1' } },
|
||||
{ entry: { id: '2', name: 'name2' } }
|
||||
];
|
||||
|
||||
store.dispatch(new PurgeDeletedNodesAction(selection));
|
||||
@ -1160,9 +1140,7 @@ describe('ContentManagementService', () => {
|
||||
it('raises error on all nodes fail', fakeAsync(done => {
|
||||
actions$.pipe(
|
||||
ofType<SnackbarErrorAction>(SnackbarActionTypes.Error),
|
||||
map((action: SnackbarErrorAction) => {
|
||||
done();
|
||||
})
|
||||
map(() => done())
|
||||
);
|
||||
spyOn(contentApi, 'purgeDeletedNode').and.callFake(id => {
|
||||
if (id === '1') {
|
||||
@ -1176,9 +1154,9 @@ describe('ContentManagementService', () => {
|
||||
return of({});
|
||||
});
|
||||
|
||||
const selection = [
|
||||
<any>{ entry: { id: '1', name: 'name1' } },
|
||||
<any>{ entry: { id: '2', name: 'name2' } }
|
||||
const selection: any[] = [
|
||||
{ entry: { id: '1', name: 'name1' } },
|
||||
{ entry: { id: '2', name: 'name2' } }
|
||||
];
|
||||
|
||||
store.dispatch(new PurgeDeletedNodesAction(selection));
|
||||
@ -1190,7 +1168,7 @@ describe('ContentManagementService', () => {
|
||||
it('does not restore nodes if no selection', () => {
|
||||
spyOn(contentApi, 'restoreNode');
|
||||
|
||||
const selection = [];
|
||||
const selection: any[] = [];
|
||||
store.dispatch(new RestoreDeletedNodesAction(selection));
|
||||
|
||||
expect(contentApi.restoreNode).not.toHaveBeenCalled();
|
||||
@ -1199,7 +1177,7 @@ describe('ContentManagementService', () => {
|
||||
it('does not restore nodes if selection has nodes without path', () => {
|
||||
spyOn(contentApi, 'restoreNode');
|
||||
|
||||
const selection = [<any>{ entry: { id: '1' } }];
|
||||
const selection: any[] = [{ entry: { id: '1' } }];
|
||||
|
||||
store.dispatch(new RestoreDeletedNodesAction(selection));
|
||||
|
||||
@ -1223,8 +1201,8 @@ describe('ContentManagementService', () => {
|
||||
]
|
||||
};
|
||||
|
||||
const selection = [
|
||||
<any>{
|
||||
const selection: any[] = [
|
||||
{
|
||||
entry: {
|
||||
id: '1',
|
||||
path
|
||||
@ -1259,8 +1237,8 @@ describe('ContentManagementService', () => {
|
||||
]
|
||||
};
|
||||
|
||||
const selection = [
|
||||
<any>{
|
||||
const selection: any[] = [
|
||||
{
|
||||
entry: {
|
||||
id: '1',
|
||||
path
|
||||
@ -1290,7 +1268,7 @@ describe('ContentManagementService', () => {
|
||||
|
||||
actions$.pipe(
|
||||
ofType<SnackbarErrorAction>(SnackbarActionTypes.Error),
|
||||
map(action => done())
|
||||
map(() => done())
|
||||
);
|
||||
|
||||
spyOn(contentApi, 'restoreNode').and.callFake(id => {
|
||||
@ -1318,10 +1296,10 @@ describe('ContentManagementService', () => {
|
||||
]
|
||||
};
|
||||
|
||||
const selection = [
|
||||
<any>{ entry: { id: '1', name: 'name1', path } },
|
||||
<any>{ entry: { id: '2', name: 'name2', path } },
|
||||
<any>{ entry: { id: '3', name: 'name3', path } }
|
||||
const selection: any[] = [
|
||||
{ entry: { id: '1', name: 'name1', path } },
|
||||
{ entry: { id: '2', name: 'name2', path } },
|
||||
{ entry: { id: '3', name: 'name3', path } }
|
||||
];
|
||||
|
||||
store.dispatch(new RestoreDeletedNodesAction(selection));
|
||||
@ -1333,7 +1311,7 @@ describe('ContentManagementService', () => {
|
||||
|
||||
actions$.pipe(
|
||||
ofType<SnackbarErrorAction>(SnackbarActionTypes.Error),
|
||||
map(action => done())
|
||||
map(() => done())
|
||||
);
|
||||
|
||||
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));
|
||||
}));
|
||||
@ -1357,7 +1335,7 @@ describe('ContentManagementService', () => {
|
||||
|
||||
actions$.pipe(
|
||||
ofType<SnackbarErrorAction>(SnackbarActionTypes.Error),
|
||||
map(action => done())
|
||||
map(() => done())
|
||||
);
|
||||
|
||||
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));
|
||||
}));
|
||||
@ -1381,7 +1359,7 @@ describe('ContentManagementService', () => {
|
||||
|
||||
actions$.pipe(
|
||||
ofType<SnackbarErrorAction>(SnackbarActionTypes.Error),
|
||||
map(action => done())
|
||||
map(() => done())
|
||||
);
|
||||
|
||||
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));
|
||||
}));
|
||||
@ -1413,7 +1391,7 @@ describe('ContentManagementService', () => {
|
||||
|
||||
actions$.pipe(
|
||||
ofType<SnackbarInfoAction>(SnackbarActionTypes.Info),
|
||||
map(action => done())
|
||||
map(() => done())
|
||||
);
|
||||
|
||||
const path = {
|
||||
@ -1425,9 +1403,9 @@ describe('ContentManagementService', () => {
|
||||
]
|
||||
};
|
||||
|
||||
const selection = [
|
||||
<any>{ entry: { id: '1', name: 'name1', path } },
|
||||
<any>{ entry: { id: '2', name: 'name2', path } }
|
||||
const selection: any[] = [
|
||||
{ entry: { id: '1', name: 'name1', path } },
|
||||
{ entry: { id: '2', name: 'name2', path } }
|
||||
];
|
||||
|
||||
store.dispatch(new RestoreDeletedNodesAction(selection));
|
||||
@ -1438,7 +1416,7 @@ describe('ContentManagementService', () => {
|
||||
|
||||
actions$.pipe(
|
||||
ofType<SnackbarInfoAction>(SnackbarActionTypes.Info),
|
||||
map(action => done())
|
||||
map(() => done())
|
||||
);
|
||||
|
||||
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));
|
||||
}));
|
||||
@ -1460,7 +1438,7 @@ describe('ContentManagementService', () => {
|
||||
|
||||
actions$.pipe(
|
||||
ofType<NavigateRouteAction>(RouterActionTypes.NavigateRoute),
|
||||
map(action => done())
|
||||
map(() => done())
|
||||
);
|
||||
|
||||
const path = {
|
||||
@ -1472,8 +1450,8 @@ describe('ContentManagementService', () => {
|
||||
]
|
||||
};
|
||||
|
||||
const selection = [
|
||||
<any>{
|
||||
const selection: any[] = [
|
||||
{
|
||||
entry: {
|
||||
id: '1',
|
||||
name: 'name1',
|
||||
@ -1489,7 +1467,7 @@ describe('ContentManagementService', () => {
|
||||
|
||||
describe('Share Node', () => {
|
||||
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(dialog, 'open').and.returnValue({
|
||||
afterClosed() {
|
||||
@ -1504,7 +1482,7 @@ describe('ContentManagementService', () => {
|
||||
}));
|
||||
|
||||
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(dialog, 'open').and.returnValue({
|
||||
afterClosed() {
|
||||
@ -1519,7 +1497,7 @@ describe('ContentManagementService', () => {
|
||||
}));
|
||||
|
||||
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(dialog, 'open').and.returnValue({
|
||||
afterClosed() {
|
||||
@ -1535,7 +1513,7 @@ describe('ContentManagementService', () => {
|
||||
}));
|
||||
|
||||
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(dialog, 'open').and.returnValue({
|
||||
afterClosed: () => of(node)
|
||||
@ -1562,9 +1540,9 @@ describe('ContentManagementService', () => {
|
||||
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(
|
||||
() => new Promise((resolve, reject) => reject('error'))
|
||||
() => new Promise((_resolve, reject) => reject('error'))
|
||||
);
|
||||
spyOn(store, 'dispatch').and.callThrough();
|
||||
store.dispatch(
|
||||
@ -1593,7 +1571,7 @@ describe('ContentManagementService', () => {
|
||||
});
|
||||
|
||||
it('should return dialog instance reference', () => {
|
||||
const mockDialogInstance = <any>{ afterClose: () => {} };
|
||||
const mockDialogInstance: any = { afterClose: () => {} };
|
||||
|
||||
spyOn(dialog, 'open').and.returnValue(mockDialogInstance);
|
||||
|
||||
@ -1605,11 +1583,11 @@ describe('ContentManagementService', () => {
|
||||
|
||||
describe('editFolder', () => {
|
||||
it('should open dialog with FolderDialogComponent instance', () => {
|
||||
const mockDialogInstance = <any>{
|
||||
const mockDialogInstance: any = {
|
||||
componentInstance: { error: 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);
|
||||
|
||||
contentManagementService.editFolder(node);
|
||||
@ -1620,11 +1598,11 @@ describe('ContentManagementService', () => {
|
||||
});
|
||||
|
||||
it('should raise error when edit operation fails', fakeAsync(() => {
|
||||
const mockDialogInstance = <any>{
|
||||
const mockDialogInstance: any = {
|
||||
componentInstance: { error: new Subject<any>() },
|
||||
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(store, 'dispatch').and.callThrough();
|
||||
|
||||
@ -1638,9 +1616,9 @@ describe('ContentManagementService', () => {
|
||||
}));
|
||||
|
||||
it('should call nodeUpdated event with edited node data', fakeAsync(() => {
|
||||
const node = <any>{ entry: { id: '1', name: 'name1' } };
|
||||
const newNode = <any>{ entry: { id: '1', name: 'name-edited' } };
|
||||
const mockDialogInstance = <any>{
|
||||
const node: any = { entry: { id: '1', name: 'name1' } };
|
||||
const newNode: any = { entry: { id: '1', name: 'name-edited' } };
|
||||
const mockDialogInstance: any = {
|
||||
componentInstance: { error: new Subject<any>() },
|
||||
afterClosed: () => of(newNode)
|
||||
};
|
||||
|
@ -128,7 +128,7 @@ export class ContentManagementService {
|
||||
|
||||
managePermissions(node: MinimalNodeEntity): void {
|
||||
if (node && node.entry) {
|
||||
const { nodeId, id } = <any>node.entry;
|
||||
const { nodeId, id } = node.entry as any;
|
||||
const siteId = node.entry['guid'];
|
||||
const targetId = siteId || nodeId || id;
|
||||
|
||||
@ -149,7 +149,7 @@ export class ContentManagementService {
|
||||
manageVersions(node: any) {
|
||||
if (node && node.entry) {
|
||||
// shared and favorite
|
||||
const id = node.entry.nodeId || (<any>node).entry.guid;
|
||||
const id = node.entry.nodeId || (node as any).entry.guid;
|
||||
|
||||
if (id) {
|
||||
this.contentApi.getNodeInfo(id).subscribe(entry => {
|
||||
@ -185,7 +185,7 @@ export class ContentManagementService {
|
||||
shareNode(node: any): void {
|
||||
if (node && node.entry) {
|
||||
// shared and favorite
|
||||
const id = node.entry.nodeId || (<any>node).entry.guid;
|
||||
const id = node.entry.nodeId || (node as any).entry.guid;
|
||||
|
||||
if (id) {
|
||||
this.contentApi.getNodeInfo(id).subscribe(entry => {
|
||||
@ -389,7 +389,7 @@ export class ContentManagementService {
|
||||
if (result === true) {
|
||||
const nodesToDelete: NodeInfo[] = nodes.map(node => {
|
||||
const { name } = node.entry;
|
||||
const id = (<any>node).entry.nodeId || node.entry.id;
|
||||
const id = (node as any).entry.nodeId || node.entry.id;
|
||||
|
||||
return {
|
||||
id,
|
||||
@ -1168,9 +1168,9 @@ export class ContentManagementService {
|
||||
return this.store.select(getAppSelection).pipe(
|
||||
take(1),
|
||||
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) {
|
||||
return of(<any>file.entry);
|
||||
return of(file.entry);
|
||||
} else {
|
||||
return this.contentApi.getNodeInfo(id);
|
||||
}
|
||||
|
@ -44,7 +44,7 @@ class TestNode {
|
||||
nodeType?: string,
|
||||
properties?: any
|
||||
) {
|
||||
this.entry = <any>{};
|
||||
this.entry = {} as any;
|
||||
this.entry.id = id || 'node-id';
|
||||
this.entry.isFile = isFile;
|
||||
this.entry.isFolder = !isFile;
|
||||
@ -86,7 +86,7 @@ describe('NodeActionsService', () => {
|
||||
isForbidden: boolean = false,
|
||||
nameExistingOnDestination?: string
|
||||
) => {
|
||||
return (entryId, options) => {
|
||||
return (_entryId, options) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
if (isForbidden) {
|
||||
reject(permissionError);
|
||||
@ -106,7 +106,7 @@ describe('NodeActionsService', () => {
|
||||
familyNodes: { parentNodeId: string; nodeChildren: any[] }[],
|
||||
isForbidden: boolean = false
|
||||
) => {
|
||||
return (parentId, options) => {
|
||||
return parentId => {
|
||||
return new Promise((resolve, reject) => {
|
||||
if (isForbidden) {
|
||||
reject(permissionError);
|
||||
@ -241,14 +241,14 @@ describe('NodeActionsService', () => {
|
||||
describe('getEntryParentId', () => {
|
||||
it('should return the parentId, if that exists on the node entry', () => {
|
||||
const parentID = 'parent-id';
|
||||
const entry = <any>{ nodeId: '1234', parentId: parentID };
|
||||
const entry: any = { nodeId: '1234', parentId: 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', () => {
|
||||
const firstParentId = 'parent-0-id';
|
||||
const entry = <any>{
|
||||
const entry: any = {
|
||||
nodeId: '1234',
|
||||
path: { elements: [{ id: 'parent-1-id' }, { id: firstParentId }] }
|
||||
};
|
||||
@ -270,7 +270,7 @@ describe('NodeActionsService', () => {
|
||||
|
||||
const dialog = TestBed.get(MatDialog);
|
||||
spyOn(dialog, 'open').and.callFake(
|
||||
(contentNodeSelectorComponent: any, data: any) => {
|
||||
(_contentNodeSelectorComponent: any, data: any) => {
|
||||
testContentNodeSelectorComponentData = data;
|
||||
return { componentInstance: {} };
|
||||
}
|
||||
@ -361,7 +361,7 @@ describe('NodeActionsService', () => {
|
||||
let testContentNodeSelectorComponentData;
|
||||
const dialog = TestBed.get(MatDialog);
|
||||
const spyOnDialog = spyOn(dialog, 'open').and.callFake(
|
||||
(contentNodeSelectorComponent: any, data: any) => {
|
||||
(_contentNodeSelectorComponent: any, data: any) => {
|
||||
testContentNodeSelectorComponentData = data;
|
||||
return { componentInstance: {} };
|
||||
}
|
||||
@ -415,7 +415,7 @@ describe('NodeActionsService', () => {
|
||||
let testContentNodeSelectorComponentData;
|
||||
const dialog = TestBed.get(MatDialog);
|
||||
spyOn(dialog, 'open').and.callFake(
|
||||
(contentNodeSelectorComponent: any, data: any) => {
|
||||
(_contentNodeSelectorComponent: any, data: any) => {
|
||||
testContentNodeSelectorComponentData = data;
|
||||
return { componentInstance: {} };
|
||||
}
|
||||
@ -445,7 +445,7 @@ describe('NodeActionsService', () => {
|
||||
let testContentNodeSelectorComponentData;
|
||||
const dialog = TestBed.get(MatDialog);
|
||||
spyOn(dialog, 'open').and.callFake(
|
||||
(contentNodeSelectorComponent: any, data: any) => {
|
||||
(_contentNodeSelectorComponent: any, data: any) => {
|
||||
testContentNodeSelectorComponentData = data;
|
||||
return { componentInstance: {} };
|
||||
}
|
||||
@ -1075,7 +1075,7 @@ describe('NodeActionsService', () => {
|
||||
spyOnDocumentListServiceAction = spyOn(
|
||||
documentListService,
|
||||
'moveNode'
|
||||
).and.callFake((contentEntryId, selectionId) => {
|
||||
).and.callFake(contentEntryId => {
|
||||
if (contentEntryId === parentFolderToMove.entry.id) {
|
||||
return throwError(conflictError);
|
||||
}
|
||||
|
@ -45,7 +45,6 @@ import {
|
||||
MinimalNodeEntity,
|
||||
MinimalNodeEntryEntity,
|
||||
SitePaging,
|
||||
Site,
|
||||
NodeChildAssociationPaging
|
||||
} from '@alfresco/js-api';
|
||||
import { ContentApiService } from '@alfresco/aca-shared';
|
||||
@ -231,7 +230,7 @@ export class NodeActionsService {
|
||||
list: {
|
||||
entries: [
|
||||
{
|
||||
entry: <Site>{
|
||||
entry: {
|
||||
guid: '-my-',
|
||||
title: this.translation.instant(
|
||||
'APP.BROWSE.PERSONAL.SIDENAV_LINK.LABEL'
|
||||
@ -239,7 +238,7 @@ export class NodeActionsService {
|
||||
}
|
||||
},
|
||||
{
|
||||
entry: <Site>{
|
||||
entry: {
|
||||
guid: '-mysites-',
|
||||
title: this.translation.instant(
|
||||
'APP.BROWSE.LIBRARIES.SIDENAV_LINK.LABEL'
|
||||
@ -267,7 +266,7 @@ export class NodeActionsService {
|
||||
excludeSiteContent: ContentNodeDialogService.nonDocumentSiteContent
|
||||
};
|
||||
|
||||
this.dialog.open(ContentNodeSelectorComponent, <any>{
|
||||
this.dialog.open(ContentNodeSelectorComponent, {
|
||||
data,
|
||||
panelClass: 'adf-content-node-selector-dialog',
|
||||
width: '630px'
|
||||
@ -344,10 +343,10 @@ export class NodeActionsService {
|
||||
}
|
||||
}
|
||||
} else if (node === null && this.isSitesDestinationAvailable) {
|
||||
node = <any>{
|
||||
node = {
|
||||
name: this.translation.instant('APP.BROWSE.LIBRARIES.TITLE'),
|
||||
path: { elements: [] }
|
||||
};
|
||||
} as any;
|
||||
}
|
||||
|
||||
return node;
|
||||
|
@ -24,11 +24,7 @@
|
||||
*/
|
||||
|
||||
import { Injectable } from '@angular/core';
|
||||
import {
|
||||
MatDialog,
|
||||
MatDialogConfig,
|
||||
MatDialogRef
|
||||
} from '@angular/material/dialog';
|
||||
import { MatDialog, MatDialogRef } from '@angular/material/dialog';
|
||||
import { CreateFromTemplateDialogComponent } from '../dialogs/node-template/create-from-template.dialog';
|
||||
import { Subject, from, of } from 'rxjs';
|
||||
import {
|
||||
@ -105,7 +101,7 @@ export class NodeTemplateService {
|
||||
data.currentFolderId = entry.id;
|
||||
|
||||
return this.dialog
|
||||
.open(ContentNodeSelectorComponent, <MatDialogConfig>{
|
||||
.open(ContentNodeSelectorComponent, {
|
||||
data,
|
||||
panelClass: [
|
||||
'adf-content-node-selector-dialog',
|
||||
|
@ -69,7 +69,7 @@ export class DownloadEffects {
|
||||
|
||||
private downloadNodes(toDownload: Array<MinimalNodeEntity>) {
|
||||
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 {
|
||||
id: this.isSharedLinkPreview ? id : nodeId || id,
|
||||
|
@ -107,7 +107,7 @@ describe('UploadEffects', () => {
|
||||
|
||||
it('should dispatch the unlock write action for a locked file', () => {
|
||||
const file: FileModel = new FileModel(
|
||||
<File>{ name: 'file1.png', size: 10 },
|
||||
{ name: 'file1.png', size: 10 } as File,
|
||||
null,
|
||||
'file1'
|
||||
);
|
||||
@ -137,7 +137,7 @@ describe('UploadEffects', () => {
|
||||
|
||||
it('should dispatch only one unlock action for a locked file', () => {
|
||||
const file: FileModel = new FileModel(
|
||||
<File>{ name: 'file1.png', size: 10 },
|
||||
{ name: 'file1.png', size: 10 } as File,
|
||||
null,
|
||||
'file1'
|
||||
);
|
||||
@ -171,7 +171,7 @@ describe('UploadEffects', () => {
|
||||
|
||||
it('should dispatch no actions if file is not locked', () => {
|
||||
const file: FileModel = new FileModel(
|
||||
<File>{ name: 'file1.png', size: 10 },
|
||||
{ name: 'file1.png', size: 10 } as File,
|
||||
null,
|
||||
'file1'
|
||||
);
|
||||
|
@ -135,17 +135,14 @@ export class UploadEffects {
|
||||
)
|
||||
.subscribe(([form, node]) => {
|
||||
if (form && node) {
|
||||
const file = this.fileVersionInput.files[0];
|
||||
const file: any = this.fileVersionInput.files[0];
|
||||
const fileModel = new FileModel(
|
||||
file,
|
||||
{
|
||||
comment: form.comment,
|
||||
majorVersion: form.version,
|
||||
parentId: node.parentId,
|
||||
path: ((<any>file).webkitRelativePath || '').replace(
|
||||
/\/[^\/]*$/,
|
||||
''
|
||||
),
|
||||
path: (file.webkitRelativePath || '').replace(/\/[^\/]*$/, ''),
|
||||
newVersion: true,
|
||||
nodeType: 'cm:content'
|
||||
},
|
||||
@ -164,14 +161,11 @@ export class UploadEffects {
|
||||
.pipe(take(1))
|
||||
.subscribe(node => {
|
||||
if (node && node.id) {
|
||||
const input = <HTMLInputElement>event.currentTarget;
|
||||
const files = FileUtils.toFileArray(input.files).map(file => {
|
||||
const input = event.currentTarget as HTMLInputElement;
|
||||
const files = FileUtils.toFileArray(input.files).map((file: any) => {
|
||||
return new FileModel(file, {
|
||||
parentId: node.id,
|
||||
path: ((<any>file).webkitRelativePath || '').replace(
|
||||
/\/[^\/]*$/,
|
||||
''
|
||||
),
|
||||
path: (file.webkitRelativePath || '').replace(/\/[^\/]*$/, ''),
|
||||
nodeType: 'cm:content'
|
||||
});
|
||||
});
|
||||
|
@ -113,7 +113,7 @@ export class ViewerEffects {
|
||||
ofType<ViewFileAction>(ViewerActionTypes.ViewFile),
|
||||
map(action => {
|
||||
if (action.payload && action.payload.entry) {
|
||||
const { id, nodeId, isFile } = <any>action.payload.entry;
|
||||
const { id, nodeId, isFile } = action.payload.entry as any;
|
||||
|
||||
if (
|
||||
this.extensions.canPreviewNode(action.payload) &&
|
||||
@ -127,7 +127,7 @@ export class ViewerEffects {
|
||||
.pipe(take(1))
|
||||
.subscribe(result => {
|
||||
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 (
|
||||
this.extensions.canPreviewNode(action.payload) &&
|
||||
@ -165,10 +165,8 @@ export class ViewerEffects {
|
||||
}
|
||||
|
||||
enterFullScreen() {
|
||||
const container = <any>(
|
||||
document.documentElement.querySelector(
|
||||
'.adf-viewer__fullscreen-container'
|
||||
)
|
||||
const container: any = document.documentElement.querySelector(
|
||||
'.adf-viewer__fullscreen-container'
|
||||
);
|
||||
if (container) {
|
||||
if (container.requestFullscreen) {
|
||||
|
@ -50,11 +50,11 @@ export const INITIAL_APP_STATE: AppState = {
|
||||
infoDrawerMetadataAspect: '',
|
||||
showFacetFilter: true,
|
||||
documentDisplayMode: 'list',
|
||||
repository: <any>{
|
||||
status: <any>{
|
||||
repository: {
|
||||
status: {
|
||||
isQuickShareEnabled: true
|
||||
}
|
||||
}
|
||||
} as any
|
||||
};
|
||||
|
||||
export const INITIAL_STATE: AppStore = {
|
||||
|
@ -50,7 +50,7 @@ export function appReducer(
|
||||
|
||||
switch (action.type) {
|
||||
case AppActionTypes.SetInitialState:
|
||||
newState = Object.assign({}, (<SetInitialStateAction>action).payload);
|
||||
newState = Object.assign({}, (action as SetInitialStateAction).payload);
|
||||
break;
|
||||
case AppActionTypes.SetSettingsParameter:
|
||||
newState = handleSettingsUpdate(
|
||||
@ -65,33 +65,37 @@ export function appReducer(
|
||||
};
|
||||
break;
|
||||
case NodeActionTypes.SetSelection:
|
||||
newState = updateSelectedNodes(state, <SetSelectedNodesAction>action);
|
||||
newState = updateSelectedNodes(state, action as SetSelectedNodesAction);
|
||||
break;
|
||||
case AppActionTypes.SetUserProfile:
|
||||
newState = updateUser(state, <SetUserProfileAction>action);
|
||||
newState = updateUser(state, action as SetUserProfileAction);
|
||||
break;
|
||||
case AppActionTypes.SetCurrentFolder:
|
||||
newState = updateCurrentFolder(state, <SetCurrentFolderAction>action);
|
||||
newState = updateCurrentFolder(state, action as SetCurrentFolderAction);
|
||||
break;
|
||||
case AppActionTypes.SetCurrentUrl:
|
||||
newState = updateCurrentUrl(state, <SetCurrentUrlAction>action);
|
||||
newState = updateCurrentUrl(state, action as SetCurrentUrlAction);
|
||||
break;
|
||||
case AppActionTypes.ToggleInfoDrawer:
|
||||
newState = toggleInfoDrawer(state);
|
||||
break;
|
||||
case AppActionTypes.SetInfoDrawerState:
|
||||
newState = setInfoDrawer(state, <SetInfoDrawerStateAction>action);
|
||||
newState = setInfoDrawer(state, action as SetInfoDrawerStateAction);
|
||||
break;
|
||||
case AppActionTypes.SetInfoDrawerMetadataAspect:
|
||||
newState = setInfoDrawerAspect(state, <SetInfoDrawerMetadataAspectAction>(
|
||||
action
|
||||
));
|
||||
newState = setInfoDrawerAspect(
|
||||
state,
|
||||
action as SetInfoDrawerMetadataAspectAction
|
||||
);
|
||||
break;
|
||||
case AppActionTypes.ToggleDocumentDisplayMode:
|
||||
newState = toggleDocumentDisplayMode(state);
|
||||
break;
|
||||
case AppActionTypes.SetRepositoryInfo:
|
||||
newState = updateRepositoryStatus(state, <SetRepositoryInfoAction>action);
|
||||
newState = updateRepositoryStatus(
|
||||
state,
|
||||
action as SetRepositoryInfoAction
|
||||
);
|
||||
break;
|
||||
case SearchActionTypes.ToggleFilter:
|
||||
newState = toggleSearchFilter(state);
|
||||
@ -138,11 +142,10 @@ function updateUser(state: AppState, action: SetUserProfileAction): AppState {
|
||||
const userName = `${firstName} ${lastName}`;
|
||||
const initials = [firstName[0], lastName[0]].join('');
|
||||
|
||||
const capabilities = (<any>user).capabilities;
|
||||
const capabilities = user.capabilities;
|
||||
const isAdmin = capabilities ? capabilities.isAdmin : true;
|
||||
|
||||
// todo: remove <any>
|
||||
newState.user = <any>{
|
||||
newState.user = {
|
||||
firstName,
|
||||
lastName,
|
||||
userName,
|
||||
|
@ -11,6 +11,7 @@
|
||||
"emitDecoratorMetadata": true,
|
||||
"experimentalDecorators": true,
|
||||
"noUnusedLocals": true,
|
||||
"noUnusedParameters": true,
|
||||
"noImplicitReturns": true,
|
||||
"target": "es5",
|
||||
"resolveJsonModule": true,
|
||||
@ -19,13 +20,13 @@
|
||||
"paths": {
|
||||
"@alfresco/aca-shared": ["projects/aca-shared/src/public-api.ts"],
|
||||
"@alfresco/aca-shared/store": [
|
||||
"projects/aca-shared/store/src/public_api.ts"
|
||||
"projects/aca-shared/store/src/public-api.ts"
|
||||
],
|
||||
"@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": [
|
||||
"projects/adf-office-services-ext/src/public_api.ts"
|
||||
"projects/adf-office-services-ext/src/public-api.ts"
|
||||
]
|
||||
}
|
||||
},
|
||||
|
31
tslint.json
31
tslint.json
@ -1,10 +1,16 @@
|
||||
{
|
||||
"rulesDirectory": [
|
||||
"node_modules/codelyzer",
|
||||
"node_modules/rxjs-tslint",
|
||||
"node_modules/adf-tslint-rules"
|
||||
],
|
||||
"extends": ["rxjs-tslint-rules"],
|
||||
"extends": [
|
||||
"tslint-plugin-prettier",
|
||||
"tslint-config-prettier",
|
||||
"rxjs-tslint-rules"
|
||||
],
|
||||
"rules": {
|
||||
"prettier": true,
|
||||
"adf-license-banner": [true, "**/*.ts", "./license-header.txt"],
|
||||
"ban": [
|
||||
true,
|
||||
@ -64,7 +70,9 @@
|
||||
"check-decl",
|
||||
"check-operator",
|
||||
"check-separator",
|
||||
"check-type"
|
||||
"check-type",
|
||||
"check-typecast",
|
||||
"check-module"
|
||||
],
|
||||
"directive-selector": [true, "attribute", "aca", "camelCase"],
|
||||
"component-selector": [
|
||||
@ -93,7 +101,18 @@
|
||||
"template-mouse-events-have-key-events": true,
|
||||
"template-no-autofocus": 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": {
|
||||
"severity": "error"
|
||||
},
|
||||
@ -137,6 +156,12 @@
|
||||
}
|
||||
],
|
||||
"severity": "error"
|
||||
}
|
||||
},
|
||||
|
||||
"no-return-await": true,
|
||||
"file-name-casing": [
|
||||
true,
|
||||
"kebab-case"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user