mxKubernetes.js 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584
  1. /**
  2. * Copyright (c) 2006-2020, JGraph Holdings Ltd
  3. */
  4. //**********************************************************************************************************************************************************
  5. // Kubernetes icon
  6. //**********************************************************************************************************************************************************
  7. /**
  8. * Extends mxShape.
  9. */
  10. function mxShapeKubernetesIcon(bounds, fill, stroke, strokewidth)
  11. {
  12. mxShape.call(this);
  13. this.bounds = bounds;
  14. this.fill = fill;
  15. this.stroke = stroke;
  16. this.strokewidth = (strokewidth != null) ? strokewidth : 1;
  17. };
  18. /**
  19. * Extends mxShape.
  20. */
  21. mxUtils.extend(mxShapeKubernetesIcon, mxShape);
  22. mxShapeKubernetesIcon.prototype.cst = {
  23. ICON : 'mxgraph.kubernetes.icon'
  24. };
  25. mxShapeKubernetesIcon.prototype.customProperties = [
  26. {name: 'prIcon', dispName: 'Type', defVal: 'api', type: 'enum',
  27. enumList: [{val: 'c_c_m', dispName: 'C-C-M'},
  28. {val: 'c_m', dispName: 'C-M'},
  29. {val: 'c_role', dispName: 'C-Role'},
  30. {val: 'cm', dispName: 'CM'},
  31. {val: 'crb', dispName: 'CRB'},
  32. {val: 'crd', dispName: 'CRD'},
  33. {val: 'cronjob', dispName: 'Cronjob'},
  34. {val: 'deploy', dispName: 'Deploy'},
  35. {val: 'ds', dispName: 'DS'},
  36. {val: 'ep', dispName: 'EP'},
  37. {val: 'etcd', dispName: 'ETCD'},
  38. {val: 'group', dispName: 'Group'},
  39. {val: 'hpa', dispName: 'HPA'},
  40. {val: 'ing', dispName: 'ING'},
  41. {val: 'job', dispName: 'Job'},
  42. {val: 'k_proxy', dispName: 'K-Proxy'},
  43. {val: 'kubelet', dispName: 'Kubelet'},
  44. {val: 'limits', dispName: 'Limits'},
  45. {val: 'master', dispName: 'Master'},
  46. {val: 'netpol', dispName: 'Netpol'},
  47. {val: 'node', dispName: 'Node'},
  48. {val: 'ns', dispName: 'NS'},
  49. {val: 'pod', dispName: 'Pod'},
  50. {val: 'psp', dispName: 'PSP'},
  51. {val: 'pv', dispName: 'PV'},
  52. {val: 'pvc', dispName: 'PVC'},
  53. {val: 'quota', dispName: 'Quota'},
  54. {val: 'rb', dispName: 'RB'},
  55. {val: 'role', dispName: 'Role'},
  56. {val: 'rs', dispName: 'RS'},
  57. {val: 'sa', dispName: 'SA'},
  58. {val: 'sc', dispName: 'SC'},
  59. {val: 'sched', dispName: 'Sched'},
  60. {val: 'secret', dispName: 'Secret'},
  61. {val: 'sts', dispName: 'STS'},
  62. {val: 'svc', dispName: 'SVC'},
  63. {val: 'user', dispName: 'User'},
  64. {val: 'vol', dispName: 'Vol'}]}
  65. ];
  66. /**
  67. * Function: paintVertexShape
  68. *
  69. * Paints the vertex shape.
  70. */
  71. mxShapeKubernetesIcon.prototype.paintVertexShape = function(c, x, y, w, h)
  72. {
  73. var prIcon = mxUtils.getValue(this.state.style, 'prIcon', '');
  74. var fillColor = mxUtils.getValue(this.state.style, 'fillColor', '#ffffff');
  75. var strokeColor = mxUtils.getValue(this.state.style, 'strokeColor', '#ffffff');
  76. c.translate(x, y);
  77. var frame = mxStencilRegistry.getStencil('mxgraph.kubernetes.frame');
  78. c.setFillColor(strokeColor);
  79. frame.drawShape(c, this, 0, 0, w, h);
  80. c.setFillColor(fillColor);
  81. frame.drawShape(c, this, w * 0.03, h * 0.03, w * 0.94, h * 0.94);
  82. var prStencil = mxStencilRegistry.getStencil('mxgraph.kubernetes.' + prIcon);
  83. if (prStencil != null)
  84. {
  85. c.setFillColor(strokeColor);
  86. prStencil.drawShape(c, this, w * 0.2, h * 0.2, w * 0.6, h * 0.6);
  87. }
  88. };
  89. mxCellRenderer.registerShape(mxShapeKubernetesIcon.prototype.cst.ICON, mxShapeKubernetesIcon);
  90. mxShapeKubernetesIcon.prototype.getConstraints = function(style, w, h)
  91. {
  92. var constr = [];
  93. var r = Math.min(h * 0.5, w * 0.5);
  94. constr.push(new mxConnectionConstraint(new mxPoint(0, 0.5), false));
  95. return (constr);
  96. }
  97. /**
  98. * Copyright (c) 2006-2020, JGraph Holdings Ltd
  99. */
  100. //**********************************************************************************************************************************************************
  101. // Kubernetes icon 2
  102. //**********************************************************************************************************************************************************
  103. /**
  104. * Extends mxShape.
  105. */
  106. function mxShapeKubernetesIcon2(bounds, fill, stroke, strokewidth)
  107. {
  108. mxShape.call(this);
  109. this.bounds = bounds;
  110. this.fill = fill;
  111. this.stroke = stroke;
  112. this.strokewidth = (strokewidth != null) ? strokewidth : 1;
  113. };
  114. /**
  115. * Extends mxShape.
  116. */
  117. mxUtils.extend(mxShapeKubernetesIcon2, mxShape);
  118. mxShapeKubernetesIcon2.prototype.cst = {
  119. ICON2 : 'mxgraph.kubernetes.icon2'
  120. };
  121. mxShapeKubernetesIcon2.prototype.customProperties = [
  122. {name: 'kubernetesLabel', dispName: 'Label', type: 'boolean', defVal:0},
  123. {name: 'prIcon', dispName: 'Type', defVal: 'api', type: 'enum',
  124. enumList: [{val: 'api', dispName: 'API'},
  125. {val: 'c_c_m', dispName: 'C-C-M'},
  126. {val: 'cm', dispName: 'CM'},
  127. {val: 'c_m', dispName: 'C-M'},
  128. {val: 'c_role', dispName: 'C-Role'},
  129. {val: 'control_plane', dispName: 'Control Plane'},
  130. {val: 'crb', dispName: 'CRB'},
  131. {val: 'crd', dispName: 'CRD'},
  132. {val: 'cronjob', dispName: 'Cronjob'},
  133. {val: 'deploy', dispName: 'Deploy'},
  134. {val: 'ds', dispName: 'DS'},
  135. {val: 'ep', dispName: 'EP'},
  136. {val: 'etcd', dispName: 'ETCD'},
  137. {val: 'group', dispName: 'Group'},
  138. {val: 'hpa', dispName: 'HPA'},
  139. {val: 'ing', dispName: 'ING'},
  140. {val: 'job', dispName: 'Job'},
  141. {val: 'k_proxy', dispName: 'K-Proxy'},
  142. {val: 'kubelet', dispName: 'Kubelet'},
  143. {val: 'limits', dispName: 'Limits'},
  144. {val: 'netpol', dispName: 'Netpol'},
  145. {val: 'node', dispName: 'Node'},
  146. {val: 'ns', dispName: 'NS'},
  147. {val: 'pod', dispName: 'Pod'},
  148. {val: 'psp', dispName: 'PSP'},
  149. {val: 'pv', dispName: 'PV'},
  150. {val: 'pvc', dispName: 'PVC'},
  151. {val: 'quota', dispName: 'Quota'},
  152. {val: 'rb', dispName: 'RB'},
  153. {val: 'role', dispName: 'Role'},
  154. ]}
  155. ];
  156. /**
  157. * Function: paintVertexShape
  158. *
  159. * Paints the vertex shape.
  160. */
  161. mxShapeKubernetesIcon2.prototype.paintVertexShape = function(c, x, y, w, h)
  162. {
  163. var prIcon = mxUtils.getValue(this.state.style, 'prIcon', '');
  164. var fillColor = mxUtils.getValue(this.state.style, 'fillColor', '#ffffff');
  165. var strokeColor = mxUtils.getValue(this.state.style, 'strokeColor', '#ffffff');
  166. var hasLabel = mxUtils.getValue(this.state.style, 'kubernetesLabel', 0);
  167. c.translate(x, y);
  168. var frame = mxStencilRegistry.getStencil('mxgraph.kubernetes.frame');
  169. c.setFillColor(strokeColor);
  170. frame.drawShape(c, this, 0, 0, w, h);
  171. c.setFillColor(fillColor);
  172. frame.drawShape(c, this, w * 0.03, h * 0.03, w * 0.94, h * 0.94);
  173. var prStencil = mxStencilRegistry.getStencil('mxgraph.kubernetes2.' + prIcon);
  174. c.setFillColor(strokeColor);
  175. c.setFontColor(strokeColor);
  176. c.setFontSize(Math.min(w, h) * 0.2);
  177. var w2 = Math.min(h, w);
  178. var h2 = w2;
  179. if (hasLabel == 1)
  180. {
  181. w2 = w2 * 0.8;
  182. h2 = w2 * 0.9;
  183. }
  184. if (prIcon == 'api')
  185. {
  186. prStencil.drawShape(c, this, w * 0.5 - w2 * 0.3, h * 0.2, w2 * 0.6, h2 * 0.6);
  187. if (hasLabel == 1)
  188. {
  189. c.text(w * 0.5, h * 0.75, 0, 0, 'api', mxConstants.ALIGN_CENTER, mxConstants.ALIGN_MIDDLE, 0, null, 0, 0, 0);
  190. }
  191. }
  192. else if (prIcon == 'c_c_m')
  193. {
  194. prStencil.drawShape(c, this, w * 0.5 - w2 * 0.3, h * 0.2, w2 * 0.6, h2 * 0.6);
  195. if (hasLabel == 1)
  196. {
  197. c.text(w * 0.5, h * 0.75, 0, 0, 'c-c-m', mxConstants.ALIGN_CENTER, mxConstants.ALIGN_MIDDLE, 0, null, 0, 0, 0);
  198. }
  199. }
  200. else if (prIcon == 'cm')
  201. {
  202. prStencil.drawShape(c, this, w * 0.5 - w2 * 0.3, h * 0.25, w2 * 0.6, h2 * 0.5);
  203. if (hasLabel == 1)
  204. {
  205. c.text(w * 0.5, h * 0.75, 0, 0, 'cm', mxConstants.ALIGN_CENTER, mxConstants.ALIGN_MIDDLE, 0, null, 0, 0, 0);
  206. }
  207. }
  208. else if (prIcon == 'c_m')
  209. {
  210. prStencil.drawShape(c, this, w * 0.5 - w2 * 0.3, h * 0.2, w2 * 0.6, h2 * 0.6);
  211. if (hasLabel == 1)
  212. {
  213. c.text(w * 0.5, h * 0.75, 0, 0, 'c-m', mxConstants.ALIGN_CENTER, mxConstants.ALIGN_MIDDLE, 0, null, 0, 0, 0);
  214. }
  215. }
  216. else if (prIcon == 'c_role')
  217. {
  218. prStencil.drawShape(c, this, w * 0.5 - w2 * 0.25, h * 0.2, w2 * 0.5, h2 * 0.6);
  219. if (hasLabel == 1)
  220. {
  221. c.text(w * 0.5, h * 0.75, 0, 0, 'c-role', mxConstants.ALIGN_CENTER, mxConstants.ALIGN_MIDDLE, 0, null, 0, 0, 0);
  222. }
  223. }
  224. else if (prIcon == 'control_plane')
  225. {
  226. prStencil.drawShape(c, this, w * 0.5 - w2 * 0.3, h * 0.2, w2 * 0.6, h2 * 0.6);
  227. if (hasLabel == 1)
  228. {
  229. c.setFontSize(Math.min(w, h) * 0.12);
  230. c.text(w * 0.5, h * 0.78, 0, 0, 'control\nplane', mxConstants.ALIGN_CENTER, mxConstants.ALIGN_MIDDLE, 0, null, 0, 0, 0);
  231. }
  232. }
  233. else if (prIcon == 'crb')
  234. {
  235. prStencil.drawShape(c, this, w * 0.5 - w2 * 0.25, h * 0.3, w2 * 0.5, h2 * 0.3);
  236. if (hasLabel == 1)
  237. {
  238. c.text(w * 0.5, h * 0.75, 0, 0, 'crb', mxConstants.ALIGN_CENTER, mxConstants.ALIGN_MIDDLE, 0, null, 0, 0, 0);
  239. }
  240. }
  241. else if (prIcon == 'crd')
  242. {
  243. prStencil.drawShape(c, this, w * 0.5 - w2 * 0.25, h * 0.2, w2 * 0.6, h2 * 0.6);
  244. if (hasLabel == 1)
  245. {
  246. c.text(w * 0.5, h * 0.75, 0, 0, 'crd', mxConstants.ALIGN_CENTER, mxConstants.ALIGN_MIDDLE, 0, null, 0, 0, 0);
  247. }
  248. }
  249. else if (prIcon == 'cronjob')
  250. {
  251. prStencil.drawShape(c, this, w * 0.5 - w2 * 0.3, h * 0.2, w2 * 0.6, h2 * 0.6);
  252. if (hasLabel == 1)
  253. {
  254. c.text(w * 0.5, h * 0.75, 0, 0, 'cronjob', mxConstants.ALIGN_CENTER, mxConstants.ALIGN_MIDDLE, 0, null, 0, 0, 0);
  255. }
  256. }
  257. else if (prIcon == 'deploy')
  258. {
  259. prStencil.drawShape(c, this, w * 0.5 - w2 * 0.27, h * 0.25, w2 * 0.6, h2 * 0.55);
  260. if (hasLabel == 1)
  261. {
  262. c.text(w * 0.5, h * 0.75, 0, 0, 'deploy', mxConstants.ALIGN_CENTER, mxConstants.ALIGN_MIDDLE, 0, null, 0, 0, 0);
  263. }
  264. }
  265. else if (prIcon == 'ds')
  266. {
  267. prStencil.drawShape(c, this, w * 0.5 - w2 * 0.3, h * 0.2, w2 * 0.6, h2 * 0.6);
  268. if (hasLabel == 1)
  269. {
  270. c.text(w * 0.5, h * 0.75, 0, 0, 'ds', mxConstants.ALIGN_CENTER, mxConstants.ALIGN_MIDDLE, 0, null, 0, 0, 0);
  271. }
  272. }
  273. else if (prIcon == 'ep')
  274. {
  275. prStencil.drawShape(c, this, w * 0.5 - w2 * 0.3, h * 0.2, w2 * 0.6, h2 * 0.6);
  276. if (hasLabel == 1)
  277. {
  278. c.text(w * 0.5, h * 0.75, 0, 0, 'ep', mxConstants.ALIGN_CENTER, mxConstants.ALIGN_MIDDLE, 0, null, 0, 0, 0);
  279. }
  280. }
  281. else if (prIcon == 'etcd')
  282. {
  283. prStencil.drawShape(c, this, w * 0.5 - w2 * 0.3, h * 0.2, w2 * 0.6, h2 * 0.6);
  284. if (hasLabel == 1)
  285. {
  286. c.text(w * 0.5, h * 0.75, 0, 0, 'etcd', mxConstants.ALIGN_CENTER, mxConstants.ALIGN_MIDDLE, 0, null, 0, 0, 0);
  287. }
  288. }
  289. else if (prIcon == 'group')
  290. {
  291. prStencil.drawShape(c, this, w * 0.5 - w2 * 0.3, h * 0.2, w2 * 0.6, h2 * 0.6);
  292. if (hasLabel == 1)
  293. {
  294. c.text(w * 0.5, h * 0.75, 0, 0, 'group', mxConstants.ALIGN_CENTER, mxConstants.ALIGN_MIDDLE, 0, null, 0, 0, 0);
  295. }
  296. }
  297. else if (prIcon == 'hpa')
  298. {
  299. prStencil.drawShape(c, this, w * 0.5 - w2 * 0.4, h * 0.1, w2 * 0.8, h2 * 0.8);
  300. if (hasLabel == 1)
  301. {
  302. c.text(w * 0.5, h * 0.75, 0, 0, 'hpa', mxConstants.ALIGN_CENTER, mxConstants.ALIGN_MIDDLE, 0, null, 0, 0, 0);
  303. }
  304. }
  305. else if (prIcon == 'ing')
  306. {
  307. prStencil.drawShape(c, this, w * 0.5 - w2 * 0.3, h * 0.2, w2 * 0.6, h2 * 0.6);
  308. if (hasLabel == 1)
  309. {
  310. c.text(w * 0.5, h * 0.75, 0, 0, 'ing', mxConstants.ALIGN_CENTER, mxConstants.ALIGN_MIDDLE, 0, null, 0, 0, 0);
  311. }
  312. }
  313. else if (prIcon == 'job')
  314. {
  315. prStencil.drawShape(c, this, w * 0.5 - w2 * 0.3, h * 0.2, w2 * 0.6, h2 * 0.6);
  316. if (hasLabel == 1)
  317. {
  318. c.text(w * 0.5, h * 0.75, 0, 0, 'job', mxConstants.ALIGN_CENTER, mxConstants.ALIGN_MIDDLE, 0, null, 0, 0, 0);
  319. }
  320. }
  321. else if (prIcon == 'k_proxy')
  322. {
  323. prStencil.drawShape(c, this, w * 0.5 - w2 * 0.3, h * 0.2, w2 * 0.6, h2 * 0.6);
  324. if (hasLabel == 1)
  325. {
  326. c.text(w * 0.5, h * 0.75, 0, 0, 'k-proxy', mxConstants.ALIGN_CENTER, mxConstants.ALIGN_MIDDLE, 0, null, 0, 0, 0);
  327. }
  328. }
  329. else if (prIcon == 'kubelet')
  330. {
  331. prStencil.drawShape(c, this, w * 0.5 - w2 * 0.3, h * 0.2, w2 * 0.6, h2 * 0.6);
  332. if (hasLabel == 1)
  333. {
  334. c.text(w * 0.5, h * 0.75, 0, 0, 'kubelet', mxConstants.ALIGN_CENTER, mxConstants.ALIGN_MIDDLE, 0, null, 0, 0, 0);
  335. }
  336. }
  337. else if (prIcon == 'limits')
  338. {
  339. prStencil.drawShape(c, this, w * 0.5 - w2 * 0.3, h * 0.2, w2 * 0.6, h2 * 0.6);
  340. if (hasLabel == 1)
  341. {
  342. c.text(w * 0.5, h * 0.75, 0, 0, 'limits', mxConstants.ALIGN_CENTER, mxConstants.ALIGN_MIDDLE, 0, null, 0, 0, 0);
  343. }
  344. }
  345. else if (prIcon == 'netpol')
  346. {
  347. prStencil.drawShape(c, this, w * 0.5 - w2 * 0.3, h * 0.2, w2 * 0.6, h2 * 0.6);
  348. if (hasLabel == 1)
  349. {
  350. c.text(w * 0.5, h * 0.75, 0, 0, 'netpol', mxConstants.ALIGN_CENTER, mxConstants.ALIGN_MIDDLE, 0, null, 0, 0, 0);
  351. }
  352. }
  353. else if (prIcon == 'node')
  354. {
  355. prStencil.drawShape(c, this, w * 0.5 - w2 * 0.3, h * 0.2, w2 * 0.6, h2 * 0.6);
  356. if (hasLabel == 1)
  357. {
  358. c.text(w * 0.5, h * 0.75, 0, 0, 'node', mxConstants.ALIGN_CENTER, mxConstants.ALIGN_MIDDLE, 0, null, 0, 0, 0);
  359. }
  360. }
  361. else if (prIcon == 'ns')
  362. {
  363. prStencil.drawShape(c, this, w * 0.5 - w2 * 0.3, h * 0.2, w2 * 0.6, h2 * 0.6);
  364. if (hasLabel == 1)
  365. {
  366. c.text(w * 0.5, h * 0.75, 0, 0, 'ns', mxConstants.ALIGN_CENTER, mxConstants.ALIGN_MIDDLE, 0, null, 0, 0, 0);
  367. }
  368. }
  369. else if (prIcon == 'pod')
  370. {
  371. prStencil.drawShape(c, this, w * 0.5 - w2 * 0.3, h * 0.2, w2 * 0.6, h2 * 0.6);
  372. if (hasLabel == 1)
  373. {
  374. c.text(w * 0.5, h * 0.75, 0, 0, 'pod', mxConstants.ALIGN_CENTER, mxConstants.ALIGN_MIDDLE, 0, null, 0, 0, 0);
  375. }
  376. }
  377. else if (prIcon == 'psp')
  378. {
  379. prStencil.drawShape(c, this, w * 0.5 - w2 * 0.3, h * 0.2, w2 * 0.6, h2 * 0.6);
  380. if (hasLabel == 1)
  381. {
  382. c.text(w * 0.5, h * 0.75, 0, 0, 'psp', mxConstants.ALIGN_CENTER, mxConstants.ALIGN_MIDDLE, 0, null, 0, 0, 0);
  383. }
  384. }
  385. else if (prIcon == 'pv')
  386. {
  387. prStencil.drawShape(c, this, w * 0.5 - w2 * 0.3, h * 0.2, w2 * 0.6, h2 * 0.6);
  388. if (hasLabel == 1)
  389. {
  390. c.text(w * 0.5, h * 0.75, 0, 0, 'pv', mxConstants.ALIGN_CENTER, mxConstants.ALIGN_MIDDLE, 0, null, 0, 0, 0);
  391. }
  392. }
  393. else if (prIcon == 'pvc')
  394. {
  395. prStencil.drawShape(c, this, w * 0.5 - w2 * 0.3, h * 0.2, w2 * 0.6, h2 * 0.6);
  396. if (hasLabel == 1)
  397. {
  398. c.text(w * 0.5, h * 0.75, 0, 0, 'pvc', mxConstants.ALIGN_CENTER, mxConstants.ALIGN_MIDDLE, 0, null, 0, 0, 0);
  399. }
  400. }
  401. else if (prIcon == 'quota')
  402. {
  403. prStencil.drawShape(c, this, w * 0.5 - w2 * 0.3, h * 0.2, w2 * 0.6, h2 * 0.6);
  404. if (hasLabel == 1)
  405. {
  406. c.text(w * 0.5, h * 0.75, 0, 0, 'quota', mxConstants.ALIGN_CENTER, mxConstants.ALIGN_MIDDLE, 0, null, 0, 0, 0);
  407. }
  408. }
  409. else if (prIcon == 'rb')
  410. {
  411. prStencil.drawShape(c, this, w * 0.5 - w2 * 0.3, h * 0.2, w2 * 0.6, h2 * 0.6);
  412. if (hasLabel == 1)
  413. {
  414. c.text(w * 0.5, h * 0.75, 0, 0, 'rb', mxConstants.ALIGN_CENTER, mxConstants.ALIGN_MIDDLE, 0, null, 0, 0, 0);
  415. }
  416. }
  417. else if (prIcon == 'role')
  418. {
  419. prStencil.drawShape(c, this, w * 0.5 - w2 * 0.3, h * 0.2, w2 * 0.6, h2 * 0.6);
  420. if (hasLabel == 1)
  421. {
  422. c.text(w * 0.5, h * 0.75, 0, 0, 'role', mxConstants.ALIGN_CENTER, mxConstants.ALIGN_MIDDLE, 0, null, 0, 0, 0);
  423. }
  424. }
  425. else if (prIcon == 'rs')
  426. {
  427. prStencil.drawShape(c, this, w * 0.5 - w2 * 0.3, h * 0.2, w2 * 0.6, h2 * 0.6);
  428. if (hasLabel == 1)
  429. {
  430. c.text(w * 0.5, h * 0.75, 0, 0, 'rs', mxConstants.ALIGN_CENTER, mxConstants.ALIGN_MIDDLE, 0, null, 0, 0, 0);
  431. }
  432. }
  433. else if (prIcon == 'sa')
  434. {
  435. prStencil.drawShape(c, this, w * 0.5 - w2 * 0.3, h * 0.2, w2 * 0.6, h2 * 0.6);
  436. if (hasLabel == 1)
  437. {
  438. c.text(w * 0.5, h * 0.75, 0, 0, 'sa', mxConstants.ALIGN_CENTER, mxConstants.ALIGN_MIDDLE, 0, null, 0, 0, 0);
  439. }
  440. }
  441. else if (prIcon == 'sc')
  442. {
  443. prStencil.drawShape(c, this, w * 0.5 - w2 * 0.3, h * 0.2, w2 * 0.6, h2 * 0.6);
  444. if (hasLabel == 1)
  445. {
  446. c.text(w * 0.5, h * 0.75, 0, 0, 'sc', mxConstants.ALIGN_CENTER, mxConstants.ALIGN_MIDDLE, 0, null, 0, 0, 0);
  447. }
  448. }
  449. else if (prIcon == 'sched')
  450. {
  451. prStencil.drawShape(c, this, w * 0.5 - w2 * 0.3, h * 0.2, w2 * 0.6, h2 * 0.6);
  452. if (hasLabel == 1)
  453. {
  454. c.text(w * 0.5, h * 0.75, 0, 0, 'sched', mxConstants.ALIGN_CENTER, mxConstants.ALIGN_MIDDLE, 0, null, 0, 0, 0);
  455. }
  456. }
  457. else if (prIcon == 'secret')
  458. {
  459. prStencil.drawShape(c, this, w * 0.5 - w2 * 0.3, h * 0.2, w2 * 0.6, h2 * 0.6);
  460. if (hasLabel == 1)
  461. {
  462. c.text(w * 0.5, h * 0.75, 0, 0, 'secret', mxConstants.ALIGN_CENTER, mxConstants.ALIGN_MIDDLE, 0, null, 0, 0, 0);
  463. }
  464. }
  465. else if (prIcon == 'sts')
  466. {
  467. prStencil.drawShape(c, this, w * 0.5 - w2 * 0.3, h * 0.2, w2 * 0.6, h2 * 0.6);
  468. if (hasLabel == 1)
  469. {
  470. c.text(w * 0.5, h * 0.75, 0, 0, 'sts', mxConstants.ALIGN_CENTER, mxConstants.ALIGN_MIDDLE, 0, null, 0, 0, 0);
  471. }
  472. }
  473. else if (prIcon == 'svc')
  474. {
  475. prStencil.drawShape(c, this, w * 0.5 - w2 * 0.3, h * 0.2, w2 * 0.6, h2 * 0.6);
  476. if (hasLabel == 1)
  477. {
  478. c.text(w * 0.5, h * 0.75, 0, 0, 'svc', mxConstants.ALIGN_CENTER, mxConstants.ALIGN_MIDDLE, 0, null, 0, 0, 0);
  479. }
  480. }
  481. else if (prIcon == 'user')
  482. {
  483. prStencil.drawShape(c, this, w * 0.5 - w2 * 0.3, h * 0.2, w2 * 0.6, h2 * 0.6);
  484. if (hasLabel == 1)
  485. {
  486. c.text(w * 0.5, h * 0.75, 0, 0, 'user', mxConstants.ALIGN_CENTER, mxConstants.ALIGN_MIDDLE, 0, null, 0, 0, 0);
  487. }
  488. }
  489. else if (prIcon == 'vol')
  490. {
  491. prStencil.drawShape(c, this, w * 0.5 - w2 * 0.3, h * 0.2, w2 * 0.6, h2 * 0.6);
  492. if (hasLabel == 1)
  493. {
  494. c.text(w * 0.5, h * 0.75, 0, 0, 'vol', mxConstants.ALIGN_CENTER, mxConstants.ALIGN_MIDDLE, 0, null, 0, 0, 0);
  495. }
  496. }
  497. else if (prStencil != null)
  498. {
  499. prStencil.drawShape(c, this, w * 0.2, h * 0.2, w * 0.6, h * 0.6);
  500. }
  501. };
  502. mxCellRenderer.registerShape(mxShapeKubernetesIcon2.prototype.cst.ICON2, mxShapeKubernetesIcon2);
  503. mxShapeKubernetesIcon2.prototype.getConstraints = function(style, w, h)
  504. {
  505. var constr = [];
  506. var r = Math.min(h * 0.5, w * 0.5);
  507. constr.push(new mxConnectionConstraint(new mxPoint(0, 0.5), false));
  508. return (constr);
  509. }