@c8y/ngx-components
Version:
Angular modules for Cumulocity IoT applications
110 lines (103 loc) • 5.81 kB
JavaScript
import * as i0 from '@angular/core';
import { inject, Injectable, NgModule } from '@angular/core';
import { ContextRouteService, PreviewService, ViewContext, gettext, hookTab, hookRoute, hookPreview } from '@c8y/ngx-components';
import { DASHBOARD_DETAILS_TABS_OUTLET_NAME, DASHBOARD_DETAILS_OUTLET } from '@c8y/ngx-components/context-dashboard';
import { ActivatedRoute } from '@angular/router';
import { map } from 'rxjs';
const ADVANCED_TAB_FEATURE_KEY = 'ui.dashboard-details-advanced-tab';
const TAB_ID = 'advanced';
class AdvancedTabFactory {
constructor() {
this.activatedRoute = inject(ActivatedRoute);
this.contextRouteService = inject(ContextRouteService);
this.betaPreviewService = inject(PreviewService);
}
get() {
return this.betaPreviewService.getState$(ADVANCED_TAB_FEATURE_KEY).pipe(map(state => {
if (state) {
const rootContext = this.contextRouteService.getRootContextOfChild(this.activatedRoute);
if (rootContext === ViewContext.Dashboard) {
return [
{
label: gettext('Import / Export`dashboard configuration`'),
icon: 'input-output',
priority: 5,
path: [{ outlets: { [DASHBOARD_DETAILS_OUTLET]: TAB_ID } }],
tabsOutlet: DASHBOARD_DETAILS_TABS_OUTLET_NAME
}
];
}
}
return [];
}));
}
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: AdvancedTabFactory, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: AdvancedTabFactory }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: AdvancedTabFactory, decorators: [{
type: Injectable
}] });
class AdvancedTabRouteGuard {
constructor() {
this.betaPreviewService = inject(PreviewService);
}
canActivate() {
return this.betaPreviewService.getState$(ADVANCED_TAB_FEATURE_KEY);
}
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: AdvancedTabRouteGuard, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: AdvancedTabRouteGuard, providedIn: 'root' }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: AdvancedTabRouteGuard, decorators: [{
type: Injectable,
args: [{ providedIn: 'root' }]
}] });
class DashboardDetailsAdvancedTabModule {
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: DashboardDetailsAdvancedTabModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.2.14", ngImport: i0, type: DashboardDetailsAdvancedTabModule }); }
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: DashboardDetailsAdvancedTabModule, providers: [
hookTab(AdvancedTabFactory),
hookRoute([
{
path: TAB_ID,
loadComponent: () => import('./c8y-ngx-components-dashboard-details-advanced-tab-dashboard-details-advanced-tab.component-DtLAOoFx.mjs').then(m => m.DashboardDetailsAdvancedTabComponent),
outlet: DASHBOARD_DETAILS_OUTLET,
context: ViewContext.Dashboard,
canActivate: [AdvancedTabRouteGuard]
}
]),
hookPreview({
key: ADVANCED_TAB_FEATURE_KEY,
label: 'Dashboard details - Import / Export tab',
description: () => import('@c8y/style/markdown-files/dashboard-details-import-export-tab.md').then(m => m.default),
settings: { reload: true }
})
] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: DashboardDetailsAdvancedTabModule, decorators: [{
type: NgModule,
args: [{
providers: [
hookTab(AdvancedTabFactory),
hookRoute([
{
path: TAB_ID,
loadComponent: () => import('./c8y-ngx-components-dashboard-details-advanced-tab-dashboard-details-advanced-tab.component-DtLAOoFx.mjs').then(m => m.DashboardDetailsAdvancedTabComponent),
outlet: DASHBOARD_DETAILS_OUTLET,
context: ViewContext.Dashboard,
canActivate: [AdvancedTabRouteGuard]
}
]),
hookPreview({
key: ADVANCED_TAB_FEATURE_KEY,
label: 'Dashboard details - Import / Export tab',
description: () => import('@c8y/style/markdown-files/dashboard-details-import-export-tab.md').then(m => m.default),
settings: { reload: true }
})
]
}]
}] });
/**
* Generated bundle index. Do not edit.
*/
export { DashboardDetailsAdvancedTabModule };
//# sourceMappingURL=c8y-ngx-components-dashboard-details-advanced-tab.mjs.map