@kong-ui-public/entities-data-plane-nodes 0.3.102 → 0.3.103
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.
- package/dist/entities-data-plane-nodes.es.js +1 -1
- package/dist/entities-data-plane-nodes.umd.js +1 -1
- package/dist/style.css +1 -1
- package/dist/types/components/ChangeLogLevelModal.vue.d.ts +2 -2
- package/dist/types/components/ChangeLogLevelModal.vue.d.ts.map +1 -1
- package/dist/types/types/data-plane-node.d.ts +10 -10
- package/dist/types/types/data-plane-node.d.ts.map +1 -1
- package/package.json +5 -5
|
@@ -480,7 +480,7 @@ const be = (n) => n instanceof E ? n : n === null ? new E({ 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-c5cbbb14"]]);
|
|
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,k,A,S){"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 C=(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 N(){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){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,b)=>{g.value="loading",L.value=null;try{await n(()=>a(r,u,b)),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 b=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(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(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}),b=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(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(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-983a59ac"]]);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(" → ")),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/dist/style.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
tr[data-v-ac7205dd],td[data-v-ac7205dd]{color:#000933}tbody tr[data-v-ac7205dd]{font-weight:600;line-height:40px}.badge-cell[data-v-ac7205dd]{vertical-align:sub}.log-level-select[data-v-
|
|
1
|
+
tr[data-v-ac7205dd],td[data-v-ac7205dd]{color:#000933}tbody tr[data-v-ac7205dd]{font-weight:600;line-height:40px}.badge-cell[data-v-ac7205dd]{vertical-align:sub}.log-level-select[data-v-c5cbbb14],.explanation-wrapper[data-v-c5cbbb14]{margin-bottom:20px}.explanation-wrapper[data-v-c5cbbb14] .k-label{margin-bottom:0!important}.explanation-wrapper .warning-message[data-v-c5cbbb14]{color:#d60027}.revert-after-wrapper[data-v-c5cbbb14]{margin-bottom:8px}.revert-after-wrapper .time[data-v-c5cbbb14]{align-items:center;display:flex}.revert-after-wrapper .time .time-input[data-v-c5cbbb14]{margin-right:8px;width:80px}.revert-after-wrapper .time .seconds[data-v-c5cbbb14]{color:#000933}.revert-after-wrapper .time .formatted-time[data-v-c5cbbb14]{color:#52596e;font-style:italic;margin-left:64px}.data-plane-node-list th[data-v-c5cbbb14],.data-plane-node-list td[data-v-c5cbbb14]{color:#000933}.data-plane-node-list thead[data-v-c5cbbb14]{text-align:left}.data-plane-node-list thead th[data-v-c5cbbb14]{font-weight:700;line-height:36px}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { LogLevel, type DataPlaneNodeCommon } from '../types';
|
|
2
2
|
import type { AsyncScheduler, AsyncSchedulerOptions } from '../composables';
|
|
3
3
|
declare let __VLS_typeProps: {
|
|
4
|
-
instanceList:
|
|
4
|
+
instanceList: Array<Pick<DataPlaneNodeCommon, 'id' | 'hostname'> & {
|
|
5
5
|
hasDLLCapability?: boolean;
|
|
6
|
-
}
|
|
6
|
+
}>;
|
|
7
7
|
instanceLogLevel: Map<string, LogLevel>;
|
|
8
8
|
requests: {
|
|
9
9
|
scheduler?: AsyncScheduler | AsyncSchedulerOptions | null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChangeLogLevelModal.vue.d.ts","sourceRoot":"","sources":["../../../src/components/ChangeLogLevelModal.vue"],"names":[],"mappings":"AAuQA,OAAO,EAAE,QAAQ,EAAE,KAAK,mBAAmB,EAAE,MAAM,UAAU,CAAA;AAC7D,OAAO,KAAK,EAAE,cAAc,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAA;AAQ3E,QAAA,IAAI,eAAe,EAAG;IACpB,YAAY,EAAE,CAAC,IAAI,CAAC,mBAAmB,EAAE,IAAI,GAAG,UAAU,CAAC,GAAG;QAAE,gBAAgB,CAAC,EAAE,OAAO,CAAA;KAAE,CAAC,
|
|
1
|
+
{"version":3,"file":"ChangeLogLevelModal.vue.d.ts","sourceRoot":"","sources":["../../../src/components/ChangeLogLevelModal.vue"],"names":[],"mappings":"AAuQA,OAAO,EAAE,QAAQ,EAAE,KAAK,mBAAmB,EAAE,MAAM,UAAU,CAAA;AAC7D,OAAO,KAAK,EAAE,cAAc,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAA;AAQ3E,QAAA,IAAI,eAAe,EAAG;IACpB,YAAY,EAAE,KAAK,CAAC,IAAI,CAAC,mBAAmB,EAAE,IAAI,GAAG,UAAU,CAAC,GAAG;QAAE,gBAAgB,CAAC,EAAE,OAAO,CAAA;KAAE,CAAC,CAAA;IAClG,gBAAgB,EAAE,GAAG,CAAC,MAAM,EAAmB,QAAQ,CAAC,CAAA;IACxD,QAAQ,EAAE;QACR,SAAS,CAAC,EAAE,cAAc,GAAG,qBAAqB,GAAG,IAAI,CAAA;QACzD,oBAAoB,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,OAAO,CAAC,QAAQ,CAAC,CAAA;QAC/D,oBAAoB,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;KACrG,CAAA;CACF,CAAC;AAwGF,KAAK,iBAAiB,GAAG;IACzB,SAAS,CAAC,EAAE,OAAO,CAAC;CACnB,GAAG,OAAO,eAAe,CAAC;;;;;;AAmL3B,wBAOG"}
|
|
@@ -11,17 +11,17 @@ export interface KonnectRuntimeInstance extends DataPlaneNodeCommon {
|
|
|
11
11
|
config_hash: string;
|
|
12
12
|
compatibility_status: {
|
|
13
13
|
state: string;
|
|
14
|
-
issues?: {
|
|
15
|
-
affected_resources: {
|
|
14
|
+
issues?: Array<{
|
|
15
|
+
affected_resources: Array<{
|
|
16
16
|
id: string;
|
|
17
17
|
type: string;
|
|
18
|
-
}
|
|
18
|
+
}>;
|
|
19
19
|
code: string;
|
|
20
20
|
description: string;
|
|
21
21
|
documentation_url: string;
|
|
22
22
|
resolution: string;
|
|
23
23
|
severity: string;
|
|
24
|
-
}
|
|
24
|
+
}>;
|
|
25
25
|
config_hash?: string;
|
|
26
26
|
};
|
|
27
27
|
data_plane_cert_id: string;
|
|
@@ -35,22 +35,22 @@ export interface KonnectRuntimeInstance extends DataPlaneNodeCommon {
|
|
|
35
35
|
connection_state: {
|
|
36
36
|
is_connected: boolean;
|
|
37
37
|
};
|
|
38
|
-
errors?: {
|
|
38
|
+
errors?: Array<{
|
|
39
39
|
name: string;
|
|
40
40
|
config_hash: string;
|
|
41
|
-
flattened_errors: {
|
|
41
|
+
flattened_errors: Array<{
|
|
42
42
|
entity_id: string;
|
|
43
43
|
entity_name: string;
|
|
44
|
-
errors: {
|
|
44
|
+
errors: Array<{
|
|
45
45
|
error_message: string;
|
|
46
46
|
type: string;
|
|
47
47
|
field: string;
|
|
48
|
-
}
|
|
48
|
+
}>;
|
|
49
49
|
entity_type: string;
|
|
50
|
-
}
|
|
50
|
+
}>;
|
|
51
51
|
code: number;
|
|
52
52
|
source: string;
|
|
53
|
-
}
|
|
53
|
+
}>;
|
|
54
54
|
connected?: string;
|
|
55
55
|
total_traffic: number | null;
|
|
56
56
|
error_rate: number | null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"data-plane-node.d.ts","sourceRoot":"","sources":["../../../src/types/data-plane-node.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,mBAAmB;IAClC,EAAE,EAAE,MAAM,CAAA;IACV,QAAQ,EAAE,MAAM,CAAA;CACjB;AAED,MAAM,WAAW,sBAAuB,SAAQ,mBAAmB;IACjE,OAAO,EAAE,MAAM,CAAA;IACf,SAAS,EAAE,MAAM,CAAA;IACjB,IAAI,EAAE,MAAM,CAAA;IACZ,UAAU,EAAE,MAAM,CAAA;IAClB,UAAU,EAAE,MAAM,CAAA;IAClB,WAAW,EAAE,MAAM,CAAA;IACnB,oBAAoB,EAAE;QACpB,KAAK,EAAE,MAAM,CAAA;QACb,MAAM,CAAC,EAAE;
|
|
1
|
+
{"version":3,"file":"data-plane-node.d.ts","sourceRoot":"","sources":["../../../src/types/data-plane-node.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,mBAAmB;IAClC,EAAE,EAAE,MAAM,CAAA;IACV,QAAQ,EAAE,MAAM,CAAA;CACjB;AAED,MAAM,WAAW,sBAAuB,SAAQ,mBAAmB;IACjE,OAAO,EAAE,MAAM,CAAA;IACf,SAAS,EAAE,MAAM,CAAA;IACjB,IAAI,EAAE,MAAM,CAAA;IACZ,UAAU,EAAE,MAAM,CAAA;IAClB,UAAU,EAAE,MAAM,CAAA;IAClB,WAAW,EAAE,MAAM,CAAA;IACnB,oBAAoB,EAAE;QACpB,KAAK,EAAE,MAAM,CAAA;QACb,MAAM,CAAC,EAAE,KAAK,CAAC;YACb,kBAAkB,EAAE,KAAK,CAAC;gBACxB,EAAE,EAAE,MAAM,CAAA;gBACV,IAAI,EAAE,MAAM,CAAA;aACb,CAAC,CAAA;YACF,IAAI,EAAE,MAAM,CAAA;YACZ,WAAW,EAAE,MAAM,CAAA;YACnB,iBAAiB,EAAE,MAAM,CAAA;YACzB,UAAU,EAAE,MAAM,CAAA;YAClB,QAAQ,EAAE,MAAM,CAAA;SACjB,CAAC,CAAA;QACF,WAAW,CAAC,EAAE,MAAM,CAAA;KACrB,CAAA;IACD,kBAAkB,EAAE,MAAM,CAAA;IAC1B,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAC/B,YAAY,EAAE;QACZ,OAAO,EAAE,MAAM,EAAE,CAAA;QACjB,mBAAmB,EAAE,MAAM,CAAA;QAC3B,aAAa,EAAE,MAAM,CAAA;QACrB,aAAa,EAAE,MAAM,CAAA;KACtB,CAAA;IACD,gBAAgB,EAAE;QAChB,YAAY,EAAE,OAAO,CAAA;KACtB,CAAA;IACD,MAAM,CAAC,EAAE,KAAK,CAAC;QACb,IAAI,EAAE,MAAM,CAAA;QACZ,WAAW,EAAE,MAAM,CAAA;QACnB,gBAAgB,EAAE,KAAK,CAAC;YACtB,SAAS,EAAE,MAAM,CAAA;YACjB,WAAW,EAAE,MAAM,CAAA;YACnB,MAAM,EAAE,KAAK,CAAC;gBACZ,aAAa,EAAE,MAAM,CAAA;gBACrB,IAAI,EAAE,MAAM,CAAA;gBACZ,KAAK,EAAE,MAAM,CAAA;aACd,CAAC,CAAA;YACF,WAAW,EAAE,MAAM,CAAA;SACpB,CAAC,CAAA;QACF,IAAI,EAAE,MAAM,CAAA;QACZ,MAAM,EAAE,MAAM,CAAA;KACf,CAAC,CAAA;IACF,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,aAAa,EAAE,MAAM,GAAG,IAAI,CAAA;IAC5B,UAAU,EAAE,MAAM,GAAG,IAAI,CAAA;IACzB,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kong-ui-public/entities-data-plane-nodes",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.103",
|
|
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,8 +26,8 @@
|
|
|
26
26
|
"axios": "^1.7.7",
|
|
27
27
|
"vue": ">= 3.3.13 < 4",
|
|
28
28
|
"vue-router": "^4.4.5",
|
|
29
|
-
"@kong-ui-public/entities-shared": "^3.25.
|
|
30
|
-
"@kong-ui-public/i18n": "^2.3.
|
|
29
|
+
"@kong-ui-public/entities-shared": "^3.25.2",
|
|
30
|
+
"@kong-ui-public/i18n": "^2.3.1"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
33
|
"@kong/design-tokens": "1.17.4",
|
|
@@ -36,8 +36,8 @@
|
|
|
36
36
|
"axios": "^1.7.7",
|
|
37
37
|
"vue": "^3.5.13",
|
|
38
38
|
"vue-router": "^4.4.5",
|
|
39
|
-
"@kong-ui-public/entities-shared": "^3.25.
|
|
40
|
-
"@kong-ui-public/i18n": "^2.3.
|
|
39
|
+
"@kong-ui-public/entities-shared": "^3.25.2",
|
|
40
|
+
"@kong-ui-public/i18n": "^2.3.1"
|
|
41
41
|
},
|
|
42
42
|
"repository": {
|
|
43
43
|
"type": "git",
|