mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2025-07-24 17:31:52 +00:00
experimental: standalone About component (#3228)
This commit is contained in:
@@ -22,46 +22,37 @@
|
||||
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { Component, Inject, OnInit, Optional } from '@angular/core';
|
||||
import { Component, OnInit, inject } from '@angular/core';
|
||||
import { DEV_MODE_TOKEN } from './dev-mode.tokens';
|
||||
import { Observable } from 'rxjs';
|
||||
import { AppExtensionService, ExtensionRef } from '@alfresco/adf-extensions';
|
||||
import { AppConfigService, AuthenticationService, RepositoryInfo } from '@alfresco/adf-core';
|
||||
import { AppExtensionService } from '@alfresco/adf-extensions';
|
||||
import { AboutModule, AppConfigService, AuthenticationService, RepositoryInfo } from '@alfresco/adf-core';
|
||||
import { DiscoveryApiService } from '@alfresco/adf-content-services';
|
||||
import { PACKAGE_JSON } from './package-json.token';
|
||||
import { TranslateModule } from '@ngx-translate/core';
|
||||
import { PageLayoutModule } 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],
|
||||
selector: 'app-about-page',
|
||||
templateUrl: './about.component.html',
|
||||
styles: [
|
||||
`
|
||||
adf-about {
|
||||
width: 100%;
|
||||
}
|
||||
`
|
||||
]
|
||||
styleUrls: ['./about.component.scss']
|
||||
})
|
||||
export class AboutComponent implements OnInit {
|
||||
pkg: any;
|
||||
dev = false;
|
||||
extensions$: Observable<ExtensionRef[]>;
|
||||
repository: RepositoryInfo = null;
|
||||
landingPage: string;
|
||||
private authService = inject(AuthenticationService);
|
||||
private appExtensions = inject(AppExtensionService);
|
||||
private discovery = inject(DiscoveryApiService);
|
||||
private appConfigService = inject(AppConfigService);
|
||||
public packageJson? = inject(PACKAGE_JSON, { optional: true });
|
||||
public dev = inject(DEV_MODE_TOKEN);
|
||||
|
||||
constructor(
|
||||
@Inject(DEV_MODE_TOKEN) devMode,
|
||||
@Optional()
|
||||
@Inject(PACKAGE_JSON)
|
||||
public packageJson,
|
||||
private authService: AuthenticationService,
|
||||
private appExtensions: AppExtensionService,
|
||||
private discovery: DiscoveryApiService,
|
||||
appConfigService: AppConfigService
|
||||
) {
|
||||
this.dev = !devMode;
|
||||
this.extensions$ = this.appExtensions.references$;
|
||||
this.landingPage = appConfigService.get('landingPage', '/personal-files');
|
||||
}
|
||||
extensions$ = this.appExtensions.references$;
|
||||
repository: RepositoryInfo = null;
|
||||
landingPage = this.appConfigService.get('landingPage', '/personal-files');
|
||||
|
||||
ngOnInit(): void {
|
||||
if (this.authService.isEcmLoggedIn()) {
|
||||
|
@@ -22,21 +22,12 @@
|
||||
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { ModuleWithProviders, NgModule, Provider } from '@angular/core';
|
||||
import { NgModule } from '@angular/core';
|
||||
import { AboutComponent } from './about.component';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { SharedModule, PageLayoutModule } from '@alfresco/aca-shared';
|
||||
|
||||
import { ExtensionService, provideExtensionConfig } from '@alfresco/adf-extensions';
|
||||
import { DEV_MODE_TOKEN } from './dev-mode.tokens';
|
||||
import { PACKAGE_JSON } from './package-json.token';
|
||||
import { AboutModule } from '@alfresco/adf-core';
|
||||
import { TranslateModule } from '@ngx-translate/core';
|
||||
import { RouterModule } from '@angular/router';
|
||||
|
||||
@NgModule({
|
||||
imports: [CommonModule, RouterModule, TranslateModule, SharedModule, PageLayoutModule, AboutModule],
|
||||
declarations: [AboutComponent],
|
||||
imports: [AboutComponent],
|
||||
providers: [provideExtensionConfig(['about.plugin.json'])]
|
||||
})
|
||||
export class AcaAboutModule {
|
||||
@@ -45,20 +36,4 @@ export class AcaAboutModule {
|
||||
'app.about.component': AboutComponent
|
||||
});
|
||||
}
|
||||
|
||||
public static forRoot(devMode: any, packageJson?: any): ModuleWithProviders<AcaAboutModule> {
|
||||
const providers: Provider[] = [{ provide: DEV_MODE_TOKEN, useValue: devMode }];
|
||||
|
||||
if (packageJson) {
|
||||
providers.push({
|
||||
provide: PACKAGE_JSON,
|
||||
useValue: packageJson
|
||||
});
|
||||
}
|
||||
|
||||
return {
|
||||
ngModule: AcaAboutModule,
|
||||
providers
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@@ -24,4 +24,4 @@
|
||||
|
||||
import { InjectionToken } from '@angular/core';
|
||||
|
||||
export const DEV_MODE_TOKEN = new InjectionToken<any>('devMode');
|
||||
export const DEV_MODE_TOKEN = new InjectionToken<boolean>('devMode');
|
||||
|
Reference in New Issue
Block a user