@dovetail-v2/refine 0.1.32 → 0.2.0-alpha.1
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.
- package/dist/{MonacoYamlDiffEditor-286ba95e.js → MonacoYamlDiffEditor-97cade84.js} +1 -1
- package/dist/{index-12763c77.js → index-50a21e99.js} +911 -678
- package/dist/refine.js +90 -87
- package/dist/refine.umd.cjs +810 -577
- package/dist/style.css +0 -8
- package/lib/components/Form/FormModal.d.ts +10 -2
- package/lib/components/Form/FormModeSegmentControl.d.ts +9 -0
- package/lib/components/Form/RefineFormContainer.d.ts +17 -0
- package/lib/components/Form/RefineFormContent.d.ts +4 -1
- package/lib/components/Form/YamlForm.d.ts +5 -2
- package/lib/components/Form/YamlFormContainer.d.ts +17 -0
- package/lib/components/Form/type.d.ts +17 -3
- package/lib/components/Form/useFieldsConfig.d.ts +2 -2
- package/lib/components/Form/useRefineForm.d.ts +3 -2
- package/lib/components/Form/useYamlForm.d.ts +0 -3
- package/lib/components/InternalBaseTable/index.d.ts +2 -2
- package/lib/hooks/useOpenForm.d.ts +0 -3
- package/lib/hooks/usePathMap.d.ts +26 -0
- package/lib/models/ingress-model.d.ts +2 -2
- package/lib/pages/storageclasses/form/index.d.ts +4 -4
- package/lib/pages/storageclasses/index.d.ts +3 -51
- package/lib/types/resource.d.ts +114 -66
- package/lib/utils/object.d.ts +1 -0
- package/package.json +1 -1
package/dist/refine.umd.cjs
CHANGED
|
@@ -31,301 +31,308 @@ var __publicField = (obj, key, value) => {
|
|
|
31
31
|
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
|
|
32
32
|
}
|
|
33
33
|
var dayjs_min = { exports: {} };
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
return
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
this.$y = t3.getFullYear(), this.$M = t3.getMonth(), this.$D = t3.getDate(), this.$W = t3.getDay(), this.$H = t3.getHours(), this.$m = t3.getMinutes(), this.$s = t3.getSeconds(), this.$ms = t3.getMilliseconds();
|
|
112
|
-
}, m2.$utils = function() {
|
|
113
|
-
return b;
|
|
114
|
-
}, m2.isValid = function() {
|
|
115
|
-
return !(this.$d.toString() === l);
|
|
116
|
-
}, m2.isSame = function(t3, e3) {
|
|
117
|
-
var n3 = O(t3);
|
|
118
|
-
return this.startOf(e3) <= n3 && n3 <= this.endOf(e3);
|
|
119
|
-
}, m2.isAfter = function(t3, e3) {
|
|
120
|
-
return O(t3) < this.startOf(e3);
|
|
121
|
-
}, m2.isBefore = function(t3, e3) {
|
|
122
|
-
return this.endOf(e3) < O(t3);
|
|
123
|
-
}, m2.$g = function(t3, e3, n3) {
|
|
124
|
-
return b.u(t3) ? this[e3] : this.set(n3, t3);
|
|
125
|
-
}, m2.unix = function() {
|
|
126
|
-
return Math.floor(this.valueOf() / 1e3);
|
|
127
|
-
}, m2.valueOf = function() {
|
|
128
|
-
return this.$d.getTime();
|
|
129
|
-
}, m2.startOf = function(t3, e3) {
|
|
130
|
-
var n3 = this, r3 = !!b.u(e3) || e3, f2 = b.p(t3), l2 = function(t4, e4) {
|
|
131
|
-
var i3 = b.w(n3.$u ? Date.UTC(n3.$y, e4, t4) : new Date(n3.$y, e4, t4), n3);
|
|
132
|
-
return r3 ? i3 : i3.endOf(a2);
|
|
133
|
-
}, $2 = function(t4, e4) {
|
|
134
|
-
return b.w(n3.toDate()[t4].apply(n3.toDate("s"), (r3 ? [0, 0, 0, 0] : [23, 59, 59, 999]).slice(e4)), n3);
|
|
135
|
-
}, y2 = this.$W, M3 = this.$M, m3 = this.$D, v2 = "set" + (this.$u ? "UTC" : "");
|
|
136
|
-
switch (f2) {
|
|
137
|
-
case h:
|
|
138
|
-
return r3 ? l2(1, 0) : l2(31, 11);
|
|
139
|
-
case c2:
|
|
140
|
-
return r3 ? l2(1, M3) : l2(0, M3 + 1);
|
|
141
|
-
case o:
|
|
142
|
-
var g2 = this.$locale().weekStart || 0, D2 = (y2 < g2 ? y2 + 7 : y2) - g2;
|
|
143
|
-
return l2(r3 ? m3 - D2 : m3 + (6 - D2), M3);
|
|
144
|
-
case a2:
|
|
145
|
-
case d:
|
|
146
|
-
return $2(v2 + "Hours", 0);
|
|
147
|
-
case u:
|
|
148
|
-
return $2(v2 + "Minutes", 1);
|
|
149
|
-
case s2:
|
|
150
|
-
return $2(v2 + "Seconds", 2);
|
|
151
|
-
case i2:
|
|
152
|
-
return $2(v2 + "Milliseconds", 3);
|
|
153
|
-
default:
|
|
154
|
-
return this.clone();
|
|
155
|
-
}
|
|
156
|
-
}, m2.endOf = function(t3) {
|
|
157
|
-
return this.startOf(t3, false);
|
|
158
|
-
}, m2.$set = function(t3, e3) {
|
|
159
|
-
var n3, o2 = b.p(t3), f2 = "set" + (this.$u ? "UTC" : ""), l2 = (n3 = {}, n3[a2] = f2 + "Date", n3[d] = f2 + "Date", n3[c2] = f2 + "Month", n3[h] = f2 + "FullYear", n3[u] = f2 + "Hours", n3[s2] = f2 + "Minutes", n3[i2] = f2 + "Seconds", n3[r2] = f2 + "Milliseconds", n3)[o2], $2 = o2 === a2 ? this.$D + (e3 - this.$W) : e3;
|
|
160
|
-
if (o2 === c2 || o2 === h) {
|
|
161
|
-
var y2 = this.clone().set(d, 1);
|
|
162
|
-
y2.$d[l2]($2), y2.init(), this.$d = y2.set(d, Math.min(this.$D, y2.daysInMonth())).$d;
|
|
163
|
-
} else
|
|
164
|
-
l2 && this.$d[l2]($2);
|
|
165
|
-
return this.init(), this;
|
|
166
|
-
}, m2.set = function(t3, e3) {
|
|
167
|
-
return this.clone().$set(t3, e3);
|
|
168
|
-
}, m2.get = function(t3) {
|
|
169
|
-
return this[b.p(t3)]();
|
|
170
|
-
}, m2.add = function(r3, f2) {
|
|
171
|
-
var d2, l2 = this;
|
|
172
|
-
r3 = Number(r3);
|
|
173
|
-
var $2 = b.p(f2), y2 = function(t3) {
|
|
174
|
-
var e3 = O(l2);
|
|
175
|
-
return b.w(e3.date(e3.date() + Math.round(t3 * r3)), l2);
|
|
176
|
-
};
|
|
177
|
-
if ($2 === c2)
|
|
178
|
-
return this.set(c2, this.$M + r3);
|
|
179
|
-
if ($2 === h)
|
|
180
|
-
return this.set(h, this.$y + r3);
|
|
181
|
-
if ($2 === a2)
|
|
182
|
-
return y2(1);
|
|
183
|
-
if ($2 === o)
|
|
184
|
-
return y2(7);
|
|
185
|
-
var M3 = (d2 = {}, d2[s2] = e2, d2[u] = n2, d2[i2] = t2, d2)[$2] || 1, m3 = this.$d.getTime() + r3 * M3;
|
|
186
|
-
return b.w(m3, this);
|
|
187
|
-
}, m2.subtract = function(t3, e3) {
|
|
188
|
-
return this.add(-1 * t3, e3);
|
|
189
|
-
}, m2.format = function(t3) {
|
|
190
|
-
var e3 = this, n3 = this.$locale();
|
|
191
|
-
if (!this.isValid())
|
|
192
|
-
return n3.invalidDate || l;
|
|
193
|
-
var r3 = t3 || "YYYY-MM-DDTHH:mm:ssZ", i3 = b.z(this), s3 = this.$H, u2 = this.$m, a3 = this.$M, o2 = n3.weekdays, c3 = n3.months, f2 = n3.meridiem, h2 = function(t4, n4, i4, s4) {
|
|
194
|
-
return t4 && (t4[n4] || t4(e3, r3)) || i4[n4].slice(0, s4);
|
|
195
|
-
}, d2 = function(t4) {
|
|
196
|
-
return b.s(s3 % 12 || 12, t4, "0");
|
|
197
|
-
}, $2 = f2 || function(t4, e4, n4) {
|
|
198
|
-
var r4 = t4 < 12 ? "AM" : "PM";
|
|
199
|
-
return n4 ? r4.toLowerCase() : r4;
|
|
200
|
-
};
|
|
201
|
-
return r3.replace(y, function(t4, r4) {
|
|
202
|
-
return r4 || function(t5) {
|
|
203
|
-
switch (t5) {
|
|
204
|
-
case "YY":
|
|
205
|
-
return String(e3.$y).slice(-2);
|
|
206
|
-
case "YYYY":
|
|
207
|
-
return b.s(e3.$y, 4, "0");
|
|
208
|
-
case "M":
|
|
209
|
-
return a3 + 1;
|
|
210
|
-
case "MM":
|
|
211
|
-
return b.s(a3 + 1, 2, "0");
|
|
212
|
-
case "MMM":
|
|
213
|
-
return h2(n3.monthsShort, a3, c3, 3);
|
|
214
|
-
case "MMMM":
|
|
215
|
-
return h2(c3, a3);
|
|
216
|
-
case "D":
|
|
217
|
-
return e3.$D;
|
|
218
|
-
case "DD":
|
|
219
|
-
return b.s(e3.$D, 2, "0");
|
|
220
|
-
case "d":
|
|
221
|
-
return String(e3.$W);
|
|
222
|
-
case "dd":
|
|
223
|
-
return h2(n3.weekdaysMin, e3.$W, o2, 2);
|
|
224
|
-
case "ddd":
|
|
225
|
-
return h2(n3.weekdaysShort, e3.$W, o2, 3);
|
|
226
|
-
case "dddd":
|
|
227
|
-
return o2[e3.$W];
|
|
228
|
-
case "H":
|
|
229
|
-
return String(s3);
|
|
230
|
-
case "HH":
|
|
231
|
-
return b.s(s3, 2, "0");
|
|
232
|
-
case "h":
|
|
233
|
-
return d2(1);
|
|
234
|
-
case "hh":
|
|
235
|
-
return d2(2);
|
|
236
|
-
case "a":
|
|
237
|
-
return $2(s3, u2, true);
|
|
238
|
-
case "A":
|
|
239
|
-
return $2(s3, u2, false);
|
|
240
|
-
case "m":
|
|
241
|
-
return String(u2);
|
|
242
|
-
case "mm":
|
|
243
|
-
return b.s(u2, 2, "0");
|
|
244
|
-
case "s":
|
|
245
|
-
return String(e3.$s);
|
|
246
|
-
case "ss":
|
|
247
|
-
return b.s(e3.$s, 2, "0");
|
|
248
|
-
case "SSS":
|
|
249
|
-
return b.s(e3.$ms, 3, "0");
|
|
250
|
-
case "Z":
|
|
251
|
-
return i3;
|
|
34
|
+
var hasRequiredDayjs_min;
|
|
35
|
+
function requireDayjs_min() {
|
|
36
|
+
if (hasRequiredDayjs_min)
|
|
37
|
+
return dayjs_min.exports;
|
|
38
|
+
hasRequiredDayjs_min = 1;
|
|
39
|
+
(function(module2, exports3) {
|
|
40
|
+
!function(t2, e2) {
|
|
41
|
+
module2.exports = e2();
|
|
42
|
+
}(commonjsGlobal, function() {
|
|
43
|
+
var t2 = 1e3, e2 = 6e4, n2 = 36e5, r2 = "millisecond", i2 = "second", s2 = "minute", u = "hour", a2 = "day", o = "week", c2 = "month", f = "quarter", h = "year", d = "date", l = "Invalid Date", $ = /^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/, y = /\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g, M = { name: "en", weekdays: "Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"), months: "January_February_March_April_May_June_July_August_September_October_November_December".split("_"), ordinal: function(t3) {
|
|
44
|
+
var e3 = ["th", "st", "nd", "rd"], n3 = t3 % 100;
|
|
45
|
+
return "[" + t3 + (e3[(n3 - 20) % 10] || e3[n3] || e3[0]) + "]";
|
|
46
|
+
} }, m = function(t3, e3, n3) {
|
|
47
|
+
var r3 = String(t3);
|
|
48
|
+
return !r3 || r3.length >= e3 ? t3 : "" + Array(e3 + 1 - r3.length).join(n3) + t3;
|
|
49
|
+
}, v = { s: m, z: function(t3) {
|
|
50
|
+
var e3 = -t3.utcOffset(), n3 = Math.abs(e3), r3 = Math.floor(n3 / 60), i3 = n3 % 60;
|
|
51
|
+
return (e3 <= 0 ? "+" : "-") + m(r3, 2, "0") + ":" + m(i3, 2, "0");
|
|
52
|
+
}, m: function t3(e3, n3) {
|
|
53
|
+
if (e3.date() < n3.date())
|
|
54
|
+
return -t3(n3, e3);
|
|
55
|
+
var r3 = 12 * (n3.year() - e3.year()) + (n3.month() - e3.month()), i3 = e3.clone().add(r3, c2), s3 = n3 - i3 < 0, u2 = e3.clone().add(r3 + (s3 ? -1 : 1), c2);
|
|
56
|
+
return +(-(r3 + (n3 - i3) / (s3 ? i3 - u2 : u2 - i3)) || 0);
|
|
57
|
+
}, a: function(t3) {
|
|
58
|
+
return t3 < 0 ? Math.ceil(t3) || 0 : Math.floor(t3);
|
|
59
|
+
}, p: function(t3) {
|
|
60
|
+
return { M: c2, y: h, w: o, d: a2, D: d, h: u, m: s2, s: i2, ms: r2, Q: f }[t3] || String(t3 || "").toLowerCase().replace(/s$/, "");
|
|
61
|
+
}, u: function(t3) {
|
|
62
|
+
return void 0 === t3;
|
|
63
|
+
} }, g = "en", D = {};
|
|
64
|
+
D[g] = M;
|
|
65
|
+
var p = "$isDayjsObject", S = function(t3) {
|
|
66
|
+
return t3 instanceof _ || !(!t3 || !t3[p]);
|
|
67
|
+
}, w = function t3(e3, n3, r3) {
|
|
68
|
+
var i3;
|
|
69
|
+
if (!e3)
|
|
70
|
+
return g;
|
|
71
|
+
if ("string" == typeof e3) {
|
|
72
|
+
var s3 = e3.toLowerCase();
|
|
73
|
+
D[s3] && (i3 = s3), n3 && (D[s3] = n3, i3 = s3);
|
|
74
|
+
var u2 = e3.split("-");
|
|
75
|
+
if (!i3 && u2.length > 1)
|
|
76
|
+
return t3(u2[0]);
|
|
77
|
+
} else {
|
|
78
|
+
var a3 = e3.name;
|
|
79
|
+
D[a3] = e3, i3 = a3;
|
|
80
|
+
}
|
|
81
|
+
return !r3 && i3 && (g = i3), i3 || !r3 && g;
|
|
82
|
+
}, O = function(t3, e3) {
|
|
83
|
+
if (S(t3))
|
|
84
|
+
return t3.clone();
|
|
85
|
+
var n3 = "object" == typeof e3 ? e3 : {};
|
|
86
|
+
return n3.date = t3, n3.args = arguments, new _(n3);
|
|
87
|
+
}, b = v;
|
|
88
|
+
b.l = w, b.i = S, b.w = function(t3, e3) {
|
|
89
|
+
return O(t3, { locale: e3.$L, utc: e3.$u, x: e3.$x, $offset: e3.$offset });
|
|
90
|
+
};
|
|
91
|
+
var _ = function() {
|
|
92
|
+
function M2(t3) {
|
|
93
|
+
this.$L = w(t3.locale, null, true), this.parse(t3), this.$x = this.$x || t3.x || {}, this[p] = true;
|
|
94
|
+
}
|
|
95
|
+
var m2 = M2.prototype;
|
|
96
|
+
return m2.parse = function(t3) {
|
|
97
|
+
this.$d = function(t4) {
|
|
98
|
+
var e3 = t4.date, n3 = t4.utc;
|
|
99
|
+
if (null === e3)
|
|
100
|
+
return /* @__PURE__ */ new Date(NaN);
|
|
101
|
+
if (b.u(e3))
|
|
102
|
+
return /* @__PURE__ */ new Date();
|
|
103
|
+
if (e3 instanceof Date)
|
|
104
|
+
return new Date(e3);
|
|
105
|
+
if ("string" == typeof e3 && !/Z$/i.test(e3)) {
|
|
106
|
+
var r3 = e3.match($);
|
|
107
|
+
if (r3) {
|
|
108
|
+
var i3 = r3[2] - 1 || 0, s3 = (r3[7] || "0").substring(0, 3);
|
|
109
|
+
return n3 ? new Date(Date.UTC(r3[1], i3, r3[3] || 1, r3[4] || 0, r3[5] || 0, r3[6] || 0, s3)) : new Date(r3[1], i3, r3[3] || 1, r3[4] || 0, r3[5] || 0, r3[6] || 0, s3);
|
|
110
|
+
}
|
|
252
111
|
}
|
|
253
|
-
return
|
|
254
|
-
}(
|
|
255
|
-
})
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
112
|
+
return new Date(e3);
|
|
113
|
+
}(t3), this.init();
|
|
114
|
+
}, m2.init = function() {
|
|
115
|
+
var t3 = this.$d;
|
|
116
|
+
this.$y = t3.getFullYear(), this.$M = t3.getMonth(), this.$D = t3.getDate(), this.$W = t3.getDay(), this.$H = t3.getHours(), this.$m = t3.getMinutes(), this.$s = t3.getSeconds(), this.$ms = t3.getMilliseconds();
|
|
117
|
+
}, m2.$utils = function() {
|
|
118
|
+
return b;
|
|
119
|
+
}, m2.isValid = function() {
|
|
120
|
+
return !(this.$d.toString() === l);
|
|
121
|
+
}, m2.isSame = function(t3, e3) {
|
|
122
|
+
var n3 = O(t3);
|
|
123
|
+
return this.startOf(e3) <= n3 && n3 <= this.endOf(e3);
|
|
124
|
+
}, m2.isAfter = function(t3, e3) {
|
|
125
|
+
return O(t3) < this.startOf(e3);
|
|
126
|
+
}, m2.isBefore = function(t3, e3) {
|
|
127
|
+
return this.endOf(e3) < O(t3);
|
|
128
|
+
}, m2.$g = function(t3, e3, n3) {
|
|
129
|
+
return b.u(t3) ? this[e3] : this.set(n3, t3);
|
|
130
|
+
}, m2.unix = function() {
|
|
131
|
+
return Math.floor(this.valueOf() / 1e3);
|
|
132
|
+
}, m2.valueOf = function() {
|
|
133
|
+
return this.$d.getTime();
|
|
134
|
+
}, m2.startOf = function(t3, e3) {
|
|
135
|
+
var n3 = this, r3 = !!b.u(e3) || e3, f2 = b.p(t3), l2 = function(t4, e4) {
|
|
136
|
+
var i3 = b.w(n3.$u ? Date.UTC(n3.$y, e4, t4) : new Date(n3.$y, e4, t4), n3);
|
|
137
|
+
return r3 ? i3 : i3.endOf(a2);
|
|
138
|
+
}, $2 = function(t4, e4) {
|
|
139
|
+
return b.w(n3.toDate()[t4].apply(n3.toDate("s"), (r3 ? [0, 0, 0, 0] : [23, 59, 59, 999]).slice(e4)), n3);
|
|
140
|
+
}, y2 = this.$W, M3 = this.$M, m3 = this.$D, v2 = "set" + (this.$u ? "UTC" : "");
|
|
141
|
+
switch (f2) {
|
|
142
|
+
case h:
|
|
143
|
+
return r3 ? l2(1, 0) : l2(31, 11);
|
|
144
|
+
case c2:
|
|
145
|
+
return r3 ? l2(1, M3) : l2(0, M3 + 1);
|
|
146
|
+
case o:
|
|
147
|
+
var g2 = this.$locale().weekStart || 0, D2 = (y2 < g2 ? y2 + 7 : y2) - g2;
|
|
148
|
+
return l2(r3 ? m3 - D2 : m3 + (6 - D2), M3);
|
|
149
|
+
case a2:
|
|
150
|
+
case d:
|
|
151
|
+
return $2(v2 + "Hours", 0);
|
|
152
|
+
case u:
|
|
153
|
+
return $2(v2 + "Minutes", 1);
|
|
154
|
+
case s2:
|
|
155
|
+
return $2(v2 + "Seconds", 2);
|
|
156
|
+
case i2:
|
|
157
|
+
return $2(v2 + "Milliseconds", 3);
|
|
158
|
+
default:
|
|
159
|
+
return this.clone();
|
|
160
|
+
}
|
|
161
|
+
}, m2.endOf = function(t3) {
|
|
162
|
+
return this.startOf(t3, false);
|
|
163
|
+
}, m2.$set = function(t3, e3) {
|
|
164
|
+
var n3, o2 = b.p(t3), f2 = "set" + (this.$u ? "UTC" : ""), l2 = (n3 = {}, n3[a2] = f2 + "Date", n3[d] = f2 + "Date", n3[c2] = f2 + "Month", n3[h] = f2 + "FullYear", n3[u] = f2 + "Hours", n3[s2] = f2 + "Minutes", n3[i2] = f2 + "Seconds", n3[r2] = f2 + "Milliseconds", n3)[o2], $2 = o2 === a2 ? this.$D + (e3 - this.$W) : e3;
|
|
165
|
+
if (o2 === c2 || o2 === h) {
|
|
166
|
+
var y2 = this.clone().set(d, 1);
|
|
167
|
+
y2.$d[l2]($2), y2.init(), this.$d = y2.set(d, Math.min(this.$D, y2.daysInMonth())).$d;
|
|
168
|
+
} else
|
|
169
|
+
l2 && this.$d[l2]($2);
|
|
170
|
+
return this.init(), this;
|
|
171
|
+
}, m2.set = function(t3, e3) {
|
|
172
|
+
return this.clone().$set(t3, e3);
|
|
173
|
+
}, m2.get = function(t3) {
|
|
174
|
+
return this[b.p(t3)]();
|
|
175
|
+
}, m2.add = function(r3, f2) {
|
|
176
|
+
var d2, l2 = this;
|
|
177
|
+
r3 = Number(r3);
|
|
178
|
+
var $2 = b.p(f2), y2 = function(t3) {
|
|
179
|
+
var e3 = O(l2);
|
|
180
|
+
return b.w(e3.date(e3.date() + Math.round(t3 * r3)), l2);
|
|
181
|
+
};
|
|
182
|
+
if ($2 === c2)
|
|
183
|
+
return this.set(c2, this.$M + r3);
|
|
184
|
+
if ($2 === h)
|
|
185
|
+
return this.set(h, this.$y + r3);
|
|
186
|
+
if ($2 === a2)
|
|
187
|
+
return y2(1);
|
|
188
|
+
if ($2 === o)
|
|
189
|
+
return y2(7);
|
|
190
|
+
var M3 = (d2 = {}, d2[s2] = e2, d2[u] = n2, d2[i2] = t2, d2)[$2] || 1, m3 = this.$d.getTime() + r3 * M3;
|
|
191
|
+
return b.w(m3, this);
|
|
192
|
+
}, m2.subtract = function(t3, e3) {
|
|
193
|
+
return this.add(-1 * t3, e3);
|
|
194
|
+
}, m2.format = function(t3) {
|
|
195
|
+
var e3 = this, n3 = this.$locale();
|
|
196
|
+
if (!this.isValid())
|
|
197
|
+
return n3.invalidDate || l;
|
|
198
|
+
var r3 = t3 || "YYYY-MM-DDTHH:mm:ssZ", i3 = b.z(this), s3 = this.$H, u2 = this.$m, a3 = this.$M, o2 = n3.weekdays, c3 = n3.months, f2 = n3.meridiem, h2 = function(t4, n4, i4, s4) {
|
|
199
|
+
return t4 && (t4[n4] || t4(e3, r3)) || i4[n4].slice(0, s4);
|
|
200
|
+
}, d2 = function(t4) {
|
|
201
|
+
return b.s(s3 % 12 || 12, t4, "0");
|
|
202
|
+
}, $2 = f2 || function(t4, e4, n4) {
|
|
203
|
+
var r4 = t4 < 12 ? "AM" : "PM";
|
|
204
|
+
return n4 ? r4.toLowerCase() : r4;
|
|
205
|
+
};
|
|
206
|
+
return r3.replace(y, function(t4, r4) {
|
|
207
|
+
return r4 || function(t5) {
|
|
208
|
+
switch (t5) {
|
|
209
|
+
case "YY":
|
|
210
|
+
return String(e3.$y).slice(-2);
|
|
211
|
+
case "YYYY":
|
|
212
|
+
return b.s(e3.$y, 4, "0");
|
|
213
|
+
case "M":
|
|
214
|
+
return a3 + 1;
|
|
215
|
+
case "MM":
|
|
216
|
+
return b.s(a3 + 1, 2, "0");
|
|
217
|
+
case "MMM":
|
|
218
|
+
return h2(n3.monthsShort, a3, c3, 3);
|
|
219
|
+
case "MMMM":
|
|
220
|
+
return h2(c3, a3);
|
|
221
|
+
case "D":
|
|
222
|
+
return e3.$D;
|
|
223
|
+
case "DD":
|
|
224
|
+
return b.s(e3.$D, 2, "0");
|
|
225
|
+
case "d":
|
|
226
|
+
return String(e3.$W);
|
|
227
|
+
case "dd":
|
|
228
|
+
return h2(n3.weekdaysMin, e3.$W, o2, 2);
|
|
229
|
+
case "ddd":
|
|
230
|
+
return h2(n3.weekdaysShort, e3.$W, o2, 3);
|
|
231
|
+
case "dddd":
|
|
232
|
+
return o2[e3.$W];
|
|
233
|
+
case "H":
|
|
234
|
+
return String(s3);
|
|
235
|
+
case "HH":
|
|
236
|
+
return b.s(s3, 2, "0");
|
|
237
|
+
case "h":
|
|
238
|
+
return d2(1);
|
|
239
|
+
case "hh":
|
|
240
|
+
return d2(2);
|
|
241
|
+
case "a":
|
|
242
|
+
return $2(s3, u2, true);
|
|
243
|
+
case "A":
|
|
244
|
+
return $2(s3, u2, false);
|
|
245
|
+
case "m":
|
|
246
|
+
return String(u2);
|
|
247
|
+
case "mm":
|
|
248
|
+
return b.s(u2, 2, "0");
|
|
249
|
+
case "s":
|
|
250
|
+
return String(e3.$s);
|
|
251
|
+
case "ss":
|
|
252
|
+
return b.s(e3.$s, 2, "0");
|
|
253
|
+
case "SSS":
|
|
254
|
+
return b.s(e3.$ms, 3, "0");
|
|
255
|
+
case "Z":
|
|
256
|
+
return i3;
|
|
257
|
+
}
|
|
258
|
+
return null;
|
|
259
|
+
}(t4) || i3.replace(":", "");
|
|
260
|
+
});
|
|
261
|
+
}, m2.utcOffset = function() {
|
|
262
|
+
return 15 * -Math.round(this.$d.getTimezoneOffset() / 15);
|
|
263
|
+
}, m2.diff = function(r3, d2, l2) {
|
|
264
|
+
var $2, y2 = this, M3 = b.p(d2), m3 = O(r3), v2 = (m3.utcOffset() - this.utcOffset()) * e2, g2 = this - m3, D2 = function() {
|
|
265
|
+
return b.m(y2, m3);
|
|
266
|
+
};
|
|
267
|
+
switch (M3) {
|
|
268
|
+
case h:
|
|
269
|
+
$2 = D2() / 12;
|
|
270
|
+
break;
|
|
271
|
+
case c2:
|
|
272
|
+
$2 = D2();
|
|
273
|
+
break;
|
|
274
|
+
case f:
|
|
275
|
+
$2 = D2() / 3;
|
|
276
|
+
break;
|
|
277
|
+
case o:
|
|
278
|
+
$2 = (g2 - v2) / 6048e5;
|
|
279
|
+
break;
|
|
280
|
+
case a2:
|
|
281
|
+
$2 = (g2 - v2) / 864e5;
|
|
282
|
+
break;
|
|
283
|
+
case u:
|
|
284
|
+
$2 = g2 / n2;
|
|
285
|
+
break;
|
|
286
|
+
case s2:
|
|
287
|
+
$2 = g2 / e2;
|
|
288
|
+
break;
|
|
289
|
+
case i2:
|
|
290
|
+
$2 = g2 / t2;
|
|
291
|
+
break;
|
|
292
|
+
default:
|
|
293
|
+
$2 = g2;
|
|
294
|
+
}
|
|
295
|
+
return l2 ? $2 : b.a($2);
|
|
296
|
+
}, m2.daysInMonth = function() {
|
|
297
|
+
return this.endOf(c2).$D;
|
|
298
|
+
}, m2.$locale = function() {
|
|
299
|
+
return D[this.$L];
|
|
300
|
+
}, m2.locale = function(t3, e3) {
|
|
301
|
+
if (!t3)
|
|
302
|
+
return this.$L;
|
|
303
|
+
var n3 = this.clone(), r3 = w(t3, e3, true);
|
|
304
|
+
return r3 && (n3.$L = r3), n3;
|
|
305
|
+
}, m2.clone = function() {
|
|
306
|
+
return b.w(this.$d, this);
|
|
307
|
+
}, m2.toDate = function() {
|
|
308
|
+
return new Date(this.valueOf());
|
|
309
|
+
}, m2.toJSON = function() {
|
|
310
|
+
return this.isValid() ? this.toISOString() : null;
|
|
311
|
+
}, m2.toISOString = function() {
|
|
312
|
+
return this.$d.toISOString();
|
|
313
|
+
}, m2.toString = function() {
|
|
314
|
+
return this.$d.toUTCString();
|
|
315
|
+
}, M2;
|
|
316
|
+
}(), k = _.prototype;
|
|
317
|
+
return O.prototype = k, [["$ms", r2], ["$s", i2], ["$m", s2], ["$H", u], ["$W", a2], ["$M", c2], ["$y", h], ["$D", d]].forEach(function(t3) {
|
|
318
|
+
k[t3[1]] = function(e3) {
|
|
319
|
+
return this.$g(e3, t3[0], t3[1]);
|
|
261
320
|
};
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
case o:
|
|
273
|
-
$2 = (g2 - v2) / 6048e5;
|
|
274
|
-
break;
|
|
275
|
-
case a2:
|
|
276
|
-
$2 = (g2 - v2) / 864e5;
|
|
277
|
-
break;
|
|
278
|
-
case u:
|
|
279
|
-
$2 = g2 / n2;
|
|
280
|
-
break;
|
|
281
|
-
case s2:
|
|
282
|
-
$2 = g2 / e2;
|
|
283
|
-
break;
|
|
284
|
-
case i2:
|
|
285
|
-
$2 = g2 / t2;
|
|
286
|
-
break;
|
|
287
|
-
default:
|
|
288
|
-
$2 = g2;
|
|
289
|
-
}
|
|
290
|
-
return l2 ? $2 : b.a($2);
|
|
291
|
-
}, m2.daysInMonth = function() {
|
|
292
|
-
return this.endOf(c2).$D;
|
|
293
|
-
}, m2.$locale = function() {
|
|
294
|
-
return D[this.$L];
|
|
295
|
-
}, m2.locale = function(t3, e3) {
|
|
296
|
-
if (!t3)
|
|
297
|
-
return this.$L;
|
|
298
|
-
var n3 = this.clone(), r3 = w(t3, e3, true);
|
|
299
|
-
return r3 && (n3.$L = r3), n3;
|
|
300
|
-
}, m2.clone = function() {
|
|
301
|
-
return b.w(this.$d, this);
|
|
302
|
-
}, m2.toDate = function() {
|
|
303
|
-
return new Date(this.valueOf());
|
|
304
|
-
}, m2.toJSON = function() {
|
|
305
|
-
return this.isValid() ? this.toISOString() : null;
|
|
306
|
-
}, m2.toISOString = function() {
|
|
307
|
-
return this.$d.toISOString();
|
|
308
|
-
}, m2.toString = function() {
|
|
309
|
-
return this.$d.toUTCString();
|
|
310
|
-
}, M2;
|
|
311
|
-
}(), k = _.prototype;
|
|
312
|
-
return O.prototype = k, [["$ms", r2], ["$s", i2], ["$m", s2], ["$H", u], ["$W", a2], ["$M", c2], ["$y", h], ["$D", d]].forEach(function(t3) {
|
|
313
|
-
k[t3[1]] = function(e3) {
|
|
314
|
-
return this.$g(e3, t3[0], t3[1]);
|
|
315
|
-
};
|
|
316
|
-
}), O.extend = function(t3, e3) {
|
|
317
|
-
return t3.$i || (t3(e3, _, O), t3.$i = true), O;
|
|
318
|
-
}, O.locale = w, O.isDayjs = S, O.unix = function(t3) {
|
|
319
|
-
return O(1e3 * t3);
|
|
320
|
-
}, O.en = D[g], O.Ls = D, O.p = {}, O;
|
|
321
|
-
});
|
|
322
|
-
})(dayjs_min);
|
|
323
|
-
var dayjs_minExports = dayjs_min.exports;
|
|
321
|
+
}), O.extend = function(t3, e3) {
|
|
322
|
+
return t3.$i || (t3(e3, _, O), t3.$i = true), O;
|
|
323
|
+
}, O.locale = w, O.isDayjs = S, O.unix = function(t3) {
|
|
324
|
+
return O(1e3 * t3);
|
|
325
|
+
}, O.en = D[g], O.Ls = D, O.p = {}, O;
|
|
326
|
+
});
|
|
327
|
+
})(dayjs_min);
|
|
328
|
+
return dayjs_min.exports;
|
|
329
|
+
}
|
|
330
|
+
var dayjs_minExports = requireDayjs_min();
|
|
324
331
|
const dayjs = /* @__PURE__ */ getDefaultExportFromCjs(dayjs_minExports);
|
|
325
332
|
var zh = { exports: {} };
|
|
326
333
|
(function(module2, exports3) {
|
|
327
334
|
!function(e2, _) {
|
|
328
|
-
module2.exports = _(
|
|
335
|
+
module2.exports = _(requireDayjs_min());
|
|
329
336
|
}(commonjsGlobal, function(e2) {
|
|
330
337
|
function _(e3) {
|
|
331
338
|
return e3 && "object" == typeof e3 && "default" in e3 ? e3 : { default: e3 };
|
|
@@ -9890,21 +9897,25 @@ var __publicField = (obj, key, value) => {
|
|
|
9890
9897
|
class IngressModel extends ResourceModel {
|
|
9891
9898
|
constructor(_rawYaml, _globalStore) {
|
|
9892
9899
|
super(_rawYaml, _globalStore);
|
|
9893
|
-
__publicField(this, "flattenedRules", []);
|
|
9894
9900
|
this._rawYaml = _rawYaml;
|
|
9895
9901
|
}
|
|
9896
|
-
|
|
9902
|
+
getFullPath(rule2, path2 = "", port2) {
|
|
9903
|
+
if (!rule2.host) {
|
|
9904
|
+
return path2 || "";
|
|
9905
|
+
}
|
|
9906
|
+
const hostValue = rule2.host || "";
|
|
9907
|
+
const protocal = this._rawYaml.spec.tls ? "https://" : "http://";
|
|
9908
|
+
const portText = port2 ? `:${port2}` : "";
|
|
9909
|
+
return `${protocal}${hostValue}${portText}${path2}`;
|
|
9910
|
+
}
|
|
9911
|
+
getFlattenedRules(services) {
|
|
9897
9912
|
var _a, _b, _c, _d;
|
|
9898
|
-
const services = await this._globalStore.get("services", {
|
|
9899
|
-
resourceBasePath: "/api/v1",
|
|
9900
|
-
kind: "Service"
|
|
9901
|
-
});
|
|
9902
9913
|
const protocal = !!this._rawYaml.spec.tls ? "https" : "http";
|
|
9903
|
-
const servicePort = (_c = (_b = (_a = services.
|
|
9914
|
+
const servicePort = (_c = (_b = (_a = services.find((s2) => {
|
|
9904
9915
|
var _a2, _b2;
|
|
9905
9916
|
return ((_a2 = s2.metadata) == null ? void 0 : _a2.name) === "contour-envoy" && ((_b2 = s2.spec) == null ? void 0 : _b2.type) === "NodePort";
|
|
9906
9917
|
})) == null ? void 0 : _a.spec) == null ? void 0 : _b.ports) == null ? void 0 : _c.find((p) => p.name === protocal);
|
|
9907
|
-
|
|
9918
|
+
return ((_d = this._rawYaml.spec.rules) == null ? void 0 : _d.reduce((res, rule2) => {
|
|
9908
9919
|
var _a2;
|
|
9909
9920
|
const paths = (_a2 = rule2.http) == null ? void 0 : _a2.paths.map((p) => {
|
|
9910
9921
|
var _a3, _b2, _c2, _d2, _e, _f;
|
|
@@ -9920,15 +9931,6 @@ var __publicField = (obj, key, value) => {
|
|
|
9920
9931
|
return [...res, ...paths || []];
|
|
9921
9932
|
}, [])) || [];
|
|
9922
9933
|
}
|
|
9923
|
-
getFullPath(rule2, path2 = "", port2) {
|
|
9924
|
-
if (!rule2.host) {
|
|
9925
|
-
return path2 || "";
|
|
9926
|
-
}
|
|
9927
|
-
const hostValue = rule2.host || "";
|
|
9928
|
-
const protocal = this._rawYaml.spec.tls ? "https://" : "http://";
|
|
9929
|
-
const portText = port2 ? `:${port2}` : "";
|
|
9930
|
-
return `${protocal}${hostValue}${portText}${path2}`;
|
|
9931
|
-
}
|
|
9932
9934
|
}
|
|
9933
9935
|
class NetworkPolicyModel extends ResourceModel {
|
|
9934
9936
|
constructor(_rawYaml, _globalStore) {
|
|
@@ -11438,11 +11440,21 @@ var __publicField = (obj, key, value) => {
|
|
|
11438
11440
|
RESOURCE_GROUP2["PROJECT"] = "PROJECT";
|
|
11439
11441
|
return RESOURCE_GROUP2;
|
|
11440
11442
|
})(RESOURCE_GROUP || {});
|
|
11443
|
+
var FormContainerType = /* @__PURE__ */ ((FormContainerType2) => {
|
|
11444
|
+
FormContainerType2["PAGE"] = "PAGE";
|
|
11445
|
+
FormContainerType2["MODAL"] = "MODAL";
|
|
11446
|
+
return FormContainerType2;
|
|
11447
|
+
})(FormContainerType || {});
|
|
11441
11448
|
var FormType = /* @__PURE__ */ ((FormType2) => {
|
|
11442
|
-
FormType2["
|
|
11443
|
-
FormType2["
|
|
11449
|
+
FormType2["YAML"] = "YAML";
|
|
11450
|
+
FormType2["FORM"] = "FORM";
|
|
11444
11451
|
return FormType2;
|
|
11445
11452
|
})(FormType || {});
|
|
11453
|
+
var FormMode = /* @__PURE__ */ ((FormMode2) => {
|
|
11454
|
+
FormMode2["FORM"] = "FORM";
|
|
11455
|
+
FormMode2["YAML"] = "YAML";
|
|
11456
|
+
return FormMode2;
|
|
11457
|
+
})(FormMode || {});
|
|
11446
11458
|
function getInitialValues(config) {
|
|
11447
11459
|
return config.initValue || {
|
|
11448
11460
|
apiVersion: config.apiVersion,
|
|
@@ -11459,11 +11471,11 @@ var __publicField = (obj, key, value) => {
|
|
|
11459
11471
|
const pushModal = eagle.usePushModal();
|
|
11460
11472
|
const go = core.useGo();
|
|
11461
11473
|
return function openForm() {
|
|
11462
|
-
var _a, _b
|
|
11474
|
+
var _a, _b;
|
|
11463
11475
|
if (resource == null ? void 0 : resource.name) {
|
|
11464
11476
|
const config = configs[resource.name];
|
|
11465
|
-
const formType = (_a = config.formConfig) == null ? void 0 : _a.
|
|
11466
|
-
if (formType === void 0 || formType ===
|
|
11477
|
+
const formType = (_a = config.formConfig) == null ? void 0 : _a.formContainerType;
|
|
11478
|
+
if (formType === void 0 || formType === FormContainerType.MODAL) {
|
|
11467
11479
|
pushModal({
|
|
11468
11480
|
component: ((_b = config.formConfig) == null ? void 0 : _b.CustomFormModal) || FormModal,
|
|
11469
11481
|
props: {
|
|
@@ -11471,8 +11483,7 @@ var __publicField = (obj, key, value) => {
|
|
|
11471
11483
|
id: options == null ? void 0 : options.id,
|
|
11472
11484
|
formProps: {
|
|
11473
11485
|
initialValues: getInitialValues(config)
|
|
11474
|
-
}
|
|
11475
|
-
renderForm: (options == null ? void 0 : options.renderForm) || ((_c = config.formConfig) == null ? void 0 : _c.renderForm)
|
|
11486
|
+
}
|
|
11476
11487
|
}
|
|
11477
11488
|
});
|
|
11478
11489
|
} else if (options == null ? void 0 : options.id) {
|
|
@@ -11520,12 +11531,13 @@ var __publicField = (obj, key, value) => {
|
|
|
11520
11531
|
resource: resource == null ? void 0 : resource.name,
|
|
11521
11532
|
action: AccessControlAuth.Delete
|
|
11522
11533
|
});
|
|
11534
|
+
const formType = ((_a = config.formConfig) == null ? void 0 : _a.formType) || FormType.FORM;
|
|
11523
11535
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
|
|
11524
11536
|
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
11525
11537
|
eagle.Dropdown,
|
|
11526
11538
|
{
|
|
11527
11539
|
overlay: /* @__PURE__ */ jsxRuntimeExports.jsxs(eagle.Menu, { children: [
|
|
11528
|
-
isInShowPage || (canEditData == null ? void 0 : canEditData.can) === false || config.hideEdit ? null : /* @__PURE__ */ jsxRuntimeExports.jsx(eagle.Menu.Item, { onClick: openForm, children: /* @__PURE__ */ jsxRuntimeExports.jsx(eagle.Icon, { src: iconsReact.EditPen16PrimaryIcon, children:
|
|
11540
|
+
isInShowPage || (canEditData == null ? void 0 : canEditData.can) === false || config.hideEdit ? null : /* @__PURE__ */ jsxRuntimeExports.jsx(eagle.Menu.Item, { onClick: openForm, children: /* @__PURE__ */ jsxRuntimeExports.jsx(eagle.Icon, { src: iconsReact.EditPen16PrimaryIcon, children: formType === FormType.FORM ? t2("dovetail.edit") : t2("dovetail.edit_yaml") }) }),
|
|
11529
11541
|
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
11530
11542
|
eagle.Menu.Item,
|
|
11531
11543
|
{
|
|
@@ -11995,9 +12007,17 @@ var __publicField = (obj, key, value) => {
|
|
|
11995
12007
|
};
|
|
11996
12008
|
const IngressRulesTable = ({ ingress }) => {
|
|
11997
12009
|
const { t: t2 } = useTranslation();
|
|
12010
|
+
const { data: serviceData } = core.useList({
|
|
12011
|
+
resource: "services",
|
|
12012
|
+
meta: {
|
|
12013
|
+
kind: "Service",
|
|
12014
|
+
apiVersion: "v1"
|
|
12015
|
+
}
|
|
12016
|
+
});
|
|
12017
|
+
const flattenedRules = React.useMemo(() => (serviceData == null ? void 0 : serviceData.data) ? ingress.getFlattenedRules(serviceData == null ? void 0 : serviceData.data) : [], [serviceData == null ? void 0 : serviceData.data, ingress]);
|
|
11998
12018
|
const rows = React.useMemo(() => {
|
|
11999
|
-
return addId(
|
|
12000
|
-
}, [
|
|
12019
|
+
return addId(flattenedRules || [], "fullPath");
|
|
12020
|
+
}, [flattenedRules]);
|
|
12001
12021
|
const component = React.useContext(ComponentContext);
|
|
12002
12022
|
const Table2 = component.Table || Table$1;
|
|
12003
12023
|
const currentSize = 10;
|
|
@@ -12383,7 +12403,7 @@ var __publicField = (obj, key, value) => {
|
|
|
12383
12403
|
marginRight: 8
|
|
12384
12404
|
},
|
|
12385
12405
|
onClick: openForm,
|
|
12386
|
-
children: ((_e = config.formConfig) == null ? void 0 : _e.
|
|
12406
|
+
children: ((_e = config.formConfig) == null ? void 0 : _e.formType) === FormType.FORM ? t2("dovetail.edit") : t2("dovetail.edit_yaml")
|
|
12387
12407
|
})
|
|
12388
12408
|
}) : null, /* @__PURE__ */ jsxRuntimeExports.jsx(Dropdown, {
|
|
12389
12409
|
record,
|
|
@@ -36323,6 +36343,86 @@ WARNING: This link could potentially be dangerous`)) {
|
|
|
36323
36343
|
}
|
|
36324
36344
|
);
|
|
36325
36345
|
}
|
|
36346
|
+
function FormModeSegmentControl({
|
|
36347
|
+
formConfig,
|
|
36348
|
+
mode,
|
|
36349
|
+
onChangeMode
|
|
36350
|
+
}) {
|
|
36351
|
+
const { isDisabledChangeMode } = formConfig;
|
|
36352
|
+
return !isDisabledChangeMode ? /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
36353
|
+
eagle.SegmentControl,
|
|
36354
|
+
{
|
|
36355
|
+
style: { fontWeight: "normal" },
|
|
36356
|
+
value: mode,
|
|
36357
|
+
options: [
|
|
36358
|
+
{
|
|
36359
|
+
value: FormMode.FORM,
|
|
36360
|
+
label: i18n.t("dovetail.form")
|
|
36361
|
+
},
|
|
36362
|
+
{
|
|
36363
|
+
value: FormMode.YAML,
|
|
36364
|
+
label: i18n.t("dovetail.yaml")
|
|
36365
|
+
}
|
|
36366
|
+
],
|
|
36367
|
+
onChange: (val) => {
|
|
36368
|
+
onChangeMode(val);
|
|
36369
|
+
}
|
|
36370
|
+
}
|
|
36371
|
+
) : null;
|
|
36372
|
+
}
|
|
36373
|
+
function immutableSet(obj, path2, value2) {
|
|
36374
|
+
return lodashEs.setWith(lodashEs.clone(obj), path2, value2, lodashEs.clone);
|
|
36375
|
+
}
|
|
36376
|
+
function usePathMap(options) {
|
|
36377
|
+
const { pathMap, transformInitValues, transformApplyValues } = options;
|
|
36378
|
+
return {
|
|
36379
|
+
/**
|
|
36380
|
+
* Transforms initial values by mapping paths from source to target structure
|
|
36381
|
+
* @param values Initial values to transform
|
|
36382
|
+
* @returns Transformed values with updated paths
|
|
36383
|
+
*/
|
|
36384
|
+
transformInitValues(values) {
|
|
36385
|
+
const initValues = values._rawYaml || values;
|
|
36386
|
+
let result = initValues;
|
|
36387
|
+
for (const { from, to } of pathMap || []) {
|
|
36388
|
+
result = immutableSet(initValues, to, lodashEs.get(initValues, from));
|
|
36389
|
+
const fromPath = [...from];
|
|
36390
|
+
const lastKey = fromPath.pop();
|
|
36391
|
+
if (lastKey) {
|
|
36392
|
+
const obj = lodashEs.get(result, fromPath);
|
|
36393
|
+
if (obj && typeof obj === "object") {
|
|
36394
|
+
delete obj[lastKey];
|
|
36395
|
+
}
|
|
36396
|
+
}
|
|
36397
|
+
}
|
|
36398
|
+
return (transformInitValues == null ? void 0 : transformInitValues(result)) || result;
|
|
36399
|
+
},
|
|
36400
|
+
/**
|
|
36401
|
+
* Transforms values back to original structure before applying/saving
|
|
36402
|
+
* @param values Values to transform back
|
|
36403
|
+
* @returns Transformed values in original structure
|
|
36404
|
+
*/
|
|
36405
|
+
transformApplyValues(values) {
|
|
36406
|
+
let result = values;
|
|
36407
|
+
for (const { from, to } of pathMap || []) {
|
|
36408
|
+
result = immutableSet(
|
|
36409
|
+
values,
|
|
36410
|
+
from,
|
|
36411
|
+
lodashEs.get(result, to)
|
|
36412
|
+
);
|
|
36413
|
+
const toPath = [...to];
|
|
36414
|
+
const lastKey = toPath.pop();
|
|
36415
|
+
if (lastKey) {
|
|
36416
|
+
const obj = lodashEs.get(result, toPath);
|
|
36417
|
+
if (obj && typeof obj === "object") {
|
|
36418
|
+
delete obj[lastKey];
|
|
36419
|
+
}
|
|
36420
|
+
}
|
|
36421
|
+
}
|
|
36422
|
+
return (transformApplyValues == null ? void 0 : transformApplyValues(result)) || result;
|
|
36423
|
+
}
|
|
36424
|
+
};
|
|
36425
|
+
}
|
|
36326
36426
|
var isCheckBoxInput = (element) => element.type === "checkbox";
|
|
36327
36427
|
var isDateObject = (value2) => value2 instanceof Date;
|
|
36328
36428
|
var isNullOrUndefined = (value2) => value2 == null;
|
|
@@ -37900,8 +38000,8 @@ WARNING: This link could potentially be dangerous`)) {
|
|
|
37900
38000
|
_formControl.current.formState = getProxyFormState(formState, control);
|
|
37901
38001
|
return _formControl.current;
|
|
37902
38002
|
}
|
|
37903
|
-
function useFieldsConfig(config, resourceId) {
|
|
37904
|
-
var _a, _b, _c
|
|
38003
|
+
function useFieldsConfig(config, formConfig, resourceId) {
|
|
38004
|
+
var _a, _b, _c;
|
|
37905
38005
|
const action = resourceId ? "edit" : "create";
|
|
37906
38006
|
const listQuery = core.useList({
|
|
37907
38007
|
resource: config == null ? void 0 : config.name,
|
|
@@ -37915,40 +38015,91 @@ WARNING: This link could potentially be dangerous`)) {
|
|
|
37915
38015
|
meta: { resourceBasePath: config == null ? void 0 : config.basePath, kind: config == null ? void 0 : config.kind },
|
|
37916
38016
|
id: resourceId
|
|
37917
38017
|
});
|
|
37918
|
-
return (
|
|
37919
|
-
record: (
|
|
37920
|
-
records: ((
|
|
38018
|
+
return (_c = formConfig == null ? void 0 : formConfig.fields) == null ? void 0 : _c.call(formConfig, {
|
|
38019
|
+
record: (_a = showQuery.queryResult.data) == null ? void 0 : _a.data,
|
|
38020
|
+
records: ((_b = listQuery.data) == null ? void 0 : _b.data) || [],
|
|
37921
38021
|
action
|
|
37922
38022
|
});
|
|
37923
38023
|
}
|
|
37924
|
-
const
|
|
38024
|
+
const RefineFormContent_ahna8x = "";
|
|
38025
|
+
function renderCommonFormFiled(props) {
|
|
38026
|
+
const {
|
|
38027
|
+
field,
|
|
38028
|
+
fieldConfig,
|
|
38029
|
+
action
|
|
38030
|
+
} = props;
|
|
38031
|
+
const {
|
|
38032
|
+
value: value2,
|
|
38033
|
+
onChange,
|
|
38034
|
+
onBlur,
|
|
38035
|
+
name: name2
|
|
38036
|
+
} = field;
|
|
38037
|
+
let ele = /* @__PURE__ */ jsxRuntimeExports.jsx(eagle.Fields.String, {
|
|
38038
|
+
placeholder: fieldConfig.placeholder,
|
|
38039
|
+
input: {
|
|
38040
|
+
value: value2,
|
|
38041
|
+
onChange,
|
|
38042
|
+
onBlur,
|
|
38043
|
+
name: name2,
|
|
38044
|
+
onFocus: () => null
|
|
38045
|
+
},
|
|
38046
|
+
meta: {}
|
|
38047
|
+
});
|
|
38048
|
+
switch (fieldConfig.type) {
|
|
38049
|
+
case "number":
|
|
38050
|
+
ele = /* @__PURE__ */ jsxRuntimeExports.jsx(eagle.Fields.Integer, {
|
|
38051
|
+
className: "c154n7ie",
|
|
38052
|
+
placeholder: fieldConfig.placeholder,
|
|
38053
|
+
input: {
|
|
38054
|
+
value: value2,
|
|
38055
|
+
onChange,
|
|
38056
|
+
onBlur,
|
|
38057
|
+
name: name2,
|
|
38058
|
+
onFocus: () => null
|
|
38059
|
+
},
|
|
38060
|
+
meta: {}
|
|
38061
|
+
});
|
|
38062
|
+
}
|
|
38063
|
+
if (action === "edit" && fieldConfig.disabledWhenEdit) {
|
|
38064
|
+
ele = /* @__PURE__ */ jsxRuntimeExports.jsx("div", {
|
|
38065
|
+
children: value2
|
|
38066
|
+
});
|
|
38067
|
+
}
|
|
38068
|
+
return ele;
|
|
38069
|
+
}
|
|
37925
38070
|
const RefineFormContent = (props) => {
|
|
37926
38071
|
const {
|
|
37927
38072
|
config,
|
|
37928
38073
|
formResult,
|
|
37929
38074
|
resourceId,
|
|
37930
|
-
errorMsgs
|
|
38075
|
+
errorMsgs,
|
|
38076
|
+
formConfig
|
|
37931
38077
|
} = props;
|
|
37932
38078
|
const {
|
|
37933
38079
|
control,
|
|
37934
|
-
getValues
|
|
38080
|
+
getValues,
|
|
38081
|
+
watch,
|
|
38082
|
+
trigger
|
|
37935
38083
|
} = formResult;
|
|
37936
38084
|
const action = resourceId ? "edit" : "create";
|
|
37937
|
-
const
|
|
37938
|
-
const
|
|
37939
|
-
|
|
38085
|
+
const formValues = watch();
|
|
38086
|
+
const formFieldsConfig = useFieldsConfig(config, formConfig, resourceId);
|
|
38087
|
+
const fields = formFieldsConfig == null ? void 0 : formFieldsConfig.map((fieldConfig) => {
|
|
38088
|
+
var _a;
|
|
38089
|
+
const isDisplay = ((_a = fieldConfig.condition) == null ? void 0 : _a.call(fieldConfig, formValues, lodashEs.get(formValues, fieldConfig.path.join(".")))) !== false;
|
|
38090
|
+
return isDisplay ? /* @__PURE__ */ jsxRuntimeExports.jsx(Controller, {
|
|
37940
38091
|
control,
|
|
37941
|
-
name:
|
|
38092
|
+
name: fieldConfig.path.join("."),
|
|
37942
38093
|
rules: {
|
|
37943
38094
|
validate(value2) {
|
|
37944
38095
|
const formValue = getValues();
|
|
37945
|
-
if (!
|
|
38096
|
+
if (!fieldConfig.validators || fieldConfig.validators.length === 0)
|
|
37946
38097
|
return true;
|
|
37947
|
-
for (const func of
|
|
38098
|
+
for (const func of fieldConfig.validators) {
|
|
37948
38099
|
const {
|
|
37949
38100
|
isValid,
|
|
37950
38101
|
errorMsg
|
|
37951
|
-
} = func(value2, formValue);
|
|
38102
|
+
} = func(value2, formValue, FormType.FORM);
|
|
37952
38103
|
if (!isValid)
|
|
37953
38104
|
return errorMsg;
|
|
37954
38105
|
}
|
|
@@ -37956,79 +38107,42 @@ WARNING: This link could potentially be dangerous`)) {
|
|
|
37956
38107
|
}
|
|
37957
38108
|
},
|
|
37958
38109
|
render: ({
|
|
37959
|
-
field
|
|
37960
|
-
onChange,
|
|
37961
|
-
onBlur,
|
|
37962
|
-
value: value2,
|
|
37963
|
-
name: name2
|
|
37964
|
-
},
|
|
38110
|
+
field,
|
|
37965
38111
|
fieldState
|
|
37966
38112
|
}) => {
|
|
37967
|
-
var
|
|
37968
|
-
const
|
|
37969
|
-
|
|
37970
|
-
|
|
37971
|
-
|
|
37972
|
-
|
|
37973
|
-
|
|
37974
|
-
|
|
37975
|
-
|
|
37976
|
-
|
|
37977
|
-
|
|
37978
|
-
|
|
37979
|
-
|
|
37980
|
-
switch (c2.type) {
|
|
37981
|
-
case "number":
|
|
37982
|
-
ele = /* @__PURE__ */ jsxRuntimeExports.jsx(eagle.Fields.Integer, {
|
|
37983
|
-
className: "c154n7ie",
|
|
37984
|
-
placeholder: c2.placeholder,
|
|
37985
|
-
input: {
|
|
37986
|
-
value: value2,
|
|
37987
|
-
onChange,
|
|
37988
|
-
onBlur,
|
|
37989
|
-
name: name2,
|
|
37990
|
-
onFocus: () => null
|
|
37991
|
-
},
|
|
37992
|
-
meta: {}
|
|
37993
|
-
});
|
|
37994
|
-
}
|
|
37995
|
-
if (action === "edit" && c2.disabledWhenEdit) {
|
|
37996
|
-
ele = /* @__PURE__ */ jsxRuntimeExports.jsx("div", {
|
|
37997
|
-
children: value2
|
|
37998
|
-
});
|
|
37999
|
-
}
|
|
38000
|
-
if (c2 == null ? void 0 : c2.render) {
|
|
38001
|
-
ele = c2.render(value2, onChange, formValue, onBlur, action, control);
|
|
38002
|
-
}
|
|
38003
|
-
if (c2.helperText) {
|
|
38004
|
-
ele = /* @__PURE__ */ jsxRuntimeExports.jsxs(eagle.Space, {
|
|
38005
|
-
size: 4,
|
|
38006
|
-
direction: "vertical",
|
|
38007
|
-
className: "c1c9j4da",
|
|
38008
|
-
children: [ele, /* @__PURE__ */ jsxRuntimeExports.jsx("div", {
|
|
38009
|
-
className: cx_default(eagle.Typo.Footnote.f2_regular, "cjxv8cf"),
|
|
38010
|
-
children: c2.helperText
|
|
38011
|
-
})]
|
|
38012
|
-
});
|
|
38113
|
+
var _a2;
|
|
38114
|
+
const renderProps = {
|
|
38115
|
+
field,
|
|
38116
|
+
fieldConfig,
|
|
38117
|
+
action,
|
|
38118
|
+
control,
|
|
38119
|
+
trigger
|
|
38120
|
+
};
|
|
38121
|
+
let ele = null;
|
|
38122
|
+
if (fieldConfig == null ? void 0 : fieldConfig.render) {
|
|
38123
|
+
ele = fieldConfig.render(renderProps);
|
|
38124
|
+
} else {
|
|
38125
|
+
ele = renderCommonFormFiled(renderProps);
|
|
38013
38126
|
}
|
|
38014
38127
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(eagle.Form.Item, {
|
|
38015
|
-
label:
|
|
38128
|
+
label: fieldConfig.label,
|
|
38016
38129
|
colon: false,
|
|
38017
38130
|
labelCol: {
|
|
38018
|
-
flex: `0 0 ${(
|
|
38131
|
+
flex: `0 0 ${(formConfig == null ? void 0 : formConfig.labelWidth) || "216px"}`
|
|
38019
38132
|
},
|
|
38020
|
-
help: (
|
|
38133
|
+
help: (_a2 = fieldState.error) == null ? void 0 : _a2.message,
|
|
38134
|
+
extra: fieldConfig.helperText,
|
|
38021
38135
|
validateStatus: fieldState.invalid ? "error" : void 0,
|
|
38022
|
-
"data-test-id":
|
|
38136
|
+
"data-test-id": fieldConfig.key,
|
|
38023
38137
|
children: ele
|
|
38024
|
-
},
|
|
38138
|
+
}, fieldConfig.key);
|
|
38025
38139
|
}
|
|
38026
|
-
},
|
|
38140
|
+
}, fieldConfig.key) : null;
|
|
38027
38141
|
});
|
|
38028
38142
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs(eagle.Space, {
|
|
38029
38143
|
direction: "vertical",
|
|
38030
38144
|
size: 16,
|
|
38031
|
-
className: "
|
|
38145
|
+
className: "c1c9j4da",
|
|
38032
38146
|
children: [fields, /* @__PURE__ */ jsxRuntimeExports.jsx(FormErrorAlert, {
|
|
38033
38147
|
errorMsgs: errorMsgs || [],
|
|
38034
38148
|
style: {
|
|
@@ -38639,7 +38753,7 @@ WARNING: This link could potentially be dangerous`)) {
|
|
|
38639
38753
|
});
|
|
38640
38754
|
return () => subscription.unsubscribe();
|
|
38641
38755
|
}, [watch]);
|
|
38642
|
-
const onValuesChange = (changeValues) => {
|
|
38756
|
+
const onValuesChange = React.useCallback((changeValues) => {
|
|
38643
38757
|
var _a;
|
|
38644
38758
|
if (warnWhenUnsavedChanges) {
|
|
38645
38759
|
setWarnWhen(true);
|
|
@@ -38653,20 +38767,22 @@ WARNING: This link could potentially be dangerous`)) {
|
|
|
38653
38767
|
return onFinishAutoSave(changeValues);
|
|
38654
38768
|
}
|
|
38655
38769
|
return changeValues;
|
|
38656
|
-
};
|
|
38657
|
-
const handleSubmit = (onValid, onInvalid) => async (e2) => {
|
|
38770
|
+
}, [warnWhenUnsavedChanges, refineCoreProps == null ? void 0 : refineCoreProps.autoSave, setWarnWhen, onFinishAutoSave]);
|
|
38771
|
+
const handleSubmit = React.useCallback((onValid, onInvalid) => async (e2) => {
|
|
38658
38772
|
setWarnWhen(false);
|
|
38659
38773
|
return handleSubmitReactHookForm(onValid, onInvalid)(e2);
|
|
38660
|
-
};
|
|
38661
|
-
const saveButtonProps = {
|
|
38662
|
-
|
|
38663
|
-
|
|
38664
|
-
|
|
38665
|
-
(
|
|
38666
|
-
|
|
38667
|
-
|
|
38668
|
-
|
|
38669
|
-
|
|
38774
|
+
}, [handleSubmitReactHookForm, setWarnWhen]);
|
|
38775
|
+
const saveButtonProps = React.useMemo(() => {
|
|
38776
|
+
return {
|
|
38777
|
+
disabled: formLoading,
|
|
38778
|
+
onClick: (e2) => {
|
|
38779
|
+
handleSubmit(
|
|
38780
|
+
(v) => onFinish(transformApplyValues ? transformApplyValues(v) : v),
|
|
38781
|
+
() => false
|
|
38782
|
+
)(e2);
|
|
38783
|
+
}
|
|
38784
|
+
};
|
|
38785
|
+
}, [formLoading, handleSubmit, onFinish, transformApplyValues]);
|
|
38670
38786
|
return {
|
|
38671
38787
|
...useHookFormResult,
|
|
38672
38788
|
handleSubmit,
|
|
@@ -38675,8 +38791,12 @@ WARNING: This link could potentially be dangerous`)) {
|
|
|
38675
38791
|
};
|
|
38676
38792
|
};
|
|
38677
38793
|
const useRefineForm = (props) => {
|
|
38678
|
-
|
|
38679
|
-
const {
|
|
38794
|
+
const { formConfig, config, id, refineProps } = props;
|
|
38795
|
+
const { transformInitValues, transformApplyValues } = usePathMap({
|
|
38796
|
+
pathMap: formConfig == null ? void 0 : formConfig.pathMap,
|
|
38797
|
+
transformInitValues: formConfig == null ? void 0 : formConfig.transformInitValues,
|
|
38798
|
+
transformApplyValues: formConfig == null ? void 0 : formConfig.transformApplyValues
|
|
38799
|
+
});
|
|
38680
38800
|
const [responseErrorMsgs, setResponseErrorMsgs] = React.useState([]);
|
|
38681
38801
|
const { i18n: i18n2 } = useTranslation();
|
|
38682
38802
|
const result = useForm({
|
|
@@ -38685,14 +38805,14 @@ WARNING: This link could potentially be dangerous`)) {
|
|
|
38685
38805
|
refineCoreProps: {
|
|
38686
38806
|
errorNotification: false,
|
|
38687
38807
|
successNotification: () => {
|
|
38688
|
-
var
|
|
38808
|
+
var _a;
|
|
38689
38809
|
const formValue = result.getValues();
|
|
38690
38810
|
return {
|
|
38691
38811
|
message: i18n2.t(
|
|
38692
38812
|
id ? "dovetail.edit_resource_success" : "dovetail.create_success_toast",
|
|
38693
38813
|
{
|
|
38694
38814
|
kind: transformResourceKindInSentence(config.displayName || config.kind, i18n2.language),
|
|
38695
|
-
name: (
|
|
38815
|
+
name: (_a = formValue.metadata) == null ? void 0 : _a.name,
|
|
38696
38816
|
interpolation: { escapeValue: false }
|
|
38697
38817
|
}
|
|
38698
38818
|
).trim(),
|
|
@@ -38707,20 +38827,20 @@ WARNING: This link could potentially be dangerous`)) {
|
|
|
38707
38827
|
...refineProps
|
|
38708
38828
|
},
|
|
38709
38829
|
defaultValues: config == null ? void 0 : config.initValue,
|
|
38710
|
-
transformApplyValues
|
|
38711
|
-
transformInitValues
|
|
38712
|
-
...
|
|
38830
|
+
transformApplyValues,
|
|
38831
|
+
transformInitValues,
|
|
38832
|
+
...formConfig == null ? void 0 : formConfig.useFormProps
|
|
38713
38833
|
});
|
|
38714
38834
|
React.useEffect(() => {
|
|
38715
|
-
var
|
|
38716
|
-
const response = (
|
|
38835
|
+
var _a, _b;
|
|
38836
|
+
const response = (_a = result.refineCore.mutationResult.error) == null ? void 0 : _a.response;
|
|
38717
38837
|
if (response && !(response == null ? void 0 : response.bodyUsed)) {
|
|
38718
|
-
(
|
|
38719
|
-
var
|
|
38720
|
-
setResponseErrorMsgs([].concat(((
|
|
38838
|
+
(_b = response.json) == null ? void 0 : _b.call(response).then((body) => {
|
|
38839
|
+
var _a2;
|
|
38840
|
+
setResponseErrorMsgs([].concat(((_a2 = formConfig == null ? void 0 : formConfig.formatError) == null ? void 0 : _a2.call(formConfig, body)) || getCommonErrors(body, i18n2)));
|
|
38721
38841
|
});
|
|
38722
38842
|
}
|
|
38723
|
-
}, [
|
|
38843
|
+
}, [formConfig, result, i18n2]);
|
|
38724
38844
|
return { formResult: result, responseErrorMsgs };
|
|
38725
38845
|
};
|
|
38726
38846
|
const index_2ivb33 = "";
|
|
@@ -39105,7 +39225,6 @@ WARNING: This link could potentially be dangerous`)) {
|
|
|
39105
39225
|
var _a;
|
|
39106
39226
|
const editor = React.useRef(null);
|
|
39107
39227
|
const { t: t2 } = useTranslation();
|
|
39108
|
-
const [enableEditor, setEnableEditor] = React.useState(false);
|
|
39109
39228
|
const [isYamlValid, setIsYamlValid] = React.useState(true);
|
|
39110
39229
|
const [isSchemaValid, setIsSchemaValid] = React.useState(true);
|
|
39111
39230
|
const [editorErrors, setEditorErrors] = React.useState([]);
|
|
@@ -39179,36 +39298,9 @@ WARNING: This link could potentially be dangerous`)) {
|
|
|
39179
39298
|
const finalErrors = React.useMemo(() => {
|
|
39180
39299
|
return lodashEs.uniq([...editorErrors, ...rulesErrors]);
|
|
39181
39300
|
}, [editorErrors, rulesErrors]);
|
|
39182
|
-
const
|
|
39183
|
-
|
|
39184
|
-
|
|
39185
|
-
}
|
|
39186
|
-
};
|
|
39187
|
-
const onValuesChange = (changeValues) => {
|
|
39188
|
-
if (changeValues && warnWhenUnsavedChanges) {
|
|
39189
|
-
setWarnWhen(true);
|
|
39190
|
-
}
|
|
39191
|
-
return changeValues;
|
|
39192
|
-
};
|
|
39193
|
-
const validateYaml = (yamlValue) => {
|
|
39194
|
-
const errorMap = {};
|
|
39195
|
-
if (rules && isYamlValid && isSchemaValid) {
|
|
39196
|
-
const formValue = yaml$2.load(yamlValue || "");
|
|
39197
|
-
rules.forEach((rule2) => {
|
|
39198
|
-
const { path: path2, validators } = rule2;
|
|
39199
|
-
const value2 = lodashEs.get(formValue, path2);
|
|
39200
|
-
for (const validator of validators || []) {
|
|
39201
|
-
const { isValid, errorMsg } = validator(value2, formValue);
|
|
39202
|
-
if (!isValid) {
|
|
39203
|
-
errorMap[path2.join(".")] = `${errorMsg}(${path2.join(".")})`;
|
|
39204
|
-
break;
|
|
39205
|
-
}
|
|
39206
|
-
}
|
|
39207
|
-
});
|
|
39208
|
-
}
|
|
39209
|
-
setRulesErrors(lodashEs.uniq(Object.values(errorMap)));
|
|
39210
|
-
return errorMap;
|
|
39211
|
-
};
|
|
39301
|
+
const schemas = React.useMemo(() => {
|
|
39302
|
+
return schema ? [schema] : [];
|
|
39303
|
+
}, [schema]);
|
|
39212
39304
|
const saveButtonProps = React.useMemo(
|
|
39213
39305
|
() => ({
|
|
39214
39306
|
loading: formLoading,
|
|
@@ -39218,15 +39310,15 @@ WARNING: This link could potentially be dangerous`)) {
|
|
|
39218
39310
|
}),
|
|
39219
39311
|
[formLoading, form2]
|
|
39220
39312
|
);
|
|
39221
|
-
const
|
|
39222
|
-
return
|
|
39223
|
-
}, [
|
|
39313
|
+
const emptySchemas = React.useMemo(() => {
|
|
39314
|
+
return [];
|
|
39315
|
+
}, []);
|
|
39224
39316
|
const editorProps = React.useMemo(() => {
|
|
39225
39317
|
var _a2;
|
|
39226
39318
|
return {
|
|
39227
39319
|
ref: editor,
|
|
39228
39320
|
defaultValue: schema && (editorOptions == null ? void 0 : editorOptions.isGenerateAnnotations) ? generateYamlBySchema(initialValues || {}, schema) : yaml$2.dump(initialValues),
|
|
39229
|
-
schemas,
|
|
39321
|
+
schemas: schemas || emptySchemas,
|
|
39230
39322
|
id: ((_a2 = useResourceResult.resource) == null ? void 0 : _a2.name) || "",
|
|
39231
39323
|
errorMsgs: finalErrors,
|
|
39232
39324
|
onValidate(yamlValid, schemaValid) {
|
|
@@ -39248,6 +39340,7 @@ WARNING: This link could potentially be dangerous`)) {
|
|
|
39248
39340
|
};
|
|
39249
39341
|
}, [
|
|
39250
39342
|
schema,
|
|
39343
|
+
emptySchemas,
|
|
39251
39344
|
editorOptions == null ? void 0 : editorOptions.isGenerateAnnotations,
|
|
39252
39345
|
initialValues,
|
|
39253
39346
|
schemas,
|
|
@@ -39256,6 +39349,36 @@ WARNING: This link could potentially be dangerous`)) {
|
|
|
39256
39349
|
finalErrors,
|
|
39257
39350
|
fold2
|
|
39258
39351
|
]);
|
|
39352
|
+
const onKeyUp = (event2) => {
|
|
39353
|
+
if (submitOnEnter && event2.key === "Enter") {
|
|
39354
|
+
form2.submit();
|
|
39355
|
+
}
|
|
39356
|
+
};
|
|
39357
|
+
const onValuesChange = (changeValues) => {
|
|
39358
|
+
if (changeValues && warnWhenUnsavedChanges) {
|
|
39359
|
+
setWarnWhen(true);
|
|
39360
|
+
}
|
|
39361
|
+
return changeValues;
|
|
39362
|
+
};
|
|
39363
|
+
const validateRules = (yamlValue) => {
|
|
39364
|
+
const errorMap = {};
|
|
39365
|
+
if (rules && isYamlValid && isSchemaValid) {
|
|
39366
|
+
const formValue = yaml$2.load(yamlValue || "");
|
|
39367
|
+
rules.forEach((rule2) => {
|
|
39368
|
+
const { path: path2, validators } = rule2;
|
|
39369
|
+
const value2 = lodashEs.get(formValue, path2);
|
|
39370
|
+
for (const validator of validators || []) {
|
|
39371
|
+
const { isValid, errorMsg } = validator(value2, formValue, FormType.YAML);
|
|
39372
|
+
if (!isValid) {
|
|
39373
|
+
errorMap[path2.join(".")] = `${errorMsg}(${path2.join(".")})`;
|
|
39374
|
+
break;
|
|
39375
|
+
}
|
|
39376
|
+
}
|
|
39377
|
+
});
|
|
39378
|
+
}
|
|
39379
|
+
setRulesErrors(lodashEs.uniq(Object.values(errorMap)));
|
|
39380
|
+
return errorMap;
|
|
39381
|
+
};
|
|
39259
39382
|
return {
|
|
39260
39383
|
form: formSF.form,
|
|
39261
39384
|
formProps: {
|
|
@@ -39271,7 +39394,7 @@ WARNING: This link could potentially be dangerous`)) {
|
|
|
39271
39394
|
setRulesErrors([]);
|
|
39272
39395
|
return;
|
|
39273
39396
|
}
|
|
39274
|
-
const rulesErrors2 =
|
|
39397
|
+
const rulesErrors2 = validateRules(((_a2 = editor.current) == null ? void 0 : _a2.getEditorValue()) || "");
|
|
39275
39398
|
if (Object.keys(rulesErrors2).length) {
|
|
39276
39399
|
setRulesErrors(Object.values(rulesErrors2));
|
|
39277
39400
|
return;
|
|
@@ -39297,26 +39420,12 @@ WARNING: This link could potentially be dangerous`)) {
|
|
|
39297
39420
|
},
|
|
39298
39421
|
saveButtonProps,
|
|
39299
39422
|
...useFormCoreResult,
|
|
39300
|
-
editorProps,
|
|
39301
|
-
enableEditor,
|
|
39302
39423
|
errorResponseBody,
|
|
39424
|
+
editorProps,
|
|
39303
39425
|
schemas: schema ? [schema] : [],
|
|
39304
39426
|
isLoadingSchema,
|
|
39305
39427
|
loadSchemaError,
|
|
39306
|
-
fetchSchema
|
|
39307
|
-
switchEditor() {
|
|
39308
|
-
var _a2, _b;
|
|
39309
|
-
if (enableEditor && ((_a2 = editor.current) == null ? void 0 : _a2.getEditorValue())) {
|
|
39310
|
-
const value2 = yaml$2.load((_b = editor.current) == null ? void 0 : _b.getEditorValue());
|
|
39311
|
-
form2 == null ? void 0 : form2.setFieldsValue(value2);
|
|
39312
|
-
}
|
|
39313
|
-
setEnableEditor(!enableEditor);
|
|
39314
|
-
},
|
|
39315
|
-
onFinish: async (values) => {
|
|
39316
|
-
var _a2;
|
|
39317
|
-
const finalValues = enableEditor ? yaml$2.load(((_a2 = editor.current) == null ? void 0 : _a2.getEditorValue()) || "") : values ?? formSF.form.getFieldsValue(true);
|
|
39318
|
-
return await onFinish(finalValues);
|
|
39319
|
-
}
|
|
39428
|
+
fetchSchema
|
|
39320
39429
|
};
|
|
39321
39430
|
};
|
|
39322
39431
|
const YamlForm_1lo4xcc = "";
|
|
@@ -39335,6 +39444,7 @@ WARNING: This link could potentially be dangerous`)) {
|
|
|
39335
39444
|
schemaStrategy = "Optional",
|
|
39336
39445
|
isShowLayout = true,
|
|
39337
39446
|
useFormProps,
|
|
39447
|
+
config,
|
|
39338
39448
|
transformInitValues,
|
|
39339
39449
|
transformApplyValues,
|
|
39340
39450
|
onSaveButtonPropsChange,
|
|
@@ -39346,8 +39456,6 @@ WARNING: This link could potentially be dangerous`)) {
|
|
|
39346
39456
|
resource
|
|
39347
39457
|
} = core.useResource();
|
|
39348
39458
|
const action = actionFromProps || actionFromResource;
|
|
39349
|
-
const configs = React.useContext(ConfigsContext);
|
|
39350
|
-
const config = configs[(resource == null ? void 0 : resource.name) || ""];
|
|
39351
39459
|
const {
|
|
39352
39460
|
t: t2,
|
|
39353
39461
|
i18n: i18n2
|
|
@@ -39398,9 +39506,6 @@ WARNING: This link could potentially be dangerous`)) {
|
|
|
39398
39506
|
const formWrapperProps = isShowLayout ? {
|
|
39399
39507
|
saveButtonProps
|
|
39400
39508
|
} : {};
|
|
39401
|
-
const schemas = React.useMemo(() => {
|
|
39402
|
-
return editorProps.schemas || [];
|
|
39403
|
-
}, [editorProps.schemas]);
|
|
39404
39509
|
const responseErrors = React.useMemo(() => errorResponseBody ? getCommonErrors(errorResponseBody, i18n2) : [], [errorResponseBody, i18n2]);
|
|
39405
39510
|
const onFinish = React.useCallback(async (store) => {
|
|
39406
39511
|
var _a, _b;
|
|
@@ -39443,7 +39548,6 @@ WARNING: This link could potentially be dangerous`)) {
|
|
|
39443
39548
|
children: /* @__PURE__ */ jsxRuntimeExports.jsx(YamlEditorComponent, {
|
|
39444
39549
|
...editorProps,
|
|
39445
39550
|
className: EditorStyle,
|
|
39446
|
-
schemas,
|
|
39447
39551
|
collapsable: false
|
|
39448
39552
|
})
|
|
39449
39553
|
}), /* @__PURE__ */ jsxRuntimeExports.jsx(eagle.Form.Item, {
|
|
@@ -39463,6 +39567,172 @@ WARNING: This link could potentially be dangerous`)) {
|
|
|
39463
39567
|
})
|
|
39464
39568
|
});
|
|
39465
39569
|
}
|
|
39570
|
+
function RefineFormContainer({
|
|
39571
|
+
id,
|
|
39572
|
+
config,
|
|
39573
|
+
customYamlFormProps,
|
|
39574
|
+
formConfig,
|
|
39575
|
+
isYamlMode,
|
|
39576
|
+
onSuccess,
|
|
39577
|
+
onError,
|
|
39578
|
+
onSaveButtonPropsChange
|
|
39579
|
+
}) {
|
|
39580
|
+
const action = id ? "edit" : "create";
|
|
39581
|
+
const fieldsConfig = useFieldsConfig(config, formConfig, id);
|
|
39582
|
+
const refineFormResult = useRefineForm({
|
|
39583
|
+
config,
|
|
39584
|
+
id,
|
|
39585
|
+
refineProps: {
|
|
39586
|
+
onMutationSuccess: () => {
|
|
39587
|
+
onSuccess == null ? void 0 : onSuccess();
|
|
39588
|
+
},
|
|
39589
|
+
onMutationError() {
|
|
39590
|
+
onError == null ? void 0 : onError();
|
|
39591
|
+
},
|
|
39592
|
+
redirect: false,
|
|
39593
|
+
...formConfig == null ? void 0 : formConfig.refineCoreProps
|
|
39594
|
+
},
|
|
39595
|
+
formConfig
|
|
39596
|
+
});
|
|
39597
|
+
const {
|
|
39598
|
+
transformApplyValues
|
|
39599
|
+
} = usePathMap({
|
|
39600
|
+
pathMap: formConfig == null ? void 0 : formConfig.pathMap,
|
|
39601
|
+
transformInitValues: formConfig == null ? void 0 : formConfig.transformInitValues,
|
|
39602
|
+
transformApplyValues: (formConfig == null ? void 0 : formConfig.transformApplyValues) || ((v) => v)
|
|
39603
|
+
});
|
|
39604
|
+
const yamlFormProps = React.useMemo(() => {
|
|
39605
|
+
if (isYamlMode) {
|
|
39606
|
+
return {
|
|
39607
|
+
...customYamlFormProps,
|
|
39608
|
+
config,
|
|
39609
|
+
transformInitValues: void 0,
|
|
39610
|
+
transformApplyValues: void 0,
|
|
39611
|
+
initialValuesForCreate: transformApplyValues(
|
|
39612
|
+
refineFormResult.formResult.getValues()
|
|
39613
|
+
),
|
|
39614
|
+
initialValuesForEdit: transformApplyValues(refineFormResult.formResult.getValues()),
|
|
39615
|
+
id,
|
|
39616
|
+
action,
|
|
39617
|
+
isShowLayout: false,
|
|
39618
|
+
useFormProps: {
|
|
39619
|
+
redirect: false
|
|
39620
|
+
},
|
|
39621
|
+
rules: fieldsConfig == null ? void 0 : fieldsConfig.map((config2) => ({
|
|
39622
|
+
path: config2.path,
|
|
39623
|
+
validators: config2.validators
|
|
39624
|
+
})),
|
|
39625
|
+
onSaveButtonPropsChange,
|
|
39626
|
+
onErrorsChange(errors) {
|
|
39627
|
+
if (errors.length) {
|
|
39628
|
+
onError == null ? void 0 : onError();
|
|
39629
|
+
}
|
|
39630
|
+
},
|
|
39631
|
+
onFinish: onSuccess
|
|
39632
|
+
};
|
|
39633
|
+
}
|
|
39634
|
+
return {
|
|
39635
|
+
config
|
|
39636
|
+
};
|
|
39637
|
+
}, [
|
|
39638
|
+
action,
|
|
39639
|
+
isYamlMode,
|
|
39640
|
+
customYamlFormProps,
|
|
39641
|
+
fieldsConfig,
|
|
39642
|
+
config,
|
|
39643
|
+
id,
|
|
39644
|
+
refineFormResult,
|
|
39645
|
+
transformApplyValues,
|
|
39646
|
+
onSaveButtonPropsChange,
|
|
39647
|
+
onSuccess,
|
|
39648
|
+
onError
|
|
39649
|
+
]);
|
|
39650
|
+
React.useEffect(() => {
|
|
39651
|
+
if (!isYamlMode) {
|
|
39652
|
+
onSaveButtonPropsChange == null ? void 0 : onSaveButtonPropsChange(refineFormResult.formResult.saveButtonProps);
|
|
39653
|
+
}
|
|
39654
|
+
}, [isYamlMode, refineFormResult.formResult.saveButtonProps, onSaveButtonPropsChange]);
|
|
39655
|
+
if (isYamlMode) {
|
|
39656
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(YamlForm, { ...yamlFormProps });
|
|
39657
|
+
}
|
|
39658
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
|
|
39659
|
+
!(formConfig == null ? void 0 : formConfig.isDisabledChangeMode) ? /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
39660
|
+
eagle.Alert,
|
|
39661
|
+
{
|
|
39662
|
+
type: "warning",
|
|
39663
|
+
message: i18n.t("dovetail.change_form_mode_alert"),
|
|
39664
|
+
style: { marginBottom: "16px" }
|
|
39665
|
+
}
|
|
39666
|
+
) : void 0,
|
|
39667
|
+
(formConfig == null ? void 0 : formConfig.renderForm) ? formConfig == null ? void 0 : formConfig.renderForm() : /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
39668
|
+
RefineFormContent,
|
|
39669
|
+
{
|
|
39670
|
+
formResult: refineFormResult.formResult,
|
|
39671
|
+
config,
|
|
39672
|
+
formConfig,
|
|
39673
|
+
errorMsgs: refineFormResult.responseErrorMsgs,
|
|
39674
|
+
resourceId: id
|
|
39675
|
+
}
|
|
39676
|
+
)
|
|
39677
|
+
] });
|
|
39678
|
+
}
|
|
39679
|
+
function YamlFormContainer({
|
|
39680
|
+
id,
|
|
39681
|
+
customYamlFormProps,
|
|
39682
|
+
config,
|
|
39683
|
+
formConfig,
|
|
39684
|
+
onSuccess,
|
|
39685
|
+
onError,
|
|
39686
|
+
onSaveButtonPropsChange
|
|
39687
|
+
}) {
|
|
39688
|
+
const action = id ? "edit" : "create";
|
|
39689
|
+
const {
|
|
39690
|
+
transformInitValues,
|
|
39691
|
+
transformApplyValues
|
|
39692
|
+
} = usePathMap({
|
|
39693
|
+
pathMap: formConfig == null ? void 0 : formConfig.pathMap,
|
|
39694
|
+
transformInitValues: formConfig == null ? void 0 : formConfig.transformInitValues,
|
|
39695
|
+
transformApplyValues: (formConfig == null ? void 0 : formConfig.transformApplyValues) || ((v) => v)
|
|
39696
|
+
});
|
|
39697
|
+
const yamlFormProps = React.useMemo(
|
|
39698
|
+
() => {
|
|
39699
|
+
return {
|
|
39700
|
+
...customYamlFormProps,
|
|
39701
|
+
config,
|
|
39702
|
+
transformInitValues,
|
|
39703
|
+
transformApplyValues,
|
|
39704
|
+
initialValuesForCreate: (customYamlFormProps == null ? void 0 : customYamlFormProps.initialValuesForCreate) || config.initValue,
|
|
39705
|
+
initialValuesForEdit: void 0,
|
|
39706
|
+
id,
|
|
39707
|
+
action,
|
|
39708
|
+
isShowLayout: false,
|
|
39709
|
+
useFormProps: {
|
|
39710
|
+
redirect: false
|
|
39711
|
+
},
|
|
39712
|
+
rules: void 0,
|
|
39713
|
+
onSaveButtonPropsChange,
|
|
39714
|
+
onErrorsChange(errors) {
|
|
39715
|
+
if (errors.length) {
|
|
39716
|
+
onError == null ? void 0 : onError();
|
|
39717
|
+
}
|
|
39718
|
+
},
|
|
39719
|
+
onFinish: onSuccess
|
|
39720
|
+
};
|
|
39721
|
+
},
|
|
39722
|
+
[
|
|
39723
|
+
id,
|
|
39724
|
+
action,
|
|
39725
|
+
customYamlFormProps,
|
|
39726
|
+
config,
|
|
39727
|
+
transformInitValues,
|
|
39728
|
+
transformApplyValues,
|
|
39729
|
+
onSuccess,
|
|
39730
|
+
onError,
|
|
39731
|
+
onSaveButtonPropsChange
|
|
39732
|
+
]
|
|
39733
|
+
);
|
|
39734
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(YamlForm, { ...yamlFormProps });
|
|
39735
|
+
}
|
|
39466
39736
|
const FormModal_64brhp = "";
|
|
39467
39737
|
const FormDescStyle = "f1nltbcu";
|
|
39468
39738
|
const ErrorStyle = "e1qgcca6";
|
|
@@ -39496,11 +39766,11 @@ WARNING: This link could potentially be dangerous`)) {
|
|
|
39496
39766
|
});
|
|
39497
39767
|
}
|
|
39498
39768
|
function FormModal(props) {
|
|
39499
|
-
var _a, _b, _c
|
|
39769
|
+
var _a, _b, _c;
|
|
39500
39770
|
const {
|
|
39501
39771
|
resource: resourceFromProps,
|
|
39502
39772
|
id,
|
|
39503
|
-
|
|
39773
|
+
yamlFormProps: customYamlFormProps
|
|
39504
39774
|
} = props;
|
|
39505
39775
|
const {
|
|
39506
39776
|
i18n: i18n2
|
|
@@ -39509,74 +39779,17 @@ WARNING: This link could potentially be dangerous`)) {
|
|
|
39509
39779
|
resource
|
|
39510
39780
|
} = core.useResource();
|
|
39511
39781
|
const configs = React.useContext(ConfigsContext);
|
|
39512
|
-
const [
|
|
39782
|
+
const [saveButtonProps, setSaveButtonProps] = React.useState({});
|
|
39513
39783
|
const [isError, setIsError] = React.useState(false);
|
|
39514
|
-
const [mode, setMode] = React.useState(
|
|
39515
|
-
|
|
39516
|
-
/* Form */
|
|
39517
|
-
);
|
|
39518
|
-
const isYamlMode = mode === "yaml";
|
|
39784
|
+
const [mode, setMode] = React.useState(FormMode.FORM);
|
|
39785
|
+
const isYamlMode = mode === FormMode.YAML;
|
|
39519
39786
|
const popModal = eagle.usePopModal();
|
|
39520
39787
|
const pushModal = eagle.usePushModal();
|
|
39521
39788
|
const config = configs[resourceFromProps || (resource == null ? void 0 : resource.name) || ""];
|
|
39522
|
-
const isDisabledChangeMode =
|
|
39789
|
+
const isDisabledChangeMode = config.formConfig && "isDisabledChangeMode" in config.formConfig && config.formConfig.isDisabledChangeMode;
|
|
39523
39790
|
const okText = i18n2.t(id ? "dovetail.save" : "dovetail.create");
|
|
39524
39791
|
const action = id ? "edit" : "create";
|
|
39525
|
-
const
|
|
39526
|
-
const refineFormResult = useRefineForm({
|
|
39527
|
-
config,
|
|
39528
|
-
id,
|
|
39529
|
-
refineProps: {
|
|
39530
|
-
onMutationSuccess: () => {
|
|
39531
|
-
popModal();
|
|
39532
|
-
},
|
|
39533
|
-
redirect: false,
|
|
39534
|
-
...(_b = config.formConfig) == null ? void 0 : _b.refineCoreProps
|
|
39535
|
-
}
|
|
39536
|
-
});
|
|
39537
|
-
const yamlFormProps = React.useMemo(() => {
|
|
39538
|
-
var _a2, _b2, _c2;
|
|
39539
|
-
const transformApplyValues = ((_a2 = config.formConfig) == null ? void 0 : _a2.transformApplyValues) || ((v) => v);
|
|
39540
|
-
return {
|
|
39541
|
-
...props.formProps,
|
|
39542
|
-
transformInitValues: isYamlMode ? void 0 : (_b2 = config.formConfig) == null ? void 0 : _b2.transformInitValues,
|
|
39543
|
-
transformApplyValues: isYamlMode ? void 0 : transformApplyValues,
|
|
39544
|
-
initialValuesForCreate: isYamlMode ? transformApplyValues(refineFormResult.formResult.getValues()) : ((_c2 = props.formProps) == null ? void 0 : _c2.initialValuesForCreate) || (config == null ? void 0 : config.initValue),
|
|
39545
|
-
initialValuesForEdit: isYamlMode ? transformApplyValues(refineFormResult.formResult.getValues()) : void 0,
|
|
39546
|
-
id,
|
|
39547
|
-
action,
|
|
39548
|
-
isShowLayout: false,
|
|
39549
|
-
useFormProps: {
|
|
39550
|
-
redirect: false
|
|
39551
|
-
},
|
|
39552
|
-
rules: isYamlMode ? fieldsConfig == null ? void 0 : fieldsConfig.map((config2) => ({
|
|
39553
|
-
path: config2.path,
|
|
39554
|
-
validators: config2.validators
|
|
39555
|
-
})) : void 0,
|
|
39556
|
-
onSaveButtonPropsChange: setYamlSaveButtonProps,
|
|
39557
|
-
onErrorsChange(errors) {
|
|
39558
|
-
setIsError(!!errors.length);
|
|
39559
|
-
},
|
|
39560
|
-
onFinish: popModal
|
|
39561
|
-
};
|
|
39562
|
-
}, [props.formProps, (_c = config.formConfig) == null ? void 0 : _c.transformInitValues, (_d = config.formConfig) == null ? void 0 : _d.transformApplyValues, config == null ? void 0 : config.initValue, id, action, refineFormResult.formResult, isYamlMode, fieldsConfig, popModal]);
|
|
39563
|
-
const isYamlForm = !((_e = config.formConfig) == null ? void 0 : _e.fields);
|
|
39564
|
-
const formEle = (() => {
|
|
39565
|
-
if (renderForm) {
|
|
39566
|
-
return renderForm(yamlFormProps);
|
|
39567
|
-
}
|
|
39568
|
-
if (isYamlForm || isYamlMode)
|
|
39569
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx(YamlForm, {
|
|
39570
|
-
...yamlFormProps
|
|
39571
|
-
});
|
|
39572
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx(RefineFormContent, {
|
|
39573
|
-
formResult: refineFormResult.formResult,
|
|
39574
|
-
config,
|
|
39575
|
-
errorMsgs: refineFormResult.responseErrorMsgs,
|
|
39576
|
-
resourceId: id
|
|
39577
|
-
});
|
|
39578
|
-
})();
|
|
39579
|
-
const saveButtonProps = isYamlForm || isYamlMode ? yamlSaveButtonProps : refineFormResult.formResult.saveButtonProps;
|
|
39792
|
+
const isYamlForm = ((_a = config.formConfig) == null ? void 0 : _a.formType) === FormType.YAML;
|
|
39580
39793
|
const onCancel = React.useCallback(() => {
|
|
39581
39794
|
popModal();
|
|
39582
39795
|
}, [popModal]);
|
|
@@ -39586,15 +39799,12 @@ WARNING: This link could potentially be dangerous`)) {
|
|
|
39586
39799
|
(_a2 = saveButtonProps.onClick) == null ? void 0 : _a2.call(saveButtonProps, e2);
|
|
39587
39800
|
}, [saveButtonProps]);
|
|
39588
39801
|
const onChangeMode = React.useCallback((value2) => {
|
|
39589
|
-
if (value2 ===
|
|
39802
|
+
if (value2 === FormMode.FORM) {
|
|
39590
39803
|
pushModal({
|
|
39591
39804
|
component: ConfirmModal,
|
|
39592
39805
|
props: {
|
|
39593
39806
|
onOk: () => {
|
|
39594
|
-
setMode(
|
|
39595
|
-
"form"
|
|
39596
|
-
/* Form */
|
|
39597
|
-
);
|
|
39807
|
+
setMode(FormMode.FORM);
|
|
39598
39808
|
}
|
|
39599
39809
|
}
|
|
39600
39810
|
});
|
|
@@ -39602,17 +39812,18 @@ WARNING: This link could potentially be dangerous`)) {
|
|
|
39602
39812
|
setMode(value2);
|
|
39603
39813
|
}
|
|
39604
39814
|
}, [pushModal]);
|
|
39605
|
-
const errorText = (() => {
|
|
39606
|
-
if (
|
|
39815
|
+
const errorText = React.useMemo(() => {
|
|
39816
|
+
if (isError) {
|
|
39607
39817
|
return i18n2.t(id ? "dovetail.save_failed" : "dovetail.create_failed");
|
|
39608
39818
|
}
|
|
39609
|
-
|
|
39819
|
+
return "";
|
|
39820
|
+
}, [isError, id, i18n2]);
|
|
39610
39821
|
const title = React.useMemo(() => {
|
|
39611
|
-
var _a2, _b2, _c2,
|
|
39822
|
+
var _a2, _b2, _c2, _d;
|
|
39612
39823
|
if (typeof ((_a2 = config.formConfig) == null ? void 0 : _a2.formTitle) === "string")
|
|
39613
39824
|
return (_b2 = config.formConfig) == null ? void 0 : _b2.formTitle;
|
|
39614
39825
|
if (typeof ((_c2 = config.formConfig) == null ? void 0 : _c2.formTitle) === "function") {
|
|
39615
|
-
return (
|
|
39826
|
+
return (_d = config.formConfig) == null ? void 0 : _d.formTitle(action);
|
|
39616
39827
|
}
|
|
39617
39828
|
const label2 = config.displayName || (config == null ? void 0 : config.kind);
|
|
39618
39829
|
return i18n2.t(id ? "dovetail.edit_resource" : "dovetail.create_resource", {
|
|
@@ -39620,14 +39831,41 @@ WARNING: This link could potentially be dangerous`)) {
|
|
|
39620
39831
|
});
|
|
39621
39832
|
}, [action, config.formConfig, config.displayName, config == null ? void 0 : config.kind, i18n2, id]);
|
|
39622
39833
|
const desc = React.useMemo(() => {
|
|
39623
|
-
var _a2, _b2, _c2,
|
|
39834
|
+
var _a2, _b2, _c2, _d;
|
|
39624
39835
|
if (typeof ((_a2 = config.formConfig) == null ? void 0 : _a2.formDesc) === "string")
|
|
39625
39836
|
return (_b2 = config.formConfig) == null ? void 0 : _b2.formDesc;
|
|
39626
39837
|
if (typeof ((_c2 = config.formConfig) == null ? void 0 : _c2.formDesc) === "function") {
|
|
39627
|
-
return (
|
|
39838
|
+
return (_d = config.formConfig) == null ? void 0 : _d.formDesc(action);
|
|
39628
39839
|
}
|
|
39629
39840
|
return "";
|
|
39630
39841
|
}, [action, config.formConfig]);
|
|
39842
|
+
const formEle = React.useMemo(() => {
|
|
39843
|
+
var _a2;
|
|
39844
|
+
const commonFormProps = {
|
|
39845
|
+
id,
|
|
39846
|
+
config,
|
|
39847
|
+
customYamlFormProps,
|
|
39848
|
+
onSaveButtonPropsChange: setSaveButtonProps,
|
|
39849
|
+
onError: () => {
|
|
39850
|
+
setIsError(true);
|
|
39851
|
+
},
|
|
39852
|
+
onSuccess: () => {
|
|
39853
|
+
setIsError(false);
|
|
39854
|
+
popModal();
|
|
39855
|
+
}
|
|
39856
|
+
};
|
|
39857
|
+
if (config.formConfig && (((_a2 = config.formConfig) == null ? void 0 : _a2.formType) === FormType.FORM || "fields" in config.formConfig)) {
|
|
39858
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(RefineFormContainer, {
|
|
39859
|
+
...commonFormProps,
|
|
39860
|
+
isYamlMode,
|
|
39861
|
+
formConfig: config.formConfig
|
|
39862
|
+
});
|
|
39863
|
+
}
|
|
39864
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(YamlFormContainer, {
|
|
39865
|
+
...commonFormProps,
|
|
39866
|
+
formConfig: config.formConfig
|
|
39867
|
+
});
|
|
39868
|
+
}, [id, customYamlFormProps, config, isYamlMode, popModal, setSaveButtonProps]);
|
|
39631
39869
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs(eagle.Modal, {
|
|
39632
39870
|
className: cx_default(FullscreenModalStyle),
|
|
39633
39871
|
style: {
|
|
@@ -39638,21 +39876,10 @@ WARNING: This link could potentially be dangerous`)) {
|
|
|
39638
39876
|
className: TitleWrapperStyle,
|
|
39639
39877
|
children: [/* @__PURE__ */ jsxRuntimeExports.jsx("span", {
|
|
39640
39878
|
children: title
|
|
39641
|
-
}),
|
|
39642
|
-
|
|
39643
|
-
|
|
39644
|
-
|
|
39645
|
-
value: mode,
|
|
39646
|
-
options: [{
|
|
39647
|
-
value: "form",
|
|
39648
|
-
label: i18n2.t("dovetail.form")
|
|
39649
|
-
}, {
|
|
39650
|
-
value: "yaml",
|
|
39651
|
-
label: i18n2.t("dovetail.yaml")
|
|
39652
|
-
}],
|
|
39653
|
-
onChange: (val) => {
|
|
39654
|
-
onChangeMode(val);
|
|
39655
|
-
}
|
|
39879
|
+
}), ((_b = config.formConfig) == null ? void 0 : _b.formType) === FormType.FORM ? /* @__PURE__ */ jsxRuntimeExports.jsx(FormModeSegmentControl, {
|
|
39880
|
+
formConfig: config.formConfig,
|
|
39881
|
+
mode,
|
|
39882
|
+
onChangeMode
|
|
39656
39883
|
}) : null]
|
|
39657
39884
|
}),
|
|
39658
39885
|
error: errorText ? /* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
|
|
@@ -39661,7 +39888,7 @@ WARNING: This link could potentially be dangerous`)) {
|
|
|
39661
39888
|
}) : "",
|
|
39662
39889
|
okButtonProps: {
|
|
39663
39890
|
...saveButtonProps,
|
|
39664
|
-
children: (
|
|
39891
|
+
children: (_c = config.formConfig) == null ? void 0 : _c.saveButtonText,
|
|
39665
39892
|
onClick: onOk
|
|
39666
39893
|
},
|
|
39667
39894
|
closeIcon: /* @__PURE__ */ jsxRuntimeExports.jsx(CloseCircleFilled$1, {}),
|
|
@@ -39672,12 +39899,6 @@ WARNING: This link could potentially be dangerous`)) {
|
|
|
39672
39899
|
children: [desc ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", {
|
|
39673
39900
|
className: FormDescStyle,
|
|
39674
39901
|
children: desc
|
|
39675
|
-
}) : void 0, !isYamlForm && mode === "form" && !isDisabledChangeMode ? /* @__PURE__ */ jsxRuntimeExports.jsx(eagle.Alert, {
|
|
39676
|
-
type: "warning",
|
|
39677
|
-
message: i18n2.t("dovetail.change_form_mode_alert"),
|
|
39678
|
-
style: {
|
|
39679
|
-
marginBottom: "16px"
|
|
39680
|
-
}
|
|
39681
39902
|
}) : void 0, formEle]
|
|
39682
39903
|
});
|
|
39683
39904
|
}
|
|
@@ -39732,10 +39953,11 @@ WARNING: This link could potentially be dangerous`)) {
|
|
|
39732
39953
|
return {
|
|
39733
39954
|
initialValues: getInitialValues(config),
|
|
39734
39955
|
transformInitValues: (_a2 = config.formConfig) == null ? void 0 : _a2.transformInitValues,
|
|
39735
|
-
transformApplyValues: (_b = config.formConfig) == null ? void 0 : _b.transformApplyValues
|
|
39956
|
+
transformApplyValues: (_b = config.formConfig) == null ? void 0 : _b.transformApplyValues,
|
|
39957
|
+
config
|
|
39736
39958
|
};
|
|
39737
39959
|
}, [config]);
|
|
39738
|
-
if ((_a = config.formConfig) == null ? void 0 : _a.
|
|
39960
|
+
if (((_a = config.formConfig) == null ? void 0 : _a.formType) === FormType.FORM) {
|
|
39739
39961
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(RefineFormPage, { config });
|
|
39740
39962
|
}
|
|
39741
39963
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(YamlForm, { ...formProps });
|
|
@@ -39748,7 +39970,7 @@ WARNING: This link could potentially be dangerous`)) {
|
|
|
39748
39970
|
/* @__PURE__ */ jsxRuntimeExports.jsx(reactRouterDom.Route, { path: `${urlPrefix}/${config.name}`, exact: true, children: /* @__PURE__ */ jsxRuntimeExports.jsx(ResourceList, { config }) }),
|
|
39749
39971
|
!config.noShow ? /* @__PURE__ */ jsxRuntimeExports.jsx(reactRouterDom.Route, { path: `${urlPrefix}/${config.name}/show`, children: /* @__PURE__ */ jsxRuntimeExports.jsx(ResourceShow, { config }) }) : null,
|
|
39750
39972
|
// the modals would render in ModalStack
|
|
39751
|
-
((_a = config.formConfig) == null ? void 0 : _a.
|
|
39973
|
+
((_a = config.formConfig) == null ? void 0 : _a.formContainerType) === FormContainerType.PAGE ? /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
|
|
39752
39974
|
/* @__PURE__ */ jsxRuntimeExports.jsx(reactRouterDom.Route, { path: `${urlPrefix}/${config.name}/create`, children: /* @__PURE__ */ jsxRuntimeExports.jsx(ResourceForm, { config }) }),
|
|
39753
39975
|
/* @__PURE__ */ jsxRuntimeExports.jsx(reactRouterDom.Route, { path: `${urlPrefix}/${config.name}/edit`, children: /* @__PURE__ */ jsxRuntimeExports.jsx(ResourceForm, { config }) })
|
|
39754
39976
|
] }) : null
|
|
@@ -40235,7 +40457,15 @@ WARNING: This link could potentially be dangerous`)) {
|
|
|
40235
40457
|
);
|
|
40236
40458
|
}
|
|
40237
40459
|
const IngressRulesComponent = ({ ingress }) => {
|
|
40238
|
-
const
|
|
40460
|
+
const { data: serviceData } = core.useList({
|
|
40461
|
+
resource: "services",
|
|
40462
|
+
meta: {
|
|
40463
|
+
kind: "Service",
|
|
40464
|
+
apiVersion: "v1"
|
|
40465
|
+
}
|
|
40466
|
+
});
|
|
40467
|
+
const flattenedRules = (serviceData == null ? void 0 : serviceData.data) ? ingress.getFlattenedRules(serviceData == null ? void 0 : serviceData.data) : [];
|
|
40468
|
+
const result = flattenedRules.map((r2) => {
|
|
40239
40469
|
const divider = " > ";
|
|
40240
40470
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
40241
40471
|
eagle.OverflowTooltip,
|
|
@@ -41317,8 +41547,10 @@ WARNING: This link could potentially be dangerous`)) {
|
|
|
41317
41547
|
exports2.EventModel = EventModel;
|
|
41318
41548
|
exports2.EventsTab = EventsTab;
|
|
41319
41549
|
exports2.EventsTableTabField = EventsTableTabField;
|
|
41550
|
+
exports2.FormContainerType = FormContainerType;
|
|
41320
41551
|
exports2.FormErrorAlert = FormErrorAlert;
|
|
41321
41552
|
exports2.FormModal = FormModal;
|
|
41553
|
+
exports2.FormMode = FormMode;
|
|
41322
41554
|
exports2.FormType = FormType;
|
|
41323
41555
|
exports2.GlobalStoreContext = GlobalStoreContext;
|
|
41324
41556
|
exports2.INGRESS_INIT_VALUE = INGRESS_INIT_VALUE;
|
|
@@ -41511,6 +41743,7 @@ WARNING: This link could potentially be dangerous`)) {
|
|
|
41511
41743
|
exports2.namespaceRules = namespaceRules;
|
|
41512
41744
|
exports2.pruneBeforeEdit = pruneBeforeEdit;
|
|
41513
41745
|
exports2.relationPlugin = relationPlugin;
|
|
41746
|
+
exports2.renderCommonFormFiled = renderCommonFormFiled;
|
|
41514
41747
|
exports2.resolveRef = resolveRef;
|
|
41515
41748
|
exports2.rfc1035LabelRules = rfc1035LabelRules;
|
|
41516
41749
|
exports2.rfc1123LabelRules = rfc1123LabelRules;
|