Updated project dependencies (#3541)
Signed-off-by: Benjamin Perez <benjamin@bexsoft.net> Co-authored-by: Benjamin Perez <benjamin@bexsoft.net>
This commit is contained in:
17
.github/workflows/jobs.yaml
vendored
17
.github/workflows/jobs.yaml
vendored
@@ -689,23 +689,6 @@ jobs:
|
||||
path: |
|
||||
./integration/coverage/
|
||||
key: ${{ runner.os }}-coverage-2-${{ github.run_id }}
|
||||
react-tests:
|
||||
name: React Tests
|
||||
needs:
|
||||
- lint-job
|
||||
- ui-assets
|
||||
- semgrep-static-code-analysis
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: Enable Corepack
|
||||
run: corepack enable
|
||||
- name: Install modules
|
||||
working-directory: ./web-app
|
||||
run: yarn install --immutable
|
||||
- name: Run tests
|
||||
working-directory: ./web-app
|
||||
run: yarn test
|
||||
|
||||
coverage:
|
||||
name: "Coverage Limit Check"
|
||||
|
||||
@@ -11,16 +11,16 @@
|
||||
"kbar": "^0.1.0-beta.46",
|
||||
"local-storage-fallback": "^4.1.3",
|
||||
"lodash": "^4.17.21",
|
||||
"luxon": "^3.5.0",
|
||||
"mds": "https://github.com/minio/mds.git#v1.1.2",
|
||||
"luxon": "^3.6.1",
|
||||
"mds": "https://github.com/minio/mds.git#v1.1.3",
|
||||
"react": "^18.3.1",
|
||||
"react-copy-to-clipboard": "^5.1.0",
|
||||
"react-dom": "^18.3.1",
|
||||
"react-dropzone": "^14.3.5",
|
||||
"react-dropzone": "^14.3.8",
|
||||
"react-markdown": "8.0.7",
|
||||
"react-pdf": "^9.2.1",
|
||||
"react-redux": "^8.1.3",
|
||||
"react-router-dom": "6.29.0",
|
||||
"react-router-dom": "6.30.0",
|
||||
"react-virtualized": "^9.22.6",
|
||||
"react-window": "^1.8.11",
|
||||
"react-window-infinite-loader": "^1.0.10",
|
||||
@@ -59,15 +59,15 @@
|
||||
"proxy": "http://localhost:9090/",
|
||||
"devDependencies": {
|
||||
"@babel/plugin-proposal-private-property-in-object": "^7.21.11",
|
||||
"@babel/runtime": "^7.26.10",
|
||||
"@playwright/test": "^1.50.1",
|
||||
"@babel/runtime": "^7.27.1",
|
||||
"@playwright/test": "^1.52.0",
|
||||
"@types/jest": "^29.5.14",
|
||||
"@types/lodash": "^4.17.15",
|
||||
"@types/luxon": "^3.4.2",
|
||||
"@types/node": "20.17.19",
|
||||
"@types/react": "18.3.18",
|
||||
"@types/lodash": "^4.17.16",
|
||||
"@types/luxon": "^3.6.2",
|
||||
"@types/node": "20.17.47",
|
||||
"@types/react": "18.3.21",
|
||||
"@types/react-copy-to-clipboard": "^5.0.7",
|
||||
"@types/react-dom": "18.3.5",
|
||||
"@types/react-dom": "18.3.7",
|
||||
"@types/react-redux": "^7.1.34",
|
||||
"@types/react-virtualized": "^9.22.2",
|
||||
"@types/react-window": "^1.8.8",
|
||||
@@ -77,16 +77,16 @@
|
||||
"@types/webpack-env": "^1.18.8",
|
||||
"babel-plugin-istanbul": "^6.1.1",
|
||||
"customize-cra": "^1.0.0",
|
||||
"knip": "^5.44.4",
|
||||
"minio": "^8.0.4",
|
||||
"knip": "^5.56.0",
|
||||
"minio": "^8.0.5",
|
||||
"nyc": "^15.1.0",
|
||||
"prettier": "3.5.1",
|
||||
"prettier": "3.5.3",
|
||||
"react-app-rewire-hot-loader": "^2.0.1",
|
||||
"react-app-rewired": "^2.2.1",
|
||||
"react-scripts": "5.0.1",
|
||||
"swagger-typescript-api": "13.0.23",
|
||||
"swagger-typescript-api": "13.1.3",
|
||||
"testcafe": "3.7.2",
|
||||
"typescript": "^5.5.3"
|
||||
"typescript": "^5.8.3"
|
||||
},
|
||||
"resolutions": {
|
||||
"nth-check": "^2.0.1",
|
||||
|
||||
@@ -1,86 +0,0 @@
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2021 MinIO, Inc.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import {
|
||||
erasureCodeCalc,
|
||||
getBytes,
|
||||
niceBytes,
|
||||
setMemoryResource,
|
||||
} from "../utils";
|
||||
|
||||
test("A variety of formatting results", () => {
|
||||
expect(niceBytes("1024")).toBe("1.0 KiB");
|
||||
expect(niceBytes("1048576")).toBe("1.0 MiB");
|
||||
expect(niceBytes("1073741824")).toBe("1.0 GiB");
|
||||
});
|
||||
|
||||
test("From value and unit to a number of bytes", () => {
|
||||
expect(getBytes("1", "KiB")).toBe("1024");
|
||||
expect(getBytes("1", "MiB")).toBe("1048576");
|
||||
expect(getBytes("1", "GiB")).toBe("1073741824");
|
||||
});
|
||||
|
||||
test("From value and unit to a number of bytes for kubernetes", () => {
|
||||
expect(getBytes("1", "Ki", true)).toBe("1024");
|
||||
expect(getBytes("1", "Mi", true)).toBe("1048576");
|
||||
expect(getBytes("1", "Gi", true)).toBe("1073741824");
|
||||
expect(getBytes("7500", "Gi", true)).toBe("8053063680000");
|
||||
});
|
||||
|
||||
test("Determine the amount of memory to use", () => {
|
||||
expect(setMemoryResource(1024, "1024", 1024)).toStrictEqual({
|
||||
error: "There are not enough memory resources available",
|
||||
limit: 0,
|
||||
request: 0,
|
||||
});
|
||||
expect(setMemoryResource(64, "1099511627776", 34359738368)).toStrictEqual({
|
||||
error:
|
||||
"The requested memory is greater than the max available memory for the selected number of nodes",
|
||||
limit: 0,
|
||||
request: 0,
|
||||
});
|
||||
expect(setMemoryResource(2, "17179869184", 34359738368)).toStrictEqual({
|
||||
error: "",
|
||||
limit: 34359738368,
|
||||
request: 2147483648,
|
||||
});
|
||||
});
|
||||
|
||||
test("Determine the correct values for EC Parity calculation", () => {
|
||||
expect(erasureCodeCalc([], 50, 5000, 4)).toStrictEqual({
|
||||
error: 1,
|
||||
defaultEC: "",
|
||||
erasureCodeSet: 0,
|
||||
maxEC: "",
|
||||
rawCapacity: "0",
|
||||
storageFactors: [],
|
||||
});
|
||||
expect(erasureCodeCalc(["EC:2"], 4, 26843545600, 4)).toStrictEqual({
|
||||
error: 0,
|
||||
storageFactors: [
|
||||
{
|
||||
erasureCode: "EC:2",
|
||||
storageFactor: 2,
|
||||
maxCapacity: "53687091200",
|
||||
maxFailureTolerations: 2,
|
||||
},
|
||||
],
|
||||
maxEC: "EC:2",
|
||||
rawCapacity: "107374182400",
|
||||
erasureCodeSet: 4,
|
||||
defaultEC: "EC:2",
|
||||
});
|
||||
});
|
||||
@@ -14,22 +14,6 @@
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
export interface IStorageFactors {
|
||||
erasureCode: string;
|
||||
storageFactor: number;
|
||||
maxCapacity: string;
|
||||
maxFailureTolerations: number;
|
||||
}
|
||||
|
||||
export interface IErasureCodeCalc {
|
||||
error: number;
|
||||
maxEC: string;
|
||||
erasureCodeSet: number;
|
||||
rawCapacity: string;
|
||||
defaultEC: string;
|
||||
storageFactors: IStorageFactors[];
|
||||
}
|
||||
|
||||
export interface ErrorResponseHandler {
|
||||
errorMessage: string;
|
||||
detailedError: string;
|
||||
|
||||
@@ -15,15 +15,11 @@
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import storage from "local-storage-fallback";
|
||||
import { IErasureCodeCalc, IStorageFactors } from "./types";
|
||||
|
||||
import get from "lodash/get";
|
||||
|
||||
const minMemReq = 2147483648; // Minimal Memory required for MinIO in bytes
|
||||
|
||||
const units = ["B", "KiB", "MiB", "GiB", "TiB", "PiB", "EiB", "ZiB", "YiB"];
|
||||
const k8sUnits = ["Ki", "Mi", "Gi", "Ti", "Pi", "Ei"];
|
||||
const k8sCalcUnits = ["B", ...k8sUnits];
|
||||
|
||||
export const niceBytes = (x: string, showK8sUnits: boolean = false) => {
|
||||
let n = parseInt(x, 10) || 0;
|
||||
@@ -54,170 +50,6 @@ export const clearSession = () => {
|
||||
deleteCookie("idp-refresh-token");
|
||||
};
|
||||
|
||||
//getBytes, converts from a value and a unit from units array to bytes as a string
|
||||
export const getBytes = (
|
||||
value: string,
|
||||
unit: string,
|
||||
fromk8s: boolean = false,
|
||||
): string => {
|
||||
return getBytesNumber(value, unit, fromk8s).toString(10);
|
||||
};
|
||||
|
||||
//getBytesNumber, converts from a value and a unit from units array to bytes
|
||||
const getBytesNumber = (
|
||||
value: string,
|
||||
unit: string,
|
||||
fromk8s: boolean = false,
|
||||
): number => {
|
||||
const vl: number = parseFloat(value);
|
||||
|
||||
const unitsTake = fromk8s ? k8sCalcUnits : units;
|
||||
|
||||
const powFactor = unitsTake.findIndex((element) => element === unit);
|
||||
|
||||
if (powFactor === -1) {
|
||||
return 0;
|
||||
}
|
||||
const factor = Math.pow(1024, powFactor);
|
||||
const total = vl * factor;
|
||||
|
||||
return total;
|
||||
};
|
||||
|
||||
export const setMemoryResource = (
|
||||
memorySize: number,
|
||||
capacitySize: string,
|
||||
maxMemorySize: number,
|
||||
) => {
|
||||
// value always comes as Gi
|
||||
const requestedSizeBytes = getBytes(memorySize.toString(10), "Gi", true);
|
||||
const memReqSize = parseInt(requestedSizeBytes, 10);
|
||||
if (maxMemorySize === 0) {
|
||||
return {
|
||||
error: "There is no memory available for the selected number of nodes",
|
||||
request: 0,
|
||||
limit: 0,
|
||||
};
|
||||
}
|
||||
|
||||
if (maxMemorySize < minMemReq) {
|
||||
return {
|
||||
error: "There are not enough memory resources available",
|
||||
request: 0,
|
||||
limit: 0,
|
||||
};
|
||||
}
|
||||
|
||||
if (memReqSize < minMemReq) {
|
||||
return {
|
||||
error: "The requested memory size must be greater than 2Gi",
|
||||
request: 0,
|
||||
limit: 0,
|
||||
};
|
||||
}
|
||||
if (memReqSize > maxMemorySize) {
|
||||
return {
|
||||
error:
|
||||
"The requested memory is greater than the max available memory for the selected number of nodes",
|
||||
request: 0,
|
||||
limit: 0,
|
||||
};
|
||||
}
|
||||
|
||||
const capSize = parseInt(capacitySize, 10);
|
||||
let memLimitSize = memReqSize;
|
||||
// set memory limit based on the capacitySize
|
||||
// if capacity size is lower than 1TiB we use the limit equal to request
|
||||
if (capSize >= parseInt(getBytes("1", "Pi", true), 10)) {
|
||||
memLimitSize = Math.max(
|
||||
memReqSize,
|
||||
parseInt(getBytes("64", "Gi", true), 10),
|
||||
);
|
||||
} else if (capSize >= parseInt(getBytes("100", "Ti"), 10)) {
|
||||
memLimitSize = Math.max(
|
||||
memReqSize,
|
||||
parseInt(getBytes("32", "Gi", true), 10),
|
||||
);
|
||||
} else if (capSize >= parseInt(getBytes("10", "Ti"), 10)) {
|
||||
memLimitSize = Math.max(
|
||||
memReqSize,
|
||||
parseInt(getBytes("16", "Gi", true), 10),
|
||||
);
|
||||
} else if (capSize >= parseInt(getBytes("1", "Ti"), 10)) {
|
||||
memLimitSize = Math.max(
|
||||
memReqSize,
|
||||
parseInt(getBytes("8", "Gi", true), 10),
|
||||
);
|
||||
}
|
||||
|
||||
return {
|
||||
error: "",
|
||||
request: memReqSize,
|
||||
limit: memLimitSize,
|
||||
};
|
||||
};
|
||||
|
||||
// Erasure Code Parity Calc
|
||||
export const erasureCodeCalc = (
|
||||
parityValidValues: string[],
|
||||
totalDisks: number,
|
||||
pvSize: number,
|
||||
totalNodes: number,
|
||||
): IErasureCodeCalc => {
|
||||
// Parity Values is empty
|
||||
if (parityValidValues.length < 1) {
|
||||
return {
|
||||
error: 1,
|
||||
defaultEC: "",
|
||||
erasureCodeSet: 0,
|
||||
maxEC: "",
|
||||
rawCapacity: "0",
|
||||
storageFactors: [],
|
||||
};
|
||||
}
|
||||
|
||||
const totalStorage = totalDisks * pvSize;
|
||||
const maxEC = parityValidValues[0];
|
||||
const maxParityNumber = parseInt(maxEC.split(":")[1], 10);
|
||||
|
||||
const erasureStripeSet = maxParityNumber * 2; // ESS is calculated by multiplying maximum parity by two.
|
||||
|
||||
const storageFactors: IStorageFactors[] = parityValidValues.map(
|
||||
(currentParity) => {
|
||||
const parityNumber = parseInt(currentParity.split(":")[1], 10);
|
||||
const storageFactor =
|
||||
erasureStripeSet / (erasureStripeSet - parityNumber);
|
||||
|
||||
const maxCapacity = Math.floor(totalStorage / storageFactor);
|
||||
const maxTolerations =
|
||||
totalDisks - Math.floor(totalDisks / storageFactor);
|
||||
return {
|
||||
erasureCode: currentParity,
|
||||
storageFactor,
|
||||
maxCapacity: maxCapacity.toString(10),
|
||||
maxFailureTolerations: maxTolerations,
|
||||
};
|
||||
},
|
||||
);
|
||||
|
||||
let defaultEC = maxEC;
|
||||
|
||||
const fourVar = parityValidValues.find((element) => element === "EC:4");
|
||||
|
||||
if (fourVar) {
|
||||
defaultEC = "EC:4";
|
||||
}
|
||||
|
||||
return {
|
||||
error: 0,
|
||||
storageFactors,
|
||||
maxEC,
|
||||
rawCapacity: totalStorage.toString(10),
|
||||
erasureCodeSet: erasureStripeSet,
|
||||
defaultEC,
|
||||
};
|
||||
};
|
||||
|
||||
// 92400 seconds -> 1 day, 1 hour, 40 minutes.
|
||||
export const niceTimeFromSeconds = (seconds: number): string => {
|
||||
const days = Math.floor(seconds / (3600 * 24));
|
||||
|
||||
@@ -40,6 +40,8 @@ export const generateOverrideTheme = (overrideVars: IEmbeddedCustomStyles) => {
|
||||
logoColor: "#C51B3F",
|
||||
logoLabelColor: overrideVars.fontColor,
|
||||
logoLabelInverse: "#FFF",
|
||||
logoContrast: "#000",
|
||||
logoContrastInverse: overrideVars.fontColor,
|
||||
loaderColor: overrideVars.loaderColor,
|
||||
boxBackground: overrideVars.boxBackground,
|
||||
mutedText: "#9c9c9c",
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user