mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2025-05-12 17:04:46 +00:00
Various code fixes (#1704)
* fix typings and missing lib * fix i18n typo, add typings * code improvements * fix missing awaits * more fixes * fix bug in the evaluators, simplify code * more fixes
This commit is contained in:
parent
bf11489e0f
commit
9c7ac17161
@ -106,7 +106,7 @@ import { Router } from '@angular/router';
|
||||
|
||||
@Component({...})
|
||||
export class CustomComponent {
|
||||
constructor(private store: Store<AppStore>, private router: Router)
|
||||
constructor(private store: Store<AppStore>, private router: Router) {}
|
||||
|
||||
viewNode(nodeId: string) {
|
||||
this.store.dispatch(new ViewNodeAction(nodeId, { location: this.router.url }));
|
||||
|
@ -84,7 +84,7 @@ describe('Extensions - DocumentList presets', () => {
|
||||
const expectedColumns = testData.filter((item) => !item.disabled).map((data) => data.label);
|
||||
const actualColumns = await dataTable.getColumnHeadersText();
|
||||
|
||||
expect(actualColumns).toEqual(expectedColumns);
|
||||
await expect(actualColumns).toEqual(expectedColumns);
|
||||
});
|
||||
|
||||
it('[C286699] Disabled items are not shown', async () => {
|
||||
|
@ -88,14 +88,14 @@ describe('Favorites', () => {
|
||||
const expectedColumns = ['Name', 'Location', 'Size', 'Modified', 'Modified by'];
|
||||
const actualColumns = await dataTable.getColumnHeadersText();
|
||||
|
||||
expect(actualColumns).toEqual(expectedColumns);
|
||||
await expect(actualColumns).toEqual(expectedColumns);
|
||||
});
|
||||
|
||||
it('[C213226] displays the favorite files and folders', async () => {
|
||||
expect(await dataTable.getRowsCount()).toEqual(4, 'Incorrect number of items displayed');
|
||||
expect(await dataTable.isItemPresent(fileName1)).toBe(true, `${fileName1} not displayed`);
|
||||
expect(await dataTable.isItemPresent(fileName2)).toBe(true, `${fileName2} not displayed`);
|
||||
expect(await dataTable.isItemPresent(favFolderName)).toBe(true, `${favFolderName} not displayed`);
|
||||
await expect(await dataTable.getRowsCount()).toEqual(4, 'Incorrect number of items displayed');
|
||||
await expect(await dataTable.isItemPresent(fileName1)).toBe(true, `${fileName1} not displayed`);
|
||||
await expect(await dataTable.isItemPresent(fileName2)).toBe(true, `${fileName2} not displayed`);
|
||||
await expect(await dataTable.isItemPresent(favFolderName)).toBe(true, `${favFolderName} not displayed`);
|
||||
});
|
||||
|
||||
it(`[C213228] deleted favorite file does not appear`, async () => {
|
||||
@ -120,12 +120,12 @@ describe('Favorites', () => {
|
||||
|
||||
it('[C213650] Location column redirect - item in user Home', async () => {
|
||||
await dataTable.clickItemLocation(favFolderName);
|
||||
expect(await breadcrumb.getAllItems()).toEqual(['Personal Files']);
|
||||
await expect(await breadcrumb.getAllItems()).toEqual(['Personal Files']);
|
||||
});
|
||||
|
||||
it('[C280484] Location column redirect - file in folder', async () => {
|
||||
await dataTable.clickItemLocation(fileName2);
|
||||
expect(await breadcrumb.getAllItems()).toEqual(['Personal Files', parentFolder]);
|
||||
await expect(await breadcrumb.getAllItems()).toEqual(['Personal Files', parentFolder]);
|
||||
});
|
||||
|
||||
it('[C280485] Location column redirect - file in site', async () => {
|
||||
|
@ -103,7 +103,7 @@ describe('File Libraries', () => {
|
||||
const expectedColumns = ['Name', 'Description', 'My Role', 'Visibility'];
|
||||
const actualColumns = await dataTable.getColumnHeadersText();
|
||||
|
||||
expect(actualColumns).toEqual(expectedColumns);
|
||||
await expect(actualColumns).toEqual(expectedColumns);
|
||||
});
|
||||
|
||||
it('[C280501] User can see only the sites he is a member of', async () => {
|
||||
@ -123,7 +123,7 @@ describe('File Libraries', () => {
|
||||
const sitesList = await dataTable.getSitesNameAndVisibility();
|
||||
|
||||
for (const site of Object.keys(expectedSitesVisibility)) {
|
||||
expect(sitesList[site]).toEqual(expectedSitesVisibility[site]);
|
||||
await expect(sitesList[site]).toEqual(expectedSitesVisibility[site]);
|
||||
}
|
||||
});
|
||||
|
||||
@ -138,14 +138,14 @@ describe('File Libraries', () => {
|
||||
const sitesList = await dataTable.getSitesNameAndRole();
|
||||
|
||||
for (const site of Object.keys(expectedSitesRoles)) {
|
||||
expect(sitesList[site]).toEqual(expectedSitesRoles[site]);
|
||||
await expect(sitesList[site]).toEqual(expectedSitesRoles[site]);
|
||||
}
|
||||
});
|
||||
|
||||
it('[C217098] Site ID is displayed when two sites have the same name', async () => {
|
||||
const expectedSites = [`${siteName} (${siteId1})`, `${siteName} (${siteId2})`];
|
||||
const actualSites = await dataTable.getCellsContainingName(siteName);
|
||||
expect(actualSites.sort()).toEqual(expectedSites.sort());
|
||||
await expect(actualSites.sort()).toEqual(expectedSites.sort());
|
||||
});
|
||||
|
||||
it('[C217096] Tooltip for sites without description', async () => {
|
||||
@ -169,7 +169,7 @@ describe('File Libraries', () => {
|
||||
const expectedColumns = ['Name', 'Description', 'My Role', 'Visibility'];
|
||||
const actualColumns = await dataTable.getColumnHeadersText();
|
||||
|
||||
expect(actualColumns).toEqual(expectedColumns);
|
||||
await expect(actualColumns).toEqual(expectedColumns);
|
||||
});
|
||||
|
||||
it('[C289897] User can see only his favorite sites', async () => {
|
||||
|
@ -88,15 +88,15 @@ describe('Personal Files', () => {
|
||||
const expectedColumns = ['Name', 'Size', 'Modified', 'Modified by'];
|
||||
const actualColumns = await dataTable.getColumnHeadersText();
|
||||
|
||||
expect(actualColumns).toEqual(expectedColumns);
|
||||
await expect(actualColumns).toEqual(expectedColumns);
|
||||
});
|
||||
|
||||
it('[C217143] has default sorted column', async () => {
|
||||
expect(await dataTable.getSortedColumnHeaderText()).toBe('Name');
|
||||
await expect(await dataTable.getSortedColumnHeaderText()).toBe('Name');
|
||||
});
|
||||
|
||||
it('[C213242] has user created content', async () => {
|
||||
expect(await dataTable.isItemPresent(userFolder)).toBe(true, 'user folder not displayed');
|
||||
await expect(await dataTable.isItemPresent(userFolder)).toBe(true, 'user folder not displayed');
|
||||
});
|
||||
|
||||
it('[C213244] navigates to folder', async () => {
|
||||
|
@ -84,7 +84,7 @@ describe('Recent Files', () => {
|
||||
const expectedColumns = ['Name', 'Location', 'Size', 'Modified'];
|
||||
const actualColumns = await dataTable.getColumnHeadersText();
|
||||
|
||||
expect(actualColumns).toEqual(expectedColumns);
|
||||
await expect(actualColumns).toEqual(expectedColumns);
|
||||
});
|
||||
|
||||
it('[C213171] default sorting column', async () => {
|
||||
@ -117,7 +117,7 @@ describe('Recent Files', () => {
|
||||
|
||||
it('[C213176] Location column redirect - file in user Home', async () => {
|
||||
await dataTable.clickItemLocation(fileName2);
|
||||
expect(await breadcrumb.getAllItems()).toEqual(['Personal Files']);
|
||||
await expect(await breadcrumb.getAllItems()).toEqual(['Personal Files']);
|
||||
});
|
||||
|
||||
it('[C280486] Location column redirect - file in folder', async () => {
|
||||
|
@ -97,7 +97,7 @@ describe('Shared Files', () => {
|
||||
const expectedColumns = ['Name', 'Location', 'Size', 'Modified', 'Modified by', 'Shared by'];
|
||||
const actualColumns = await dataTable.getColumnHeadersText();
|
||||
|
||||
expect(actualColumns).toEqual(expectedColumns);
|
||||
await expect(actualColumns).toEqual(expectedColumns);
|
||||
});
|
||||
|
||||
it('[C213115] default sorting column', async () => {
|
||||
@ -126,7 +126,7 @@ describe('Shared Files', () => {
|
||||
|
||||
it('[C213666] Location column redirect - file in user Home', async () => {
|
||||
await dataTable.clickItemLocation(file4User);
|
||||
expect(await breadcrumb.getAllItems()).toEqual(['Personal Files']);
|
||||
await expect(await breadcrumb.getAllItems()).toEqual(['Personal Files']);
|
||||
});
|
||||
|
||||
it('[C280490] Location column redirect - file in folder', async () => {
|
||||
|
@ -108,7 +108,7 @@ describe('Trash', () => {
|
||||
const expectedColumns = ['Name', 'Location', 'Size', 'Deleted', 'Deleted by'];
|
||||
const actualColumns = await dataTable.getColumnHeadersText();
|
||||
|
||||
expect(actualColumns).toEqual(expectedColumns);
|
||||
await expect(actualColumns).toEqual(expectedColumns);
|
||||
});
|
||||
|
||||
it('[C280493] displays the files and folders deleted by everyone', async () => {
|
||||
@ -135,7 +135,7 @@ describe('Trash', () => {
|
||||
const expectedColumns = ['Name', 'Location', 'Size', 'Deleted'];
|
||||
const actualColumns = await dataTable.getColumnHeadersText();
|
||||
|
||||
expect(actualColumns).toEqual(expectedColumns);
|
||||
await expect(actualColumns).toEqual(expectedColumns);
|
||||
});
|
||||
|
||||
it('[C213218] displays the files and folders deleted by the user', async () => {
|
||||
|
@ -80,7 +80,7 @@ describe('Pagination on multiple pages : ', () => {
|
||||
|
||||
describe('on Search Results', () => {
|
||||
beforeAll(async () => {
|
||||
userApi.search.waitForApi(username, { expect: initialSearchTotalItems + 101 });
|
||||
await userApi.search.waitForApi(username, { expect: initialSearchTotalItems + 101 });
|
||||
}, 120000);
|
||||
searchResultsTests(username);
|
||||
});
|
||||
|
@ -172,7 +172,7 @@ describe('Search results - libraries', () => {
|
||||
const expectedColumns = ['Name', 'Description', 'My Role', 'Visibility'];
|
||||
const actualColumns = await dataTable.getColumnHeadersText();
|
||||
|
||||
expect(actualColumns).toEqual(expectedColumns);
|
||||
await expect(actualColumns).toEqual(expectedColumns);
|
||||
});
|
||||
|
||||
it('[C290017] Library visibility is correctly displayed', async () => {
|
||||
|
@ -86,6 +86,7 @@
|
||||
"ajv-cli": "^3.3.0",
|
||||
"codelyzer": "^6.0.0",
|
||||
"commander": "^6.0.0",
|
||||
"connect-history-api-fallback": "^1.6.0",
|
||||
"cpr": "^3.0.1",
|
||||
"cspell": "^4.1.0",
|
||||
"dotenv": "^8.2.0",
|
||||
|
@ -103,7 +103,7 @@ export function isShared(context: RuleContext): boolean {
|
||||
return true;
|
||||
}
|
||||
|
||||
if ((navigation.isNotTrashcan(context), !context.selection.isEmpty && context.selection.file)) {
|
||||
if (navigation.isNotTrashcan(context) && !context.selection.isEmpty && context.selection.file) {
|
||||
return !!(context.selection.file.entry && context.selection.file.entry.properties && context.selection.file.entry.properties['qshare:sharedId']);
|
||||
}
|
||||
|
||||
|
@ -126,6 +126,7 @@ export class ContentApiService {
|
||||
/**
|
||||
* Gets information about a user identified by their username.
|
||||
* @param personId ID of the target user
|
||||
* @param options Api options
|
||||
* @returns User information
|
||||
*/
|
||||
getPerson(personId: string, options?: { fields?: Array<string> }): Observable<PersonEntry> {
|
||||
@ -138,6 +139,7 @@ export class ContentApiService {
|
||||
* @param nodeId The id of the node to be copied
|
||||
* @param targetParentId The id of the folder-node where the node have to be copied to
|
||||
* @param name The new name for the copy that would be added on the destination folder
|
||||
* @param opts Api options
|
||||
*/
|
||||
copyNode(nodeId: string, targetParentId: string, name?: string, opts?: { include?: Array<string>; fields?: Array<string> }): Observable<NodeEntry> {
|
||||
return from(this.api.nodesApi.copyNode(nodeId, { targetParentId, name }, opts));
|
||||
|
@ -77,9 +77,9 @@ describe('RouterExtensionService', () => {
|
||||
]
|
||||
});
|
||||
|
||||
extensionService = TestBed.get(ExtensionService);
|
||||
service = TestBed.get(RouterExtensionService);
|
||||
router = TestBed.get(Router);
|
||||
extensionService = TestBed.inject(ExtensionService);
|
||||
service = TestBed.inject(RouterExtensionService);
|
||||
router = TestBed.inject(Router);
|
||||
router.config = [
|
||||
{ path: 'login', component: {} as Type<any> },
|
||||
{ path: 'settings', component: {} as Type<any> },
|
||||
|
@ -34,11 +34,10 @@ export class Breadcrumb extends Component {
|
||||
}
|
||||
|
||||
async getAllItems(): Promise<string[]> {
|
||||
const items: string[] = await this.items.map(async (elem) => {
|
||||
return this.items.map(async (elem) => {
|
||||
const str = await elem.getText();
|
||||
return str.split('\nchevron_right')[0];
|
||||
});
|
||||
return items;
|
||||
}
|
||||
|
||||
async clickItem(name: string): Promise<void> {
|
||||
|
@ -23,7 +23,7 @@
|
||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { by, browser } from 'protractor';
|
||||
import { browser, by } from 'protractor';
|
||||
import { Component } from '../component';
|
||||
import { waitForPresence, waitForStaleness } from '../../utilities/utils';
|
||||
|
||||
@ -57,9 +57,8 @@ export class DropDownBreadcrumb extends Component {
|
||||
}
|
||||
|
||||
async getPathItems(): Promise<string[]> {
|
||||
const items: string[] = await this.pathItems.map(async (elem) => {
|
||||
return this.pathItems.map(async (elem) => {
|
||||
return elem.getText();
|
||||
});
|
||||
return items;
|
||||
}
|
||||
}
|
||||
|
@ -45,7 +45,7 @@ export abstract class Component {
|
||||
return root.all(by.css(css));
|
||||
}
|
||||
|
||||
constructor(selector: string, ancestor?: string) {
|
||||
protected constructor(selector: string, ancestor?: string) {
|
||||
const locator = selector;
|
||||
|
||||
this.component = ancestor ? browser.$$(ancestor).first().$$(locator).first() : browser.$$(locator).first();
|
||||
|
@ -23,12 +23,12 @@
|
||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { ElementFinder, ElementArrayFinder, by, browser, protractor } from 'protractor';
|
||||
import { browser, by, ElementArrayFinder, ElementFinder, protractor } from 'protractor';
|
||||
import { Logger } from '@alfresco/adf-testing';
|
||||
import { BROWSER_WAIT_TIMEOUT } from '../../configs';
|
||||
import { Component } from '../component';
|
||||
import { Menu } from '../menu/menu';
|
||||
import { Utils, waitForPresence, waitForClickable } from '../../utilities/utils';
|
||||
import { Utils, waitForClickable, waitForPresence } from '../../utilities/utils';
|
||||
|
||||
export class DataTable extends Component {
|
||||
private static selectors = {
|
||||
@ -146,10 +146,9 @@ export class DataTable extends Component {
|
||||
}
|
||||
|
||||
async getSelectedRowsNames(): Promise<string[]> {
|
||||
const rowsText: string[] = await this.getSelectedRows().map((row) => {
|
||||
return this.getSelectedRows().map((row) => {
|
||||
return row.element(by.css('.adf-datatable-cell[title="Name"]')).getText();
|
||||
});
|
||||
return rowsText;
|
||||
}
|
||||
|
||||
async getSelectedRowsCount(): Promise<number> {
|
||||
@ -358,10 +357,9 @@ export class DataTable extends Component {
|
||||
|
||||
async getCellsContainingName(name: string): Promise<string[]> {
|
||||
const rows = this.getRows().all(by.cssContainingText(DataTable.selectors.cell, name));
|
||||
const cellsText: string[] = await rows.map(async (cell) => {
|
||||
return rows.map(async (cell) => {
|
||||
return cell.getText();
|
||||
});
|
||||
return cellsText;
|
||||
}
|
||||
|
||||
async hasContextMenu(): Promise<boolean> {
|
||||
@ -378,12 +376,11 @@ export class DataTable extends Component {
|
||||
}
|
||||
|
||||
private async getEntireDataTableText(): Promise<string[]> {
|
||||
const text: string[] = await this.getRows().map((row) => {
|
||||
return this.getRows().map((row) => {
|
||||
return row.all(by.css(DataTable.selectors.cell)).map(async (cell) => {
|
||||
return cell.getText();
|
||||
});
|
||||
});
|
||||
return text;
|
||||
}
|
||||
|
||||
async getSitesNameAndVisibility(): Promise<any> {
|
||||
|
@ -27,7 +27,7 @@ import { ElementFinder, by, browser, Locator } from 'protractor';
|
||||
import { isPresentAndDisplayed, waitForPresence, waitForVisibility, waitForStaleness } from '../../utilities/utils';
|
||||
|
||||
export abstract class GenericDialog {
|
||||
constructor(private rootCssSelector?: string) {}
|
||||
protected constructor(private rootCssSelector?: string) {}
|
||||
|
||||
get rootElem(): ElementFinder {
|
||||
return browser.element(by.css(this.rootCssSelector));
|
||||
|
@ -117,11 +117,10 @@ export class Menu extends Component {
|
||||
}
|
||||
|
||||
async getMenuItems(): Promise<string[]> {
|
||||
const items: string[] = await this.items.map(async (elem) => {
|
||||
return this.items.map(async (elem) => {
|
||||
const span = elem.element(by.css('span'));
|
||||
return span.getText();
|
||||
});
|
||||
return items;
|
||||
}
|
||||
|
||||
async clickNthItem(nth: number): Promise<void> {
|
||||
@ -194,8 +193,7 @@ export class Menu extends Component {
|
||||
async isMenuItemDisabled(title: string): Promise<string | null> {
|
||||
try {
|
||||
const item = this.getItemByLabel(title);
|
||||
const disabled = await item.getAttribute('disabled');
|
||||
return disabled;
|
||||
return await item.getAttribute('disabled');
|
||||
} catch (error) {
|
||||
Logger.error('----- isMenuItemDisabled catch: ', error);
|
||||
return null;
|
||||
|
@ -79,8 +79,7 @@ export class CreatedDateFilter extends GenericFilterPanel {
|
||||
|
||||
async getFromValue(): Promise<string> {
|
||||
try {
|
||||
const value = await this.fromInput.getAttribute('value');
|
||||
return value;
|
||||
return await this.fromInput.getAttribute('value');
|
||||
} catch (error) {
|
||||
return '';
|
||||
}
|
||||
@ -88,8 +87,7 @@ export class CreatedDateFilter extends GenericFilterPanel {
|
||||
|
||||
async getFromError(): Promise<string> {
|
||||
try {
|
||||
const error = await this.fromFieldError.getText();
|
||||
return error;
|
||||
return await this.fromFieldError.getText();
|
||||
} catch (err) {
|
||||
return '';
|
||||
}
|
||||
@ -97,8 +95,7 @@ export class CreatedDateFilter extends GenericFilterPanel {
|
||||
|
||||
async getToValue(): Promise<string> {
|
||||
try {
|
||||
const value = await this.toInput.getAttribute('value');
|
||||
return value;
|
||||
return await this.toInput.getAttribute('value');
|
||||
} catch (err) {
|
||||
return '';
|
||||
}
|
||||
@ -106,8 +103,7 @@ export class CreatedDateFilter extends GenericFilterPanel {
|
||||
|
||||
async getToError(): Promise<string> {
|
||||
try {
|
||||
const error = await this.toFieldError.getText();
|
||||
return error;
|
||||
return await this.toFieldError.getText();
|
||||
} catch (err) {
|
||||
return '';
|
||||
}
|
||||
|
@ -52,17 +52,15 @@ export class FacetFilter extends GenericFilterPanel {
|
||||
}
|
||||
|
||||
async getFiltersValues(): Promise<string[]> {
|
||||
const list: string[] = await this.facets.map((option) => {
|
||||
return this.facets.map((option) => {
|
||||
return option.getText();
|
||||
});
|
||||
return list;
|
||||
}
|
||||
|
||||
async getFiltersCheckedValues(): Promise<string[]> {
|
||||
const list: string[] = await this.selectedFacets.map((option) => {
|
||||
return this.selectedFacets.map((option) => {
|
||||
return option.getText();
|
||||
});
|
||||
return list;
|
||||
}
|
||||
|
||||
async resetPanel(): Promise<void> {
|
||||
|
@ -36,17 +36,15 @@ export class SizeFilter extends GenericFilterPanel {
|
||||
clearButton: ElementFinder = this.panel.element(by.cssContainingText('.adf-facet-buttons button', 'Clear all'));
|
||||
|
||||
async getFiltersValues(): Promise<string[]> {
|
||||
const list: string[] = await this.facets.map((option) => {
|
||||
return this.facets.map((option) => {
|
||||
return option.getText();
|
||||
});
|
||||
return list;
|
||||
}
|
||||
|
||||
async getFiltersCheckedValues(): Promise<string[]> {
|
||||
const list: string[] = await this.selectedFacets.map((option) => {
|
||||
return this.selectedFacets.map((option) => {
|
||||
return option.getText();
|
||||
});
|
||||
return list;
|
||||
}
|
||||
|
||||
async resetPanel(): Promise<void> {
|
||||
|
@ -78,10 +78,9 @@ export class SearchSortingPicker extends Component {
|
||||
}
|
||||
|
||||
async getSortByOptionsList(): Promise<string[]> {
|
||||
const list: string[] = await this.sortByList.map(async (option) => {
|
||||
return this.sortByList.map(async (option) => {
|
||||
return option.getText();
|
||||
});
|
||||
return list;
|
||||
}
|
||||
|
||||
async sortBy(option: SortByType): Promise<void> {
|
||||
|
@ -46,10 +46,9 @@ export class SearchResultsPage extends BrowsingPage {
|
||||
|
||||
async getResultsChipsValues(): Promise<string[]> {
|
||||
const chips = this.chipList.all(by.css('.mat-chip'));
|
||||
const chipsValues: string[] = await chips.map(async (elem) => {
|
||||
return chips.map(async (elem) => {
|
||||
return (await elem.getText()).replace(`\ncancel`, '');
|
||||
});
|
||||
return chipsValues;
|
||||
}
|
||||
|
||||
async removeChip(chipName: string): Promise<void> {
|
||||
|
@ -128,7 +128,7 @@ export class FavoritesApi extends RepoApi {
|
||||
}
|
||||
|
||||
async isFavoriteWithRetry(nodeId: string, data: { expect: boolean }) {
|
||||
let isFavorite: boolean;
|
||||
let isFavorite = false;
|
||||
try {
|
||||
const favorite = async () => {
|
||||
isFavorite = await this.isFavorite(nodeId);
|
||||
|
@ -49,8 +49,7 @@ export class NodesApi extends RepoApi {
|
||||
async getNodeById(id: string): Promise<NodeEntry | null> {
|
||||
try {
|
||||
await this.apiAuth();
|
||||
const node = await this.nodesApi.getNode(id);
|
||||
return node;
|
||||
return await this.nodesApi.getNode(id);
|
||||
} catch (error) {
|
||||
this.handleError(`${this.constructor.name} ${this.getNodeById.name}`, error);
|
||||
return null;
|
||||
@ -525,7 +524,7 @@ export class NodesApi extends RepoApi {
|
||||
expect: expect,
|
||||
retry: 5
|
||||
};
|
||||
let isLocked: boolean;
|
||||
let isLocked = false;
|
||||
try {
|
||||
const locked = async () => {
|
||||
isLocked = (await this.getLockType(nodeId)) === 'WRITE_LOCK';
|
||||
|
@ -30,7 +30,7 @@ import { Logger } from '@alfresco/adf-testing';
|
||||
export abstract class RepoApi {
|
||||
alfrescoJsApi = new AlfrescoApi();
|
||||
|
||||
constructor(private username: string = browser.params.ADMIN_USERNAME, private password: string = browser.params.ADMIN_PASSWORD) {
|
||||
protected constructor(private username: string = browser.params.ADMIN_USERNAME, private password: string = browser.params.ADMIN_PASSWORD) {
|
||||
this.alfrescoJsApi.setConfig(browser.params.config);
|
||||
}
|
||||
|
||||
|
@ -28,13 +28,13 @@ const MAX_RETRIES = process.env.MAX_RETRIES || 1;
|
||||
|
||||
function rmDir(dirPath) {
|
||||
try {
|
||||
var files = fs.readdirSync(dirPath);
|
||||
const files = fs.readdirSync(dirPath);
|
||||
} catch (e) {
|
||||
return;
|
||||
}
|
||||
if (files.length > 0)
|
||||
for (var i = 0; i < files.length; i++) {
|
||||
var filePath = dirPath + '/' + files[i];
|
||||
for (let i = 0; i < files.length; i++) {
|
||||
const filePath = dirPath + '/' + files[i];
|
||||
if (fs.statSync(filePath).isFile()) fs.unlinkSync(filePath);
|
||||
else rmDir(filePath);
|
||||
}
|
||||
|
@ -7,7 +7,7 @@
|
||||
*/
|
||||
|
||||
import { ParamType } from './params';
|
||||
import { BaseParamOptions, CommanderOptionParams, BaseParam } from './base-param';
|
||||
import { CommanderOptionParams, BaseParam } from './base-param';
|
||||
|
||||
export class BooleanParam extends BaseParam {
|
||||
protected type = ParamType.confirm;
|
||||
|
@ -7,7 +7,7 @@
|
||||
*/
|
||||
|
||||
import { ParamType } from './params';
|
||||
import { BaseParam, BaseParamOptions, CommanderOptionParams } from './base-param';
|
||||
import { BaseParam, CommanderOptionParams } from './base-param';
|
||||
|
||||
export class InputParam extends BaseParam {
|
||||
protected type = ParamType.input;
|
||||
|
@ -36,6 +36,7 @@ import { SetCurrentFolderAction, isAdmin, AppStore, UploadFileVersionAction } fr
|
||||
import { BreakpointObserver, Breakpoints } from '@angular/cdk/layout';
|
||||
import { debounceTime, takeUntil } from 'rxjs/operators';
|
||||
import { FilterSearch, ShareDataRow } from '@alfresco/adf-content-services';
|
||||
import { DocumentListPresetRef } from '@alfresco/adf-extensions';
|
||||
|
||||
@Component({
|
||||
templateUrl: './files.component.html'
|
||||
@ -49,7 +50,7 @@ export class FilesComponent extends PageComponent implements OnInit, OnDestroy {
|
||||
|
||||
private nodePath: PathElement[];
|
||||
|
||||
columns: any[] = [];
|
||||
columns: DocumentListPresetRef[] = [];
|
||||
|
||||
constructor(
|
||||
private router: Router,
|
||||
|
@ -28,6 +28,7 @@ import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { AppTestingModule } from '../../../testing/app-testing.module';
|
||||
import { NO_ERRORS_SCHEMA } from '@angular/core';
|
||||
import { NodePermissionService } from '@alfresco/aca-shared';
|
||||
import { Node } from '@alfresco/js-api';
|
||||
|
||||
describe('CommentsTabComponent', () => {
|
||||
let component: CommentsTabComponent;
|
||||
@ -66,44 +67,40 @@ describe('CommentsTabComponent', () => {
|
||||
});
|
||||
|
||||
it('should return [false] if node selected is neither file or folder', () => {
|
||||
const testNode: any = {
|
||||
component.node = {
|
||||
id: 'test-node-id',
|
||||
isFile: false,
|
||||
isFolder: false
|
||||
};
|
||||
component.node = testNode;
|
||||
} as Node;
|
||||
expect(component.canUpdateNode).toBe(false);
|
||||
});
|
||||
|
||||
it('should return [false] if node selected is a locked file', () => {
|
||||
const testNode: any = {
|
||||
component.node = {
|
||||
id: 'test-node-id',
|
||||
isFile: true,
|
||||
isFolder: false,
|
||||
isLocked: true
|
||||
};
|
||||
component.node = testNode;
|
||||
} as Node;
|
||||
expect(component.canUpdateNode).toBe(false);
|
||||
});
|
||||
|
||||
it('should check [update] permission if node selected is a not locked file', () => {
|
||||
const testNode: any = {
|
||||
component.node = {
|
||||
id: 'test-node-id',
|
||||
isFile: true,
|
||||
isFolder: false
|
||||
};
|
||||
component.node = testNode;
|
||||
} as Node;
|
||||
expect(component.canUpdateNode).toBe(true);
|
||||
expect(checked).toContain('update');
|
||||
});
|
||||
|
||||
it('should check [update] permission if node selected is a folder', () => {
|
||||
const testNode: any = {
|
||||
component.node = {
|
||||
id: 'test-node-id',
|
||||
isFile: false,
|
||||
isFolder: true
|
||||
};
|
||||
component.node = testNode;
|
||||
} as Node;
|
||||
expect(component.canUpdateNode).toBe(true);
|
||||
expect(checked).toContain('update');
|
||||
});
|
||||
|
@ -70,7 +70,7 @@ export abstract class PageComponent implements OnInit, OnDestroy, OnChanges {
|
||||
|
||||
protected subscriptions: Subscription[] = [];
|
||||
|
||||
constructor(protected store: Store<AppStore>, protected extensions: AppExtensionService, protected content: ContentManagementService) {}
|
||||
protected constructor(protected store: Store<AppStore>, protected extensions: AppExtensionService, protected content: ContentManagementService) {}
|
||||
|
||||
ngOnInit() {
|
||||
this.sharedPreviewUrl$ = this.store.select(getSharedUrl);
|
||||
|
@ -177,10 +177,10 @@ export class PreviewComponent extends PageComponent implements OnInit, OnDestroy
|
||||
this.nodeId = this.node.id;
|
||||
return;
|
||||
}
|
||||
this.router.navigate([this.previewLocation, id]);
|
||||
await this.router.navigate([this.previewLocation, id]);
|
||||
} catch (err) {
|
||||
if (!err || err.status !== 401) {
|
||||
this.router.navigate([this.previewLocation, id]);
|
||||
await this.router.navigate([this.previewLocation, id]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -31,7 +31,7 @@ import { Component, OnInit, ViewEncapsulation } from '@angular/core';
|
||||
import { ActivatedRoute } from '@angular/router';
|
||||
import { Store } from '@ngrx/store';
|
||||
import { forkJoin, from, of } from 'rxjs';
|
||||
import { catchError, flatMap } from 'rxjs/operators';
|
||||
import { catchError, mergeMap } from 'rxjs/operators';
|
||||
import { AppExtensionService } from '@alfresco/aca-shared';
|
||||
|
||||
@Component({
|
||||
@ -55,8 +55,10 @@ export class SharedLinkViewComponent implements OnInit {
|
||||
ngOnInit() {
|
||||
this.route.params
|
||||
.pipe(
|
||||
flatMap((params) =>
|
||||
forkJoin(from(this.alfrescoApiService.sharedLinksApi.getSharedLink(params.id)), of(params.id)).pipe(catchError(() => of([null, params.id])))
|
||||
mergeMap((params) =>
|
||||
forkJoin([from(this.alfrescoApiService.sharedLinksApi.getSharedLink(params.id)), of(params.id)]).pipe(
|
||||
catchError(() => of([null, params.id]))
|
||||
)
|
||||
)
|
||||
)
|
||||
.subscribe(([sharedEntry, sharedId]: [SharedLinkEntry, string]) => {
|
||||
|
@ -56,7 +56,10 @@ describe('ButtonMenuComponent', () => {
|
||||
it('should render action item', () => {
|
||||
component.item = {
|
||||
id: 'test-action-button',
|
||||
url: 'dummy'
|
||||
url: 'dummy',
|
||||
icon: null,
|
||||
title: null,
|
||||
route: null
|
||||
};
|
||||
|
||||
fixture.detectChanges();
|
||||
@ -68,16 +71,23 @@ describe('ButtonMenuComponent', () => {
|
||||
it('should render action item with children', () => {
|
||||
component.item = {
|
||||
id: 'test-action-button',
|
||||
icon: null,
|
||||
title: null,
|
||||
route: null,
|
||||
children: [
|
||||
{
|
||||
id: 'child-1',
|
||||
title: 'child-1',
|
||||
url: 'dummy'
|
||||
url: 'dummy',
|
||||
icon: null,
|
||||
route: null
|
||||
},
|
||||
{
|
||||
id: 'child-2',
|
||||
title: 'child-2',
|
||||
url: 'dummy'
|
||||
url: 'dummy',
|
||||
icon: null,
|
||||
route: null
|
||||
}
|
||||
]
|
||||
};
|
||||
|
@ -25,6 +25,7 @@
|
||||
|
||||
import { Component, Input, ViewEncapsulation, OnInit, ChangeDetectorRef } from '@angular/core';
|
||||
import { OverlayContainer } from '@angular/cdk/overlay';
|
||||
import { NavBarLinkRef } from '@alfresco/adf-extensions';
|
||||
|
||||
@Component({
|
||||
selector: 'app-button-menu',
|
||||
@ -33,7 +34,8 @@ import { OverlayContainer } from '@angular/cdk/overlay';
|
||||
encapsulation: ViewEncapsulation.None
|
||||
})
|
||||
export class ButtonMenuComponent implements OnInit {
|
||||
@Input() item;
|
||||
@Input()
|
||||
item: NavBarLinkRef;
|
||||
|
||||
constructor(private cd: ChangeDetectorRef, private overlayContainer: OverlayContainer) {
|
||||
this.overlayContainer.getContainerElement().classList.add('aca-menu-panel');
|
||||
|
@ -52,7 +52,7 @@ import { SharedLinkEntry } from '@alfresco/js-api';
|
||||
host: { class: 'app-view-node' }
|
||||
})
|
||||
export class ViewNodeComponent {
|
||||
@Input() data: any;
|
||||
@Input() data: { title?: string; menuButton?: boolean; iconButton?: boolean };
|
||||
|
||||
constructor(private store: Store<AppStore>, private router: Router) {}
|
||||
|
||||
|
@ -102,7 +102,7 @@ describe('ContentManagementService', () => {
|
||||
|
||||
store.dispatch(new CopyNodesAction(selection));
|
||||
nodeActions.contentCopied.next(createdItems);
|
||||
subject.next('OPERATION.SUCCES.CONTENT.COPY');
|
||||
subject.next('OPERATION.SUCCESS.CONTENT.COPY');
|
||||
|
||||
expect(nodeActions.copyNodes).toHaveBeenCalled();
|
||||
expect(snackBar.open['calls'].argsFor(0)[0]).toBe('APP.MESSAGES.INFO.NODE_COPY.SINGULAR');
|
||||
@ -116,7 +116,7 @@ describe('ContentManagementService', () => {
|
||||
|
||||
store.dispatch(new CopyNodesAction(selection));
|
||||
nodeActions.contentCopied.next(createdItems);
|
||||
subject.next('OPERATION.SUCCES.CONTENT.COPY');
|
||||
subject.next('OPERATION.SUCCESS.CONTENT.COPY');
|
||||
|
||||
expect(nodeActions.copyNodes).toHaveBeenCalled();
|
||||
expect(snackBar.open['calls'].argsFor(0)[0]).toBe('APP.MESSAGES.INFO.NODE_COPY.PLURAL');
|
||||
@ -130,7 +130,7 @@ describe('ContentManagementService', () => {
|
||||
|
||||
store.dispatch(new CopyNodesAction(selection));
|
||||
nodeActions.contentCopied.next(createdItems);
|
||||
subject.next('OPERATION.SUCCES.CONTENT.COPY');
|
||||
subject.next('OPERATION.SUCCESS.CONTENT.COPY');
|
||||
|
||||
expect(nodeActions.copyNodes).toHaveBeenCalled();
|
||||
expect(snackBar.open['calls'].argsFor(0)[0]).toBe('APP.MESSAGES.INFO.NODE_COPY.PARTIAL_SINGULAR');
|
||||
@ -148,7 +148,7 @@ describe('ContentManagementService', () => {
|
||||
|
||||
store.dispatch(new CopyNodesAction(selection));
|
||||
nodeActions.contentCopied.next(createdItems);
|
||||
subject.next('OPERATION.SUCCES.CONTENT.COPY');
|
||||
subject.next('OPERATION.SUCCESS.CONTENT.COPY');
|
||||
|
||||
expect(nodeActions.copyNodes).toHaveBeenCalled();
|
||||
expect(snackBar.open['calls'].argsFor(0)[0]).toBe('APP.MESSAGES.INFO.NODE_COPY.PARTIAL_PLURAL');
|
||||
@ -166,7 +166,7 @@ describe('ContentManagementService', () => {
|
||||
|
||||
store.dispatch(new CopyNodesAction(selection));
|
||||
nodeActions.contentCopied.next(createdItems);
|
||||
subject.next('OPERATION.SUCCES.CONTENT.COPY');
|
||||
subject.next('OPERATION.SUCCESS.CONTENT.COPY');
|
||||
|
||||
expect(nodeActions.copyNodes).toHaveBeenCalled();
|
||||
expect(snackBar.open['calls'].argsFor(0)[0]).toBe('APP.MESSAGES.INFO.NODE_COPY.FAIL_PLURAL');
|
||||
@ -180,7 +180,7 @@ describe('ContentManagementService', () => {
|
||||
|
||||
store.dispatch(new CopyNodesAction(selection));
|
||||
nodeActions.contentCopied.next(createdItems);
|
||||
subject.next('OPERATION.SUCCES.CONTENT.COPY');
|
||||
subject.next('OPERATION.SUCCESS.CONTENT.COPY');
|
||||
|
||||
expect(nodeActions.copyNodes).toHaveBeenCalled();
|
||||
expect(snackBar.open['calls'].argsFor(0)[0]).toBe('APP.MESSAGES.INFO.NODE_COPY.FAIL_SINGULAR');
|
||||
@ -242,7 +242,7 @@ describe('ContentManagementService', () => {
|
||||
const createdItems: any[] = [{ entry: { id: 'copy-id', name: 'name' } }];
|
||||
|
||||
store.dispatch(new CopyNodesAction(selection));
|
||||
nodeActions.copyNodes(null).next('OPERATION.SUCCES.CONTENT.COPY');
|
||||
nodeActions.copyNodes(null).next('OPERATION.SUCCESS.CONTENT.COPY');
|
||||
nodeActions.contentCopied.next(createdItems);
|
||||
|
||||
expect(nodeActions.copyNodes).toHaveBeenCalled();
|
||||
@ -279,7 +279,7 @@ describe('ContentManagementService', () => {
|
||||
];
|
||||
|
||||
store.dispatch(new CopyNodesAction(selection));
|
||||
nodeActions.copyNodes(null).next('OPERATION.SUCCES.CONTENT.COPY');
|
||||
nodeActions.copyNodes(null).next('OPERATION.SUCCESS.CONTENT.COPY');
|
||||
nodeActions.contentCopied.next(createdItems);
|
||||
|
||||
expect(nodeActions.copyNodes).toHaveBeenCalled();
|
||||
@ -299,7 +299,7 @@ describe('ContentManagementService', () => {
|
||||
const createdItems: any[] = [{ entry: { id: 'copy-id', name: 'name' } }];
|
||||
|
||||
store.dispatch(new CopyNodesAction(selection));
|
||||
nodeActions.copyNodes(null).next('OPERATION.SUCCES.CONTENT.COPY');
|
||||
nodeActions.copyNodes(null).next('OPERATION.SUCCESS.CONTENT.COPY');
|
||||
nodeActions.contentCopied.next(createdItems);
|
||||
|
||||
expect(nodeActions.copyNodes).toHaveBeenCalled();
|
||||
@ -314,7 +314,7 @@ describe('ContentManagementService', () => {
|
||||
const createdItems: any[] = [{ entry: { id: 'copy-id', name: 'name' } }];
|
||||
|
||||
store.dispatch(new CopyNodesAction(selection));
|
||||
nodeActions.copyNodes(null).next('OPERATION.SUCCES.CONTENT.COPY');
|
||||
nodeActions.copyNodes(null).next('OPERATION.SUCCESS.CONTENT.COPY');
|
||||
nodeActions.contentCopied.next(createdItems);
|
||||
|
||||
expect(nodeActions.copyNodes).toHaveBeenCalled();
|
||||
@ -329,7 +329,7 @@ describe('ContentManagementService', () => {
|
||||
const createdItems: any[] = [{ entry: { id: 'copy-id', name: 'name' } }];
|
||||
|
||||
store.dispatch(new CopyNodesAction(selection));
|
||||
nodeActions.copyNodes(null).next('OPERATION.SUCCES.CONTENT.COPY');
|
||||
nodeActions.copyNodes(null).next('OPERATION.SUCCESS.CONTENT.COPY');
|
||||
nodeActions.contentCopied.next(createdItems);
|
||||
|
||||
expect(nodeActions.copyNodes).toHaveBeenCalled();
|
||||
@ -375,7 +375,7 @@ describe('ContentManagementService', () => {
|
||||
|
||||
const selection: any = node;
|
||||
store.dispatch(new MoveNodesAction(selection));
|
||||
nodeActions.moveNodes(null).next('OPERATION.SUCCES.CONTENT.MOVE');
|
||||
nodeActions.moveNodes(null).next('OPERATION.SUCCESS.CONTENT.MOVE');
|
||||
nodeActions.contentMoved.next(moveResponse);
|
||||
|
||||
expect(nodeActions.moveNodes).toHaveBeenCalled();
|
||||
@ -396,7 +396,7 @@ describe('ContentManagementService', () => {
|
||||
const selection: any = nodes;
|
||||
|
||||
store.dispatch(new MoveNodesAction(selection));
|
||||
nodeActions.moveNodes(null).next('OPERATION.SUCCES.CONTENT.MOVE');
|
||||
nodeActions.moveNodes(null).next('OPERATION.SUCCESS.CONTENT.MOVE');
|
||||
nodeActions.contentMoved.next(moveResponse);
|
||||
|
||||
expect(nodeActions.moveNodes).toHaveBeenCalled();
|
||||
@ -414,10 +414,8 @@ describe('ContentManagementService', () => {
|
||||
spyOn(nodeActions, 'moveNodes').and.returnValue(subject);
|
||||
spyOn(nodeActions, 'processResponse').and.returnValue(moveResponse);
|
||||
|
||||
const selection = nodes;
|
||||
|
||||
store.dispatch(new MoveNodesAction(selection));
|
||||
nodeActions.moveNodes(null).next('OPERATION.SUCCES.CONTENT.MOVE');
|
||||
store.dispatch(new MoveNodesAction(nodes));
|
||||
nodeActions.moveNodes(null).next('OPERATION.SUCCESS.CONTENT.MOVE');
|
||||
nodeActions.contentMoved.next(moveResponse);
|
||||
|
||||
expect(nodeActions.moveNodes).toHaveBeenCalled();
|
||||
@ -435,10 +433,8 @@ describe('ContentManagementService', () => {
|
||||
spyOn(nodeActions, 'moveNodes').and.returnValue(subject);
|
||||
spyOn(nodeActions, 'processResponse').and.returnValue(moveResponse);
|
||||
|
||||
const selection = nodes;
|
||||
|
||||
store.dispatch(new MoveNodesAction(selection));
|
||||
nodeActions.moveNodes(null).next('OPERATION.SUCCES.CONTENT.MOVE');
|
||||
store.dispatch(new MoveNodesAction(nodes));
|
||||
nodeActions.moveNodes(null).next('OPERATION.SUCCESS.CONTENT.MOVE');
|
||||
nodeActions.contentMoved.next(moveResponse);
|
||||
|
||||
expect(nodeActions.moveNodes).toHaveBeenCalled();
|
||||
@ -457,7 +453,7 @@ describe('ContentManagementService', () => {
|
||||
spyOn(nodeActions, 'processResponse').and.returnValue(moveResponse);
|
||||
|
||||
store.dispatch(new MoveNodesAction(nodes));
|
||||
nodeActions.moveNodes(null).next('OPERATION.SUCCES.CONTENT.MOVE');
|
||||
nodeActions.moveNodes(null).next('OPERATION.SUCCESS.CONTENT.MOVE');
|
||||
nodeActions.contentMoved.next(moveResponse);
|
||||
|
||||
expect(nodeActions.moveNodes).toHaveBeenCalled();
|
||||
@ -476,7 +472,7 @@ describe('ContentManagementService', () => {
|
||||
spyOn(nodeActions, 'processResponse').and.returnValue(moveResponse);
|
||||
|
||||
store.dispatch(new MoveNodesAction(nodes));
|
||||
nodeActions.moveNodes(null).next('OPERATION.SUCCES.CONTENT.MOVE');
|
||||
nodeActions.moveNodes(null).next('OPERATION.SUCCESS.CONTENT.MOVE');
|
||||
nodeActions.contentMoved.next(moveResponse);
|
||||
|
||||
expect(nodeActions.moveNodes).toHaveBeenCalled();
|
||||
@ -546,7 +542,7 @@ describe('ContentManagementService', () => {
|
||||
spyOn(nodeActions, 'processResponse').and.returnValue(moveResponse);
|
||||
|
||||
store.dispatch(new MoveNodesAction(nodes));
|
||||
nodeActions.moveNodes(null).next('OPERATION.SUCCES.CONTENT.MOVE');
|
||||
nodeActions.moveNodes(null).next('OPERATION.SUCCESS.CONTENT.MOVE');
|
||||
nodeActions.contentMoved.next(moveResponse);
|
||||
|
||||
expect(nodeActions.moveNodes).toHaveBeenCalled();
|
||||
@ -592,7 +588,7 @@ describe('ContentManagementService', () => {
|
||||
spyOn(nodeActions, 'moveNodeAction').and.returnValue(of({}));
|
||||
|
||||
store.dispatch(new MoveNodesAction(selection));
|
||||
nodeActions.moveNodes(null).next('OPERATION.SUCCES.CONTENT.MOVE');
|
||||
nodeActions.moveNodes(null).next('OPERATION.SUCCESS.CONTENT.MOVE');
|
||||
const movedItems = {
|
||||
failed: [],
|
||||
partiallySucceeded: [],
|
||||
@ -625,7 +621,7 @@ describe('ContentManagementService', () => {
|
||||
};
|
||||
|
||||
store.dispatch(new MoveNodesAction(selection));
|
||||
nodeActions.moveNodes(null).next('OPERATION.SUCCES.CONTENT.MOVE');
|
||||
nodeActions.moveNodes(null).next('OPERATION.SUCCESS.CONTENT.MOVE');
|
||||
nodeActions.contentMoved.next(movedItems);
|
||||
|
||||
expect(nodeActions.moveNodeAction).toHaveBeenCalledWith(node.entry, initialParent);
|
||||
@ -657,7 +653,7 @@ describe('ContentManagementService', () => {
|
||||
};
|
||||
|
||||
store.dispatch(new MoveNodesAction(selection));
|
||||
nodeActions.moveNodes(null).next('OPERATION.SUCCES.CONTENT.MOVE');
|
||||
nodeActions.moveNodes(null).next('OPERATION.SUCCESS.CONTENT.MOVE');
|
||||
nodeActions.contentMoved.next(movedItems);
|
||||
|
||||
expect(contentApi.restoreNode).toHaveBeenCalled();
|
||||
@ -699,7 +695,7 @@ describe('ContentManagementService', () => {
|
||||
};
|
||||
|
||||
store.dispatch(new MoveNodesAction(selection));
|
||||
nodeActions.moveNodes(null).next('OPERATION.SUCCES.CONTENT.MOVE');
|
||||
nodeActions.moveNodes(null).next('OPERATION.SUCCESS.CONTENT.MOVE');
|
||||
nodeActions.contentMoved.next(movedItems);
|
||||
|
||||
expect(contentApi.restoreNode).toHaveBeenCalled();
|
||||
@ -731,7 +727,7 @@ describe('ContentManagementService', () => {
|
||||
};
|
||||
|
||||
store.dispatch(new MoveNodesAction(selection));
|
||||
nodeActions.moveNodes(null).next('OPERATION.SUCCES.CONTENT.MOVE');
|
||||
nodeActions.moveNodes(null).next('OPERATION.SUCCESS.CONTENT.MOVE');
|
||||
nodeActions.contentMoved.next(movedItems);
|
||||
|
||||
expect(contentApi.restoreNode).toHaveBeenCalled();
|
||||
@ -763,7 +759,7 @@ describe('ContentManagementService', () => {
|
||||
};
|
||||
|
||||
store.dispatch(new MoveNodesAction(selection));
|
||||
nodeActions.moveNodes(null).next('OPERATION.SUCCES.CONTENT.MOVE');
|
||||
nodeActions.moveNodes(null).next('OPERATION.SUCCESS.CONTENT.MOVE');
|
||||
nodeActions.contentMoved.next(movedItems);
|
||||
|
||||
expect(nodeActions.moveNodes).toHaveBeenCalled();
|
||||
|
@ -59,7 +59,7 @@ import { MatDialog } from '@angular/material/dialog';
|
||||
import { MatSnackBar } from '@angular/material/snack-bar';
|
||||
import { Store } from '@ngrx/store';
|
||||
import { forkJoin, Observable, of, Subject, zip } from 'rxjs';
|
||||
import { catchError, flatMap, map, mergeMap, take, tap } from 'rxjs/operators';
|
||||
import { catchError, map, mergeMap, take, tap } from 'rxjs/operators';
|
||||
import { NodePermissionsDialogComponent } from '../components/permissions/permission-dialog/node-permissions.dialog';
|
||||
import { NodeVersionsDialogComponent } from '../dialogs/node-versions/node-versions.dialog';
|
||||
import { NodeActionsService } from './node-actions.service';
|
||||
@ -1031,7 +1031,7 @@ export class ContentManagementService {
|
||||
getNodeInfo(): Observable<MinimalNodeEntryEntity> {
|
||||
return this.store.select(getAppSelection).pipe(
|
||||
take(1),
|
||||
flatMap(({ file }) => {
|
||||
mergeMap(({ file }) => {
|
||||
const id = (file as any).entry.nodeId || (file as any).entry.guid;
|
||||
if (!id) {
|
||||
return of(file.entry);
|
||||
|
@ -356,7 +356,7 @@ describe('NodeActionsService', () => {
|
||||
const spyOnDestinationPicker = spyOn(service, 'getContentNodeSelection').and.callThrough();
|
||||
spyOn(service, 'getEntryParentId').and.returnValue('parent-id');
|
||||
|
||||
let dialogData: any;
|
||||
let dialogData = null;
|
||||
const spyOnDialog = spyOn(dialog, 'open').and.callFake((_contentNodeSelectorComponent: any, data: any) => {
|
||||
dialogData = data;
|
||||
return { componentInstance: {} } as MatDialogRef<any>;
|
||||
|
@ -118,7 +118,7 @@ export class NodeActionsService {
|
||||
}
|
||||
|
||||
action$.subscribe((newContent) => {
|
||||
observable.next(`OPERATION.SUCCES.${type.toUpperCase()}.${action.toUpperCase()}`);
|
||||
observable.next(`OPERATION.SUCCESS.${type.toUpperCase()}.${action.toUpperCase()}`);
|
||||
|
||||
const processedData = this.processResponse(newContent);
|
||||
if (action === BatchOperationType.copy) {
|
||||
|
@ -62,7 +62,7 @@ export class AppEffects {
|
||||
})
|
||||
);
|
||||
|
||||
private redirectToLogin() {
|
||||
this.router.navigate(['login']);
|
||||
private redirectToLogin(): Promise<boolean> {
|
||||
return this.router.navigate(['login']);
|
||||
}
|
||||
}
|
||||
|
@ -212,7 +212,7 @@ function updateSelectedNodes(state: AppState, action: SetSelectedNodesAction): A
|
||||
if (nodes.length === 1) {
|
||||
file = nodes.find((entity: any) => {
|
||||
// workaround Shared
|
||||
return entity.entry.isFile || entity.entry.nodeId || entity.entry.sharedByUser ? true : false;
|
||||
return !!(entity.entry.isFile || entity.entry.nodeId || entity.entry.sharedByUser);
|
||||
});
|
||||
folder = nodes.find((entity: any) => entity.entry.isFolder);
|
||||
}
|
||||
@ -266,7 +266,7 @@ function handleSettingsUpdate(state: AppState, action: SetSettingsParameterActio
|
||||
const { payload } = action;
|
||||
|
||||
if (payload.name === 'languagePicker') {
|
||||
newState.languagePicker = payload.value ? true : false;
|
||||
newState.languagePicker = !!payload.value;
|
||||
}
|
||||
return newState;
|
||||
}
|
||||
|
2
src/typings.d.ts
vendored
2
src/typings.d.ts
vendored
@ -28,5 +28,3 @@ declare var module: NodeModule;
|
||||
interface NodeModule {
|
||||
id: string;
|
||||
}
|
||||
|
||||
interface WebKitFileEntry {}
|
||||
|
Loading…
x
Reference in New Issue
Block a user