Skip to content

Commit

Permalink
[ACS-7678] Convert content pipes to standalone (#9562)
Browse files Browse the repository at this point in the history
* standalone pipes for content services

* remove useless module [ci:force]

* bug fixes [ci:force]

* bug fixes and cleanup [ci:force]

* cleanup unused/dead code [ci:force]
  • Loading branch information
DenysVuika authored Apr 17, 2024
1 parent 74ef7ee commit 5d474d8
Show file tree
Hide file tree
Showing 17 changed files with 55 additions and 169 deletions.
9 changes: 3 additions & 6 deletions lib/content-services/src/lib/content.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,19 +42,18 @@ import { AspectListModule } from './aspect-list/aspect-list.module';
import { VersionCompatibilityModule } from './version-compatibility/version-compatibility.module';
import { versionCompatibilityFactory } from './version-compatibility/version-compatibility-factory';
import { VersionCompatibilityService } from './version-compatibility/version-compatibility.service';
import { ContentPipeModule } from './pipes/content-pipe.module';
import { CONTENT_PIPES } from './pipes/content-pipe.module';
import { NodeCommentsModule } from './node-comments/node-comments.module';
import { TreeModule } from './tree/tree.module';
import { AlfrescoViewerModule } from './viewer/alfresco-viewer.module';
import { ContentUserInfoModule } from './content-user-info/content-user-info.module';
import { SecurityControlsServiceModule } from './security/services/security-controls-service.module';
import { CategoriesModule } from './category/category.module';
import { contentAuthLoaderFactory } from './auth-loader/content-auth-loader-factory';
import { ContentAuthLoaderService } from './auth-loader/content-auth-loader.service';

@NgModule({
imports: [
ContentPipeModule,
...CONTENT_PIPES,
CoreModule,
TagModule,
CommonModule,
Expand Down Expand Up @@ -83,12 +82,11 @@ import { ContentAuthLoaderService } from './auth-loader/content-auth-loader.serv
TreeModule,
SearchTextModule,
AlfrescoViewerModule,
SecurityControlsServiceModule,
CategoriesModule
],
providers: [provideTranslations('adf-content-services', 'assets/adf-content-services')],
exports: [
ContentPipeModule,
...CONTENT_PIPES,
TagModule,
DocumentListModule,
ContentUserInfoModule,
Expand All @@ -112,7 +110,6 @@ import { ContentAuthLoaderService } from './auth-loader/content-auth-loader.serv
TreeModule,
SearchTextModule,
AlfrescoViewerModule,
SecurityControlsServiceModule,
CategoriesModule
]
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import { CoreModule, EditJsonDialogModule } from '@alfresco/adf-core';

import { MaterialModule } from '../material.module';
import { UploadModule } from '../upload/upload.module';
import { ContentPipeModule } from '../pipes/content-pipe.module';
import { SearchModule } from './../search/search.module';

import { ContentActionListComponent } from './components/content-action/content-action-list.component';
Expand All @@ -36,17 +35,18 @@ import { NameColumnComponent } from './components/name-column/name-column.compon
import { FilterHeaderComponent } from './components/filter-header/filter-header.component';
import { FileAutoDownloadComponent } from './components/file-auto-download/file-auto-download.component';
import { ContentDirectiveModule } from '../directives/content-directive.module';
import { NodeNameTooltipPipe } from '../pipes';

@NgModule({
imports: [
CoreModule,
CommonModule,
ContentPipeModule,
MaterialModule,
UploadModule,
EditJsonDialogModule,
SearchModule,
ContentDirectiveModule
ContentDirectiveModule,
NodeNameTooltipPipe
],
declarations: [
DocumentListComponent,
Expand All @@ -72,5 +72,4 @@ import { ContentDirectiveModule } from '../directives/content-directive.module';
FilterHeaderComponent
]
})
export class DocumentListModule {
}
export class DocumentListModule {}
32 changes: 9 additions & 23 deletions lib/content-services/src/lib/pipes/content-pipe.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,33 +15,19 @@
* limitations under the License.
*/

import { CommonModule } from '@angular/common';
import { NgModule } from '@angular/core';
import { NodeNameTooltipPipe } from './node-name-tooltip.pipe';
import { TranslateModule } from '@ngx-translate/core';
import { IsIncludedPipe } from './is-included.pipe';
import { TabLabelsPipe } from './tab-labels.pipe';

export const CONTENT_PIPES = [NodeNameTooltipPipe, IsIncludedPipe, TabLabelsPipe] as const;

/**
* @deprecated Use the individual pipe modules instead.
*/
@NgModule({
imports: [
CommonModule,
TranslateModule
],
declarations: [
NodeNameTooltipPipe,
IsIncludedPipe,
TabLabelsPipe
],
providers: [
NodeNameTooltipPipe,
IsIncludedPipe,
TabLabelsPipe
],
exports: [
NodeNameTooltipPipe,
IsIncludedPipe,
TabLabelsPipe
]
imports: [...CONTENT_PIPES],
providers: [...CONTENT_PIPES],
exports: [...CONTENT_PIPES]
})
export class ContentPipeModule {
}
export class ContentPipeModule {}
3 changes: 2 additions & 1 deletion lib/content-services/src/lib/pipes/is-included.pipe.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
import { Pipe, PipeTransform } from '@angular/core';

@Pipe({
name: 'adfIsIncluded'
name: 'adfIsIncluded',
standalone: true
})
export class IsIncludedPipe<T> implements PipeTransform {
transform(value: T, array: T[], compare?: (value1: T, value2: T) => boolean): boolean {
Expand Down
3 changes: 2 additions & 1 deletion lib/content-services/src/lib/pipes/node-name-tooltip.pipe.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ import { Pipe, PipeTransform } from '@angular/core';
import { NodeEntry } from '@alfresco/js-api';

@Pipe({
name: 'adfNodeNameTooltip'
name: 'adfNodeNameTooltip',
standalone: true
})
export class NodeNameTooltipPipe implements PipeTransform {
transform(node: NodeEntry): string {
Expand Down
11 changes: 5 additions & 6 deletions lib/content-services/src/lib/pipes/tab-labels.pipe.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,11 @@ import { Pipe, PipeTransform } from '@angular/core';
import { SearchWidgetSettings } from '../search/models/search-widget-settings.interface';

@Pipe({
name: 'tabLabels'
name: 'tabLabels',
standalone: true
})
export class TabLabelsPipe implements PipeTransform {

transform(field: string, settings?: SearchWidgetSettings): string {
return settings?.displayedLabelsByField?.[field] ? settings.displayedLabelsByField[field] : field;
}

transform(field: string, settings?: SearchWidgetSettings): string {
return settings?.displayedLabelsByField?.[field] ? settings.displayedLabelsByField[field] : field;
}
}
14 changes: 12 additions & 2 deletions lib/content-services/src/lib/search/search.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import { CommonModule } from '@angular/common';
import { NgModule } from '@angular/core';
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import { MaterialModule } from '../material.module';
import { ContentPipeModule } from '../pipes/content-pipe.module';

import { CoreModule, SearchTextModule } from '@alfresco/adf-core';

Expand Down Expand Up @@ -57,9 +56,20 @@ import { SearchFilterTabDirective } from './components/search-filter-tabbed/sear
import { SearchFacetChipTabbedComponent } from './components/search-filter-chips/search-facet-chip-tabbed/search-facet-chip-tabbed.component';
import { SearchFacetTabbedContentComponent } from './components/search-filter-chips/search-facet-chip-tabbed/search-facet-tabbed-content.component';
import { SearchInputComponent } from './components/search-input';
import { IsIncludedPipe, TabLabelsPipe } from '../pipes';

@NgModule({
imports: [CommonModule, ContentPipeModule, FormsModule, ReactiveFormsModule, MaterialModule, CoreModule, SearchTextModule, SearchInputComponent],
imports: [
CommonModule,
FormsModule,
ReactiveFormsModule,
MaterialModule,
CoreModule,
SearchTextModule,
SearchInputComponent,
IsIncludedPipe,
TabLabelsPipe
],
declarations: [
SearchComponent,
SearchControlComponent,
Expand Down
1 change: 0 additions & 1 deletion lib/content-services/src/lib/security/public-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,3 @@
*/

export * from './services/security-controls-groups-marks-security.service';
export * from './services/security-controls-service.module';
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* limitations under the License.
*/

import { SecurityMarkPaging, SecurityMarkEntry, SecurityMarkBody } from '@alfresco/js-api';
import { SecurityMarkPaging, SecurityMarkBody } from '@alfresco/js-api';

export const fakeMarksApiResponse: SecurityMarkPaging = {
list: {
Expand All @@ -38,14 +38,8 @@ export const fakeMarksApiResponse: SecurityMarkPaging = {
}
};

export const fakeCreateMarksApiResponse: SecurityMarkEntry = {
entry: {
groupId: 'e7b83b84-bb48-46fc-8e64-4b6be910906c',
name: 'securityMark1',
id: 'ffBOeOJJ'
export const createNewSecurityMarkMock: SecurityMarkBody[] = [
{
name: 'securityMark1'
}
};

export const createNewSecurityMarkMock: SecurityMarkBody[] = [{
name: 'securityMark1'
}];
];

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,9 @@ import { SecurityGroupBody, SecurityMarkBody, SecurityMarkEntry } from '@alfresc

describe('SecurityControlsService', () => {
let service: SecurityControlsService;
let securityGroupId;
let securityMarkId;
let securityGroupId: string;
let securityMarkId: string;

const securityGroupBody: SecurityGroupBody = {
groupName: 'TestGroup',
groupType: 'HIERARCHICAL'
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,11 @@ import { TranslationService } from '@alfresco/adf-core';

@Pipe({
name: 'adfFileUploadError',
pure: true
pure: true,
standalone: true
})
export class FileUploadErrorPipe implements PipeTransform {

constructor(private translation: TranslationService) {
}
constructor(private translation: TranslationService) {}

transform(errorCode: number): string {
return this.translation.instant(`FILE_UPLOAD.ERRORS.${errorCode || 'GENERIC'}`);
Expand Down
10 changes: 2 additions & 8 deletions lib/content-services/src/lib/upload/upload.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,13 @@ import { UploadButtonComponent } from './components/upload-button.component';
import { UploadVersionButtonComponent } from './components/upload-version-button.component';
import { UploadDragAreaComponent } from './components/upload-drag-area.component';
import { FileUploadErrorPipe } from './pipes/file-upload-error.pipe';
import { CoreModule } from '@alfresco/adf-core';
import { CoreModule, FileSizePipe } from '@alfresco/adf-core';
import { FileDraggableDirective } from './directives/file-draggable.directive';
import { ToggleIconDirective } from './directives/toggle-icon.directive';
import { A11yModule } from '@angular/cdk/a11y';

@NgModule({
imports: [
CoreModule,
CommonModule,
MaterialModule,
A11yModule
],
imports: [CoreModule, CommonModule, MaterialModule, A11yModule, FileUploadErrorPipe, FileSizePipe],
declarations: [
FileDraggableDirective,
UploadDragAreaComponent,
Expand All @@ -45,7 +40,6 @@ import { A11yModule } from '@angular/cdk/a11y';
FileUploadingDialogComponent,
FileUploadingListComponent,
FileUploadingListRowComponent,
FileUploadErrorPipe,
ToggleIconDirective
],
exports: [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,32 +25,13 @@ import { VersionManagerComponent } from './version-manager.component';
import { VersionListComponent } from './version-list.component';
import { UploadModule } from '../upload/upload.module';
import { VersionCompatibilityModule } from '../version-compatibility/version-compatibility.module';
import { CoreModule } from '@alfresco/adf-core';
import { CoreModule, FileTypePipe } from '@alfresco/adf-core';
import { VersionComparisonComponent } from './version-comparison.component';
import { ScrollingModule } from '@angular/cdk/scrolling';

@NgModule({
imports: [
CommonModule,
MaterialModule,
CoreModule,
UploadModule,
VersionCompatibilityModule,
FormsModule,
ScrollingModule
],
exports: [
VersionUploadComponent,
VersionManagerComponent,
VersionListComponent,
FormsModule,
VersionComparisonComponent
],
declarations: [
VersionUploadComponent,
VersionManagerComponent,
VersionListComponent,
VersionComparisonComponent
]
imports: [CommonModule, MaterialModule, CoreModule, UploadModule, VersionCompatibilityModule, FormsModule, ScrollingModule, FileTypePipe],
exports: [VersionUploadComponent, VersionManagerComponent, VersionListComponent, FormsModule, VersionComparisonComponent],
declarations: [VersionUploadComponent, VersionManagerComponent, VersionListComponent, VersionComparisonComponent]
})
export class VersionManagerModule {}
Loading

0 comments on commit 5d474d8

Please sign in to comment.