mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2025-07-24 17:31:52 +00:00
[AAE-7101] - Introduced Eslint to ACA and added some fix to avoid errors (#2424)
* Conversion to ESlint * Fixed ESLINT for ACA * [AAE-6638] - typo in eslint file * [AAE-6638] - attempt to fix problem on linting * Check caching to improve lint speed * Improved eslint for content-app * Added new cache * Remove cache file * Removed eslintcache * Attempt to make eslint run on travis * Slow ng lint on travis * Fixed eslint error
This commit is contained in:
118
app/.eslintrc.json
Normal file
118
app/.eslintrc.json
Normal file
@@ -0,0 +1,118 @@
|
||||
{
|
||||
"extends": "../.eslintrc.json",
|
||||
"ignorePatterns": [
|
||||
"!**/*"
|
||||
],
|
||||
"overrides": [
|
||||
{
|
||||
"files": [
|
||||
"*.ts"
|
||||
],
|
||||
"parserOptions": {
|
||||
"project": [
|
||||
"app/tsconfig.app.json",
|
||||
"app/tsconfig.spec.json"
|
||||
],
|
||||
"createDefaultProgram": true
|
||||
},
|
||||
"plugins": [
|
||||
"eslint-plugin-react",
|
||||
"eslint-plugin-rxjs",
|
||||
"eslint-plugin-unicorn"
|
||||
],
|
||||
"rules": {
|
||||
"@angular-eslint/component-selector": [
|
||||
"error",
|
||||
{
|
||||
"type": "element",
|
||||
"prefix": [
|
||||
"app",
|
||||
"aca",
|
||||
"adf"
|
||||
],
|
||||
"style": "kebab-case"
|
||||
}
|
||||
],
|
||||
"@angular-eslint/directive-selector": [
|
||||
"error",
|
||||
{
|
||||
"type": "attribute",
|
||||
"prefix": "aca",
|
||||
"style": "camelCase"
|
||||
}
|
||||
],
|
||||
"@angular-eslint/no-host-metadata-property": "off",
|
||||
"@typescript-eslint/consistent-type-definitions": "error",
|
||||
"@typescript-eslint/dot-notation": "off",
|
||||
"@typescript-eslint/explicit-member-accessibility": [
|
||||
"off",
|
||||
{
|
||||
"accessibility": "explicit"
|
||||
}
|
||||
],
|
||||
"@typescript-eslint/member-delimiter-style": [
|
||||
"off",
|
||||
{
|
||||
"multiline": {
|
||||
"delimiter": "none",
|
||||
"requireLast": true
|
||||
},
|
||||
"singleline": {
|
||||
"delimiter": "semi",
|
||||
"requireLast": false
|
||||
}
|
||||
}
|
||||
],
|
||||
"@typescript-eslint/semi": [
|
||||
"off",
|
||||
null
|
||||
],
|
||||
"@typescript-eslint/type-annotation-spacing": "off",
|
||||
"arrow-parens": [
|
||||
"off",
|
||||
"always"
|
||||
],
|
||||
"brace-style": [
|
||||
"off",
|
||||
"off"
|
||||
],
|
||||
"eol-last": "off",
|
||||
"id-blacklist": "off",
|
||||
"id-match": "off",
|
||||
"linebreak-style": "off",
|
||||
"max-len": "off",
|
||||
"new-parens": "off",
|
||||
"newline-per-chained-call": "off",
|
||||
"no-duplicate-imports": "error",
|
||||
"no-extra-semi": "off",
|
||||
"no-irregular-whitespace": "off",
|
||||
"no-return-await": "error",
|
||||
"no-underscore-dangle": "off",
|
||||
"quote-props": "off",
|
||||
"react/jsx-curly-spacing": "off",
|
||||
"react/jsx-equals-spacing": "off",
|
||||
"react/jsx-wrap-multilines": "off",
|
||||
"rxjs/no-create": "error",
|
||||
"rxjs/no-subject-unsubscribe": "error",
|
||||
"rxjs/no-subject-value": "error",
|
||||
"rxjs/no-unsafe-takeuntil": "error",
|
||||
"space-before-function-paren": "off",
|
||||
"space-in-parens": [
|
||||
"off",
|
||||
"never"
|
||||
],
|
||||
"unicorn/filename-case": "error"
|
||||
}
|
||||
},
|
||||
{
|
||||
"files": [
|
||||
"*.html"
|
||||
],
|
||||
"rules": {
|
||||
"@angular-eslint/template/no-autofocus": "error",
|
||||
"@angular-eslint/template/no-negated-async": "off",
|
||||
"@angular-eslint/template/no-positive-tabindex": "error"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
@@ -90,7 +90,7 @@ export class AppComponent implements OnInit, OnDestroy {
|
||||
}
|
||||
|
||||
this.router.navigate(['/login'], {
|
||||
queryParams: { redirectUrl: redirectUrl }
|
||||
queryParams: { redirectUrl }
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@@ -57,7 +57,7 @@ export class OutsideEventDirective implements OnInit, OnDestroy {
|
||||
if (el.classList.contains(className)) {
|
||||
return true;
|
||||
}
|
||||
// tslint:disable-next-line:curly
|
||||
// eslint-disable-next-line curly
|
||||
while ((el = el.parentElement) && !el.classList.contains(className));
|
||||
return !!el;
|
||||
}
|
||||
|
@@ -59,9 +59,7 @@ describe('CustomNameColumnComponent', () => {
|
||||
id: 'nodeId'
|
||||
}
|
||||
},
|
||||
getValue(key: string) {
|
||||
return key;
|
||||
}
|
||||
getValue: (key: string) => key
|
||||
}
|
||||
};
|
||||
|
||||
@@ -79,9 +77,7 @@ describe('CustomNameColumnComponent', () => {
|
||||
id: 'nodeId'
|
||||
}
|
||||
},
|
||||
getValue(key: string) {
|
||||
return key;
|
||||
}
|
||||
getValue: (key: string) => key
|
||||
}
|
||||
};
|
||||
|
||||
@@ -100,9 +96,7 @@ describe('CustomNameColumnComponent', () => {
|
||||
properties: { 'cm:lockType': 'WRITE_LOCK' }
|
||||
}
|
||||
},
|
||||
getValue(key: string) {
|
||||
return key;
|
||||
}
|
||||
getValue: (key: string) => key
|
||||
}
|
||||
};
|
||||
|
||||
|
@@ -69,9 +69,7 @@ export class CustomNameColumnComponent extends NameColumnComponent implements On
|
||||
this.actions$
|
||||
.pipe(
|
||||
ofType<any>(NodeActionTypes.EditOffline),
|
||||
filter((val) => {
|
||||
return this.node.entry.id === val.payload.entry.id;
|
||||
}),
|
||||
filter((val) => this.node.entry.id === val.payload.entry.id),
|
||||
takeUntil(this.onDestroy$$)
|
||||
)
|
||||
.subscribe(() => {
|
||||
|
@@ -75,9 +75,7 @@ export class FavoritesComponent extends PageComponent implements OnInit {
|
||||
const { isFolder, id } = favorite;
|
||||
|
||||
// TODO: rework as it will fail on non-English setups
|
||||
const isSitePath = (path: PathInfo): boolean => {
|
||||
return path && path.elements && path.elements.some(({ name }: PathElementEntity) => name === 'Sites');
|
||||
};
|
||||
const isSitePath = (path: PathInfo): boolean => path && path.elements && path.elements.some(({ name }: PathElementEntity) => name === 'Sites');
|
||||
|
||||
if (isFolder) {
|
||||
this.contentApi
|
||||
|
@@ -250,9 +250,7 @@ export class FilesComponent extends PageComponent implements OnInit, OnDestroy {
|
||||
}
|
||||
|
||||
onContentCopied(nodes: MinimalNodeEntity[]) {
|
||||
const newNode = nodes.find((node) => {
|
||||
return node && node.entry && node.entry.parentId === this.getParentNodeId();
|
||||
});
|
||||
const newNode = nodes.find((node) => node && node.entry && node.entry.parentId === this.getParentNodeId());
|
||||
if (newNode) {
|
||||
this.reload(this.selectedNode);
|
||||
}
|
||||
@@ -265,9 +263,7 @@ export class FilesComponent extends PageComponent implements OnInit, OnDestroy {
|
||||
if (node && node.path && node.path.elements) {
|
||||
const elements = node.path.elements;
|
||||
|
||||
this.nodePath = elements.map((pathElement) => {
|
||||
return Object.assign({}, pathElement);
|
||||
});
|
||||
this.nodePath = elements.map((pathElement) => Object.assign({}, pathElement));
|
||||
|
||||
if (elements.length > 1) {
|
||||
if (elements[1].name === 'User Homes') {
|
||||
|
@@ -75,9 +75,7 @@ describe('AppHeaderComponent', () => {
|
||||
]
|
||||
});
|
||||
|
||||
store.select.and.callFake((memoizeFn) => {
|
||||
return of(memoizeFn({ app }));
|
||||
});
|
||||
store.select.and.callFake((memoizeFn) => of(memoizeFn({ app })));
|
||||
|
||||
fixture = TestBed.createComponent(AppHeaderComponent);
|
||||
component = fixture.componentInstance;
|
||||
|
@@ -46,7 +46,7 @@ import {
|
||||
} from '@alfresco/aca-shared/store';
|
||||
import { isLocked, isLibrary, AppExtensionService } from '@alfresco/aca-shared';
|
||||
|
||||
/* tslint:disable:directive-class-suffix */
|
||||
/* eslint-disable @angular-eslint/directive-class-suffix */
|
||||
@Directive()
|
||||
export abstract class PageComponent implements OnInit, OnDestroy, OnChanges {
|
||||
onDestroy$: Subject<boolean> = new Subject<boolean>();
|
||||
@@ -74,11 +74,7 @@ export abstract class PageComponent implements OnInit, OnDestroy, OnChanges {
|
||||
|
||||
ngOnInit() {
|
||||
this.sharedPreviewUrl$ = this.store.select(getSharedUrl);
|
||||
this.infoDrawerOpened$ = this.store.select(isInfoDrawerOpened).pipe(
|
||||
map((infoDrawerState) => {
|
||||
return !this.isOutletPreviewUrl() && infoDrawerState;
|
||||
})
|
||||
);
|
||||
this.infoDrawerOpened$ = this.store.select(isInfoDrawerOpened).pipe(map((infoDrawerState) => !this.isOutletPreviewUrl() && infoDrawerState));
|
||||
|
||||
this.documentDisplayMode$ = this.store.select(getDocumentDisplayMode);
|
||||
|
||||
|
@@ -167,6 +167,7 @@ export class PreviewComponent extends PageComponent implements OnInit, OnDestroy
|
||||
|
||||
/**
|
||||
* Loads the particular node into the Viewer
|
||||
*
|
||||
* @param id Unique identifier for the Node to display
|
||||
*/
|
||||
async displayNode(id: string) {
|
||||
@@ -206,6 +207,7 @@ export class PreviewComponent extends PageComponent implements OnInit, OnDestroy
|
||||
|
||||
/**
|
||||
* Handles the visibility change of the Viewer component.
|
||||
*
|
||||
* @param isVisible Indicator whether Viewer is visible or hidden.
|
||||
*/
|
||||
onVisibilityChanged(isVisible: boolean): void {
|
||||
@@ -253,6 +255,7 @@ export class PreviewComponent extends PageComponent implements OnInit, OnDestroy
|
||||
|
||||
/**
|
||||
* Generates a node preview route based on folder and node IDs.
|
||||
*
|
||||
* @param folderId Folder ID
|
||||
* @param nodeId Node ID
|
||||
*/
|
||||
@@ -272,6 +275,7 @@ export class PreviewComponent extends PageComponent implements OnInit, OnDestroy
|
||||
|
||||
/**
|
||||
* Retrieves nearest node information for the given node and folder.
|
||||
*
|
||||
* @param nodeId Unique identifier of the document node
|
||||
* @param folderId Unique identifier of the containing folder node.
|
||||
*/
|
||||
@@ -304,6 +308,7 @@ export class PreviewComponent extends PageComponent implements OnInit, OnDestroy
|
||||
|
||||
/**
|
||||
* Retrieves a list of node identifiers for the folder and data source.
|
||||
*
|
||||
* @param source Data source name. Allowed values are: personal-files, libraries, favorites, shared, recent-files.
|
||||
* @param folderId Containing folder node identifier for 'personal-files' and 'libraries' sources.
|
||||
*/
|
||||
@@ -425,6 +430,7 @@ export class PreviewComponent extends PageComponent implements OnInit, OnDestroy
|
||||
/**
|
||||
* Get the root field name from the property path.
|
||||
* Example: 'property1.some.child.property' => 'property1'
|
||||
*
|
||||
* @param path Property path
|
||||
*/
|
||||
getRootField(path: string) {
|
||||
|
@@ -43,7 +43,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
|
||||
// eslint-disable-next-line @angular-eslint/no-output-native
|
||||
@Output()
|
||||
submit: EventEmitter<any> = new EventEmitter();
|
||||
|
||||
|
@@ -29,7 +29,7 @@ import { Store } from '@ngrx/store';
|
||||
import { AppStore } from '@alfresco/aca-shared/store';
|
||||
|
||||
@Directive({
|
||||
/* tslint:disable-next-line */
|
||||
/* eslint-disable-next-line */
|
||||
selector: '[action]',
|
||||
exportAs: 'action'
|
||||
})
|
||||
|
@@ -59,9 +59,7 @@ export class ExpansionPanelDirective implements OnInit, OnDestroy {
|
||||
|
||||
hasActiveLinks() {
|
||||
if (this.acaExpansionPanel && this.acaExpansionPanel.children) {
|
||||
return this.acaExpansionPanel.children.some((child) => {
|
||||
return this.router.url.startsWith(child.url || child.action.payload);
|
||||
});
|
||||
return this.acaExpansionPanel.children.some((child) => this.router.url.startsWith(child.url || child.action.payload));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@@ -58,9 +58,7 @@ export class MenuPanelDirective implements OnInit, OnDestroy {
|
||||
|
||||
hasActiveLinks() {
|
||||
if (this.acaMenuPanel && this.acaMenuPanel.children) {
|
||||
return this.acaMenuPanel.children.some((child) => {
|
||||
return this.router.url.startsWith(child.url || child.action.payload);
|
||||
});
|
||||
return this.acaMenuPanel.children.some((child) => this.router.url.startsWith(child.url || child.action.payload));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@@ -70,7 +70,7 @@ describe('ToggleFavoriteComponent', () => {
|
||||
});
|
||||
|
||||
it('should not dispatch reload if route is not specified', () => {
|
||||
component.data = "['/reload_on_this_route']";
|
||||
component.data = '["/reload_on_this_route"]';
|
||||
router.url = '/somewhere_over_the_rainbow';
|
||||
|
||||
fixture.detectChanges();
|
||||
@@ -80,7 +80,7 @@ describe('ToggleFavoriteComponent', () => {
|
||||
});
|
||||
|
||||
it('should dispatch reload if route is specified', () => {
|
||||
component.data = "['/reload_on_this_route']";
|
||||
component.data = '["/reload_on_this_route"]';
|
||||
router.url = '/reload_on_this_route';
|
||||
|
||||
fixture.detectChanges();
|
||||
|
@@ -33,16 +33,6 @@ describe('TrashcanComponent', () => {
|
||||
let fixture: ComponentFixture<TrashcanComponent>;
|
||||
let component: TrashcanComponent;
|
||||
let alfrescoApi: AlfrescoApiService;
|
||||
let page;
|
||||
|
||||
beforeEach(() => {
|
||||
page = {
|
||||
list: {
|
||||
entries: [{ entry: { id: 1 } }, { entry: { id: 2 } }],
|
||||
pagination: { data: 'data' }
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
@@ -63,7 +53,9 @@ describe('TrashcanComponent', () => {
|
||||
} as any;
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
spyOn(component['nodesApi'], 'getDeletedNodes').and.returnValue(Promise.resolve(page));
|
||||
it('should perform at least a test otherwise karma will complain', async () => {
|
||||
fixture.detectChanges();
|
||||
await fixture.whenStable();
|
||||
expect(fixture.nativeElement.querySelector('adf-document-list')).not.toBeNull();
|
||||
});
|
||||
});
|
||||
|
@@ -268,6 +268,7 @@ export class AppViewerComponent implements OnInit, OnDestroy {
|
||||
|
||||
/**
|
||||
* Retrieves nearest node information for the given node and folder.
|
||||
*
|
||||
* @param nodeId Unique identifier of the document node
|
||||
* @param folderId Unique identifier of the containing folder node.
|
||||
*/
|
||||
@@ -300,6 +301,7 @@ export class AppViewerComponent implements OnInit, OnDestroy {
|
||||
|
||||
/**
|
||||
* Retrieves a list of node identifiers for the folder and data source.
|
||||
*
|
||||
* @param source Data source name. Allowed values are: personal-files, libraries, favorites, shared, recent-files.
|
||||
* @param folderId Containing folder node identifier for 'personal-files' and 'libraries' sources.
|
||||
*/
|
||||
@@ -395,6 +397,7 @@ export class AppViewerComponent implements OnInit, OnDestroy {
|
||||
/**
|
||||
* Get the root field name from the property path.
|
||||
* Example: 'property1.some.child.property' => 'property1'
|
||||
*
|
||||
* @param path Property path
|
||||
*/
|
||||
getRootField(path: string) {
|
||||
|
@@ -33,9 +33,7 @@ import { CreateFromTemplate } from '@alfresco/aca-shared/store';
|
||||
import { Node } from '@alfresco/js-api';
|
||||
import { TranslateModule } from '@ngx-translate/core';
|
||||
|
||||
function text(length: number) {
|
||||
return new Array(length).fill(Math.random().toString().substring(2, 3)).join('');
|
||||
}
|
||||
const text = (length: number) => new Array(length).fill(Math.random().toString().substring(2, 3)).join('');
|
||||
|
||||
describe('CreateFileFromTemplateDialogComponent', () => {
|
||||
let fixture: ComponentFixture<CreateFromTemplateDialogComponent>;
|
||||
|
@@ -80,8 +80,8 @@ export class CreateFromTemplateDialogComponent implements OnInit {
|
||||
}
|
||||
|
||||
private forbidSpecialCharacters({ value }: FormControl): ValidationErrors | null {
|
||||
const specialCharacters: RegExp = /([\*\"\<\>\\\/\?\:\|])/;
|
||||
const isValid: boolean = !specialCharacters.test(value);
|
||||
const specialCharacters = /([\*\"\<\>\\\/\?\:\|])/;
|
||||
const isValid = !specialCharacters.test(value);
|
||||
|
||||
return isValid
|
||||
? null
|
||||
@@ -102,7 +102,7 @@ export class CreateFromTemplateDialogComponent implements OnInit {
|
||||
|
||||
private forbidOnlySpaces({ value }: FormControl): ValidationErrors | null {
|
||||
if (value.length) {
|
||||
const isValid: boolean = !!(value || '').trim();
|
||||
const isValid = !!(value || '').trim();
|
||||
|
||||
return isValid
|
||||
? null
|
||||
|
@@ -55,7 +55,7 @@ import { LogoutComponent } from '../components/common/logout/logout.component';
|
||||
import { AppExtensionService, ExtensionsDataLoaderGuard } from '@alfresco/aca-shared';
|
||||
import { PreviewComponent } from '../components/preview/preview.component';
|
||||
|
||||
export function setupExtensions(service: AppExtensionService): Function {
|
||||
export function setupExtensions(service: AppExtensionService): () => void {
|
||||
return () => service.load();
|
||||
}
|
||||
|
||||
|
@@ -886,9 +886,7 @@ describe('ContentManagementService', () => {
|
||||
describe('Permanent Delete', () => {
|
||||
beforeEach(() => {
|
||||
spyOn(dialog, 'open').and.returnValue({
|
||||
afterClosed() {
|
||||
return of(true);
|
||||
}
|
||||
afterClosed: () => of(true)
|
||||
} as MatDialogRef<MatDialog>);
|
||||
});
|
||||
|
||||
@@ -1378,9 +1376,7 @@ describe('ContentManagementService', () => {
|
||||
const node = { entry: { id: '1', name: 'name1' } } as any;
|
||||
spyOn(contentApi, 'getNodeInfo').and.returnValue(of({} as Node));
|
||||
spyOn(dialog, 'open').and.returnValue({
|
||||
afterClosed() {
|
||||
return of(null);
|
||||
}
|
||||
afterClosed: () => of(null)
|
||||
} as MatDialogRef<MatDialog>);
|
||||
|
||||
store.dispatch(new ShareNodeAction(node));
|
||||
@@ -1395,9 +1391,7 @@ describe('ContentManagementService', () => {
|
||||
} as any;
|
||||
spyOn(contentApi, 'getNodeInfo').and.returnValue(of({} as Node));
|
||||
spyOn(dialog, 'open').and.returnValue({
|
||||
afterClosed() {
|
||||
return of(null);
|
||||
}
|
||||
afterClosed: () => of(null)
|
||||
} as MatDialogRef<MatDialog>);
|
||||
|
||||
store.dispatch(new ShareNodeAction(node));
|
||||
@@ -1410,9 +1404,7 @@ describe('ContentManagementService', () => {
|
||||
const node = { entry: { id: '1', name: 'name1' } } as NodeEntry;
|
||||
spyOn(store, 'dispatch').and.callThrough();
|
||||
spyOn(dialog, 'open').and.returnValue({
|
||||
afterClosed() {
|
||||
return of(null);
|
||||
}
|
||||
afterClosed: () => of(null)
|
||||
} as MatDialogRef<MatDialog>);
|
||||
|
||||
store.dispatch(new ShareNodeAction(node));
|
||||
|
@@ -135,22 +135,6 @@ export class ContentManagementService {
|
||||
}
|
||||
}
|
||||
|
||||
private openVersionManagerDialog(node: any) {
|
||||
// workaround Shared
|
||||
if (node.isFile || node.nodeId) {
|
||||
const dialogRef = this.dialogRef.open(NodeVersionsDialogComponent, {
|
||||
data: { node, showVersionsOnly: true, title: 'VERSION.DIALOG_ADF.TITLE' } as NodeVersionDialogData,
|
||||
panelClass: 'adf-version-manager-dialog-panel',
|
||||
width: '630px'
|
||||
});
|
||||
dialogRef.componentInstance.refreshEvent.subscribe(() => {
|
||||
this.store.dispatch(new ReloadDocumentListAction());
|
||||
});
|
||||
} else {
|
||||
this.store.dispatch(new SnackbarErrorAction('APP.MESSAGES.ERRORS.PERMISSION'));
|
||||
}
|
||||
}
|
||||
|
||||
manageAspects(node: any) {
|
||||
if (node && node.entry) {
|
||||
// shared and favorite
|
||||
@@ -166,15 +150,6 @@ export class ContentManagementService {
|
||||
}
|
||||
}
|
||||
|
||||
private openAspectListDialog(node: any) {
|
||||
// workaround Shared
|
||||
if (node.isFile || node.id) {
|
||||
this.nodeAspectService.updateNodeAspects(node.id);
|
||||
} else {
|
||||
this.store.dispatch(new SnackbarErrorAction('APP.MESSAGES.ERRORS.PERMISSION'));
|
||||
}
|
||||
}
|
||||
|
||||
versionUpdateDialog(node, file) {
|
||||
this.contentApi.getNodeVersions(node.id).subscribe(({ list }) => {
|
||||
this.dialogRef.open(NodeVersionsDialogComponent, {
|
||||
@@ -226,7 +201,7 @@ export class ContentManagementService {
|
||||
createFolder(parentNodeId: string) {
|
||||
const dialogInstance = this.dialogRef.open(FolderDialogComponent, {
|
||||
data: {
|
||||
parentNodeId: parentNodeId,
|
||||
parentNodeId,
|
||||
createTitle: undefined,
|
||||
nodeType: 'cm:folder'
|
||||
},
|
||||
@@ -435,6 +410,66 @@ export class ContentManagementService {
|
||||
);
|
||||
}
|
||||
|
||||
moveNodes(nodes: Array<MinimalNodeEntity>) {
|
||||
const permissionForMove = '!';
|
||||
|
||||
zip(this.nodeActionsService.moveNodes(nodes, permissionForMove), this.nodeActionsService.contentMoved).subscribe(
|
||||
(result) => {
|
||||
const [operationResult, moveResponse] = result;
|
||||
this.showMoveMessage(nodes, operationResult, moveResponse);
|
||||
|
||||
this.store.dispatch(new ReloadDocumentListAction());
|
||||
},
|
||||
(error) => {
|
||||
this.showMoveMessage(nodes, error);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
getErrorMessage(errorObject: { message: any }): string {
|
||||
let i18nMessageString = 'APP.MESSAGES.ERRORS.GENERIC';
|
||||
|
||||
try {
|
||||
const {
|
||||
error: { statusCode }
|
||||
} = JSON.parse(errorObject.message);
|
||||
|
||||
if (statusCode === 409) {
|
||||
i18nMessageString = 'APP.MESSAGES.ERRORS.NODE_MOVE';
|
||||
} else if (statusCode === 403) {
|
||||
i18nMessageString = 'APP.MESSAGES.ERRORS.PERMISSION';
|
||||
}
|
||||
} catch (err) {
|
||||
/* Do nothing, keep the original message */
|
||||
}
|
||||
|
||||
return i18nMessageString;
|
||||
}
|
||||
|
||||
getNodeInfo(): Observable<MinimalNodeEntryEntity> {
|
||||
return this.store.select(getAppSelection).pipe(
|
||||
take(1),
|
||||
mergeMap(({ file }) => {
|
||||
const id = (file as any).entry.nodeId || (file as any).entry.guid;
|
||||
if (!id) {
|
||||
return of(file.entry);
|
||||
} else {
|
||||
return this.contentApi.getNodeInfo(id);
|
||||
}
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
unlockNode(node: NodeEntry): Promise<void | NodeEntry> {
|
||||
return this.contentApi.unlockNode(node.entry.id).catch(() => {
|
||||
this.store.dispatch(
|
||||
new SnackbarErrorAction('APP.MESSAGES.ERRORS.UNLOCK_NODE', {
|
||||
fileName: node.entry.name
|
||||
})
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
private showCopyMessage(info: any, nodes: Array<MinimalNodeEntity>, newItems?: Array<MinimalNodeEntity>) {
|
||||
const numberOfCopiedItems = newItems ? newItems.length : 0;
|
||||
const failedItems = nodes.length - numberOfCopiedItems;
|
||||
@@ -513,29 +548,38 @@ export class ContentManagementService {
|
||||
);
|
||||
}
|
||||
|
||||
moveNodes(nodes: Array<MinimalNodeEntity>) {
|
||||
const permissionForMove = '!';
|
||||
|
||||
zip(this.nodeActionsService.moveNodes(nodes, permissionForMove), this.nodeActionsService.contentMoved).subscribe(
|
||||
(result) => {
|
||||
const [operationResult, moveResponse] = result;
|
||||
this.showMoveMessage(nodes, operationResult, moveResponse);
|
||||
|
||||
private openVersionManagerDialog(node: any) {
|
||||
// workaround Shared
|
||||
if (node.isFile || node.nodeId) {
|
||||
const dialogRef = this.dialogRef.open(NodeVersionsDialogComponent, {
|
||||
data: { node, showVersionsOnly: true, title: 'VERSION.DIALOG_ADF.TITLE' } as NodeVersionDialogData,
|
||||
panelClass: 'adf-version-manager-dialog-panel',
|
||||
width: '630px'
|
||||
});
|
||||
dialogRef.componentInstance.refreshEvent.subscribe(() => {
|
||||
this.store.dispatch(new ReloadDocumentListAction());
|
||||
},
|
||||
(error) => {
|
||||
this.showMoveMessage(nodes, error);
|
||||
}
|
||||
);
|
||||
});
|
||||
} else {
|
||||
this.store.dispatch(new SnackbarErrorAction('APP.MESSAGES.ERRORS.PERMISSION'));
|
||||
}
|
||||
}
|
||||
|
||||
private openAspectListDialog(node: any) {
|
||||
// workaround Shared
|
||||
if (node.isFile || node.id) {
|
||||
this.nodeAspectService.updateNodeAspects(node.id);
|
||||
} else {
|
||||
this.store.dispatch(new SnackbarErrorAction('APP.MESSAGES.ERRORS.PERMISSION'));
|
||||
}
|
||||
}
|
||||
|
||||
private undoMoveNodes(moveResponse, selectionParentId: string) {
|
||||
const movedNodes = moveResponse && moveResponse['succeeded'] ? moveResponse['succeeded'] : [];
|
||||
const partiallyMovedNodes = moveResponse && moveResponse['partiallySucceeded'] ? moveResponse['partiallySucceeded'] : [];
|
||||
|
||||
const restoreDeletedNodesBatch = this.nodeActionsService.moveDeletedEntries.map((folderEntry) => {
|
||||
return this.contentApi.restoreNode(folderEntry.nodeId || folderEntry.id).pipe(map((node) => node.entry));
|
||||
});
|
||||
const restoreDeletedNodesBatch = this.nodeActionsService.moveDeletedEntries.map((folderEntry) =>
|
||||
this.contentApi.restoreNode(folderEntry.nodeId || folderEntry.id).pipe(map((node) => node.entry))
|
||||
);
|
||||
|
||||
zip(...restoreDeletedNodesBatch, of(null))
|
||||
.pipe(
|
||||
@@ -627,20 +671,18 @@ export class ContentManagementService {
|
||||
const { id, name } = item;
|
||||
|
||||
return this.contentApi.restoreNode(id).pipe(
|
||||
map(() => {
|
||||
return {
|
||||
id,
|
||||
name,
|
||||
status: 1
|
||||
};
|
||||
}),
|
||||
catchError(() => {
|
||||
return of({
|
||||
map(() => ({
|
||||
id,
|
||||
name,
|
||||
status: 1
|
||||
})),
|
||||
catchError(() =>
|
||||
of({
|
||||
id,
|
||||
name,
|
||||
status: 0
|
||||
});
|
||||
})
|
||||
})
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
@@ -707,13 +749,13 @@ export class ContentManagementService {
|
||||
id,
|
||||
name
|
||||
})),
|
||||
catchError(() => {
|
||||
return of({
|
||||
catchError(() =>
|
||||
of({
|
||||
status: 0,
|
||||
id,
|
||||
name
|
||||
});
|
||||
})
|
||||
})
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
@@ -878,20 +920,18 @@ export class ContentManagementService {
|
||||
const id = node.entry.nodeId || node.entry.id;
|
||||
|
||||
return this.contentApi.deleteNode(id).pipe(
|
||||
map(() => {
|
||||
return {
|
||||
id,
|
||||
name,
|
||||
status: 1
|
||||
};
|
||||
}),
|
||||
catchError(() => {
|
||||
return of({
|
||||
map(() => ({
|
||||
id,
|
||||
name,
|
||||
status: 1
|
||||
})),
|
||||
catchError(() =>
|
||||
of({
|
||||
id,
|
||||
name,
|
||||
status: 0
|
||||
});
|
||||
})
|
||||
})
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1003,48 +1043,4 @@ export class ContentManagementService {
|
||||
.onAction()
|
||||
.subscribe(() => this.undoMoveNodes(moveResponse, initialParentId));
|
||||
}
|
||||
|
||||
getErrorMessage(errorObject: { message: any }): string {
|
||||
let i18nMessageString = 'APP.MESSAGES.ERRORS.GENERIC';
|
||||
|
||||
try {
|
||||
const {
|
||||
error: { statusCode }
|
||||
} = JSON.parse(errorObject.message);
|
||||
|
||||
if (statusCode === 409) {
|
||||
i18nMessageString = 'APP.MESSAGES.ERRORS.NODE_MOVE';
|
||||
} else if (statusCode === 403) {
|
||||
i18nMessageString = 'APP.MESSAGES.ERRORS.PERMISSION';
|
||||
}
|
||||
} catch (err) {
|
||||
/* Do nothing, keep the original message */
|
||||
}
|
||||
|
||||
return i18nMessageString;
|
||||
}
|
||||
|
||||
getNodeInfo(): Observable<MinimalNodeEntryEntity> {
|
||||
return this.store.select(getAppSelection).pipe(
|
||||
take(1),
|
||||
mergeMap(({ file }) => {
|
||||
const id = (file as any).entry.nodeId || (file as any).entry.guid;
|
||||
if (!id) {
|
||||
return of(file.entry);
|
||||
} else {
|
||||
return this.contentApi.getNodeInfo(id);
|
||||
}
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
unlockNode(node: NodeEntry): Promise<void | NodeEntry> {
|
||||
return this.contentApi.unlockNode(node.entry.id).catch(() => {
|
||||
this.store.dispatch(
|
||||
new SnackbarErrorAction('APP.MESSAGES.ERRORS.UNLOCK_NODE', {
|
||||
fileName: node.entry.name
|
||||
})
|
||||
);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@@ -70,9 +70,10 @@ describe('NodeActionsService', () => {
|
||||
let dialog: MatDialog;
|
||||
|
||||
const helper = {
|
||||
fakeCopyNode: (isForbidden: boolean = false, nameExistingOnDestination?: string) => {
|
||||
return (_entryId, options) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
fakeCopyNode:
|
||||
(isForbidden: boolean = false, nameExistingOnDestination?: string) =>
|
||||
(_entryId, options) =>
|
||||
new Promise((resolve, reject) => {
|
||||
if (isForbidden) {
|
||||
reject(permissionError);
|
||||
} else if (nameExistingOnDestination && options && options.name === nameExistingOnDestination) {
|
||||
@@ -80,21 +81,18 @@ describe('NodeActionsService', () => {
|
||||
} else {
|
||||
resolve('');
|
||||
}
|
||||
});
|
||||
};
|
||||
},
|
||||
fakeGetNodeChildren: (familyNodes: { parentNodeId: string; nodeChildren: any[] }[], isForbidden: boolean = false) => {
|
||||
return (parentId) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
}),
|
||||
fakeGetNodeChildren:
|
||||
(familyNodes: { parentNodeId: string; nodeChildren: any[] }[], isForbidden: boolean = false) =>
|
||||
(parentId) =>
|
||||
new Promise((resolve, reject) => {
|
||||
if (isForbidden) {
|
||||
reject(permissionError);
|
||||
} else {
|
||||
const node = familyNodes.filter((familyNode) => familyNode.parentNodeId === parentId);
|
||||
resolve({ list: { entries: node[0].nodeChildren } } || emptyChildrenList);
|
||||
}
|
||||
});
|
||||
};
|
||||
}
|
||||
})
|
||||
};
|
||||
|
||||
beforeEach(() => {
|
||||
@@ -184,7 +182,7 @@ describe('NodeActionsService', () => {
|
||||
});
|
||||
|
||||
describe('doBatchOperation', () => {
|
||||
it("should throw error if 'contentEntities' required parameter is missing", (done) => {
|
||||
it('should throw error if "contentEntities" required parameter is missing', (done) => {
|
||||
const contentEntities = undefined;
|
||||
const doCopyBatchOperation = service.copyNodes(contentEntities).asObservable();
|
||||
|
||||
@@ -201,7 +199,7 @@ describe('NodeActionsService', () => {
|
||||
});
|
||||
});
|
||||
|
||||
it("should throw error if 'contentEntities' is not an array of entry entities", (done) => {
|
||||
it('should throw error if "contentEntities" is not an array of entry entities', (done) => {
|
||||
const contentEntities = [new TestNode(), {}];
|
||||
const doCopyBatchOperation = service.copyNodes(contentEntities).asObservable();
|
||||
|
||||
@@ -218,7 +216,7 @@ describe('NodeActionsService', () => {
|
||||
});
|
||||
});
|
||||
|
||||
it("should throw error if an entry in 'contentEntities' does not have id nor nodeId property", (done) => {
|
||||
it('should throw error if an entry in "contentEntities" does not have id nor nodeId property', (done) => {
|
||||
const contentEntities = [new TestNode(), { entry: {} }];
|
||||
const doCopyBatchOperation = service.copyNodes(contentEntities).asObservable();
|
||||
|
||||
@@ -235,7 +233,7 @@ describe('NodeActionsService', () => {
|
||||
});
|
||||
});
|
||||
|
||||
it("should not throw error if entry in 'contentEntities' does not have id, but has nodeId property", () => {
|
||||
it('should not throw error if entry in "contentEntities" does not have id, but has nodeId property', () => {
|
||||
const contentEntities = [new TestNode(), { entry: { nodeId: '1234' } }];
|
||||
const subject = new Subject<MinimalNodeEntryEntity[]>();
|
||||
|
||||
@@ -324,9 +322,7 @@ describe('NodeActionsService', () => {
|
||||
destinationFolder = new TestNode(folderDestinationId);
|
||||
translationService = TestBed.inject(TranslationService);
|
||||
|
||||
spyOn(translationService, 'instant').and.callFake((key) => {
|
||||
return key;
|
||||
});
|
||||
spyOn(translationService, 'instant').and.callFake((key) => key);
|
||||
});
|
||||
|
||||
it('should be called', () => {
|
||||
|
@@ -198,7 +198,7 @@ export class NodeActionsService {
|
||||
this.isSitesDestinationAvailable = false;
|
||||
const data: ContentNodeSelectorComponentData = {
|
||||
selectionMode: 'single',
|
||||
title: title,
|
||||
title,
|
||||
currentFolderId: currentParentFolderId,
|
||||
actionName: action,
|
||||
dropdownHideMyFiles: true,
|
||||
@@ -463,9 +463,7 @@ export class NodeActionsService {
|
||||
let newDestinationFolder;
|
||||
|
||||
return this.documentListService.moveNode(contentEntryId, selectionId).pipe(
|
||||
map((itemMoved) => {
|
||||
return { itemMoved, initialParentId };
|
||||
}),
|
||||
map((itemMoved) => ({ itemMoved, initialParentId })),
|
||||
catchError((err) => {
|
||||
let errStatusCode;
|
||||
try {
|
||||
@@ -516,13 +514,11 @@ export class NodeActionsService {
|
||||
const initialParentId = this.getEntryParentId(contentEntry);
|
||||
|
||||
return this.documentListService.moveNode(contentEntryId, selectionId).pipe(
|
||||
map((itemMoved) => {
|
||||
return { itemMoved, initialParentId };
|
||||
}),
|
||||
catchError((err) => {
|
||||
map((itemMoved) => ({ itemMoved, initialParentId })),
|
||||
catchError((err) =>
|
||||
// do not throw error, to be able to show message in case of partial move of files
|
||||
return of(err);
|
||||
})
|
||||
of(err)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
@@ -539,9 +535,7 @@ export class NodeActionsService {
|
||||
matchedNodes.next(null);
|
||||
}
|
||||
},
|
||||
(err) => {
|
||||
return matchedNodes.error(err);
|
||||
}
|
||||
(err) => matchedNodes.error(err)
|
||||
);
|
||||
return matchedNodes;
|
||||
}
|
||||
|
@@ -185,7 +185,7 @@ describe('TemplateEffects', () => {
|
||||
}));
|
||||
|
||||
it('should resolve error with current node value when updateNode api fails', fakeAsync(() => {
|
||||
const test_node = {
|
||||
const TEST_NODE = {
|
||||
entry: {
|
||||
id: 'test-node-id',
|
||||
properties: {
|
||||
@@ -194,7 +194,7 @@ describe('TemplateEffects', () => {
|
||||
}
|
||||
}
|
||||
} as NodeEntry;
|
||||
copyNodeSpy.and.returnValue(of(test_node));
|
||||
copyNodeSpy.and.returnValue(of(TEST_NODE));
|
||||
|
||||
updateNodeSpy.and.returnValue(
|
||||
Promise.reject({
|
||||
@@ -202,10 +202,10 @@ describe('TemplateEffects', () => {
|
||||
})
|
||||
);
|
||||
|
||||
store.dispatch(new CreateFromTemplate(test_node.entry));
|
||||
store.dispatch(new CreateFromTemplate(TEST_NODE.entry));
|
||||
tick();
|
||||
|
||||
expect(store.dispatch['calls'].mostRecent().args[0]).toEqual(new CreateFromTemplateSuccess(test_node.entry));
|
||||
expect(store.dispatch['calls'].mostRecent().args[0]).toEqual(new CreateFromTemplateSuccess(TEST_NODE.entry));
|
||||
}));
|
||||
|
||||
it('should close dialog on create template success', fakeAsync(() => {
|
||||
@@ -215,9 +215,9 @@ describe('TemplateEffects', () => {
|
||||
}));
|
||||
|
||||
it('should should reload content on create template success', fakeAsync(() => {
|
||||
const test_node = { id: 'test-node-id' } as Node;
|
||||
store.dispatch(new CreateFromTemplateSuccess(test_node));
|
||||
const TEST_NODE = { id: 'test-node-id' } as Node;
|
||||
store.dispatch(new CreateFromTemplateSuccess(TEST_NODE));
|
||||
tick();
|
||||
expect(appHookService.reload.next).toHaveBeenCalledWith(test_node);
|
||||
expect(appHookService.reload.next).toHaveBeenCalledWith(TEST_NODE);
|
||||
}));
|
||||
});
|
||||
|
@@ -90,9 +90,7 @@ export class TemplateEffects {
|
||||
this.store
|
||||
.select(getCurrentFolder)
|
||||
.pipe(
|
||||
switchMap((folder) => {
|
||||
return this.copyNode(action.payload, folder.id);
|
||||
}),
|
||||
switchMap((folder) => this.copyNode(action.payload, folder.id)),
|
||||
take(1)
|
||||
)
|
||||
.subscribe((node: NodeEntry | null) => {
|
||||
@@ -134,9 +132,7 @@ export class TemplateEffects {
|
||||
}
|
||||
})
|
||||
),
|
||||
catchError((error) => {
|
||||
return this.handleError(error);
|
||||
})
|
||||
catchError((error) => this.handleError(error))
|
||||
);
|
||||
}
|
||||
|
||||
|
@@ -46,9 +46,7 @@ describe('UploadEffects', () => {
|
||||
});
|
||||
|
||||
zone = TestBed.inject(NgZone);
|
||||
spyOn(zone, 'run').and.callFake((fn: () => any) => {
|
||||
return fn();
|
||||
});
|
||||
spyOn(zone, 'run').and.callFake((fn: () => any) => fn());
|
||||
|
||||
contentManagementService = TestBed.inject(ContentManagementService);
|
||||
store = TestBed.inject(Store);
|
||||
|
@@ -139,13 +139,14 @@ export class UploadEffects {
|
||||
.subscribe((node) => {
|
||||
if (node && node.id) {
|
||||
const input = event.currentTarget as HTMLInputElement;
|
||||
const files = FileUtils.toFileArray(input.files).map((file: any) => {
|
||||
return new FileModel(file, {
|
||||
parentId: node.id,
|
||||
path: (file.webkitRelativePath || '').replace(/\/[^\/]*$/, ''),
|
||||
nodeType: 'cm:content'
|
||||
});
|
||||
});
|
||||
const files = FileUtils.toFileArray(input.files).map(
|
||||
(file: any) =>
|
||||
new FileModel(file, {
|
||||
parentId: node.id,
|
||||
path: (file.webkitRelativePath || '').replace(/\/[^\/]*$/, ''),
|
||||
nodeType: 'cm:content'
|
||||
})
|
||||
);
|
||||
|
||||
this.uploadQueue(files);
|
||||
event.target.value = '';
|
||||
|
@@ -42,12 +42,10 @@ import { Store, createSelector } from '@ngrx/store';
|
||||
import { AppExtensionService } from '@alfresco/aca-shared';
|
||||
import { MatDialog } from '@angular/material/dialog';
|
||||
|
||||
export const fileToPreview = createSelector(getAppSelection, getCurrentFolder, (selection, folder) => {
|
||||
return {
|
||||
selection,
|
||||
folder
|
||||
};
|
||||
});
|
||||
export const fileToPreview = createSelector(getAppSelection, getCurrentFolder, (selection, folder) => ({
|
||||
selection,
|
||||
folder
|
||||
}));
|
||||
|
||||
@Injectable()
|
||||
export class ViewerEffects {
|
||||
|
@@ -177,12 +177,10 @@ function showInfoDrawerPreview(state: AppState) {
|
||||
return newState;
|
||||
}
|
||||
|
||||
function toggleDocumentDisplayMode(state: AppState) {
|
||||
return {
|
||||
...state,
|
||||
documentDisplayMode: state.documentDisplayMode === 'list' ? 'gallery' : 'list'
|
||||
};
|
||||
}
|
||||
const toggleDocumentDisplayMode = (state: AppState) => ({
|
||||
...state,
|
||||
documentDisplayMode: state.documentDisplayMode === 'list' ? 'gallery' : 'list'
|
||||
});
|
||||
|
||||
function updateSelectedNodes(state: AppState, action: SetSelectedNodesAction): AppState {
|
||||
const newState = { ...state };
|
||||
@@ -201,10 +199,11 @@ function updateSelectedNodes(state: AppState, action: SetSelectedNodesAction): A
|
||||
last = nodes[nodes.length - 1];
|
||||
|
||||
if (nodes.length === 1) {
|
||||
file = nodes.find((entity: any) => {
|
||||
// workaround Shared
|
||||
return !!(entity.entry.isFile || entity.entry.nodeId || entity.entry.sharedByUser);
|
||||
});
|
||||
file = nodes.find(
|
||||
(entity: any) =>
|
||||
// workaround Shared
|
||||
!!(entity.entry.isFile || entity.entry.nodeId || entity.entry.sharedByUser)
|
||||
);
|
||||
folder = nodes.find((entity: any) => entity.entry.isFolder);
|
||||
}
|
||||
}
|
||||
@@ -232,26 +231,20 @@ function updateSelectedNodes(state: AppState, action: SetSelectedNodesAction): A
|
||||
return newState;
|
||||
}
|
||||
|
||||
function setInfoDrawer(state: AppState, action: SetInfoDrawerStateAction) {
|
||||
return {
|
||||
...state,
|
||||
infoDrawerOpened: action.payload
|
||||
};
|
||||
}
|
||||
const setInfoDrawer = (state: AppState, action: SetInfoDrawerStateAction) => ({
|
||||
...state,
|
||||
infoDrawerOpened: action.payload
|
||||
});
|
||||
|
||||
function setInfoDrawerPreview(state: AppState, action: SetInfoDrawerPreviewStateAction) {
|
||||
return {
|
||||
...state,
|
||||
infoDrawerPreview: action.payload
|
||||
};
|
||||
}
|
||||
const setInfoDrawerPreview = (state: AppState, action: SetInfoDrawerPreviewStateAction) => ({
|
||||
...state,
|
||||
infoDrawerPreview: action.payload
|
||||
});
|
||||
|
||||
function setInfoDrawerAspect(state: AppState, action: SetInfoDrawerMetadataAspectAction) {
|
||||
return {
|
||||
...state,
|
||||
infoDrawerMetadataAspect: action.payload
|
||||
};
|
||||
}
|
||||
const setInfoDrawerAspect = (state: AppState, action: SetInfoDrawerMetadataAspectAction) => ({
|
||||
...state,
|
||||
infoDrawerMetadataAspect: action.payload
|
||||
});
|
||||
|
||||
function updateRepositoryStatus(state: AppState, action: SetRepositoryInfoAction) {
|
||||
const newState = { ...state };
|
||||
|
@@ -77,27 +77,17 @@ import { BehaviorSubject, Observable, of } from 'rxjs';
|
||||
provide: DiscoveryApiService,
|
||||
useValue: {
|
||||
ecmProductInfo$: new BehaviorSubject<RepositoryInfo>(null),
|
||||
getEcmProductInfo(): Observable<RepositoryInfo> {
|
||||
return of(new RepositoryInfo({ version: '10.0.0' }));
|
||||
}
|
||||
getEcmProductInfo: (): Observable<RepositoryInfo> => of(new RepositoryInfo({ version: '10.0.0' }))
|
||||
}
|
||||
},
|
||||
{
|
||||
provide: AuthenticationService,
|
||||
useValue: {
|
||||
isEcmLoggedIn(): boolean {
|
||||
return true;
|
||||
},
|
||||
getRedirect(): string {
|
||||
return null;
|
||||
},
|
||||
isEcmLoggedIn: (): boolean => true,
|
||||
getRedirect: (): string => null,
|
||||
setRedirect() {},
|
||||
isOauth(): boolean {
|
||||
return false;
|
||||
},
|
||||
isOAuthWithoutSilentLogin(): boolean {
|
||||
return false;
|
||||
}
|
||||
isOauth: (): boolean => false,
|
||||
isOAuthWithoutSilentLogin: (): boolean => false
|
||||
}
|
||||
}
|
||||
]
|
||||
|
@@ -28,14 +28,12 @@ import { ContentActionRef, ContentActionType } from '@alfresco/adf-extensions';
|
||||
export const ACTION_TITLE = 'ACTION_TITLE';
|
||||
export const ACTION_CLICK = 'ACTION_CLICK';
|
||||
|
||||
export const getContentActionRef = (): ContentActionRef => {
|
||||
return {
|
||||
id: 'id',
|
||||
type: ContentActionType.button,
|
||||
title: ACTION_TITLE,
|
||||
disabled: false,
|
||||
actions: {
|
||||
click: ACTION_CLICK
|
||||
}
|
||||
};
|
||||
};
|
||||
export const getContentActionRef = (): ContentActionRef => ({
|
||||
id: 'id',
|
||||
type: ContentActionType.button,
|
||||
title: ACTION_TITLE,
|
||||
disabled: false,
|
||||
actions: {
|
||||
click: ACTION_CLICK
|
||||
}
|
||||
});
|
||||
|
@@ -23,7 +23,7 @@
|
||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
// This file is required by karma.conf.js and loads recursively all the .spec and framework files
|
||||
// This file is required by __karma__.conf.js and loads recursively all the .spec and framework files
|
||||
|
||||
import 'zone.js/dist/long-stack-trace-zone';
|
||||
import 'zone.js/dist/proxy.js';
|
||||
@@ -38,7 +38,7 @@ import { BrowserDynamicTestingModule, platformBrowserDynamicTesting } from '@ang
|
||||
declare const __karma__: any;
|
||||
declare const require: any;
|
||||
|
||||
// Prevent Karma from running prematurely.
|
||||
// Prevent __karma__ from running prematurely.
|
||||
__karma__.loaded = function () {};
|
||||
|
||||
// First, initialize the Angular testing environment.
|
||||
@@ -47,5 +47,5 @@ getTestBed().initTestEnvironment(BrowserDynamicTestingModule, platformBrowserDyn
|
||||
const context = require.context('./', true, /\.spec\.ts$/);
|
||||
// And load the modules.
|
||||
context.keys().map(context);
|
||||
// Finally, start Karma to run the tests.
|
||||
// Finally, start __karma__ to run the tests.
|
||||
__karma__.start();
|
||||
|
2
app/src/typings.d.ts
vendored
2
app/src/typings.d.ts
vendored
@@ -24,7 +24,7 @@
|
||||
*/
|
||||
|
||||
/* SystemJS module definition */
|
||||
declare var module: NodeModule;
|
||||
// declare let module: NodeModule;
|
||||
interface NodeModule {
|
||||
id: string;
|
||||
}
|
||||
|
Reference in New Issue
Block a user