Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ACS-4538] Make folder-rules secondary entry point of aca-content #3181

Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .github/actions/publish-libs/npm-publish.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ fi

export PROJECTS=(
'aca-content'
'aca-folder-rules'
'aca-preview'
'aca-shared'
'aca-viewer'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ fi

export PROJECTS=(
'aca-content'
'aca-folder-rules'
'aca-preview'
'aca-shared'
'aca-viewer'
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@ jobs:
unit-tests:
- name: "aca-content"
- name: "aca-shared"
- name: "aca-folder-rules"
- name: "aca-preview"
steps:
- name: Checkout
Expand Down
12 changes: 8 additions & 4 deletions app/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -79,13 +79,13 @@
},
{
"glob": "folder-rules.plugin.json",
"input": "projects/aca-folder-rules/assets",
"input": "projects/aca-content/folder-rules/assets",
"output": "./assets/plugins"
},
{
"glob": "**/*",
"input": "projects/aca-folder-rules/assets",
"output": "./assets/aca-folder-rules"
"input": "projects/aca-content/folder-rules/assets",
"output": "./assets/folder-rules"
},
{
"glob": "**/*",
Expand Down Expand Up @@ -253,7 +253,11 @@
"assets": [
"app/src/assets",
"app/src/favicon-96x96.png",
"projects/aca-content/assets",
{
"glob": "**/*",
"input": "projects/aca-content/assets",
"output": "/assets"
},
{
"input": "app/.tmp",
"output": "/",
Expand Down
2 changes: 1 addition & 1 deletion app/src/app/extensions.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@
*/

import { NgModule } from '@angular/core';
import { AcaFolderRulesModule } from '@alfresco/aca-content/folder-rules';
import { AosExtensionModule } from '@alfresco/aca-content/ms-office';
import { AcaAboutModule, DEV_MODE_TOKEN, PACKAGE_JSON } from '@alfresco/aca-content/about';
import { AcaFolderRulesModule } from '@alfresco/aca-folder-rules';
import { environment } from '../environments/environment';
import packageJson from 'package.json';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"$schema": "../../../extension.schema.json",
"$schema": "../../../../extension.schema.json",
"$id": "0455ca6c-cc7a-43ae-bbf7-35795413d2dd",
"$name": "Folder Rules Plugin",
"$version": "0.0.1",
Expand Down
5 changes: 5 additions & 0 deletions projects/aca-content/folder-rules/ng-package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"lib": {
"entryFile": "src/public-api.ts"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ const routes: Routes = [
})
export class AcaFolderRulesModule {
constructor(translation: TranslationService, extensions: ExtensionService) {
translation.addTranslationFolder('aca-folder-rules', 'assets/aca-folder-rules');
translation.addTranslationFolder('folder-rules', 'assets/folder-rules');

extensions.setEvaluators({
'rules.canManageFolderRules': rules.canManageFolderRules
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@

&__container {
display: grid;
grid-template-columns: minmax(250px,1fr) 3fr;
grid-template-columns: minmax(250px, 1fr) 3fr;
padding: 20px;
gap: 12px;
overflow-y: auto;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@
*/

import { ComponentFixture, TestBed } from '@angular/core/testing';
import { AcaFolderRulesModule, ManageRulesSmartComponent } from '@alfresco/aca-folder-rules';
import { AcaFolderRulesModule } from '../folder-rules.module';
import { ManageRulesSmartComponent } from './manage-rules.smart-component';
import { DebugElement, Predicate } from '@angular/core';
import { CoreTestingModule } from '@alfresco/adf-core';
import { FolderRulesService } from '../services/folder-rules.service';
Expand All @@ -37,7 +38,7 @@ import {
ruleSetWithLinkMock
} from '../mock/rule-sets.mock';
import { By } from '@angular/platform-browser';
import { owningFolderIdMock, owningFolderMock } from '../mock/node.mock';
import { getOwningFolderEntryMock, owningFolderIdMock, owningFolderMock } from '../mock/node.mock';
import { MatDialog } from '@angular/material/dialog';
import { ActionsService } from '../services/actions.service';
import { FolderRuleSetsService } from '../services/folder-rule-sets.service';
Expand All @@ -53,6 +54,7 @@ describe('ManageRulesSmartComponent', () => {
let folderRuleSetsService: FolderRuleSetsService;
let folderRulesService: FolderRulesService;
let actionsService: ActionsService;
let callApiSpy: jasmine.Spy;

beforeEach(() => {
TestBed.configureTestingModule({
Expand Down Expand Up @@ -81,6 +83,19 @@ describe('ManageRulesSmartComponent', () => {
actionsService = TestBed.inject(ActionsService);

spyOn(actionsService, 'loadActionDefinitions').and.stub();
spyOn(folderRulesService, 'getRuleSettings').and.returnValue(Promise.resolve(ruleSettingsMock));
callApiSpy = spyOn<any>(folderRuleSetsService, 'callApi');
callApiSpy
.withArgs(`/nodes/${owningFolderIdMock}/rule-sets?include=isLinkedTo,owningFolder,linkedToBy&skipCount=0&maxItems=100`, 'GET')
.and.returnValue(Promise.resolve(ownedRuleSetMock))
.withArgs(`/nodes/${owningFolderIdMock}/rule-sets/-default-?include=isLinkedTo,owningFolder,linkedToBy`, 'GET')
.and.returnValue(Promise.resolve(ownedRuleSetMock))
.withArgs(`/nodes/${owningFolderIdMock}?include=path%2Cproperties%2CallowableOperations%2Cpermissions`, 'GET')
.and.returnValue(Promise.resolve(getOwningFolderEntryMock));
});

afterEach(() => {
fixture.destroy();
});

it('should show a list of rule sets and rules', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,5 @@
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
*/

export * from './lib/folder-rules.module';
export { ManageRulesSmartComponent } from './lib/manage-rules/manage-rules.smart-component';
export * from './folder-rules.module';
export { ManageRulesSmartComponent } from './manage-rules/manage-rules.smart-component';
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
display: flex;
align-items: center;
justify-content: center;
margin: 20px 0
margin: 20px 0;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@
align-items: baseline;
gap: 8px;

& > label, & > .label {
& > label,
& > .label {
font-weight: bold;
width: 20%;
min-width: 100px;
Expand Down Expand Up @@ -75,12 +76,15 @@
}
}

&.read-only, .mat-form-field-disabled {
.mat-form-field-underline, .mat-select-arrow-wrapper {
&.read-only,
.mat-form-field-disabled {
.mat-form-field-underline,
.mat-select-arrow-wrapper {
display: none;
}

*:disabled, .mat-select-disabled .mat-select-value {
*:disabled,
.mat-select-disabled .mat-select-value {
color: inherit;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import { ruleListGroupingItemsMock, rulesMock } from '../../mock/rules.mock';
import { DebugElement } from '@angular/core';
import { By } from '@angular/platform-browser';
import { CoreTestingModule } from '@alfresco/adf-core';
import { AcaFolderRulesModule } from '@alfresco/aca-folder-rules';
import { AcaFolderRulesModule } from '../../folder-rules.module';

describe('RuleListGroupingUiComponent', () => {
let component: RuleListGroupingUiComponent;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,12 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { RuleSetPickerOptions, RuleSetPickerSmartComponent } from './rule-set-picker.smart-component';
import { CoreTestingModule } from '@alfresco/adf-core';
import { folderToLinkMock } from '../mock/node.mock';
import { folderToLinkMock, otherFolderMock } from '../mock/node.mock';
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
import { FolderRuleSetsService } from '../services/folder-rule-sets.service';
import { of } from 'rxjs';
import { ruleSetWithLinkMock, ruleSetWithNoRulesToLinkMock, ruleSetWithOwnedRulesToLinkMock } from '../mock/rule-sets.mock';
import { ownedRuleSetMock, ruleSetWithLinkMock, ruleSetWithNoRulesToLinkMock, ruleSetWithOwnedRulesToLinkMock } from '../mock/rule-sets.mock';
import { ContentApiService } from '../../../../aca-shared/src/public-api';
MichalKinas marked this conversation as resolved.
Show resolved Hide resolved
import { By } from '@angular/platform-browser';

describe('RuleSetPickerSmartComponent', () => {
Expand All @@ -38,6 +39,7 @@ describe('RuleSetPickerSmartComponent', () => {
let folderRuleSetsService: FolderRuleSetsService;

let loadRuleSetsSpy: jasmine.Spy;
let callApiSpy: jasmine.Spy;

const dialogRef = {
close: jasmine.createSpy('close'),
Expand All @@ -54,7 +56,18 @@ describe('RuleSetPickerSmartComponent', () => {
imports: [CoreTestingModule],
providers: [
{ provide: MatDialogRef, useValue: dialogRef },
{ provide: MAT_DIALOG_DATA, useValue: dialogOptions }
{ provide: MAT_DIALOG_DATA, useValue: dialogOptions },
{
provide: ContentApiService,
useValue: {
getNode: () => {
return of({ entry: folderToLinkMock });
},
getNodeInfo: () => {
return of(otherFolderMock);
}
}
}
]
});

Expand All @@ -63,7 +76,19 @@ describe('RuleSetPickerSmartComponent', () => {
component = fixture.componentInstance;
component['folderRuleSetsService'] = folderRuleSetsService;

loadRuleSetsSpy = spyOn(folderRuleSetsService, 'loadRuleSets');
loadRuleSetsSpy = spyOn(folderRuleSetsService, 'loadRuleSets').and.callThrough();
callApiSpy = spyOn<any>(folderRuleSetsService, 'callApi');
callApiSpy
.withArgs(`/nodes/${dialogOptions.nodeId}/rule-sets?include=isLinkedTo,owningFolder,linkedToBy&skipCount=0&maxItems=100`, 'GET')
.and.returnValue(Promise.resolve(ownedRuleSetMock))
.withArgs(`/nodes/${dialogOptions.nodeId}/rule-sets/-default-?include=isLinkedTo,owningFolder,linkedToBy`, 'GET')
.and.returnValue(Promise.resolve(ownedRuleSetMock))
.withArgs(`/nodes/${folderToLinkMock.id}?include=path%2Cproperties%2CallowableOperations%2Cpermissions`, 'GET')
.and.returnValue(Promise.resolve({ entry: folderToLinkMock }));
});

afterEach(() => {
fixture.destroy();
});

it('should load the rule sets of a node once it has been selected', () => {
Expand Down
1 change: 1 addition & 0 deletions projects/aca-content/ng-package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"input": "./src/lib/ui/",
"output": "ui"
},
"folder-rules/assets",
"about/assets",
"ms-office/assets",
"assets"
Expand Down
13 changes: 12 additions & 1 deletion projects/aca-content/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,18 @@
"license": "LGPL-3.0",
"peerDependencies": {
"@angular/common": "^14.1.0",
"@angular/core": "^14.1.0"
"@angular/core": "^14.1.0",
"@alfresco/adf-core": "^6.1.0-0",
"@alfresco/adf-content-services": "^6.1.0-0",
"@alfresco/adf-extensions": "^6.1.0-0",
"@alfresco/js-api": "^6.1.0-0",
"@angular/animations": "^14.1.3",
"@angular/cdk": "^14.1.3",
"@angular/forms": "^14.1.3",
"@angular/material": "^14.1.3",
"@ngx-translate/core": "^14.0.0",
"rxjs": "6.6.6",
"zone.js": "0.11.8"
},
"dependencies": {
"tslib": "^2.3.0"
Expand Down
2 changes: 1 addition & 1 deletion projects/aca-content/src/lib/aca-content.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ import { CONTENT_ROUTES } from './aca-content.routes';
import { RouterModule } from '@angular/router';
import { UploadFilesDialogComponent } from './components/upload-files-dialog/upload-files-dialog.component';
import { AppSharedLinkViewModule } from './components/shared-link-view/shared-link-view.module';
import { AcaFolderRulesModule } from '@alfresco/aca-folder-rules';
import { AcaFolderRulesModule } from '@alfresco/aca-content/folder-rules';
import { TagsColumnComponent } from './components/dl-custom-components/tags-column/tags-column.component';
import { UserInfoComponent } from './components/common/user-info/user-info.component';
import { SidenavComponent } from './components/sidenav/sidenav.component';
Expand Down
2 changes: 1 addition & 1 deletion projects/aca-content/src/lib/aca-content.routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -571,7 +571,7 @@ export const CONTENT_LAYOUT_ROUTES: Route = {
children: [
{
path: '',
loadChildren: () => import('@alfresco/aca-folder-rules').then((m) => m.AcaFolderRulesModule)
loadChildren: () => import('@alfresco/aca-content/folder-rules').then((m) => m.AcaFolderRulesModule)
}
]
},
Expand Down
19 changes: 18 additions & 1 deletion projects/aca-content/tsconfig.lib.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,27 @@
"extends": "../../tsconfig.json",
"compilerOptions": {
"outDir": "../../out-tsc/lib",
"target": "es2020",
"moduleResolution": "node",
"sourceMap": true,
"declaration": true,
"declarationMap": true,
"inlineSources": true,
"types": []
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"importHelpers": true,
"types": [],
"lib": [
"dom",
"es2020"
]
},
"angularCompilerOptions": {
"skipTemplateCodegen": true,
"strictMetadataEmit": true,
"enableResourceInlining": true,
"fullTemplateTypeCheck": true,
"strictInjectionParameters": true
},
"exclude": [
"test.ts",
Expand Down
1 change: 0 additions & 1 deletion projects/aca-content/tsconfig.lib.prod.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
"@alfresco/aca-shared": ["dist/@alfresco/aca-shared"],
"@alfresco/aca-shared/store": ["dist/@alfresco/aca-shared/store"],
"@alfresco/aca-shared/rules": ["dist/@alfresco/aca-shared/rules"],
"@alfresco/aca-folder-rules": ["dist/@alfresco/aca-folder-rules"],
"@alfresco/aca-viewer": ["dist/@alfresco/aca-viewer"],
"@alfresco/aca-preview": ["dist/@alfresco/aca-preview"]
},
Expand Down
23 changes: 0 additions & 23 deletions projects/aca-folder-rules/.eslintrc.js

This file was deleted.

9 changes: 0 additions & 9 deletions projects/aca-folder-rules/README.md

This file was deleted.

15 changes: 0 additions & 15 deletions projects/aca-folder-rules/karma.conf.js

This file was deleted.

Loading