@kong-ui-public/entities-data-plane-nodes 0.4.4 → 0.4.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -283,7 +283,7 @@ const be = (n) => n instanceof E ? n : n === null ? new E({ maxConcurrentAsyncs:
283
283
  l(a) === "not_supported" ? (g(), $("span", Te, d(l(o).t("log_level.not_applicable")), 1)) : l(a) ? (g(), $(j, { key: 2 }, [
284
284
  i("span", Ie, d(l(o).t(`log_level.${l(a)}`)), 1),
285
285
  l(a) !== T.targetLogLevel ? (g(), $("span", Ne, [
286
- v[0] || (v[0] = A(" → ")),
286
+ v[0] || (v[0] = A(" → ", -1)),
287
287
  i("span", $e, d(l(o).t(`log_level.${T.targetLogLevel}`)), 1)
288
288
  ])) : q("", !0)
289
289
  ], 64)) : (g(), k(C, {
@@ -1 +1 @@
1
- (function(s,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue"),require("@kong-ui-public/i18n"),require("@kong-ui-public/entities-shared"),require("@kong/icons")):typeof define=="function"&&define.amd?define(["exports","vue","@kong-ui-public/i18n","@kong-ui-public/entities-shared","@kong/icons"],e):(s=typeof globalThis<"u"?globalThis:s||self,e(s["kong-ui-public-entities-data-plane-nodes"]={},s.Vue,s["kong-ui-public-i18n"],s["kong-ui-public-entities-shared"],s.KongIcons))})(this,function(s,e,b,A,S){"use strict";var ue=Object.defineProperty;var ge=(s,e,b)=>e in s?ue(s,e,{enumerable:!0,configurable:!0,writable:!0,value:b}):s[e]=b;var C=(s,e,b)=>ge(s,typeof e!="symbol"?e+"":e,b);const P={modal:{action_button:{confirm:"Confirm",submitting:"Submitting...",ok:"OK"},change_log_level:{title:"Change Log Level ({summary})",summary_with_name:"Node {name}",summary_with_number:"{number} Nodes"},dp_list:{header:{host:"Host",action:"Action",status:"Status"},status:{failed:"Failure",loading:"Loading",pending:"Pending",succeed:"Succeed",not_supported:"Not Supported"}},log_level_disk_space_warning:"If left on for extended periods of time, can result in excess disk space consumption.",log_level_explanation:{debug:"Provides debug information about the plugin’s run loop and each individual plugin or other components.",info:"Provides messages that provide a record of the normal operation of the system.",notice:"Provides messages that provide a record of the normal operation of the system, but also alerts conditions that may require monitoring. Kong does not make a large difference between info and notice.",warn:"Is used to log any abnormal behavior that doesn’t result in dropped transactions but requires further investigation.",error:"Is used for logging errors that result in a request being dropped.",crit:"Is used when Kong is working under critical conditions and not working properly, thus affecting several clients."},revert_to_default_after:{label:"Revert to default after",hours:"hour",minutes:"min",seconds:"seconds"},select_log_level_title:"Select Log Level"},log_level:{debug:"Debug",info:"Info",notice:"Notice",warn:"Warn",error:"Error",crit:"Critical",not_applicable:"N/A"}};function N(){const o=b.createI18n("en-us",P);return{i18n:o,i18nT:b.i18nTComponent(o)}}var h=(o=>(o.Debug="debug",o.Info="info",o.Notice="notice",o.Warn="warn",o.Error="error",o.Critical="crit",o))(h||{});class M{constructor(n){C(this,"concurrentTokenSet",new Set);C(this,"concurrentTokenBorrowQueue",[]);for(let t=0;t<n;++t)this.concurrentTokenSet.add(Symbol(`token-${t}`))}hasAvailableConcurrentToken(){return this.concurrentTokenSet.size>0}borrowConcurrentToken(){if(this.concurrentTokenSet.size>0){const n=this.concurrentTokenSet.values().next().value;if(n)return this.concurrentTokenSet.delete(n),()=>{this.returnConcurrentToken(n)}}throw new Error("BUG: No available token to borrow")}returnConcurrentToken(n){if(this.concurrentTokenSet.has(n))throw new Error("Token already returned");const t=this.concurrentTokenBorrowQueue.shift();t?t[0](()=>this.returnConcurrentToken(n)):this.concurrentTokenSet.add(n)}async borrowToken(){return this.hasAvailableConcurrentToken()?this.borrowConcurrentToken():new Promise((n,t)=>{this.concurrentTokenBorrowQueue.push([n,t])})}clearWaitingQueue(n){for(;this.concurrentTokenBorrowQueue.length>0;){const[,t]=this.concurrentTokenBorrowQueue.shift();t(n)}}}class x extends Error{constructor(n,t){super(n,t),this.name="AsyncAbortException"}}class v{constructor(n){C(this,"tokenBucket",null);C(this,"schedule",async n=>{let t;this.tokenBucket&&(t=await this.tokenBucket.borrowToken());try{const a=await n();return t==null||t(),a}catch(a){throw t==null||t(),a}});C(this,"cancelAll",(n,t)=>{var a;(a=this.tokenBucket)==null||a.clearWaitingQueue(new x(n,t))});n.maxConcurrentAsyncs>0&&(this.tokenBucket=new M(n.maxConcurrentAsyncs))}}const K=Object.freeze(Object.defineProperty({__proto__:null,AsyncAbortException:x,AsyncScheduler:v,useAsyncScheduler:o=>o instanceof v?o:o===null?new v({maxConcurrentAsyncs:0}):new v(o)},Symbol.toStringTag,{value:"Module"})),V=[h.Debug,h.Info,h.Notice,h.Warn,h.Error,h.Critical],f={useI18n:N,...Object.freeze(Object.defineProperty({__proto__:null,supportedLevels:V,useDataPlaneLogLevelChecker:o=>{const n=o.requestExecutor??(r=>r()),{getDataPlaneLogLevel:t,setDataPlaneLogLevel:a}=o,{getMessageFromError:l}=A.useErrors();return{checkDataPlaneLogLevel:(r,c)=>{const d=e.ref(e.toValue(c==null?void 0:c.currentLogLevelHint)??null);d.value===null&&n(async()=>{d.value=await t(r)}).catch(u=>{u instanceof x||console.error("Failed to get data plane log level",u)}),c!=null&&c.currentLogLevelHint&&e.watch(()=>e.toValue(c.currentLogLevelHint),u=>{u&&(d.value=u)});const g=e.ref("pending"),L=e.ref(null);return{currentLogLevel:d,updateStatus:g,updateErrorMessage:L,updateLogLevel:async(u,k)=>{g.value="loading",L.value=null;try{await n(()=>a(r,u,k)),d.value=u,g.value="success"}catch(w){L.value=l(w),g.value="error"}}}}}},useFriendlyRevertTime:o=>{const{i18n:n}=N();return e.computed(()=>{const t=e.toValue(o);if(isNaN(t)||t<=0)return"";let a="";const l=t%60;l!==0&&(a+=`${l} ${n.t("modal.revert_to_default_after.seconds")}`);const i=Math.floor(t/60)%60;i!==0&&(a=`${i} ${n.t("modal.revert_to_default_after.minutes")} ${a}`);const r=Math.floor(t/3600);return r!==0&&(a=`${r} ${n.t("modal.revert_to_default_after.hours")} ${a}`),a})},useLogLevelCandidateSelectItems:o=>{const{i18n:n}=N();return e.computed(()=>{const t=e.toValue(o==null?void 0:o.disabled)??[];return V.map(a=>({label:n.t(`log_level.${a}`),value:a,selected:(o==null?void 0:o.initialSelected)===a,disabled:t.includes(a)}))})},useLogLevelExplanation:o=>{const n=[h.Debug],{i18n:t}=N();return e.computed(()=>{const a=e.toValue(o);return{explanation:t.t(`modal.log_level_explanation.${a}`),warning:n.includes(a)?t.t("modal.log_level_disk_space_warning"):void 0}})}},Symbol.toStringTag,{value:"Module"})),...K},q={"data-testid":"log-change-action"},F={key:0},R={"data-testid":"log-change-action-current-level"},H={key:0},j={"data-testid":"log-change-action-target-level"},O={"data-testid":"log-change-status"},Q=e.defineComponent({__name:"CLLModalNodeRow",props:{dataPlaneId:{},hostname:{},hasDllCapability:{type:Boolean},targetLogLevel:{},checkLogLevel:{},logLevelHint:{}},setup(o,{expose:n}){const t=o,{i18n:a}=f.useI18n();let l=e.ref("not_supported"),i=e.ref("not_supported"),r=e.ref(null),c=async()=>{};t.hasDllCapability&&({currentLogLevel:l,updateStatus:i,updateErrorMessage:r,updateLogLevel:c}=t.checkLogLevel(t.dataPlaneId,{currentLogLevelHint:()=>t.logLevelHint??null})),n({updateLogLevel:c});const d=e.computed(()=>{switch(i.value){case"success":return"success";case"error":return"danger";case"loading":case"pending":return"warning";default:return"neutral"}}),g=e.computed(()=>{switch(i.value){case"success":return a.t("modal.dp_list.status.succeed");case"error":return a.t("modal.dp_list.status.failed");case"pending":return a.t("modal.dp_list.status.pending");case"loading":return a.t("modal.dp_list.status.loading");default:return a.t("modal.dp_list.status.not_supported")}}),L=e.computed(()=>{switch(i.value){case"success":return S.CheckCircleIcon;case"error":case"not_supported":return S.ClearIcon;case"loading":return S.ProgressIcon;default:return S.EqualIcon}});return(y,u)=>{const k=e.resolveComponent("KSkeleton"),w=e.resolveComponent("KBadge"),B=e.resolveComponent("KTooltip");return e.openBlock(),e.createElementBlock("tr",null,[e.createElementVNode("td",null,e.toDisplayString(y.hostname),1),e.createElementVNode("td",q,[e.unref(l)==="not_supported"?(e.openBlock(),e.createElementBlock("span",F,e.toDisplayString(e.unref(a).t("log_level.not_applicable")),1)):e.unref(l)?(e.openBlock(),e.createElementBlock(e.Fragment,{key:2},[e.createElementVNode("span",R,e.toDisplayString(e.unref(a).t(`log_level.${e.unref(l)}`)),1),e.unref(l)!==y.targetLogLevel?(e.openBlock(),e.createElementBlock("span",H,[u[0]||(u[0]=e.createTextVNode(" → ")),e.createElementVNode("span",j,e.toDisplayString(e.unref(a).t(`log_level.${y.targetLogLevel}`)),1)])):e.createCommentVNode("",!0)],64)):(e.openBlock(),e.createBlock(k,{key:1,type:"spinner"}))]),e.createElementVNode("td",O,[e.unref(r)?(e.openBlock(),e.createBlock(B,{key:0,text:e.unref(r)},{default:e.withCtx(()=>[e.createVNode(w,{appearance:d.value,class:"badge-cell"},{icon:e.withCtx(()=>[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(L.value)))]),default:e.withCtx(()=>[e.createTextVNode(" "+e.toDisplayString(g.value),1)]),_:1},8,["appearance"])]),_:1},8,["text"])):(e.openBlock(),e.createBlock(w,{key:1,appearance:d.value,class:"badge-cell"},{icon:e.withCtx(()=>[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(L.value)))]),default:e.withCtx(()=>[e.createTextVNode(" "+e.toDisplayString(g.value),1)]),_:1},8,["appearance"]))])])}}}),T=(o,n)=>{const t=o.__vccOpts||o;for(const[a,l]of n)t[a]=l;return t},W=T(Q,[["__scopeId","data-v-ac7205dd"]]),z={class:"explanation-wrapper"},U={key:0,class:"warning-message","data-testid":"log-level-warning-message"},G={class:"revert-after-wrapper"},J={class:"time"},X={class:"seconds"},Y={class:"formatted-time","data-testid":"log-level-timeout-formatted"},Z={class:"data-plane-node-list","data-testid":"data-plane-node-list"},ee={style:{width:"40%"}},te={style:{width:"40%"}},ne=T(e.defineComponent({name:"ChangeLogLevelModal",__name:"ChangeLogLevelModal",props:e.mergeModels({instanceList:{},instanceLogLevel:{},requests:{}},{visible:{type:Boolean},visibleModifiers:{}}),emits:["update:visible"],setup(o){const n=o,t=e.useModel(o,"visible"),a=h.Notice,{i18n:l}=f.useI18n(),i=e.ref("edit"),r=e.ref(a),c=e.ref("60"),d=e.computed(()=>Math.floor(Number(c.value))),g=e.computed(()=>n.instanceList.filter(_=>_.hasDLLCapability!==!1)),L=e.computed(()=>{const _=g.value.length===1?l.t("modal.change_log_level.summary_with_name",{name:g.value[0].hostname}):l.t("modal.change_log_level.summary_with_number",{number:`${g.value.length}`});return l.t("modal.change_log_level.title",{summary:_})}),y=e.computed(()=>i.value==="submitting"||isNaN(d.value)||d.value<=0||g.value.length===0),u=f.useLogLevelCandidateSelectItems({initialSelected:a}),k=f.useLogLevelExplanation(r),w=f.useFriendlyRevertTime(d),B=f.useAsyncScheduler(n.requests.scheduler===void 0?{maxConcurrentAsyncs:10}:n.requests.scheduler),{checkDataPlaneLogLevel:oe}=f.useDataPlaneLogLevelChecker({getDataPlaneLogLevel:n.requests.getDataPlaneLogLevel,setDataPlaneLogLevel:n.requests.setDataPlaneLogLevel,requestExecutor:B.schedule}),E=new Map,ae=(_,m)=>{m===null?E.delete(_):E.set(_,m)},le=async()=>{if(i.value!=="edit"){D();return}i.value="submitting";const _=Array.from(E.values()).map(m=>m.updateLogLevel(r.value,d.value));try{await Promise.all(_)}catch(m){console.error("Failed to update log level",m)}finally{i.value="submitted"}},D=()=>{t.value=!1,c.value="60",i.value="edit",r.value=a},re=e.computed(()=>{switch(i.value){case"submitting":return l.t("modal.action_button.submitting");case"submitted":return l.t("modal.action_button.ok");default:return l.t("modal.action_button.confirm")}});return(_,m)=>{const se=e.resolveComponent("KSelect"),I=e.resolveComponent("KLabel"),ie=e.resolveComponent("KInput"),ce=e.resolveComponent("KModal");return e.openBlock(),e.createBlock(ce,{"action-button-disabled":y.value,"action-button-text":re.value,"data-testid":"change-log-level-modal","hide-cancel-button":!0,"hide-close-icon":i.value==="submitting","max-width":"640px",title:L.value,visible:t.value,onCancel:D,onProceed:le},{default:e.withCtx(()=>[i.value==="edit"?(e.openBlock(),e.createBlock(se,{key:0,modelValue:r.value,"onUpdate:modelValue":m[0]||(m[0]=p=>r.value=p),class:"log-level-select","data-testid":"log-level-select",items:e.unref(u),label:e.unref(l).t("modal.select_log_level_title")},null,8,["modelValue","items","label"])):e.createCommentVNode("",!0),e.createElementVNode("div",z,[e.createVNode(I,null,{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(l).t(`log_level.${r.value}`)),1)]),_:1}),e.createElementVNode("div",null,e.toDisplayString(e.unref(k).explanation),1),e.unref(k).warning?(e.openBlock(),e.createElementBlock("div",U,e.toDisplayString(e.unref(k).warning),1)):e.createCommentVNode("",!0)]),e.createElementVNode("div",G,[e.createVNode(I,null,{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(l).t("modal.revert_to_default_after.label")),1)]),_:1}),e.createElementVNode("div",J,[e.createVNode(ie,{modelValue:c.value,"onUpdate:modelValue":m[1]||(m[1]=p=>c.value=p),class:"time-input","data-testid":"log-level-timeout",disabled:i.value!=="edit",error:d.value<=0||isNaN(d.value),min:"1",type:"number"},null,8,["modelValue","disabled","error"]),e.createElementVNode("span",X,e.toDisplayString(e.unref(l).t("modal.revert_to_default_after.seconds")),1),e.createElementVNode("span",Y,e.toDisplayString(e.unref(w)),1)])]),e.createElementVNode("table",Z,[e.createElementVNode("thead",null,[e.createElementVNode("th",ee,e.toDisplayString(e.unref(l).t("modal.dp_list.header.host")),1),e.createElementVNode("th",te,e.toDisplayString(e.unref(l).t("modal.dp_list.header.action")),1),e.createElementVNode("th",null,e.toDisplayString(e.unref(l).t("modal.dp_list.header.status")),1)]),e.createElementVNode("tbody",null,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.instanceList,p=>{var $;return e.openBlock(),e.createBlock(W,{key:p.id,ref_for:!0,ref:de=>ae(p.id,de),"check-log-level":e.unref(oe),"data-plane-id":p.id,"data-testid":`data-plane-node-list-row-${p.id}`,"has-dll-capability":p.hasDLLCapability??!0,hostname:p.hostname,"log-level-hint":($=n.instanceLogLevel)==null?void 0:$.get(p.id),"target-log-level":r.value},null,8,["check-log-level","data-plane-id","data-testid","has-dll-capability","hostname","log-level-hint","target-log-level"])}),128))])])]),_:1},8,["action-button-disabled","action-button-text","hide-close-icon","title","visible"])}}}),[["__scopeId","data-v-c5cbbb14"]]);s.ChangeLogLevelModal=ne,s.LogLevel=h,s.composables=f,Object.defineProperty(s,Symbol.toStringTag,{value:"Module"})});
1
+ (function(s,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue"),require("@kong-ui-public/i18n"),require("@kong-ui-public/entities-shared"),require("@kong/icons")):typeof define=="function"&&define.amd?define(["exports","vue","@kong-ui-public/i18n","@kong-ui-public/entities-shared","@kong/icons"],e):(s=typeof globalThis<"u"?globalThis:s||self,e(s["kong-ui-public-entities-data-plane-nodes"]={},s.Vue,s["kong-ui-public-i18n"],s["kong-ui-public-entities-shared"],s.KongIcons))})(this,function(s,e,b,A,S){"use strict";var ue=Object.defineProperty;var ge=(s,e,b)=>e in s?ue(s,e,{enumerable:!0,configurable:!0,writable:!0,value:b}):s[e]=b;var C=(s,e,b)=>ge(s,typeof e!="symbol"?e+"":e,b);const P={modal:{action_button:{confirm:"Confirm",submitting:"Submitting...",ok:"OK"},change_log_level:{title:"Change Log Level ({summary})",summary_with_name:"Node {name}",summary_with_number:"{number} Nodes"},dp_list:{header:{host:"Host",action:"Action",status:"Status"},status:{failed:"Failure",loading:"Loading",pending:"Pending",succeed:"Succeed",not_supported:"Not Supported"}},log_level_disk_space_warning:"If left on for extended periods of time, can result in excess disk space consumption.",log_level_explanation:{debug:"Provides debug information about the plugin’s run loop and each individual plugin or other components.",info:"Provides messages that provide a record of the normal operation of the system.",notice:"Provides messages that provide a record of the normal operation of the system, but also alerts conditions that may require monitoring. Kong does not make a large difference between info and notice.",warn:"Is used to log any abnormal behavior that doesn’t result in dropped transactions but requires further investigation.",error:"Is used for logging errors that result in a request being dropped.",crit:"Is used when Kong is working under critical conditions and not working properly, thus affecting several clients."},revert_to_default_after:{label:"Revert to default after",hours:"hour",minutes:"min",seconds:"seconds"},select_log_level_title:"Select Log Level"},log_level:{debug:"Debug",info:"Info",notice:"Notice",warn:"Warn",error:"Error",crit:"Critical",not_applicable:"N/A"}};function N(){const o=b.createI18n("en-us",P);return{i18n:o,i18nT:b.i18nTComponent(o)}}var h=(o=>(o.Debug="debug",o.Info="info",o.Notice="notice",o.Warn="warn",o.Error="error",o.Critical="crit",o))(h||{});class M{constructor(n){C(this,"concurrentTokenSet",new Set);C(this,"concurrentTokenBorrowQueue",[]);for(let t=0;t<n;++t)this.concurrentTokenSet.add(Symbol(`token-${t}`))}hasAvailableConcurrentToken(){return this.concurrentTokenSet.size>0}borrowConcurrentToken(){if(this.concurrentTokenSet.size>0){const n=this.concurrentTokenSet.values().next().value;if(n)return this.concurrentTokenSet.delete(n),()=>{this.returnConcurrentToken(n)}}throw new Error("BUG: No available token to borrow")}returnConcurrentToken(n){if(this.concurrentTokenSet.has(n))throw new Error("Token already returned");const t=this.concurrentTokenBorrowQueue.shift();t?t[0](()=>this.returnConcurrentToken(n)):this.concurrentTokenSet.add(n)}async borrowToken(){return this.hasAvailableConcurrentToken()?this.borrowConcurrentToken():new Promise((n,t)=>{this.concurrentTokenBorrowQueue.push([n,t])})}clearWaitingQueue(n){for(;this.concurrentTokenBorrowQueue.length>0;){const[,t]=this.concurrentTokenBorrowQueue.shift();t(n)}}}class x extends Error{constructor(n,t){super(n,t),this.name="AsyncAbortException"}}class v{constructor(n){C(this,"tokenBucket",null);C(this,"schedule",async n=>{let t;this.tokenBucket&&(t=await this.tokenBucket.borrowToken());try{const a=await n();return t==null||t(),a}catch(a){throw t==null||t(),a}});C(this,"cancelAll",(n,t)=>{var a;(a=this.tokenBucket)==null||a.clearWaitingQueue(new x(n,t))});n.maxConcurrentAsyncs>0&&(this.tokenBucket=new M(n.maxConcurrentAsyncs))}}const K=Object.freeze(Object.defineProperty({__proto__:null,AsyncAbortException:x,AsyncScheduler:v,useAsyncScheduler:o=>o instanceof v?o:o===null?new v({maxConcurrentAsyncs:0}):new v(o)},Symbol.toStringTag,{value:"Module"})),V=[h.Debug,h.Info,h.Notice,h.Warn,h.Error,h.Critical],f={useI18n:N,...Object.freeze(Object.defineProperty({__proto__:null,supportedLevels:V,useDataPlaneLogLevelChecker:o=>{const n=o.requestExecutor??(r=>r()),{getDataPlaneLogLevel:t,setDataPlaneLogLevel:a}=o,{getMessageFromError:l}=A.useErrors();return{checkDataPlaneLogLevel:(r,c)=>{const d=e.ref(e.toValue(c==null?void 0:c.currentLogLevelHint)??null);d.value===null&&n(async()=>{d.value=await t(r)}).catch(u=>{u instanceof x||console.error("Failed to get data plane log level",u)}),c!=null&&c.currentLogLevelHint&&e.watch(()=>e.toValue(c.currentLogLevelHint),u=>{u&&(d.value=u)});const g=e.ref("pending"),L=e.ref(null);return{currentLogLevel:d,updateStatus:g,updateErrorMessage:L,updateLogLevel:async(u,k)=>{g.value="loading",L.value=null;try{await n(()=>a(r,u,k)),d.value=u,g.value="success"}catch(w){L.value=l(w),g.value="error"}}}}}},useFriendlyRevertTime:o=>{const{i18n:n}=N();return e.computed(()=>{const t=e.toValue(o);if(isNaN(t)||t<=0)return"";let a="";const l=t%60;l!==0&&(a+=`${l} ${n.t("modal.revert_to_default_after.seconds")}`);const i=Math.floor(t/60)%60;i!==0&&(a=`${i} ${n.t("modal.revert_to_default_after.minutes")} ${a}`);const r=Math.floor(t/3600);return r!==0&&(a=`${r} ${n.t("modal.revert_to_default_after.hours")} ${a}`),a})},useLogLevelCandidateSelectItems:o=>{const{i18n:n}=N();return e.computed(()=>{const t=e.toValue(o==null?void 0:o.disabled)??[];return V.map(a=>({label:n.t(`log_level.${a}`),value:a,selected:(o==null?void 0:o.initialSelected)===a,disabled:t.includes(a)}))})},useLogLevelExplanation:o=>{const n=[h.Debug],{i18n:t}=N();return e.computed(()=>{const a=e.toValue(o);return{explanation:t.t(`modal.log_level_explanation.${a}`),warning:n.includes(a)?t.t("modal.log_level_disk_space_warning"):void 0}})}},Symbol.toStringTag,{value:"Module"})),...K},q={"data-testid":"log-change-action"},F={key:0},R={"data-testid":"log-change-action-current-level"},H={key:0},j={"data-testid":"log-change-action-target-level"},O={"data-testid":"log-change-status"},Q=e.defineComponent({__name:"CLLModalNodeRow",props:{dataPlaneId:{},hostname:{},hasDllCapability:{type:Boolean},targetLogLevel:{},checkLogLevel:{},logLevelHint:{}},setup(o,{expose:n}){const t=o,{i18n:a}=f.useI18n();let l=e.ref("not_supported"),i=e.ref("not_supported"),r=e.ref(null),c=async()=>{};t.hasDllCapability&&({currentLogLevel:l,updateStatus:i,updateErrorMessage:r,updateLogLevel:c}=t.checkLogLevel(t.dataPlaneId,{currentLogLevelHint:()=>t.logLevelHint??null})),n({updateLogLevel:c});const d=e.computed(()=>{switch(i.value){case"success":return"success";case"error":return"danger";case"loading":case"pending":return"warning";default:return"neutral"}}),g=e.computed(()=>{switch(i.value){case"success":return a.t("modal.dp_list.status.succeed");case"error":return a.t("modal.dp_list.status.failed");case"pending":return a.t("modal.dp_list.status.pending");case"loading":return a.t("modal.dp_list.status.loading");default:return a.t("modal.dp_list.status.not_supported")}}),L=e.computed(()=>{switch(i.value){case"success":return S.CheckCircleIcon;case"error":case"not_supported":return S.ClearIcon;case"loading":return S.ProgressIcon;default:return S.EqualIcon}});return(y,u)=>{const k=e.resolveComponent("KSkeleton"),w=e.resolveComponent("KBadge"),B=e.resolveComponent("KTooltip");return e.openBlock(),e.createElementBlock("tr",null,[e.createElementVNode("td",null,e.toDisplayString(y.hostname),1),e.createElementVNode("td",q,[e.unref(l)==="not_supported"?(e.openBlock(),e.createElementBlock("span",F,e.toDisplayString(e.unref(a).t("log_level.not_applicable")),1)):e.unref(l)?(e.openBlock(),e.createElementBlock(e.Fragment,{key:2},[e.createElementVNode("span",R,e.toDisplayString(e.unref(a).t(`log_level.${e.unref(l)}`)),1),e.unref(l)!==y.targetLogLevel?(e.openBlock(),e.createElementBlock("span",H,[u[0]||(u[0]=e.createTextVNode(" → ",-1)),e.createElementVNode("span",j,e.toDisplayString(e.unref(a).t(`log_level.${y.targetLogLevel}`)),1)])):e.createCommentVNode("",!0)],64)):(e.openBlock(),e.createBlock(k,{key:1,type:"spinner"}))]),e.createElementVNode("td",O,[e.unref(r)?(e.openBlock(),e.createBlock(B,{key:0,text:e.unref(r)},{default:e.withCtx(()=>[e.createVNode(w,{appearance:d.value,class:"badge-cell"},{icon:e.withCtx(()=>[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(L.value)))]),default:e.withCtx(()=>[e.createTextVNode(" "+e.toDisplayString(g.value),1)]),_:1},8,["appearance"])]),_:1},8,["text"])):(e.openBlock(),e.createBlock(w,{key:1,appearance:d.value,class:"badge-cell"},{icon:e.withCtx(()=>[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(L.value)))]),default:e.withCtx(()=>[e.createTextVNode(" "+e.toDisplayString(g.value),1)]),_:1},8,["appearance"]))])])}}}),T=(o,n)=>{const t=o.__vccOpts||o;for(const[a,l]of n)t[a]=l;return t},W=T(Q,[["__scopeId","data-v-ac7205dd"]]),z={class:"explanation-wrapper"},U={key:0,class:"warning-message","data-testid":"log-level-warning-message"},G={class:"revert-after-wrapper"},J={class:"time"},X={class:"seconds"},Y={class:"formatted-time","data-testid":"log-level-timeout-formatted"},Z={class:"data-plane-node-list","data-testid":"data-plane-node-list"},ee={style:{width:"40%"}},te={style:{width:"40%"}},ne=T(e.defineComponent({name:"ChangeLogLevelModal",__name:"ChangeLogLevelModal",props:e.mergeModels({instanceList:{},instanceLogLevel:{},requests:{}},{visible:{type:Boolean},visibleModifiers:{}}),emits:["update:visible"],setup(o){const n=o,t=e.useModel(o,"visible"),a=h.Notice,{i18n:l}=f.useI18n(),i=e.ref("edit"),r=e.ref(a),c=e.ref("60"),d=e.computed(()=>Math.floor(Number(c.value))),g=e.computed(()=>n.instanceList.filter(_=>_.hasDLLCapability!==!1)),L=e.computed(()=>{const _=g.value.length===1?l.t("modal.change_log_level.summary_with_name",{name:g.value[0].hostname}):l.t("modal.change_log_level.summary_with_number",{number:`${g.value.length}`});return l.t("modal.change_log_level.title",{summary:_})}),y=e.computed(()=>i.value==="submitting"||isNaN(d.value)||d.value<=0||g.value.length===0),u=f.useLogLevelCandidateSelectItems({initialSelected:a}),k=f.useLogLevelExplanation(r),w=f.useFriendlyRevertTime(d),B=f.useAsyncScheduler(n.requests.scheduler===void 0?{maxConcurrentAsyncs:10}:n.requests.scheduler),{checkDataPlaneLogLevel:oe}=f.useDataPlaneLogLevelChecker({getDataPlaneLogLevel:n.requests.getDataPlaneLogLevel,setDataPlaneLogLevel:n.requests.setDataPlaneLogLevel,requestExecutor:B.schedule}),E=new Map,ae=(_,m)=>{m===null?E.delete(_):E.set(_,m)},le=async()=>{if(i.value!=="edit"){D();return}i.value="submitting";const _=Array.from(E.values()).map(m=>m.updateLogLevel(r.value,d.value));try{await Promise.all(_)}catch(m){console.error("Failed to update log level",m)}finally{i.value="submitted"}},D=()=>{t.value=!1,c.value="60",i.value="edit",r.value=a},re=e.computed(()=>{switch(i.value){case"submitting":return l.t("modal.action_button.submitting");case"submitted":return l.t("modal.action_button.ok");default:return l.t("modal.action_button.confirm")}});return(_,m)=>{const se=e.resolveComponent("KSelect"),I=e.resolveComponent("KLabel"),ie=e.resolveComponent("KInput"),ce=e.resolveComponent("KModal");return e.openBlock(),e.createBlock(ce,{"action-button-disabled":y.value,"action-button-text":re.value,"data-testid":"change-log-level-modal","hide-cancel-button":!0,"hide-close-icon":i.value==="submitting","max-width":"640px",title:L.value,visible:t.value,onCancel:D,onProceed:le},{default:e.withCtx(()=>[i.value==="edit"?(e.openBlock(),e.createBlock(se,{key:0,modelValue:r.value,"onUpdate:modelValue":m[0]||(m[0]=p=>r.value=p),class:"log-level-select","data-testid":"log-level-select",items:e.unref(u),label:e.unref(l).t("modal.select_log_level_title")},null,8,["modelValue","items","label"])):e.createCommentVNode("",!0),e.createElementVNode("div",z,[e.createVNode(I,null,{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(l).t(`log_level.${r.value}`)),1)]),_:1}),e.createElementVNode("div",null,e.toDisplayString(e.unref(k).explanation),1),e.unref(k).warning?(e.openBlock(),e.createElementBlock("div",U,e.toDisplayString(e.unref(k).warning),1)):e.createCommentVNode("",!0)]),e.createElementVNode("div",G,[e.createVNode(I,null,{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(l).t("modal.revert_to_default_after.label")),1)]),_:1}),e.createElementVNode("div",J,[e.createVNode(ie,{modelValue:c.value,"onUpdate:modelValue":m[1]||(m[1]=p=>c.value=p),class:"time-input","data-testid":"log-level-timeout",disabled:i.value!=="edit",error:d.value<=0||isNaN(d.value),min:"1",type:"number"},null,8,["modelValue","disabled","error"]),e.createElementVNode("span",X,e.toDisplayString(e.unref(l).t("modal.revert_to_default_after.seconds")),1),e.createElementVNode("span",Y,e.toDisplayString(e.unref(w)),1)])]),e.createElementVNode("table",Z,[e.createElementVNode("thead",null,[e.createElementVNode("th",ee,e.toDisplayString(e.unref(l).t("modal.dp_list.header.host")),1),e.createElementVNode("th",te,e.toDisplayString(e.unref(l).t("modal.dp_list.header.action")),1),e.createElementVNode("th",null,e.toDisplayString(e.unref(l).t("modal.dp_list.header.status")),1)]),e.createElementVNode("tbody",null,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.instanceList,p=>{var $;return e.openBlock(),e.createBlock(W,{key:p.id,ref_for:!0,ref:de=>ae(p.id,de),"check-log-level":e.unref(oe),"data-plane-id":p.id,"data-testid":`data-plane-node-list-row-${p.id}`,"has-dll-capability":p.hasDLLCapability??!0,hostname:p.hostname,"log-level-hint":($=n.instanceLogLevel)==null?void 0:$.get(p.id),"target-log-level":r.value},null,8,["check-log-level","data-plane-id","data-testid","has-dll-capability","hostname","log-level-hint","target-log-level"])}),128))])])]),_:1},8,["action-button-disabled","action-button-text","hide-close-icon","title","visible"])}}}),[["__scopeId","data-v-c5cbbb14"]]);s.ChangeLogLevelModal=ne,s.LogLevel=h,s.composables=f,Object.defineProperty(s,Symbol.toStringTag,{value:"Module"})});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kong-ui-public/entities-data-plane-nodes",
3
- "version": "0.4.4",
3
+ "version": "0.4.5",
4
4
  "type": "module",
5
5
  "main": "./dist/entities-data-plane-nodes.umd.js",
6
6
  "module": "./dist/entities-data-plane-nodes.es.js",
@@ -21,23 +21,23 @@
21
21
  "access": "public"
22
22
  },
23
23
  "peerDependencies": {
24
- "@kong/icons": "^1.33.2",
25
- "@kong/kongponents": "^9.37.2",
24
+ "@kong/icons": "^1.31.0",
25
+ "@kong/kongponents": "9.34.2",
26
26
  "axios": "^1.11.0",
27
- "vue": "^3.5.13",
27
+ "vue": ">= 3.3.13 < 4",
28
28
  "vue-router": "^4.4.5",
29
- "@kong-ui-public/entities-shared": "^3.27.4",
30
- "@kong-ui-public/i18n": "^2.4.2"
29
+ "@kong-ui-public/entities-shared": "^3.27.5",
30
+ "@kong-ui-public/i18n": "^2.4.3"
31
31
  },
32
32
  "devDependencies": {
33
- "@kong/design-tokens": "^1.18.0",
33
+ "@kong/design-tokens": "1.18.0",
34
34
  "@kong/icons": "^1.33.2",
35
- "@kong/kongponents": "^9.37.2",
36
- "axios": "^1.11.0",
35
+ "@kong/kongponents": "9.38.3",
36
+ "axios": "^1.7.7",
37
37
  "vue": "^3.5.13",
38
38
  "vue-router": "^4.4.5",
39
- "@kong-ui-public/i18n": "^2.4.2",
40
- "@kong-ui-public/entities-shared": "^3.27.4"
39
+ "@kong-ui-public/entities-shared": "^3.27.5",
40
+ "@kong-ui-public/i18n": "^2.4.3"
41
41
  },
42
42
  "repository": {
43
43
  "type": "git",