mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2025-07-31 17:38:28 +00:00
[ACA-2871] Create File from template - filter link files (#1298)
* filter rows * tests * small rename of the tests Co-authored-by: Adina Parpalita <adina.parpalita@ness.com>
This commit is contained in:
committed by
Adina Parpalita
parent
fd970c1ef1
commit
503075143b
@@ -153,4 +153,52 @@ describe('CreateFileFromTemplateService', () => {
|
|||||||
new SnackbarErrorAction('APP.MESSAGES.ERRORS.GENERIC')
|
new SnackbarErrorAction('APP.MESSAGES.ERRORS.GENERIC')
|
||||||
);
|
);
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
it('should return true if row is not a `link` nodeType', () => {
|
||||||
|
spyOn(
|
||||||
|
alfrescoApiService.getInstance().nodes,
|
||||||
|
'getNodeInfo'
|
||||||
|
).and.returnValue(
|
||||||
|
of({
|
||||||
|
id: 'templates-folder-id',
|
||||||
|
path: {
|
||||||
|
elements: [],
|
||||||
|
name: '/Company Home/Data Dictionary'
|
||||||
|
}
|
||||||
|
})
|
||||||
|
);
|
||||||
|
spyOn(dialog, 'open');
|
||||||
|
|
||||||
|
createFileFromTemplateService.openTemplatesDialog();
|
||||||
|
|
||||||
|
expect(
|
||||||
|
dialog.open['calls'].argsFor(0)[1].data.rowFilter({
|
||||||
|
node: { entry: { nodeType: 'text' } }
|
||||||
|
})
|
||||||
|
).toBe(true);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should return false if row is a `link` nodeType', () => {
|
||||||
|
spyOn(
|
||||||
|
alfrescoApiService.getInstance().nodes,
|
||||||
|
'getNodeInfo'
|
||||||
|
).and.returnValue(
|
||||||
|
of({
|
||||||
|
id: 'templates-folder-id',
|
||||||
|
path: {
|
||||||
|
elements: [],
|
||||||
|
name: '/Company Home/Data Dictionary'
|
||||||
|
}
|
||||||
|
})
|
||||||
|
);
|
||||||
|
spyOn(dialog, 'open');
|
||||||
|
|
||||||
|
createFileFromTemplateService.openTemplatesDialog();
|
||||||
|
|
||||||
|
expect(
|
||||||
|
dialog.open['calls'].argsFor(0)[1].data.rowFilter({
|
||||||
|
node: { entry: { nodeType: 'app:filelink' } }
|
||||||
|
})
|
||||||
|
).toBe(false);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
@@ -27,14 +27,15 @@ import { Injectable } from '@angular/core';
|
|||||||
import { MatDialog, MatDialogConfig, MatDialogRef } from '@angular/material';
|
import { MatDialog, MatDialogConfig, MatDialogRef } from '@angular/material';
|
||||||
import { CreateFileFromTemplateDialogComponent } from '../dialogs/node-templates/create-from-template.dialog';
|
import { CreateFileFromTemplateDialogComponent } from '../dialogs/node-templates/create-from-template.dialog';
|
||||||
import { Subject, from, of } from 'rxjs';
|
import { Subject, from, of } from 'rxjs';
|
||||||
import { Node, MinimalNode } from '@alfresco/js-api';
|
import { Node, MinimalNode, MinimalNodeEntryEntity } from '@alfresco/js-api';
|
||||||
import { AlfrescoApiService, TranslationService } from '@alfresco/adf-core';
|
import { AlfrescoApiService, TranslationService } from '@alfresco/adf-core';
|
||||||
import { switchMap, catchError } from 'rxjs/operators';
|
import { switchMap, catchError } from 'rxjs/operators';
|
||||||
import { Store } from '@ngrx/store';
|
import { Store } from '@ngrx/store';
|
||||||
import { AppStore, SnackbarErrorAction } from '@alfresco/aca-shared/store';
|
import { AppStore, SnackbarErrorAction } from '@alfresco/aca-shared/store';
|
||||||
import {
|
import {
|
||||||
ContentNodeSelectorComponent,
|
ContentNodeSelectorComponent,
|
||||||
ContentNodeSelectorComponentData
|
ContentNodeSelectorComponentData,
|
||||||
|
ShareDataRow
|
||||||
} from '@alfresco/adf-content-services';
|
} from '@alfresco/adf-content-services';
|
||||||
|
|
||||||
@Injectable({
|
@Injectable({
|
||||||
@@ -62,7 +63,8 @@ export class CreateFileFromTemplateService {
|
|||||||
dropdownSiteList: null,
|
dropdownSiteList: null,
|
||||||
breadcrumbTransform: this.transformNode.bind(this),
|
breadcrumbTransform: this.transformNode.bind(this),
|
||||||
select,
|
select,
|
||||||
isSelectionValid: this.isSelectionValid.bind(this)
|
isSelectionValid: this.isSelectionValid.bind(this),
|
||||||
|
rowFilter: this.rowFilter.bind(this)
|
||||||
};
|
};
|
||||||
|
|
||||||
from(
|
from(
|
||||||
@@ -131,4 +133,9 @@ export class CreateFileFromTemplateService {
|
|||||||
private get title() {
|
private get title() {
|
||||||
return this.translation.instant('NODE_SELECTOR.SELECT_TEMPLATE_TITLE');
|
return this.translation.instant('NODE_SELECTOR.SELECT_TEMPLATE_TITLE');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private rowFilter(row: ShareDataRow): boolean {
|
||||||
|
const node: MinimalNodeEntryEntity = row.node.entry;
|
||||||
|
return node.nodeType !== 'app:filelink';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user