@prorobotech/openapi-k8s-toolkit 1.2.0-alpha.5 → 1.2.0-alpha.7
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/openapi-k8s-toolkit.es.js +277 -213
- package/dist/openapi-k8s-toolkit.es.js.map +1 -1
- package/dist/openapi-k8s-toolkit.umd.js +286 -212
- package/dist/openapi-k8s-toolkit.umd.js.map +1 -1
- package/dist/types/components/molecules/EnrichedTable/organisms/EnrichedTable/EnrichedTable.d.ts +2 -2
- package/dist/types/components/molecules/EnrichedTable/organisms/EnrichedTable/utils.d.ts +3 -3
- package/dist/types/components/organisms/DynamicComponents/types.d.ts +2 -2
- package/dist/types/localTypes/bff/table.d.ts +2 -2
- package/dist/types/localTypes/navigations.d.ts +3 -0
- package/dist/types/localTypes/richTable.d.ts +4 -2
- package/dist/types/{components/organisms/DynamicComponents/molecules/ConverterBytes/utils.d.ts → utils/converterBytes/converterBytes.d.ts} +1 -1
- package/dist/types/utils/converterBytes/index.d.ts +1 -0
- package/dist/types/{components/organisms/DynamicComponents/molecules/ConverterCores/utils.d.ts → utils/converterCores/converterCores.d.ts} +1 -1
- package/dist/types/utils/converterCores/index.d.ts +1 -0
- package/dist/types/utils/index.d.ts +2 -0
- package/package.json +1 -1
- /package/dist/types/{components/organisms/DynamicComponents/molecules/ConverterBytes/types.d.ts → localTypes/factories/converterBytes.d.ts} +0 -0
- /package/dist/types/{components/organisms/DynamicComponents/molecules/ConverterCores/types.d.ts → localTypes/factories/converterCores.d.ts} +0 -0
- /package/dist/types/{components/organisms/DynamicComponents/molecules/ConverterBytes/utilts.test.d.ts → utils/converterBytes/converterBytes.test.d.ts} +0 -0
- /package/dist/types/{components/organisms/DynamicComponents/molecules/ConverterCores/utilts.test.d.ts → utils/converterCores/converterCores.test.d.ts} +0 -0
|
@@ -33964,6 +33964,220 @@
|
|
|
33964
33964
|
});
|
|
33965
33965
|
};
|
|
33966
33966
|
|
|
33967
|
+
const UNIT_FACTORS = {
|
|
33968
|
+
B: 1,
|
|
33969
|
+
kB: 1e3,
|
|
33970
|
+
MB: 1e6,
|
|
33971
|
+
GB: 1e9,
|
|
33972
|
+
TB: 1e12,
|
|
33973
|
+
PB: 1e15,
|
|
33974
|
+
EB: 1e18,
|
|
33975
|
+
KiB: 1024,
|
|
33976
|
+
MiB: 1024 ** 2,
|
|
33977
|
+
GiB: 1024 ** 3,
|
|
33978
|
+
TiB: 1024 ** 4,
|
|
33979
|
+
PiB: 1024 ** 5,
|
|
33980
|
+
EiB: 1024 ** 6
|
|
33981
|
+
};
|
|
33982
|
+
const ALIASES = (() => {
|
|
33983
|
+
const siPairs = [
|
|
33984
|
+
[["b", "byte", "bytes"], "B"],
|
|
33985
|
+
[["k", "kb", "kB", "KB"], "kB"],
|
|
33986
|
+
[["m", "mb", "MB"], "MB"],
|
|
33987
|
+
[["g", "gb", "GB"], "GB"],
|
|
33988
|
+
[["t", "tb, TB".replace(",", "")], "TB"],
|
|
33989
|
+
[["p", "pb", "PB"], "PB"],
|
|
33990
|
+
[["e", "eb", "EB"], "EB"]
|
|
33991
|
+
];
|
|
33992
|
+
const iecPairs = [
|
|
33993
|
+
[["ki", "kib", "Ki", "KiB"], "KiB"],
|
|
33994
|
+
[["mi", "mib", "Mi", "MiB"], "MiB"],
|
|
33995
|
+
[["gi", "gib", "Gi", "GiB"], "GiB"],
|
|
33996
|
+
[["ti", "tib", "Ti", "TiB"], "TiB"],
|
|
33997
|
+
[["pi", "pib", "Pi", "PiB"], "PiB"],
|
|
33998
|
+
[["ei", "eib", "Ei", "EiB"], "EiB"]
|
|
33999
|
+
];
|
|
34000
|
+
const entries = [...siPairs, ...iecPairs].flatMap(([keys, unit]) => keys.map((k) => [k.toLowerCase(), unit]));
|
|
34001
|
+
const canon = Object.keys(UNIT_FACTORS).map((u) => [u.toLowerCase(), u]);
|
|
34002
|
+
return Object.fromEntries([...entries, ...canon]);
|
|
34003
|
+
})();
|
|
34004
|
+
const normalizeUnit = (u) => {
|
|
34005
|
+
const key = String(u).trim().toLowerCase();
|
|
34006
|
+
const canon = ALIASES[key];
|
|
34007
|
+
if (!canon) {
|
|
34008
|
+
console.error(`Unknown unit: "${u}"`);
|
|
34009
|
+
return "GB";
|
|
34010
|
+
}
|
|
34011
|
+
return canon;
|
|
34012
|
+
};
|
|
34013
|
+
const convertBytes = (bytes, unit, opts) => {
|
|
34014
|
+
if (!Number.isFinite(bytes)) {
|
|
34015
|
+
console.error("bytes must be a finite number");
|
|
34016
|
+
return -1;
|
|
34017
|
+
}
|
|
34018
|
+
if (bytes < 0) {
|
|
34019
|
+
console.error("bytes must be >= 0");
|
|
34020
|
+
return -1;
|
|
34021
|
+
}
|
|
34022
|
+
const canon = normalizeUnit(unit);
|
|
34023
|
+
const factor = UNIT_FACTORS[canon];
|
|
34024
|
+
const value = bytes / factor;
|
|
34025
|
+
return opts?.format ? `${value.toLocaleString(opts.locale, {
|
|
34026
|
+
minimumFractionDigits: 0,
|
|
34027
|
+
maximumFractionDigits: opts?.precision ?? 2
|
|
34028
|
+
})} ${canon}` : value;
|
|
34029
|
+
};
|
|
34030
|
+
const formatBytesAuto = (bytes, { standard = "si", precision = 2, locale } = {}) => {
|
|
34031
|
+
if (!Number.isFinite(bytes)) {
|
|
34032
|
+
console.error("bytes must be a finite number");
|
|
34033
|
+
return "infinite";
|
|
34034
|
+
}
|
|
34035
|
+
if (bytes < 0) {
|
|
34036
|
+
console.error("bytes must be >= 0");
|
|
34037
|
+
return "less then zero";
|
|
34038
|
+
}
|
|
34039
|
+
const ladder = standard === "iec" ? ["B", "KiB", "MiB", "GiB", "TiB", "PiB", "EiB"] : ["B", "kB", "MB", "GB", "TB", "PB", "EB"];
|
|
34040
|
+
const base = standard === "iec" ? 1024 : 1e3;
|
|
34041
|
+
const idx = bytes > 0 ? Math.min(ladder.length - 1, Math.floor(Math.log(bytes) / Math.log(base))) : 0;
|
|
34042
|
+
const unit = ladder[Math.max(0, idx)];
|
|
34043
|
+
return String(convertBytes(bytes, unit, { format: true, precision, locale }));
|
|
34044
|
+
};
|
|
34045
|
+
const toBytes = (value, from) => {
|
|
34046
|
+
if (!Number.isFinite(value)) {
|
|
34047
|
+
console.error("value must be a finite number");
|
|
34048
|
+
return -1;
|
|
34049
|
+
}
|
|
34050
|
+
if (value < 0) {
|
|
34051
|
+
console.error("value must be >= 0");
|
|
34052
|
+
return -1;
|
|
34053
|
+
}
|
|
34054
|
+
const canon = normalizeUnit(from);
|
|
34055
|
+
const factor = UNIT_FACTORS[canon];
|
|
34056
|
+
return value * factor;
|
|
34057
|
+
};
|
|
34058
|
+
const convertStorage = (value, from, to, opts) => {
|
|
34059
|
+
const bytes = toBytes(value, from);
|
|
34060
|
+
if (bytes < 0) return -1;
|
|
34061
|
+
return convertBytes(bytes, to, opts);
|
|
34062
|
+
};
|
|
34063
|
+
const parseValueWithUnit = (input) => {
|
|
34064
|
+
const trimmed = input.trim();
|
|
34065
|
+
if (!trimmed) return null;
|
|
34066
|
+
const match = trimmed.match(/^([+-]?\d+(?:\.\d+)?)(?:\s*([a-zA-Z]+))?$/);
|
|
34067
|
+
if (!match) return null;
|
|
34068
|
+
const [, numPart, unitPart] = match;
|
|
34069
|
+
const value = Number(numPart);
|
|
34070
|
+
if (!Number.isFinite(value)) return null;
|
|
34071
|
+
if (unitPart) {
|
|
34072
|
+
return { value, unit: unitPart };
|
|
34073
|
+
}
|
|
34074
|
+
return { value };
|
|
34075
|
+
};
|
|
34076
|
+
|
|
34077
|
+
const CORE_UNIT_FACTORS = {
|
|
34078
|
+
core: 1,
|
|
34079
|
+
mcore: 1e-3,
|
|
34080
|
+
ucore: 1e-6,
|
|
34081
|
+
ncore: 1e-9
|
|
34082
|
+
};
|
|
34083
|
+
const CORE_ALIASES = (() => {
|
|
34084
|
+
const corePairs = [
|
|
34085
|
+
// plain cores
|
|
34086
|
+
[["core", "cores", "c", "cpu", "cpus", "vcpu", "vcpus"], "core"],
|
|
34087
|
+
// millicores
|
|
34088
|
+
[["m", "mc", "mcore", "mcores", "millicore", "millicores", "millicpu", "millicpus"], "mcore"],
|
|
34089
|
+
// microcores
|
|
34090
|
+
[["u", "µ", "ucore", "ucores", "micro", "microcore", "microcores"], "ucore"],
|
|
34091
|
+
// nanocores
|
|
34092
|
+
[["n", "ncore", "ncores", "nano", "nanocore", "nanocores"], "ncore"]
|
|
34093
|
+
];
|
|
34094
|
+
const entries = corePairs.flatMap(([keys, unit]) => keys.map((k) => [k.toLowerCase(), unit]));
|
|
34095
|
+
const canon = Object.keys(CORE_UNIT_FACTORS).map((u) => [u.toLowerCase(), u]);
|
|
34096
|
+
return Object.fromEntries([...entries, ...canon]);
|
|
34097
|
+
})();
|
|
34098
|
+
const normalizeCoreUnit = (u) => {
|
|
34099
|
+
const key = String(u).trim().toLowerCase();
|
|
34100
|
+
const canon = CORE_ALIASES[key];
|
|
34101
|
+
if (!canon) {
|
|
34102
|
+
console.error(`Unknown core unit: "${u}"`);
|
|
34103
|
+
return "core";
|
|
34104
|
+
}
|
|
34105
|
+
return canon;
|
|
34106
|
+
};
|
|
34107
|
+
const convertCores = (cores, unit, opts) => {
|
|
34108
|
+
if (!Number.isFinite(cores)) {
|
|
34109
|
+
console.error("cores must be a finite number");
|
|
34110
|
+
return -1;
|
|
34111
|
+
}
|
|
34112
|
+
if (cores < 0) {
|
|
34113
|
+
console.error("cores must be >= 0");
|
|
34114
|
+
return -1;
|
|
34115
|
+
}
|
|
34116
|
+
const canon = normalizeCoreUnit(unit);
|
|
34117
|
+
const factor = CORE_UNIT_FACTORS[canon];
|
|
34118
|
+
const value = cores / factor;
|
|
34119
|
+
if (!opts?.format) return value;
|
|
34120
|
+
return `${value.toLocaleString(opts.locale, {
|
|
34121
|
+
minimumFractionDigits: 0,
|
|
34122
|
+
maximumFractionDigits: opts?.precision ?? 2
|
|
34123
|
+
})} ${canon}`;
|
|
34124
|
+
};
|
|
34125
|
+
const formatCoresAuto = (cores, { precision = 2, locale } = {}) => {
|
|
34126
|
+
if (!Number.isFinite(cores)) {
|
|
34127
|
+
console.error("cores must be a finite number");
|
|
34128
|
+
return "infinite";
|
|
34129
|
+
}
|
|
34130
|
+
if (cores < 0) {
|
|
34131
|
+
console.error("cores must be >= 0");
|
|
34132
|
+
return "less then zero";
|
|
34133
|
+
}
|
|
34134
|
+
if (cores === 0) {
|
|
34135
|
+
return "0 core";
|
|
34136
|
+
}
|
|
34137
|
+
let targetUnit;
|
|
34138
|
+
if (cores >= 1) {
|
|
34139
|
+
targetUnit = "core";
|
|
34140
|
+
} else if (cores >= 1e-3) {
|
|
34141
|
+
targetUnit = "mcore";
|
|
34142
|
+
} else if (cores >= 1e-6) {
|
|
34143
|
+
targetUnit = "ucore";
|
|
34144
|
+
} else {
|
|
34145
|
+
targetUnit = "ncore";
|
|
34146
|
+
}
|
|
34147
|
+
return String(convertCores(cores, targetUnit, { format: true, precision, locale }));
|
|
34148
|
+
};
|
|
34149
|
+
const toCores = (value, from) => {
|
|
34150
|
+
if (!Number.isFinite(value)) {
|
|
34151
|
+
console.error("value must be a finite number");
|
|
34152
|
+
return -1;
|
|
34153
|
+
}
|
|
34154
|
+
if (value < 0) {
|
|
34155
|
+
console.error("value must be >= 0");
|
|
34156
|
+
return -1;
|
|
34157
|
+
}
|
|
34158
|
+
const canon = normalizeCoreUnit(from);
|
|
34159
|
+
const factor = CORE_UNIT_FACTORS[canon];
|
|
34160
|
+
return value * factor;
|
|
34161
|
+
};
|
|
34162
|
+
const convertCompute = (value, from, to, opts) => {
|
|
34163
|
+
const cores = toCores(value, from);
|
|
34164
|
+
if (cores < 0) return -1;
|
|
34165
|
+
return convertCores(cores, to, opts);
|
|
34166
|
+
};
|
|
34167
|
+
const parseCoresWithUnit = (input) => {
|
|
34168
|
+
const trimmed = input.trim();
|
|
34169
|
+
if (!trimmed) return null;
|
|
34170
|
+
const match = trimmed.match(/^([+-]?\d+(?:\.\d+)?)(?:\s*([a-zA-Zµ]+))?$/);
|
|
34171
|
+
if (!match) return null;
|
|
34172
|
+
const [, numPart, unitPart] = match;
|
|
34173
|
+
const value = Number(numPart);
|
|
34174
|
+
if (!Number.isFinite(value)) return null;
|
|
34175
|
+
if (unitPart) {
|
|
34176
|
+
return { value, unit: unitPart };
|
|
34177
|
+
}
|
|
34178
|
+
return { value };
|
|
34179
|
+
};
|
|
34180
|
+
|
|
33967
34181
|
const DynamicRendererInner = ({
|
|
33968
34182
|
items,
|
|
33969
34183
|
components
|
|
@@ -44830,111 +45044,6 @@
|
|
|
44830
45044
|
] });
|
|
44831
45045
|
};
|
|
44832
45046
|
|
|
44833
|
-
const UNIT_FACTORS = {
|
|
44834
|
-
B: 1,
|
|
44835
|
-
kB: 1e3,
|
|
44836
|
-
MB: 1e6,
|
|
44837
|
-
GB: 1e9,
|
|
44838
|
-
TB: 1e12,
|
|
44839
|
-
PB: 1e15,
|
|
44840
|
-
EB: 1e18,
|
|
44841
|
-
KiB: 1024,
|
|
44842
|
-
MiB: 1024 ** 2,
|
|
44843
|
-
GiB: 1024 ** 3,
|
|
44844
|
-
TiB: 1024 ** 4,
|
|
44845
|
-
PiB: 1024 ** 5,
|
|
44846
|
-
EiB: 1024 ** 6
|
|
44847
|
-
};
|
|
44848
|
-
const ALIASES = (() => {
|
|
44849
|
-
const siPairs = [
|
|
44850
|
-
[["b", "byte", "bytes"], "B"],
|
|
44851
|
-
[["k", "kb", "kB", "KB"], "kB"],
|
|
44852
|
-
[["m", "mb", "MB"], "MB"],
|
|
44853
|
-
[["g", "gb", "GB"], "GB"],
|
|
44854
|
-
[["t", "tb, TB".replace(",", "")], "TB"],
|
|
44855
|
-
[["p", "pb", "PB"], "PB"],
|
|
44856
|
-
[["e", "eb", "EB"], "EB"]
|
|
44857
|
-
];
|
|
44858
|
-
const iecPairs = [
|
|
44859
|
-
[["ki", "kib", "Ki", "KiB"], "KiB"],
|
|
44860
|
-
[["mi", "mib", "Mi", "MiB"], "MiB"],
|
|
44861
|
-
[["gi", "gib", "Gi", "GiB"], "GiB"],
|
|
44862
|
-
[["ti", "tib", "Ti", "TiB"], "TiB"],
|
|
44863
|
-
[["pi", "pib", "Pi", "PiB"], "PiB"],
|
|
44864
|
-
[["ei", "eib", "Ei", "EiB"], "EiB"]
|
|
44865
|
-
];
|
|
44866
|
-
const entries = [...siPairs, ...iecPairs].flatMap(([keys, unit]) => keys.map((k) => [k.toLowerCase(), unit]));
|
|
44867
|
-
const canon = Object.keys(UNIT_FACTORS).map((u) => [u.toLowerCase(), u]);
|
|
44868
|
-
return Object.fromEntries([...entries, ...canon]);
|
|
44869
|
-
})();
|
|
44870
|
-
const normalizeUnit = (u) => {
|
|
44871
|
-
const key = String(u).trim().toLowerCase();
|
|
44872
|
-
const canon = ALIASES[key];
|
|
44873
|
-
if (!canon) {
|
|
44874
|
-
console.error(`Unknown unit: "${u}"`);
|
|
44875
|
-
return "GB";
|
|
44876
|
-
}
|
|
44877
|
-
return canon;
|
|
44878
|
-
};
|
|
44879
|
-
const convertBytes = (bytes, unit, opts) => {
|
|
44880
|
-
if (!Number.isFinite(bytes)) {
|
|
44881
|
-
console.error("bytes must be a finite number");
|
|
44882
|
-
return -1;
|
|
44883
|
-
}
|
|
44884
|
-
if (bytes < 0) {
|
|
44885
|
-
console.error("bytes must be >= 0");
|
|
44886
|
-
return -1;
|
|
44887
|
-
}
|
|
44888
|
-
const canon = normalizeUnit(unit);
|
|
44889
|
-
const factor = UNIT_FACTORS[canon];
|
|
44890
|
-
const value = bytes / factor;
|
|
44891
|
-
return opts?.format ? `${value.toLocaleString(opts.locale, {
|
|
44892
|
-
minimumFractionDigits: 0,
|
|
44893
|
-
maximumFractionDigits: opts?.precision ?? 2
|
|
44894
|
-
})} ${canon}` : value;
|
|
44895
|
-
};
|
|
44896
|
-
const formatBytesAuto = (bytes, { standard = "si", precision = 2, locale } = {}) => {
|
|
44897
|
-
if (!Number.isFinite(bytes)) {
|
|
44898
|
-
console.error("bytes must be a finite number");
|
|
44899
|
-
return "infinite";
|
|
44900
|
-
}
|
|
44901
|
-
if (bytes < 0) {
|
|
44902
|
-
console.error("bytes must be >= 0");
|
|
44903
|
-
return "less then zero";
|
|
44904
|
-
}
|
|
44905
|
-
const ladder = standard === "iec" ? ["B", "KiB", "MiB", "GiB", "TiB", "PiB", "EiB"] : ["B", "kB", "MB", "GB", "TB", "PB", "EB"];
|
|
44906
|
-
const base = standard === "iec" ? 1024 : 1e3;
|
|
44907
|
-
const idx = bytes > 0 ? Math.min(ladder.length - 1, Math.floor(Math.log(bytes) / Math.log(base))) : 0;
|
|
44908
|
-
const unit = ladder[Math.max(0, idx)];
|
|
44909
|
-
return String(convertBytes(bytes, unit, { format: true, precision, locale }));
|
|
44910
|
-
};
|
|
44911
|
-
const toBytes = (value, from) => {
|
|
44912
|
-
if (!Number.isFinite(value)) {
|
|
44913
|
-
console.error("value must be a finite number");
|
|
44914
|
-
return -1;
|
|
44915
|
-
}
|
|
44916
|
-
if (value < 0) {
|
|
44917
|
-
console.error("value must be >= 0");
|
|
44918
|
-
return -1;
|
|
44919
|
-
}
|
|
44920
|
-
const canon = normalizeUnit(from);
|
|
44921
|
-
const factor = UNIT_FACTORS[canon];
|
|
44922
|
-
return value * factor;
|
|
44923
|
-
};
|
|
44924
|
-
const parseValueWithUnit = (input) => {
|
|
44925
|
-
const trimmed = input.trim();
|
|
44926
|
-
if (!trimmed) return null;
|
|
44927
|
-
const match = trimmed.match(/^([+-]?\d+(?:\.\d+)?)(?:\s*([a-zA-Z]+))?$/);
|
|
44928
|
-
if (!match) return null;
|
|
44929
|
-
const [, numPart, unitPart] = match;
|
|
44930
|
-
const value = Number(numPart);
|
|
44931
|
-
if (!Number.isFinite(value)) return null;
|
|
44932
|
-
if (unitPart) {
|
|
44933
|
-
return { value, unit: unitPart };
|
|
44934
|
-
}
|
|
44935
|
-
return { value };
|
|
44936
|
-
};
|
|
44937
|
-
|
|
44938
45047
|
const ConverterBytes = ({ data }) => {
|
|
44939
45048
|
const {
|
|
44940
45049
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
@@ -45033,105 +45142,6 @@
|
|
|
45033
45142
|
return /* @__PURE__ */ jsxRuntimeExports.jsx("span", { style, children: result });
|
|
45034
45143
|
};
|
|
45035
45144
|
|
|
45036
|
-
const CORE_UNIT_FACTORS = {
|
|
45037
|
-
core: 1,
|
|
45038
|
-
mcore: 1e-3,
|
|
45039
|
-
ucore: 1e-6,
|
|
45040
|
-
ncore: 1e-9
|
|
45041
|
-
};
|
|
45042
|
-
const CORE_ALIASES = (() => {
|
|
45043
|
-
const corePairs = [
|
|
45044
|
-
// plain cores
|
|
45045
|
-
[["core", "cores", "c", "cpu", "cpus", "vcpu", "vcpus"], "core"],
|
|
45046
|
-
// millicores
|
|
45047
|
-
[["m", "mc", "mcore", "mcores", "millicore", "millicores", "millicpu", "millicpus"], "mcore"],
|
|
45048
|
-
// microcores
|
|
45049
|
-
[["u", "µ", "ucore", "ucores", "micro", "microcore", "microcores"], "ucore"],
|
|
45050
|
-
// nanocores
|
|
45051
|
-
[["n", "ncore", "ncores", "nano", "nanocore", "nanocores"], "ncore"]
|
|
45052
|
-
];
|
|
45053
|
-
const entries = corePairs.flatMap(([keys, unit]) => keys.map((k) => [k.toLowerCase(), unit]));
|
|
45054
|
-
const canon = Object.keys(CORE_UNIT_FACTORS).map((u) => [u.toLowerCase(), u]);
|
|
45055
|
-
return Object.fromEntries([...entries, ...canon]);
|
|
45056
|
-
})();
|
|
45057
|
-
const normalizeCoreUnit = (u) => {
|
|
45058
|
-
const key = String(u).trim().toLowerCase();
|
|
45059
|
-
const canon = CORE_ALIASES[key];
|
|
45060
|
-
if (!canon) {
|
|
45061
|
-
console.error(`Unknown core unit: "${u}"`);
|
|
45062
|
-
return "core";
|
|
45063
|
-
}
|
|
45064
|
-
return canon;
|
|
45065
|
-
};
|
|
45066
|
-
const convertCores = (cores, unit, opts) => {
|
|
45067
|
-
if (!Number.isFinite(cores)) {
|
|
45068
|
-
console.error("cores must be a finite number");
|
|
45069
|
-
return -1;
|
|
45070
|
-
}
|
|
45071
|
-
if (cores < 0) {
|
|
45072
|
-
console.error("cores must be >= 0");
|
|
45073
|
-
return -1;
|
|
45074
|
-
}
|
|
45075
|
-
const canon = normalizeCoreUnit(unit);
|
|
45076
|
-
const factor = CORE_UNIT_FACTORS[canon];
|
|
45077
|
-
const value = cores / factor;
|
|
45078
|
-
if (!opts?.format) return value;
|
|
45079
|
-
return `${value.toLocaleString(opts.locale, {
|
|
45080
|
-
minimumFractionDigits: 0,
|
|
45081
|
-
maximumFractionDigits: opts?.precision ?? 2
|
|
45082
|
-
})} ${canon}`;
|
|
45083
|
-
};
|
|
45084
|
-
const formatCoresAuto = (cores, { precision = 2, locale } = {}) => {
|
|
45085
|
-
if (!Number.isFinite(cores)) {
|
|
45086
|
-
console.error("cores must be a finite number");
|
|
45087
|
-
return "infinite";
|
|
45088
|
-
}
|
|
45089
|
-
if (cores < 0) {
|
|
45090
|
-
console.error("cores must be >= 0");
|
|
45091
|
-
return "less then zero";
|
|
45092
|
-
}
|
|
45093
|
-
if (cores === 0) {
|
|
45094
|
-
return "0 core";
|
|
45095
|
-
}
|
|
45096
|
-
let targetUnit;
|
|
45097
|
-
if (cores >= 1) {
|
|
45098
|
-
targetUnit = "core";
|
|
45099
|
-
} else if (cores >= 1e-3) {
|
|
45100
|
-
targetUnit = "mcore";
|
|
45101
|
-
} else if (cores >= 1e-6) {
|
|
45102
|
-
targetUnit = "ucore";
|
|
45103
|
-
} else {
|
|
45104
|
-
targetUnit = "ncore";
|
|
45105
|
-
}
|
|
45106
|
-
return String(convertCores(cores, targetUnit, { format: true, precision, locale }));
|
|
45107
|
-
};
|
|
45108
|
-
const toCores = (value, from) => {
|
|
45109
|
-
if (!Number.isFinite(value)) {
|
|
45110
|
-
console.error("value must be a finite number");
|
|
45111
|
-
return -1;
|
|
45112
|
-
}
|
|
45113
|
-
if (value < 0) {
|
|
45114
|
-
console.error("value must be >= 0");
|
|
45115
|
-
return -1;
|
|
45116
|
-
}
|
|
45117
|
-
const canon = normalizeCoreUnit(from);
|
|
45118
|
-
const factor = CORE_UNIT_FACTORS[canon];
|
|
45119
|
-
return value * factor;
|
|
45120
|
-
};
|
|
45121
|
-
const parseCoresWithUnit = (input) => {
|
|
45122
|
-
const trimmed = input.trim();
|
|
45123
|
-
if (!trimmed) return null;
|
|
45124
|
-
const match = trimmed.match(/^([+-]?\d+(?:\.\d+)?)(?:\s*([a-zA-Zµ]+))?$/);
|
|
45125
|
-
if (!match) return null;
|
|
45126
|
-
const [, numPart, unitPart] = match;
|
|
45127
|
-
const value = Number(numPart);
|
|
45128
|
-
if (!Number.isFinite(value)) return null;
|
|
45129
|
-
if (unitPart) {
|
|
45130
|
-
return { value, unit: unitPart };
|
|
45131
|
-
}
|
|
45132
|
-
return { value };
|
|
45133
|
-
};
|
|
45134
|
-
|
|
45135
45145
|
const ConverterCores = ({ data }) => {
|
|
45136
45146
|
const {
|
|
45137
45147
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
@@ -47051,7 +47061,7 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
|
|
|
47051
47061
|
additionalPrinterColumnsTrimLengths,
|
|
47052
47062
|
additionalPrinterColumnsColWidths,
|
|
47053
47063
|
additionalPrinterColumnsKeyTypeProps,
|
|
47054
|
-
|
|
47064
|
+
additionalPrinterColumnsCustomSortersAndFilters,
|
|
47055
47065
|
theme,
|
|
47056
47066
|
getRowKey
|
|
47057
47067
|
// for factory search
|
|
@@ -47060,7 +47070,10 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
|
|
|
47060
47070
|
return void 0;
|
|
47061
47071
|
}
|
|
47062
47072
|
return columns.map((el, colIndex) => {
|
|
47063
|
-
const
|
|
47073
|
+
const possibleAdditionalPrinterColumnsCustomSortersAndFiltersType = additionalPrinterColumnsCustomSortersAndFilters?.find(({ key }) => key === el.key)?.type;
|
|
47074
|
+
const isSortersAndFitlersDisabled = possibleAdditionalPrinterColumnsCustomSortersAndFiltersType === "disabled";
|
|
47075
|
+
const isSortersAndFitlersCPU = possibleAdditionalPrinterColumnsCustomSortersAndFiltersType === "cpu";
|
|
47076
|
+
const isSortersAndFitlersMemory = possibleAdditionalPrinterColumnsCustomSortersAndFiltersType === "memory";
|
|
47064
47077
|
const possibleUndefinedValue = additionalPrinterColumnsUndefinedValues?.find(({ key }) => key === el.key)?.value;
|
|
47065
47078
|
const possibleTrimLength = additionalPrinterColumnsTrimLengths?.find(({ key }) => key === el.key)?.value;
|
|
47066
47079
|
const possibleColWidth = additionalPrinterColumnsColWidths?.find(({ key }) => key === el.key)?.value;
|
|
@@ -47074,6 +47087,47 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
|
|
|
47074
47087
|
if (!cell) return "";
|
|
47075
47088
|
return (cell.innerText || cell.textContent || "").trim().toLowerCase();
|
|
47076
47089
|
};
|
|
47090
|
+
const getEntry = (record) => {
|
|
47091
|
+
const { dataIndex } = el;
|
|
47092
|
+
return Array.isArray(dataIndex) ? lodashExports.get(record, dataIndex) : record[dataIndex];
|
|
47093
|
+
};
|
|
47094
|
+
const getTextForNumericUnitSort = (record) => {
|
|
47095
|
+
if (useFactorySearch) {
|
|
47096
|
+
const textFromDom = getCellTextFromDOM(record);
|
|
47097
|
+
if (textFromDom) return textFromDom;
|
|
47098
|
+
}
|
|
47099
|
+
const raw = getEntry(record);
|
|
47100
|
+
if (raw == null) return null;
|
|
47101
|
+
return String(raw);
|
|
47102
|
+
};
|
|
47103
|
+
const getMemoryInBytes = (record) => {
|
|
47104
|
+
const text = getTextForNumericUnitSort(record);
|
|
47105
|
+
if (!text) return NaN;
|
|
47106
|
+
const parsed = parseValueWithUnit(text);
|
|
47107
|
+
if (!parsed) return NaN;
|
|
47108
|
+
if (parsed.unit) {
|
|
47109
|
+
return toBytes(parsed.value, parsed.unit);
|
|
47110
|
+
}
|
|
47111
|
+
return parsed.value;
|
|
47112
|
+
};
|
|
47113
|
+
const getCpuInCores = (record) => {
|
|
47114
|
+
const text = getTextForNumericUnitSort(record);
|
|
47115
|
+
if (!text) return NaN;
|
|
47116
|
+
const parsed = parseCoresWithUnit(text);
|
|
47117
|
+
if (!parsed) return NaN;
|
|
47118
|
+
if (parsed.unit) {
|
|
47119
|
+
return toCores(parsed.value, parsed.unit);
|
|
47120
|
+
}
|
|
47121
|
+
return parsed.value;
|
|
47122
|
+
};
|
|
47123
|
+
const safeNumericCompare = (a, b) => {
|
|
47124
|
+
const aNaN = Number.isNaN(a);
|
|
47125
|
+
const bNaN = Number.isNaN(b);
|
|
47126
|
+
if (aNaN && bNaN) return 0;
|
|
47127
|
+
if (aNaN) return 1;
|
|
47128
|
+
if (bNaN) return -1;
|
|
47129
|
+
return a - b;
|
|
47130
|
+
};
|
|
47077
47131
|
return {
|
|
47078
47132
|
...el,
|
|
47079
47133
|
render: (value, record) => getCellRender({
|
|
@@ -47094,7 +47148,7 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
|
|
|
47094
47148
|
};
|
|
47095
47149
|
},
|
|
47096
47150
|
filterDropdown: ({ setSelectedKeys, selectedKeys, confirm, clearFilters, close }) => {
|
|
47097
|
-
if (isSortersAndFitlersDisabled) {
|
|
47151
|
+
if (isSortersAndFitlersDisabled || isSortersAndFitlersMemory || isSortersAndFitlersCPU) {
|
|
47098
47152
|
return null;
|
|
47099
47153
|
}
|
|
47100
47154
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
@@ -47109,13 +47163,13 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
|
|
|
47109
47163
|
);
|
|
47110
47164
|
},
|
|
47111
47165
|
filterIcon: (filtered) => {
|
|
47112
|
-
if (isSortersAndFitlersDisabled) {
|
|
47166
|
+
if (isSortersAndFitlersDisabled || isSortersAndFitlersMemory || isSortersAndFitlersCPU) {
|
|
47113
47167
|
return null;
|
|
47114
47168
|
}
|
|
47115
47169
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(icons.SearchOutlined, { style: { color: filtered ? "#1677ff" : void 0 } });
|
|
47116
47170
|
},
|
|
47117
47171
|
onFilter: (value, record) => {
|
|
47118
|
-
if (isSortersAndFitlersDisabled) {
|
|
47172
|
+
if (isSortersAndFitlersDisabled || isSortersAndFitlersMemory || isSortersAndFitlersCPU) {
|
|
47119
47173
|
return false;
|
|
47120
47174
|
}
|
|
47121
47175
|
if (useFactorySearch) {
|
|
@@ -47148,6 +47202,16 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
|
|
|
47148
47202
|
const bText = getCellTextFromDOM(b);
|
|
47149
47203
|
return aText.localeCompare(bText);
|
|
47150
47204
|
}
|
|
47205
|
+
if (isSortersAndFitlersMemory) {
|
|
47206
|
+
const aBytes = getMemoryInBytes(a);
|
|
47207
|
+
const bBytes = getMemoryInBytes(b);
|
|
47208
|
+
return safeNumericCompare(aBytes, bBytes);
|
|
47209
|
+
}
|
|
47210
|
+
if (isSortersAndFitlersCPU) {
|
|
47211
|
+
const aCores = getCpuInCores(a);
|
|
47212
|
+
const bCores = getCpuInCores(b);
|
|
47213
|
+
return safeNumericCompare(aCores, bCores);
|
|
47214
|
+
}
|
|
47151
47215
|
const { dataIndex } = el;
|
|
47152
47216
|
const aEntry = Array.isArray(dataIndex) ? lodashExports.get(a, dataIndex) : a[dataIndex];
|
|
47153
47217
|
const bEntry = Array.isArray(dataIndex) ? lodashExports.get(b, dataIndex) : b[dataIndex];
|
|
@@ -47278,7 +47342,7 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
|
|
|
47278
47342
|
additionalPrinterColumnsTrimLengths,
|
|
47279
47343
|
additionalPrinterColumnsColWidths,
|
|
47280
47344
|
additionalPrinterColumnsKeyTypeProps,
|
|
47281
|
-
|
|
47345
|
+
additionalPrinterColumnsCustomSortersAndFilters,
|
|
47282
47346
|
selectData,
|
|
47283
47347
|
withoutControls = false,
|
|
47284
47348
|
tableProps
|
|
@@ -47294,7 +47358,7 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
|
|
|
47294
47358
|
additionalPrinterColumnsTrimLengths,
|
|
47295
47359
|
additionalPrinterColumnsColWidths,
|
|
47296
47360
|
additionalPrinterColumnsKeyTypeProps,
|
|
47297
|
-
|
|
47361
|
+
additionalPrinterColumnsCustomSortersAndFilters,
|
|
47298
47362
|
theme,
|
|
47299
47363
|
getRowKey: rowKey
|
|
47300
47364
|
// for factory search
|
|
@@ -47665,7 +47729,7 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
|
|
|
47665
47729
|
additionalPrinterColumnsTrimLengths: preparedProps.additionalPrinterColumnsTrimLengths,
|
|
47666
47730
|
additionalPrinterColumnsColWidths: preparedProps.additionalPrinterColumnsColWidths,
|
|
47667
47731
|
additionalPrinterColumnsKeyTypeProps: preparedProps.additionalPrinterColumnsKeyTypeProps,
|
|
47668
|
-
|
|
47732
|
+
additionalPrinterColumnsCustomSortersAndFilters: preparedProps.additionalPrinterColumnsCustomSortersAndFilters,
|
|
47669
47733
|
selectData,
|
|
47670
47734
|
tableProps,
|
|
47671
47735
|
withoutControls
|
|
@@ -54996,6 +55060,10 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
|
|
|
54996
55060
|
exports.checkIfApiInstanceNamespaceScoped = checkIfApiInstanceNamespaceScoped;
|
|
54997
55061
|
exports.checkIfBuiltInInstanceNamespaceScoped = checkIfBuiltInInstanceNamespaceScoped;
|
|
54998
55062
|
exports.checkPermission = checkPermission;
|
|
55063
|
+
exports.convertBytes = convertBytes;
|
|
55064
|
+
exports.convertCompute = convertCompute;
|
|
55065
|
+
exports.convertCores = convertCores;
|
|
55066
|
+
exports.convertStorage = convertStorage;
|
|
54999
55067
|
exports.createContextFactory = createContextFactory;
|
|
55000
55068
|
exports.createNewEntry = createNewEntry;
|
|
55001
55069
|
exports.deepMerge = deepMerge;
|
|
@@ -55005,6 +55073,8 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
|
|
|
55005
55073
|
exports.filterIfBuiltInInstanceNamespaceScoped = filterIfBuiltInInstanceNamespaceScoped;
|
|
55006
55074
|
exports.filterSelectOptions = filterSelectOptions;
|
|
55007
55075
|
exports.floorToDecimal = floorToDecimal;
|
|
55076
|
+
exports.formatBytesAuto = formatBytesAuto;
|
|
55077
|
+
exports.formatCoresAuto = formatCoresAuto;
|
|
55008
55078
|
exports.getAllPathsFromObj = getAllPathsFromObj;
|
|
55009
55079
|
exports.getApiResourceSingle = getApiResourceSingle;
|
|
55010
55080
|
exports.getApiResourceTypes = getApiResourceTypes;
|
|
@@ -55044,14 +55114,18 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
|
|
|
55044
55114
|
exports.kindByGvr = kindByGvr;
|
|
55045
55115
|
exports.namespacedByGvr = namespacedByGvr;
|
|
55046
55116
|
exports.normalizeValuesForQuotasToNumber = normalizeValuesForQuotasToNumber;
|
|
55117
|
+
exports.parseCoresWithUnit = parseCoresWithUnit;
|
|
55047
55118
|
exports.parseQuotaValue = parseQuotaValue;
|
|
55048
55119
|
exports.parseQuotaValueCpu = parseQuotaValueCpu;
|
|
55049
55120
|
exports.parseQuotaValueMemoryAndStorage = parseQuotaValueMemoryAndStorage;
|
|
55121
|
+
exports.parseValueWithUnit = parseValueWithUnit;
|
|
55050
55122
|
exports.pluralByKind = pluralByKind;
|
|
55051
55123
|
exports.prepareDataForManageableBreadcrumbs = prepareDataForManageableBreadcrumbs;
|
|
55052
55124
|
exports.prepareDataForManageableSidebar = prepareDataForManageableSidebar;
|
|
55053
55125
|
exports.prepareTemplate = prepareTemplate;
|
|
55054
55126
|
exports.prepareUrlsToFetchForDynamicRenderer = prepareUrlsToFetchForDynamicRenderer;
|
|
55127
|
+
exports.toBytes = toBytes;
|
|
55128
|
+
exports.toCores = toCores;
|
|
55055
55129
|
exports.updateEntry = updateEntry;
|
|
55056
55130
|
exports.useApiResourceSingle = useApiResourceSingle;
|
|
55057
55131
|
exports.useApiResourceTypesByGroup = useApiResourceTypesByGroup;
|