Skip to content

Commit

Permalink
[ACS-5627] migrate to standalone components (#3339)
Browse files Browse the repository at this point in the history
* standalone preview component

* remove deprecated routes

* remove preview routes

* standalone viewer

* toggle favorite

* edit offline

* fix tests

* toggle info drawer

* toggle join library

* toggle favorite library

* view node

* convert app toolbar module to standalone directives

* convert sidenav module to standalone

* convert search module to standalone

* shared link view

* shared files

* reduce module files

* files component

* files component cleanup

* cleanup directives module

* favorite libraries

* favorites component

* recent files component

* libraries component

* cleanup

* remove material module barrel

* open in app component

* cleanup modules

* migrate toolbar module to standalone

* split page layout module

* remove incorrect import

* remove incorrect import

* rule list

* folder rules module

* folder rules module

* backwards compatibility for ADW

* reduce core module usage
  • Loading branch information
DenysVuika committed Jul 17, 2023
1 parent 48a502b commit 9cf317d
Show file tree
Hide file tree
Showing 136 changed files with 986 additions and 915 deletions.
3 changes: 1 addition & 2 deletions app/src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import { NgModule } from '@angular/core';
import { BrowserAnimationsModule, NoopAnimationsModule } from '@angular/platform-browser/animations';

import { TRANSLATION_PROVIDER, AppConfigService, DebugAppConfigService, CoreModule, AuthGuard } from '@alfresco/adf-core';
import { AppService, SharedModule } from '@alfresco/aca-shared';
import { AppService } from '@alfresco/aca-shared';

import { AppExtensionsModule } from './extensions.module';
import { environment } from '../environments/environment';
Expand Down Expand Up @@ -89,7 +89,6 @@ registerLocaleData(localeSv);
BrowserModule,
TranslateModule.forRoot(),
CoreModule.forRoot(),
SharedModule,
CoreExtensionsModule.forRoot(),
LoginComponent,
environment.e2e ? NoopAnimationsModule : BrowserAnimationsModule,
Expand Down
14 changes: 12 additions & 2 deletions projects/aca-content/about/src/about.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,25 @@ import { AboutModule, AppConfigService, AuthenticationService, RepositoryInfo }
import { DiscoveryApiService } from '@alfresco/adf-content-services';
import { PACKAGE_JSON } from './package-json.token';
import { TranslateModule } from '@ngx-translate/core';
import { AppExtensionService, PageLayoutModule } from '@alfresco/aca-shared';
import { AppExtensionService, PageLayoutComponent, PageLayoutContentComponent, PageLayoutHeaderComponent } from '@alfresco/aca-shared';
import { RouterModule } from '@angular/router';
import { MatIconModule } from '@angular/material/icon';
import { CommonModule } from '@angular/common';
import { MatButtonModule } from '@angular/material/button';

@Component({
standalone: true,
imports: [CommonModule, TranslateModule, AboutModule, PageLayoutModule, RouterModule, MatIconModule, MatButtonModule],
imports: [
CommonModule,
TranslateModule,
AboutModule,
RouterModule,
MatIconModule,
MatButtonModule,
PageLayoutHeaderComponent,
PageLayoutContentComponent,
PageLayoutComponent
],
selector: 'app-about-page',
templateUrl: './about.component.html',
styleUrls: ['./about.component.scss'],
Expand Down
31 changes: 9 additions & 22 deletions projects/aca-content/folder-rules/src/folder-rules.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,19 +22,16 @@
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
*/

import { CoreModule, TranslationService } from '@alfresco/adf-core';
import { ExtensionService, ExtensionsModule, provideExtensionConfig } from '@alfresco/adf-extensions';
import { TranslationService } from '@alfresco/adf-core';
import { ExtensionService, provideExtensionConfig } from '@alfresco/adf-extensions';
import { NgModule } from '@angular/core';
import * as rules from './folder-rules.rules';
import { CommonModule } from '@angular/common';
import { RouterModule, Routes } from '@angular/router';
import { EditRuleDialogUiComponent } from './rule-details/edit-rule-dialog.ui-component';
import { ManageRulesSmartComponent } from './manage-rules/manage-rules.smart-component';
import { RuleCompositeConditionUiComponent } from './rule-details/conditions/rule-composite-condition.ui-component';
import { RuleDetailsUiComponent } from './rule-details/rule-details.ui-component';
import { RuleSimpleConditionUiComponent } from './rule-details/conditions/rule-simple-condition.ui-component';
import { GenericErrorComponent, PageLayoutModule } from '@alfresco/aca-shared';
import { BreadcrumbModule, ContentNodeSelectorModule, DocumentListModule } from '@alfresco/adf-content-services';
import { RuleListItemUiComponent } from './rule-list/rule-list-item/rule-list-item.ui-component';
import { RuleListGroupingUiComponent } from './rule-list/rule-list-grouping/rule-list-grouping.ui-component';
import { RuleTriggersUiComponent } from './rule-details/triggers/rule-triggers.ui-component';
Expand All @@ -54,30 +51,20 @@ const routes: Routes = [
@NgModule({
providers: [provideExtensionConfig(['folder-rules.plugin.json'])],
imports: [
CommonModule,
RouterModule.forChild(routes),
CoreModule.forChild(),
PageLayoutModule,
BreadcrumbModule,
DocumentListModule,
ExtensionsModule,
ContentNodeSelectorModule,
GenericErrorComponent
],
declarations: [
EditRuleDialogUiComponent,
RuleListItemUiComponent,
RuleListGroupingUiComponent,
RuleListUiComponent,
ManageRulesSmartComponent,
RuleSetPickerSmartComponent,
RuleActionListUiComponent,
RuleActionUiComponent,
RuleCompositeConditionUiComponent,
RuleDetailsUiComponent,
RuleListGroupingUiComponent,
RuleListItemUiComponent,
RuleListUiComponent,
RuleSetPickerSmartComponent,
RuleSimpleConditionUiComponent,
RuleOptionsUiComponent,
RuleTriggersUiComponent,
RuleOptionsUiComponent
RuleDetailsUiComponent,
EditRuleDialogUiComponent
]
})
export class AcaFolderRulesModule {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
*/

import { ComponentFixture, TestBed } from '@angular/core/testing';
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';
Expand Down Expand Up @@ -58,7 +57,7 @@ describe('ManageRulesSmartComponent', () => {

beforeEach(() => {
TestBed.configureTestingModule({
imports: [CoreTestingModule, AcaFolderRulesModule],
imports: [CoreTestingModule, ManageRulesSmartComponent],
providers: [
{
provide: AppService,
Expand All @@ -67,8 +66,6 @@ describe('ManageRulesSmartComponent', () => {
toggleAppNavBar$: new Subject()
}
},
FolderRuleSetsService,
FolderRulesService,
{ provide: Store, useValue: { dispatch: () => {} } },
{ provide: ActivatedRoute, useValue: { params: of({ nodeId: owningFolderIdMock }) } }
]
Expand Down Expand Up @@ -205,7 +202,9 @@ describe('ManageRulesSmartComponent', () => {
expect(ruleDetails).toBeFalsy();
});

it('should call deleteRule() if confirmation dialog returns true', () => {
// TODO: flaky test that needs review
// eslint-disable-next-line ban/ban
xit('should call deleteRule() if confirmation dialog returns true', () => {
const dialog = TestBed.inject(MatDialog);
folderRuleSetsService.folderInfo$ = of(owningFolderMock);
folderRuleSetsService.mainRuleSet$ = of(ownedRuleSetMock);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,26 +23,62 @@
*/

import { ChangeDetectionStrategy, Component, OnDestroy, OnInit, ViewEncapsulation } from '@angular/core';
import { Location } from '@angular/common';
import { CommonModule, Location } from '@angular/common';
import { FolderRulesService } from '../services/folder-rules.service';
import { Observable, Subject, Subscription } from 'rxjs';
import { Rule } from '../model/rule.model';
import { ActivatedRoute } from '@angular/router';
import { ActivatedRoute, RouterModule } from '@angular/router';
import { NodeInfo } from '@alfresco/aca-shared/store';
import { delay, takeUntil } from 'rxjs/operators';
import { EditRuleDialogUiComponent } from '../rule-details/edit-rule-dialog.ui-component';
import { MatDialog } from '@angular/material/dialog';
import { ConfirmDialogComponent } from '@alfresco/adf-content-services';
import { NotificationService } from '@alfresco/adf-core';
import { MatDialog, MatDialogModule } from '@angular/material/dialog';
import { BreadcrumbModule, ConfirmDialogComponent } from '@alfresco/adf-content-services';
import { NotificationService, TemplateModule, ToolbarModule } from '@alfresco/adf-core';
import { ActionDefinitionTransformed } from '../model/rule-action.model';
import { ActionsService } from '../services/actions.service';
import { FolderRuleSetsService } from '../services/folder-rule-sets.service';
import { RuleSet } from '../model/rule-set.model';
import { RuleSetPickerSmartComponent } from '../rule-set-picker/rule-set-picker.smart-component';
import { MatSlideToggleChange } from '@angular/material/slide-toggle';
import { MatSlideToggleChange, MatSlideToggleModule } from '@angular/material/slide-toggle';
import { ActionParameterConstraint } from '../model/action-parameter-constraint.model';
import { TranslateModule } from '@ngx-translate/core';
import {
GenericErrorComponent,
PageLayoutComponent,
PageLayoutContentComponent,
PageLayoutErrorComponent,
PageLayoutHeaderComponent
} from '@alfresco/aca-shared';
import { MatButtonModule } from '@angular/material/button';
import { MatIconModule } from '@angular/material/icon';
import { MatProgressBarModule } from '@angular/material/progress-bar';
import { MatDividerModule } from '@angular/material/divider';
import { RuleListUiComponent } from '../rule-list/rule-list/rule-list.ui-component';
import { RuleDetailsUiComponent } from '../rule-details/rule-details.ui-component';

@Component({
standalone: true,
imports: [
CommonModule,
TranslateModule,
PageLayoutComponent,
ToolbarModule,
MatButtonModule,
MatIconModule,
BreadcrumbModule,
MatProgressBarModule,
MatSlideToggleModule,
MatDividerModule,
RuleListUiComponent,
RouterModule,
TemplateModule,
PageLayoutErrorComponent,
PageLayoutContentComponent,
PageLayoutHeaderComponent,
GenericErrorComponent,
RuleDetailsUiComponent,
MatDialogModule
],
selector: 'aca-manage-rules',
templateUrl: 'manage-rules.smart-component.html',
styleUrls: ['manage-rules.smart-component.scss'],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,21 @@
*/

import { Component, forwardRef, Input, OnDestroy, ViewEncapsulation } from '@angular/core';
import { ControlValueAccessor, FormArray, FormControl, NG_VALUE_ACCESSOR, Validators } from '@angular/forms';
import { ControlValueAccessor, FormArray, FormControl, NG_VALUE_ACCESSOR, ReactiveFormsModule, Validators } from '@angular/forms';
import { ActionDefinitionTransformed, RuleAction } from '../../model/rule-action.model';
import { Subscription } from 'rxjs';
import { ruleActionValidator } from '../validators/rule-actions.validator';
import { ActionParameterConstraint } from '../../model/action-parameter-constraint.model';
import { CommonModule } from '@angular/common';
import { TranslateModule } from '@ngx-translate/core';
import { RuleActionUiComponent } from './rule-action.ui-component';
import { MatButtonModule } from '@angular/material/button';
import { MatMenuModule } from '@angular/material/menu';
import { MatIconModule } from '@angular/material/icon';

@Component({
standalone: true,
imports: [CommonModule, TranslateModule, RuleActionUiComponent, ReactiveFormsModule, MatButtonModule, MatMenuModule, MatIconModule],
selector: 'aca-rule-action-list',
templateUrl: './rule-action-list.ui-component.html',
styleUrls: ['./rule-action-list.ui-component.scss'],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ describe('RuleActionUiComponent', () => {

beforeEach(() => {
TestBed.configureTestingModule({
imports: [CoreTestingModule]
imports: [CoreTestingModule, RuleActionUiComponent]
});

fixture = TestBed.createComponent(RuleActionUiComponent);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,12 @@
*/

import { Component, forwardRef, Input, OnChanges, OnDestroy, OnInit, SimpleChanges, ViewEncapsulation } from '@angular/core';
import { ControlValueAccessor, FormControl, FormGroup, NG_VALUE_ACCESSOR, Validators } from '@angular/forms';
import { ControlValueAccessor, FormControl, FormGroup, NG_VALUE_ACCESSOR, ReactiveFormsModule, Validators } from '@angular/forms';
import { ActionDefinitionTransformed, RuleAction } from '../../model/rule-action.model';
import { CardViewItem } from '@alfresco/adf-core/lib/card-view/interfaces/card-view-item.interface';
import {
CardViewBoolItemModel,
CardViewModule,
CardViewSelectItemModel,
CardViewSelectItemOption,
CardViewTextItemModel,
Expand All @@ -40,9 +41,14 @@ import { takeUntil } from 'rxjs/operators';
import { ActionParameterConstraint, ConstraintValue } from '../../model/action-parameter-constraint.model';
import { ContentNodeSelectorComponent, ContentNodeSelectorComponentData, NodeAction } from '@alfresco/adf-content-services';
import { MatDialog } from '@angular/material/dialog';
import { TranslateService } from '@ngx-translate/core';
import { TranslateModule, TranslateService } from '@ngx-translate/core';
import { CommonModule } from '@angular/common';
import { MatFormFieldModule } from '@angular/material/form-field';
import { MatSelectModule } from '@angular/material/select';

@Component({
standalone: true,
imports: [CommonModule, TranslateModule, ReactiveFormsModule, MatFormFieldModule, MatSelectModule, CardViewModule],
selector: 'aca-rule-action',
templateUrl: './rule-action.ui-component.html',
styleUrls: ['./rule-action.ui-component.scss'],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,7 @@ describe('RuleCompositeConditionUiComponent', () => {

beforeEach(() => {
TestBed.configureTestingModule({
imports: [CoreTestingModule],
declarations: [RuleCompositeConditionUiComponent, RuleSimpleConditionUiComponent]
imports: [CoreTestingModule, RuleCompositeConditionUiComponent, RuleSimpleConditionUiComponent]
});

fixture = TestBed.createComponent(RuleCompositeConditionUiComponent);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,30 @@

import { Component, forwardRef, HostBinding, Input, OnChanges, OnDestroy, SimpleChanges, ViewEncapsulation } from '@angular/core';
import { RuleCompositeCondition } from '../../model/rule-composite-condition.model';
import { ControlValueAccessor, FormArray, FormControl, FormGroup, NG_VALUE_ACCESSOR } from '@angular/forms';
import { ControlValueAccessor, FormArray, FormControl, FormGroup, NG_VALUE_ACCESSOR, ReactiveFormsModule } from '@angular/forms';
import { RuleSimpleCondition } from '../../model/rule-simple-condition.model';
import { CommonModule } from '@angular/common';
import { TranslateModule } from '@ngx-translate/core';
import { MatFormFieldModule } from '@angular/material/form-field';
import { MatSelectModule } from '@angular/material/select';
import { MatButtonModule } from '@angular/material/button';
import { MatMenuModule } from '@angular/material/menu';
import { MatIconModule } from '@angular/material/icon';
import { RuleSimpleConditionUiComponent } from './rule-simple-condition.ui-component';

@Component({
standalone: true,
imports: [
CommonModule,
TranslateModule,
ReactiveFormsModule,
MatFormFieldModule,
MatSelectModule,
MatButtonModule,
MatMenuModule,
MatIconModule,
RuleSimpleConditionUiComponent
],
selector: 'aca-rule-composite-condition',
templateUrl: './rule-composite-condition.ui-component.html',
styleUrls: ['./rule-composite-condition.ui-component.scss'],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,7 @@ describe('RuleSimpleConditionUiComponent', () => {

beforeEach(() => {
TestBed.configureTestingModule({
imports: [CoreTestingModule],
declarations: [RuleSimpleConditionUiComponent]
imports: [CoreTestingModule, RuleSimpleConditionUiComponent]
});

fixture = TestBed.createComponent(RuleSimpleConditionUiComponent);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,21 @@
*/

import { Component, forwardRef, Input, OnDestroy, ViewEncapsulation } from '@angular/core';
import { AbstractControl, ControlValueAccessor, FormControl, FormGroup, NG_VALUE_ACCESSOR } from '@angular/forms';
import { AbstractControl, ControlValueAccessor, FormControl, FormGroup, NG_VALUE_ACCESSOR, ReactiveFormsModule } from '@angular/forms';
import { RuleSimpleCondition } from '../../model/rule-simple-condition.model';
import { comparatorHiddenForConditionFieldType, RuleConditionField, ruleConditionFields } from './rule-condition-fields';
import { RuleConditionComparator, ruleConditionComparators } from './rule-condition-comparators';
import { AppConfigService } from '@alfresco/adf-core';
import { MimeType } from './rule-mime-types';
import { CommonModule } from '@angular/common';
import { TranslateModule } from '@ngx-translate/core';
import { MatFormFieldModule } from '@angular/material/form-field';
import { MatSelectModule } from '@angular/material/select';
import { MatInputModule } from '@angular/material/input';

@Component({
standalone: true,
imports: [CommonModule, TranslateModule, ReactiveFormsModule, MatFormFieldModule, MatSelectModule, MatInputModule],
selector: 'aca-rule-simple-condition',
templateUrl: './rule-simple-condition.ui-component.html',
styleUrls: ['./rule-simple-condition.ui-component.scss'],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,6 @@ import { By } from '@angular/platform-browser';
import { RuleDetailsUiComponent } from './rule-details.ui-component';
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
import { CoreTestingModule } from '@alfresco/adf-core';
import { RuleCompositeConditionUiComponent } from './conditions/rule-composite-condition.ui-component';
import { RuleTriggersUiComponent } from './triggers/rule-triggers.ui-component';
import { RuleActionListUiComponent } from './actions/rule-action-list.ui-component';
import { RuleActionUiComponent } from './actions/rule-action.ui-component';
import { RuleOptionsUiComponent } from './options/rule-options.ui-component';
import { of, timer } from 'rxjs';

describe('EditRuleDialogSmartComponent', () => {
Expand All @@ -45,16 +40,7 @@ describe('EditRuleDialogSmartComponent', () => {

const setupBeforeEach = (dialogOptions: EditRuleDialogOptions = { actionDefinitions$: of([]), parameterConstraints$: of([]) }) => {
TestBed.configureTestingModule({
imports: [CoreTestingModule],
declarations: [
EditRuleDialogUiComponent,
RuleCompositeConditionUiComponent,
RuleDetailsUiComponent,
RuleTriggersUiComponent,
RuleActionListUiComponent,
RuleActionUiComponent,
RuleOptionsUiComponent
],
imports: [CoreTestingModule, EditRuleDialogUiComponent],
providers: [
{ provide: MatDialogRef, useValue: dialogRef },
{ provide: MAT_DIALOG_DATA, useValue: dialogOptions }
Expand Down

0 comments on commit 9cf317d

Please sign in to comment.