UNPKG

graphdb-workbench

Version:
1 lines 3.38 kB
import{h}from"@stencil/core";import{OperationGroup,OperationStatus,MapperProvider,OperationGroupSummaryListMapper,navigateTo}from"../../../../../api/dist/ontotext-workbench-api";const operationGroupToIcon={[OperationGroup.BACKUP]:"fa-regular fa-archive",[OperationGroup.QUERY]:"fa-regular fa-arrow-right-arrow-left",[OperationGroup.CLUSTER]:"fa-regular fa-sitemap",[OperationGroup.IMPORT]:"icon-import"},operationStatusToWarningClass={[OperationStatus.WARNING]:"status-warning",[OperationStatus.INFORMATION]:"status-information",[OperationStatus.CRITICAL]:"status-critical"},operationStatusToFadeClass={[OperationStatus.WARNING]:"onto-btn-fade-warning",[OperationStatus.CRITICAL]:"onto-btn-fade-danger"};export class OntoOperationsNotification{constructor(){this.isOpen=!1,this.toggleDropdown=t=>{t.stopPropagation(),this.isOpen=!this.isOpen}}handleOutsideClick(){this.isOpen&&(this.isOpen=!1)}render(){var t;return this.operationGroups=MapperProvider.get(OperationGroupSummaryListMapper).mapToModel(this.activeOperations.toOperationsGroupSummary()),h("section",{key:"2c5c95054d9516505606b35dbfac6e1de9b324d9",class:"operations-statuses"},h("button",{key:"06559cb44b4e56f281302d6d542cb92e1bd1c9ee",class:`operations-statuses-dropdown-toggle ${this.isOpen?"open":"closed"} ${null!==(t=operationStatusToFadeClass[this.activeOperations.status])&&void 0!==t?t:""}`,onClick:this.toggleDropdown},this.operationGroups.getItems().map(t=>h("section",{key:t.id,class:"operation-status-header"},h("i",{class:`${operationGroupToIcon[t.group]} ${operationStatusToWarningClass[t.status]}`}),t.totalOperations?h("sup",{class:"running-operation-count tag-info"},t.totalOperations):"")),h("i",{key:"652f71e26dfefbe20ec8157d07e6ef1296f6c500",class:"fa-light fa-angle-down "+(this.isOpen?"fa-rotate-180":"")})),this.isOpen&&h("ul",{key:"d2fcec5df9ba1a52f72391b0bcf6c0314e5aaedf",class:"operations-dropdown"},h("section",{key:"059befb6671d7caebd86c037e80033fbc94beb90",class:"operations-statuses-content"},this.activeOperations.allRunningOperations.getItems().map(t=>h("li",{key:t.id},h("a",{class:`operation-status-content onto-btn no-underline ${operationStatusToWarningClass[t.status]}`,target:"_blank",onClick:navigateTo(t.href)},h("i",{class:operationGroupToIcon[t.group]}),h("span",{class:"operation-status-label"},h("translate-label",{labelKey:`operations_notification.links.${t.labelKey}`})),h("span",{class:"operation-number"},t.count?h("span",{class:"operation-status-running-operation-count"},t.count):"")))))))}static get is(){return"onto-operations-notification"}static get originalStyleUrls(){return{$:["onto-operations-notification.scss"]}}static get styleUrls(){return{$:["onto-operations-notification.css"]}}static get properties(){return{activeOperations:{type:"unknown",attribute:"active-operations",mutable:!1,complexType:{original:"OperationStatusSummary",resolved:"OperationStatusSummary",references:{OperationStatusSummary:{location:"import",path:"@ontotext/workbench-api",id:"../api/dist/ontotext-workbench-api.d.ts::OperationStatusSummary"}}},required:!1,optional:!1,docs:{tags:[],text:"The active operations summary. Holds general status and all current operations"},getter:!1,setter:!1}}}static get states(){return{isOpen:{}}}static get elementRef(){return"el"}static get listeners(){return[{name:"click",method:"handleOutsideClick",target:"window",capture:!1,passive:!1}]}}