{"version":3,"file":"c8y-ngx-components-operations-operation-details.mjs","sources":["../../operations/operation-details/operation-details-modal.component.ts","../../operations/operation-details/operation-details-modal.component.html","../../operations/operation-details/operation-details.service.ts","../../operations/operation-details/operation-details.component.ts","../../operations/operation-details/operation-details.component.html","../../operations/operation-details/operation-details.module.ts","../../operations/operation-details/c8y-ngx-components-operations-operation-details.ts"],"sourcesContent":["import { Component, Input } from '@angular/core';\nimport { BsModalRef } from 'ngx-bootstrap/modal';\nimport { IOperation } from '@c8y/client';\nimport { OperationsListService } from '@c8y/ngx-components/operations/operations-list';\n@Component({\n  selector: 'c8y-operation-details-modal',\n  templateUrl: './operation-details-modal.component.html'\n})\nexport class OperationDetailsModalComponent {\n  @Input() operation: Partial<IOperation>;\n  @Input() collapsed = false;\n  @Input() readOnly = false;\n  isSmartRulesMicroserviceAvailable = false;\n\n  constructor(public modalRef: BsModalRef, private operationsListService: OperationsListService) {}\n\n  async ngOnInit() {\n    this.isSmartRulesMicroserviceAvailable =\n      await this.operationsListService.isSmartRulesMicroserviceAvailable();\n  }\n}\n","<div class=\"viewport-modal\">\n  <div class=\"modal-header separator\">\n    <h3 id=\"modal-title\">{{ 'Single operation details' | translate }}</h3>\n  </div>\n\n  <div\n    class=\"modal-inner-scroll\"\n    id=\"modal-body\"\n  >\n    <c8y-operations-list-item\n      [operation]=\"operation\"\n      [collapsed]=\"collapsed\"\n      [noExpandToggle]=\"true\"\n      [readOnly]=\"readOnly\"\n      [isSmartRulesMicroserviceAvailable]=\"isSmartRulesMicroserviceAvailable\"\n    ></c8y-operations-list-item>\n  </div>\n\n  <div class=\"modal-footer\">\n    <button\n      class=\"btn btn-default\"\n      title=\"{{ 'Close' | translate }}\"\n      type=\"button\"\n      (click)=\"modalRef.hide()\"\n    >\n      {{ 'Close' | translate }}\n    </button>\n  </div>\n</div>\n","import { Injectable } from '@angular/core';\nimport { BsModalService } from 'ngx-bootstrap/modal';\nimport { IOperation, OperationService } from '@c8y/client';\nimport { OperationDetailsModalComponent } from './operation-details-modal.component';\n\n@Injectable()\nexport class OperationDetailsService {\n  constructor(private operationService: OperationService, private modalService: BsModalService) {}\n\n  /**\n   * Opens a modal window with the details of given single operation.\n   * @param operationOrOperationId Operation's object or id.\n   * @param options Additional options:\n   * - `collapsed`: boolean - whether the details pane should be initially collapsed\n   * - `readOnly`: boolean - whether the details should be displayed in read-only mode\n   */\n  async openDetails(\n    operationOrOperationId: IOperation | string | number,\n    options?: { collapsed?: boolean; readOnly?: boolean }\n  ) {\n    const operation: IOperation = (operationOrOperationId as IOperation).id\n      ? (operationOrOperationId as IOperation)\n      : (await this.operationService.detail(operationOrOperationId)).data;\n    const initialState = { operation, ...options };\n\n    this.modalService.show(OperationDetailsModalComponent, {\n      initialState,\n      class: 'modal-lg',\n      ariaDescribedby: 'modal-body',\n      ariaLabelledBy: 'modal-title'\n    });\n  }\n}\n","import { Component, forwardRef, Input } from '@angular/core';\nimport { IOperation } from '@c8y/client';\nimport {\n  operationStatusClasses,\n  operationStatusIcons,\n  ProductExperienceEvent,\n  ProductExperienceEventSource,\n  PRODUCT_EXPERIENCE_EVENT_SOURCE\n} from '@c8y/ngx-components';\nimport { ACTIONS_OPERATIONS, COMPONENTS } from '@c8y/ngx-components/operations/product-experience';\nimport { OperationDetailsService } from './operation-details.service';\n\n/**\n * Operation details component displays a single operation's status, description and creationTime.\n *\n * ```html\n * <c8y-operation-details [operation]=\"operation\"></c8y-operation-details>\n * ```\n */\n@Component({\n  selector: 'c8y-operation-details',\n  templateUrl: './operation-details.component.html',\n  providers: [\n    {\n      provide: PRODUCT_EXPERIENCE_EVENT_SOURCE,\n      useExisting: forwardRef(() => OperationDetailsComponent)\n    }\n  ]\n})\nexport class OperationDetailsComponent implements ProductExperienceEventSource {\n  ACTIONS = ACTIONS_OPERATIONS;\n  @Input() operation: IOperation;\n\n  statusIcons: object;\n  statusClasses: object;\n\n  productExperienceEvent: ProductExperienceEvent = {\n    eventName: undefined, // supress emitting events if a parent component does not declare event name\n    data: {\n      component: COMPONENTS.OPERATION_DETAILS\n    }\n  };\n\n  constructor(private operationDetailsService: OperationDetailsService) {}\n\n  ngOnInit() {\n    this.statusIcons = operationStatusIcons;\n    this.statusClasses = operationStatusClasses;\n  }\n\n  openDetails() {\n    this.operationDetailsService.openDetails(this.operation);\n  }\n}\n","<div class=\"c8y-list--group\" *ngIf=\"operation\">\n  <a class=\"c8y-list__item\">\n    <div class=\"c8y-list__item__block\">\n      <div class=\"c8y-list__item__icon\">\n        <button\n          class=\"btn-clean\"\n          type=\"button\"\n          [attr.aria-label]=\"operation.status?.toString() | translate\"\n          [tooltip]=\"operation.status?.toString() | translate\"\n          [delay]=\"500\"\n          placement=\"right\"\n          container=\"body\"\n        >\n          <i\n            [c8yIcon]=\"statusIcons[operation.status]\"\n            [ngClass]=\"statusClasses[operation.status]\"\n          ></i>\n        </button>\n      </div>\n      <div class=\"c8y-list__item__body p-r-16\">\n        <div class=\"content-flex-40\">\n          <div class=\"col-8\">\n            <button\n              class=\"btn-clean text-truncate\"\n              type=\"button\"\n              title=\"{{ operation.description | translate }}\"\n              (click)=\"openDetails()\"\n              c8yProductExperience\n              inherit\n              [actionData]=\"{ action: ACTIONS.OPEN_OPERATION_DETAILS }\"\n            >\n              {{ operation.description | translate }}\n            </button>\n          </div>\n          <div class=\"col-4 text-muted\">\n            <small class=\"icon-flex\">\n              <i c8yIcon=\"calendar\" class=\"m-r-4\"></i>\n              <span>{{ operation.creationTime | c8yDate }}</span>\n            </small>\n          </div>\n        </div>\n      </div>\n    </div>\n  </a>\n</div>\n","import { NgModule } from '@angular/core';\nimport { CollapseModule } from 'ngx-bootstrap/collapse';\nimport { PopoverModule } from 'ngx-bootstrap/popover';\nimport { TooltipModule } from 'ngx-bootstrap/tooltip';\n\nimport { CoreModule } from '@c8y/ngx-components';\nimport { BulkOperationListItemService } from '@c8y/ngx-components/operations/bulk-operation-list-item';\n\nimport { OperationsListItemComponent } from '@c8y/ngx-components/operations/operations-list';\nimport { OperationDetailsModalComponent } from './operation-details-modal.component';\nimport { OperationDetailsComponent } from './operation-details.component';\nimport { OperationDetailsService } from './operation-details.service';\n\n/**\n * This module allows to display details of a single operation in a modal.\n */\n@NgModule({\n  imports: [CoreModule, PopoverModule, TooltipModule, CollapseModule, OperationsListItemComponent],\n  providers: [OperationDetailsService, BulkOperationListItemService],\n  declarations: [OperationDetailsComponent, OperationDetailsModalComponent],\n  exports: [OperationDetailsComponent]\n})\nexport class OperationDetailsModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["i3","i1","i2","i1.OperationDetailsService"],"mappings":";;;;;;;;;;;;;;;;MAQa,8BAA8B,CAAA;IAMzC,WAAmB,CAAA,QAAoB,EAAU,qBAA4C,EAAA;QAA1E,IAAQ,CAAA,QAAA,GAAR,QAAQ,CAAY;QAAU,IAAqB,CAAA,qBAAA,GAArB,qBAAqB,CAAuB;QAJpF,IAAS,CAAA,SAAA,GAAG,KAAK,CAAC;QAClB,IAAQ,CAAA,QAAA,GAAG,KAAK,CAAC;QAC1B,IAAiC,CAAA,iCAAA,GAAG,KAAK,CAAC;KAEuD;AAEjG,IAAA,MAAM,QAAQ,GAAA;AACZ,QAAA,IAAI,CAAC,iCAAiC;AACpC,YAAA,MAAM,IAAI,CAAC,qBAAqB,CAAC,iCAAiC,EAAE,CAAC;KACxE;+GAXU,8BAA8B,EAAA,IAAA,EAAA,CAAA,EAAA,KAAA,EAAA,EAAA,CAAA,UAAA,EAAA,EAAA,EAAA,KAAA,EAAA,EAAA,CAAA,qBAAA,EAAA,CAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA,CAAA,EAAA;AAA9B,IAAA,SAAA,IAAA,CAAA,IAAA,GAAA,EAAA,CAAA,oBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,SAAA,EAAA,IAAA,EAAA,8BAA8B,qJCR3C,wwBA6BA,EAAA,YAAA,EAAA,CAAA,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