diff --git a/projects/aca-folder-rules/assets/i18n/en.json b/projects/aca-folder-rules/assets/i18n/en.json
index 6f724d6ee..c71a88751 100644
--- a/projects/aca-folder-rules/assets/i18n/en.json
+++ b/projects/aca-folder-rules/assets/i18n/en.json
@@ -35,7 +35,7 @@
"OPTIONS": {
"CASCADE": "Rule applies to subfolders",
"ASYNCHRONOUS": "Run rule in the background",
- "ENABLED": "Disable rule",
+ "DISABLE_RULE": "Disable rule",
"ERROR_SCRIPT": "If errors occur run script",
"SELECT_ACTION": "Select action"
},
diff --git a/projects/aca-folder-rules/src/lib/model/aspect.model.ts b/projects/aca-folder-rules/src/lib/model/aspect.model.ts
new file mode 100644
index 000000000..a99cc2728
--- /dev/null
+++ b/projects/aca-folder-rules/src/lib/model/aspect.model.ts
@@ -0,0 +1,40 @@
+/*!
+ * @license
+ * Alfresco Example Content Application
+ *
+ * Copyright (C) 2005 - 2020 Alfresco Software Limited
+ *
+ * This file is part of the Alfresco Example Content Application.
+ * If the software was purchased under a paid Alfresco license, the terms of
+ * the paid license agreement will prevail. Otherwise, the software is
+ * provided under the following open source license terms:
+ *
+ * The Alfresco Example Content Application is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * The Alfresco Example Content Application is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with Alfresco. If not, see .
+ */
+
+export interface AspectModel {
+ id: string;
+ description: string;
+ namespaceUri: string;
+ namespacePrefix: string;
+}
+
+export interface Aspect {
+ includedInSupertypeQuery: boolean;
+ isContainer: boolean;
+ model: AspectModel;
+ id: string;
+ title: string;
+ parentId: string;
+}
diff --git a/projects/aca-folder-rules/src/lib/rule-details/options/rule-options.ui-component.html b/projects/aca-folder-rules/src/lib/rule-details/options/rule-options.ui-component.html
index 8538eb4fc..00c27ede7 100644
--- a/projects/aca-folder-rules/src/lib/rule-details/options/rule-options.ui-component.html
+++ b/projects/aca-folder-rules/src/lib/rule-details/options/rule-options.ui-component.html
@@ -27,7 +27,7 @@
[attr.data-automation-id]="'rule-option-checkbox-enabled'"
[checked]="!form.value.enabled" *ngIf="!preview"
(change)="form.get('enabled').setValue(!$event.checked)">
- {{ 'ACA_FOLDER_RULES.RULE_DETAILS.OPTIONS.ENABLED' | translate }}
+ {{ 'ACA_FOLDER_RULES.RULE_DETAILS.OPTIONS.DISABLE_RULE' | translate }}
diff --git a/projects/aca-folder-rules/src/lib/services/folder-rules.service.spec.ts b/projects/aca-folder-rules/src/lib/services/folder-rules.service.spec.ts
index 9d76cc287..5c918bc5e 100644
--- a/projects/aca-folder-rules/src/lib/services/folder-rules.service.spec.ts
+++ b/projects/aca-folder-rules/src/lib/services/folder-rules.service.spec.ts
@@ -125,4 +125,17 @@ describe('FolderRulesService', () => {
expect(apiCallSpy).toHaveBeenCalledWith(`/nodes/${nodeId}/rule-sets/${ruleSetId}/rules/${ruleId}`, 'PUT', paramsWithBody);
});
});
+
+ describe('loadAspects', () => {
+ beforeEach(async () => {
+ apiCallSpy = spyOn(folderRulesService, 'apiCall').withArgs(`/aspects`, 'GET', params).and.returnValue([]);
+
+ folderRulesService.loadAspects();
+ });
+
+ it('should send correct GET request', async () => {
+ expect(apiCallSpy).toHaveBeenCalled();
+ expect(apiCallSpy).toHaveBeenCalledWith(`/aspects`, 'GET', params);
+ });
+ });
});
diff --git a/projects/aca-folder-rules/src/lib/services/folder-rules.service.ts b/projects/aca-folder-rules/src/lib/services/folder-rules.service.ts
index b29497db6..59a95d87a 100644
--- a/projects/aca-folder-rules/src/lib/services/folder-rules.service.ts
+++ b/projects/aca-folder-rules/src/lib/services/folder-rules.service.ts
@@ -32,6 +32,7 @@ import { ContentApiService } from '@alfresco/aca-shared';
import { NodeInfo } from '@alfresco/aca-shared/store';
import { RuleCompositeCondition } from '../model/rule-composite-condition.model';
import { RuleSimpleCondition } from '../model/rule-simple-condition.model';
+import { Aspect, AspectModel } from '../model/aspect.model';
@Injectable({
providedIn: 'root'
@@ -70,6 +71,8 @@ export class FolderRulesService {
loading$ = this.loadingSource.asObservable();
private deletedRuleIdSource = new BehaviorSubject(null);
deletedRuleId$: Observable = this.deletedRuleIdSource.asObservable();
+ private aspectsSource = new BehaviorSubject([]);
+ aspects$: Observable = this.aspectsSource.asObservable();
constructor(private apiService: AlfrescoApiService, private contentApi: ContentApiService) {}
@@ -146,6 +149,14 @@ export class FolderRulesService {
).subscribe({ error: (error) => console.error(error) });
}
+ loadAspects(): void {
+ from(this.apiCall('/aspects', 'GET', [{}, {}, {}, {}, {}, ['application/json'], ['application/json']]))
+ .pipe(map((res) => res.list.entries.map((entry) => this.formatAspect(entry.entry))))
+ .subscribe((res) => {
+ this.aspectsSource.next(res);
+ });
+ }
+
private apiCall(path: string, httpMethod: string, params?: any[]): Promise {
return this.apiService.getInstance().contentClient.callApi(path, httpMethod, ...params);
}
@@ -197,4 +208,24 @@ export class FolderRulesService {
parameter: obj.parameter || ''
};
}
+
+ private formatAspect(obj): Aspect {
+ return {
+ includedInSupertypeQuery: obj.includedInSupertypeQuery ?? false,
+ isContainer: obj.isContainer ?? false,
+ model: this.formatAspectModel(obj.model),
+ id: obj.id ?? '',
+ title: obj.title ?? '',
+ parentId: obj.parentId ?? ''
+ };
+ }
+
+ private formatAspectModel(obj): AspectModel {
+ return {
+ id: obj.id ?? '',
+ description: obj.description ?? '',
+ namespaceUri: obj.namespaceUri ?? '',
+ namespacePrefix: obj.namespacePrefix ?? ''
+ };
+ }
}