Skip to content

Updated project dependencies #3541

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 16, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 0 additions & 17 deletions .github/workflows/jobs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
32 changes: 16 additions & 16 deletions web-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand All @@ -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",
Expand Down
86 changes: 0 additions & 86 deletions web-app/src/common/__tests__/utils.test.ts

This file was deleted.

16 changes: 0 additions & 16 deletions web-app/src/common/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
168 changes: 0 additions & 168 deletions web-app/src/common/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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));
Expand Down
2 changes: 2 additions & 0 deletions web-app/src/utils/stylesUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Loading
Loading