@dovetail-v2/refine 0.1.12 → 0.1.13

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.
@@ -10,8 +10,8 @@ import React__default, { createElement, isValidElement, cloneElement, Children,
10
10
  import { ResourceContext, matchResourceFromRoute, useResource, useDelete, useNavigation, useBreadcrumb, useList, CanAccess, useUpdate, useParsed, useGo, useCan, useTable, useDeleteMany, useShow, useDataProvider, useRefineContext, useTranslate, useWarnAboutChange, useForm as useForm$2, flattenObjectKeys, pickNotDeprecated, useMenu, Refine } from "@refinedev/core";
11
11
  import { parse, stringify } from "qs";
12
12
  import { useLocation, useHistory, useParams, matchPath, Link, Route, NavLink, Router } from "react-router-dom";
13
- import { Typo, Tag, Input, Select, AntdOption, Button, Form, Space, TextArea, kitContext, Loading, Table as Table$2, Pagination, Alert, usePopModal, Modal, usePushModal, Fields, Units, OverflowTooltip, Tooltip, StatusCapsule, Dropdown, Menu as Menu$1, Icon as Icon$1, Divider, Link as Link$1, Tabs as Tabs$1, TabsTabPane, Row, Col, DonutChart, SegmentControl, Checkbox, DropdownMenu, SearchInput, Token, AntdSelectOptGroup, Popover, AntdTable, TableForm, getOptions, MenuItemGroup, Layout as Layout$1, Time as Time$1, useMessage, ModalStack, KitStoreProvider, ConfigProvider } from "@cloudtower/eagle";
14
- import { EditPen16PrimaryIcon, Download16GradientBlueIcon, TrashBinDelete16Icon, MoreEllipsis324BoldSecondaryIcon, MoreEllipsis324BoldBlueIcon, MoreEllipsis316BoldBlueIcon, PlusAddCreateNew16BoldOntintIcon, ArrowChevronLeft16BoldTertiaryIcon, ArrowChevronLeftSmall16BoldBlueIcon, ViewEye16GradientGrayIcon, EntityFilterIgnoreGradient16GrayIcon, RecoverContinue16GradientBlueIcon, SuspendedPause16GradientBlueIcon, Retry16GradientBlueIcon, FontSize16GrayIcon, FontSize16BlueIcon, LogCollection16GrayIcon, LogCollection16GradientBlueIcon, TrashBinDeletePermanently16GrayIcon, TrashBinDeletePermanently16BlueIcon, Loading24GradientBlueIcon, OpenTerminal16GradientBlueIcon, HierarchyTriangleRight16GrayIcon, HierarchyTriangleRight16BlueIcon, ClipboardCopy16GradientGrayIcon, ClipboardCopy16GradientBlueIcon, Retry16GradientGrayIcon, EditPen16GradientGrayIcon, EditPen16GradientBlueIcon, Showdiff16GradientGrayIcon, Showdiff16GradientBlueIcon, XmarkFailedSeriousWarningFill16RedIcon, ExclamationErrorCircleFill16RedIcon, Pause16GradientBlueIcon, EditPen16BlueIcon, InfoICircleFill16GrayIcon, InfoICircleFill16Gray70Icon } from "@cloudtower/icons-react";
13
+ import { Typo, Tag, Input, Select, AntdOption, Button, Form, Space, TextArea, kitContext, Loading, Table as Table$2, Pagination, Alert, usePopModal, Modal, usePushModal, Fields, Units, OverflowTooltip, Tooltip, StatusCapsule, Dropdown, Menu as Menu$1, Icon as Icon$1, Divider, Link as Link$1, Tabs as Tabs$1, TabsTabPane, Row, Col, Popover, AntdTable, TableForm, getOptions, DonutChart, SegmentControl, Checkbox, DropdownMenu, SearchInput, Token, AntdSelectOptGroup, MenuItemGroup, Layout as Layout$1, Time as Time$1, useMessage, ModalStack, KitStoreProvider, ConfigProvider } from "@cloudtower/eagle";
14
+ import { EditPen16PrimaryIcon, Download16GradientBlueIcon, TrashBinDelete16Icon, MoreEllipsis324BoldSecondaryIcon, MoreEllipsis324BoldBlueIcon, MoreEllipsis316BoldBlueIcon, PlusAddCreateNew16BoldOntintIcon, ArrowChevronLeft16BoldTertiaryIcon, ArrowChevronLeftSmall16BoldBlueIcon, ViewEye16GradientGrayIcon, EntityFilterIgnoreGradient16GrayIcon, InfoICircleFill16GrayIcon, InfoICircleFill16Gray70Icon, RecoverContinue16GradientBlueIcon, SuspendedPause16GradientBlueIcon, Retry16GradientBlueIcon, FontSize16GrayIcon, FontSize16BlueIcon, LogCollection16GrayIcon, LogCollection16GradientBlueIcon, TrashBinDeletePermanently16GrayIcon, TrashBinDeletePermanently16BlueIcon, Loading24GradientBlueIcon, OpenTerminal16GradientBlueIcon, HierarchyTriangleRight16GrayIcon, HierarchyTriangleRight16BlueIcon, ClipboardCopy16GradientGrayIcon, ClipboardCopy16GradientBlueIcon, Retry16GradientGrayIcon, EditPen16GradientGrayIcon, EditPen16GradientBlueIcon, Showdiff16GradientGrayIcon, Showdiff16GradientBlueIcon, XmarkFailedSeriousWarningFill16RedIcon, ExclamationErrorCircleFill16RedIcon, Pause16GradientBlueIcon, EditPen16BlueIcon } from "@cloudtower/icons-react";
15
15
  import { first, cloneDeep, set as set$1, omit as omit$1, merge, get as get$3, debounce, last, isObject as isObject$4, uniq, keyBy } from "lodash-es";
16
16
  import yaml$1 from "js-yaml";
17
17
  import { paginateData, sortData, dataProvider, liveProvider } from "k8s-api-provider";
@@ -12175,40 +12175,413 @@ function KeyValueSecret(props) {
12175
12175
  })
12176
12176
  });
12177
12177
  }
12178
- const NodeTaintsTable = ({ taints = [] }) => {
12179
- const { t: t2 } = useTranslation();
12180
- const component = useContext(ComponentContext);
12181
- const Table2 = component.Table || Table$1;
12182
- const taintsWithId = addId(taints, "key");
12183
- const columns = [
12184
- {
12185
- key: "key",
12186
- display: true,
12187
- dataIndex: "key",
12188
- title: t2("dovetail.key"),
12189
- width: 120,
12190
- sortable: true
12191
- },
12192
- {
12193
- key: "value",
12194
- display: true,
12195
- dataIndex: "value",
12196
- title: t2("dovetail.value"),
12197
- width: 120,
12198
- sortable: true
12199
- },
12200
- {
12178
+ function validateLabelKey(key2) {
12179
+ const labelPrefixRegex = /(^[a-zA-Z0-9]$)|(^[a-zA-Z0-9][a-zA-Z0-9\.]*[a-zA-Z0-9]$)/;
12180
+ const labelNameRegex = /(^[a-zA-Z0-9]$)|(^[a-zA-Z0-9][a-zA-Z0-9\.\-]*[a-zA-Z0-9]$)/;
12181
+ let prefix, name2;
12182
+ const splitResult = key2.split("/");
12183
+ if (splitResult.length === 1) {
12184
+ name2 = splitResult[0];
12185
+ } else {
12186
+ prefix = splitResult[0];
12187
+ name2 = splitResult[1];
12188
+ }
12189
+ if (prefix === "") {
12190
+ return { isValid: false, errorMessage: "EMPTY_PREFIX" };
12191
+ }
12192
+ if (prefix && !labelPrefixRegex.test(prefix)) {
12193
+ return { isValid: false, errorMessage: "INVALID_PREFIX" };
12194
+ }
12195
+ if (!labelNameRegex.test(name2)) {
12196
+ return { isValid: false, errorMessage: "INVALID_NAME" };
12197
+ }
12198
+ if (prefix && prefix.length > 253) {
12199
+ return { isValid: false, errorMessage: "MAX_253" };
12200
+ }
12201
+ if (name2 && name2.length > 63) {
12202
+ return { isValid: false, errorMessage: "MAX_63" };
12203
+ }
12204
+ return { isValid: true };
12205
+ }
12206
+ function validateLabelValue(value2) {
12207
+ const labelValueRegex = /(^[a-zA-Z0-9]$)|(^[a-zA-Z0-9][a-zA-Z0-9\.\-]*[a-zA-Z0-9]$)/;
12208
+ if (value2 === "") {
12209
+ return { isValid: true };
12210
+ }
12211
+ if (value2.length > 63) {
12212
+ return { isValid: false, errorMessage: "MAX_63" };
12213
+ }
12214
+ if (!labelValueRegex.test(value2)) {
12215
+ return { isValid: false, errorMessage: "INVALID_VALUE" };
12216
+ }
12217
+ return { isValid: true };
12218
+ }
12219
+ const LabelFormatPopover_105yfzn = "";
12220
+ const PodLabelFormatRulePopoverStyle = "p5jt6nm";
12221
+ const LabelFormatPopover = () => {
12222
+ const {
12223
+ t: t2
12224
+ } = useTranslation();
12225
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(Popover, {
12226
+ overlayClassName: PodLabelFormatRulePopoverStyle,
12227
+ placement: "bottomRight",
12228
+ content: /* @__PURE__ */ jsxRuntimeExports.jsx(AntdTable, {
12229
+ bordered: true,
12230
+ dataSource: [{
12231
+ object: t2("dovetail.key"),
12232
+ contains: t2("dovetail.suffix"),
12233
+ optional: t2("dovetail.no"),
12234
+ rule: [t2("dovetail.suffix_format_rule_1"), t2("dovetail.suffix_format_rule_2"), t2("dovetail.suffix_format_rule_3")]
12235
+ }, {
12236
+ object: t2("dovetail.key"),
12237
+ contains: t2("dovetail.name"),
12238
+ optional: t2("dovetail.yes"),
12239
+ rule: [t2("dovetail.name_format_rule_1"), t2("dovetail.name_format_rule_2"), t2("dovetail.name_format_rule_3")]
12240
+ }, {
12241
+ object: t2("dovetail.value"),
12242
+ contains: t2("dovetail.name"),
12243
+ optional: t2("dovetail.no"),
12244
+ rule: [t2("dovetail.name_format_rule_1"), t2("dovetail.name_format_rule_2"), t2("dovetail.name_format_rule_3")]
12245
+ }],
12246
+ columns: [{
12247
+ key: "object",
12248
+ title: t2("dovetail.object"),
12249
+ dataIndex: "object",
12250
+ render: (cell, record, index2) => {
12251
+ return {
12252
+ children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", {
12253
+ className: Typo.Label.l4_bold,
12254
+ children: cell
12255
+ }),
12256
+ props: {
12257
+ rowSpan: index2 === 0 ? 2 : index2 === 1 ? 0 : 1
12258
+ }
12259
+ };
12260
+ }
12261
+ }, {
12262
+ key: "contains",
12263
+ title: t2("dovetail.contains"),
12264
+ dataIndex: "contains"
12265
+ }, {
12266
+ key: "optional",
12267
+ title: t2("dovetail.optional"),
12268
+ dataIndex: "optional"
12269
+ }, {
12270
+ key: "rule",
12271
+ title: t2("dovetail.format_requirements"),
12272
+ dataIndex: "rule",
12273
+ render: (cell) => {
12274
+ return /* @__PURE__ */ jsxRuntimeExports.jsx("ul", {
12275
+ className: "rule-list",
12276
+ children: cell.map((rule2, index2) => /* @__PURE__ */ jsxRuntimeExports.jsx("li", {
12277
+ children: rule2
12278
+ }, index2))
12279
+ });
12280
+ }
12281
+ }],
12282
+ pagination: false
12283
+ }),
12284
+ children: /* @__PURE__ */ jsxRuntimeExports.jsx(Button, {
12285
+ size: "small",
12286
+ type: "link",
12287
+ children: t2("dovetail.look_format_requirement")
12288
+ })
12289
+ });
12290
+ };
12291
+ const KeyValueTableForm_1eydq7y = "";
12292
+ function _KeyValueTableFormForm(props, ref) {
12293
+ const {
12294
+ defaultValue,
12295
+ onSubmit,
12296
+ extraColumns,
12297
+ addButtonText
12298
+ } = props;
12299
+ const {
12300
+ t: t2
12301
+ } = useTranslation();
12302
+ const [value2, setValue] = useState([]);
12303
+ const tableFormRef = useRef(null);
12304
+ useImperativeHandle(ref, () => ({
12305
+ submit: () => {
12306
+ return new Promise((res, rej) => {
12307
+ var _a;
12308
+ (_a = tableFormRef.current) == null ? void 0 : _a.validateWholeFields();
12309
+ setTimeout(() => {
12310
+ var _a2;
12311
+ const isValid = (_a2 = tableFormRef.current) == null ? void 0 : _a2.isValid();
12312
+ if (isValid) {
12313
+ res(onSubmit(value2));
12314
+ } else {
12315
+ rej();
12316
+ }
12317
+ }, 0);
12318
+ });
12319
+ }
12320
+ }), [onSubmit, value2]);
12321
+ const renderTextAreaFunc = ({
12322
+ value: value22,
12323
+ onChange
12324
+ }) => {
12325
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(TextArea, {
12326
+ autoSize: true,
12327
+ className: "clsjtk2",
12328
+ size: "small",
12329
+ value: value22,
12330
+ onChange: (e2) => {
12331
+ onChange(e2.target.value);
12332
+ }
12333
+ });
12334
+ };
12335
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs(Space, {
12336
+ size: 8,
12337
+ direction: "vertical",
12338
+ className: "cq3mbby",
12339
+ children: [/* @__PURE__ */ jsxRuntimeExports.jsx(TableForm, {
12340
+ ref: tableFormRef,
12341
+ onBodyChange: (value22) => {
12342
+ setValue(value22);
12343
+ },
12344
+ columns: [{
12345
+ key: "key",
12346
+ title: t2("dovetail.key"),
12347
+ type: "input",
12348
+ validator: ({
12349
+ value: value22
12350
+ }) => {
12351
+ if (!value22)
12352
+ return t2("dovetail.key_empty_text");
12353
+ const {
12354
+ isValid
12355
+ } = validateLabelKey(value22 || "");
12356
+ if (!isValid)
12357
+ return t2("dovetail.format_error");
12358
+ },
12359
+ render: renderTextAreaFunc
12360
+ }, {
12361
+ key: "value",
12362
+ title: t2("dovetail.value_optional"),
12363
+ type: "input",
12364
+ validator: ({
12365
+ value: value22
12366
+ }) => {
12367
+ const {
12368
+ isValid
12369
+ } = validateLabelValue(value22 || "");
12370
+ if (!isValid)
12371
+ return t2("dovetail.format_error");
12372
+ },
12373
+ render: renderTextAreaFunc
12374
+ }, ...extraColumns || []],
12375
+ disableBatchFilling: true,
12376
+ hideEmptyTable: true,
12377
+ rowAddConfig: {
12378
+ addible: true,
12379
+ text: () => addButtonText
12380
+ },
12381
+ defaultData: defaultValue,
12382
+ row: {
12383
+ deletable: true
12384
+ }
12385
+ }), /* @__PURE__ */ jsxRuntimeExports.jsx(LabelFormatPopover, {})]
12386
+ });
12387
+ }
12388
+ const KeyValueTableFormForm = React__default.forwardRef(_KeyValueTableFormForm);
12389
+ const EditNodeTaintForm_cgov7z = "";
12390
+ const UlStyle = "u19jcs7t";
12391
+ const EditNodeTaintForm = React__default.forwardRef(function EditNodeTaintForm2(props, ref) {
12392
+ const {
12393
+ nodeModel
12394
+ } = props;
12395
+ const {
12396
+ mutateAsync
12397
+ } = useUpdate();
12398
+ const {
12399
+ t: t2
12400
+ } = useTranslation();
12401
+ const defaultValue = useMemo(() => {
12402
+ var _a;
12403
+ return ((_a = nodeModel._rawYaml.spec) == null ? void 0 : _a.taints) || [];
12404
+ }, [nodeModel]);
12405
+ const onSubmit = useCallback((_value) => {
12406
+ const value2 = _value;
12407
+ const newYaml = nodeModel._globalStore.restoreItem(nodeModel);
12408
+ if (newYaml.spec) {
12409
+ newYaml.spec.taints = value2;
12410
+ }
12411
+ pruneBeforeEdit(newYaml);
12412
+ return mutateAsync({
12413
+ id: nodeModel.id,
12414
+ resource: nodeModel.name || "",
12415
+ values: newYaml,
12416
+ meta: {
12417
+ resourceBasePath: nodeModel.apiVersion,
12418
+ kind: nodeModel.kind
12419
+ },
12420
+ successNotification() {
12421
+ return {
12422
+ message: t2("dovetail.edit_node_taint_success_toast", {
12423
+ kind: nodeModel.kind,
12424
+ name: nodeModel.metadata.name,
12425
+ interpolation: {
12426
+ escapeValue: false
12427
+ }
12428
+ }),
12429
+ type: "success"
12430
+ };
12431
+ },
12432
+ errorNotification: false
12433
+ });
12434
+ }, [nodeModel, mutateAsync, t2]);
12435
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(KeyValueTableFormForm, {
12436
+ ref,
12437
+ defaultValue,
12438
+ onSubmit,
12439
+ addButtonText: t2("dovetail.add_taint"),
12440
+ extraColumns: [{
12201
12441
  key: "effect",
12202
- display: true,
12203
- dataIndex: "effect",
12204
12442
  title: t2("dovetail.effect"),
12205
- width: 120,
12206
- sortable: true,
12207
- render: (value2) => {
12208
- return t2(`dovetail.node_taint_${value2}`);
12443
+ render: ({
12444
+ value: value2,
12445
+ onChange
12446
+ }) => {
12447
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(Select, {
12448
+ input: {},
12449
+ value: value2,
12450
+ onChange,
12451
+ size: "small",
12452
+ children: getOptions([{
12453
+ value: "NoSchedule",
12454
+ children: t2(`dovetail.node_taint_${"NoSchedule"}`),
12455
+ suffix: /* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip, {
12456
+ title: /* @__PURE__ */ jsxRuntimeExports.jsx(TaintEffectTooltip, {
12457
+ effect: "NoSchedule"
12458
+ /* NoSchedule */
12459
+ }),
12460
+ children: /* @__PURE__ */ jsxRuntimeExports.jsx(Icon$1, {
12461
+ src: InfoICircleFill16GrayIcon,
12462
+ hoverSrc: InfoICircleFill16Gray70Icon
12463
+ })
12464
+ })
12465
+ }, {
12466
+ value: "PreferNoSchedule",
12467
+ children: t2(`dovetail.node_taint_${"PreferNoSchedule"}`),
12468
+ suffix: /* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip, {
12469
+ title: /* @__PURE__ */ jsxRuntimeExports.jsx(TaintEffectTooltip, {
12470
+ effect: "PreferNoSchedule"
12471
+ /* PreferNoSchedule */
12472
+ }),
12473
+ children: /* @__PURE__ */ jsxRuntimeExports.jsx(Icon$1, {
12474
+ src: InfoICircleFill16GrayIcon,
12475
+ hoverSrc: InfoICircleFill16Gray70Icon
12476
+ })
12477
+ })
12478
+ }, {
12479
+ value: "NoExecute",
12480
+ children: t2(`dovetail.node_taint_${"NoExecute"}`),
12481
+ suffix: /* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip, {
12482
+ title: /* @__PURE__ */ jsxRuntimeExports.jsx(TaintEffectTooltip, {
12483
+ effect: "NoExecute"
12484
+ /* NoExecute */
12485
+ }),
12486
+ children: /* @__PURE__ */ jsxRuntimeExports.jsx(Icon$1, {
12487
+ src: InfoICircleFill16GrayIcon,
12488
+ hoverSrc: InfoICircleFill16Gray70Icon
12489
+ })
12490
+ })
12491
+ }])
12492
+ });
12493
+ },
12494
+ validator: ({
12495
+ value: value2
12496
+ }) => {
12497
+ if (!value2)
12498
+ return t2("dovetail.taint_effect_empty_text");
12209
12499
  }
12500
+ }]
12501
+ });
12502
+ });
12503
+ const TaintEffectTooltip = ({
12504
+ effect: effect2
12505
+ }) => {
12506
+ const {
12507
+ t: t2
12508
+ } = useTranslation();
12509
+ const TaintEffectTooltipTextConfig = {
12510
+ [
12511
+ "NoSchedule"
12512
+ /* NoSchedule */
12513
+ ]: {
12514
+ title: "NoSchedule",
12515
+ tooltips: [t2("dovetail.taint_effect_NoSchedule_tooltip_1"), t2("dovetail.taint_effect_NoSchedule_tooltip_2")]
12516
+ },
12517
+ [
12518
+ "PreferNoSchedule"
12519
+ /* PreferNoSchedule */
12520
+ ]: {
12521
+ title: "PreferNoSchedule",
12522
+ tooltips: [t2("dovetail.taint_effect_PreferNoSchedule_tooltip_1"), t2("dovetail.taint_effect_PreferNoSchedule_tooltip_2"), t2("dovetail.taint_effect_PreferNoSchedule_tooltip_3")]
12523
+ },
12524
+ [
12525
+ "NoExecute"
12526
+ /* NoExecute */
12527
+ ]: {
12528
+ title: "NoExecute",
12529
+ tooltips: [t2("dovetail.taint_effect_NoExecute_tooltip_3")]
12210
12530
  }
12211
- ];
12531
+ };
12532
+ const config = TaintEffectTooltipTextConfig[effect2];
12533
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
12534
+ children: [/* @__PURE__ */ jsxRuntimeExports.jsx("b", {
12535
+ children: config.title
12536
+ }), /* @__PURE__ */ jsxRuntimeExports.jsx("ul", {
12537
+ className: UlStyle,
12538
+ children: config.tooltips.map((tooltip, index2) => /* @__PURE__ */ jsxRuntimeExports.jsx("li", {
12539
+ children: tooltip
12540
+ }, index2))
12541
+ })]
12542
+ });
12543
+ };
12544
+ const NodeTaintsTable_wrxeox = "";
12545
+ const EffectStyle = "evoxbc1";
12546
+ const NodeTaintsTable = ({
12547
+ taints = []
12548
+ }) => {
12549
+ const {
12550
+ t: t2
12551
+ } = useTranslation();
12552
+ const component = useContext(ComponentContext);
12553
+ const Table2 = component.Table || Table$1;
12554
+ const taintsWithId = addId(taints, "key");
12555
+ const columns = [{
12556
+ key: "key",
12557
+ display: true,
12558
+ dataIndex: "key",
12559
+ title: t2("dovetail.key"),
12560
+ sortable: true
12561
+ }, {
12562
+ key: "value",
12563
+ display: true,
12564
+ dataIndex: "value",
12565
+ title: t2("dovetail.value"),
12566
+ sortable: true
12567
+ }, {
12568
+ key: "effect",
12569
+ display: true,
12570
+ dataIndex: "effect",
12571
+ title: t2("dovetail.effect"),
12572
+ sortable: true,
12573
+ render: (value2) => {
12574
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip, {
12575
+ title: /* @__PURE__ */ jsxRuntimeExports.jsx(TaintEffectTooltip, {
12576
+ effect: value2
12577
+ }),
12578
+ children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", {
12579
+ className: EffectStyle,
12580
+ children: t2(`dovetail.node_taint_${value2}`)
12581
+ })
12582
+ });
12583
+ }
12584
+ }];
12212
12585
  const {
12213
12586
  data: finalData,
12214
12587
  currentPage,
@@ -12217,40 +12590,34 @@ const NodeTaintsTable = ({ taints = [] }) => {
12217
12590
  } = useTableData({
12218
12591
  data: taintsWithId,
12219
12592
  columns,
12220
- defaultSorters: [
12221
- {
12222
- field: "lastUpdateTime",
12223
- order: "desc"
12224
- }
12225
- ]
12593
+ defaultSorters: [{
12594
+ field: "lastUpdateTime",
12595
+ order: "desc"
12596
+ }]
12226
12597
  });
12227
12598
  const currentSize = 10;
12228
12599
  if (taintsWithId.length === 0) {
12229
- return /* @__PURE__ */ jsxRuntimeExports.jsx(
12230
- WidgetErrorContent,
12231
- {
12232
- errorText: t2("dovetail.no_resource", { kind: t2("dovetail.taint") }),
12233
- type: ErrorContentType.Card
12234
- }
12235
- );
12600
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(WidgetErrorContent, {
12601
+ errorText: t2("dovetail.no_resource", {
12602
+ kind: t2("dovetail.taint")
12603
+ }),
12604
+ type: ErrorContentType.Card
12605
+ });
12236
12606
  }
12237
- return /* @__PURE__ */ jsxRuntimeExports.jsx(
12238
- Table2,
12239
- {
12240
- tableKey: "condition",
12241
- loading: false,
12242
- data: finalData,
12243
- total: taintsWithId.length,
12244
- columns: addDefaultRenderToColumns(columns),
12245
- rowKey: "key",
12246
- empty: t2("dovetail.empty"),
12247
- defaultSize: currentSize,
12248
- currentPage,
12249
- onPageChange,
12250
- onSorterChange,
12251
- showMenuColumn: false
12252
- }
12253
- );
12607
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(Table2, {
12608
+ tableKey: "condition",
12609
+ loading: false,
12610
+ data: finalData,
12611
+ total: taintsWithId.length,
12612
+ columns: addDefaultRenderToColumns(columns),
12613
+ rowKey: "key",
12614
+ empty: t2("dovetail.empty"),
12615
+ defaultSize: currentSize,
12616
+ currentPage,
12617
+ onPageChange,
12618
+ onSorterChange,
12619
+ showMenuColumn: false
12620
+ });
12254
12621
  };
12255
12622
  function PVVolumeModeDisplay(props) {
12256
12623
  const { value: value2 } = props;
@@ -38008,7 +38375,7 @@ const Separator = () => {
38008
38375
  });
38009
38376
  };
38010
38377
  const MonacoYamlEditor = React__default.lazy(() => Promise.resolve().then(() => MonacoYamlEditor$2));
38011
- const MonacoYamlDiffEditor = React__default.lazy(() => import("./MonacoYamlDiffEditor-ae1a891e.js"));
38378
+ const MonacoYamlDiffEditor = React__default.lazy(() => import("./MonacoYamlDiffEditor-814adc94.js"));
38012
38379
  const YamlEditorComponent = forwardRef(
38013
38380
  function YamlEditorComponent2(props, ref) {
38014
38381
  const {
@@ -39067,217 +39434,6 @@ function CronJobDropdown(props) {
39067
39434
  }
39068
39435
  ) : null });
39069
39436
  }
39070
- function validateLabelKey(key2) {
39071
- const labelPrefixRegex = /(^[a-zA-Z0-9]$)|(^[a-zA-Z0-9][a-zA-Z0-9\.]*[a-zA-Z0-9]$)/;
39072
- const labelNameRegex = /(^[a-zA-Z0-9]$)|(^[a-zA-Z0-9][a-zA-Z0-9\.\-]*[a-zA-Z0-9]$)/;
39073
- let prefix, name2;
39074
- const splitResult = key2.split("/");
39075
- if (splitResult.length === 1) {
39076
- name2 = splitResult[0];
39077
- } else {
39078
- prefix = splitResult[0];
39079
- name2 = splitResult[1];
39080
- }
39081
- if (prefix === "") {
39082
- return { isValid: false, errorMessage: "EMPTY_PREFIX" };
39083
- }
39084
- if (prefix && !labelPrefixRegex.test(prefix)) {
39085
- return { isValid: false, errorMessage: "INVALID_PREFIX" };
39086
- }
39087
- if (!labelNameRegex.test(name2)) {
39088
- return { isValid: false, errorMessage: "INVALID_NAME" };
39089
- }
39090
- if (prefix && prefix.length > 253) {
39091
- return { isValid: false, errorMessage: "MAX_253" };
39092
- }
39093
- if (name2 && name2.length > 63) {
39094
- return { isValid: false, errorMessage: "MAX_63" };
39095
- }
39096
- return { isValid: true };
39097
- }
39098
- function validateLabelValue(value2) {
39099
- const labelValueRegex = /(^[a-zA-Z0-9]$)|(^[a-zA-Z0-9][a-zA-Z0-9\.\-]*[a-zA-Z0-9]$)/;
39100
- if (value2 === "") {
39101
- return { isValid: true };
39102
- }
39103
- if (value2.length > 63) {
39104
- return { isValid: false, errorMessage: "MAX_63" };
39105
- }
39106
- if (!labelValueRegex.test(value2)) {
39107
- return { isValid: false, errorMessage: "INVALID_VALUE" };
39108
- }
39109
- return { isValid: true };
39110
- }
39111
- const LabelFormatPopover_105yfzn = "";
39112
- const PodLabelFormatRulePopoverStyle = "p5jt6nm";
39113
- const LabelFormatPopover = () => {
39114
- const {
39115
- t: t2
39116
- } = useTranslation();
39117
- return /* @__PURE__ */ jsxRuntimeExports.jsx(Popover, {
39118
- overlayClassName: PodLabelFormatRulePopoverStyle,
39119
- placement: "bottomRight",
39120
- content: /* @__PURE__ */ jsxRuntimeExports.jsx(AntdTable, {
39121
- bordered: true,
39122
- dataSource: [{
39123
- object: t2("dovetail.key"),
39124
- contains: t2("dovetail.suffix"),
39125
- optional: t2("dovetail.no"),
39126
- rule: [t2("dovetail.suffix_format_rule_1"), t2("dovetail.suffix_format_rule_2"), t2("dovetail.suffix_format_rule_3")]
39127
- }, {
39128
- object: t2("dovetail.key"),
39129
- contains: t2("dovetail.name"),
39130
- optional: t2("dovetail.yes"),
39131
- rule: [t2("dovetail.name_format_rule_1"), t2("dovetail.name_format_rule_2"), t2("dovetail.name_format_rule_3")]
39132
- }, {
39133
- object: t2("dovetail.value"),
39134
- contains: t2("dovetail.name"),
39135
- optional: t2("dovetail.no"),
39136
- rule: [t2("dovetail.name_format_rule_1"), t2("dovetail.name_format_rule_2"), t2("dovetail.name_format_rule_3")]
39137
- }],
39138
- columns: [{
39139
- key: "object",
39140
- title: t2("dovetail.object"),
39141
- dataIndex: "object",
39142
- render: (cell, record, index2) => {
39143
- return {
39144
- children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", {
39145
- className: Typo.Label.l4_bold,
39146
- children: cell
39147
- }),
39148
- props: {
39149
- rowSpan: index2 === 0 ? 2 : index2 === 1 ? 0 : 1
39150
- }
39151
- };
39152
- }
39153
- }, {
39154
- key: "contains",
39155
- title: t2("dovetail.contains"),
39156
- dataIndex: "contains"
39157
- }, {
39158
- key: "optional",
39159
- title: t2("dovetail.optional"),
39160
- dataIndex: "optional"
39161
- }, {
39162
- key: "rule",
39163
- title: t2("dovetail.format_requirements"),
39164
- dataIndex: "rule",
39165
- render: (cell) => {
39166
- return /* @__PURE__ */ jsxRuntimeExports.jsx("ul", {
39167
- className: "rule-list",
39168
- children: cell.map((rule2, index2) => /* @__PURE__ */ jsxRuntimeExports.jsx("li", {
39169
- children: rule2
39170
- }, index2))
39171
- });
39172
- }
39173
- }],
39174
- pagination: false
39175
- }),
39176
- children: /* @__PURE__ */ jsxRuntimeExports.jsx(Button, {
39177
- size: "small",
39178
- type: "link",
39179
- children: t2("dovetail.look_format_requirement")
39180
- })
39181
- });
39182
- };
39183
- const KeyValueTableForm_1eydq7y = "";
39184
- function _KeyValueTableFormForm(props, ref) {
39185
- const {
39186
- defaultValue,
39187
- onSubmit,
39188
- extraColumns,
39189
- addButtonText
39190
- } = props;
39191
- const {
39192
- t: t2
39193
- } = useTranslation();
39194
- const [value2, setValue] = useState([]);
39195
- const tableFormRef = useRef(null);
39196
- useImperativeHandle(ref, () => ({
39197
- submit: () => {
39198
- return new Promise((res, rej) => {
39199
- var _a;
39200
- (_a = tableFormRef.current) == null ? void 0 : _a.validateWholeFields();
39201
- setTimeout(() => {
39202
- var _a2;
39203
- const isValid = (_a2 = tableFormRef.current) == null ? void 0 : _a2.isValid();
39204
- if (isValid) {
39205
- res(onSubmit(value2));
39206
- } else {
39207
- rej();
39208
- }
39209
- }, 0);
39210
- });
39211
- }
39212
- }), [onSubmit, value2]);
39213
- const renderTextAreaFunc = ({
39214
- value: value22,
39215
- onChange
39216
- }) => {
39217
- return /* @__PURE__ */ jsxRuntimeExports.jsx(TextArea, {
39218
- autoSize: true,
39219
- className: "clsjtk2",
39220
- size: "small",
39221
- value: value22,
39222
- onChange: (e2) => {
39223
- onChange(e2.target.value);
39224
- }
39225
- });
39226
- };
39227
- return /* @__PURE__ */ jsxRuntimeExports.jsxs(Space, {
39228
- size: 8,
39229
- direction: "vertical",
39230
- className: "cq3mbby",
39231
- children: [/* @__PURE__ */ jsxRuntimeExports.jsx(TableForm, {
39232
- ref: tableFormRef,
39233
- onBodyChange: (value22) => {
39234
- setValue(value22);
39235
- },
39236
- columns: [{
39237
- key: "key",
39238
- title: t2("dovetail.key"),
39239
- type: "input",
39240
- validator: ({
39241
- value: value22
39242
- }) => {
39243
- if (!value22)
39244
- return t2("dovetail.key_empty_text");
39245
- const {
39246
- isValid
39247
- } = validateLabelKey(value22 || "");
39248
- if (!isValid)
39249
- return t2("dovetail.format_error");
39250
- },
39251
- render: renderTextAreaFunc
39252
- }, {
39253
- key: "value",
39254
- title: t2("dovetail.value_optional"),
39255
- type: "input",
39256
- validator: ({
39257
- value: value22
39258
- }) => {
39259
- const {
39260
- isValid
39261
- } = validateLabelValue(value22 || "");
39262
- if (!isValid)
39263
- return t2("dovetail.format_error");
39264
- },
39265
- render: renderTextAreaFunc
39266
- }, ...extraColumns || []],
39267
- disableBatchFilling: true,
39268
- hideEmptyTable: true,
39269
- rowAddConfig: {
39270
- addible: true,
39271
- text: () => addButtonText
39272
- },
39273
- defaultData: defaultValue,
39274
- row: {
39275
- deletable: true
39276
- }
39277
- }), /* @__PURE__ */ jsxRuntimeExports.jsx(LabelFormatPopover, {})]
39278
- });
39279
- }
39280
- const KeyValueTableFormForm = React__default.forwardRef(_KeyValueTableFormForm);
39281
39437
  const EditLabelForm = React__default.forwardRef(
39282
39438
  function EditLabelForm2(props, ref) {
39283
39439
  var _a;
@@ -39342,26 +39498,23 @@ function EditLabelDropdownMenuItem(props) {
39342
39498
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
39343
39499
  Menu$1.Item,
39344
39500
  {
39501
+ ...props,
39345
39502
  className: "ant-dropdown-menu-item",
39346
- onClick: () => {
39503
+ onClick: (e2) => {
39504
+ var _a;
39347
39505
  const modalProps = {
39348
39506
  formRef,
39349
39507
  title: t2("dovetail.edit_label"),
39350
39508
  fullscreen: true,
39351
39509
  renderContent() {
39352
- return /* @__PURE__ */ jsxRuntimeExports.jsx(
39353
- EditLabelForm,
39354
- {
39355
- ref: formRef,
39356
- resourceModel
39357
- }
39358
- );
39510
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(EditLabelForm, { ref: formRef, resourceModel });
39359
39511
  }
39360
39512
  };
39361
39513
  pushModal({
39362
39514
  component: EditFieldModal,
39363
39515
  props: modalProps
39364
39516
  });
39517
+ (_a = props.onClick) == null ? void 0 : _a.call(props, e2);
39365
39518
  },
39366
39519
  children: /* @__PURE__ */ jsxRuntimeExports.jsx(Icon$1, { src: EditPen16BlueIcon, children: t2("dovetail.edit_label") })
39367
39520
  }
@@ -39429,172 +39582,28 @@ function EditAnnotationDropdownMenuItem(props) {
39429
39582
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
39430
39583
  Menu$1.Item,
39431
39584
  {
39585
+ ...props,
39432
39586
  className: "ant-dropdown-menu-item",
39433
- onClick: () => {
39587
+ onClick: (e2) => {
39588
+ var _a;
39434
39589
  const modalProps = {
39435
39590
  formRef,
39436
39591
  title: t2("dovetail.edit_annotation"),
39437
39592
  fullscreen: true,
39438
39593
  renderContent() {
39439
- return /* @__PURE__ */ jsxRuntimeExports.jsx(
39440
- EditAnnotationForm,
39441
- {
39442
- ref: formRef,
39443
- resourceModel
39444
- }
39445
- );
39594
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(EditAnnotationForm, { ref: formRef, resourceModel });
39446
39595
  }
39447
39596
  };
39448
39597
  pushModal({
39449
39598
  component: EditFieldModal,
39450
39599
  props: modalProps
39451
39600
  });
39601
+ (_a = props.onClick) == null ? void 0 : _a.call(props, e2);
39452
39602
  },
39453
39603
  children: /* @__PURE__ */ jsxRuntimeExports.jsx(Icon$1, { src: EditPen16BlueIcon, children: t2("dovetail.edit_annotation") })
39454
39604
  }
39455
39605
  );
39456
39606
  }
39457
- const EditNodeTaintForm_cgov7z = "";
39458
- const UlStyle = "u19jcs7t";
39459
- const EditNodeTaintForm = React__default.forwardRef(function EditNodeTaintForm2(props, ref) {
39460
- const {
39461
- nodeModel
39462
- } = props;
39463
- const {
39464
- mutateAsync
39465
- } = useUpdate();
39466
- const {
39467
- t: t2
39468
- } = useTranslation();
39469
- const defaultValue = useMemo(() => {
39470
- var _a;
39471
- return ((_a = nodeModel._rawYaml.spec) == null ? void 0 : _a.taints) || [];
39472
- }, [nodeModel]);
39473
- const onSubmit = useCallback((_value) => {
39474
- const value2 = _value;
39475
- const newYaml = nodeModel._globalStore.restoreItem(nodeModel);
39476
- if (newYaml.spec) {
39477
- newYaml.spec.taints = value2;
39478
- }
39479
- pruneBeforeEdit(newYaml);
39480
- return mutateAsync({
39481
- id: nodeModel.id,
39482
- resource: nodeModel.name || "",
39483
- values: newYaml,
39484
- meta: {
39485
- resourceBasePath: nodeModel.apiVersion,
39486
- kind: nodeModel.kind
39487
- },
39488
- successNotification() {
39489
- return {
39490
- message: t2("dovetail.edit_node_taint_success_toast", {
39491
- kind: nodeModel.kind,
39492
- name: nodeModel.metadata.name,
39493
- interpolation: {
39494
- escapeValue: false
39495
- }
39496
- }),
39497
- type: "success"
39498
- };
39499
- },
39500
- errorNotification: false
39501
- });
39502
- }, [nodeModel, mutateAsync, t2]);
39503
- const noScheduleTooltip = /* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
39504
- children: [/* @__PURE__ */ jsxRuntimeExports.jsx("b", {
39505
- children: "NoSchedule"
39506
- }), /* @__PURE__ */ jsxRuntimeExports.jsxs("ul", {
39507
- className: UlStyle,
39508
- children: [/* @__PURE__ */ jsxRuntimeExports.jsx("li", {
39509
- children: t2("dovetail.taint_effect_NoSchedule_tooltip_1")
39510
- }), /* @__PURE__ */ jsxRuntimeExports.jsx("li", {
39511
- children: t2("dovetail.taint_effect_NoSchedule_tooltip_2")
39512
- })]
39513
- })]
39514
- });
39515
- const preferNoScheduleTooltip = /* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
39516
- children: [/* @__PURE__ */ jsxRuntimeExports.jsx("b", {
39517
- children: "PreferNoSchedule"
39518
- }), /* @__PURE__ */ jsxRuntimeExports.jsxs("ul", {
39519
- className: UlStyle,
39520
- children: [/* @__PURE__ */ jsxRuntimeExports.jsx("li", {
39521
- children: t2("dovetail.taint_effect_PreferNoSchedule_tooltip_1")
39522
- }), /* @__PURE__ */ jsxRuntimeExports.jsx("li", {
39523
- children: t2("dovetail.taint_effect_PreferNoSchedule_tooltip_2")
39524
- }), /* @__PURE__ */ jsxRuntimeExports.jsx("li", {
39525
- children: t2("dovetail.taint_effect_PreferNoSchedule_tooltip_3")
39526
- })]
39527
- })]
39528
- });
39529
- const noExecuteTooltip = /* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
39530
- children: [/* @__PURE__ */ jsxRuntimeExports.jsx("b", {
39531
- children: "NoExecute"
39532
- }), /* @__PURE__ */ jsxRuntimeExports.jsx("ul", {
39533
- className: UlStyle,
39534
- children: /* @__PURE__ */ jsxRuntimeExports.jsx("li", {
39535
- children: t2("dovetail.taint_effect_NoExecute_tooltip_3")
39536
- })
39537
- })]
39538
- });
39539
- return /* @__PURE__ */ jsxRuntimeExports.jsx(KeyValueTableFormForm, {
39540
- ref,
39541
- defaultValue,
39542
- onSubmit,
39543
- addButtonText: t2("dovetail.add_taint"),
39544
- extraColumns: [{
39545
- key: "effect",
39546
- title: t2("dovetail.effect"),
39547
- render: ({
39548
- value: value2,
39549
- onChange
39550
- }) => {
39551
- return /* @__PURE__ */ jsxRuntimeExports.jsx(Select, {
39552
- input: {},
39553
- value: value2,
39554
- onChange,
39555
- size: "small",
39556
- children: getOptions([{
39557
- value: "NoSchedule",
39558
- children: t2(`dovetail.node_taint_${"NoSchedule"}`),
39559
- suffix: /* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip, {
39560
- title: noScheduleTooltip,
39561
- children: /* @__PURE__ */ jsxRuntimeExports.jsx(Icon$1, {
39562
- src: InfoICircleFill16GrayIcon,
39563
- hoverSrc: InfoICircleFill16Gray70Icon
39564
- })
39565
- })
39566
- }, {
39567
- value: "PreferNoSchedule",
39568
- children: t2(`dovetail.node_taint_${"PreferNoSchedule"}`),
39569
- suffix: /* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip, {
39570
- title: preferNoScheduleTooltip,
39571
- children: /* @__PURE__ */ jsxRuntimeExports.jsx(Icon$1, {
39572
- src: InfoICircleFill16GrayIcon,
39573
- hoverSrc: InfoICircleFill16Gray70Icon
39574
- })
39575
- })
39576
- }, {
39577
- value: "NoExecute",
39578
- children: t2(`dovetail.node_taint_${"NoExecute"}`),
39579
- suffix: /* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip, {
39580
- title: noExecuteTooltip,
39581
- children: /* @__PURE__ */ jsxRuntimeExports.jsx(Icon$1, {
39582
- src: InfoICircleFill16GrayIcon,
39583
- hoverSrc: InfoICircleFill16Gray70Icon
39584
- })
39585
- })
39586
- }])
39587
- });
39588
- },
39589
- validator: ({
39590
- value: value2
39591
- }) => {
39592
- if (!value2)
39593
- return t2("dovetail.taint_effect_empty_text");
39594
- }
39595
- }]
39596
- });
39597
- });
39598
39607
  function EditNodeTaintDropdownMenuItem(props) {
39599
39608
  const { formRef, resourceModel } = props;
39600
39609
  const { t: t2 } = useTranslation();
@@ -39602,26 +39611,23 @@ function EditNodeTaintDropdownMenuItem(props) {
39602
39611
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
39603
39612
  Menu$1.Item,
39604
39613
  {
39614
+ ...props,
39605
39615
  className: "ant-dropdown-menu-item",
39606
- onClick: () => {
39616
+ onClick: (e2) => {
39617
+ var _a;
39607
39618
  const modalProps = {
39608
39619
  formRef,
39609
39620
  title: t2("dovetail.edit_node_taint"),
39610
39621
  fullscreen: true,
39611
39622
  renderContent() {
39612
- return /* @__PURE__ */ jsxRuntimeExports.jsx(
39613
- EditNodeTaintForm,
39614
- {
39615
- ref: formRef,
39616
- nodeModel: resourceModel
39617
- }
39618
- );
39623
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(EditNodeTaintForm, { ref: formRef, nodeModel: resourceModel });
39619
39624
  }
39620
39625
  };
39621
39626
  pushModal({
39622
39627
  component: EditFieldModal,
39623
39628
  props: modalProps
39624
39629
  });
39630
+ (_a = props.onClick) == null ? void 0 : _a.call(props, e2);
39625
39631
  },
39626
39632
  children: /* @__PURE__ */ jsxRuntimeExports.jsx(Icon$1, { src: EditPen16BlueIcon, children: t2("dovetail.edit_node_taint") })
39627
39633
  }