@kong-ui-public/entities-data-plane-nodes 0.5.35 → 0.5.36-pr.2790.95b70759b.0
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.
|
@@ -333,7 +333,7 @@ const be = (n) => n instanceof B ? n : n === null ? new B({ maxConcurrentAsyncs:
|
|
|
333
333
|
for (const [o, a] of e)
|
|
334
334
|
t[o] = a;
|
|
335
335
|
return t;
|
|
336
|
-
}, Be = /* @__PURE__ */ z(De, [["__scopeId", "data-v-
|
|
336
|
+
}, Be = /* @__PURE__ */ z(De, [["__scopeId", "data-v-a77ba884"]]), Ee = { class: "explanation-wrapper" }, Pe = {
|
|
337
337
|
key: 0,
|
|
338
338
|
class: "warning-message",
|
|
339
339
|
"data-testid": "log-level-warning-message"
|
|
@@ -480,7 +480,7 @@ const be = (n) => n instanceof B ? n : n === null ? new B({ maxConcurrentAsyncs:
|
|
|
480
480
|
}, 8, ["action-button-disabled", "action-button-text", "hide-close-icon", "title", "visible"]);
|
|
481
481
|
};
|
|
482
482
|
}
|
|
483
|
-
}), Ge = /* @__PURE__ */ z(Qe, [["__scopeId", "data-v-
|
|
483
|
+
}), Ge = /* @__PURE__ */ z(Qe, [["__scopeId", "data-v-f1206079"]]);
|
|
484
484
|
export {
|
|
485
485
|
Ge as ChangeLogLevelModal,
|
|
486
486
|
b as LogLevel,
|
|
@@ -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,C){"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 w=(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 S(){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){w(this,"concurrentTokenSet",new Set);w(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 N extends Error{constructor(n,t){super(n,t),this.name="AsyncAbortException"}}class x{constructor(n){w(this,"tokenBucket",null);w(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}});w(this,"cancelAll",(n,t)=>{var a;(a=this.tokenBucket)==null||a.clearWaitingQueue(new N(n,t))});n.maxConcurrentAsyncs>0&&(this.tokenBucket=new M(n.maxConcurrentAsyncs))}}const K=Object.freeze(Object.defineProperty({__proto__:null,AsyncAbortException:N,AsyncScheduler:x,useAsyncScheduler:o=>o instanceof x?o:o===null?new x({maxConcurrentAsyncs:0}):new x(o)},Symbol.toStringTag,{value:"Module"})),V=[h.Debug,h.Info,h.Notice,h.Warn,h.Error,h.Critical],_={useI18n:S,...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,i)=>{const d=e.ref(e.toValue(i==null?void 0:i.currentLogLevelHint)??null);d.value===null&&n(async()=>{d.value=await t(r)}).catch(u=>{u instanceof N||console.error("Failed to get data plane log level",u)}),i!=null&&i.currentLogLevelHint&&e.watch(()=>e.toValue(i.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(y){L.value=l(y),g.value="error"}}}}}},useFriendlyRevertTime:o=>{const{i18n:n}=S();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 c=Math.floor(t/60)%60;c!==0&&(a=`${c} ${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}=S();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}=S();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}=_.useI18n();let l=e.ref("not_supported"),c=e.ref("not_supported"),r=e.ref(null),i=async()=>{};t.hasDllCapability&&({currentLogLevel:l,updateStatus:c,updateErrorMessage:r,updateLogLevel:i}=t.checkLogLevel(t.dataPlaneId,{currentLogLevelHint:()=>t.logLevelHint??null})),n({updateLogLevel:i});const d=e.computed(()=>{switch(c.value){case"success":return"success";case"error":return"danger";case"loading":case"pending":return"warning";default:return"neutral"}}),g=e.computed(()=>{switch(c.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(c.value){case"success":return C.CheckCircleIcon;case"error":case"not_supported":return C.ClearIcon;case"loading":return C.ProgressIcon;default:return C.EqualIcon}});return(v,u)=>{const k=e.resolveComponent("KSkeleton"),y=e.resolveComponent("KBadge"),B=e.resolveComponent("KTooltip");return e.openBlock(),e.createElementBlock("tr",null,[e.createElementVNode("td",null,e.toDisplayString(o.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)!==o.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.${o.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(y,{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(y,{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}=_.useI18n(),c=e.ref("edit"),r=e.ref(a),i=e.ref("60"),d=e.computed(()=>Math.floor(Number(i.value))),g=e.computed(()=>n.instanceList.filter(f=>f.hasDLLCapability!==!1)),L=e.computed(()=>{const f=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:f})}),v=e.computed(()=>c.value==="submitting"||isNaN(d.value)||d.value<=0||g.value.length===0),u=_.useLogLevelCandidateSelectItems({initialSelected:a}),k=_.useLogLevelExplanation(r),y=_.useFriendlyRevertTime(d),B=_.useAsyncScheduler(n.requests.scheduler===void 0?{maxConcurrentAsyncs:10}:n.requests.scheduler),{checkDataPlaneLogLevel:oe}=_.useDataPlaneLogLevelChecker({getDataPlaneLogLevel:n.requests.getDataPlaneLogLevel,setDataPlaneLogLevel:n.requests.setDataPlaneLogLevel,requestExecutor:B.schedule}),E=new Map,ae=(f,m)=>{m===null?E.delete(f):E.set(f,m)},le=async()=>{if(c.value!=="edit"){D();return}c.value="submitting";const f=Array.from(E.values()).map(m=>m.updateLogLevel(r.value,d.value));try{await Promise.all(f)}catch(m){console.error("Failed to update log level",m)}finally{c.value="submitted"}},D=()=>{t.value=!1,i.value="60",c.value="edit",r.value=a},re=e.computed(()=>{switch(c.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(f,m)=>{const se=e.resolveComponent("KSelect"),I=e.resolveComponent("KLabel"),ce=e.resolveComponent("KInput"),ie=e.resolveComponent("KModal");return e.openBlock(),e.createBlock(ie,{"action-button-disabled":v.value,"action-button-text":re.value,"data-testid":"change-log-level-modal","hide-cancel-button":!0,"hide-close-icon":c.value==="submitting","max-width":"640px",title:L.value,visible:t.value,onCancel:D,onProceed:le},{default:e.withCtx(()=>[c.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(ce,{modelValue:i.value,"onUpdate:modelValue":m[1]||(m[1]=p=>i.value=p),class:"time-input","data-testid":"log-level-timeout",disabled:c.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(y)),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=_,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,k,A,C){"use strict";var ue=Object.defineProperty;var ge=(s,e,k)=>e in s?ue(s,e,{enumerable:!0,configurable:!0,writable:!0,value:k}):s[e]=k;var w=(s,e,k)=>ge(s,typeof e!="symbol"?e+"":e,k);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 S(){const o=k.createI18n("en-us",P);return{i18n:o,i18nT:k.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){w(this,"concurrentTokenSet",new Set);w(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 N extends Error{constructor(n,t){super(n,t),this.name="AsyncAbortException"}}class x{constructor(n){w(this,"tokenBucket",null);w(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}});w(this,"cancelAll",(n,t)=>{var a;(a=this.tokenBucket)==null||a.clearWaitingQueue(new N(n,t))});n.maxConcurrentAsyncs>0&&(this.tokenBucket=new M(n.maxConcurrentAsyncs))}}const K=Object.freeze(Object.defineProperty({__proto__:null,AsyncAbortException:N,AsyncScheduler:x,useAsyncScheduler:o=>o instanceof x?o:o===null?new x({maxConcurrentAsyncs:0}):new x(o)},Symbol.toStringTag,{value:"Module"})),V=[h.Debug,h.Info,h.Notice,h.Warn,h.Error,h.Critical],_={useI18n:S,...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 N||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,b)=>{g.value="loading",L.value=null;try{await n(()=>a(r,u,b)),d.value=u,g.value="success"}catch(y){L.value=l(y),g.value="error"}}}}}},useFriendlyRevertTime:o=>{const{i18n:n}=S();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}=S();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}=S();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}=_.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 C.CheckCircleIcon;case"error":case"not_supported":return C.ClearIcon;case"loading":return C.ProgressIcon;default:return C.EqualIcon}});return(v,u)=>{const b=e.resolveComponent("KSkeleton"),y=e.resolveComponent("KBadge"),B=e.resolveComponent("KTooltip");return e.openBlock(),e.createElementBlock("tr",null,[e.createElementVNode("td",null,e.toDisplayString(o.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)!==o.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.${o.targetLogLevel}`)),1)])):e.createCommentVNode("",!0)],64)):(e.openBlock(),e.createBlock(b,{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(y,{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(y,{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-a77ba884"]]),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}=_.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(f=>f.hasDLLCapability!==!1)),L=e.computed(()=>{const f=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:f})}),v=e.computed(()=>i.value==="submitting"||isNaN(d.value)||d.value<=0||g.value.length===0),u=_.useLogLevelCandidateSelectItems({initialSelected:a}),b=_.useLogLevelExplanation(r),y=_.useFriendlyRevertTime(d),B=_.useAsyncScheduler(n.requests.scheduler===void 0?{maxConcurrentAsyncs:10}:n.requests.scheduler),{checkDataPlaneLogLevel:oe}=_.useDataPlaneLogLevelChecker({getDataPlaneLogLevel:n.requests.getDataPlaneLogLevel,setDataPlaneLogLevel:n.requests.setDataPlaneLogLevel,requestExecutor:B.schedule}),E=new Map,ae=(f,m)=>{m===null?E.delete(f):E.set(f,m)},le=async()=>{if(i.value!=="edit"){D();return}i.value="submitting";const f=Array.from(E.values()).map(m=>m.updateLogLevel(r.value,d.value));try{await Promise.all(f)}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(f,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":v.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(b).explanation),1),e.unref(b).warning?(e.openBlock(),e.createElementBlock("div",U,e.toDisplayString(e.unref(b).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(y)),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-f1206079"]]);s.ChangeLogLevelModal=ne,s.LogLevel=h,s.composables=_,Object.defineProperty(s,Symbol.toStringTag,{value:"Module"})});
|
package/dist/style.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
tr[data-v-
|
|
1
|
+
tr[data-v-a77ba884],td[data-v-a77ba884]{color:#000933;color:var(--kui-color-text, #000933)}tbody tr[data-v-a77ba884]{font-weight:600;font-weight:var(--kui-font-weight-semibold, 600);line-height:40px;line-height:var(--kui-line-height-80, 40px)}.badge-cell[data-v-a77ba884]{vertical-align:sub}.log-level-select[data-v-f1206079],.explanation-wrapper[data-v-f1206079]{margin-bottom:20px;margin-bottom:var(--kui-space-70, 20px)}.explanation-wrapper[data-v-f1206079] .k-label{margin-bottom:0!important}.explanation-wrapper .warning-message[data-v-f1206079]{color:#d60027;color:var(--kui-color-text-danger, #d60027)}.revert-after-wrapper[data-v-f1206079]{margin-bottom:8px;margin-bottom:var(--kui-space-40, 8px)}.revert-after-wrapper .time[data-v-f1206079]{align-items:center;display:flex}.revert-after-wrapper .time .time-input[data-v-f1206079]{margin-right:8px;margin-right:var(--kui-space-40, 8px);width:80px}.revert-after-wrapper .time .seconds[data-v-f1206079]{color:#000933;color:var(--kui-color-text, #000933)}.revert-after-wrapper .time .formatted-time[data-v-f1206079]{color:#52596e;color:var(--kui-color-text-neutral-strong, #52596e);font-style:italic;margin-left:64px;margin-left:var(--kui-space-130, 64px)}.data-plane-node-list th[data-v-f1206079],.data-plane-node-list td[data-v-f1206079]{color:#000933;color:var(--kui-color-text, #000933)}.data-plane-node-list thead[data-v-f1206079]{text-align:left}.data-plane-node-list thead th[data-v-f1206079]{font-weight:700;font-weight:var(--kui-font-weight-bold, 700);line-height:36px;line-height:var(--kui-line-height-70, 36px)}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kong-ui-public/entities-data-plane-nodes",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.36-pr.2790.95b70759b.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/entities-data-plane-nodes.umd.js",
|
|
6
6
|
"module": "./dist/entities-data-plane-nodes.es.js",
|
|
@@ -26,17 +26,17 @@
|
|
|
26
26
|
"axios": "^1.13.2",
|
|
27
27
|
"vue": ">= 3.3.13 < 4",
|
|
28
28
|
"vue-router": "^4.6.4",
|
|
29
|
-
"@kong-ui-public/entities-shared": "^3.36.
|
|
29
|
+
"@kong-ui-public/entities-shared": "^3.36.13-pr.2790.95b70759b.0",
|
|
30
30
|
"@kong-ui-public/i18n": "^2.4.5"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
|
-
"@kong/design-tokens": "1.18.
|
|
33
|
+
"@kong/design-tokens": "1.18.3-pr.613.f4a145c.0",
|
|
34
34
|
"@kong/icons": "^1.41.0",
|
|
35
35
|
"@kong/kongponents": "9.48.8",
|
|
36
36
|
"axios": "^1.13.2",
|
|
37
37
|
"vue": "^3.5.26",
|
|
38
38
|
"vue-router": "^4.6.4",
|
|
39
|
-
"@kong-ui-public/entities-shared": "^3.36.
|
|
39
|
+
"@kong-ui-public/entities-shared": "^3.36.13-pr.2790.95b70759b.0",
|
|
40
40
|
"@kong-ui-public/i18n": "^2.4.5"
|
|
41
41
|
},
|
|
42
42
|
"repository": {
|