@dovetail-v2/refine 0.0.66-pod-exec.0 → 0.1.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 (238) hide show
  1. package/dist/{MonacoYamlDiffEditor-6b799b64.js → MonacoYamlDiffEditor-e737ae8d.js} +1 -1
  2. package/dist/{index-c07bed15.js → index-0c7bfb69.js} +5800 -19551
  3. package/dist/refine.js +162 -161
  4. package/dist/refine.umd.cjs +4780 -18531
  5. package/dist/style.css +11 -229
  6. package/lib/src/App.js +91 -0
  7. package/lib/src/Dovetail.js +45 -0
  8. package/lib/src/components/Breadcrumb/index.js +20 -0
  9. package/lib/src/components/ConditionsTable/ConditionsTable.js +56 -0
  10. package/lib/src/components/ConditionsTable/index.js +1 -0
  11. package/lib/src/components/CreateButton/index.js +10 -0
  12. package/lib/src/components/CronJobDropdown/index.js +26 -0
  13. package/lib/src/components/CronjobJobsTable/index.js +49 -0
  14. package/lib/src/components/DeleteButton/index.js +13 -0
  15. package/lib/src/components/DeleteManyButton/index.js +16 -0
  16. package/lib/src/components/DrawerShow/DrawerShow.js +13 -0
  17. package/lib/src/components/DrawerShow/index.js +1 -0
  18. package/lib/src/components/EditButton/index.js +13 -0
  19. package/lib/src/components/EditField/index.js +47 -0
  20. package/lib/src/components/ErrorContent/index.js +36 -0
  21. package/lib/src/components/EventsTable/EventsTable.js +59 -0
  22. package/lib/src/components/EventsTable/index.js +1 -0
  23. package/lib/src/components/Form/FormModal.d.ts +0 -1
  24. package/lib/src/components/Form/KeyValueListWidget.js +56 -0
  25. package/lib/src/components/Form/MetadataForm.js +9 -0
  26. package/lib/src/components/Form/NameInputWidget.js +50 -0
  27. package/lib/src/components/Form/NamespaceSelectWidget.js +21 -0
  28. package/lib/src/components/Form/index.js +4 -0
  29. package/lib/src/components/Form/widget.js +1 -0
  30. package/lib/src/components/FormErrorAlert/index.js +8 -0
  31. package/lib/src/components/FormLayout/index.js +21 -0
  32. package/lib/src/components/FormModal/index.js +51 -0
  33. package/lib/src/components/ImageNames/index.js +14 -0
  34. package/lib/src/components/IngressRulesComponent/index.js +11 -0
  35. package/lib/src/components/IngressRulesTable/IngressRulesTable.js +51 -0
  36. package/lib/src/components/IngressRulesTable/index.js +1 -0
  37. package/lib/src/components/K8sDropdown/index.js +31 -0
  38. package/lib/src/components/KeyValue/KeyValue.js +27 -0
  39. package/lib/src/components/KeyValue/index.js +1 -0
  40. package/lib/src/components/KeyValueData/index.js +50 -0
  41. package/lib/src/components/Layout/index.js +39 -0
  42. package/lib/src/components/ListPage/index.d.ts +1 -0
  43. package/lib/src/components/ListPage/index.js +25 -0
  44. package/lib/src/components/Menu/index.js +36 -0
  45. package/lib/src/components/NamespacesFilter/index.js +34 -0
  46. package/lib/src/components/NetworkPolicyRulesTable/NetworkPolicyRulesTable.d.ts +1 -2
  47. package/lib/src/components/NetworkPolicyRulesTable/NetworkPolicyRulesTable.js +77 -0
  48. package/lib/src/components/NetworkPolicyRulesTable/index.js +1 -0
  49. package/lib/src/components/PageShow/PageShow.js +11 -0
  50. package/lib/src/components/PageShow/index.js +1 -0
  51. package/lib/src/components/PodContainersTable/PodContainersTable.js +78 -0
  52. package/lib/src/components/PodContainersTable/index.js +1 -0
  53. package/lib/src/components/PodLog/index.js +136 -0
  54. package/lib/src/components/ReferenceLink/index.js +17 -0
  55. package/lib/src/components/RefineForm/RefineFormContent.d.ts +10 -0
  56. package/lib/src/components/RefineForm/RefineFormModal.d.ts +8 -0
  57. package/lib/src/components/RefineForm/RefineFormPage.d.ts +7 -0
  58. package/lib/src/components/RefineForm/index.d.ts +3 -0
  59. package/lib/src/components/RefineForm/type.d.ts +20 -0
  60. package/lib/src/components/RefineForm/useRefineForm.d.ts +10 -0
  61. package/lib/src/components/ResourceCRUD/ResourceCRUD.js +15 -0
  62. package/lib/src/components/ResourceCRUD/create/index.js +13 -0
  63. package/lib/src/components/ResourceCRUD/index.js +4 -0
  64. package/lib/src/components/ResourceCRUD/list/index.js +19 -0
  65. package/lib/src/components/ResourceCRUD/show/index.js +6 -0
  66. package/lib/src/components/ResourceFiledDisplays.d.ts +7 -0
  67. package/lib/src/components/ResourceLink/index.js +21 -0
  68. package/lib/src/components/ResourceUsageBar/index.js +81 -0
  69. package/lib/src/components/Separator/index.js +11 -0
  70. package/lib/src/components/ShowContent/ShowContent.js +157 -0
  71. package/lib/src/components/ShowContent/fields.d.ts +7 -2
  72. package/lib/src/components/ShowContent/fields.js +157 -0
  73. package/lib/src/components/ShowContent/index.js +2 -0
  74. package/lib/src/components/StateTag/StateTag.js +22 -0
  75. package/lib/src/components/StateTag/index.js +1 -0
  76. package/lib/src/components/Table/ErrorContent.js +36 -0
  77. package/lib/src/components/Table/TableToolBar.js +14 -0
  78. package/lib/src/components/Table/TableWidgets.js +28 -0
  79. package/lib/src/components/Table/index.js +69 -0
  80. package/lib/src/components/Tags/index.js +22 -0
  81. package/lib/src/components/Time/index.js +14 -0
  82. package/lib/src/components/WorkloadDropdown/index.js +24 -0
  83. package/lib/src/components/WorkloadPodsTable/WorkloadPodsTable.js +39 -0
  84. package/lib/src/components/WorkloadPodsTable/index.js +1 -0
  85. package/lib/src/components/WorkloadReplicas/index.js +50 -0
  86. package/lib/src/components/YamlEditor/MonacoYamlDiffEditor.js +34 -0
  87. package/lib/src/components/YamlEditor/MonacoYamlEditor.js +149 -0
  88. package/lib/src/components/YamlEditor/YamlEditorComponent.js +90 -0
  89. package/lib/src/components/YamlEditor/index.js +1 -0
  90. package/lib/src/components/YamlEditor/style.js +102 -0
  91. package/lib/src/components/YamlEditor/yaml.worker.js +1 -0
  92. package/lib/src/components/YamlForm/index.d.ts +0 -4
  93. package/lib/src/components/YamlForm/index.js +61 -0
  94. package/lib/src/components/index.d.ts +1 -3
  95. package/lib/src/components/index.js +38 -0
  96. package/lib/src/constants/index.js +2 -0
  97. package/lib/src/constants/k8s.js +203 -0
  98. package/lib/src/constants/state.js +15 -0
  99. package/lib/src/contexts/component.js +3 -0
  100. package/lib/src/contexts/configs.js +3 -0
  101. package/lib/src/contexts/global-store.js +3 -0
  102. package/lib/src/contexts/index.js +3 -0
  103. package/lib/src/hooks/index.js +7 -0
  104. package/lib/src/hooks/useDeleteModal/index.js +1 -0
  105. package/lib/src/hooks/useDeleteModal/useDeleteManyModal.js +31 -0
  106. package/lib/src/hooks/useDeleteModal/useDeleteModal.js +38 -0
  107. package/lib/src/hooks/useDownloadYAML.js +10 -0
  108. package/lib/src/hooks/useEagleForm.d.ts +1 -2
  109. package/lib/src/hooks/useEagleForm.js +177 -0
  110. package/lib/src/hooks/useEagleTable/columns.d.ts +6 -6
  111. package/lib/src/hooks/useEagleTable/columns.js +246 -0
  112. package/lib/src/hooks/useEagleTable/index.js +2 -0
  113. package/lib/src/hooks/useEagleTable/useEagleTable.js +63 -0
  114. package/lib/src/hooks/useEdit.js +19 -0
  115. package/lib/src/hooks/useGlobalStore.js +5 -0
  116. package/lib/src/hooks/useK8sYamlEditor.js +37 -0
  117. package/lib/src/hooks/useOpenForm.js +43 -0
  118. package/lib/src/hooks/useSchema.js +37 -0
  119. package/lib/src/hooks/useSubmitForm.js +42 -0
  120. package/lib/src/i18n.d.ts +26 -2
  121. package/lib/src/i18n.js +19 -0
  122. package/lib/src/index.js +13 -0
  123. package/lib/src/locales/en-US/dovetail.json +18 -0
  124. package/lib/src/locales/en-US/index.d.ts +14 -1
  125. package/lib/src/locales/en-US/index.js +4 -0
  126. package/lib/src/locales/index.js +6 -0
  127. package/lib/src/locales/zh-CN/dovetail.json +91 -0
  128. package/lib/src/locales/zh-CN/index.d.ts +12 -1
  129. package/lib/src/locales/zh-CN/index.js +4 -0
  130. package/lib/src/main.js +12 -0
  131. package/lib/src/models/cronjob-model.d.ts +0 -1
  132. package/lib/src/models/cronjob-model.js +32 -0
  133. package/lib/src/models/daemonset-model.d.ts +0 -1
  134. package/lib/src/models/daemonset-model.js +17 -0
  135. package/lib/src/models/deployment-model.d.ts +0 -1
  136. package/lib/src/models/deployment-model.js +17 -0
  137. package/lib/src/models/event-model.d.ts +0 -1
  138. package/lib/src/models/event-model.js +11 -0
  139. package/lib/src/models/index.js +14 -0
  140. package/lib/src/models/ingress-model.d.ts +0 -1
  141. package/lib/src/models/ingress-model.js +24 -0
  142. package/lib/src/models/job-model.d.ts +0 -1
  143. package/lib/src/models/job-model.js +56 -0
  144. package/lib/src/models/network-policy-model.d.ts +0 -1
  145. package/lib/src/models/network-policy-model.js +10 -0
  146. package/lib/src/models/node-model.d.ts +0 -1
  147. package/lib/src/models/persistent-volume-claim.d.ts +0 -1
  148. package/lib/src/models/persistent-volume.d.ts +0 -1
  149. package/lib/src/models/pod-metrics-model.d.ts +0 -1
  150. package/lib/src/models/pod-metrics-model.js +34 -0
  151. package/lib/src/models/pod-model.d.ts +0 -1
  152. package/lib/src/models/pod-model.js +78 -0
  153. package/lib/src/models/resource-model.d.ts +1 -1
  154. package/lib/src/models/resource-model.js +34 -0
  155. package/lib/src/models/server-instance-model.d.ts +10 -0
  156. package/lib/src/models/service-model.d.ts +0 -1
  157. package/lib/src/models/service-model.js +17 -0
  158. package/lib/src/models/statefulset-model.d.ts +0 -1
  159. package/lib/src/models/statefulset-model.js +17 -0
  160. package/lib/src/models/storage-class.d.ts +0 -1
  161. package/lib/src/models/types/index.js +1 -0
  162. package/lib/src/models/types/metric.js +1 -0
  163. package/lib/src/models/workload-base-model.d.ts +0 -1
  164. package/lib/src/models/workload-base-model.js +22 -0
  165. package/lib/src/models/workload-model.d.ts +0 -1
  166. package/lib/src/models/workload-model.js +51 -0
  167. package/lib/src/pages/configmaps/index.js +15 -0
  168. package/lib/src/pages/cronjobs/create/index.js +6 -0
  169. package/lib/src/pages/cronjobs/index.js +3 -0
  170. package/lib/src/pages/cronjobs/list/index.js +42 -0
  171. package/lib/src/pages/cronjobs/show/index.js +16 -0
  172. package/lib/src/pages/daemonsets/create/index.js +6 -0
  173. package/lib/src/pages/daemonsets/index.js +3 -0
  174. package/lib/src/pages/daemonsets/list/index.js +32 -0
  175. package/lib/src/pages/daemonsets/show/index.js +16 -0
  176. package/lib/src/pages/deployments/create/index.js +7 -0
  177. package/lib/src/pages/deployments/index.js +3 -0
  178. package/lib/src/pages/deployments/list/index.js +26 -0
  179. package/lib/src/pages/deployments/show/index.js +16 -0
  180. package/lib/src/pages/ingresses/index.js +26 -0
  181. package/lib/src/pages/jobs/index.js +34 -0
  182. package/lib/src/pages/networkPolicies/index.js +67 -0
  183. package/lib/src/pages/persistentvolumeclaims/index.d.ts +4 -0
  184. package/lib/src/pages/persistentvolumes/index.d.ts +3 -18
  185. package/lib/src/pages/pods/create/index.js +6 -0
  186. package/lib/src/pages/pods/index.js +3 -0
  187. package/lib/src/pages/pods/list/index.js +81 -0
  188. package/lib/src/pages/pods/show/index.js +54 -0
  189. package/lib/src/pages/secrets/index.js +15 -0
  190. package/lib/src/pages/services/index.js +26 -0
  191. package/lib/src/pages/statefulsets/create/index.js +6 -0
  192. package/lib/src/pages/statefulsets/index.js +3 -0
  193. package/lib/src/pages/statefulsets/list/index.js +26 -0
  194. package/lib/src/pages/statefulsets/show/index.js +16 -0
  195. package/lib/src/plugins/index.js +3 -0
  196. package/lib/src/plugins/model-plugin.js +46 -0
  197. package/lib/src/plugins/relation-plugin.js +81 -0
  198. package/lib/src/plugins/type.js +1 -0
  199. package/lib/src/providers/index.js +1 -0
  200. package/lib/src/providers/router-provider/index.js +100 -0
  201. package/lib/src/types/index.js +1 -0
  202. package/lib/src/types/resource.js +12 -0
  203. package/lib/src/utils/addId.js +8 -0
  204. package/lib/src/utils/download.js +9 -0
  205. package/lib/src/utils/error.js +53 -0
  206. package/lib/src/utils/form.js +9 -0
  207. package/lib/src/utils/k8s.js +6 -0
  208. package/lib/src/utils/labels.js +15 -0
  209. package/lib/src/utils/match-selector.js +12 -0
  210. package/lib/src/utils/openapi.js +33 -0
  211. package/lib/src/utils/schema.js +117 -0
  212. package/lib/src/utils/selector.js +12 -0
  213. package/lib/src/utils/string.js +6 -0
  214. package/lib/src/utils/time.js +46 -0
  215. package/lib/src/utils/unit.js +69 -0
  216. package/lib/src/utils/yaml.js +44 -0
  217. package/lib/vite.config.js +60 -0
  218. package/package.json +1 -10
  219. package/lib/src/components/ModalContextProvider/index.d.ts +0 -12
  220. package/lib/src/components/PodDropdown/index.d.ts +0 -9
  221. package/lib/src/components/PodShellModal/PodShell.d.ts +0 -18
  222. package/lib/src/components/PodShellModal/index.d.ts +0 -10
  223. package/lib/src/components/Shell/index.d.ts +0 -50
  224. package/lib/src/components/Shell/zmodem/index.d.ts +0 -51
  225. package/lib/src/hooks/useModal.d.ts +0 -0
  226. package/lib/src/hooks/useNamespaceFilter.d.ts +0 -5
  227. package/lib/src/model/cronjob-model.d.ts +0 -9
  228. package/lib/src/model/index.d.ts +0 -6
  229. package/lib/src/model/job-model.d.ts +0 -10
  230. package/lib/src/model/pod-metrics-model.d.ts +0 -7
  231. package/lib/src/model/pod-model.d.ts +0 -15
  232. package/lib/src/model/resource-model.d.ts +0 -17
  233. package/lib/src/model/workload-model.d.ts +0 -17
  234. package/lib/src/pages/nodes/hooks/useNodeMetrics.d.ts +0 -17
  235. package/lib/src/pages/storageclasses/list/index.d.ts +0 -3
  236. package/lib/src/pages/storageclasses/show/index.d.ts +0 -3
  237. package/lib/src/types/metric.d.ts +0 -25
  238. package/lib/src/utils/shell.d.ts +0 -16
@@ -0,0 +1,46 @@
1
+ export function getSecondsDiff(startDate, endDate) {
2
+ return Math.round(Math.abs(Date.parse(endDate) - Date.parse(startDate)) / 1000);
3
+ }
4
+ export function elapsedTime(seconds, i18nMap) {
5
+ const { min, sec, hr, day } = i18nMap;
6
+ if (!seconds) {
7
+ return {};
8
+ }
9
+ if (seconds < 120) {
10
+ return {
11
+ diff: 1,
12
+ label: `${seconds} ${sec}`,
13
+ };
14
+ }
15
+ const minutes = Math.floor(seconds / 60);
16
+ if (minutes < 10) {
17
+ return {
18
+ diff: 1,
19
+ label: `${minutes} ${min} ${seconds - minutes * 60} ${sec}`,
20
+ };
21
+ }
22
+ const hours = Math.floor(seconds / 3600);
23
+ if (hours < 3) {
24
+ return {
25
+ diff: 60,
26
+ label: `${minutes} ${min}`,
27
+ };
28
+ }
29
+ const days = Math.floor(seconds / (3600 * 24));
30
+ if (days > 1) {
31
+ return {
32
+ diff: 60,
33
+ label: `${days} ${day} ${hours - days * 24} ${hr}`,
34
+ };
35
+ }
36
+ if (hours > 7) {
37
+ return {
38
+ diff: 60,
39
+ label: `${hours} ${hr}`,
40
+ };
41
+ }
42
+ return {
43
+ diff: 60,
44
+ label: `${hours} ${hr} ${minutes - hours * 60} ${min}`,
45
+ };
46
+ }
@@ -0,0 +1,69 @@
1
+ const UNITS = ['', 'K', 'M', 'G', 'T', 'P'];
2
+ const FRACTIONAL = ['', 'm', 'u', 'n', 'p', 'f']; // milli micro nano pico femto
3
+ export function formatSi(inValue, options) {
4
+ const { increment = 1000, suffix = null, firstSuffix = null, startingExponent = 0, minExponent = 0, maxPrecision = 2, atLeastOne = true, } = options || {};
5
+ let val = inValue;
6
+ let exp = startingExponent;
7
+ while ((val >= increment && exp + 1 < UNITS.length) || exp < minExponent) {
8
+ val = val / increment;
9
+ exp++;
10
+ }
11
+ let out = 0;
12
+ if (val < 10 && maxPrecision >= 2) {
13
+ out = Math.round(val * 100) / 100;
14
+ }
15
+ else if (val < 100 && maxPrecision >= 1) {
16
+ out = Math.round(val * 10) / 10;
17
+ }
18
+ else {
19
+ out = Math.round(val);
20
+ }
21
+ if (atLeastOne && out === 0) {
22
+ out = 1;
23
+ }
24
+ let outStr = String(out);
25
+ if (exp === 0 && firstSuffix !== null) {
26
+ outStr += `${firstSuffix}`;
27
+ }
28
+ else {
29
+ outStr += `${UNITS[exp]}${suffix}` || '';
30
+ }
31
+ return outStr;
32
+ }
33
+ export function parseSi(inValue, increment = null, allowFractional = true) {
34
+ if (!inValue || typeof inValue !== 'string' || !inValue.length) {
35
+ return NaN;
36
+ }
37
+ inValue = inValue.replace(/,/g, '');
38
+ // eslint-disable-next-line prefer-const
39
+ let [, valStr, unit, incStr] = inValue.match(/^([0-9.-]+)\s*([^0-9.-]?)([^0-9.-]?)/) || [];
40
+ const val = parseFloat(valStr);
41
+ if (!unit) {
42
+ return val;
43
+ }
44
+ // micro "mu" symbol -> u
45
+ if (unit.charCodeAt(0) === 181) {
46
+ unit = 'u';
47
+ }
48
+ const divide = FRACTIONAL.includes(unit);
49
+ const multiply = UNITS.includes(unit.toUpperCase());
50
+ if (increment === null) {
51
+ // Automatically handle 1 KB = 1000B, 1 KiB = 1024B if no increment set
52
+ if ((multiply || divide) && incStr === 'i') {
53
+ increment = 1024;
54
+ }
55
+ else {
56
+ increment = 1000;
57
+ }
58
+ }
59
+ if (divide && allowFractional) {
60
+ const exp = FRACTIONAL.indexOf(unit);
61
+ return val / Math.pow(increment, exp);
62
+ }
63
+ if (multiply) {
64
+ const exp = UNITS.indexOf(unit.toUpperCase());
65
+ return val * Math.pow(increment, exp);
66
+ }
67
+ // Unrecognized unit character
68
+ return val;
69
+ }
@@ -0,0 +1,44 @@
1
+ import yaml from 'js-yaml';
2
+ import { isObject } from 'lodash-es';
3
+ import { generateSchemaTypeValue } from './schema';
4
+ export function generateYamlBySchema(defaultValue, schema) {
5
+ const typeObject = generateSchemaTypeValue(schema);
6
+ function makeAnnotations(obj, key) {
7
+ const result = {};
8
+ if (isObject(obj[key])) {
9
+ result[`#${key}`] = {};
10
+ Object.keys(obj[key]).forEach(prop => {
11
+ result[`#${key}`] = {
12
+ ...result[`#${key}`],
13
+ ...makeAnnotations(obj[key], prop),
14
+ };
15
+ });
16
+ }
17
+ else {
18
+ result[`#${key}`] = obj[key];
19
+ }
20
+ return result;
21
+ }
22
+ function merge(obj1, obj2, merged = {}) {
23
+ for (const key in obj1) {
24
+ merged[key] = obj1[key];
25
+ }
26
+ for (const key in obj2) {
27
+ if (key in obj1) {
28
+ if (isObject(obj2[key]) && isObject(obj1[key])) {
29
+ merged[key] = merge(obj1[key], obj2[key]);
30
+ }
31
+ }
32
+ else {
33
+ merged = {
34
+ ...merged,
35
+ ...makeAnnotations(obj2, key),
36
+ };
37
+ }
38
+ }
39
+ return merged;
40
+ }
41
+ const merged = merge(defaultValue, typeObject);
42
+ const content = yaml.dump(merged);
43
+ return content.replace(/(')(#.+?)(')/g, '$2').replace(/( +)(#)/g, '$2$1');
44
+ }
@@ -0,0 +1,60 @@
1
+ import path from 'path';
2
+ import linaria from '@linaria/vite';
3
+ import react from '@vitejs/plugin-react';
4
+ import { defineConfig } from 'vite';
5
+ import commonjs from 'vite-plugin-commonjs';
6
+ // import { getProxyConfig } from './tools/proxy-k8s';
7
+ export default defineConfig({
8
+ plugins: [commonjs(), react(), linaria()],
9
+ server: {
10
+ host: '0.0.0.0',
11
+ proxy: {
12
+ // '/proxy-k8s': getProxyConfig(),
13
+ '/api': {
14
+ target: process.env.API_HOST || 'http://192.168.28.26',
15
+ ws: true,
16
+ headers: {
17
+ 'x-skip-auth-verify': 'true',
18
+ },
19
+ },
20
+ },
21
+ },
22
+ optimizeDeps: {
23
+ exclude: ['monaco-yaml/yaml.worker.js']
24
+ },
25
+ build: {
26
+ minify: false,
27
+ lib: {
28
+ entry: path.resolve(__dirname, 'src/index.ts'),
29
+ name: 'dovetail',
30
+ },
31
+ rollupOptions: {
32
+ external: [
33
+ '@cloudtower/eagle',
34
+ '@cloudtower/icons-react',
35
+ '@refinedev/core',
36
+ '@refinedev/inferencer',
37
+ 'antd',
38
+ 'i18next',
39
+ 'ky',
40
+ 'lodash-es',
41
+ 'mitt',
42
+ 'qs',
43
+ 'react',
44
+ 'react-dom',
45
+ 'react-router-dom',
46
+ 'sunflower-antd',
47
+ 'monaco-editor',
48
+ 'monaco-yaml',
49
+ 'js-yaml',
50
+ 'k8s-api-provider',
51
+ ],
52
+ },
53
+ },
54
+ resolve: {
55
+ preserveSymlinks: true,
56
+ alias: {
57
+ src: path.resolve(__dirname, 'src'),
58
+ },
59
+ },
60
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dovetail-v2/refine",
3
- "version": "0.0.66-pod-exec.0",
3
+ "version": "0.1.0",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist",
@@ -17,16 +17,7 @@
17
17
  "@refinedev/core": "^4.47.2",
18
18
  "@refinedev/inferencer": "^4.5.20",
19
19
  "@refinedev/react-hook-form": "^4.8.14",
20
- "@xterm/addon-attach": "^0.11.0",
21
- "@xterm/addon-canvas": "^0.7.0",
22
- "@xterm/addon-fit": "^0.10.0",
23
- "@xterm/addon-search": "^0.15.0",
24
- "@xterm/addon-web-links": "^0.11.0",
25
- "@xterm/addon-webgl": "^0.18.0",
26
- "@xterm/xterm": "^5.5.0",
27
20
  "antd": "4.5.0",
28
- "buffer": "^6.0.3",
29
- "copy-to-clipboard": "^3.3.3",
30
21
  "dayjs": "^1.11.10",
31
22
  "i18next": "^23.2.3",
32
23
  "js-yaml": "^4.1.0",
@@ -1,12 +0,0 @@
1
- import React from 'react';
2
- interface ModalInfo {
3
- resource: string;
4
- id?: string;
5
- }
6
- type ModalContextValue = ModalInfo & {
7
- open: (info: ModalInfo) => void;
8
- close: () => void;
9
- };
10
- export declare const ModalContext: React.Context<ModalContextValue>;
11
- declare function ModalContextProvider(props: React.PropsWithChildren<Record<string, unknown>>): JSX.Element;
12
- export default ModalContextProvider;
@@ -1,9 +0,0 @@
1
- import React from 'react';
2
- import { PodModel } from '../../models';
3
- import { DropdownSize } from '../K8sDropdown';
4
- type Props<Model extends PodModel> = {
5
- record: Model;
6
- size?: DropdownSize;
7
- };
8
- export declare function PodDropdown<Model extends PodModel>(props: React.PropsWithChildren<Props<Model>>): JSX.Element;
9
- export {};
@@ -1,18 +0,0 @@
1
- import React from 'react';
2
- import { SocketStatus } from 'src/components/Shell';
3
- import '@xterm/xterm/css/xterm.css';
4
- import { PodModel } from 'src/models/pod-model';
5
- export declare enum OS {
6
- Linux = "linux",
7
- Windows = "windows"
8
- }
9
- interface PodShellProps {
10
- pod: PodModel;
11
- basePath: string;
12
- onSocketStatusChange?: (socketStatus: SocketStatus) => void;
13
- }
14
- interface PodShellHandler {
15
- getAllTerminalContents: () => string[];
16
- }
17
- export declare const PodShell: React.ForwardRefExoticComponent<PodShellProps & React.RefAttributes<PodShellHandler>>;
18
- export {};
@@ -1,10 +0,0 @@
1
- /// <reference types="react" />
2
- import { SocketStatus } from 'src/components/Shell';
3
- import { PodModel } from 'src/models';
4
- import { PodShell } from './PodShell';
5
- interface PodShellModalProps {
6
- pod: PodModel;
7
- onSocketStatusChange?: (socketStatus: SocketStatus) => void;
8
- }
9
- export declare function PodShellModal(props: PodShellModalProps): JSX.Element;
10
- export { PodShell };
@@ -1,50 +0,0 @@
1
- import { Terminal } from '@xterm/xterm';
2
- import React from 'react';
3
- import '@xterm/xterm/css/xterm.css';
4
- export declare enum SocketStatus {
5
- Opening = "Opening",
6
- Open = "Open",
7
- Disconnected = "Disconnected"
8
- }
9
- export type ShellProps = React.PropsWithChildren<{
10
- url: string;
11
- protocols?: string;
12
- encode: (input: string) => string | ArrayBufferLike | Blob | ArrayBufferView;
13
- decode?: (output: string | ArrayBufferLike | Blob | ArrayBufferView) => string | ArrayBuffer;
14
- fit?: (layout: {
15
- rows: number;
16
- cols: number;
17
- }) => void;
18
- onSocketInit?: (socket: WebSocket) => void;
19
- onTermInit?: (term: Terminal) => void;
20
- onSocketMessage?: (e: MessageEvent, socket: WebSocket, term: Terminal | null) => void;
21
- onSocketOpen?: (socket: WebSocket) => void;
22
- onSocketClose?: (socket: WebSocket, term: Terminal | null) => void;
23
- onSocketStatusChange?: (socketStatus: SocketStatus) => void;
24
- }>;
25
- export interface ShellHandler {
26
- clear: () => void;
27
- send: (data: string | ArrayBufferLike | Blob | ArrayBufferView) => void;
28
- getAllTerminalContents: () => string[];
29
- setSocketStatus: React.Dispatch<React.SetStateAction<SocketStatus>>;
30
- searchNext: (search: string) => void;
31
- searchPrevious: (search: string) => void;
32
- }
33
- export declare const Shell: React.ForwardRefExoticComponent<{
34
- url: string;
35
- protocols?: string | undefined;
36
- encode: (input: string) => string | ArrayBufferLike | Blob | ArrayBufferView;
37
- decode?: ((output: string | ArrayBufferLike | Blob | ArrayBufferView) => string | ArrayBuffer) | undefined;
38
- fit?: ((layout: {
39
- rows: number;
40
- cols: number;
41
- }) => void) | undefined;
42
- onSocketInit?: ((socket: WebSocket) => void) | undefined;
43
- onTermInit?: ((term: Terminal) => void) | undefined;
44
- onSocketMessage?: ((e: MessageEvent, socket: WebSocket, term: Terminal | null) => void) | undefined;
45
- onSocketOpen?: ((socket: WebSocket) => void) | undefined;
46
- onSocketClose?: ((socket: WebSocket, term: Terminal | null) => void) | undefined;
47
- onSocketStatusChange?: ((socketStatus: SocketStatus) => void) | undefined;
48
- } & {
49
- children?: React.ReactNode;
50
- } & React.RefAttributes<ShellHandler>>;
@@ -1,51 +0,0 @@
1
- import { ITerminalAddon, Terminal } from '@xterm/xterm';
2
- import { Component } from 'react';
3
- export interface FlowControl {
4
- limit: number;
5
- highWater: number;
6
- lowWater: number;
7
- pause: () => void;
8
- resume: () => void;
9
- }
10
- interface Props {
11
- sender: (data: ArrayLike<number>) => void;
12
- control: FlowControl;
13
- modalDownload: boolean;
14
- modalUpload: boolean;
15
- change: (v: string) => void;
16
- hideDownload: (v: boolean) => void;
17
- hideUpload: (v: boolean) => void;
18
- }
19
- interface State {
20
- value: string;
21
- }
22
- export declare class ZmodemAddon extends Component<Props, State> implements ITerminalAddon {
23
- private terminal;
24
- private keyDispose;
25
- private sentry;
26
- private session;
27
- private written;
28
- private pending;
29
- constructor(props: Props);
30
- render(): JSX.Element;
31
- state: {
32
- value: string;
33
- };
34
- onInput: (ev: any) => void;
35
- onSubmit: (ev: any) => void;
36
- componentWillUnmount(): Promise<void>;
37
- activate(terminal: Terminal): void;
38
- dispose(): void;
39
- consume(data: ArrayBuffer): void;
40
- private handleError;
41
- private zmodemInit;
42
- private zmodemReset;
43
- private zmodemWrite;
44
- private zmodemSend;
45
- private zmodemDetect;
46
- private sendFile;
47
- private receiveFile;
48
- private writeProgress;
49
- private bytesHuman;
50
- }
51
- export {};
File without changes
@@ -1,5 +0,0 @@
1
- import { CrudFilters } from '@refinedev/core';
2
- declare function useNamespaceRefineFilter(): {
3
- permanent: CrudFilters;
4
- };
5
- export default useNamespaceRefineFilter;
@@ -1,9 +0,0 @@
1
- import { CronJob } from 'kubernetes-types/batch/v1';
2
- import { WithId } from '../types';
3
- import { WorkloadModel } from './workload-model';
4
- export declare class CronJobModel extends WorkloadModel<CronJob> {
5
- data: WithId<CronJob>;
6
- constructor(data: WithId<CronJob>);
7
- suspend(): WithId<CronJob>;
8
- resume(): WithId<CronJob>;
9
- }
@@ -1,6 +0,0 @@
1
- export * from './job-model';
2
- export * from './pod-model';
3
- export * from './pod-metrics-model';
4
- export * from './resource-model';
5
- export * from './workload-model';
6
- export * from './cronjob-model';
@@ -1,10 +0,0 @@
1
- import { Job } from 'kubernetes-types/batch/v1';
2
- import { WithId } from '../types';
3
- import { WorkloadModel } from './workload-model';
4
- export declare class JobModel extends WorkloadModel<Job> {
5
- rawYaml: WithId<Job>;
6
- constructor(rawYaml: WithId<Job>);
7
- get duration(): number;
8
- get durationDisplay(): string | undefined;
9
- get completionsDisplay(): string;
10
- }
@@ -1,7 +0,0 @@
1
- import { PodMetrics, ResourceQuantity } from 'src/types/metric';
2
- import { ResourceModel } from './resource-model';
3
- export declare class PodMetricsModel extends ResourceModel {
4
- data: PodMetrics;
5
- usage: ResourceQuantity;
6
- constructor(data: PodMetrics);
7
- }
@@ -1,15 +0,0 @@
1
- import type { Pod } from 'kubernetes-types/core/v1';
2
- import { ResourceQuantity } from 'src/types/metric';
3
- import { WithId } from '../types';
4
- import { WorkloadModel } from './workload-model';
5
- export declare class PodModel extends WorkloadModel<Pod> {
6
- rawYaml: WithId<Pod>;
7
- request: ResourceQuantity;
8
- limit: ResourceQuantity;
9
- constructor(rawYaml: WithId<Pod>);
10
- get imageNames(): string[];
11
- get restartCount(): number;
12
- get readyDisplay(): string;
13
- get readyContainerCount(): number | undefined;
14
- get containerCount(): number | undefined;
15
- }
@@ -1,17 +0,0 @@
1
- import { Resource } from '../types';
2
- export declare class ResourceModel implements Resource {
3
- rawYaml: Resource;
4
- id: Resource['id'];
5
- apiVersion: Resource['apiVersion'];
6
- kind: Resource['kind'];
7
- metadata: Resource['metadata'];
8
- constructor(rawYaml: Resource);
9
- get name(): string | undefined;
10
- get namespace(): string | undefined;
11
- get labels(): {
12
- [name: string]: string;
13
- } | undefined;
14
- get annotations(): {
15
- [name: string]: string;
16
- } | undefined;
17
- }
@@ -1,17 +0,0 @@
1
- import type { DaemonSet, Deployment, StatefulSet } from 'kubernetes-types/apps/v1';
2
- import type { CronJob, Job } from 'kubernetes-types/batch/v1';
3
- import { Pod } from 'kubernetes-types/core/v1';
4
- import { WithId } from '../types';
5
- import { ResourceModel } from './resource-model';
6
- type WorkloadTypes = Deployment | StatefulSet | Job | DaemonSet | CronJob | Pod;
7
- export declare class WorkloadModel<T extends WorkloadTypes = WorkloadTypes> extends ResourceModel {
8
- rawYaml: WithId<T>;
9
- constructor(rawYaml: WithId<T>);
10
- get status(): T['status'];
11
- get spec(): T['spec'];
12
- get imageNames(): string[];
13
- get restartCount(): number;
14
- redeploy(): WithId<T>;
15
- scale(value: number): WithId<T>;
16
- }
17
- export {};
@@ -1,17 +0,0 @@
1
- type MetricMap = Record<string, string>;
2
- type NodeMetrics = {
3
- cpuUsed: MetricMap | null;
4
- cpuUsage: MetricMap | null;
5
- };
6
- export interface PrometheusResponse {
7
- data: {
8
- result: {
9
- metric: Record<string, string>;
10
- value: [number, string];
11
- }[];
12
- };
13
- }
14
- export declare function transformMetricResult(response: PrometheusResponse, metricName?: string): Record<string, string>;
15
- export declare function getMonitorDatas(queries: string[], modelName?: string): Promise<Record<string, string>[]>;
16
- export declare function useNodeMetrics(): NodeMetrics;
17
- export {};
@@ -1,3 +0,0 @@
1
- import { IResourceComponentsProps } from '@refinedev/core';
2
- import React from 'react';
3
- export declare const StorageClassList: React.FC<IResourceComponentsProps>;
@@ -1,3 +0,0 @@
1
- import { IResourceComponentsProps } from '@refinedev/core';
2
- import React from 'react';
3
- export declare const StorageClassShow: React.FC<IResourceComponentsProps>;
@@ -1,25 +0,0 @@
1
- import { Resource } from './resource';
2
- type Quantity = string;
3
- export type ContainerMetrics = {
4
- name: string;
5
- usage: {
6
- cpu?: Quantity;
7
- memory?: Quantity;
8
- };
9
- };
10
- export type PodMetrics = {
11
- timestamp: string;
12
- window: string;
13
- containers: ContainerMetrics[];
14
- } & Resource;
15
- export type ResourceQuantity = {
16
- cpu: {
17
- si: string;
18
- value: number;
19
- };
20
- memory: {
21
- si: string;
22
- value: number;
23
- };
24
- };
25
- export {};
@@ -1,16 +0,0 @@
1
- /// <reference types="node" />
2
- import { Buffer } from 'buffer';
3
- export type QueryParams = {
4
- [key: string]: string | string[];
5
- };
6
- export declare const stdin: (characters: string) => Buffer;
7
- export declare function addParam(url: string, key: string, val: string | string[]): string;
8
- export declare function addParams(url: string, params: QueryParams): string;
9
- declare enum Alphabet {
10
- NORMAL = "normal",
11
- URL = "url"
12
- }
13
- export declare function base64Encode(str: string, alphabet?: Alphabet): string;
14
- export declare function base64DecodeToBuffer(str: string): Buffer;
15
- export declare function base64Decode(str: string): string;
16
- export {};