import{h}from"@stencil/core";import{OperationGroup,OperationStatus,navigateTo}from"../../../../../api/dist/ontotext-workbench-api";const operationGroupToIcon={[OperationGroup.BACKUP]:"ri-archive-line",[OperationGroup.QUERY]:"ri-arrow-left-right-line",[OperationGroup.CLUSTER]:"ri-organization-chart",[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=this.activeOperations.toOperationGroupSummaryList(),h("section",{key:"c4ed5b693c399a3b3d57cdefcca5828d55a67de3",class:"operations-statuses"},h("button",{key:"994dc049b42836ade271a3fc0076bee5a2b95570",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:`operation-status-icon icon-1-33x ${operationGroupToIcon[t.group]} ${operationStatusToWarningClass[t.status]}`}),t.totalOperations?h("sup",{class:"running-operation-count"},t.totalOperations):"")),h("i",{key:"eb093116742efd2a231011b2a45dfc67ebc8a9d4",class:"ri-arrow-down-s-line "+(this.isOpen?"rotate-180":"")})),this.isOpen&&h("ul",{key:"75ef54df0350f9beda3acf4fece801da8eef6dff",class:"operations-dropdown"},h("section",{key:"929302253ab9f1d43aa77e40fa78862c093222d5",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}]}}