mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2025-05-12 17:04:46 +00:00
[ACS-4146] Folder Rules bug fix: An empty list for a child folder is displayed instead of an empty content template (#2839)
* [ACS-4146] - functional implementation * [ACS-4146] - unit tests * [ACS-4146] - removed console.log()
This commit is contained in:
parent
c3cbfb1e93
commit
86178c3a3a
@ -57,7 +57,7 @@
|
||||
</adf-toolbar>
|
||||
<mat-divider></mat-divider>
|
||||
|
||||
<div class="aca-manage-rules__container" *ngIf="(mainRuleSet$ | async) || (inheritedRuleSets$ | async).length > 0; else emptyContent">
|
||||
<div class="aca-manage-rules__container" *ngIf="(mainRuleSet$ | async) || isInheritedRuleSetsNotEmpty(inheritedRuleSets$ | async); else emptyContent">
|
||||
<aca-rule-list
|
||||
[mainRuleSet]="mainRuleSet$ | async"
|
||||
[folderId]="nodeId"
|
||||
|
@ -30,7 +30,7 @@ import { CoreTestingModule } from '@alfresco/adf-core';
|
||||
import { FolderRulesService } from '../services/folder-rules.service';
|
||||
import { ActivatedRoute } from '@angular/router';
|
||||
import { of } from 'rxjs';
|
||||
import { inheritedRuleSetMock, ownedRuleSetMock, ruleSetWithLinkMock } from '../mock/rule-sets.mock';
|
||||
import { inheritedRuleSetMock, ownedRuleSetMock, ruleSetsWithEmptyRulesMock, ruleSetWithLinkMock } from '../mock/rule-sets.mock';
|
||||
import { By } from '@angular/platform-browser';
|
||||
import { owningFolderIdMock, owningFolderMock } from '../mock/node.mock';
|
||||
import { MatDialog } from '@angular/material/dialog';
|
||||
@ -100,7 +100,7 @@ describe('ManageRulesSmartComponent', () => {
|
||||
it('should only show adf-empty-content if node has no rules defined yet', () => {
|
||||
folderRuleSetsService.folderInfo$ = of(owningFolderMock);
|
||||
folderRuleSetsService.mainRuleSet$ = of(null);
|
||||
folderRuleSetsService.inheritedRuleSets$ = of([]);
|
||||
folderRuleSetsService.inheritedRuleSets$ = of(ruleSetsWithEmptyRulesMock);
|
||||
folderRuleSetsService.isLoading$ = of(false);
|
||||
actionsService.loading$ = of(false);
|
||||
|
||||
|
@ -241,4 +241,8 @@ export class ManageRulesSmartComponent implements OnInit, OnDestroy {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
isInheritedRuleSetsNotEmpty(inheritedRuleSets: RuleSet[]): boolean {
|
||||
return inheritedRuleSets.filter((ruleSet) => ruleSet.rules.length > 0).length > 0;
|
||||
}
|
||||
}
|
||||
|
@ -115,4 +115,16 @@ export const inheritedRuleSetMock: RuleSet = {
|
||||
loadingRules: false
|
||||
};
|
||||
|
||||
export const inheritedRuleSetWithEmptyRulesMock: RuleSet = {
|
||||
id: 'inherited-rule-set',
|
||||
isLinkedTo: false,
|
||||
owningFolder: otherFolderMock,
|
||||
linkedToBy: [],
|
||||
rules: [],
|
||||
hasMoreRules: false,
|
||||
loadingRules: false
|
||||
};
|
||||
|
||||
export const ruleSetsMock: RuleSet[] = [inheritedRuleSetMock, ownedRuleSetMock, ruleSetWithLinkMock];
|
||||
|
||||
export const ruleSetsWithEmptyRulesMock: RuleSet[] = [inheritedRuleSetWithEmptyRulesMock];
|
||||
|
Loading…
x
Reference in New Issue
Block a user