mxKubernetes.js 17 KB

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