@prorobotech/openapi-k8s-toolkit 1.2.0-alpha.6 → 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/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
|
@@ -33965,6 +33965,220 @@ const isFlatObject = (obj) => {
|
|
|
33965
33965
|
});
|
|
33966
33966
|
};
|
|
33967
33967
|
|
|
33968
|
+
const UNIT_FACTORS = {
|
|
33969
|
+
B: 1,
|
|
33970
|
+
kB: 1e3,
|
|
33971
|
+
MB: 1e6,
|
|
33972
|
+
GB: 1e9,
|
|
33973
|
+
TB: 1e12,
|
|
33974
|
+
PB: 1e15,
|
|
33975
|
+
EB: 1e18,
|
|
33976
|
+
KiB: 1024,
|
|
33977
|
+
MiB: 1024 ** 2,
|
|
33978
|
+
GiB: 1024 ** 3,
|
|
33979
|
+
TiB: 1024 ** 4,
|
|
33980
|
+
PiB: 1024 ** 5,
|
|
33981
|
+
EiB: 1024 ** 6
|
|
33982
|
+
};
|
|
33983
|
+
const ALIASES = (() => {
|
|
33984
|
+
const siPairs = [
|
|
33985
|
+
[["b", "byte", "bytes"], "B"],
|
|
33986
|
+
[["k", "kb", "kB", "KB"], "kB"],
|
|
33987
|
+
[["m", "mb", "MB"], "MB"],
|
|
33988
|
+
[["g", "gb", "GB"], "GB"],
|
|
33989
|
+
[["t", "tb, TB".replace(",", "")], "TB"],
|
|
33990
|
+
[["p", "pb", "PB"], "PB"],
|
|
33991
|
+
[["e", "eb", "EB"], "EB"]
|
|
33992
|
+
];
|
|
33993
|
+
const iecPairs = [
|
|
33994
|
+
[["ki", "kib", "Ki", "KiB"], "KiB"],
|
|
33995
|
+
[["mi", "mib", "Mi", "MiB"], "MiB"],
|
|
33996
|
+
[["gi", "gib", "Gi", "GiB"], "GiB"],
|
|
33997
|
+
[["ti", "tib", "Ti", "TiB"], "TiB"],
|
|
33998
|
+
[["pi", "pib", "Pi", "PiB"], "PiB"],
|
|
33999
|
+
[["ei", "eib", "Ei", "EiB"], "EiB"]
|
|
34000
|
+
];
|
|
34001
|
+
const entries = [...siPairs, ...iecPairs].flatMap(([keys, unit]) => keys.map((k) => [k.toLowerCase(), unit]));
|
|
34002
|
+
const canon = Object.keys(UNIT_FACTORS).map((u) => [u.toLowerCase(), u]);
|
|
34003
|
+
return Object.fromEntries([...entries, ...canon]);
|
|
34004
|
+
})();
|
|
34005
|
+
const normalizeUnit = (u) => {
|
|
34006
|
+
const key = String(u).trim().toLowerCase();
|
|
34007
|
+
const canon = ALIASES[key];
|
|
34008
|
+
if (!canon) {
|
|
34009
|
+
console.error(`Unknown unit: "${u}"`);
|
|
34010
|
+
return "GB";
|
|
34011
|
+
}
|
|
34012
|
+
return canon;
|
|
34013
|
+
};
|
|
34014
|
+
const convertBytes = (bytes, unit, opts) => {
|
|
34015
|
+
if (!Number.isFinite(bytes)) {
|
|
34016
|
+
console.error("bytes must be a finite number");
|
|
34017
|
+
return -1;
|
|
34018
|
+
}
|
|
34019
|
+
if (bytes < 0) {
|
|
34020
|
+
console.error("bytes must be >= 0");
|
|
34021
|
+
return -1;
|
|
34022
|
+
}
|
|
34023
|
+
const canon = normalizeUnit(unit);
|
|
34024
|
+
const factor = UNIT_FACTORS[canon];
|
|
34025
|
+
const value = bytes / factor;
|
|
34026
|
+
return opts?.format ? `${value.toLocaleString(opts.locale, {
|
|
34027
|
+
minimumFractionDigits: 0,
|
|
34028
|
+
maximumFractionDigits: opts?.precision ?? 2
|
|
34029
|
+
})} ${canon}` : value;
|
|
34030
|
+
};
|
|
34031
|
+
const formatBytesAuto = (bytes, { standard = "si", precision = 2, locale } = {}) => {
|
|
34032
|
+
if (!Number.isFinite(bytes)) {
|
|
34033
|
+
console.error("bytes must be a finite number");
|
|
34034
|
+
return "infinite";
|
|
34035
|
+
}
|
|
34036
|
+
if (bytes < 0) {
|
|
34037
|
+
console.error("bytes must be >= 0");
|
|
34038
|
+
return "less then zero";
|
|
34039
|
+
}
|
|
34040
|
+
const ladder = standard === "iec" ? ["B", "KiB", "MiB", "GiB", "TiB", "PiB", "EiB"] : ["B", "kB", "MB", "GB", "TB", "PB", "EB"];
|
|
34041
|
+
const base = standard === "iec" ? 1024 : 1e3;
|
|
34042
|
+
const idx = bytes > 0 ? Math.min(ladder.length - 1, Math.floor(Math.log(bytes) / Math.log(base))) : 0;
|
|
34043
|
+
const unit = ladder[Math.max(0, idx)];
|
|
34044
|
+
return String(convertBytes(bytes, unit, { format: true, precision, locale }));
|
|
34045
|
+
};
|
|
34046
|
+
const toBytes = (value, from) => {
|
|
34047
|
+
if (!Number.isFinite(value)) {
|
|
34048
|
+
console.error("value must be a finite number");
|
|
34049
|
+
return -1;
|
|
34050
|
+
}
|
|
34051
|
+
if (value < 0) {
|
|
34052
|
+
console.error("value must be >= 0");
|
|
34053
|
+
return -1;
|
|
34054
|
+
}
|
|
34055
|
+
const canon = normalizeUnit(from);
|
|
34056
|
+
const factor = UNIT_FACTORS[canon];
|
|
34057
|
+
return value * factor;
|
|
34058
|
+
};
|
|
34059
|
+
const convertStorage = (value, from, to, opts) => {
|
|
34060
|
+
const bytes = toBytes(value, from);
|
|
34061
|
+
if (bytes < 0) return -1;
|
|
34062
|
+
return convertBytes(bytes, to, opts);
|
|
34063
|
+
};
|
|
34064
|
+
const parseValueWithUnit = (input) => {
|
|
34065
|
+
const trimmed = input.trim();
|
|
34066
|
+
if (!trimmed) return null;
|
|
34067
|
+
const match = trimmed.match(/^([+-]?\d+(?:\.\d+)?)(?:\s*([a-zA-Z]+))?$/);
|
|
34068
|
+
if (!match) return null;
|
|
34069
|
+
const [, numPart, unitPart] = match;
|
|
34070
|
+
const value = Number(numPart);
|
|
34071
|
+
if (!Number.isFinite(value)) return null;
|
|
34072
|
+
if (unitPart) {
|
|
34073
|
+
return { value, unit: unitPart };
|
|
34074
|
+
}
|
|
34075
|
+
return { value };
|
|
34076
|
+
};
|
|
34077
|
+
|
|
34078
|
+
const CORE_UNIT_FACTORS = {
|
|
34079
|
+
core: 1,
|
|
34080
|
+
mcore: 1e-3,
|
|
34081
|
+
ucore: 1e-6,
|
|
34082
|
+
ncore: 1e-9
|
|
34083
|
+
};
|
|
34084
|
+
const CORE_ALIASES = (() => {
|
|
34085
|
+
const corePairs = [
|
|
34086
|
+
// plain cores
|
|
34087
|
+
[["core", "cores", "c", "cpu", "cpus", "vcpu", "vcpus"], "core"],
|
|
34088
|
+
// millicores
|
|
34089
|
+
[["m", "mc", "mcore", "mcores", "millicore", "millicores", "millicpu", "millicpus"], "mcore"],
|
|
34090
|
+
// microcores
|
|
34091
|
+
[["u", "µ", "ucore", "ucores", "micro", "microcore", "microcores"], "ucore"],
|
|
34092
|
+
// nanocores
|
|
34093
|
+
[["n", "ncore", "ncores", "nano", "nanocore", "nanocores"], "ncore"]
|
|
34094
|
+
];
|
|
34095
|
+
const entries = corePairs.flatMap(([keys, unit]) => keys.map((k) => [k.toLowerCase(), unit]));
|
|
34096
|
+
const canon = Object.keys(CORE_UNIT_FACTORS).map((u) => [u.toLowerCase(), u]);
|
|
34097
|
+
return Object.fromEntries([...entries, ...canon]);
|
|
34098
|
+
})();
|
|
34099
|
+
const normalizeCoreUnit = (u) => {
|
|
34100
|
+
const key = String(u).trim().toLowerCase();
|
|
34101
|
+
const canon = CORE_ALIASES[key];
|
|
34102
|
+
if (!canon) {
|
|
34103
|
+
console.error(`Unknown core unit: "${u}"`);
|
|
34104
|
+
return "core";
|
|
34105
|
+
}
|
|
34106
|
+
return canon;
|
|
34107
|
+
};
|
|
34108
|
+
const convertCores = (cores, unit, opts) => {
|
|
34109
|
+
if (!Number.isFinite(cores)) {
|
|
34110
|
+
console.error("cores must be a finite number");
|
|
34111
|
+
return -1;
|
|
34112
|
+
}
|
|
34113
|
+
if (cores < 0) {
|
|
34114
|
+
console.error("cores must be >= 0");
|
|
34115
|
+
return -1;
|
|
34116
|
+
}
|
|
34117
|
+
const canon = normalizeCoreUnit(unit);
|
|
34118
|
+
const factor = CORE_UNIT_FACTORS[canon];
|
|
34119
|
+
const value = cores / factor;
|
|
34120
|
+
if (!opts?.format) return value;
|
|
34121
|
+
return `${value.toLocaleString(opts.locale, {
|
|
34122
|
+
minimumFractionDigits: 0,
|
|
34123
|
+
maximumFractionDigits: opts?.precision ?? 2
|
|
34124
|
+
})} ${canon}`;
|
|
34125
|
+
};
|
|
34126
|
+
const formatCoresAuto = (cores, { precision = 2, locale } = {}) => {
|
|
34127
|
+
if (!Number.isFinite(cores)) {
|
|
34128
|
+
console.error("cores must be a finite number");
|
|
34129
|
+
return "infinite";
|
|
34130
|
+
}
|
|
34131
|
+
if (cores < 0) {
|
|
34132
|
+
console.error("cores must be >= 0");
|
|
34133
|
+
return "less then zero";
|
|
34134
|
+
}
|
|
34135
|
+
if (cores === 0) {
|
|
34136
|
+
return "0 core";
|
|
34137
|
+
}
|
|
34138
|
+
let targetUnit;
|
|
34139
|
+
if (cores >= 1) {
|
|
34140
|
+
targetUnit = "core";
|
|
34141
|
+
} else if (cores >= 1e-3) {
|
|
34142
|
+
targetUnit = "mcore";
|
|
34143
|
+
} else if (cores >= 1e-6) {
|
|
34144
|
+
targetUnit = "ucore";
|
|
34145
|
+
} else {
|
|
34146
|
+
targetUnit = "ncore";
|
|
34147
|
+
}
|
|
34148
|
+
return String(convertCores(cores, targetUnit, { format: true, precision, locale }));
|
|
34149
|
+
};
|
|
34150
|
+
const toCores = (value, from) => {
|
|
34151
|
+
if (!Number.isFinite(value)) {
|
|
34152
|
+
console.error("value must be a finite number");
|
|
34153
|
+
return -1;
|
|
34154
|
+
}
|
|
34155
|
+
if (value < 0) {
|
|
34156
|
+
console.error("value must be >= 0");
|
|
34157
|
+
return -1;
|
|
34158
|
+
}
|
|
34159
|
+
const canon = normalizeCoreUnit(from);
|
|
34160
|
+
const factor = CORE_UNIT_FACTORS[canon];
|
|
34161
|
+
return value * factor;
|
|
34162
|
+
};
|
|
34163
|
+
const convertCompute = (value, from, to, opts) => {
|
|
34164
|
+
const cores = toCores(value, from);
|
|
34165
|
+
if (cores < 0) return -1;
|
|
34166
|
+
return convertCores(cores, to, opts);
|
|
34167
|
+
};
|
|
34168
|
+
const parseCoresWithUnit = (input) => {
|
|
34169
|
+
const trimmed = input.trim();
|
|
34170
|
+
if (!trimmed) return null;
|
|
34171
|
+
const match = trimmed.match(/^([+-]?\d+(?:\.\d+)?)(?:\s*([a-zA-Zµ]+))?$/);
|
|
34172
|
+
if (!match) return null;
|
|
34173
|
+
const [, numPart, unitPart] = match;
|
|
34174
|
+
const value = Number(numPart);
|
|
34175
|
+
if (!Number.isFinite(value)) return null;
|
|
34176
|
+
if (unitPart) {
|
|
34177
|
+
return { value, unit: unitPart };
|
|
34178
|
+
}
|
|
34179
|
+
return { value };
|
|
34180
|
+
};
|
|
34181
|
+
|
|
33968
34182
|
const DynamicRendererInner = ({
|
|
33969
34183
|
items,
|
|
33970
34184
|
components
|
|
@@ -44831,111 +45045,6 @@ const Annotations = ({
|
|
|
44831
45045
|
] });
|
|
44832
45046
|
};
|
|
44833
45047
|
|
|
44834
|
-
const UNIT_FACTORS = {
|
|
44835
|
-
B: 1,
|
|
44836
|
-
kB: 1e3,
|
|
44837
|
-
MB: 1e6,
|
|
44838
|
-
GB: 1e9,
|
|
44839
|
-
TB: 1e12,
|
|
44840
|
-
PB: 1e15,
|
|
44841
|
-
EB: 1e18,
|
|
44842
|
-
KiB: 1024,
|
|
44843
|
-
MiB: 1024 ** 2,
|
|
44844
|
-
GiB: 1024 ** 3,
|
|
44845
|
-
TiB: 1024 ** 4,
|
|
44846
|
-
PiB: 1024 ** 5,
|
|
44847
|
-
EiB: 1024 ** 6
|
|
44848
|
-
};
|
|
44849
|
-
const ALIASES = (() => {
|
|
44850
|
-
const siPairs = [
|
|
44851
|
-
[["b", "byte", "bytes"], "B"],
|
|
44852
|
-
[["k", "kb", "kB", "KB"], "kB"],
|
|
44853
|
-
[["m", "mb", "MB"], "MB"],
|
|
44854
|
-
[["g", "gb", "GB"], "GB"],
|
|
44855
|
-
[["t", "tb, TB".replace(",", "")], "TB"],
|
|
44856
|
-
[["p", "pb", "PB"], "PB"],
|
|
44857
|
-
[["e", "eb", "EB"], "EB"]
|
|
44858
|
-
];
|
|
44859
|
-
const iecPairs = [
|
|
44860
|
-
[["ki", "kib", "Ki", "KiB"], "KiB"],
|
|
44861
|
-
[["mi", "mib", "Mi", "MiB"], "MiB"],
|
|
44862
|
-
[["gi", "gib", "Gi", "GiB"], "GiB"],
|
|
44863
|
-
[["ti", "tib", "Ti", "TiB"], "TiB"],
|
|
44864
|
-
[["pi", "pib", "Pi", "PiB"], "PiB"],
|
|
44865
|
-
[["ei", "eib", "Ei", "EiB"], "EiB"]
|
|
44866
|
-
];
|
|
44867
|
-
const entries = [...siPairs, ...iecPairs].flatMap(([keys, unit]) => keys.map((k) => [k.toLowerCase(), unit]));
|
|
44868
|
-
const canon = Object.keys(UNIT_FACTORS).map((u) => [u.toLowerCase(), u]);
|
|
44869
|
-
return Object.fromEntries([...entries, ...canon]);
|
|
44870
|
-
})();
|
|
44871
|
-
const normalizeUnit = (u) => {
|
|
44872
|
-
const key = String(u).trim().toLowerCase();
|
|
44873
|
-
const canon = ALIASES[key];
|
|
44874
|
-
if (!canon) {
|
|
44875
|
-
console.error(`Unknown unit: "${u}"`);
|
|
44876
|
-
return "GB";
|
|
44877
|
-
}
|
|
44878
|
-
return canon;
|
|
44879
|
-
};
|
|
44880
|
-
const convertBytes = (bytes, unit, opts) => {
|
|
44881
|
-
if (!Number.isFinite(bytes)) {
|
|
44882
|
-
console.error("bytes must be a finite number");
|
|
44883
|
-
return -1;
|
|
44884
|
-
}
|
|
44885
|
-
if (bytes < 0) {
|
|
44886
|
-
console.error("bytes must be >= 0");
|
|
44887
|
-
return -1;
|
|
44888
|
-
}
|
|
44889
|
-
const canon = normalizeUnit(unit);
|
|
44890
|
-
const factor = UNIT_FACTORS[canon];
|
|
44891
|
-
const value = bytes / factor;
|
|
44892
|
-
return opts?.format ? `${value.toLocaleString(opts.locale, {
|
|
44893
|
-
minimumFractionDigits: 0,
|
|
44894
|
-
maximumFractionDigits: opts?.precision ?? 2
|
|
44895
|
-
})} ${canon}` : value;
|
|
44896
|
-
};
|
|
44897
|
-
const formatBytesAuto = (bytes, { standard = "si", precision = 2, locale } = {}) => {
|
|
44898
|
-
if (!Number.isFinite(bytes)) {
|
|
44899
|
-
console.error("bytes must be a finite number");
|
|
44900
|
-
return "infinite";
|
|
44901
|
-
}
|
|
44902
|
-
if (bytes < 0) {
|
|
44903
|
-
console.error("bytes must be >= 0");
|
|
44904
|
-
return "less then zero";
|
|
44905
|
-
}
|
|
44906
|
-
const ladder = standard === "iec" ? ["B", "KiB", "MiB", "GiB", "TiB", "PiB", "EiB"] : ["B", "kB", "MB", "GB", "TB", "PB", "EB"];
|
|
44907
|
-
const base = standard === "iec" ? 1024 : 1e3;
|
|
44908
|
-
const idx = bytes > 0 ? Math.min(ladder.length - 1, Math.floor(Math.log(bytes) / Math.log(base))) : 0;
|
|
44909
|
-
const unit = ladder[Math.max(0, idx)];
|
|
44910
|
-
return String(convertBytes(bytes, unit, { format: true, precision, locale }));
|
|
44911
|
-
};
|
|
44912
|
-
const toBytes = (value, from) => {
|
|
44913
|
-
if (!Number.isFinite(value)) {
|
|
44914
|
-
console.error("value must be a finite number");
|
|
44915
|
-
return -1;
|
|
44916
|
-
}
|
|
44917
|
-
if (value < 0) {
|
|
44918
|
-
console.error("value must be >= 0");
|
|
44919
|
-
return -1;
|
|
44920
|
-
}
|
|
44921
|
-
const canon = normalizeUnit(from);
|
|
44922
|
-
const factor = UNIT_FACTORS[canon];
|
|
44923
|
-
return value * factor;
|
|
44924
|
-
};
|
|
44925
|
-
const parseValueWithUnit = (input) => {
|
|
44926
|
-
const trimmed = input.trim();
|
|
44927
|
-
if (!trimmed) return null;
|
|
44928
|
-
const match = trimmed.match(/^([+-]?\d+(?:\.\d+)?)(?:\s*([a-zA-Z]+))?$/);
|
|
44929
|
-
if (!match) return null;
|
|
44930
|
-
const [, numPart, unitPart] = match;
|
|
44931
|
-
const value = Number(numPart);
|
|
44932
|
-
if (!Number.isFinite(value)) return null;
|
|
44933
|
-
if (unitPart) {
|
|
44934
|
-
return { value, unit: unitPart };
|
|
44935
|
-
}
|
|
44936
|
-
return { value };
|
|
44937
|
-
};
|
|
44938
|
-
|
|
44939
45048
|
const ConverterBytes = ({ data }) => {
|
|
44940
45049
|
const {
|
|
44941
45050
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
@@ -45034,105 +45143,6 @@ const ConverterBytes = ({ data }) => {
|
|
|
45034
45143
|
return /* @__PURE__ */ jsxRuntimeExports.jsx("span", { style, children: result });
|
|
45035
45144
|
};
|
|
45036
45145
|
|
|
45037
|
-
const CORE_UNIT_FACTORS = {
|
|
45038
|
-
core: 1,
|
|
45039
|
-
mcore: 1e-3,
|
|
45040
|
-
ucore: 1e-6,
|
|
45041
|
-
ncore: 1e-9
|
|
45042
|
-
};
|
|
45043
|
-
const CORE_ALIASES = (() => {
|
|
45044
|
-
const corePairs = [
|
|
45045
|
-
// plain cores
|
|
45046
|
-
[["core", "cores", "c", "cpu", "cpus", "vcpu", "vcpus"], "core"],
|
|
45047
|
-
// millicores
|
|
45048
|
-
[["m", "mc", "mcore", "mcores", "millicore", "millicores", "millicpu", "millicpus"], "mcore"],
|
|
45049
|
-
// microcores
|
|
45050
|
-
[["u", "µ", "ucore", "ucores", "micro", "microcore", "microcores"], "ucore"],
|
|
45051
|
-
// nanocores
|
|
45052
|
-
[["n", "ncore", "ncores", "nano", "nanocore", "nanocores"], "ncore"]
|
|
45053
|
-
];
|
|
45054
|
-
const entries = corePairs.flatMap(([keys, unit]) => keys.map((k) => [k.toLowerCase(), unit]));
|
|
45055
|
-
const canon = Object.keys(CORE_UNIT_FACTORS).map((u) => [u.toLowerCase(), u]);
|
|
45056
|
-
return Object.fromEntries([...entries, ...canon]);
|
|
45057
|
-
})();
|
|
45058
|
-
const normalizeCoreUnit = (u) => {
|
|
45059
|
-
const key = String(u).trim().toLowerCase();
|
|
45060
|
-
const canon = CORE_ALIASES[key];
|
|
45061
|
-
if (!canon) {
|
|
45062
|
-
console.error(`Unknown core unit: "${u}"`);
|
|
45063
|
-
return "core";
|
|
45064
|
-
}
|
|
45065
|
-
return canon;
|
|
45066
|
-
};
|
|
45067
|
-
const convertCores = (cores, unit, opts) => {
|
|
45068
|
-
if (!Number.isFinite(cores)) {
|
|
45069
|
-
console.error("cores must be a finite number");
|
|
45070
|
-
return -1;
|
|
45071
|
-
}
|
|
45072
|
-
if (cores < 0) {
|
|
45073
|
-
console.error("cores must be >= 0");
|
|
45074
|
-
return -1;
|
|
45075
|
-
}
|
|
45076
|
-
const canon = normalizeCoreUnit(unit);
|
|
45077
|
-
const factor = CORE_UNIT_FACTORS[canon];
|
|
45078
|
-
const value = cores / factor;
|
|
45079
|
-
if (!opts?.format) return value;
|
|
45080
|
-
return `${value.toLocaleString(opts.locale, {
|
|
45081
|
-
minimumFractionDigits: 0,
|
|
45082
|
-
maximumFractionDigits: opts?.precision ?? 2
|
|
45083
|
-
})} ${canon}`;
|
|
45084
|
-
};
|
|
45085
|
-
const formatCoresAuto = (cores, { precision = 2, locale } = {}) => {
|
|
45086
|
-
if (!Number.isFinite(cores)) {
|
|
45087
|
-
console.error("cores must be a finite number");
|
|
45088
|
-
return "infinite";
|
|
45089
|
-
}
|
|
45090
|
-
if (cores < 0) {
|
|
45091
|
-
console.error("cores must be >= 0");
|
|
45092
|
-
return "less then zero";
|
|
45093
|
-
}
|
|
45094
|
-
if (cores === 0) {
|
|
45095
|
-
return "0 core";
|
|
45096
|
-
}
|
|
45097
|
-
let targetUnit;
|
|
45098
|
-
if (cores >= 1) {
|
|
45099
|
-
targetUnit = "core";
|
|
45100
|
-
} else if (cores >= 1e-3) {
|
|
45101
|
-
targetUnit = "mcore";
|
|
45102
|
-
} else if (cores >= 1e-6) {
|
|
45103
|
-
targetUnit = "ucore";
|
|
45104
|
-
} else {
|
|
45105
|
-
targetUnit = "ncore";
|
|
45106
|
-
}
|
|
45107
|
-
return String(convertCores(cores, targetUnit, { format: true, precision, locale }));
|
|
45108
|
-
};
|
|
45109
|
-
const toCores = (value, from) => {
|
|
45110
|
-
if (!Number.isFinite(value)) {
|
|
45111
|
-
console.error("value must be a finite number");
|
|
45112
|
-
return -1;
|
|
45113
|
-
}
|
|
45114
|
-
if (value < 0) {
|
|
45115
|
-
console.error("value must be >= 0");
|
|
45116
|
-
return -1;
|
|
45117
|
-
}
|
|
45118
|
-
const canon = normalizeCoreUnit(from);
|
|
45119
|
-
const factor = CORE_UNIT_FACTORS[canon];
|
|
45120
|
-
return value * factor;
|
|
45121
|
-
};
|
|
45122
|
-
const parseCoresWithUnit = (input) => {
|
|
45123
|
-
const trimmed = input.trim();
|
|
45124
|
-
if (!trimmed) return null;
|
|
45125
|
-
const match = trimmed.match(/^([+-]?\d+(?:\.\d+)?)(?:\s*([a-zA-Zµ]+))?$/);
|
|
45126
|
-
if (!match) return null;
|
|
45127
|
-
const [, numPart, unitPart] = match;
|
|
45128
|
-
const value = Number(numPart);
|
|
45129
|
-
if (!Number.isFinite(value)) return null;
|
|
45130
|
-
if (unitPart) {
|
|
45131
|
-
return { value, unit: unitPart };
|
|
45132
|
-
}
|
|
45133
|
-
return { value };
|
|
45134
|
-
};
|
|
45135
|
-
|
|
45136
45146
|
const ConverterCores = ({ data }) => {
|
|
45137
45147
|
const {
|
|
45138
45148
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
@@ -47052,7 +47062,7 @@ const getEnrichedColumns = ({
|
|
|
47052
47062
|
additionalPrinterColumnsTrimLengths,
|
|
47053
47063
|
additionalPrinterColumnsColWidths,
|
|
47054
47064
|
additionalPrinterColumnsKeyTypeProps,
|
|
47055
|
-
|
|
47065
|
+
additionalPrinterColumnsCustomSortersAndFilters,
|
|
47056
47066
|
theme,
|
|
47057
47067
|
getRowKey
|
|
47058
47068
|
// for factory search
|
|
@@ -47061,7 +47071,10 @@ const getEnrichedColumns = ({
|
|
|
47061
47071
|
return void 0;
|
|
47062
47072
|
}
|
|
47063
47073
|
return columns.map((el, colIndex) => {
|
|
47064
|
-
const
|
|
47074
|
+
const possibleAdditionalPrinterColumnsCustomSortersAndFiltersType = additionalPrinterColumnsCustomSortersAndFilters?.find(({ key }) => key === el.key)?.type;
|
|
47075
|
+
const isSortersAndFitlersDisabled = possibleAdditionalPrinterColumnsCustomSortersAndFiltersType === "disabled";
|
|
47076
|
+
const isSortersAndFitlersCPU = possibleAdditionalPrinterColumnsCustomSortersAndFiltersType === "cpu";
|
|
47077
|
+
const isSortersAndFitlersMemory = possibleAdditionalPrinterColumnsCustomSortersAndFiltersType === "memory";
|
|
47065
47078
|
const possibleUndefinedValue = additionalPrinterColumnsUndefinedValues?.find(({ key }) => key === el.key)?.value;
|
|
47066
47079
|
const possibleTrimLength = additionalPrinterColumnsTrimLengths?.find(({ key }) => key === el.key)?.value;
|
|
47067
47080
|
const possibleColWidth = additionalPrinterColumnsColWidths?.find(({ key }) => key === el.key)?.value;
|
|
@@ -47075,6 +47088,47 @@ const getEnrichedColumns = ({
|
|
|
47075
47088
|
if (!cell) return "";
|
|
47076
47089
|
return (cell.innerText || cell.textContent || "").trim().toLowerCase();
|
|
47077
47090
|
};
|
|
47091
|
+
const getEntry = (record) => {
|
|
47092
|
+
const { dataIndex } = el;
|
|
47093
|
+
return Array.isArray(dataIndex) ? lodashExports.get(record, dataIndex) : record[dataIndex];
|
|
47094
|
+
};
|
|
47095
|
+
const getTextForNumericUnitSort = (record) => {
|
|
47096
|
+
if (useFactorySearch) {
|
|
47097
|
+
const textFromDom = getCellTextFromDOM(record);
|
|
47098
|
+
if (textFromDom) return textFromDom;
|
|
47099
|
+
}
|
|
47100
|
+
const raw = getEntry(record);
|
|
47101
|
+
if (raw == null) return null;
|
|
47102
|
+
return String(raw);
|
|
47103
|
+
};
|
|
47104
|
+
const getMemoryInBytes = (record) => {
|
|
47105
|
+
const text = getTextForNumericUnitSort(record);
|
|
47106
|
+
if (!text) return NaN;
|
|
47107
|
+
const parsed = parseValueWithUnit(text);
|
|
47108
|
+
if (!parsed) return NaN;
|
|
47109
|
+
if (parsed.unit) {
|
|
47110
|
+
return toBytes(parsed.value, parsed.unit);
|
|
47111
|
+
}
|
|
47112
|
+
return parsed.value;
|
|
47113
|
+
};
|
|
47114
|
+
const getCpuInCores = (record) => {
|
|
47115
|
+
const text = getTextForNumericUnitSort(record);
|
|
47116
|
+
if (!text) return NaN;
|
|
47117
|
+
const parsed = parseCoresWithUnit(text);
|
|
47118
|
+
if (!parsed) return NaN;
|
|
47119
|
+
if (parsed.unit) {
|
|
47120
|
+
return toCores(parsed.value, parsed.unit);
|
|
47121
|
+
}
|
|
47122
|
+
return parsed.value;
|
|
47123
|
+
};
|
|
47124
|
+
const safeNumericCompare = (a, b) => {
|
|
47125
|
+
const aNaN = Number.isNaN(a);
|
|
47126
|
+
const bNaN = Number.isNaN(b);
|
|
47127
|
+
if (aNaN && bNaN) return 0;
|
|
47128
|
+
if (aNaN) return 1;
|
|
47129
|
+
if (bNaN) return -1;
|
|
47130
|
+
return a - b;
|
|
47131
|
+
};
|
|
47078
47132
|
return {
|
|
47079
47133
|
...el,
|
|
47080
47134
|
render: (value, record) => getCellRender({
|
|
@@ -47095,7 +47149,7 @@ const getEnrichedColumns = ({
|
|
|
47095
47149
|
};
|
|
47096
47150
|
},
|
|
47097
47151
|
filterDropdown: ({ setSelectedKeys, selectedKeys, confirm, clearFilters, close }) => {
|
|
47098
|
-
if (isSortersAndFitlersDisabled) {
|
|
47152
|
+
if (isSortersAndFitlersDisabled || isSortersAndFitlersMemory || isSortersAndFitlersCPU) {
|
|
47099
47153
|
return null;
|
|
47100
47154
|
}
|
|
47101
47155
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
@@ -47110,13 +47164,13 @@ const getEnrichedColumns = ({
|
|
|
47110
47164
|
);
|
|
47111
47165
|
},
|
|
47112
47166
|
filterIcon: (filtered) => {
|
|
47113
|
-
if (isSortersAndFitlersDisabled) {
|
|
47167
|
+
if (isSortersAndFitlersDisabled || isSortersAndFitlersMemory || isSortersAndFitlersCPU) {
|
|
47114
47168
|
return null;
|
|
47115
47169
|
}
|
|
47116
47170
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(SearchOutlined, { style: { color: filtered ? "#1677ff" : void 0 } });
|
|
47117
47171
|
},
|
|
47118
47172
|
onFilter: (value, record) => {
|
|
47119
|
-
if (isSortersAndFitlersDisabled) {
|
|
47173
|
+
if (isSortersAndFitlersDisabled || isSortersAndFitlersMemory || isSortersAndFitlersCPU) {
|
|
47120
47174
|
return false;
|
|
47121
47175
|
}
|
|
47122
47176
|
if (useFactorySearch) {
|
|
@@ -47149,6 +47203,16 @@ const getEnrichedColumns = ({
|
|
|
47149
47203
|
const bText = getCellTextFromDOM(b);
|
|
47150
47204
|
return aText.localeCompare(bText);
|
|
47151
47205
|
}
|
|
47206
|
+
if (isSortersAndFitlersMemory) {
|
|
47207
|
+
const aBytes = getMemoryInBytes(a);
|
|
47208
|
+
const bBytes = getMemoryInBytes(b);
|
|
47209
|
+
return safeNumericCompare(aBytes, bBytes);
|
|
47210
|
+
}
|
|
47211
|
+
if (isSortersAndFitlersCPU) {
|
|
47212
|
+
const aCores = getCpuInCores(a);
|
|
47213
|
+
const bCores = getCpuInCores(b);
|
|
47214
|
+
return safeNumericCompare(aCores, bCores);
|
|
47215
|
+
}
|
|
47152
47216
|
const { dataIndex } = el;
|
|
47153
47217
|
const aEntry = Array.isArray(dataIndex) ? lodashExports.get(a, dataIndex) : a[dataIndex];
|
|
47154
47218
|
const bEntry = Array.isArray(dataIndex) ? lodashExports.get(b, dataIndex) : b[dataIndex];
|
|
@@ -47279,7 +47343,7 @@ const EnrichedTable = ({
|
|
|
47279
47343
|
additionalPrinterColumnsTrimLengths,
|
|
47280
47344
|
additionalPrinterColumnsColWidths,
|
|
47281
47345
|
additionalPrinterColumnsKeyTypeProps,
|
|
47282
|
-
|
|
47346
|
+
additionalPrinterColumnsCustomSortersAndFilters,
|
|
47283
47347
|
selectData,
|
|
47284
47348
|
withoutControls = false,
|
|
47285
47349
|
tableProps
|
|
@@ -47295,7 +47359,7 @@ const EnrichedTable = ({
|
|
|
47295
47359
|
additionalPrinterColumnsTrimLengths,
|
|
47296
47360
|
additionalPrinterColumnsColWidths,
|
|
47297
47361
|
additionalPrinterColumnsKeyTypeProps,
|
|
47298
|
-
|
|
47362
|
+
additionalPrinterColumnsCustomSortersAndFilters,
|
|
47299
47363
|
theme,
|
|
47300
47364
|
getRowKey: rowKey
|
|
47301
47365
|
// for factory search
|
|
@@ -47666,7 +47730,7 @@ const EnrichedTableProvider = ({
|
|
|
47666
47730
|
additionalPrinterColumnsTrimLengths: preparedProps.additionalPrinterColumnsTrimLengths,
|
|
47667
47731
|
additionalPrinterColumnsColWidths: preparedProps.additionalPrinterColumnsColWidths,
|
|
47668
47732
|
additionalPrinterColumnsKeyTypeProps: preparedProps.additionalPrinterColumnsKeyTypeProps,
|
|
47669
|
-
|
|
47733
|
+
additionalPrinterColumnsCustomSortersAndFilters: preparedProps.additionalPrinterColumnsCustomSortersAndFilters,
|
|
47670
47734
|
selectData,
|
|
47671
47735
|
tableProps,
|
|
47672
47736
|
withoutControls
|
|
@@ -54946,5 +55010,5 @@ const useInfiniteSentinel = (sentinelRef, hasMore, onNeedMore) => {
|
|
|
54946
55010
|
}, [sentinelRef, hasMore, onNeedMore]);
|
|
54947
55011
|
};
|
|
54948
55012
|
|
|
54949
|
-
export { BackToDefaultIcon, BlackholeForm, BlackholeFormProvider, ContentCard$1 as ContentCard, CursorDefaultDiv, CursorPointerTag, CursorPointerTagMinContent, CustomSelect$4 as CustomSelect, DeleteIcon, DeleteModal, DeleteModalMany, DownIcon, DynamicComponents, DynamicRenderer, DynamicRendererWithProviders, EarthIcon, EditIcon, EnrichedTable, EnrichedTableProvider, Events, FlexGrow, LockedIcon, LookingGlassIcon, ManageableBreadcrumbs, ManageableBreadcrumbsProvider, ManageableSidebar, ManageableSidebarProvider, MarketPlace, MarketplaceCard, MinusIcon, NodeTerminal, PaddingContainer, PauseCircleIcon, PlusIcon, PodLogs, PodLogsMonaco, PodTerminal, ProjectInfoCard, ResourceLink, ResumeCircleIcon, Search, Spacer$1 as Spacer, SuccessIcon, TreeWithSearch, UncontrolledSelect, UnlockedIcon, UpIcon, YamlEditorSingleton$1 as YamlEditorSingleton, checkIfApiInstanceNamespaceScoped, checkIfBuiltInInstanceNamespaceScoped, checkPermission, createContextFactory, createNewEntry, deepMerge, deleteEntry, feedbackIcons, filterIfApiInstanceNamespaceScoped, filterIfBuiltInInstanceNamespaceScoped, filterSelectOptions, floorToDecimal, getAllPathsFromObj, getApiResourceSingle, getApiResourceTypes, getApiResourceTypesByApiGroup, getApiResources, getBuiltinResourceSingle, getBuiltinResourceTypes, getBuiltinResources, getBuiltinTreeData, getClusterList, getCrdData, getCrdResourceSingle, getCrdResources, getDirectUnknownResource, getEnrichedColumns, getEnrichedColumnsWithControls, getGroupsByCategory, getKinds, getLinkToApiForm, getLinkToBuiltinForm, getLinkToForm, getNamespaceLink, getObjectFormItemsDraft, getPrefixSubarrays, getResourceLink, getSortedKinds, getSortedKindsAll, getStringByName, getSwagger, getUppercase, groupsToTreeData, hslFromString, includesArray, isFlatObject, isMultilineFromYaml, isMultilineString, kindByGvr, namespacedByGvr, normalizeValuesForQuotasToNumber, parseQuotaValue, parseQuotaValueCpu, parseQuotaValueMemoryAndStorage, pluralByKind, prepareDataForManageableBreadcrumbs, prepareDataForManageableSidebar, prepareTemplate, prepareUrlsToFetchForDynamicRenderer, updateEntry, useApiResourceSingle, useApiResourceTypesByGroup, useApiResources, useApisResourceTypes, useBuiltinResourceSingle, useBuiltinResourceTypes, useBuiltinResources, useClusterList, useCrdData, useCrdResourceSingle, useCrdResources, useDirectUnknownResource, useInfiniteSentinel, useK8sSmartResource, useK8sVerbs, useListWatch, useManyK8sSmartResource, usePermissions, useSmartResourceParams };
|
|
55013
|
+
export { BackToDefaultIcon, BlackholeForm, BlackholeFormProvider, ContentCard$1 as ContentCard, CursorDefaultDiv, CursorPointerTag, CursorPointerTagMinContent, CustomSelect$4 as CustomSelect, DeleteIcon, DeleteModal, DeleteModalMany, DownIcon, DynamicComponents, DynamicRenderer, DynamicRendererWithProviders, EarthIcon, EditIcon, EnrichedTable, EnrichedTableProvider, Events, FlexGrow, LockedIcon, LookingGlassIcon, ManageableBreadcrumbs, ManageableBreadcrumbsProvider, ManageableSidebar, ManageableSidebarProvider, MarketPlace, MarketplaceCard, MinusIcon, NodeTerminal, PaddingContainer, PauseCircleIcon, PlusIcon, PodLogs, PodLogsMonaco, PodTerminal, ProjectInfoCard, ResourceLink, ResumeCircleIcon, Search, Spacer$1 as Spacer, SuccessIcon, TreeWithSearch, UncontrolledSelect, UnlockedIcon, UpIcon, YamlEditorSingleton$1 as YamlEditorSingleton, checkIfApiInstanceNamespaceScoped, checkIfBuiltInInstanceNamespaceScoped, checkPermission, convertBytes, convertCompute, convertCores, convertStorage, createContextFactory, createNewEntry, deepMerge, deleteEntry, feedbackIcons, filterIfApiInstanceNamespaceScoped, filterIfBuiltInInstanceNamespaceScoped, filterSelectOptions, floorToDecimal, formatBytesAuto, formatCoresAuto, getAllPathsFromObj, getApiResourceSingle, getApiResourceTypes, getApiResourceTypesByApiGroup, getApiResources, getBuiltinResourceSingle, getBuiltinResourceTypes, getBuiltinResources, getBuiltinTreeData, getClusterList, getCrdData, getCrdResourceSingle, getCrdResources, getDirectUnknownResource, getEnrichedColumns, getEnrichedColumnsWithControls, getGroupsByCategory, getKinds, getLinkToApiForm, getLinkToBuiltinForm, getLinkToForm, getNamespaceLink, getObjectFormItemsDraft, getPrefixSubarrays, getResourceLink, getSortedKinds, getSortedKindsAll, getStringByName, getSwagger, getUppercase, groupsToTreeData, hslFromString, includesArray, isFlatObject, isMultilineFromYaml, isMultilineString, kindByGvr, namespacedByGvr, normalizeValuesForQuotasToNumber, parseCoresWithUnit, parseQuotaValue, parseQuotaValueCpu, parseQuotaValueMemoryAndStorage, parseValueWithUnit, pluralByKind, prepareDataForManageableBreadcrumbs, prepareDataForManageableSidebar, prepareTemplate, prepareUrlsToFetchForDynamicRenderer, toBytes, toCores, updateEntry, useApiResourceSingle, useApiResourceTypesByGroup, useApiResources, useApisResourceTypes, useBuiltinResourceSingle, useBuiltinResourceTypes, useBuiltinResources, useClusterList, useCrdData, useCrdResourceSingle, useCrdResources, useDirectUnknownResource, useInfiniteSentinel, useK8sSmartResource, useK8sVerbs, useListWatch, useManyK8sSmartResource, usePermissions, useSmartResourceParams };
|
|
54950
55014
|
//# sourceMappingURL=openapi-k8s-toolkit.es.js.map
|