[ACS-5308] cleanup content common module and move to standalone components (#3234)

* language picker

* location link

* logout component

* logout: fix tests

* toggle shared component

* user info component

* cleanup common module

* migrate generic error to standalone

* thumbnail column component

* name column component

* tags column component

* locked by component

* cleanup module dependencies

* comments tab component

* info drawer and details

* cleanup infodrawer module

* remove useless test

* reduce useless imports

* info drawer module

* context menu component
This commit is contained in:
Denys Vuika
2023-05-29 10:28:26 +01:00
committed by GitHub
parent 40c4740b3a
commit 251b6a0ec7
52 changed files with 291 additions and 384 deletions

View File

@@ -22,30 +22,25 @@
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
*/
import { CoreModule } from '@alfresco/adf-core';
import { ExtensionsModule } from '@alfresco/adf-extensions';
import { CommonModule } from '@angular/common';
import { NgModule } from '@angular/core';
import { GenericErrorModule } from '@alfresco/aca-shared';
import { LocationLinkComponent } from './location-link/location-link.component';
import { ToggleSharedComponent } from './toggle-shared/toggle-shared.component';
import { LanguagePickerComponent } from './language-picker/language-picker.component';
import { LogoutComponent } from './logout/logout.component';
import { ContentModule } from '@alfresco/adf-content-services';
import { UserInfoComponent } from './user-info/user-info.component';
import { RouterModule } from '@angular/router';
/**
* @deprecated Use `APP_COMMON_DIRECTIVES` instead
*/
@NgModule({
imports: [CommonModule, CoreModule.forChild(), ContentModule.forChild(), ExtensionsModule, GenericErrorModule, RouterModule],
declarations: [LocationLinkComponent, ToggleSharedComponent, LanguagePickerComponent, LogoutComponent, UserInfoComponent],
exports: [
ExtensionsModule,
LocationLinkComponent,
GenericErrorModule,
ToggleSharedComponent,
LanguagePickerComponent,
LogoutComponent,
UserInfoComponent
]
imports: [LanguagePickerComponent, LocationLinkComponent, LogoutComponent, ToggleSharedComponent, UserInfoComponent]
})
export class AppCommonModule {}
export const APP_COMMON_DIRECTIVES = [
LanguagePickerComponent,
LocationLinkComponent,
LogoutComponent,
ToggleSharedComponent,
UserInfoComponent
] as const;

View File

@@ -22,9 +22,15 @@
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
*/
import { LanguageMenuModule } from '@alfresco/adf-core';
import { Component } from '@angular/core';
import { MatIconModule } from '@angular/material/icon';
import { MatMenuModule } from '@angular/material/menu';
import { TranslateModule } from '@ngx-translate/core';
@Component({
standalone: true,
imports: [TranslateModule, MatIconModule, MatMenuModule, LanguageMenuModule],
selector: 'aca-language-picker',
template: `
<button mat-menu-item [matMenuTriggerFor]="langMenu">

View File

@@ -22,16 +22,19 @@
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
*/
import { Component, Input, ChangeDetectionStrategy, OnInit, ViewEncapsulation, HostListener } from '@angular/core';
import { Component, Input, ChangeDetectionStrategy, OnInit, ViewEncapsulation, HostListener, inject } from '@angular/core';
import { PathInfo, MinimalNodeEntity } from '@alfresco/js-api';
import { Observable, BehaviorSubject, of } from 'rxjs';
import { Store } from '@ngrx/store';
import { AppStore, NavigateToParentFolder } from '@alfresco/aca-shared/store';
import { NavigateToParentFolder } from '@alfresco/aca-shared/store';
import { ContentApiService } from '@alfresco/aca-shared';
import { TranslationService } from '@alfresco/adf-core';
import { CommonModule } from '@angular/common';
import { TranslateModule } from '@ngx-translate/core';
@Component({
standalone: true,
imports: [CommonModule, TranslateModule],
selector: 'aca-location-link',
template: `
<a
@@ -50,6 +53,10 @@ import { TranslationService } from '@alfresco/adf-core';
}
})
export class LocationLinkComponent implements OnInit {
private store = inject(Store);
private contentApi = inject(ContentApiService);
private translationService = inject(TranslationService);
private _path: PathInfo;
nodeLocation$ = new BehaviorSubject(this.translationService.instant('APP.BROWSE.SEARCH.UNKNOWN_LOCATION'));
@@ -66,8 +73,6 @@ export class LocationLinkComponent implements OnInit {
this.getTooltip(this._path);
}
constructor(private store: Store<AppStore>, private contentApi: ContentApiService, private translationService: TranslationService) {}
goToLocation() {
if (this.context) {
const node: MinimalNodeEntity = this.context.row.node;

View File

@@ -31,12 +31,11 @@ import { SetSelectedNodesAction } from '@alfresco/aca-shared/store';
describe('LogoutComponent', () => {
let fixture: ComponentFixture<LogoutComponent>;
let component: LogoutComponent;
let store;
let store: Store;
beforeEach(() => {
TestBed.configureTestingModule({
imports: [AppTestingModule],
declarations: [LogoutComponent],
imports: [AppTestingModule, LogoutComponent],
providers: [
{
provide: Store,

View File

@@ -24,9 +24,14 @@
import { Component } from '@angular/core';
import { Store } from '@ngrx/store';
import { AppStore, SetSelectedNodesAction } from '@alfresco/aca-shared/store';
import { SetSelectedNodesAction } from '@alfresco/aca-shared/store';
import { TranslateModule } from '@ngx-translate/core';
import { MatIconModule } from '@angular/material/icon';
import { MatMenuModule } from '@angular/material/menu';
@Component({
standalone: true,
imports: [TranslateModule, MatIconModule, MatMenuModule],
selector: 'aca-logout',
template: `
<button mat-menu-item (click)="onLogoutEvent()" adf-logout>
@@ -36,7 +41,7 @@ import { AppStore, SetSelectedNodesAction } from '@alfresco/aca-shared/store';
`
})
export class LogoutComponent {
constructor(private store: Store<AppStore>) {}
constructor(private store: Store) {}
onLogoutEvent() {
this.store.dispatch(new SetSelectedNodesAction([]));

View File

@@ -27,8 +27,15 @@ import { Observable } from 'rxjs';
import { Store } from '@ngrx/store';
import { SelectionState } from '@alfresco/adf-extensions';
import { AppStore, ShareNodeAction, getAppSelection } from '@alfresco/aca-shared/store';
import { CommonModule } from '@angular/common';
import { MatMenuModule } from '@angular/material/menu';
import { MatIconModule } from '@angular/material/icon';
import { TranslateModule } from '@ngx-translate/core';
import { MatButtonModule } from '@angular/material/button';
@Component({
standalone: true,
imports: [CommonModule, MatMenuModule, MatIconModule, TranslateModule, MatButtonModule],
selector: 'app-toggle-shared',
templateUrl: './toggle-shared.component.html'
})

View File

@@ -87,8 +87,7 @@ describe('UserInfoComponent', () => {
};
TestBed.configureTestingModule({
imports: [AppTestingModule],
declarations: [UserInfoComponent],
imports: [AppTestingModule, UserInfoComponent],
providers: [
{ provide: AuthenticationService, useValue: authServiceStub },
{ provide: PeopleContentService, useValue: peopleContentServiceStub },

View File

@@ -27,8 +27,14 @@ import { Component, OnInit, ViewEncapsulation } from '@angular/core';
import { Observable, of } from 'rxjs';
import { PeopleContentService } from '@alfresco/adf-content-services';
import { map } from 'rxjs/operators';
import { CommonModule } from '@angular/common';
import { RouterModule } from '@angular/router';
import { MatMenuModule } from '@angular/material/menu';
import { TranslateModule } from '@ngx-translate/core';
@Component({
standalone: true,
imports: [CommonModule, RouterModule, MatMenuModule, TranslateModule],
selector: 'app-user-info',
templateUrl: './user-info.component.html',
styleUrls: ['./user-info.component.scss'],