plugin-workflow-portainer 0.0.0-stage → 0.2.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.
Files changed (99) hide show
  1. package/LICENSE +176 -0
  2. package/README.md +31 -3
  3. package/client-v2.js +1 -0
  4. package/client.js +1 -0
  5. package/dist/client/127.09e6675863ac8138.js +10 -0
  6. package/dist/client/57.67f04a547ead06b8.js +10 -0
  7. package/dist/client/660.546c702d1ddf7eff.js +10 -0
  8. package/dist/client/981.e38099c59bf992f0.js +10 -0
  9. package/dist/client/index.js +10 -0
  10. package/dist/client-v2/127.9f65dc2e3d0df10a.js +10 -0
  11. package/dist/client-v2/57.a60e16e4b4e4fa28.js +10 -0
  12. package/dist/client-v2/660.29ae3c3b4040039d.js +10 -0
  13. package/dist/client-v2/981.8627062881ad83d1.js +10 -0
  14. package/dist/client-v2/index.js +10 -0
  15. package/dist/externalVersion.js +20 -0
  16. package/dist/index.js +48 -0
  17. package/dist/locale/en-US.json +193 -0
  18. package/dist/locale/vi-VN.json +193 -0
  19. package/dist/locale/zh-CN.json +193 -0
  20. package/dist/node_modules/joi/dist/joi-browser.min.js +1 -0
  21. package/dist/node_modules/joi/lib/annotate.js +175 -0
  22. package/dist/node_modules/joi/lib/base.js +1069 -0
  23. package/dist/node_modules/joi/lib/cache.js +143 -0
  24. package/dist/node_modules/joi/lib/common.js +216 -0
  25. package/dist/node_modules/joi/lib/compile.js +283 -0
  26. package/dist/node_modules/joi/lib/errors.js +271 -0
  27. package/dist/node_modules/joi/lib/extend.js +312 -0
  28. package/dist/node_modules/joi/lib/index.d.ts +2365 -0
  29. package/dist/node_modules/joi/lib/index.js +1 -0
  30. package/dist/node_modules/joi/lib/manifest.js +476 -0
  31. package/dist/node_modules/joi/lib/messages.js +207 -0
  32. package/dist/node_modules/joi/lib/modify.js +267 -0
  33. package/dist/node_modules/joi/lib/ref.js +414 -0
  34. package/dist/node_modules/joi/lib/schemas.js +302 -0
  35. package/dist/node_modules/joi/lib/state.js +166 -0
  36. package/dist/node_modules/joi/lib/template.js +463 -0
  37. package/dist/node_modules/joi/lib/trace.js +346 -0
  38. package/dist/node_modules/joi/lib/types/alternatives.js +364 -0
  39. package/dist/node_modules/joi/lib/types/any.js +174 -0
  40. package/dist/node_modules/joi/lib/types/array.js +809 -0
  41. package/dist/node_modules/joi/lib/types/binary.js +100 -0
  42. package/dist/node_modules/joi/lib/types/boolean.js +150 -0
  43. package/dist/node_modules/joi/lib/types/date.js +233 -0
  44. package/dist/node_modules/joi/lib/types/function.js +93 -0
  45. package/dist/node_modules/joi/lib/types/keys.js +1084 -0
  46. package/dist/node_modules/joi/lib/types/link.js +184 -0
  47. package/dist/node_modules/joi/lib/types/number.js +363 -0
  48. package/dist/node_modules/joi/lib/types/object.js +22 -0
  49. package/dist/node_modules/joi/lib/types/string.js +850 -0
  50. package/dist/node_modules/joi/lib/types/symbol.js +102 -0
  51. package/dist/node_modules/joi/lib/validator.js +750 -0
  52. package/dist/node_modules/joi/lib/values.js +263 -0
  53. package/dist/node_modules/joi/node_modules/@hapi/topo/lib/index.d.ts +60 -0
  54. package/dist/node_modules/joi/node_modules/@hapi/topo/lib/index.js +225 -0
  55. package/dist/node_modules/joi/node_modules/@hapi/topo/package.json +30 -0
  56. package/dist/node_modules/joi/package.json +1 -0
  57. package/dist/server/actions/portainer.js +317 -0
  58. package/dist/server/collections/portainer-instances.js +54 -0
  59. package/dist/server/index.js +54 -0
  60. package/dist/server/instructions/PortainerStackControlInstruction.js +156 -0
  61. package/dist/server/instructions/PortainerStackRedeployInstruction.js +254 -0
  62. package/dist/server/instructions/helpers.js +211 -0
  63. package/dist/server/plugin.js +177 -0
  64. package/dist/server/services/PortainerClient.js +669 -0
  65. package/dist/shared/collection.js +57 -0
  66. package/dist/shared/constants.js +66 -0
  67. package/dist/shared/env.js +238 -0
  68. package/dist/shared/types.js +24 -0
  69. package/package.json +50 -4
  70. package/server.js +1 -0
  71. package/src/client/index.tsx +50 -0
  72. package/src/client/instructions.tsx +76 -0
  73. package/src/client-v2/__tests__/workflow-registration.test.tsx +242 -0
  74. package/src/client-v2/components/ControlFieldset.tsx +46 -0
  75. package/src/client-v2/components/PortainerEnvEditor.tsx +223 -0
  76. package/src/client-v2/components/PortainerSettingsPage.tsx +707 -0
  77. package/src/client-v2/components/PortainerTargetFields.tsx +309 -0
  78. package/src/client-v2/components/RedeployFieldset.tsx +124 -0
  79. package/src/client-v2/components/StackDetailDrawer.tsx +790 -0
  80. package/src/client-v2/index.tsx +50 -0
  81. package/src/client-v2/instructions.tsx +162 -0
  82. package/src/client-v2/locale.ts +24 -0
  83. package/src/index.ts +11 -0
  84. package/src/locale/en-US.json +193 -0
  85. package/src/locale/vi-VN.json +193 -0
  86. package/src/locale/zh-CN.json +193 -0
  87. package/src/server/__tests__/portainer-workflow.test.ts +559 -0
  88. package/src/server/actions/portainer.ts +361 -0
  89. package/src/server/collections/portainer-instances.ts +34 -0
  90. package/src/server/index.ts +13 -0
  91. package/src/server/instructions/PortainerStackControlInstruction.ts +139 -0
  92. package/src/server/instructions/PortainerStackRedeployInstruction.ts +255 -0
  93. package/src/server/instructions/helpers.ts +237 -0
  94. package/src/server/plugin.ts +174 -0
  95. package/src/server/services/PortainerClient.ts +846 -0
  96. package/src/shared/collection.ts +32 -0
  97. package/src/shared/constants.ts +25 -0
  98. package/src/shared/env.ts +243 -0
  99. package/src/shared/types.ts +164 -0
@@ -0,0 +1,10 @@
1
+ /**
2
+ * This file is part of the NocoBase (R) project.
3
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
+ * Authors: NocoBase Team.
5
+ *
6
+ * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
+ * For more information, please refer to: https://www.nocobase.com/agreement.
8
+ */
9
+
10
+ "use strict";(self.webpackChunkplugin_workflow_portainer_client_v2=self.webpackChunkplugin_workflow_portainer_client_v2||[]).push([["981"],{572:function(e,t,n){n.d(t,{PortainerSettingsPage:function(){return x}});var r=n(375),a=n(485),l=n(59),o=n(155),i=n.n(o),c=n(249),s=n(515);function u(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function m(e,t,n,r,a,l,o){try{var i=e[l](o),c=i.value}catch(e){n(e);return}i.done?t(c):Promise.resolve(c).then(r,a)}function d(e){return function(){var t=this,n=arguments;return new Promise(function(r,a){var l=e.apply(t,n);function o(e){m(l,r,a,o,i,"next",e)}function i(e){m(l,r,a,o,i,"throw",e)}o(void 0)})}}function p(e,t){return null!=t&&"u">typeof Symbol&&t[Symbol.hasInstance]?!!t[Symbol.hasInstance](e):e instanceof t}function y(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n,r,a=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=a){var l=[],o=!0,i=!1;try{for(a=a.call(e);!(o=(n=a.next()).done)&&(l.push(n.value),!t||l.length!==t);o=!0);}catch(e){i=!0,r=e}finally{try{o||null==a.return||a.return()}finally{if(i)throw r}}return l}}(e,t)||f(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function f(e,t){if(e){if("string"==typeof e)return u(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return u(e,t)}}function h(e,t){var n,r,a,l={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]},o=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),i=Object.defineProperty;return i(o,"next",{value:c(0)}),i(o,"throw",{value:c(1)}),i(o,"return",{value:c(2)}),"function"==typeof Symbol&&i(o,Symbol.iterator,{value:function(){return this}}),o;function c(i){return function(c){var s=[i,c];if(n)throw TypeError("Generator is already executing.");for(;o&&(o=0,s[0]&&(l=0)),l;)try{if(n=1,r&&(a=2&s[0]?r.return:s[0]?r.throw||((a=r.return)&&a.call(r),0):r.next)&&!(a=a.call(r,s[1])).done)return a;switch(r=0,a&&(s=[2&s[0],a.value]),s[0]){case 0:case 1:a=s;break;case 4:return l.label++,{value:s[1],done:!1};case 5:l.label++,r=s[1],s=[0];continue;case 7:s=l.ops.pop(),l.trys.pop();continue;default:if(!(a=(a=l.trys).length>0&&a[a.length-1])&&(6===s[0]||2===s[0])){l=0;continue}if(3===s[0]&&(!a||s[1]>a[0]&&s[1]<a[3])){l.label=s[1];break}if(6===s[0]&&l.label<a[1]){l.label=a[1],a=s;break}if(a&&l.label<a[2]){l.label=a[2],l.ops.push(s);break}a[2]&&l.ops.pop(),l.trys.pop();continue}s=t.call(e,l)}catch(e){s=[6,e],r=0}finally{n=a=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}}}function g(e){var t=Number(null!=e?e:0);if(!Number.isFinite(t)||t<=0)return"0 B";for(var n=["B","KB","MB","GB","TB"],r=0,a=t;a>=1024&&r<n.length-1;)a/=1024,r+=1;return"".concat(a>=100||0===r?Math.round(a):a.toFixed(1)," ").concat(n[r])}function b(e){return e&&Number.isFinite(e)&&!(e<=0)?new Date(1e3*e).toLocaleString():"-"}function E(e,t){return 3===e?i().createElement(l.Tag,{color:"processing"},t("Deploying")):4===e?i().createElement(l.Tag,{color:"error"},t("Error")):i().createElement(l.Tag,{color:1===e?"success":"default"},t(1===e?"Active":"Inactive"))}function v(e){var t,n,m,v,S,k,w,T,C,I,x,P,O,z,F,A,B,j,D,U,M=e.open,N=e.instance,L=e.stack,R=e.endpoints,G=e.onClose,q=e.onStackChanged,H=(0,s.kj)(),K=(0,a.useApp)().apiClient,V=y((0,o.useState)(null),2),_=V[0],Y=V[1],X=y((0,o.useState)(!1),2),Z=X[0],W=X[1],$=y((0,o.useState)(!1),2),Q=$[0],J=$[1],ee=y((0,o.useState)(null),2),et=ee[0],en=ee[1],er=y((0,o.useState)(!1),2),ea=er[0],el=er[1],eo=y((0,o.useState)(null),2),ei=eo[0],ec=eo[1],es=y((0,o.useState)(null),2),eu=es[0],em=es[1],ed=y((0,o.useState)(100),2),ep=ed[0],ey=ed[1],ef=y((0,o.useState)(""),2),eh=ef[0],eg=ef[1],eb=y((0,o.useState)(!1),2),eE=eb[0],ev=eb[1],eS=(0,o.useRef)(!1),ek=(0,o.useCallback)(function(e){return d(function(){var t,n,r,a;return h(this,function(l){switch(l.label){case 0:if(!N||!L||eS.current)return[2];eS.current=!0,(null==e?void 0:e.silent)?J(!0):W(!0),l.label=1;case 1:return l.trys.push([1,3,4,5]),[4,K.request({url:"".concat(c.Yk,":getStackOverview"),method:"get",params:{instanceId:N.id,stackId:L.id,includeStats:"true",includeFile:(null==e?void 0:e.includeFile)===!1?"false":"true"}})];case 2:return(r=null==(n=l.sent())||null==(t=n.data)?void 0:t.data)&&(Y(function(t){var n,a;return n=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){var r;r=n[t],t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r})}return e}({},r),a=a={stackFileContent:(null==e?void 0:e.includeFile)===!1&&t?t.stackFileContent:r.stackFileContent},Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(a)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t})(Object(a)).forEach(function(e){Object.defineProperty(n,e,Object.getOwnPropertyDescriptor(a,e))}),n}),en(null)),[3,5];case 3:return en(p(a=l.sent(),Error)?a.message:H("Failed to load Stack details from Portainer")),[3,5];case 4:return eS.current=!1,W(!1),J(!1),[7];case 5:return[2]}})})()},[K,N,L,H]);(0,o.useEffect)(function(){M&&N&&L?(Y(null),en(null),ek({silent:!1,includeFile:!0})):(el(!1),em(null))},[ek,N,M,L]),(0,o.useEffect)(function(){if(M&&ea&&N&&L){var e=window.setInterval(function(){("u"<typeof document||"hidden"!==document.visibilityState)&&ek({silent:!0,includeFile:!1})},5e3);return function(){return window.clearInterval(e)}}},[ea,ek,N,M,L]);var ew=(0,o.useCallback)(function(e,t){return d(function(){var n,r,a,o,i,s;return h(this,function(u){switch(u.label){case 0:if(!N||!L)return[2];r=null!=(n=null==_?void 0:_.detail.endpointId)?n:L.endpointId,ev(!0),u.label=1;case 1:return u.trys.push([1,3,4,5]),[4,K.request({url:"".concat(c.Yk,":getContainerLogs"),method:"get",params:{instanceId:N.id,endpointId:r,containerId:e.id,tail:t}})];case 2:return eg(String(null!=(a=null==(s=u.sent())||null==(i=s.data)||null==(o=i.data)?void 0:o.logs)?a:"")),[3,5];case 3:return u.sent(),l.message.error(H("Failed to fetch container logs")),[3,5];case 4:return ev(!1),[7];case 5:return[2]}})})()},[K,N,null==_?void 0:_.detail.endpointId,L,H]),eT=function(e){em(e),eg(""),ew(e,ep)},eC=function(e){return d(function(){var t,n,r,a;return h(this,function(o){switch(o.label){case 0:if(!N||!L)return[2];n=null!=(t=null==_?void 0:_.detail.endpointId)?t:L.endpointId,ec(e),o.label=1;case 1:return o.trys.push([1,4,5,6]),[4,K.request({url:"".concat(c.Yk,":controlStack"),method:"post",data:{instanceId:N.id,endpointId:n,stackId:L.id,operation:e}})];case 2:return o.sent(),l.message.success("start"===e?H("Stack started"):H("Stack stopped")),[4,ek({silent:!0,includeFile:!1})];case 3:return o.sent(),null==q||q(),[3,6];case 4:return a=p(r=o.sent(),Error)?r.message:H("Failed to control Stack"),l.message.error(a),[3,6];case 5:return ec(null),[7];case 6:return[2]}})})()},eI=null==_?void 0:_.detail,ex=null==_?void 0:_.summary,eP=null!=(n=null==eI?void 0:eI.endpointId)?n:null==L?void 0:L.endpointId,eO=eP?null!=(m=null==(U=R.find(function(e){return e.id===eP}))?void 0:U.name)?m:"#".concat(eP):"-",ez=null!=(v=null!=(S=null==eI?void 0:eI.status)?S:null==L?void 0:L.status)?v:1,eF=[{title:H("Container / Service"),key:"name",width:230,render:function(e,t){return i().createElement(l.Space,{direction:"vertical",size:2},i().createElement(l.Space,{size:"small",wrap:!0},i().createElement(l.Typography.Text,{strong:!0},t.name||t.id),t.service?i().createElement(l.Tag,{color:"geekblue"},t.service):null),i().createElement(l.Typography.Text,{type:"secondary",style:{fontSize:12}},t.image))}},{title:H("State & Uptime"),key:"state",width:150,render:function(e,t){return i().createElement(l.Space,{direction:"vertical",size:2},i().createElement(l.Tag,{color:t.healthy?"success":"exited"===t.state?"default":"error",icon:t.healthy?i().createElement(r.CheckCircleOutlined,null):i().createElement(r.CloseCircleOutlined,null)},t.state),t.status?i().createElement(l.Typography.Text,{type:"secondary",style:{fontSize:12}},t.status):null)}},{title:H("Ports & IP"),key:"network",width:190,render:function(e,t){return i().createElement(l.Space,{direction:"vertical",size:2},t.ports&&t.ports.length>0?t.ports.map(function(e){return i().createElement(l.Typography.Text,{key:e,code:!0,style:{fontSize:12}},e)}):i().createElement(l.Typography.Text,{type:"secondary"},"-"),t.ipAddresses&&t.ipAddresses.length>0?i().createElement(l.Typography.Text,{type:"secondary",style:{fontSize:12}},"IP: ",t.ipAddresses.join(", ")):null)}},{title:H("CPU"),key:"cpu",width:130,render:function(e,t){return t.stats?i().createElement(l.Space,{direction:"vertical",size:0,style:{width:"100%"}},i().createElement(l.Typography.Text,{strong:!0},t.stats.cpuPercent.toFixed(2),"%"),i().createElement(l.Progress,{percent:Math.min(100,Number(t.stats.cpuPercent.toFixed(1))),size:"small",showInfo:!1,"aria-label":"".concat(H("CPU")," ").concat(t.name)})):i().createElement(l.Typography.Text,{type:"secondary"},"-")}},{title:H("Memory"),key:"memory",width:175,render:function(e,t){return t.stats?i().createElement(l.Space,{direction:"vertical",size:0,style:{width:"100%"}},i().createElement(l.Typography.Text,{strong:!0},g(t.stats.memUsageBytes)," ",i().createElement(l.Typography.Text,{type:"secondary",style:{fontWeight:400,fontSize:12}},"/ ",g(t.stats.memLimitBytes))),i().createElement(l.Progress,{percent:Math.min(100,Number(t.stats.memPercent.toFixed(1))),size:"small",showInfo:!1,"aria-label":"".concat(H("Memory")," ").concat(t.name)})):i().createElement(l.Typography.Text,{type:"secondary"},"-")}},{title:H("Network / PIDs"),key:"io",width:165,render:function(e,t){return t.stats?i().createElement(l.Space,{direction:"vertical",size:0,style:{fontSize:12}},i().createElement(l.Typography.Text,{style:{fontSize:12}},"↓ ",g(t.stats.netRxBytes)," / ↑ ",g(t.stats.netTxBytes)),i().createElement(l.Typography.Text,{type:"secondary",style:{fontSize:12}},"PIDs: ",t.stats.pids)):i().createElement(l.Typography.Text,{type:"secondary"},"-")}},{title:H("Actions"),key:"actions",width:96,fixed:"right",render:function(e,t){return i().createElement(l.Button,{size:"small",htmlType:"button",icon:i().createElement(r.FileTextOutlined,null),"aria-label":"".concat(H("Logs")," ").concat(t.name||t.id),onClick:function(){return eT(t)}},H("Logs"))}}],eA=[{title:H("Name"),dataIndex:"name",key:"name",width:240,render:function(e,t){return i().createElement(l.Space,{size:"small"},i().createElement(l.Typography.Text,{code:!0},e),t.sensitive?i().createElement(l.Tag,{color:"warning"},H("Secret")):null)}},{title:H("Value"),dataIndex:"value",key:"value",render:function(e,t){return t.sensitive?i().createElement(l.Typography.Text,{type:"secondary"},e):i().createElement(l.Typography.Text,{style:{wordBreak:"break-all"}},e||"-")}}],eB=[{title:H("Time"),dataIndex:"time",key:"time",width:190,render:function(e){return b(e)}},{title:H("Status"),dataIndex:"status",key:"status",width:120,render:function(e){return E(e,H)}},{title:H("Message"),dataIndex:"message",key:"message",render:function(e){return e||"-"}}];return i().createElement(i().Fragment,null,i().createElement(l.Drawer,{open:M,width:920,onClose:G,title:i().createElement(l.Space,{size:"small",wrap:!0},i().createElement("span",null,H("Stack Detail")," — ",null!=(k=null==L?void 0:L.name)?k:""),L?E(ez,H):null,L?i().createElement(l.Tag,{color:(null!=(w=null==eI?void 0:eI.isGitStack)?w:L.isGitStack)?"processing":"purple"},(null!=(T=null==eI?void 0:eI.isGitStack)?T:L.isGitStack)?H("Git Stack"):H("Compose")):null),extra:i().createElement(l.Space,{size:"small",wrap:!0},i().createElement(l.Space,{size:6},i().createElement(l.Switch,{size:"small",checked:ea,"aria-label":H("Auto-refresh live metrics (5s)"),onChange:function(e){return el(e)}}),i().createElement(l.Typography.Text,{style:{fontSize:12}},H("Auto-refresh (5s)"))),2===ez?i().createElement(l.Button,{size:"small",type:"primary",htmlType:"button",icon:i().createElement(r.PlayCircleOutlined,null),loading:"start"===ei,onClick:function(){eC("start")}},H("Start Stack")):i().createElement(l.Popconfirm,{title:H("Stop this Stack on Portainer?"),onConfirm:function(){return eC("stop")}},i().createElement(l.Button,{size:"small",danger:!0,htmlType:"button",icon:i().createElement(r.PauseCircleOutlined,null),loading:"stop"===ei},H("Stop Stack"))),i().createElement(l.Button,{size:"small",htmlType:"button",icon:i().createElement(r.ReloadOutlined,null),loading:Q||Z,onClick:function(){ek({silent:!!_,includeFile:!0})}},H("Refresh")))},et?i().createElement(l.Alert,{type:"error",showIcon:!0,style:{marginBottom:16},message:et}):null,Z&&!_?i().createElement(l.Flex,{justify:"center",align:"center",style:{minHeight:260}},i().createElement(l.Spin,{size:"large"})):_?i().createElement(i().Fragment,null,i().createElement(l.Flex,{gap:"small",wrap:"wrap",style:{marginBottom:16}},i().createElement(l.Card,{size:"small",style:{flex:"1 1 180px"}},i().createElement(l.Statistic,{title:H("Containers Health"),value:null!=(C=null==ex?void 0:ex.runningCount)?C:0,suffix:"/ ".concat(null!=(I=null==ex?void 0:ex.totalCount)?I:0),valueStyle:{color:(null!=(x=null==ex?void 0:ex.totalCount)?x:0)===0?void 0:(null==ex?void 0:ex.healthy)?"#389e0d":"#cf1322"}}),i().createElement(l.Typography.Text,{type:"secondary",style:{fontSize:12}},eO," (#",eP,")")),i().createElement(l.Card,{size:"small",style:{flex:"1 1 190px"}},i().createElement(l.Statistic,{title:H("Live CPU Usage"),value:null!=(P=null==ex?void 0:ex.totalCpuPercent)?P:0,precision:2,suffix:"%"}),i().createElement(l.Progress,{percent:Math.min(100,Number((null!=(O=null==ex?void 0:ex.totalCpuPercent)?O:0).toFixed(1))),size:"small",showInfo:!1,"aria-label":H("Live CPU Usage")})),i().createElement(l.Card,{size:"small",style:{flex:"1 1 220px"}},i().createElement(l.Statistic,{title:H("Live Memory Usage"),value:g(null!=(z=null==ex?void 0:ex.totalMemUsageBytes)?z:0),suffix:(null==ex?void 0:ex.memLimitBytes)?i().createElement(l.Typography.Text,{type:"secondary",style:{fontSize:13}},"/ ",g(ex.memLimitBytes)," (",ex.totalMemPercent.toFixed(1),"%)"):null}),i().createElement(l.Progress,{percent:Math.min(100,Number((null!=(F=null==ex?void 0:ex.totalMemPercent)?F:0).toFixed(1))),size:"small",showInfo:!1,"aria-label":H("Live Memory Usage")})),i().createElement(l.Card,{size:"small",style:{flex:"1 1 200px"}},i().createElement(l.Statistic,{title:H("Network I/O (RX / TX)"),value:"↓ ".concat(g(null!=(A=null==ex?void 0:ex.totalNetRxBytes)?A:0)),valueStyle:{fontSize:16}}),i().createElement(l.Typography.Text,{type:"secondary",style:{fontSize:12}},"↑ ",g(null!=(B=null==ex?void 0:ex.totalNetTxBytes)?B:0)))),i().createElement(l.Tabs,{defaultActiveKey:"containers",items:[{key:"containers",label:"".concat(H("Containers & Live Metrics")," (").concat(_.containers.length,")"),children:i().createElement("div",{tabIndex:0,role:"region","aria-label":H("Stack containers and live metrics"),style:{overflowX:"auto",maxInlineSize:"100%"}},i().createElement(l.Table,{rowKey:"id",size:"small",pagination:!1,scroll:{x:1120},dataSource:_.containers,columns:eF,locale:{emptyText:i().createElement(l.Empty,{description:H("No containers found for this Stack")})}}))},{key:"metadata",label:H("Stack Metadata"),children:i().createElement(l.Space,{direction:"vertical",size:"middle",style:{width:"100%"}},i().createElement(l.Descriptions,{bordered:!0,size:"small",column:{xs:1,sm:2}},i().createElement(l.Descriptions.Item,{label:H("Stack ID")},null==eI?void 0:eI.id),i().createElement(l.Descriptions.Item,{label:H("Stack Name")},null==eI?void 0:eI.name),i().createElement(l.Descriptions.Item,{label:H("Endpoint")},eO," (#",eP,")"),i().createElement(l.Descriptions.Item,{label:H("Entry point")},i().createElement(l.Typography.Text,{code:!0},(null==eI?void 0:eI.entryPoint)||"docker-compose.yml")),i().createElement(l.Descriptions.Item,{label:H("Created at")},b(null==eI?void 0:eI.createdAt),(null==eI?void 0:eI.createdBy)?" (".concat(eI.createdBy,")"):""),i().createElement(l.Descriptions.Item,{label:H("Last updated")},b(null==eI?void 0:eI.updatedAt),(null==eI?void 0:eI.updatedBy)?" (".concat(eI.updatedBy,")"):""),(null==eI?void 0:eI.isGitStack)?i().createElement(i().Fragment,null,i().createElement(l.Descriptions.Item,{label:H("Connected Git repository"),span:2},i().createElement(l.Typography.Text,{code:!0},eI.gitRepoUrl||"-")),i().createElement(l.Descriptions.Item,{label:H("Git reference")},i().createElement(l.Typography.Text,{code:!0},eI.gitReference||"-")),i().createElement(l.Descriptions.Item,{label:H("Git commit / config")},eI.gitCommitHash?i().createElement(l.Typography.Text,{code:!0},eI.gitCommitHash.slice(0,12)):"-",eI.gitConfigFilePath?" (".concat(eI.gitConfigFilePath,")"):"")):null,(null==eI?void 0:eI.projectPath)?i().createElement(l.Descriptions.Item,{label:H("Project path"),span:2},i().createElement(l.Typography.Text,{code:!0},eI.projectPath)):null),(null==eI?void 0:eI.deployments)&&eI.deployments.length>0?i().createElement(l.Card,{size:"small",title:H("Deployment History")},i().createElement(l.Table,{rowKey:function(e,t){var n;return"".concat(null!=(n=e.time)?n:0,"-").concat(null!=t?t:0)},size:"small",pagination:{pageSize:5},dataSource:((function(e){if(Array.isArray(e))return u(e)})(t=eI.deployments)||function(e){if("u">typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(t)||f(t)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()).reverse(),columns:eB})):null)},{key:"env",label:"".concat(H("Env Vars")," (").concat(null!=(j=null==eI?void 0:eI.env.length)?j:0,")"),children:i().createElement(l.Table,{rowKey:"name",size:"small",pagination:{pageSize:15},dataSource:null!=(D=null==eI?void 0:eI.env)?D:[],columns:eA,locale:{emptyText:i().createElement(l.Empty,{description:H("No environment variables configured")})}})},{key:"compose",label:i().createElement("span",null,i().createElement(r.CodeOutlined,{style:{marginInlineEnd:6}}),H("Compose File")),children:_.stackFileContent?i().createElement("pre",{tabIndex:0,role:"region","aria-label":H("Compose File"),style:{margin:0,padding:12,maxHeight:480,overflow:"auto",borderRadius:6,background:"#141414",color:"#e6f4ff",fontSize:12,lineHeight:1.55}},_.stackFileContent):i().createElement(l.Empty,{description:H("Compose file content is unavailable")})}]})):null),i().createElement(l.Modal,{open:!!eu,width:840,onCancel:function(){return em(null)},footer:i().createElement(l.Flex,{justify:"space-between",align:"center"},i().createElement(l.Space,{size:"small"},i().createElement(l.Typography.Text,{type:"secondary"},H("Tail lines"),":"),i().createElement(l.Select,{size:"small",style:{width:110},value:ep,"aria-label":H("Tail lines"),options:[{value:50,label:"50"},{value:100,label:"100"},{value:300,label:"300"}],onChange:function(e){ey(e),eu&&ew(eu,e)}})),i().createElement(l.Space,null,i().createElement(l.Button,{htmlType:"button",icon:i().createElement(r.ReloadOutlined,null),loading:eE,onClick:function(){eu&&ew(eu,ep)}},H("Refresh")),i().createElement(l.Button,{type:"primary",htmlType:"button",onClick:function(){return em(null)}},H("Close")))),title:eu?"".concat(H("Container Logs")," — ").concat(eu.name||eu.id):H("Container Logs")},i().createElement(l.Spin,{spinning:eE},i().createElement("pre",{tabIndex:0,role:"region","aria-label":H("Container Logs"),style:{margin:0,padding:12,minHeight:240,maxHeight:460,overflow:"auto",borderRadius:6,background:"#141414",color:"#d9f7be",fontSize:12,lineHeight:1.5,whiteSpace:"pre-wrap",wordBreak:"break-word"}},eh||H("No log output")))))}function S(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function k(e,t,n,r,a,l,o){try{var i=e[l](o),c=i.value}catch(e){n(e);return}i.done?t(c):Promise.resolve(c).then(r,a)}function w(e){return function(){var t=this,n=arguments;return new Promise(function(r,a){var l=e.apply(t,n);function o(e){k(l,r,a,o,i,"next",e)}function i(e){k(l,r,a,o,i,"throw",e)}o(void 0)})}}function T(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){var r;r=n[t],t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r})}return e}function C(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n,r,a=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=a){var l=[],o=!0,i=!1;try{for(a=a.call(e);!(o=(n=a.next()).done)&&(l.push(n.value),!t||l.length!==t);o=!0);}catch(e){i=!0,r=e}finally{try{o||null==a.return||a.return()}finally{if(i)throw r}}return l}}(e,t)||function(e,t){if(e){if("string"==typeof e)return S(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return S(e,t)}}(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function I(e,t){var n,r,a,l={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]},o=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),i=Object.defineProperty;return i(o,"next",{value:c(0)}),i(o,"throw",{value:c(1)}),i(o,"return",{value:c(2)}),"function"==typeof Symbol&&i(o,Symbol.iterator,{value:function(){return this}}),o;function c(i){return function(c){var s=[i,c];if(n)throw TypeError("Generator is already executing.");for(;o&&(o=0,s[0]&&(l=0)),l;)try{if(n=1,r&&(a=2&s[0]?r.return:s[0]?r.throw||((a=r.return)&&a.call(r),0):r.next)&&!(a=a.call(r,s[1])).done)return a;switch(r=0,a&&(s=[2&s[0],a.value]),s[0]){case 0:case 1:a=s;break;case 4:return l.label++,{value:s[1],done:!1};case 5:l.label++,r=s[1],s=[0];continue;case 7:s=l.ops.pop(),l.trys.pop();continue;default:if(!(a=(a=l.trys).length>0&&a[a.length-1])&&(6===s[0]||2===s[0])){l=0;continue}if(3===s[0]&&(!a||s[1]>a[0]&&s[1]<a[3])){l.label=s[1];break}if(6===s[0]&&l.label<a[1]){l.label=a[1],a=s;break}if(a&&l.label<a[2]){l.label=a[2],l.ops.push(s);break}a[2]&&l.ops.pop(),l.trys.pop();continue}s=t.call(e,l)}catch(e){s=[6,e],r=0}finally{n=a=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}}}function x(){var e=(0,s.kj)(),t=(0,a.useApp)().apiClient,n=C(l.Form.useForm(),1)[0],u=C((0,o.useState)([]),2),m=u[0],d=u[1],p=C((0,o.useState)(!1),2),y=p[0],f=p[1],h=C((0,o.useState)(!1),2),g=h[0],b=h[1],E=C((0,o.useState)(null),2),S=E[0],k=E[1],x=C((0,o.useState)(!1),2),P=x[0],O=x[1],z=C((0,o.useState)(!1),2),F=z[0],A=z[1],B=C((0,o.useState)(null),2),j=B[0],D=B[1],U=C((0,o.useState)(null),2),M=U[0],N=U[1],L=C((0,o.useState)([]),2),R=L[0],G=L[1],q=C((0,o.useState)(void 0),2),H=q[0],K=q[1],V=C((0,o.useState)([]),2),_=V[0],Y=V[1],X=C((0,o.useState)(!1),2),Z=X[0],W=X[1],$=C((0,o.useState)(null),2),Q=$[0],J=$[1],ee=(0,o.useCallback)(function(){return w(function(){var n,r;return I(this,function(a){switch(a.label){case 0:f(!0),a.label=1;case 1:return a.trys.push([1,3,4,5]),[4,t.request({url:"".concat(c.Z3,":list"),method:"get",params:{pageSize:100,sort:["-isDefault","id"]}})];case 2:return d(Array.isArray(null==(r=a.sent())||null==(n=r.data)?void 0:n.data)?r.data.data:[]),[3,5];case 3:return a.sent(),l.message.error(e("Failed to load Portainer instances")),[3,5];case 4:return f(!1),[7];case 5:return[2]}})})()},[t,e]);(0,o.useEffect)(function(){ee()},[ee]);var et=function(e){var t,r,a;k(e),n.setFieldsValue({name:e.name,baseUrl:e.baseUrl,apiKey:e.apiKey||c.Q6,gitCredentialId:null!=(t=e.gitCredentialId)?t:void 0,gitUsername:null!=(r=e.gitUsername)?r:"",gitAccessToken:e.gitAccessToken||"",allowInsecureTls:!!e.allowInsecureTls,defaultTimeoutMs:null!=(a=e.defaultTimeoutMs)?a:c.t1,isDefault:!!e.isDefault,enabled:!1!==e.enabled}),b(!0)},en=(0,o.useCallback)(function(n,r){return w(function(){var a,o,i,s,u;return I(this,function(m){switch(m.label){case 0:W(!0),m.label=1;case 1:return m.trys.push([1,3,4,5]),[4,Promise.all([t.request({url:"".concat(c.Yk,":listEndpoints"),method:"get",params:{instanceId:n}}),t.request({url:"".concat(c.Yk,":listStacks"),method:"get",params:T({instanceId:n},r?{endpointId:r}:{})})])];case 2:return s=(i=C.apply(void 0,[m.sent(),2]))[0],u=i[1],G(Array.isArray(null==s||null==(a=s.data)?void 0:a.data)?s.data.data:[]),Y(Array.isArray(null==u||null==(o=u.data)?void 0:o.data)?u.data.data:[]),[3,5];case 3:return m.sent(),l.message.error(e("Failed to load environments and stacks from Portainer")),[3,5];case 4:return W(!1),[7];case 5:return[2]}})})()},[t,e]),er=function(e){N(e),J(null),K(void 0),en(e.id,void 0)},ea=[{title:e("Name"),dataIndex:"name",key:"name",render:function(t,n){return i().createElement(l.Space,null,i().createElement(l.Typography.Text,{strong:!0},t),n.isDefault?i().createElement(l.Tag,{color:"blue"},e("Default")):null)}},{title:e("Base URL"),dataIndex:"baseUrl",key:"baseUrl",render:function(e){return i().createElement(l.Typography.Text,{code:!0},e)}},{title:e("Health & Version"),key:"health",render:function(t,n){return n.lastHealthStatus?"ok"===n.lastHealthStatus?i().createElement(l.Space,{size:"small"},i().createElement(l.Tag,{color:"success",icon:i().createElement(r.CheckCircleOutlined,null)},e("Connected")),n.lastVersion?i().createElement(l.Typography.Text,{type:"secondary"},"v",n.lastVersion):null):i().createElement(l.Tag,{color:"error"},e("Unreachable")):i().createElement(l.Tag,null,e("Not tested"))}},{title:e("Enabled"),dataIndex:"enabled",key:"enabled",width:100,render:function(n,r){return i().createElement(l.Switch,{checked:!1!==n,"aria-label":"".concat(e("Toggle Portainer instance")," ").concat(r.name),onChange:function(n){w(function(){return I(this,function(a){switch(a.label){case 0:return a.trys.push([0,3,,4]),[4,t.request({url:"".concat(c.Z3,":update"),method:"post",params:{filterByTk:r.id},data:{enabled:n}})];case 1:return a.sent(),[4,ee()];case 2:return a.sent(),[3,4];case 3:return a.sent(),l.message.error(e("Failed to update status")),[3,4];case 4:return[2]}})})()}})}},{title:e("Actions"),key:"actions",width:300,render:function(n,a){return i().createElement(l.Space,{size:"small",wrap:!0},i().createElement(l.Button,{size:"small",htmlType:"button",icon:i().createElement(r.ApiOutlined,null),loading:j===a.id,"aria-label":"".concat(e("Test connection")," ").concat(a.name),onClick:function(){w(function(){var n,r,o,i,s;return I(this,function(u){switch(u.label){case 0:D(a.id),u.label=1;case 1:return u.trys.push([1,4,6,7]),[4,t.request({url:"".concat(c.Yk,":testConnection"),method:"post",params:{filterByTk:a.id}})];case 2:return s=null==(i=u.sent())||null==(o=i.data)?void 0:o.data,l.message.success(e("Connected to Portainer v{{version}} ({{count}} environments found)",{version:null!=(n=null==s?void 0:s.version)?n:"unknown",count:null!=(r=null==s?void 0:s.endpointCount)?r:0})),[4,ee()];case 3:case 5:return u.sent(),[3,7];case 4:return u.sent(),l.message.error(e("Connection test failed")),[4,ee()];case 6:return D(null),[7];case 7:return[2]}})})()}},e("Test")),i().createElement(l.Button,{size:"small",htmlType:"button",icon:i().createElement(r.AppstoreOutlined,null),"aria-label":"".concat(e("Browse Stacks")," ").concat(a.name),onClick:function(){return er(a)}},e("Stacks")),i().createElement(l.Button,{size:"small",htmlType:"button",icon:i().createElement(r.EditOutlined,null),"aria-label":"".concat(e("Edit Portainer instance")," ").concat(a.name),onClick:function(){return et(a)}}),i().createElement(l.Popconfirm,{title:e("Delete this Portainer instance?"),onConfirm:function(){return w(function(){return I(this,function(n){switch(n.label){case 0:return n.trys.push([0,3,,4]),[4,t.request({url:"".concat(c.Z3,":destroy"),method:"post",params:{filterByTk:a.id}})];case 1:return n.sent(),l.message.success(e("Portainer instance deleted")),[4,ee()];case 2:return n.sent(),[3,4];case 3:return n.sent(),l.message.error(e("Failed to delete Portainer instance")),[3,4];case 4:return[2]}})})()}},i().createElement(l.Button,{size:"small",danger:!0,htmlType:"button",icon:i().createElement(r.DeleteOutlined,null),"aria-label":"".concat(e("Delete Portainer instance")," ").concat(a.name)})))}}],el=[{title:e("ID"),dataIndex:"id",key:"id",width:72},{title:e("Stack Name"),dataIndex:"name",key:"name",render:function(e){return i().createElement(l.Typography.Text,{strong:!0},e)}},{title:e("Endpoint"),dataIndex:"endpointId",key:"endpointId",width:130,render:function(e){var t=R.find(function(t){return t.id===e});return t?"".concat(t.name," (#").concat(e,")"):"#".concat(e)}},{title:e("Source"),key:"source",render:function(t,n){return i().createElement(l.Space,{size:"small",wrap:!0},i().createElement(l.Tag,{color:n.isGitStack?"processing":"purple"},n.isGitStack?e("Git Stack"):e("Compose")),n.gitReference?i().createElement(l.Typography.Text,{code:!0},n.gitReference):null)}},{title:e("Status"),dataIndex:"status",key:"status",width:110,render:function(t){return 3===t?i().createElement(l.Tag,{color:"processing"},e("Deploying")):4===t?i().createElement(l.Tag,{color:"error"},e("Error")):i().createElement(l.Tag,{color:1===t?"success":"default"},1===t?e("Active"):e("Inactive"))}},{title:e("Env Vars"),dataIndex:"envCount",key:"envCount",width:90},{title:e("Actions"),key:"actions",width:105,render:function(t,n){return i().createElement(l.Button,{size:"small",htmlType:"button",icon:i().createElement(r.EyeOutlined,null),"aria-label":"".concat(e("Detail")," ").concat(n.name),onClick:function(){return J(n)}},e("Detail"))}}];return i().createElement(l.Card,{title:e("Portainer Instances"),extra:i().createElement(l.Space,null,i().createElement(l.Button,{htmlType:"button",icon:i().createElement(r.ReloadOutlined,null),loading:y,onClick:function(){ee()}},e("Refresh")),i().createElement(l.Button,{type:"primary",htmlType:"button",icon:i().createElement(r.PlusOutlined,null),onClick:function(){k(null),n.resetFields(),n.setFieldsValue({defaultTimeoutMs:c.t1,allowInsecureTls:!1,isDefault:0===m.length,enabled:!0}),b(!0)}},e("Add Portainer instance")))},i().createElement(l.Alert,{type:"info",showIcon:!0,style:{marginBottom:16},message:e("Configure Portainer servers with an Access Token (X-API-Key). Workflow nodes can select Environments and Stacks directly or receive dynamic IDs and Env variables from upstream build catalogs.")}),i().createElement(l.Table,{rowKey:"id",loading:y,dataSource:m,columns:ea,pagination:!1}),i().createElement(l.Modal,{open:g,title:S?e("Edit Portainer instance"):e("Add Portainer instance"),onCancel:function(){return b(!1)},destroyOnClose:!0,width:620,footer:i().createElement(l.Flex,{justify:"space-between",align:"center"},i().createElement(l.Button,{htmlType:"button",icon:i().createElement(r.ApiOutlined,null),loading:F,onClick:function(){w(function(){var r,a,o,i,s,u;return I(this,function(m){switch(m.label){case 0:if(!(r=n.getFieldsValue()).baseUrl)return l.message.warning(e("Please enter a Portainer base URL first")),[2];A(!0),m.label=1;case 1:var d,p;return m.trys.push([1,3,4,5]),[4,t.request({url:"".concat(c.Yk,":testConnectionDraft"),method:"post",data:(d=T({},r),p=p={id:null==S?void 0:S.id},Object.getOwnPropertyDescriptors?Object.defineProperties(d,Object.getOwnPropertyDescriptors(p)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t})(Object(p)).forEach(function(e){Object.defineProperty(d,e,Object.getOwnPropertyDescriptor(p,e))}),d)})];case 2:return u=null==(s=m.sent())||null==(i=s.data)?void 0:i.data,l.message.success(e("Connected to Portainer v{{version}} ({{count}} environments found)",{version:null!=(a=null==u?void 0:u.version)?a:"unknown",count:null!=(o=null==u?void 0:u.endpointCount)?o:0})),[3,5];case 3:return m.sent(),l.message.error(e("Connection test failed. Check URL, API key, and TLS settings.")),[3,5];case 4:return A(!1),[7];case 5:return[2]}})})()}},e("Test connection")),i().createElement(l.Space,null,i().createElement(l.Button,{htmlType:"button",onClick:function(){return b(!1)}},e("Cancel")),i().createElement(l.Button,{type:"primary",htmlType:"button",loading:P,onClick:function(){w(function(){var r,a,o;return I(this,function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),[4,n.validateFields()];case 1:return r=i.sent(),[3,3];case 2:return i.sent(),[2];case 3:O(!0),i.label=4;case 4:if(i.trys.push([4,10,11,12]),!S)return[3,6];return[4,t.request({url:"".concat(c.Z3,":update"),method:"post",params:{filterByTk:S.id},data:r})];case 5:return i.sent(),l.message.success(e("Portainer instance updated")),[3,8];case 6:return[4,t.request({url:"".concat(c.Z3,":create"),method:"post",data:r})];case 7:i.sent(),l.message.success(e("Portainer instance created")),i.label=8;case 8:return b(!1),[4,ee()];case 9:return i.sent(),[3,12];case 10:var s,u;return s=a=i.sent(),o=(null!=(u=Error)&&"u">typeof Symbol&&u[Symbol.hasInstance]?!!u[Symbol.hasInstance](s):s instanceof u)?a.message:e("Failed to save Portainer instance"),l.message.error(o),[3,12];case 11:return O(!1),[7];case 12:return[2]}})})()}},e("Save"))))},i().createElement(l.Form,{form:n,layout:"vertical"},i().createElement(l.Form.Item,{name:"name",label:e("Instance name"),rules:[{required:!0,message:e("Instance name is required")}]},i().createElement(l.Input,{placeholder:"Portainer Production"})),i().createElement(l.Form.Item,{name:"baseUrl",label:e("Portainer base URL"),rules:[{required:!0,message:e("Base URL is required")}],extra:e("Example: https://portainer.internal:9443")},i().createElement(l.Input,{placeholder:"https://portainer.example.com:9443",autoCorrect:"off",autoCapitalize:"none",spellCheck:!1})),i().createElement(l.Form.Item,{name:"apiKey",label:e("Portainer API key (X-API-Key)"),rules:[{required:!S,message:e("API key is required")}],extra:e("Generated under Portainer -> My account -> Access tokens. Encrypted at rest.")},i().createElement(l.Input.Password,{placeholder:"ptr_...",autoComplete:"new-password",autoCorrect:"off",autoCapitalize:"none",spellCheck:!1})),i().createElement(l.Flex,{gap:"middle",wrap:"wrap"},i().createElement(l.Form.Item,{name:"defaultTimeoutMs",label:e("Default build/redeploy timeout (ms)"),style:{flex:"1 1 240px"}},i().createElement(l.InputNumber,{min:c.SU,max:c.mn,step:5e3,style:{width:"100%"}}))),i().createElement(l.Space,{size:"large",wrap:!0,style:{marginBottom:16}},i().createElement(l.Form.Item,{name:"isDefault",valuePropName:"checked",style:{marginBottom:0}},i().createElement(l.Checkbox,null,e("Set as default instance"))),i().createElement(l.Form.Item,{name:"allowInsecureTls",valuePropName:"checked",style:{marginBottom:0}},i().createElement(l.Checkbox,null,e("Allow self-signed TLS certificate (:9443)"))),i().createElement(l.Form.Item,{name:"enabled",valuePropName:"checked",style:{marginBottom:0}},i().createElement(l.Checkbox,null,e("Enabled")))),i().createElement(l.Collapse,{size:"small",items:[{key:"git-fallback",label:e("Optional Git authentication fallback (when Stack has no saved GitCredentialID)"),children:i().createElement(i().Fragment,null,i().createElement(l.Form.Item,{name:"gitCredentialId",label:e("Portainer saved Git Credential ID (optional)"),extra:e("Automatically detected from each Git Stack when present; set here only to supply a default ID.")},i().createElement(l.InputNumber,{min:1,style:{width:"100%"}})),i().createElement(l.Form.Item,{name:"gitUsername",label:e("Fallback Git username (optional)")},i().createElement(l.Input,{autoCorrect:"off",autoCapitalize:"none",spellCheck:!1,placeholder:"oauth2"})),i().createElement(l.Form.Item,{name:"gitAccessToken",label:e("Fallback Git Personal Access Token (optional)"),style:{marginBottom:0}},i().createElement(l.Input.Password,{autoComplete:"new-password",autoCorrect:"off",autoCapitalize:"none",spellCheck:!1})))}]}))),i().createElement(l.Drawer,{open:!!M,title:M?"".concat(e("Portainer Stacks")," — ").concat(M.name):e("Portainer Stacks"),onClose:function(){J(null),N(null)},width:820},i().createElement(l.Flex,{gap:"small",align:"center",style:{marginBottom:16}},i().createElement(l.Select,{allowClear:!0,style:{width:280},placeholder:e("All environments (Endpoints)"),value:H,options:R.map(function(e){return{value:e.id,label:"".concat(e.name," (#").concat(e.id,")")}}),onChange:function(e){K(e),M&&en(M.id,e)}}),i().createElement(l.Button,{htmlType:"button",icon:i().createElement(r.ReloadOutlined,null),loading:Z,onClick:function(){M&&en(M.id,H)}},e("Refresh"))),i().createElement(l.Table,{rowKey:"id",size:"small",loading:Z,dataSource:_,columns:el,pagination:{pageSize:15}}),i().createElement(v,{open:!!Q,instance:M,stack:Q,endpoints:R,onClose:function(){return J(null)},onStackChanged:function(){M&&en(M.id,H)}})))}}}]);
@@ -0,0 +1,10 @@
1
+ /**
2
+ * This file is part of the NocoBase (R) project.
3
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
+ * Authors: NocoBase Team.
5
+ *
6
+ * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
+ * For more information, please refer to: https://www.nocobase.com/agreement.
8
+ */
9
+
10
+ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("@nocobase/client-v2"),require("react"),require("antd"),require("@nocobase/plugin-workflow/client-v2"),require("@ant-design/icons")):"function"==typeof define&&define.amd?define("plugin-workflow-portainer/client-v2",["@nocobase/client-v2","react","antd","@nocobase/plugin-workflow/client-v2","@ant-design/icons"],t):"object"==typeof exports?exports["plugin-workflow-portainer/client-v2"]=t(require("@nocobase/client-v2"),require("react"),require("antd"),require("@nocobase/plugin-workflow/client-v2"),require("@ant-design/icons")):e["plugin-workflow-portainer/client-v2"]=t(e["@nocobase/client-v2"],e.react,e.antd,e["@nocobase/plugin-workflow/client-v2"],e["@ant-design/icons"])}(self,function(e,t,n,r,o){return function(){"use strict";var i,a,u,c={515:function(e,t,n){n.d(t,{MZ:function(){return a},kj:function(){return u}});var r=n(485),o=n(155),i=n(249).kc,a=function(e){return'{{t("'.concat(e,'", { ns: "').concat(i,'" })}}')};function u(){var e=(0,r.useApp)();return(0,o.useCallback)(function(t,n){return e.i18n.t(t,function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){var r;r=n[t],t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r})}return e}({ns:[i,"client"]},n))},[e.i18n])}},249:function(e,t,n){n.d(t,{DQ:function(){return u},Q6:function(){return l},SU:function(){return s},Yk:function(){return i},Z3:function(){return o},fD:function(){return c},im:function(){return a},kc:function(){return r},mn:function(){return p},t1:function(){return f}});var r="plugin-workflow-portainer",o="portainerInstances",i="portainerWorkflow",a="pm.plugin-workflow-portainer",u="portainer",c={redeploy:"portainer-stack-redeploy",control:"portainer-stack-control"},l="••••••••",f=6e5,s=1e3,p=36e5},375:function(e){e.exports=o},485:function(t){t.exports=e},197:function(e){e.exports=r},59:function(e){e.exports=n},155:function(e){e.exports=t}},l={};function f(e){var t=l[e];if(void 0!==t)return t.exports;var n=l[e]={exports:{}};return c[e](n,n.exports,f),n.exports}f.m=c,f.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return f.d(t,{a:t}),t},f.d=function(e,t){for(var n in t)f.o(t,n)&&!f.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},f.f={},f.e=function(e){return Promise.all(Object.keys(f.f).reduce(function(t,n){return f.f[n](e,t),t},[]))},f.u=function(e){return""+e+"."+({127:"9f65dc2e3d0df10a",57:"a60e16e4b4e4fa28",660:"29ae3c3b4040039d",981:"8627062881ad83d1"})[e]+".js"},f.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(e){if("object"==typeof window)return window}}(),f.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},s={},f.l=function(e,t,n,r){if(s[e])return void s[e].push(t);if(void 0!==n)for(var o,i,a=document.getElementsByTagName("script"),u=0;u<a.length;u++){var c=a[u];if(c.getAttribute("src")==e||c.getAttribute("data-rspack")=="plugin-workflow-portainer/client-v2:"+n){o=c;break}}o||(i=!0,(o=document.createElement("script")).timeout=120,f.nc&&o.setAttribute("nonce",f.nc),o.setAttribute("data-rspack","plugin-workflow-portainer/client-v2:"+n),o.src=e),s[e]=[t];var l=function(t,n){o.onerror=o.onload=null,clearTimeout(p);var r=s[e];if(delete s[e],o.parentNode&&o.parentNode.removeChild(o),r&&r.forEach(function(e){return e(n)}),t)return t(n)},p=setTimeout(l.bind(null,void 0,{type:"timeout",target:o}),12e4);o.onerror=l.bind(null,o.onerror),o.onload=l.bind(null,o.onload),i&&document.head.appendChild(o)},f.r=function(e){"u">typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},f.g.importScripts&&(p=f.g.location+"");var s,p,d=f.g.document;if(!p&&d&&(d.currentScript&&"SCRIPT"===d.currentScript.tagName.toUpperCase()&&(p=d.currentScript.src),!p)){var b=d.getElementsByTagName("script");if(b.length)for(var y=b.length-1;y>-1&&(!p||!/^http(s?):/.test(p));)p=b[y--].src}if(!p)throw Error("Automatic publicPath is not supported in this browser");f.p=p.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),i={889:0},f.f.j=function(e,t){var n=f.o(i,e)?i[e]:void 0;if(0!==n)if(n)t.push(n[2]);else{var r=new Promise(function(t,r){n=i[e]=[t,r]});t.push(n[2]=r);var o=f.p+f.u(e),a=Error();f.l(o,function(t){if(f.o(i,e)&&(0!==(n=i[e])&&(i[e]=void 0),n)){var r=t&&("load"===t.type?"missing":t.type),o=t&&t.target&&t.target.src;a.message="Loading chunk "+e+" failed.\n("+r+": "+o+")",a.name="ChunkLoadError",a.type=r,a.request=o,n[1](a)}},"chunk-"+e,e)}},a=function(e,t){var n,r,o=t[0],a=t[1],u=t[2],c=0;if(o.some(function(e){return 0!==i[e]})){for(n in a)f.o(a,n)&&(f.m[n]=a[n]);u&&u(f)}for(e&&e(t);c<o.length;c++)r=o[c],f.o(i,r)&&i[r]&&i[r][0](),i[r]=0},(u=self.webpackChunkplugin_workflow_portainer_client_v2=self.webpackChunkplugin_workflow_portainer_client_v2||[]).forEach(a.bind(null,0)),u.push=a.bind(null,u.push.bind(u));var v={};return!function(){var e="",t="u">typeof document?document.currentScript:null;if(t&&t.src){var n=t.src.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"");n.indexOf("/static/plugins/plugin-workflow-portainer/dist/client-v2/")>=0&&(e=n.replace(/\/[^\/]+$/,"/"))}if(!e){var r=window.__webpack_public_path__||"";r&&("/"!==r.charAt(r.length-1)&&(r+="/"),e=r+"static/plugins/plugin-workflow-portainer/dist/client-v2/")}if(!e){var o=window.__nocobase_modern_client_prefix__||"v",i="/"+(o=String(o).replace(/^\/+|\/+$/g,"")||"v")+"/";if(!(e=window.__nocobase_public_path__||"")&&window.location&&window.location.pathname){var a=window.location.pathname||"/",u=a.indexOf(i);e=u>=0?a.slice(0,u+1):"/"}e&&(e=e.replace(RegExp("/"+o+"/?$"),"/")),e||(e="/"),"/"!==e.charAt(e.length-1)&&(e+="/"),e+="static/plugins/plugin-workflow-portainer/dist/client-v2/"}f.p=e}(),!function(){f.r(v),f.d(v,{PluginWorkflowPortainerClientV2:function(){return C},default:function(){return I}});var e=f(485),t=f(249),n={name:t.Z3,title:"Portainer Instances",hidden:!0,fields:[{name:"id",type:"bigInt",autoIncrement:!0,primaryKey:!0},{name:"name",type:"string"},{name:"baseUrl",type:"string"},{name:"apiKey",type:"text"},{name:"gitUsername",type:"string"},{name:"gitAccessToken",type:"text"},{name:"gitCredentialId",type:"integer"},{name:"allowInsecureTls",type:"boolean",defaultValue:!1},{name:"defaultTimeoutMs",type:"integer",defaultValue:t.t1},{name:"isDefault",type:"boolean",defaultValue:!1},{name:"enabled",type:"boolean",defaultValue:!0},{name:"lastHealthStatus",type:"string"},{name:"lastVersion",type:"string"},{name:"lastCheckedAt",type:"date"}]},r=f(375),o=f(197),i=f(155),a=f.n(i),u=f(515);function c(e,t,n){return t=b(t),function(e,t){var n;if(t&&("object"==((n=t)&&"u">typeof Symbol&&n.constructor===Symbol?"symbol":typeof n)||"function"==typeof t))return t;if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e,w()?Reflect.construct(t,n||[],b(e).constructor):t.apply(e,n))}function l(e,t){if(!(e instanceof t))throw TypeError("Cannot call a class as a function")}function s(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function p(e,t,n){return t&&s(e.prototype,t),n&&s(e,n),e}function d(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function b(e){return(b=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function y(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&h(e,t)}function g(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){d(e,t,n[t])})}return e}function m(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t})(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}),e}function h(e,t){return(h=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function w(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(w=function(){return!!e})()}function k(e,t,n){var r,i,a;return d(a={},null!=(r=e.value)?r:o.defaultFieldNames.value,t),d(a,null!=(i=e.label)?i:o.defaultFieldNames.label,n),a}var O=function(e){function n(){var e;return l(this,n),e=c(this,n,arguments),d(e,"type",t.fD.redeploy),d(e,"title",(0,u.MZ)("Run / Redeploy Stack")),d(e,"description",(0,u.MZ)("Pull Git changes, build compose services, or redeploy a Portainer Stack with full environment variable control.")),d(e,"group",t.DQ),d(e,"icon",a().createElement(r.CloudUploadOutlined,null)),d(e,"testable",!0),d(e,"FieldsetLoader",function(){return Promise.all([f.e("127"),f.e("57")]).then(f.bind(f,632)).then(function(e){return{default:e.RedeployFieldset}})}),e}return y(n,e),p(n,[{key:"createDefaultConfig",value:function(){return{mode:"stack",envStrategy:"merge",repullImage:!1,prune:!1,envPairs:[],timeoutMs:t.t1,ignoreFail:!1}}},{key:"useVariables",value:function(e,t){return function(e){var t,n=e.key,r=e.title,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},a=i.fieldNames,c=void 0===a?o.defaultFieldNames:a,l=null!=(t=c.children)?t:o.defaultFieldNames.children;return m(g({},k(c,n,r)),d({},l,[k(c,"ok",(0,u.MZ)("Succeeded")),k(c,"stackId",(0,u.MZ)("Stack ID")),k(c,"stackName",(0,u.MZ)("Stack name")),k(c,"endpointId",(0,u.MZ)("Environment (Endpoint) ID")),k(c,"stackType",(0,u.MZ)("Stack type")),k(c,"stackStatus",(0,u.MZ)("Stack status")),k(c,"gitReference",(0,u.MZ)("Git reference")),k(c,"appliedEnv",(0,u.MZ)("Applied environment (masked)")),k(c,"appliedEnvCount",(0,u.MZ)("Applied variable count")),k(c,"healthy",(0,u.MZ)("Containers healthy")),k(c,"runningCount",(0,u.MZ)("Running containers")),k(c,"totalCount",(0,u.MZ)("Total containers")),k(c,"durationMs",(0,u.MZ)("Duration (ms)")),k(c,"startedAt",(0,u.MZ)("Started at")),k(c,"finishedAt",(0,u.MZ)("Finished at")),k(c,"errorMessage",(0,u.MZ)("Error message"))]))}(e,t)}}]),n}(o.Instruction),S=function(e){function n(){var e;return l(this,n),e=c(this,n,arguments),d(e,"type",t.fD.control),d(e,"title",(0,u.MZ)("Control / Inspect Stack")),d(e,"description",(0,u.MZ)("Inspect Stack container health, start, or stop a Portainer Stack in an environment.")),d(e,"group",t.DQ),d(e,"icon",a().createElement(r.ClusterOutlined,null)),d(e,"testable",!0),d(e,"FieldsetLoader",function(){return Promise.all([f.e("127"),f.e("660")]).then(f.bind(f,943)).then(function(e){return{default:e.ControlFieldset}})}),e}return y(n,e),p(n,[{key:"createDefaultConfig",value:function(){return{action:"inspect",ignoreFail:!1}}},{key:"useVariables",value:function(e,t){return function(e){var t,n=e.key,r=e.title,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},a=i.fieldNames,c=void 0===a?o.defaultFieldNames:a,l=null!=(t=c.children)?t:o.defaultFieldNames.children;return m(g({},k(c,n,r)),d({},l,[k(c,"ok",(0,u.MZ)("Succeeded")),k(c,"action",(0,u.MZ)("Executed action")),k(c,"stackId",(0,u.MZ)("Stack ID")),k(c,"stackName",(0,u.MZ)("Stack name")),k(c,"endpointId",(0,u.MZ)("Environment (Endpoint) ID")),k(c,"stackType",(0,u.MZ)("Stack type")),k(c,"stackStatus",(0,u.MZ)("Stack status")),k(c,"gitReference",(0,u.MZ)("Git reference")),k(c,"healthy",(0,u.MZ)("Stack healthy")),k(c,"runningCount",(0,u.MZ)("Running containers")),k(c,"totalCount",(0,u.MZ)("Total containers")),k(c,"currentEnv",(0,u.MZ)("Current environment (masked)")),k(c,"durationMs",(0,u.MZ)("Duration (ms)")),k(c,"errorMessage",(0,u.MZ)("Error message"))]))}(e,t)}}]),n}(o.Instruction);function P(e,t,n,r,o,i,a){try{var u=e[i](a),c=u.value}catch(e){n(e);return}u.done?t(c):Promise.resolve(c).then(r,o)}function j(e,t,n){return(j=E()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var o=new(Function.bind.apply(e,r));return n&&_(o,n.prototype),o}).apply(null,arguments)}function M(e){return(M=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function _(e,t){return(_=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Z(e){var t="function"==typeof Map?new Map:void 0;return(Z=function(e){if(null===e||-1===Function.toString.call(e).indexOf("[native code]"))return e;if("function"!=typeof e)throw TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,n)}function n(){return j(e,arguments,M(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),_(n,e)})(e)}function E(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(E=function(){return!!e})()}var x="workflow-portainer",C=function(r){var o;if("function"!=typeof r&&null!==r)throw TypeError("Super expression must either be null or a function");function i(){var e,t;if(!(this instanceof i))throw TypeError("Cannot call a class as a function");return e=i,t=arguments,e=M(e),function(e,t){var n;if(t&&("object"==((n=t)&&"u">typeof Symbol&&n.constructor===Symbol?"symbol":typeof n)||"function"==typeof t))return t;if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(this,E()?Reflect.construct(e,t||[],M(this).constructor):e.apply(this,t))}return i.prototype=Object.create(r&&r.prototype,{constructor:{value:i,writable:!0,configurable:!0}}),r&&_(i,r),o=[{key:"load",value:function(){var r;return(r=function(){var r;return function(e,t){var n,r,o,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),u=Object.defineProperty;return u(a,"next",{value:c(0)}),u(a,"throw",{value:c(1)}),u(a,"return",{value:c(2)}),"function"==typeof Symbol&&u(a,Symbol.iterator,{value:function(){return this}}),a;function c(u){return function(c){var l=[u,c];if(n)throw TypeError("Generator is already executing.");for(;a&&(a=0,l[0]&&(i=0)),i;)try{if(n=1,r&&(o=2&l[0]?r.return:l[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,l[1])).done)return o;switch(r=0,o&&(l=[2&l[0],o.value]),l[0]){case 0:case 1:o=l;break;case 4:return i.label++,{value:l[1],done:!1};case 5:i.label++,r=l[1],l=[0];continue;case 7:l=i.ops.pop(),i.trys.pop();continue;default:if(!(o=(o=i.trys).length>0&&o[o.length-1])&&(6===l[0]||2===l[0])){i=0;continue}if(3===l[0]&&(!o||l[1]>o[0]&&l[1]<o[3])){i.label=l[1];break}if(6===l[0]&&i.label<o[1]){i.label=o[1],o=l;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(l);break}o[2]&&i.ops.pop(),i.trys.pop();continue}l=t.call(e,i)}catch(e){l=[6,e],r=0}finally{n=o=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}}(this,function(o){var i,a,c;return this.app.addProvider(e.ExtendCollectionsProvider,{collections:[n]}),(r=this.app.pm.get("workflow")||this.app.pm.get("@nocobase/plugin-workflow"))&&(null==(i=r.registerInstructionGroup)||i.call(r,t.DQ,{key:t.DQ,label:(0,u.MZ)("Portainer")}),null==(a=r.registerInstruction)||a.call(r,t.fD.redeploy,O),null==(c=r.registerInstruction)||c.call(r,t.fD.control,S)),this.pluginSettingsManager.addMenuItem({key:x,title:this.t("Portainer Workflows"),icon:"CloudServerOutlined",aclSnippet:t.im}),this.pluginSettingsManager.addPageTabItem({menuKey:x,key:"instances",title:this.t("Portainer Instances"),aclSnippet:t.im,componentLoader:function(){return f.e("981").then(f.bind(f,572)).then(function(e){return{default:e.PortainerSettingsPage}})}}),[2]})},function(){var e=this,t=arguments;return new Promise(function(n,o){var i=r.apply(e,t);function a(e){P(i,n,o,a,u,"next",e)}function u(e){P(i,n,o,a,u,"throw",e)}a(void 0)})}).call(this)}}],function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(i.prototype,o),i}(Z(e.Plugin)),I=C}(),v}()});
@@ -0,0 +1,20 @@
1
+ /**
2
+ * This file is part of the NocoBase (R) project.
3
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
+ * Authors: NocoBase Team.
5
+ *
6
+ * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
+ * For more information, please refer to: https://www.nocobase.com/agreement.
8
+ */
9
+
10
+ module.exports = {
11
+ "@nocobase/client": "2.2.52",
12
+ "@nocobase/plugin-workflow": "2.2.52",
13
+ "react": "18.2.0",
14
+ "@ant-design/icons": "5.6.1",
15
+ "@nocobase/client-v2": "2.2.52",
16
+ "@nocobase/actions": "2.2.52",
17
+ "@nocobase/database": "2.2.52",
18
+ "@nocobase/server": "2.2.52",
19
+ "antd": "5.24.2"
20
+ };
package/dist/index.js ADDED
@@ -0,0 +1,48 @@
1
+ /**
2
+ * This file is part of the NocoBase (R) project.
3
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
+ * Authors: NocoBase Team.
5
+ *
6
+ * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
+ * For more information, please refer to: https://www.nocobase.com/agreement.
8
+ */
9
+
10
+ var __create = Object.create;
11
+ var __defProp = Object.defineProperty;
12
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
13
+ var __getOwnPropNames = Object.getOwnPropertyNames;
14
+ var __getProtoOf = Object.getPrototypeOf;
15
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
16
+ var __export = (target, all) => {
17
+ for (var name in all)
18
+ __defProp(target, name, { get: all[name], enumerable: true });
19
+ };
20
+ var __copyProps = (to, from, except, desc) => {
21
+ if (from && typeof from === "object" || typeof from === "function") {
22
+ for (let key of __getOwnPropNames(from))
23
+ if (!__hasOwnProp.call(to, key) && key !== except)
24
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
25
+ }
26
+ return to;
27
+ };
28
+ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
29
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
30
+ // If the importer is in node compatibility mode or this is not an ESM
31
+ // file that has been converted to a CommonJS file using a Babel-
32
+ // compatible transform (i.e. "__esModule" has not been set), then set
33
+ // "default" to the CommonJS "module.exports" for node compatibility.
34
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
35
+ mod
36
+ ));
37
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
38
+ var src_exports = {};
39
+ __export(src_exports, {
40
+ default: () => import_server.default
41
+ });
42
+ module.exports = __toCommonJS(src_exports);
43
+ var import_server = __toESM(require("./server"));
44
+ __reExport(src_exports, require("./server"), module.exports);
45
+ // Annotate the CommonJS export names for ESM import in node:
46
+ 0 && (module.exports = {
47
+ ...require("./server")
48
+ });
@@ -0,0 +1,193 @@
1
+ {
2
+ "Portainer": "Portainer",
3
+ "Portainer Workflows": "Portainer Workflows",
4
+ "Portainer Instances": "Portainer Instances",
5
+ "Portainer instance": "Portainer instance",
6
+ "Default": "Default",
7
+ "Default Portainer instance": "Default Portainer instance",
8
+ "Leave empty to use the default enabled Portainer instance, or bind a workflow variable.": "Leave empty to use the default enabled Portainer instance, or bind a workflow variable.",
9
+ "Environment (Endpoint)": "Environment (Endpoint)",
10
+ "Select a Portainer environment or bind a dynamic endpointId variable.": "Select a Portainer environment or bind a dynamic endpointId variable.",
11
+ "Endpoint ID (e.g. 1)": "Endpoint ID (e.g. 1)",
12
+ "Auto-resolve from Stack or select environment": "Auto-resolve from Stack or select environment",
13
+ "Refresh Portainer environments": "Refresh Portainer environments",
14
+ "Up": "Up",
15
+ "Down": "Down",
16
+ "Target Stack": "Target Stack",
17
+ "Please select a Stack or bind a Stack ID variable": "Please select a Stack or bind a Stack ID variable",
18
+ "Connected Git repository": "Connected Git repository",
19
+ "Choose the Portainer Stack to control or bind a stackId variable from upstream data.": "Choose the Portainer Stack to control or bind a stackId variable from upstream data.",
20
+ "Stack ID (e.g. 12)": "Stack ID (e.g. 12)",
21
+ "Select Portainer Stack": "Select Portainer Stack",
22
+ "Git Stack": "Git Stack",
23
+ "Compose": "Compose",
24
+ "Run / Redeploy Stack": "Run / Redeploy Stack",
25
+ "Pull Git changes, build compose services, or redeploy a Portainer Stack with full environment variable control.": "Pull Git changes, build compose services, or redeploy a Portainer Stack with full environment variable control.",
26
+ "Control / Inspect Stack": "Control / Inspect Stack",
27
+ "Inspect Stack container health, start, or stop a Portainer Stack in an environment.": "Inspect Stack container health, start, or stop a Portainer Stack in an environment.",
28
+ "Execution mode": "Execution mode",
29
+ "Use Stack API to control Environment, Stack, Git branch, and full Env variables; use Stack Webhook when triggering an unauthenticated Portainer webhook UUID.": "Use Stack API to control Environment, Stack, Git branch, and full Env variables; use Stack Webhook when triggering an unauthenticated Portainer webhook UUID.",
30
+ "Stack API (Git / Compose)": "Stack API (Git / Compose)",
31
+ "Stack Webhook": "Stack Webhook",
32
+ "Stack Webhook token": "Stack Webhook token",
33
+ "Webhook token is required": "Webhook token is required",
34
+ "The UUID at the end of /api/stacks/webhooks/<token>.": "The UUID at the end of /api/stacks/webhooks/<token>.",
35
+ "Image tag override (optional)": "Image tag override (optional)",
36
+ "Appends ?tag=<value> when triggering a Portainer Stack webhook.": "Appends ?tag=<value> when triggering a Portainer Stack webhook.",
37
+ "Git branch / tag override (optional)": "Git branch / tag override (optional)",
38
+ "Leave empty to keep the Git reference already configured on Portainer (e.g. refs/heads/main), or pass a branch/tag such as main or refs/tags/v1.2.0.": "Leave empty to keep the Git reference already configured on Portainer (e.g. refs/heads/main), or pass a branch/tag such as main or refs/tags/v1.2.0.",
39
+ "Force pull / repull latest images": "Force pull / repull latest images",
40
+ "Enable when deploying a separate Stack so Portainer pulls the newly built image from your registry.": "Enable when deploying a separate Stack so Portainer pulls the newly built image from your registry.",
41
+ "Prune orphan services on redeploy": "Prune orphan services on redeploy",
42
+ "Request timeout": "Request timeout",
43
+ "Increase timeout for Stacks that run long Dockerfile builds during git/redeploy.": "Increase timeout for Stacks that run long Dockerfile builds during git/redeploy.",
44
+ "ms": "ms",
45
+ "Ignore failed execution and continue workflow": "Ignore failed execution and continue workflow",
46
+ "Environment merge strategy": "Environment merge strategy",
47
+ "Merge keeps existing Portainer Stack variables intact and overrides matching keys; Replace overwrites the entire Stack Env list.": "Merge keeps existing Portainer Stack variables intact and overrides matching keys; Replace overwrites the entire Stack Env list.",
48
+ "Merge & override existing Stack Env": "Merge & override existing Stack Env",
49
+ "Replace all Stack Env": "Replace all Stack Env",
50
+ "Environment variables (Key-Value)": "Environment variables (Key-Value)",
51
+ "Load Env from Stack": "Load Env from Stack",
52
+ "Add variables such as IMAGE_TAG or runtime settings. Mark sensitive values as Secret to redact them in workflow execution logs.": "Add variables such as IMAGE_TAG or runtime settings. Mark sensitive values as Secret to redact them in workflow execution logs.",
53
+ "Delete environment variable": "Delete environment variable",
54
+ "Value or {{variable}}": "Value or {{variable}}",
55
+ "Secret": "Secret",
56
+ "Add environment variable": "Add environment variable",
57
+ "Bulk .env text & dynamic JSON environment": "Bulk .env text & dynamic JSON environment",
58
+ "Bulk .env format": "Bulk .env format",
59
+ "Enter KEY=VALUE lines. Supports upstream workflow variables.": "Enter KEY=VALUE lines. Supports upstream workflow variables.",
60
+ "Dynamic environment JSON / variable": "Dynamic environment JSON / variable",
61
+ "Pass a JSON object {\"KEY\":\"VAL\"}, an array [{\"name\":\"KEY\",\"value\":\"VAL\"}], or a workflow variable from a build catalog record.": "Pass a JSON object {\"KEY\":\"VAL\"}, an array [{\"name\":\"KEY\",\"value\":\"VAL\"}], or a workflow variable from a build catalog record.",
62
+ "Loaded {{count}} variables ({{sensitive}} sensitive keys stay preserved on Portainer in Merge mode)": "Loaded {{count}} variables ({{sensitive}} sensitive keys stay preserved on Portainer in Merge mode)",
63
+ "Loaded {{count}} variables from Portainer Stack": "Loaded {{count}} variables from Portainer Stack",
64
+ "Failed to load environment variables from Portainer Stack": "Failed to load environment variables from Portainer Stack",
65
+ "Stack operation": "Stack operation",
66
+ "Inspect retrieves Stack status, current Env keys, and container health without restarting services; Start and Stop control the Stack lifecycle.": "Inspect retrieves Stack status, current Env keys, and container health without restarting services; Start and Stop control the Stack lifecycle.",
67
+ "Inspect Stack & Health": "Inspect Stack & Health",
68
+ "Start Stack": "Start Stack",
69
+ "Stop Stack": "Stop Stack",
70
+ "Succeeded": "Succeeded",
71
+ "Executed action": "Executed action",
72
+ "Stack ID": "Stack ID",
73
+ "Stack ID is required": "Stack ID is required",
74
+ "Stack name": "Stack name",
75
+ "Environment (Endpoint) ID": "Environment (Endpoint) ID",
76
+ "Stack type": "Stack type",
77
+ "Stack status": "Stack status",
78
+ "Git reference": "Git reference",
79
+ "Applied environment (masked)": "Applied environment (masked)",
80
+ "Applied variable count": "Applied variable count",
81
+ "Containers healthy": "Containers healthy",
82
+ "Stack healthy": "Stack healthy",
83
+ "Running containers": "Running containers",
84
+ "Total containers": "Total containers",
85
+ "Current environment (masked)": "Current environment (masked)",
86
+ "Duration (ms)": "Duration (ms)",
87
+ "Started at": "Started at",
88
+ "Finished at": "Finished at",
89
+ "Error message": "Error message",
90
+ "Refresh": "Refresh",
91
+ "Add Portainer instance": "Add Portainer instance",
92
+ "Edit Portainer instance": "Edit Portainer instance",
93
+ "Delete Portainer instance": "Delete Portainer instance",
94
+ "Delete this Portainer instance?": "Delete this Portainer instance?",
95
+ "Configure Portainer servers with an Access Token (X-API-Key). Workflow nodes can select Environments and Stacks directly or receive dynamic IDs and Env variables from upstream build catalogs.": "Configure Portainer servers with an Access Token (X-API-Key). Workflow nodes can select Environments and Stacks directly or receive dynamic IDs and Env variables from upstream build catalogs.",
96
+ "Name": "Name",
97
+ "Base URL": "Base URL",
98
+ "Health & Version": "Health & Version",
99
+ "Not tested": "Not tested",
100
+ "Connected": "Connected",
101
+ "Unreachable": "Unreachable",
102
+ "Enabled": "Enabled",
103
+ "Toggle Portainer instance": "Toggle Portainer instance",
104
+ "Actions": "Actions",
105
+ "Test": "Test",
106
+ "Test connection": "Test connection",
107
+ "Stacks": "Stacks",
108
+ "Browse Stacks": "Browse Stacks",
109
+ "Cancel": "Cancel",
110
+ "Save": "Save",
111
+ "Instance name": "Instance name",
112
+ "Instance name is required": "Instance name is required",
113
+ "Portainer base URL": "Portainer base URL",
114
+ "Base URL is required": "Base URL is required",
115
+ "Example: https://portainer.internal:9443": "Example: https://portainer.internal:9443",
116
+ "Portainer API key (X-API-Key)": "Portainer API key (X-API-Key)",
117
+ "API key is required": "API key is required",
118
+ "Generated under Portainer -> My account -> Access tokens. Encrypted at rest.": "Generated under Portainer -> My account -> Access tokens. Encrypted at rest.",
119
+ "Default build/redeploy timeout (ms)": "Default build/redeploy timeout (ms)",
120
+ "Set as default instance": "Set as default instance",
121
+ "Allow self-signed TLS certificate (:9443)": "Allow self-signed TLS certificate (:9443)",
122
+ "Optional Git authentication fallback (when Stack has no saved GitCredentialID)": "Optional Git authentication fallback (when Stack has no saved GitCredentialID)",
123
+ "Portainer saved Git Credential ID (optional)": "Portainer saved Git Credential ID (optional)",
124
+ "Automatically detected from each Git Stack when present; set here only to supply a default ID.": "Automatically detected from each Git Stack when present; set here only to supply a default ID.",
125
+ "Fallback Git username (optional)": "Fallback Git username (optional)",
126
+ "Fallback Git Personal Access Token (optional)": "Fallback Git Personal Access Token (optional)",
127
+ "Portainer Stacks": "Portainer Stacks",
128
+ "All environments (Endpoints)": "All environments (Endpoints)",
129
+ "ID": "ID",
130
+ "Stack Name": "Stack Name",
131
+ "Endpoint": "Endpoint",
132
+ "Source": "Source",
133
+ "Status": "Status",
134
+ "Active": "Active",
135
+ "Inactive": "Inactive",
136
+ "Deploying": "Deploying",
137
+ "Error": "Error",
138
+ "Env Vars": "Env Vars",
139
+ "Failed to load Portainer instances": "Failed to load Portainer instances",
140
+ "Portainer instance updated": "Portainer instance updated",
141
+ "Portainer instance created": "Portainer instance created",
142
+ "Failed to save Portainer instance": "Failed to save Portainer instance",
143
+ "Please enter a Portainer base URL first": "Please enter a Portainer base URL first",
144
+ "Connected to Portainer v{{version}} ({{count}} environments found)": "Connected to Portainer v{{version}} ({{count}} environments found)",
145
+ "Connection test failed. Check URL, API key, and TLS settings.": "Connection test failed. Check URL, API key, and TLS settings.",
146
+ "Connection test failed": "Connection test failed",
147
+ "Failed to update status": "Failed to update status",
148
+ "Portainer instance deleted": "Portainer instance deleted",
149
+ "Failed to delete Portainer instance": "Failed to delete Portainer instance",
150
+ "Failed to load environments and stacks from Portainer": "Failed to load environments and stacks from Portainer",
151
+ "Detail": "Detail",
152
+ "Stack Detail": "Stack Detail",
153
+ "Auto-refresh (5s)": "Auto-refresh (5s)",
154
+ "Auto-refresh live metrics (5s)": "Auto-refresh live metrics (5s)",
155
+ "Stop this Stack on Portainer?": "Stop this Stack on Portainer?",
156
+ "Stack started": "Stack started",
157
+ "Stack stopped": "Stack stopped",
158
+ "Failed to control Stack": "Failed to control Stack",
159
+ "Operation must be start or stop": "Operation must be start or stop",
160
+ "Failed to load Stack details from Portainer": "Failed to load Stack details from Portainer",
161
+ "Containers Health": "Containers Health",
162
+ "Live CPU Usage": "Live CPU Usage",
163
+ "Live Memory Usage": "Live Memory Usage",
164
+ "Network I/O (RX / TX)": "Network I/O (RX / TX)",
165
+ "Containers & Live Metrics": "Containers & Live Metrics",
166
+ "Stack containers and live metrics": "Stack containers and live metrics",
167
+ "No containers found for this Stack": "No containers found for this Stack",
168
+ "Container / Service": "Container / Service",
169
+ "State & Uptime": "State & Uptime",
170
+ "Ports & IP": "Ports & IP",
171
+ "CPU": "CPU",
172
+ "Memory": "Memory",
173
+ "Network / PIDs": "Network / PIDs",
174
+ "Logs": "Logs",
175
+ "Container Logs": "Container Logs",
176
+ "Tail lines": "Tail lines",
177
+ "Close": "Close",
178
+ "No log output": "No log output",
179
+ "Failed to fetch container logs": "Failed to fetch container logs",
180
+ "Stack Metadata": "Stack Metadata",
181
+ "Entry point": "Entry point",
182
+ "Created at": "Created at",
183
+ "Last updated": "Last updated",
184
+ "Git commit / config": "Git commit / config",
185
+ "Project path": "Project path",
186
+ "Deployment History": "Deployment History",
187
+ "Time": "Time",
188
+ "Message": "Message",
189
+ "Value": "Value",
190
+ "No environment variables configured": "No environment variables configured",
191
+ "Compose File": "Compose File",
192
+ "Compose file content is unavailable": "Compose file content is unavailable"
193
+ }