{"version":3,"file":"c8y-ngx-components-feature-toggles-list.mjs","sources":["../../feature-toggles/list/can-toggle-status-of-feature-toggle.pipe.ts","../../feature-toggles/list/feature-toggle-list/feature-toggle-list.component.ts","../../feature-toggles/list/feature-toggle-list/feature-toggle-list.component.html","../../feature-toggles/list/index.ts","../../feature-toggles/list/c8y-ngx-components-feature-toggles-list.ts"],"sourcesContent":["import { inject, Pipe, PipeTransform } from '@angular/core';\nimport { IFeatureToggle } from '@c8y/client';\nimport { AppStateService, Permissions } from '@c8y/ngx-components';\n\n@Pipe({\n  name: 'canToggleStatusOfFeatureToggle'\n})\nexport class CanToggleStatusOfFeatureTogglePipe implements PipeTransform {\n  private permissions = inject(Permissions);\n  private appState = inject(AppStateService);\n\n  transform(value: IFeatureToggle): boolean {\n    if (!this.permissions.hasRole(Permissions.ROLE_TENANT_MANAGEMENT_ADMIN)) {\n      return false;\n    }\n    if (this.appState.currentTenant.value?.name === 'management') {\n      return true;\n    }\n    if (value.phase === 'PUBLIC_PREVIEW' || value.phase === 'GENERALLY_AVAILABLE') {\n      return true;\n    }\n    return false;\n  }\n}\n","import { NgClass } from '@angular/common';\nimport { Component, inject, OnInit } from '@angular/core';\nimport { ActivatedRoute } from '@angular/router';\nimport { FeatureService, IFeatureToggle } from '@c8y/client';\nimport {\n  C8yTranslateDirective,\n  TitleComponent,\n  DataGridComponent,\n  Column,\n  C8yTranslatePipe,\n  EmptyStateComponent,\n  Pagination,\n  DisplayOptions,\n  CellRendererDefDirective,\n  ColumnDirective,\n  ActionControl,\n  AlertService,\n  Permissions,\n  AppStateService,\n  ContextRouteService,\n  HeaderCellRendererDefDirective\n} from '@c8y/ngx-components';\nimport { gettext } from '@c8y/ngx-components/gettext';\nimport { PopoverDirective } from 'ngx-bootstrap/popover';\nimport { FormsModule } from '@angular/forms';\nimport { CanToggleStatusOfFeatureTogglePipe } from '../can-toggle-status-of-feature-toggle.pipe';\n\n@Component({\n  selector: 'c8y-feature-toggle-list',\n  templateUrl: './feature-toggle-list.component.html',\n  imports: [\n    TitleComponent,\n    C8yTranslateDirective,\n    C8yTranslatePipe,\n    DataGridComponent,\n    EmptyStateComponent,\n    CellRendererDefDirective,\n    ColumnDirective,\n    PopoverDirective,\n    NgClass,\n    FormsModule,\n    CanToggleStatusOfFeatureTogglePipe,\n    HeaderCellRendererDefDirective\n  ]\n})\nexport class FeatureToggleListComponent implements OnInit {\n  columns: Column[] = [\n    { name: 'name', header: gettext('Name'), sortable: true, path: 'name' },\n    { name: 'description', header: gettext('Description'), sortable: true, path: 'description' },\n    { name: 'key', header: gettext('Toggle key'), sortable: true, path: 'key' },\n    { name: 'status', header: gettext('Status'), sortable: true, path: 'active' },\n    { name: 'phase', header: gettext('Phase'), sortable: true, path: 'phase' },\n    { name: 'strategy', header: gettext('Strategy'), sortable: true, path: 'strategy' }\n  ];\n  actionControls: ActionControl[] = [\n    {\n      name: 'clearOverride',\n      icon: 'reset',\n      type: 'clearOverride',\n      text: gettext('Reset the toggle to the default state depending on the phase'),\n      callback: async (item: IFeatureToggle, reload) => {\n        await this.removeTenantOverride(item);\n        reload();\n      },\n      showIf: (item: IFeatureToggle) =>\n        item.strategy !== 'DEFAULT' &&\n        this.permissions.hasRole('ROLE_TENANT_MANAGEMENT_ADMIN') &&\n        (this.isManagementTenant ||\n          item.phase === 'PUBLIC_PREVIEW' ||\n          item.phase === 'GENERALLY_AVAILABLE')\n    }\n  ];\n  items: (IFeatureToggle & { id: string })[] = [];\n  pagination: Pagination = {\n    pageSize: 50,\n    currentPage: 1\n  };\n  displayOptions: DisplayOptions = {\n    bordered: false,\n    striped: true,\n    filter: true,\n    gridHeader: true,\n    hover: true\n  };\n  hasPrivatePreviewFeatures = false;\n  phaseDetails = {\n    PUBLIC_PREVIEW: {\n      class: 'tag--info',\n      name: gettext('Public preview`feature phase`'),\n      description: gettext(\n        'The feature is available for public preview and can be used by all users. It is disabled by default.'\n      )\n    },\n    PRIVATE_PREVIEW: {\n      class: 'tag--default',\n      name: gettext('Private preview`feature phase`'),\n      description: gettext(\n        'The feature is in private preview and available to a selected set of users. It is disabled by default.'\n      )\n    },\n    GENERALLY_AVAILABLE: {\n      class: 'tag--success',\n      name: gettext('Generally available`feature phase`'),\n      description: gettext(\n        'The feature is generally available and can be used by all users. It is enabled by default.'\n      )\n    }\n  };\n  phaseKeysOrder = [\n    'PRIVATE_PREVIEW',\n    'PUBLIC_PREVIEW',\n    'GENERALLY_AVAILABLE'\n  ] as const satisfies Array<keyof typeof this.phaseDetails>;\n  strategyDetails = [\n    {\n      key: 'DEFAULT',\n      class: 'tag--success',\n      name: gettext('Default`strategy`'),\n      description: gettext('The feature toggle is using the default state based on its phase.')\n    },\n    {\n      key: 'TENANT',\n      class: 'tag--info',\n      name: gettext('Custom`strategy`'),\n      description: gettext(\n        'The feature toggle has been customized. When the phase of the feature changes, the custom state remains unchanged.'\n      )\n    }\n  ];\n\n  activatedRoute: ActivatedRoute = inject(ActivatedRoute, { optional: true });\n  private featureToggle = inject(FeatureService);\n  private alertService = inject(AlertService);\n  private permissions = inject(Permissions);\n  private isManagementTenant = inject(AppStateService).currentTenant.value?.name === 'management';\n  private contextRouteService = inject(ContextRouteService);\n\n  constructor() {\n    this.items = this.activatedRoute?.snapshot.data['features'] || [];\n  }\n\n  async ngOnInit(): Promise<void> {\n    await this.reload();\n  }\n\n  async reload() {\n    let { data: toggles } = await this.featureToggle.list({ pageSize: 1000 });\n    toggles = toggles.filter(\n      toggle =>\n        toggle.phase !== 'IN_DEVELOPMENT' &&\n        (toggle.phase !== 'PRIVATE_PREVIEW' || toggle.active === true)\n    );\n    this.hasPrivatePreviewFeatures = toggles.some(toggle => toggle.phase === 'PRIVATE_PREVIEW');\n    const contextData = this.contextRouteService.getContextData(this.activatedRoute);\n    if (!contextData) {\n      this.items = toggles.map(toggle => ({ ...toggle, id: toggle.key }));\n      return;\n    }\n\n    const tenantId = contextData.contextData.id;\n    const promises = toggles.map(toggle => {\n      return this.featureToggle.detailByTenant(toggle.key).then(({ data }) => {\n        const override = data.find(ft => ft.tenantId === tenantId);\n        if (override) {\n          return {\n            ...toggle,\n            id: toggle.key,\n            strategy: 'TENANT',\n            active: override.active\n          } as const;\n        }\n        return {\n          ...toggle,\n          id: toggle.key,\n          strategy: 'DEFAULT',\n          active: toggle.phase === 'GENERALLY_AVAILABLE'\n        } as const;\n      });\n    });\n    const results = await Promise.all(promises);\n    this.items = results;\n  }\n\n  async updateFeature(feature: IFeatureToggle, newActiveValue: boolean) {\n    try {\n      const contextData = this.contextRouteService.getContextData(this.activatedRoute);\n      if (contextData) {\n        const tenantId = contextData.contextData.id as string;\n        await this.featureToggle.updateFeatureByTenant(\n          {\n            key: feature.key,\n            active: newActiveValue\n          },\n          tenantId\n        );\n      } else {\n        await this.featureToggle.updateFeature({ key: feature.key, active: newActiveValue });\n      }\n\n      if (newActiveValue) {\n        this.alertService.success(gettext('Feature enabled.'));\n      } else {\n        this.alertService.success(gettext('Feature disabled.'));\n      }\n    } catch (e) {\n      console.error('Error updating feature:', e);\n      if (newActiveValue) {\n        this.alertService.warning(gettext('Failed to enable feature.'));\n      } else {\n        this.alertService.warning(gettext('Failed to disable feature.'));\n      }\n    }\n    await this.reload();\n  }\n\n  async removeTenantOverride(feature: IFeatureToggle) {\n    try {\n      const contextData = this.contextRouteService.getContextData(this.activatedRoute);\n      if (contextData) {\n        const tenantId = contextData.contextData.id as string;\n        await this.featureToggle.removeTenantOverrideByTenant(feature, tenantId);\n      } else {\n        await this.featureToggle.removeTenantOverride(feature);\n      }\n      this.alertService.success(gettext('Feature reset to default state.'));\n    } catch (e) {\n      console.error('Error removing feature override:', e);\n      this.alertService.warning(gettext('Failed to reset feature state.'));\n    }\n    await this.reload();\n  }\n}\n","<c8y-title translate>{{ 'Feature toggles' | translate }}</c8y-title>\n\n<div class=\"content-fullpage d-flex d-col border-top border-bottom\">\n  <c8y-data-grid\n    [title]=\"'Feature toggles' | translate\"\n    [actionControls]=\"actionControls\"\n    [columns]=\"columns\"\n    [rows]=\"items\"\n    [pagination]=\"pagination\"\n    [displayOptions]=\"displayOptions\"\n    (onReload)=\"reload()\"\n  >\n    <c8y-column name=\"name\">\n      <ng-container *c8yCellRendererDef=\"let context\">\n        <strong>{{ context.value || '--' | translate }}</strong>\n      </ng-container>\n    </c8y-column>\n    <c8y-column name=\"description\">\n      <ng-container *c8yCellRendererDef=\"let context\">\n        <p>{{ context.value || '--' | translate }}</p>\n      </ng-container>\n    </c8y-column>\n    <c8y-column name=\"status\">\n      <ng-container *c8yCellRendererDef=\"let context\">\n        <label class=\"c8y-switch c8y-switch--inline\">\n          <input\n            type=\"checkbox\"\n            [ngModel]=\"context.value\"\n            [disabled]=\"!(context.item | canToggleStatusOfFeatureToggle)\"\n            (ngModelChange)=\"updateFeature(context.item, !context.value)\"\n            [ngModelOptions]=\"{ standalone: true }\"\n          />\n          <span></span>\n          <span class=\"text-12 a-s-center\">\n            @if (context.value) {\n              {{ 'Enabled' | translate }}\n            } @else {\n              {{ 'Disabled' | translate }}\n            }\n          </span>\n        </label>\n      </ng-container>\n    </c8y-column>\n    <c8y-column name=\"phase\">\n      <ng-template #phasePopoverHelp>\n        <p>\n          <strong>{{ 'Feature phases' | translate }}</strong>\n        </p>\n        @for (phaseKey of phaseKeysOrder; track phaseKey) {\n          @if (phaseKey !== 'PRIVATE_PREVIEW' || hasPrivatePreviewFeatures) {\n            <span\n              class=\"tag chip m-b-4\"\n              [ngClass]=\"phaseDetails[phaseKey].class\"\n            >\n              {{ phaseDetails[phaseKey].name | translate }}\n            </span>\n            <p class=\"text-12 m-b-8\">\n              {{ phaseDetails[phaseKey].description | translate }}\n            </p>\n          }\n        }\n      </ng-template>\n      <ng-container *c8yHeaderCellRendererDef>\n        {{ 'Phase' | translate }}\n        <button\n          class=\"btn-help btn-help--sm\"\n          [attr.aria-label]=\"'Help' | translate\"\n          [popover]=\"phasePopoverHelp\"\n          placement=\"bottom\"\n          triggers=\"focus\"\n          container=\"body\"\n          type=\"button\"\n        ></button>\n      </ng-container>\n      <ng-container *c8yCellRendererDef=\"let context\">\n        <span\n          class=\"tag\"\n          [ngClass]=\"phaseDetails[context.value]?.class || 'tag--warning'\"\n        >\n          {{ phaseDetails[context.value]?.name || context.value | translate }}\n        </span>\n      </ng-container>\n    </c8y-column>\n    <c8y-column name=\"strategy\">\n      <ng-template #strategyPopoverHelp>\n        <p>\n          <strong>{{ 'Feature strategies' | translate }}</strong>\n        </p>\n        @for (strategy of strategyDetails; track strategy) {\n          <span\n            class=\"tag chip m-b-4\"\n            [ngClass]=\"strategy.class\"\n          >\n            {{ strategy.name | translate }}\n          </span>\n          <p class=\"text-12 m-b-8\">\n            {{ strategy.description | translate }}\n          </p>\n        }\n      </ng-template>\n      <ng-container *c8yHeaderCellRendererDef>\n        {{ 'Strategy' | translate }}\n        <button\n          class=\"btn-help btn-help--sm\"\n          [attr.aria-label]=\"'Help' | translate\"\n          [popover]=\"strategyPopoverHelp\"\n          placement=\"bottom\"\n          triggers=\"focus\"\n          container=\"body\"\n          type=\"button\"\n        ></button>\n      </ng-container>\n      <ng-container *c8yCellRendererDef=\"let context\">\n        @for (strategy of strategyDetails; track strategy) {\n          @if (context.value === strategy.key) {\n            <span\n              class=\"tag\"\n              [ngClass]=\"strategy.class\"\n            >\n              {{ strategy.name | translate }}\n            </span>\n          }\n        }\n      </ng-container>\n    </c8y-column>\n    <c8y-ui-empty-state\n      [icon]=\"'toggle-on'\"\n      [title]=\"'No feature toggles available.' | translate\"\n      [horizontal]=\"true\"\n    ></c8y-ui-empty-state>\n  </c8y-data-grid>\n</div>\n","import { Routes } from '@angular/router';\nimport { FeatureToggleListComponent } from './feature-toggle-list/feature-toggle-list.component';\n\nexport * from './feature-toggle-list/feature-toggle-list.component';\n\nexport const childRoutes: Routes = [\n  {\n    path: '',\n    pathMatch: 'full',\n    component: FeatureToggleListComponent\n  }\n];\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;;MAOa,kCAAkC,C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