@c8y/ngx-components
Version:
Angular modules for Cumulocity IoT applications
64 lines (58 loc) • 2.98 kB
JavaScript
import * as i0 from '@angular/core';
import { inject, Injectable, NgModule } from '@angular/core';
import { hookPreview } from '@c8y/ngx-components';
import { ApplicationService, FeatureService } from '@c8y/client';
const DATA_PREP_UI_VISIBILITY_FEATURE_KEY = 'data-prep.ui-visibility';
const DATA_PREP_MICROSERVICE_NAME = 'data-prep-ctrl';
class DataPrepPreviewFactory {
constructor() {
this.applicationService = inject(ApplicationService);
this.featureService = inject(FeatureService);
}
async get() {
const microserviceSubscribed = await this.applicationService
.isAvailable(DATA_PREP_MICROSERVICE_NAME)
.then(({ data: subscribed }) => subscribed)
.catch(() => false);
if (!microserviceSubscribed) {
return [];
}
const canShowInPreview = await this.featureService
.detail(DATA_PREP_UI_VISIBILITY_FEATURE_KEY)
.then(({ data }) => data?.phase == 'PUBLIC_PREVIEW')
.catch(() => false);
if (!canShowInPreview) {
return [];
}
return {
key: DATA_PREP_UI_VISIBILITY_FEATURE_KEY,
label: 'Data Preparation',
description: () => import('@c8y/style/markdown-files/data-prep-preview.md').then(m => m.default),
settings: {
reload: true
}
};
}
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: DataPrepPreviewFactory, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: DataPrepPreviewFactory, providedIn: 'root' }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: DataPrepPreviewFactory, decorators: [{
type: Injectable,
args: [{ providedIn: 'root' }]
}] });
class DataPrepPreviewModule {
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: DataPrepPreviewModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.3.25", ngImport: i0, type: DataPrepPreviewModule }); }
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: DataPrepPreviewModule, providers: [hookPreview(DataPrepPreviewFactory)] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: DataPrepPreviewModule, decorators: [{
type: NgModule,
args: [{
providers: [hookPreview(DataPrepPreviewFactory)]
}]
}] });
/**
* Generated bundle index. Do not edit.
*/
export { DataPrepPreviewModule };
//# sourceMappingURL=c8y-ngx-components-data-preparation.mjs.map