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-5308] cleanup content common module and move to standalone components #3234

Merged
merged 20 commits into from
May 29, 2023
Merged
Show file tree
Hide file tree
Changes from 7 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
5 changes: 3 additions & 2 deletions projects/aca-content/src/lib/aca-content.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ import {
LibraryStatusColumnComponent,
TrashcanNameColumnComponent
} from '@alfresco/adf-content-services';
import { DocumentBasePageService, ExtensionsDataLoaderGuard, PageLayoutModule, SharedModule } from '@alfresco/aca-shared';
import { DocumentBasePageService, ExtensionsDataLoaderGuard, PageLayoutModule, SharedModule, GenericErrorModule } from '@alfresco/aca-shared';
import * as rules from '@alfresco/aca-shared/rules';

import { FilesComponent } from './components/files/files.component';
Expand Down Expand Up @@ -121,7 +121,8 @@ import { UserMenuComponent } from './components/sidenav/user-menu/user-menu.comp
ViewProfileModule,
AppTrashcanModule,
AppSharedLinkViewModule,
AcaFolderRulesModule
AcaFolderRulesModule,
GenericErrorModule
],
declarations: [
FilesComponent,
Expand Down
18 changes: 1 addition & 17 deletions projects/aca-content/src/lib/components/common/common.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,30 +22,14 @@
* 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';

@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 {}
Original file line number Diff line number Diff line change
Expand Up @@ -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">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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'));
Expand All @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand All @@ -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([]));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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'
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,7 @@ describe('UserInfoComponent', () => {
};

TestBed.configureTestingModule({
imports: [AppTestingModule],
declarations: [UserInfoComponent],
imports: [AppTestingModule, UserInfoComponent],
providers: [
{ provide: AuthenticationService, useValue: authServiceStub },
{ provide: PeopleContentService, useValue: peopleContentServiceStub },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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'],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { CoreModule } from '@alfresco/adf-core';
import { ContentModule } from '@alfresco/adf-content-services';
import { ExtensionsModule } from '@alfresco/adf-extensions';
import { LockedByModule, PageLayoutModule } from '@alfresco/aca-shared';
import { SearchResultsComponent } from './search-results/search-results.component';
import { SearchResultsRowComponent } from './search-results-row/search-results-row.component';
Expand All @@ -38,12 +39,14 @@ import { ContextMenuModule } from '../context-menu/context-menu.module';
import { SearchActionMenuComponent } from './search-action-menu/search-action-menu.component';
import { DocumentListCustomComponentsModule } from '../dl-custom-components/document-list-custom-components.module';
import { AppSearchInputModule } from './search-input.module';
import { LocationLinkComponent } from '../common/location-link/location-link.component';

@NgModule({
imports: [
CommonModule,
CoreModule.forChild(),
ContentModule.forChild(),
ExtensionsModule,
AppCommonModule,
AppInfoDrawerModule,
AppToolbarModule,
Expand All @@ -52,7 +55,8 @@ import { AppSearchInputModule } from './search-input.module';
ContextMenuModule,
LockedByModule,
DocumentListCustomComponentsModule,
AppSearchInputModule
AppSearchInputModule,
LocationLinkComponent
],
declarations: [SearchResultsComponent, SearchLibrariesResultsComponent, SearchResultsRowComponent, SearchActionMenuComponent],
exports: [SearchResultsComponent, SearchLibrariesResultsComponent, SearchResultsRowComponent, SearchActionMenuComponent]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import { DirectivesModule } from '../../directives/directives.module';
import { ContextMenuModule } from '../context-menu/context-menu.module';
import { AppSearchInputModule } from '../search/search-input.module';
import { PageLayoutModule } from '@alfresco/aca-shared';
import { ExtensionsModule } from '@alfresco/adf-extensions';

@NgModule({
imports: [
Expand All @@ -44,7 +45,8 @@ import { PageLayoutModule } from '@alfresco/aca-shared';
AppToolbarModule,
ContextMenuModule,
PageLayoutModule,
AppSearchInputModule
AppSearchInputModule,
ExtensionsModule
],
declarations: [TrashcanComponent],
exports: [TrashcanComponent]
Expand Down