@orsetra/shared-ui 1.1.38 → 1.1.40
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.
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Extended UI Components for Dynamic Forms
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
// CamelRouteCode removed - causes SSR issues with Monaco Editor
|
|
3
|
+
// Use local implementation in project-manager instead
|
|
4
4
|
export { default as CPUNumber } from './CPUNumber'
|
|
5
5
|
export { default as ClassStorageSelect } from './ClassStorageSelect'
|
|
6
6
|
export { default as ClusterSelect } from './ClusterSelect'
|
|
@@ -18,66 +18,77 @@ export function StringsInput({
|
|
|
18
18
|
disabled = false,
|
|
19
19
|
placeholder = "Enter value",
|
|
20
20
|
}: StringsInputProps) {
|
|
21
|
-
const [items, setItems] = useState<string[]>(value.
|
|
21
|
+
const [items, setItems] = useState<string[]>(value.filter(v => v !== ""))
|
|
22
|
+
const [inputValue, setInputValue] = useState("")
|
|
22
23
|
|
|
23
24
|
useEffect(() => {
|
|
24
|
-
|
|
25
|
-
|
|
25
|
+
const filtered = value.filter(v => v !== "")
|
|
26
|
+
if (JSON.stringify(filtered) !== JSON.stringify(items)) {
|
|
27
|
+
setItems(filtered)
|
|
26
28
|
}
|
|
27
29
|
}, [value])
|
|
28
30
|
|
|
29
|
-
const
|
|
30
|
-
const newItems =
|
|
31
|
-
newItems[index] = newValue
|
|
31
|
+
const handleRemove = (index: number) => {
|
|
32
|
+
const newItems = items.filter((_, i) => i !== index)
|
|
32
33
|
setItems(newItems)
|
|
33
|
-
onChange?.(newItems
|
|
34
|
+
onChange?.(newItems)
|
|
34
35
|
}
|
|
35
36
|
|
|
36
37
|
const handleAdd = () => {
|
|
37
|
-
const
|
|
38
|
+
const trimmed = inputValue.trim()
|
|
39
|
+
if (!trimmed) return
|
|
40
|
+
const newItems = [...items, trimmed]
|
|
38
41
|
setItems(newItems)
|
|
42
|
+
onChange?.(newItems)
|
|
43
|
+
setInputValue("")
|
|
39
44
|
}
|
|
40
45
|
|
|
41
|
-
const
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
46
|
+
const handleKeyDown = (e: React.KeyboardEvent<HTMLInputElement>) => {
|
|
47
|
+
if (e.key === "Enter") {
|
|
48
|
+
e.preventDefault()
|
|
49
|
+
handleAdd()
|
|
50
|
+
}
|
|
45
51
|
}
|
|
46
52
|
|
|
47
53
|
return (
|
|
48
54
|
<div className="space-y-2">
|
|
49
55
|
{items.map((item, index) => (
|
|
50
|
-
<div key={index} className="flex gap-2">
|
|
51
|
-
<
|
|
52
|
-
|
|
53
|
-
|
|
56
|
+
<div key={index} className="flex items-center gap-2">
|
|
57
|
+
<span className="flex-1 text-sm px-3 py-2 border border-ibm-gray-20 bg-ibm-gray-10 text-ibm-gray-100 truncate">
|
|
58
|
+
{item}
|
|
59
|
+
</span>
|
|
60
|
+
<Button
|
|
61
|
+
type="button"
|
|
62
|
+
variant="secondary"
|
|
63
|
+
onClick={() => handleRemove(index)}
|
|
54
64
|
disabled={disabled}
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
<Button
|
|
60
|
-
type="button"
|
|
61
|
-
variant="secondary"
|
|
62
|
-
onClick={() => handleRemove(index)}
|
|
63
|
-
disabled={disabled}
|
|
64
|
-
className="rounded-none h-9 w-9 p-0"
|
|
65
|
-
>
|
|
66
|
-
<X className="h-4 w-4" />
|
|
67
|
-
</Button>
|
|
68
|
-
)}
|
|
65
|
+
className="rounded-none h-9 w-9 p-0 shrink-0"
|
|
66
|
+
>
|
|
67
|
+
<X className="h-4 w-4" />
|
|
68
|
+
</Button>
|
|
69
69
|
</div>
|
|
70
70
|
))}
|
|
71
|
-
<
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
71
|
+
<div className="flex gap-2">
|
|
72
|
+
<Input
|
|
73
|
+
value={inputValue}
|
|
74
|
+
onChange={(e) => setInputValue(e.target.value)}
|
|
75
|
+
onKeyDown={handleKeyDown}
|
|
76
|
+
disabled={disabled}
|
|
77
|
+
placeholder={placeholder}
|
|
78
|
+
className="rounded-none flex-1"
|
|
79
|
+
/>
|
|
80
|
+
<Button
|
|
81
|
+
type="button"
|
|
82
|
+
variant="secondary"
|
|
83
|
+
leftIcon={<Plus className="h-4 w-4 mr-1" />}
|
|
84
|
+
onClick={handleAdd}
|
|
85
|
+
disabled={disabled || !inputValue.trim()}
|
|
86
|
+
className="rounded-none shrink-0"
|
|
87
|
+
>
|
|
88
|
+
|
|
89
|
+
Add
|
|
90
|
+
</Button>
|
|
91
|
+
</div>
|
|
81
92
|
</div>
|
|
82
93
|
)
|
|
83
94
|
}
|
package/package.json
CHANGED
|
@@ -1,271 +0,0 @@
|
|
|
1
|
-
export default {
|
|
2
|
-
base: 'vs-dark',
|
|
3
|
-
inherit: true,
|
|
4
|
-
rules: [
|
|
5
|
-
{
|
|
6
|
-
background: '1B191A',
|
|
7
|
-
token: '',
|
|
8
|
-
},
|
|
9
|
-
{
|
|
10
|
-
foreground: '555555',
|
|
11
|
-
token: 'comment',
|
|
12
|
-
},
|
|
13
|
-
{
|
|
14
|
-
foreground: '555555',
|
|
15
|
-
token: 'comment.block',
|
|
16
|
-
},
|
|
17
|
-
{
|
|
18
|
-
foreground: 'ad9361',
|
|
19
|
-
token: 'string',
|
|
20
|
-
},
|
|
21
|
-
{
|
|
22
|
-
foreground: 'cccccc',
|
|
23
|
-
token: 'constant.numeric',
|
|
24
|
-
},
|
|
25
|
-
{
|
|
26
|
-
foreground: 'a1a1ff',
|
|
27
|
-
token: 'keyword',
|
|
28
|
-
},
|
|
29
|
-
{
|
|
30
|
-
foreground: '2f006e',
|
|
31
|
-
token: 'meta.preprocessor',
|
|
32
|
-
},
|
|
33
|
-
{
|
|
34
|
-
fontStyle: 'bold',
|
|
35
|
-
token: 'keyword.control.import',
|
|
36
|
-
},
|
|
37
|
-
{
|
|
38
|
-
foreground: 'a1a1ff',
|
|
39
|
-
token: 'support.function',
|
|
40
|
-
},
|
|
41
|
-
{
|
|
42
|
-
foreground: '0000ff',
|
|
43
|
-
token: 'declaration.function function-result',
|
|
44
|
-
},
|
|
45
|
-
{
|
|
46
|
-
fontStyle: 'bold',
|
|
47
|
-
token: 'declaration.function function-name',
|
|
48
|
-
},
|
|
49
|
-
{
|
|
50
|
-
fontStyle: 'bold',
|
|
51
|
-
token: 'declaration.function argument-name',
|
|
52
|
-
},
|
|
53
|
-
{
|
|
54
|
-
foreground: '0000ff',
|
|
55
|
-
token: 'declaration.function function-arg-type',
|
|
56
|
-
},
|
|
57
|
-
{
|
|
58
|
-
fontStyle: 'italic',
|
|
59
|
-
token: 'declaration.function function-argument',
|
|
60
|
-
},
|
|
61
|
-
{
|
|
62
|
-
fontStyle: 'underline',
|
|
63
|
-
token: 'declaration.class class-name',
|
|
64
|
-
},
|
|
65
|
-
{
|
|
66
|
-
fontStyle: 'italic underline',
|
|
67
|
-
token: 'declaration.class class-inheritance',
|
|
68
|
-
},
|
|
69
|
-
{
|
|
70
|
-
foreground: 'fff9f9',
|
|
71
|
-
background: 'ff0000',
|
|
72
|
-
fontStyle: 'bold',
|
|
73
|
-
token: 'invalid',
|
|
74
|
-
},
|
|
75
|
-
{
|
|
76
|
-
background: 'ffd0d0',
|
|
77
|
-
token: 'invalid.deprecated.trailing-whitespace',
|
|
78
|
-
},
|
|
79
|
-
{
|
|
80
|
-
fontStyle: 'italic',
|
|
81
|
-
token: 'declaration.section section-name',
|
|
82
|
-
},
|
|
83
|
-
{
|
|
84
|
-
foreground: 'c10006',
|
|
85
|
-
token: 'string.interpolation',
|
|
86
|
-
},
|
|
87
|
-
{
|
|
88
|
-
foreground: '666666',
|
|
89
|
-
token: 'string.regexp',
|
|
90
|
-
},
|
|
91
|
-
{
|
|
92
|
-
foreground: 'c1c144',
|
|
93
|
-
token: 'variable',
|
|
94
|
-
},
|
|
95
|
-
{
|
|
96
|
-
foreground: '6782d3',
|
|
97
|
-
token: 'constant',
|
|
98
|
-
},
|
|
99
|
-
{
|
|
100
|
-
foreground: 'afa472',
|
|
101
|
-
token: 'constant.character',
|
|
102
|
-
},
|
|
103
|
-
{
|
|
104
|
-
foreground: 'de8e30',
|
|
105
|
-
fontStyle: 'bold',
|
|
106
|
-
token: 'constant.language',
|
|
107
|
-
},
|
|
108
|
-
{
|
|
109
|
-
fontStyle: 'underline',
|
|
110
|
-
token: 'embedded',
|
|
111
|
-
},
|
|
112
|
-
{
|
|
113
|
-
foreground: '858ef4',
|
|
114
|
-
token: 'keyword.markup.element-name',
|
|
115
|
-
},
|
|
116
|
-
{
|
|
117
|
-
foreground: '9b456f',
|
|
118
|
-
token: 'keyword.markup.attribute-name',
|
|
119
|
-
},
|
|
120
|
-
{
|
|
121
|
-
foreground: '9b456f',
|
|
122
|
-
token: 'meta.attribute-with-value',
|
|
123
|
-
},
|
|
124
|
-
{
|
|
125
|
-
foreground: 'c82255',
|
|
126
|
-
fontStyle: 'bold',
|
|
127
|
-
token: 'keyword.exception',
|
|
128
|
-
},
|
|
129
|
-
{
|
|
130
|
-
foreground: '47b8d6',
|
|
131
|
-
token: 'keyword.operator',
|
|
132
|
-
},
|
|
133
|
-
{
|
|
134
|
-
foreground: '6969fa',
|
|
135
|
-
fontStyle: 'bold',
|
|
136
|
-
token: 'keyword.control',
|
|
137
|
-
},
|
|
138
|
-
{
|
|
139
|
-
foreground: '68685b',
|
|
140
|
-
token: 'meta.tag.preprocessor.xml',
|
|
141
|
-
},
|
|
142
|
-
{
|
|
143
|
-
foreground: '888888',
|
|
144
|
-
token: 'meta.tag.sgml.doctype',
|
|
145
|
-
},
|
|
146
|
-
{
|
|
147
|
-
fontStyle: 'italic',
|
|
148
|
-
token: 'string.quoted.docinfo.doctype.DTD',
|
|
149
|
-
},
|
|
150
|
-
{
|
|
151
|
-
foreground: '909090',
|
|
152
|
-
token: 'comment.other.server-side-include.xhtml',
|
|
153
|
-
},
|
|
154
|
-
{
|
|
155
|
-
foreground: '909090',
|
|
156
|
-
token: 'comment.other.server-side-include.html',
|
|
157
|
-
},
|
|
158
|
-
{
|
|
159
|
-
foreground: '858ef4',
|
|
160
|
-
token: 'text.html declaration.tag',
|
|
161
|
-
},
|
|
162
|
-
{
|
|
163
|
-
foreground: '858ef4',
|
|
164
|
-
token: 'text.html meta.tag',
|
|
165
|
-
},
|
|
166
|
-
{
|
|
167
|
-
foreground: '858ef4',
|
|
168
|
-
token: 'text.html entity.name.tag.xhtml',
|
|
169
|
-
},
|
|
170
|
-
{
|
|
171
|
-
foreground: '9b456f',
|
|
172
|
-
token: 'keyword.markup.attribute-name',
|
|
173
|
-
},
|
|
174
|
-
{
|
|
175
|
-
foreground: '777777',
|
|
176
|
-
token: 'keyword.other.phpdoc.php',
|
|
177
|
-
},
|
|
178
|
-
{
|
|
179
|
-
foreground: 'c82255',
|
|
180
|
-
token: 'keyword.other.include.php',
|
|
181
|
-
},
|
|
182
|
-
{
|
|
183
|
-
foreground: 'de8e20',
|
|
184
|
-
fontStyle: 'bold',
|
|
185
|
-
token: 'support.constant.core.php',
|
|
186
|
-
},
|
|
187
|
-
{
|
|
188
|
-
foreground: 'de8e10',
|
|
189
|
-
fontStyle: 'bold',
|
|
190
|
-
token: 'support.constant.std.php',
|
|
191
|
-
},
|
|
192
|
-
{
|
|
193
|
-
foreground: 'b72e1d',
|
|
194
|
-
token: 'variable.other.global.php',
|
|
195
|
-
},
|
|
196
|
-
{
|
|
197
|
-
foreground: '00ff00',
|
|
198
|
-
token: 'variable.other.global.safer.php',
|
|
199
|
-
},
|
|
200
|
-
{
|
|
201
|
-
foreground: 'bfa36d',
|
|
202
|
-
token: 'string.quoted.single.php',
|
|
203
|
-
},
|
|
204
|
-
{
|
|
205
|
-
foreground: '6969fa',
|
|
206
|
-
token: 'keyword.storage.php',
|
|
207
|
-
},
|
|
208
|
-
{
|
|
209
|
-
foreground: 'ad9361',
|
|
210
|
-
token: 'string.quoted.double.php',
|
|
211
|
-
},
|
|
212
|
-
{
|
|
213
|
-
foreground: 'ec9e00',
|
|
214
|
-
token: 'entity.other.attribute-name.id.css',
|
|
215
|
-
},
|
|
216
|
-
{
|
|
217
|
-
foreground: 'b8cd06',
|
|
218
|
-
fontStyle: 'bold',
|
|
219
|
-
token: 'entity.name.tag.css',
|
|
220
|
-
},
|
|
221
|
-
{
|
|
222
|
-
foreground: 'edca06',
|
|
223
|
-
token: 'entity.other.attribute-name.class.css',
|
|
224
|
-
},
|
|
225
|
-
{
|
|
226
|
-
foreground: '2e759c',
|
|
227
|
-
token: 'entity.other.attribute-name.pseudo-class.css',
|
|
228
|
-
},
|
|
229
|
-
{
|
|
230
|
-
foreground: 'ffffff',
|
|
231
|
-
background: 'ff0000',
|
|
232
|
-
token: 'invalid.bad-comma.css',
|
|
233
|
-
},
|
|
234
|
-
{
|
|
235
|
-
foreground: '9b2e4d',
|
|
236
|
-
token: 'support.constant.property-value.css',
|
|
237
|
-
},
|
|
238
|
-
{
|
|
239
|
-
foreground: 'e1c96b',
|
|
240
|
-
token: 'support.type.property-name.css',
|
|
241
|
-
},
|
|
242
|
-
{
|
|
243
|
-
foreground: '666633',
|
|
244
|
-
token: 'constant.other.rgb-value.css',
|
|
245
|
-
},
|
|
246
|
-
{
|
|
247
|
-
foreground: '666633',
|
|
248
|
-
token: 'support.constant.font-name.css',
|
|
249
|
-
},
|
|
250
|
-
{
|
|
251
|
-
foreground: '7171f3',
|
|
252
|
-
token: 'support.constant.tm-language-def',
|
|
253
|
-
},
|
|
254
|
-
{
|
|
255
|
-
foreground: '7171f3',
|
|
256
|
-
token: 'support.constant.name.tm-language-def',
|
|
257
|
-
},
|
|
258
|
-
{
|
|
259
|
-
foreground: '6969fa',
|
|
260
|
-
token: 'keyword.other.unit.css',
|
|
261
|
-
},
|
|
262
|
-
],
|
|
263
|
-
colors: {
|
|
264
|
-
'editor.foreground': '#DADADA',
|
|
265
|
-
'editor.background': '#1B191A',
|
|
266
|
-
'editor.selectionBackground': '#73597E80',
|
|
267
|
-
'editor.lineHighlightBackground': '#353030',
|
|
268
|
-
'editorCursor.foreground': '#FFFFFF',
|
|
269
|
-
'editorWhitespace.foreground': '#4F4D4D',
|
|
270
|
-
},
|
|
271
|
-
};
|
|
@@ -1,156 +0,0 @@
|
|
|
1
|
-
import { Upload, Button, Message, Field } from '@alifd/next';
|
|
2
|
-
import * as yaml from 'js-yaml';
|
|
3
|
-
import React from 'react';
|
|
4
|
-
import { AiOutlineCloudUpload } from 'react-icons/ai';
|
|
5
|
-
import { v4 as uuid } from 'uuid';
|
|
6
|
-
|
|
7
|
-
import DefinitionCode from '../../components/DefinitionCode';
|
|
8
|
-
import { If } from '../../components/If';
|
|
9
|
-
import { Translation } from '../../components/Translation';
|
|
10
|
-
|
|
11
|
-
import type { KubernetesObject } from './objects';
|
|
12
|
-
|
|
13
|
-
type Props = {
|
|
14
|
-
value?: any;
|
|
15
|
-
id: string;
|
|
16
|
-
onChange: (value: any) => void;
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
type State = {
|
|
20
|
-
message: string;
|
|
21
|
-
containerId: string;
|
|
22
|
-
showButton: boolean;
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
class K8sObjectsCode extends React.Component<Props, State> {
|
|
26
|
-
form: Field;
|
|
27
|
-
constructor(props: Props) {
|
|
28
|
-
super(props);
|
|
29
|
-
this.state = {
|
|
30
|
-
message: '',
|
|
31
|
-
containerId: uuid(),
|
|
32
|
-
showButton: false,
|
|
33
|
-
};
|
|
34
|
-
this.form = new Field(this, {
|
|
35
|
-
onChange: () => {
|
|
36
|
-
const values: { code: string } = this.form.getValues();
|
|
37
|
-
this.onChange(values.code);
|
|
38
|
-
},
|
|
39
|
-
});
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
componentDidMount = () => {
|
|
43
|
-
const { value } = this.props;
|
|
44
|
-
this.setValues(value);
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
setValues = (value: KubernetesObject[]) => {
|
|
48
|
-
if (value) {
|
|
49
|
-
try {
|
|
50
|
-
let code = '---\n';
|
|
51
|
-
if (value instanceof Array) {
|
|
52
|
-
value.map((res) => {
|
|
53
|
-
if (res) {
|
|
54
|
-
code = code + yaml.dump(res) + '---\n';
|
|
55
|
-
}
|
|
56
|
-
});
|
|
57
|
-
} else {
|
|
58
|
-
code = yaml.dump(value) + '---\n';
|
|
59
|
-
}
|
|
60
|
-
this.form.setValues({ code: code });
|
|
61
|
-
} catch {}
|
|
62
|
-
}
|
|
63
|
-
};
|
|
64
|
-
|
|
65
|
-
onChange = (v: string) => {
|
|
66
|
-
const { onChange, value } = this.props;
|
|
67
|
-
if (onChange) {
|
|
68
|
-
try {
|
|
69
|
-
let object: any = yaml.load(v);
|
|
70
|
-
if (!(object instanceof Array)) {
|
|
71
|
-
object = [object];
|
|
72
|
-
}
|
|
73
|
-
object = object.filter((ob: any) => ob != null);
|
|
74
|
-
if (yaml.dump(value) != v) {
|
|
75
|
-
onChange(object);
|
|
76
|
-
}
|
|
77
|
-
this.setState({ message: '' });
|
|
78
|
-
} catch (error: any) {
|
|
79
|
-
if ((error.message = 'expected a single document in the stream, but found more')) {
|
|
80
|
-
try {
|
|
81
|
-
let objects = yaml.loadAll(v);
|
|
82
|
-
if (yaml.dump(value) != v) {
|
|
83
|
-
objects = objects.filter((ob: any) => ob != null);
|
|
84
|
-
onChange(objects);
|
|
85
|
-
}
|
|
86
|
-
this.setState({
|
|
87
|
-
message: '',
|
|
88
|
-
});
|
|
89
|
-
} catch (err: any) {
|
|
90
|
-
this.setState({ message: err.message });
|
|
91
|
-
}
|
|
92
|
-
} else {
|
|
93
|
-
this.setState({ message: error.message });
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
};
|
|
98
|
-
|
|
99
|
-
customRequest = (option: any) => {
|
|
100
|
-
const reader = new FileReader();
|
|
101
|
-
const fileselect = option.file;
|
|
102
|
-
reader.readAsText(fileselect);
|
|
103
|
-
reader.onload = () => {
|
|
104
|
-
this.form.setValue('code', reader.result?.toString() || '');
|
|
105
|
-
};
|
|
106
|
-
return {
|
|
107
|
-
file: File,
|
|
108
|
-
abort() {},
|
|
109
|
-
};
|
|
110
|
-
};
|
|
111
|
-
|
|
112
|
-
onConvert2WebService = () => {};
|
|
113
|
-
|
|
114
|
-
render() {
|
|
115
|
-
const { id } = this.props;
|
|
116
|
-
const { init } = this.form;
|
|
117
|
-
const { message, containerId, showButton } = this.state;
|
|
118
|
-
return (
|
|
119
|
-
<div id={id}>
|
|
120
|
-
<If condition={message}>
|
|
121
|
-
<span style={{ color: 'red' }}>{message}</span>
|
|
122
|
-
</If>
|
|
123
|
-
|
|
124
|
-
<Message type="notice" style={{ marginTop: '16px' }}>
|
|
125
|
-
<Translation>
|
|
126
|
-
The input data will be automatically formatted. Ensure that the input data is a valid k8s resource YAML.
|
|
127
|
-
</Translation>
|
|
128
|
-
</Message>
|
|
129
|
-
|
|
130
|
-
<Upload request={this.customRequest}>
|
|
131
|
-
<Button text type="normal" className="padding-left-0">
|
|
132
|
-
<AiOutlineCloudUpload />
|
|
133
|
-
<Translation>Upload Yaml File</Translation>
|
|
134
|
-
</Button>
|
|
135
|
-
</Upload>
|
|
136
|
-
|
|
137
|
-
<div id={containerId} className="guide-code">
|
|
138
|
-
<DefinitionCode containerId={containerId} language={'yaml'} readOnly={false} {...init('code')} />
|
|
139
|
-
</div>
|
|
140
|
-
|
|
141
|
-
<If condition={showButton}>
|
|
142
|
-
<div style={{ marginTop: '16px' }}>
|
|
143
|
-
<span style={{ fontSize: '14px', color: '#000', marginRight: '16px' }}>
|
|
144
|
-
<Translation>Convert the kubernetes resource component to the webservice component?</Translation>
|
|
145
|
-
</span>
|
|
146
|
-
<Button type="secondary" onClick={this.onConvert2WebService}>
|
|
147
|
-
Yes
|
|
148
|
-
</Button>
|
|
149
|
-
</div>
|
|
150
|
-
</If>
|
|
151
|
-
</div>
|
|
152
|
-
);
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
export default K8sObjectsCode;
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import type { ResourceObject } from '@velaux/data';
|
|
2
|
-
|
|
3
|
-
export interface KubernetesObject extends ResourceObject {
|
|
4
|
-
apiVersion: string;
|
|
5
|
-
kind: string;
|
|
6
|
-
spec?: Record<string, any>;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
export function isDeployment(object: KubernetesObject): boolean {
|
|
10
|
-
return object.kind === 'Deployment';
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export function isShowConvertButton(objects: KubernetesObject[]): boolean {
|
|
14
|
-
return objects.filter((ob) => isDeployment(ob)).length > 0;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export function buildWebServiceBaseDeployment(object: KubernetesObject): Record<string, any> {
|
|
18
|
-
return {
|
|
19
|
-
image: object.spec?.containers[0].image,
|
|
20
|
-
ports: [],
|
|
21
|
-
readinessProbe: {},
|
|
22
|
-
livenessProbe: {},
|
|
23
|
-
env: [],
|
|
24
|
-
memory: '',
|
|
25
|
-
cpu: '',
|
|
26
|
-
};
|
|
27
|
-
}
|