{"version":3,"file":"c8y-ngx-components-operations-operations-list-item-details.mjs","sources":["../../operations/operations-list-item-details/operation-details.component.ts","../../operations/operations-list-item-details/operation-details.component.html","../../operations/operations-list-item-details/operation-details-tabs.component.ts","../../operations/operations-list-item-details/operation-details-tabs.component.html","../../operations/operations-list-item-details/operations-list-item-details.module.ts","../../operations/operations-list-item-details/c8y-ngx-components-operations-operations-list-item-details.ts"],"sourcesContent":["import { Component, EventEmitter, Input, Output } from '@angular/core';\nimport { IOperation, IOperationBulk } from '@c8y/client';\nimport { BulkOperationModalDetailsService } from '@c8y/ngx-components/operations/bulk-operation-modal-details';\nimport {\n  C8yTranslateDirective,\n  IconDirective,\n  C8yTranslatePipe,\n  DatePipe\n} from '@c8y/ngx-components';\nimport { NgIf, NgPlural, NgPluralCase, JsonPipe } from '@angular/common';\nimport { PopoverDirective } from 'ngx-bootstrap/popover';\n\n@Component({\n  selector: 'c8y-operation-li-details',\n  templateUrl: './operation-details.component.html',\n  imports: [\n    C8yTranslateDirective,\n    NgIf,\n    PopoverDirective,\n    NgPlural,\n    NgPluralCase,\n    IconDirective,\n    C8yTranslatePipe,\n    JsonPipe,\n    DatePipe\n  ]\n})\nexport class OperationListItemDetailsComponent {\n  @Input()\n  operation: (IOperation | IOperationBulk) & {\n    bulkOperationId?: string | number;\n    failureReason?: string;\n    result?: any;\n    description?: string;\n  };\n\n  @Input()\n  bulkOperationModalDetailsService: BulkOperationModalDetailsService;\n  @Output() showFailedOperation: EventEmitter<number> = new EventEmitter();\n\n  scrollToRetriedFromOperation(failedOperationId) {\n    this.showFailedOperation.emit(failedOperationId);\n  }\n\n  openBulkOperationDetails(bulkOperationId) {\n    this.bulkOperationModalDetailsService.openDetails(bulkOperationId);\n  }\n}\n","<div class=\"row d-flex-md fit-h\">\n  <div class=\"col-md-4 m-b-auto\">\n    <div\n      class=\"legend form-block\"\n      translate\n    >\n      Details\n    </div>\n    <ul class=\"list-unstyled small\">\n      <li\n        class=\"p-t-4 p-b-4 d-flex separator-bottom\"\n        *ngIf=\"operation.startDate\"\n      >\n        <label\n          class=\"small m-0\"\n          translate\n        >\n          Start date\n        </label>\n        <span class=\"m-l-auto\">{{ operation.startDate | c8yDate }}</span>\n      </li>\n      <li\n        class=\"p-t-4 p-b-4 d-flex separator-bottom\"\n        *ngIf=\"operation.bulkOperationId\"\n      >\n        <label\n          class=\"small m-b-auto\"\n          translate\n        >\n          Bulk operation\n        </label>\n        <div class=\"m-l-auto text-right text-truncate\">\n          <a\n            class=\"interact\"\n            (click)=\"openBulkOperationDetails(operation.bulkOperationId)\"\n          >\n            {{ 'See details' | translate }}\n          </a>\n        </div>\n      </li>\n      <li\n        class=\"p-t-4 p-b-4 d-flex separator-bottom\"\n        *ngIf=\"operation.creationRamp\"\n      >\n        <label class=\"small m-0\">\n          {{ 'Delay' | translate }}\n          <button\n            class=\"btn-help btn-help--sm\"\n            [attr.aria-label]=\"'Help' | translate\"\n            popover=\"{{ 'Delay before sending the operation to the next device.' | translate }}\"\n            placement=\"right\"\n            triggers=\"focus\"\n            container=\"body\"\n            type=\"button\"\n          ></button>\n        </label>\n        <span\n          class=\"m-l-auto\"\n          [ngPlural]=\"operation.creationRamp\"\n        >\n          <ng-template ngPluralCase=\"=1\">\n            {{ operation.creationRamp }}\n            <span translate>second</span>\n          </ng-template>\n          <ng-template ngPluralCase=\"other\">\n            {{ operation.creationRamp }}\n            <span translate>seconds</span>\n          </ng-template>\n        </span>\n      </li>\n      <li class=\"p-t-4 p-b-4 d-flex separator-bottom\">\n        <label\n          class=\"small m-0\"\n          translate\n        >\n          Status\n        </label>\n        <span class=\"m-l-auto text-uppercase\">\n          @if (operation.operationPrototype) {\n            {{ operation.generalStatus.toString() | translate }}\n          } @else if (operation.status) {\n            {{ operation.status?.toString() | translate }}\n          }\n        </span>\n      </li>\n      <li\n        class=\"p-t-4 p-b-4 d-flex separator-bottom\"\n        *ngIf=\"operation.failureReason\"\n      >\n        <label\n          class=\"small m-0\"\n          translate\n        >\n          Failure reason\n        </label>\n        <span\n          class=\"inner-scroll p-l-16 m-b-0 m-l-auto text-truncate-wrap\"\n          title=\"{{ operation.failureReason | translate }}\"\n        >\n          {{ operation.failureReason | translate }}\n        </span>\n      </li>\n      <li\n        class=\"p-t-4 p-b-4 d-flex separator-bottom\"\n        *ngIf=\"operation.result || operation.progress\"\n      >\n        <label\n          class=\"small m-b-auto\"\n          translate\n        >\n          Result\n        </label>\n        <div\n          class=\"d-flex flex-grow m-l-auto j-c-end\"\n          *ngIf=\"operation.progress; else singleOpResult\"\n        >\n          <div\n            class=\"icon-flex m-l-auto m-r-8\"\n            *ngIf=\"operation.progress.successful > 0\"\n          >\n            <i\n              class=\"text-success m-r-4\"\n              c8yIcon=\"check-circle\"\n            ></i>\n            <span\n              ngNonBindable\n              translate\n              [translateParams]=\"{\n                bulkOperationsCountSuccessful: operation.progress.successful\n              }\"\n            >\n              {{ bulkOperationsCountSuccessful }} successful\n            </span>\n          </div>\n          <div\n            class=\"icon-flex m-l-auto m-r-8\"\n            *ngIf=\"operation.progress.failed > 0\"\n          >\n            <i\n              class=\"text-danger m-r-4\"\n              c8yIcon=\"warning\"\n            ></i>\n            <span\n              ngNonBindable\n              translate\n              [translateParams]=\"{ bulkOperationsCountFailed: operation.progress.failed }\"\n            >\n              {{ bulkOperationsCountFailed }} failed\n            </span>\n          </div>\n          <div\n            class=\"icon-flex m-l-auto m-r-8\"\n            *ngIf=\"operation.progress.executing > 0\"\n          >\n            <i\n              class=\"m-r-4 text-info\"\n              c8yIcon=\"refresh\"\n            ></i>\n            <span\n              ngNonBindable\n              translate\n              [translateParams]=\"{ bulkOperationsCountExecuting: operation.progress.executing }\"\n            >\n              {{ bulkOperationsCountExecuting }} executing\n            </span>\n          </div>\n          <div\n            class=\"icon-flex m-l-auto m-r-8\"\n            *ngIf=\"operation.progress.pending > 0\"\n          >\n            <i\n              class=\"m-r-4 text-info\"\n              c8yIcon=\"clock-o\"\n            ></i>\n            <span\n              ngNonBindable\n              translate\n              [translateParams]=\"{ bulkOperationsCountPending: operation.progress.pending }\"\n            >\n              {{ bulkOperationsCountPending }} pending\n            </span>\n          </div>\n        </div>\n        <ng-template #singleOpResult>\n          <span\n            class=\"inner-scroll p-l-16 m-b-0 m-l-auto text-truncate-wrap\"\n            title=\"{{ operation.result }}\"\n          >\n            {{ operation.result }}\n          </span>\n        </ng-template>\n      </li>\n      <li\n        class=\"p-t-4 p-b-4 d-flex separator-bottom\"\n        *ngIf=\"operation.failedParentId\"\n      >\n        <label\n          class=\"small m-0\"\n          translate\n        >\n          Retried from\n        </label>\n        <span class=\"m-l-auto\">\n          <button\n            class=\"btn btn-default btn-xs\"\n            title=\"{{ 'Scroll to parent operation.' | translate }}\"\n            type=\"button\"\n            (click)=\"scrollToRetriedFromOperation(operation.failedParentId)\"\n          >\n            {{ operation.failedParentId }}\n          </button>\n        </span>\n      </li>\n      <li\n        class=\"p-t-4 p-b-4 d-flex separator-bottom\"\n        *ngIf=\"operation.note || operation.description\"\n      >\n        <label\n          class=\"small m-b-auto\"\n          translate\n        >\n          Description\n        </label>\n        <span\n          class=\"inner-scroll p-l-16 m-b-0 m-l-auto text-truncate-wrap\"\n          title=\"{{ operation.note ? operation.note : (operation.description | translate) }}\"\n        >\n          {{ operation.note ? operation.note : (operation.description | translate) }}\n        </span>\n      </li>\n    </ul>\n  </div>\n  <div class=\"col-md-8 fit-h d-flex d-col\">\n    <div\n      class=\"legend form-block\"\n      translate\n    >\n      Operation\n    </div>\n    <pre class=\"inner-scroll p-8 m-b-0 text-pre-normal\">\n      <code>{{ operation.operationPrototype || operation | json }}</code>\n    </pre>\n  </div>\n</div>\n","import {\n  Component,\n  EventEmitter,\n  Input,\n  OnInit,\n  Output,\n  ViewChild,\n  ViewContainerRef\n} from '@angular/core';\nimport { AuditRecordType, IOperation, IOperationBulk } from '@c8y/client';\nimport { gettext } from '@c8y/ngx-components/gettext';\nimport { Tab, IconDirective, AuditLogComponent, C8yTranslatePipe } from '@c8y/ngx-components';\nimport { BulkOperationModalDetailsService } from '@c8y/ngx-components/operations/bulk-operation-modal-details';\nimport { NgFor, NgClass, NgTemplateOutlet, NgIf } from '@angular/common';\nimport { OperationListItemDetailsComponent } from './operation-details.component';\nimport { SingleOperationsListComponent } from '@c8y/ngx-components/operations/bulk-single-operations-list';\n\n@Component({\n  selector: 'c8y-operation-details-tabs',\n  templateUrl: './operation-details-tabs.component.html',\n  imports: [\n    NgFor,\n    NgClass,\n    IconDirective,\n    NgTemplateOutlet,\n    OperationListItemDetailsComponent,\n    AuditLogComponent,\n    NgIf,\n    SingleOperationsListComponent,\n    C8yTranslatePipe\n  ]\n})\nexport class OperationDetailsTabsComponent implements OnInit {\n  AuditRecordType = AuditRecordType;\n\n  @Input()\n  operation: Partial<IOperation & IOperationBulk>;\n  @Input()\n  readOnly = false;\n\n  @Input()\n  bulkOperationModalDetailsService: BulkOperationModalDetailsService;\n  @Output() onRetryFailedOperations: EventEmitter<Partial<IOperationBulk>> = new EventEmitter();\n  @Output() showFailedOperation: EventEmitter<number> = new EventEmitter();\n\n  @ViewChild('details', { static: true }) detailsTemplate: any;\n  @ViewChild('audit', { static: true }) auditTemplate: any;\n\n  tabs: Tab[] = [];\n  template: ViewContainerRef;\n\n  ngOnInit(): void {\n    this.template = this.detailsTemplate;\n\n    this.tabs = [\n      {\n        label: gettext('Details'),\n        path: null,\n        icon: 'asterisk',\n        template: this.detailsTemplate\n      },\n      {\n        label: gettext('History of changes'),\n        path: null,\n        icon: 'archive',\n        template: this.auditTemplate\n      }\n    ];\n  }\n}\n","<div\n  class=\"tabContainer\"\n  #container\n>\n  <ul class=\"nav nav-tabs nav-tabsc8y\">\n    <li\n      [ngClass]=\"{ active: tab.template === template }\"\n      *ngFor=\"let tab of tabs\"\n    >\n      <button\n        class=\"btn\"\n        [title]=\"tab.label | translate\"\n        (click)=\"template = tab.template\"\n      >\n        <i [c8yIcon]=\"tab.icon\"></i>\n        <span class=\"txt\">{{ tab.label | translate }}</span>\n      </button>\n    </li>\n  </ul>\n</div>\n\n<ng-container *ngTemplateOutlet=\"template\"></ng-container>\n\n<ng-template #details>\n  <c8y-operation-li-details\n    [operation]=\"operation\"\n    (showFailedOperation)=\"showFailedOperation.emit($event)\"\n    [bulkOperationModalDetailsService]=\"bulkOperationModalDetailsService\"\n  ></c8y-operation-li-details>\n</ng-template>\n\n<ng-template #audit>\n  <c8y-audit-log\n    [source]=\"operation.id\"\n    [type]=\"\n      !!operation.operationPrototype ? AuditRecordType.BULK_OPERATION : AuditRecordType.OPERATION\n    \"\n  ></c8y-audit-log>\n</ng-template>\n\n<c8y-single-operations-list\n  class=\"d-flex d-col\"\n  *ngIf=\"operation.operationPrototype\"\n  [bulkOperation]=\"operation\"\n  [readOnly]=\"readOnly\"\n  (onRetryFailedOperations)=\"onRetryFailedOperations.emit($event)\"\n></c8y-single-operations-list>\n","import { NgModule } from '@angular/core';\nimport { OperationDetailsTabsComponent } from './operation-details-tabs.component';\nimport { OperationListItemDetailsComponent } from './operation-details.component';\n\n/**\n * This module allows for displaying the list of single operations and their details.\n */\n@NgModule({\n  imports: [OperationListItemDetailsComponent, OperationDetailsTabsComponent],\n  exports: [OperationListItemDetailsComponent, OperationDetailsTabsComponent]\n})\nexport class OperationsListItemDetailsModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;MA2Ba,iCAAiC,CAAA;AAf9C,IAAA,WAAA,GAAA;AA0BY,QAAA,IAAA,CAAA,mBAAmB,GAAyB,IAAI,YAAY,EAAE;AASzE,IAAA;AAPC,IAAA,4BAA4B,CAAC,iBAAiB,EAAA;AAC5C,QAAA,IAAI,CAAC,mBAAmB,CAAC,IAAI,CAAC,iBAAiB,CAAC;IAClD;AAEA,IAAA,wBAAwB,CAAC,eAAe,EAAA;AACtC,QAAA,IAAI,CAAC,gCAAgC,CAAC,WAAW,CAAC,eAAe,CAAC;IACpE;+GAnBW,iCAAiC,EAAA,IAAA,EAAA,EAAA,EAAA,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