@prorobotech/openapi-k8s-toolkit 1.2.0-alpha.6 → 1.2.0-alpha.8
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 +267 -214
- package/dist/openapi-k8s-toolkit.es.js.map +1 -1
- package/dist/openapi-k8s-toolkit.umd.js +276 -213
- 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/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 isSortersAndFiltersDisabled = possibleAdditionalPrinterColumnsCustomSortersAndFiltersType === "disabled";
|
|
47075
|
+
const isSortersAndFiltersCPU = possibleAdditionalPrinterColumnsCustomSortersAndFiltersType === "cpu";
|
|
47076
|
+
const isSortersAndFiltersMemory = 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,36 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
|
|
|
47074
47087
|
if (!cell) return "";
|
|
47075
47088
|
return (cell.innerText || cell.textContent || "").trim().toLowerCase();
|
|
47076
47089
|
};
|
|
47090
|
+
const getMemoryInBytes = (record) => {
|
|
47091
|
+
const text = getCellTextFromDOM(record);
|
|
47092
|
+
if (!text) return 0;
|
|
47093
|
+
const parsed = parseValueWithUnit(text);
|
|
47094
|
+
if (!parsed) return 0;
|
|
47095
|
+
if (parsed.unit) {
|
|
47096
|
+
const bytes = toBytes(parsed.value, parsed.unit);
|
|
47097
|
+
return bytes >= 0 ? bytes : 0;
|
|
47098
|
+
}
|
|
47099
|
+
return parsed.value;
|
|
47100
|
+
};
|
|
47101
|
+
const getCpuInCores = (record) => {
|
|
47102
|
+
const text = getCellTextFromDOM(record);
|
|
47103
|
+
if (!text) return 0;
|
|
47104
|
+
const parsed = parseCoresWithUnit(text);
|
|
47105
|
+
if (!parsed) return 0;
|
|
47106
|
+
if (parsed.unit) {
|
|
47107
|
+
const cores = toCores(parsed.value, parsed.unit);
|
|
47108
|
+
return cores >= 0 ? cores : 0;
|
|
47109
|
+
}
|
|
47110
|
+
return parsed.value;
|
|
47111
|
+
};
|
|
47112
|
+
const safeNumericCompare = (a, b) => {
|
|
47113
|
+
const aNaN = Number.isNaN(a);
|
|
47114
|
+
const bNaN = Number.isNaN(b);
|
|
47115
|
+
if (aNaN && bNaN) return 0;
|
|
47116
|
+
if (aNaN) return 1;
|
|
47117
|
+
if (bNaN) return -1;
|
|
47118
|
+
return a - b;
|
|
47119
|
+
};
|
|
47077
47120
|
return {
|
|
47078
47121
|
...el,
|
|
47079
47122
|
render: (value, record) => getCellRender({
|
|
@@ -47094,7 +47137,7 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
|
|
|
47094
47137
|
};
|
|
47095
47138
|
},
|
|
47096
47139
|
filterDropdown: ({ setSelectedKeys, selectedKeys, confirm, clearFilters, close }) => {
|
|
47097
|
-
if (
|
|
47140
|
+
if (isSortersAndFiltersDisabled || isSortersAndFiltersMemory || isSortersAndFiltersCPU) {
|
|
47098
47141
|
return null;
|
|
47099
47142
|
}
|
|
47100
47143
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
@@ -47109,13 +47152,13 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
|
|
|
47109
47152
|
);
|
|
47110
47153
|
},
|
|
47111
47154
|
filterIcon: (filtered) => {
|
|
47112
|
-
if (
|
|
47155
|
+
if (isSortersAndFiltersDisabled || isSortersAndFiltersMemory || isSortersAndFiltersCPU) {
|
|
47113
47156
|
return null;
|
|
47114
47157
|
}
|
|
47115
47158
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(icons.SearchOutlined, { style: { color: filtered ? "#1677ff" : void 0 } });
|
|
47116
47159
|
},
|
|
47117
47160
|
onFilter: (value, record) => {
|
|
47118
|
-
if (
|
|
47161
|
+
if (isSortersAndFiltersDisabled || isSortersAndFiltersMemory || isSortersAndFiltersCPU) {
|
|
47119
47162
|
return false;
|
|
47120
47163
|
}
|
|
47121
47164
|
if (useFactorySearch) {
|
|
@@ -47142,7 +47185,17 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
|
|
|
47142
47185
|
}
|
|
47143
47186
|
return false;
|
|
47144
47187
|
},
|
|
47145
|
-
sorter:
|
|
47188
|
+
sorter: isSortersAndFiltersDisabled ? false : (a, b) => {
|
|
47189
|
+
if (isSortersAndFiltersMemory) {
|
|
47190
|
+
const aBytes = getMemoryInBytes(a);
|
|
47191
|
+
const bBytes = getMemoryInBytes(b);
|
|
47192
|
+
return safeNumericCompare(aBytes, bBytes);
|
|
47193
|
+
}
|
|
47194
|
+
if (isSortersAndFiltersCPU) {
|
|
47195
|
+
const aCores = getCpuInCores(a);
|
|
47196
|
+
const bCores = getCpuInCores(b);
|
|
47197
|
+
return safeNumericCompare(aCores, bCores);
|
|
47198
|
+
}
|
|
47146
47199
|
if (useFactorySearch) {
|
|
47147
47200
|
const aText = getCellTextFromDOM(a);
|
|
47148
47201
|
const bText = getCellTextFromDOM(b);
|
|
@@ -47278,7 +47331,7 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
|
|
|
47278
47331
|
additionalPrinterColumnsTrimLengths,
|
|
47279
47332
|
additionalPrinterColumnsColWidths,
|
|
47280
47333
|
additionalPrinterColumnsKeyTypeProps,
|
|
47281
|
-
|
|
47334
|
+
additionalPrinterColumnsCustomSortersAndFilters,
|
|
47282
47335
|
selectData,
|
|
47283
47336
|
withoutControls = false,
|
|
47284
47337
|
tableProps
|
|
@@ -47294,7 +47347,7 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
|
|
|
47294
47347
|
additionalPrinterColumnsTrimLengths,
|
|
47295
47348
|
additionalPrinterColumnsColWidths,
|
|
47296
47349
|
additionalPrinterColumnsKeyTypeProps,
|
|
47297
|
-
|
|
47350
|
+
additionalPrinterColumnsCustomSortersAndFilters,
|
|
47298
47351
|
theme,
|
|
47299
47352
|
getRowKey: rowKey
|
|
47300
47353
|
// for factory search
|
|
@@ -47665,7 +47718,7 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
|
|
|
47665
47718
|
additionalPrinterColumnsTrimLengths: preparedProps.additionalPrinterColumnsTrimLengths,
|
|
47666
47719
|
additionalPrinterColumnsColWidths: preparedProps.additionalPrinterColumnsColWidths,
|
|
47667
47720
|
additionalPrinterColumnsKeyTypeProps: preparedProps.additionalPrinterColumnsKeyTypeProps,
|
|
47668
|
-
|
|
47721
|
+
additionalPrinterColumnsCustomSortersAndFilters: preparedProps.additionalPrinterColumnsCustomSortersAndFilters,
|
|
47669
47722
|
selectData,
|
|
47670
47723
|
tableProps,
|
|
47671
47724
|
withoutControls
|
|
@@ -54996,6 +55049,10 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
|
|
|
54996
55049
|
exports.checkIfApiInstanceNamespaceScoped = checkIfApiInstanceNamespaceScoped;
|
|
54997
55050
|
exports.checkIfBuiltInInstanceNamespaceScoped = checkIfBuiltInInstanceNamespaceScoped;
|
|
54998
55051
|
exports.checkPermission = checkPermission;
|
|
55052
|
+
exports.convertBytes = convertBytes;
|
|
55053
|
+
exports.convertCompute = convertCompute;
|
|
55054
|
+
exports.convertCores = convertCores;
|
|
55055
|
+
exports.convertStorage = convertStorage;
|
|
54999
55056
|
exports.createContextFactory = createContextFactory;
|
|
55000
55057
|
exports.createNewEntry = createNewEntry;
|
|
55001
55058
|
exports.deepMerge = deepMerge;
|
|
@@ -55005,6 +55062,8 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
|
|
|
55005
55062
|
exports.filterIfBuiltInInstanceNamespaceScoped = filterIfBuiltInInstanceNamespaceScoped;
|
|
55006
55063
|
exports.filterSelectOptions = filterSelectOptions;
|
|
55007
55064
|
exports.floorToDecimal = floorToDecimal;
|
|
55065
|
+
exports.formatBytesAuto = formatBytesAuto;
|
|
55066
|
+
exports.formatCoresAuto = formatCoresAuto;
|
|
55008
55067
|
exports.getAllPathsFromObj = getAllPathsFromObj;
|
|
55009
55068
|
exports.getApiResourceSingle = getApiResourceSingle;
|
|
55010
55069
|
exports.getApiResourceTypes = getApiResourceTypes;
|
|
@@ -55044,14 +55103,18 @@ if (_IS_WORKLET) registerPaint("spoiler", SpoilerPainterWorklet);
|
|
|
55044
55103
|
exports.kindByGvr = kindByGvr;
|
|
55045
55104
|
exports.namespacedByGvr = namespacedByGvr;
|
|
55046
55105
|
exports.normalizeValuesForQuotasToNumber = normalizeValuesForQuotasToNumber;
|
|
55106
|
+
exports.parseCoresWithUnit = parseCoresWithUnit;
|
|
55047
55107
|
exports.parseQuotaValue = parseQuotaValue;
|
|
55048
55108
|
exports.parseQuotaValueCpu = parseQuotaValueCpu;
|
|
55049
55109
|
exports.parseQuotaValueMemoryAndStorage = parseQuotaValueMemoryAndStorage;
|
|
55110
|
+
exports.parseValueWithUnit = parseValueWithUnit;
|
|
55050
55111
|
exports.pluralByKind = pluralByKind;
|
|
55051
55112
|
exports.prepareDataForManageableBreadcrumbs = prepareDataForManageableBreadcrumbs;
|
|
55052
55113
|
exports.prepareDataForManageableSidebar = prepareDataForManageableSidebar;
|
|
55053
55114
|
exports.prepareTemplate = prepareTemplate;
|
|
55054
55115
|
exports.prepareUrlsToFetchForDynamicRenderer = prepareUrlsToFetchForDynamicRenderer;
|
|
55116
|
+
exports.toBytes = toBytes;
|
|
55117
|
+
exports.toCores = toCores;
|
|
55055
55118
|
exports.updateEntry = updateEntry;
|
|
55056
55119
|
exports.useApiResourceSingle = useApiResourceSingle;
|
|
55057
55120
|
exports.useApiResourceTypesByGroup = useApiResourceTypesByGroup;
|