diff --git a/.github/workflows/ui.yaml b/.github/workflows/ui.yaml index 2da6bf47dd0..088b169dd40 100644 --- a/.github/workflows/ui.yaml +++ b/.github/workflows/ui.yaml @@ -77,6 +77,11 @@ jobs: continue-on-error: false run: | ./check-prettier.sh + - name: Check for dead code + working-directory: ./web-app + continue-on-error: false + run: | + ./check-deadcode.sh reuse-golang-dependencies: timeout-minutes: 30 name: reuse golang dependencies diff --git a/web-app/Makefile b/web-app/Makefile index 1fd676e0d3f..e79e87f4c70 100644 --- a/web-app/Makefile +++ b/web-app/Makefile @@ -15,3 +15,6 @@ prettify: yarn prettier --write . --loglevel warn pretty: prettify + +find-deadcode: + ./check-deadcode.sh diff --git a/web-app/check-deadcode.sh b/web-app/check-deadcode.sh new file mode 100755 index 00000000000..7c67fa152fd --- /dev/null +++ b/web-app/check-deadcode.sh @@ -0,0 +1,8 @@ +#!/bin/bash + +if [ -f "$NVM_DIR/nvm.sh" ] +then + \. "$NVM_DIR/nvm.sh"; + nvm use; +fi +yarn find-deadcode diff --git a/web-app/package.json b/web-app/package.json index 4cbd460beeb..f03ae327320 100644 --- a/web-app/package.json +++ b/web-app/package.json @@ -37,7 +37,8 @@ "start": "PORT=5050 react-scripts start", "build": "react-scripts build", "test": "react-scripts test", - "eject": "react-scripts eject" + "eject": "react-scripts eject", + "find-deadcode": "ts-prune -s operatorApi.ts | (! grep -v 'used in module')" }, "eslintConfig": { "extends": "react-app", @@ -77,7 +78,8 @@ "prettier": "3.0.0", "react-scripts": "5.0.1", "testcafe": "2.6.2", - "typescript": "^4.4.3" + "typescript": "^4.4.3", + "ts-prune": "^0.10.3" }, "resolutions": { "nth-check": "^2.0.1", diff --git a/web-app/src/api/errors.ts b/web-app/src/api/errors.ts deleted file mode 100644 index 222336db2b8..00000000000 --- a/web-app/src/api/errors.ts +++ /dev/null @@ -1,35 +0,0 @@ -// This file is part of MinIO Console Server -// Copyright (c) 2023 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 . - -import { ErrorResponseHandler } from "../common/types"; -import { Error } from "./operatorApi"; - -// errorToHandler translates a swagger error to a ErrorResponseHandler which -// is legacy, when all API calls are using the swagger API, we can remove this. -export const errorToHandler = (e: Error): ErrorResponseHandler => { - if (!e) { - return { - statusCode: 0, - errorMessage: "", - detailedError: "", - }; - } - return { - statusCode: e.code, - errorMessage: e.message, - detailedError: e.detailedMessage, - }; -}; diff --git a/web-app/src/common/Copyright.tsx b/web-app/src/common/Copyright.tsx deleted file mode 100644 index 7ab4083dae1..00000000000 --- a/web-app/src/common/Copyright.tsx +++ /dev/null @@ -1,32 +0,0 @@ -// This file is part of MinIO Operator -// 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 . - -import React from "react"; -import Typography from "@mui/material/Typography"; -import Link from "@mui/material/Link"; - -export default function Copyright() { - return ( - - {"Copyright © "} - - MinIO - {" "} - {new Date().getFullYear()} - {"."} - - ); -} diff --git a/web-app/src/common/SecureComponent/SecureComponent.tsx b/web-app/src/common/SecureComponent/SecureComponent.tsx deleted file mode 100644 index 647d14ef570..00000000000 --- a/web-app/src/common/SecureComponent/SecureComponent.tsx +++ /dev/null @@ -1,56 +0,0 @@ -// This file is part of MinIO Operator -// 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 . - -import React, { cloneElement } from "react"; -import hasPermission from "./accessControl"; - -interface ISecureComponentProps { - errorProps?: any; - RenderError?: any; - matchAll?: boolean; - children: any; - scopes: string[]; - resource: string | string[]; - containsResource?: boolean; -} - -const SecureComponent = ({ - children, - RenderError = () => <>, - errorProps = null, - matchAll = false, - scopes = [], - resource, - containsResource = false, -}: ISecureComponentProps) => { - const permissionGranted = hasPermission( - resource, - scopes, - matchAll, - containsResource, - ); - if (!permissionGranted && !errorProps) return ; - if (!permissionGranted && errorProps) { - return Array.isArray(children) ? ( - <>{children.map((child) => cloneElement(child, { ...errorProps }))} - ) : ( - cloneElement(children, { ...errorProps }) - ); - } - return <>{children}; -}; - -export default SecureComponent; diff --git a/web-app/src/common/SecureComponent/index.ts b/web-app/src/common/SecureComponent/index.ts index 9db2d90a9a7..44b823bdb07 100644 --- a/web-app/src/common/SecureComponent/index.ts +++ b/web-app/src/common/SecureComponent/index.ts @@ -15,4 +15,3 @@ // along with this program. If not, see . export { default as hasPermission } from "./accessControl"; -export { default as SecureComponent } from "./SecureComponent"; diff --git a/web-app/src/common/SecureComponent/permissions.ts b/web-app/src/common/SecureComponent/permissions.ts index c7758f0b5c2..34a363b0ea6 100644 --- a/web-app/src/common/SecureComponent/permissions.ts +++ b/web-app/src/common/SecureComponent/permissions.ts @@ -520,124 +520,4 @@ export const IAM_PAGES_PERMISSIONS = { ], }; -export const S3_ALL_RESOURCES = "arn:aws:s3:::*"; export const CONSOLE_UI_RESOURCE = "console-ui"; - -export const permissionTooltipHelper = (scopes: string[], name: string) => { - let niceScopes = scopes.join(", ").toString(); - - return ( - "You require additional permissions in order to " + - name + - ". Please ask your MinIO administrator to grant you " + - niceScopes + - " permission" + - (scopes.length > 1 ? "s" : "") + - " in order to " + - name + - "." - ); -}; - -export const listUsersPermissions = [IAM_SCOPES.ADMIN_LIST_USERS]; - -export const addUserToGroupPermissions = [IAM_SCOPES.ADMIN_ADD_USER_TO_GROUP]; - -export const deleteUserPermissions = [IAM_SCOPES.ADMIN_DELETE_USER]; - -export const enableUserPermissions = [IAM_SCOPES.ADMIN_ENABLE_USER]; - -export const disableUserPermissions = [IAM_SCOPES.ADMIN_DISABLE_USER]; - -//note that adminUserPermissions does NOT include ADMIN_CREATE_USER to allow hiding the Users tab for users wtih only this permission as it is being applied by default -export const adminUserPermissions = [ - IAM_SCOPES.ADMIN_LIST_USER_POLICIES, - IAM_SCOPES.ADMIN_LIST_USERS, - IAM_SCOPES.ADMIN_ADD_USER_TO_GROUP, - IAM_SCOPES.ADMIN_REMOVE_USER_FROM_GROUP, - IAM_SCOPES.ADMIN_ATTACH_USER_OR_GROUP_POLICY, - IAM_SCOPES.ADMIN_LIST_USERS, - IAM_SCOPES.ADMIN_DELETE_USER, - IAM_SCOPES.ADMIN_ENABLE_USER, - IAM_SCOPES.ADMIN_DISABLE_USER, - IAM_SCOPES.ADMIN_GET_USER, - IAM_SCOPES.ADMIN_LIST_USER_POLICIES, -]; - -export const assignIAMPolicyPermissions = [ - IAM_SCOPES.ADMIN_ATTACH_USER_OR_GROUP_POLICY, - IAM_SCOPES.ADMIN_LIST_USER_POLICIES, - IAM_SCOPES.ADMIN_GET_POLICY, -]; - -export const assignGroupPermissions = [ - IAM_SCOPES.ADMIN_ADD_USER_TO_GROUP, - IAM_SCOPES.ADMIN_REMOVE_USER_FROM_GROUP, - IAM_SCOPES.ADMIN_LIST_GROUPS, - IAM_SCOPES.ADMIN_ENABLE_USER, -]; - -export const getGroupPermissions = [IAM_SCOPES.ADMIN_GET_GROUP]; - -export const enableDisableUserPermissions = [ - IAM_SCOPES.ADMIN_ENABLE_USER, - IAM_SCOPES.ADMIN_DISABLE_USER, -]; - -export const editServiceAccountPermissions = [ - IAM_SCOPES.ADMIN_LIST_SERVICEACCOUNTS, - IAM_SCOPES.ADMIN_UPDATE_SERVICEACCOUNT, - IAM_SCOPES.ADMIN_REMOVE_SERVICEACCOUNT, -]; - -export const applyPolicyPermissions = [ - IAM_SCOPES.ADMIN_ATTACH_USER_OR_GROUP_POLICY, - IAM_SCOPES.ADMIN_LIST_USER_POLICIES, -]; - -export const deleteGroupPermissions = [IAM_SCOPES.ADMIN_REMOVE_USER_FROM_GROUP]; - -export const displayGroupsPermissions = [IAM_SCOPES.ADMIN_LIST_GROUPS]; - -export const createGroupPermissions = [ - IAM_SCOPES.ADMIN_ADD_USER_TO_GROUP, - IAM_SCOPES.ADMIN_LIST_USERS, -]; - -export const viewUserPermissions = [ - IAM_SCOPES.ADMIN_GET_USER, - IAM_SCOPES.ADMIN_LIST_USERS, -]; -export const editGroupMembersPermissions = [ - IAM_SCOPES.ADMIN_ADD_USER_TO_GROUP, - IAM_SCOPES.ADMIN_LIST_USERS, -]; -export const setGroupPoliciesPermissions = [ - IAM_SCOPES.ADMIN_ATTACH_USER_OR_GROUP_POLICY, - IAM_SCOPES.ADMIN_LIST_USER_POLICIES, -]; -export const viewPolicyPermissions = [IAM_SCOPES.ADMIN_GET_POLICY]; -export const enableDisableGroupPermissions = [ - IAM_SCOPES.ADMIN_ENABLE_GROUP, - IAM_SCOPES.ADMIN_DISABLE_GROUP, -]; -export const createPolicyPermissions = [IAM_SCOPES.ADMIN_CREATE_POLICY]; - -export const deletePolicyPermissions = [IAM_SCOPES.ADMIN_DELETE_POLICY]; - -export const listPolicyPermissions = [IAM_SCOPES.ADMIN_LIST_USER_POLICIES]; - -export const listGroupPermissions = [ - IAM_SCOPES.ADMIN_LIST_GROUPS, - IAM_SCOPES.ADMIN_GET_GROUP, -]; - -export const deleteBucketPermissions = [ - IAM_SCOPES.S3_DELETE_BUCKET, - IAM_SCOPES.S3_FORCE_DELETE_BUCKET, -]; - -export const browseBucketPermissions = [ - IAM_SCOPES.S3_LIST_BUCKET, - IAM_SCOPES.S3_ALL_LIST_BUCKET, -]; diff --git a/web-app/src/common/types.ts b/web-app/src/common/types.ts index 2fad0ed596c..dcb8133831b 100644 --- a/web-app/src/common/types.ts +++ b/web-app/src/common/types.ts @@ -168,12 +168,6 @@ export interface ErrorResponseHandler { statusCode?: number; message?: string; // if any type error thrown } - -export interface IBytesCalc { - total: number; - unit: string; -} - export interface IEmbeddedCustomButton { backgroundColor?: string; textColor?: string; diff --git a/web-app/src/common/utils.ts b/web-app/src/common/utils.ts index 788ac3d2a33..af973170308 100644 --- a/web-app/src/common/utils.ts +++ b/web-app/src/common/utils.ts @@ -16,7 +16,6 @@ import storage from "local-storage-fallback"; import { - IBytesCalc, ICapacity, IErasureCodeCalc, IStorageDistribution, @@ -46,7 +45,6 @@ export const units = [ ]; export const k8sUnits = ["Ki", "Mi", "Gi", "Ti", "Pi", "Ei"]; export const k8sCalcUnits = ["B", ...k8sUnits]; -export const timeUnits = ["ms", "s", "m", "h", "d", "w", "M", "Q", "y"]; export const niceBytes = (x: string, showK8sUnits: boolean = false) => { let n = parseInt(x, 10) || 0; @@ -66,18 +64,6 @@ export const niceBytesInt = (n: number, showK8sUnits: boolean = false) => { return n.toFixed(1) + " " + (showK8sUnits ? k8sUnitsN[l] : units[l]); }; -export const setCookie = (name: string, val: string) => { - const date = new Date(); - const value = val; - - // Set it expire in 45 minutes - date.setTime(date.getTime() + 45 * 60 * 1000); - - // Set it - document.cookie = - name + "=" + value + "; expires=" + date.toUTCString() + "; path=/"; -}; - export const deleteCookie = (name: string) => { document.cookie = name + "=; expires=Thu, 01 Jan 1970 00:00:01 GMT;"; }; @@ -89,22 +75,6 @@ export const clearSession = () => { deleteCookie("idp-refresh-token"); }; -// timeFromDate gets time string from date input -export const timeFromDate = (d: Date) => { - let h = d.getHours() < 10 ? `0${d.getHours()}` : `${d.getHours()}`; - let m = d.getMinutes() < 10 ? `0${d.getMinutes()}` : `${d.getMinutes()}`; - let s = d.getSeconds() < 10 ? `0${d.getSeconds()}` : `${d.getSeconds()}`; - - return `${h}:${m}:${s}:${d.getMilliseconds()}`; -}; - -// units to be used in a dropdown -export const factorForDropdown = () => { - return units.map((unit) => { - return { label: unit, value: unit }; - }); -}; - // units to be used in a dropdown export const k8sScalarUnitsExcluding = (exclude?: string[]) => { return k8sUnits @@ -149,12 +119,6 @@ export const getBytesNumber = ( return total; }; -//getTotalSize gets the total size of a value & unit -export const getTotalSize = (value: string, unit: string) => { - const bytes = getBytes(value, unit, true).toString(); - return niceBytes(bytes); -}; - export const setMemoryResource = ( memorySize: number, capacitySize: string, @@ -554,186 +518,6 @@ export const niceDaysInt = (seconds: number, timeVariant: string = "s") => { }`; }; -const twoDigitsNumberString = (value: number) => { - return `${value < 10 ? "0" : ""}${value}`; -}; - -export const getTimeFromTimestamp = ( - timestamp: string, - fullDate: boolean = false, - simplifiedDate: boolean = false, -) => { - const timestampToInt = parseInt(timestamp); - if (isNaN(timestampToInt)) { - return ""; - } - const dateObject = new Date(timestampToInt * 1000); - - if (fullDate) { - if (simplifiedDate) { - return `${twoDigitsNumberString( - dateObject.getMonth() + 1, - )}/${twoDigitsNumberString(dateObject.getDate())} ${twoDigitsNumberString( - dateObject.getHours(), - )}:${twoDigitsNumberString(dateObject.getMinutes())}`; - } else { - return dateObject.toLocaleString(); - } - } - return `${dateObject.getHours()}:${String(dateObject.getMinutes()).padStart( - 2, - "0", - )}`; -}; - -export const calculateBytes = ( - x: string | number, - showDecimals = false, - roundFloor = true, - k8sUnit = false, -): IBytesCalc => { - let bytes; - - if (typeof x === "string") { - bytes = parseInt(x, 10); - } else { - bytes = x; - } - - if (bytes === 0) { - return { total: 0, unit: units[0] }; - } - - // Gi : GiB - const k = 1024; - - // Get unit for measure - const i = Math.floor(Math.log(bytes) / Math.log(k)); - - const fractionDigits = showDecimals ? 1 : 0; - - const bytesUnit = bytes / Math.pow(k, i); - - const roundedUnit = roundFloor ? Math.floor(bytesUnit) : bytesUnit; - - // Get Unit parsed - const unitParsed = parseFloat(roundedUnit.toFixed(fractionDigits)); - const finalUnit = k8sUnit ? k8sCalcUnits[i] : units[i]; - - return { total: unitParsed, unit: finalUnit }; -}; - -export const nsToSeconds = (nanoseconds: number) => { - const conversion = nanoseconds * 0.000000001; - const round = Math.round((conversion + Number.EPSILON) * 10000) / 10000; - - return `${round} s`; -}; - -export const textToRGBColor = (text: string) => { - const splitText = text.split(""); - - const hashVl = splitText.reduce((acc, currItem) => { - return acc + currItem.charCodeAt(0) + ((acc << 5) - acc); - }, 0); - - const hashColored = ((hashVl * 100) & 0x00ffffff).toString(16).toUpperCase(); - - return `#${hashColored.padStart(6, "0")}`; -}; - -export const prettyNumber = (usage: number | undefined) => { - if (usage === undefined) { - return 0; - } - - return usage.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ","); -}; - -export const representationNumber = (number: number | undefined) => { - if (number === undefined) { - return "0"; - } - - let returnValue = number.toString(); - let unit = ""; - - if (number > 999 && number < 1000000) { - returnValue = (number / 1000).toFixed(1); // convert to K, numbers > 999 - unit = "K"; - } else if (number >= 1000000 && number < 1000000000) { - returnValue = (number / 1000000).toFixed(1); // convert to M, numbers >= 1 million - unit = "M"; - } else if (number >= 1000000000) { - returnValue = (number / 1000000000).toFixed(1); // convert to B, numbers >= 1 billion - unit = "B"; - } - - if (returnValue.endsWith(".0")) { - returnValue = returnValue.slice(0, -2); - } - - return `${returnValue}${unit}`; -}; - -export const encodeURLString = (name: string | number | null) => { - if (!name) { - return ""; - } - try { - return btoa(unescape(encodeURIComponent(name))); - } catch (err) { - return ""; - } -}; - -export const decodeURLString = (text: string) => { - try { - return decodeURIComponent(escape(window.atob(text))); - } catch (err) { - return text; - } -}; - -export const performDownload = (blob: Blob, fileName: string) => { - const link = document.createElement("a"); - link.href = window.URL.createObjectURL(blob); - link.download = fileName; - document.body.appendChild(link); - link.click(); - document.body.removeChild(link); -}; - -export const getCookieValue = (cookieName: string) => { - return ( - document.cookie - .match("(^|;)\\s*" + cookieName + "\\s*=\\s*([^;]+)") - ?.pop() || "" - ); -}; - -export const capacityColors = (usedSpace: number, maxSpace: number) => { - const percCalculate = (usedSpace * 100) / maxSpace; - - if (percCalculate >= 90) { - return "#C83B51"; - } else if (percCalculate >= 70) { - return "#FFAB0F"; - } - - return "#07193E"; -}; - -export const getClientOS = (): string => { - const getPlatform = get(window.navigator, "platform", "undefined"); - - if (!getPlatform) { - return "undefined"; - } - - return getPlatform; -}; - export const MinIOEnvVarsSettings: any = { MINIO_ACCESS_KEY: { secret: true }, MINIO_ACCESS_KEY_OLD: { secret: true }, @@ -753,165 +537,3 @@ export const MinIOEnvVarsSettings: any = { MINIO_SECRET_KEY: { secret: true }, MINIO_SECRET_KEY_OLD: { secret: true }, }; - -export const MinIOEnvironmentVariables = [ - "MINIO_ACCESS_KEY", - "MINIO_ACCESS_KEY_OLD", - "MINIO_AUDIT_WEBHOOK_AUTH_TOKEN", - "MINIO_AUDIT_WEBHOOK_CLIENT_CERT", - "MINIO_AUDIT_WEBHOOK_CLIENT_KEY", - "MINIO_AUDIT_WEBHOOK_ENABLE", - "MINIO_AUDIT_WEBHOOK_ENDPOINT", - "MINIO_BROWSER", - "MINIO_BROWSER_REDIRECT_URL", - "MINIO_IDENTITY_LDAP_COMMENT", - "MINIO_IDENTITY_LDAP_GROUP_SEARCH_BASE_DN", - "MINIO_IDENTITY_LDAP_GROUP_SEARCH_FILTER", - "MINIO_IDENTITY_LDAP_LOOKUP_BIND_DN", - "MINIO_IDENTITY_LDAP_LOOKUP_BIND_PASSWORD", - "MINIO_IDENTITY_LDAP_SERVER_ADDR", - "MINIO_IDENTITY_LDAP_SERVER_INSECURE", - "MINIO_IDENTITY_LDAP_SERVER_STARTTLS", - "MINIO_IDENTITY_LDAP_STS_EXPIRY", - "MINIO_IDENTITY_LDAP_TLS_SKIP_VERIFY", - "MINIO_IDENTITY_LDAP_USER_DN_SEARCH_BASE_DN", - "MINIO_IDENTITY_LDAP_USER_DN_SEARCH_FILTER", - "MINIO_IDENTITY_LDAP_USERNAME_FORMAT", - "MINIO_IDENTITY_OPENID_CLAIM_NAME", - "MINIO_IDENTITY_OPENID_CLAIM_PREFIX", - "MINIO_IDENTITY_OPENID_CLIENT_ID", - "MINIO_IDENTITY_OPENID_CLIENT_SECRET", - "MINIO_IDENTITY_OPENID_COMMENT", - "MINIO_IDENTITY_OPENID_CONFIG_URL", - "MINIO_IDENTITY_OPENID_SCOPES", - "MINIO_KMS_AUTO_ENCRYPTION", - "MINIO_KMS_KES_CERT_FILE", - "MINIO_KMS_KES_ENDPOINT", - "MINIO_KMS_KES_KEY_FILE", - "MINIO_KMS_KES_KEY_NAME", - "MINIO_KMS_SECRET_KEY", - "MINIO_LOGGER_WEBHOOK_AUTH_TOKEN", - "MINIO_LOGGER_WEBHOOK_ENABLE", - "MINIO_LOGGER_WEBHOOK_ENDPOINT", - "MINIO_LOG_QUERY_URL", - "MINIO_NOTIFY_AMQP_AUTO_DELETED", - "MINIO_NOTIFY_AMQP_COMMENT", - "MINIO_NOTIFY_AMQP_DELIVERY_MODE", - "MINIO_NOTIFY_AMQP_DURABLE", - "MINIO_NOTIFY_AMQP_ENABLE", - "MINIO_NOTIFY_AMQP_EXCHANGE", - "MINIO_NOTIFY_AMQP_EXCHANGE_TYPE", - "MINIO_NOTIFY_AMQP_INTERNAL", - "MINIO_NOTIFY_AMQP_MANDATORY", - "MINIO_NOTIFY_AMQP_NO_WAIT", - "MINIO_NOTIFY_AMQP_QUEUE_DIR", - "MINIO_NOTIFY_AMQP_QUEUE_LIMIT", - "MINIO_NOTIFY_AMQP_ROUTING_KEY", - "MINIO_NOTIFY_AMQP_URL", - "MINIO_NOTIFY_ELASTICSEARCH_COMMENT", - "MINIO_NOTIFY_ELASTICSEARCH_ENABLE", - "MINIO_NOTIFY_ELASTICSEARCH_FORMAT", - "MINIO_NOTIFY_ELASTICSEARCH_INDEX", - "MINIO_NOTIFY_ELASTICSEARCH_PASSWORD", - "MINIO_NOTIFY_ELASTICSEARCH_QUEUE_DIR", - "MINIO_NOTIFY_ELASTICSEARCH_QUEUE_LIMIT", - "MINIO_NOTIFY_ELASTICSEARCH_URL", - "MINIO_NOTIFY_ELASTICSEARCH_USERNAME", - "MINIO_NOTIFY_KAFKA_BROKERS", - "MINIO_NOTIFY_KAFKA_CLIENT_TLS_CERT", - "MINIO_NOTIFY_KAFKA_CLIENT_TLS_KEY", - "MINIO_NOTIFY_KAFKA_COMMENT", - "MINIO_NOTIFY_KAFKA_ENABLE", - "MINIO_NOTIFY_KAFKA_QUEUE_DIR", - "MINIO_NOTIFY_KAFKA_QUEUE_LIMIT", - "MINIO_NOTIFY_KAFKA_SASL", - "MINIO_NOTIFY_KAFKA_SASL_MECHANISM", - "MINIO_NOTIFY_KAFKA_SASL_PASSWORD", - "MINIO_NOTIFY_KAFKA_SASL_USERNAME", - "MINIO_NOTIFY_KAFKA_TLS", - "MINIO_NOTIFY_KAFKA_TLS_CLIENT_AUTH", - "MINIO_NOTIFY_KAFKA_TLS_SKIP_VERIFY", - "MINIO_NOTIFY_KAFKA_TOPIC", - "MINIO_NOTIFY_KAFKA_VERSION", - "MINIO_NOTIFY_MQTT_BROKER", - "MINIO_NOTIFY_MQTT_COMMENT", - "MINIO_NOTIFY_MQTT_ENABLE", - "MINIO_NOTIFY_MQTT_KEEP_ALIVE_INTERVAL", - "MINIO_NOTIFY_MQTT_PASSWORD", - "MINIO_NOTIFY_MQTT_QOS", - "MINIO_NOTIFY_MQTT_QUEUE_DIR", - "MINIO_NOTIFY_MQTT_QUEUE_LIMIT", - "MINIO_NOTIFY_MQTT_RECONNECT_INTERVAL", - "MINIO_NOTIFY_MQTT_TOPIC", - "MINIO_NOTIFY_MQTT_USERNAME", - "MINIO_NOTIFY_MYSQL_COMMENT", - "MINIO_NOTIFY_MYSQL_DSN_STRING", - "MINIO_NOTIFY_MYSQL_ENABLE", - "MINIO_NOTIFY_MYSQL_FORMAT", - "MINIO_NOTIFY_MYSQL_MAX_OPEN_CONNECTIONS", - "MINIO_NOTIFY_MYSQL_QUEUE_DIR", - "MINIO_NOTIFY_MYSQL_QUEUE_LIMIT", - "MINIO_NOTIFY_MYSQL_TABLE", - "MINIO_NOTIFY_NATS_ADDRESS", - "MINIO_NOTIFY_NATS_CERT_AUTHORITY", - "MINIO_NOTIFY_NATS_CLIENT_CERT", - "MINIO_NOTIFY_NATS_CLIENT_KEY", - "MINIO_NOTIFY_NATS_COMMENT", - "MINIO_NOTIFY_NATS_ENABLE", - "MINIO_NOTIFY_NATS_PASSWORD", - "MINIO_NOTIFY_NATS_PING_INTERVAL", - "MINIO_NOTIFY_NATS_QUEUE_DIR", - "MINIO_NOTIFY_NATS_QUEUE_LIMIT", - "MINIO_NOTIFY_NATS_STREAMING", - "MINIO_NOTIFY_NATS_STREAMING_ASYNC", - "MINIO_NOTIFY_NATS_STREAMING_CLUSTER_ID", - "MINIO_NOTIFY_NATS_STREAMING_MAX_PUB_ACKS_IN_FLIGHT", - "MINIO_NOTIFY_NATS_SUBJECT", - "MINIO_NOTIFY_NATS_TLS", - "MINIO_NOTIFY_NATS_TLS_SKIP_VERIFY", - "MINIO_NOTIFY_NATS_TOKEN", - "MINIO_NOTIFY_NATS_USERNAME", - "MINIO_NOTIFY_NSQ_COMMENT", - "MINIO_NOTIFY_NSQ_ENABLE", - "MINIO_NOTIFY_NSQ_NSQD_ADDRESS", - "MINIO_NOTIFY_NSQ_QUEUE_DIR", - "MINIO_NOTIFY_NSQ_QUEUE_LIMIT", - "MINIO_NOTIFY_NSQ_TLS", - "MINIO_NOTIFY_NSQ_TLS_SKIP_VERIFY", - "MINIO_NOTIFY_NSQ_TOPIC", - "MINIO_NOTIFY_POSTGRESQL_COMMENT", - "MINIO_NOTIFY_POSTGRESQL_CONNECTION_STRING", - "MINIO_NOTIFY_POSTGRESQL_ENABLE", - "MINIO_NOTIFY_POSTGRESQL_FORMAT", - "MINIO_NOTIFY_POSTGRESQL_MAX_OPEN_CONNECTIONS", - "MINIO_NOTIFY_POSTGRESQL_QUEUE_DIR", - "MINIO_NOTIFY_POSTGRESQL_QUEUE_LIMIT", - "MINIO_NOTIFY_POSTGRESQL_TABLE", - "MINIO_NOTIFY_REDIS_ADDRESS", - "MINIO_NOTIFY_REDIS_COMMENT", - "MINIO_NOTIFY_REDIS_ENABLE", - "MINIO_NOTIFY_REDIS_FORMAT", - "MINIO_NOTIFY_REDIS_KEY", - "MINIO_NOTIFY_REDIS_PASSWORD", - "MINIO_NOTIFY_REDIS_QUEUE_DIR", - "MINIO_NOTIFY_REDIS_QUEUE_LIMIT", - "MINIO_NOTIFY_WEBHOOK_AUTH_TOKEN", - "MINIO_NOTIFY_WEBHOOK_CLIENT_CERT", - "MINIO_NOTIFY_WEBHOOK_CLIENT_KEY", - "MINIO_NOTIFY_WEBHOOK_COMMENT", - "MINIO_NOTIFY_WEBHOOK_ENABLE", - "MINIO_NOTIFY_WEBHOOK_ENDPOINT", - "MINIO_NOTIFY_WEBHOOK_QUEUE_DIR", - "MINIO_NOTIFY_WEBHOOK_QUEUE_LIMIT", - "MINIO_PROMETHEUS_AUTH_TYPE", - "MINIO_PROMETHEUS_JOB_ID", - "MINIO_PROMETHEUS_URL", - "MINIO_ROOT_PASSWORD", - "MINIO_ROOT_USER", - "MINIO_SECRET_KEY", - "MINIO_SECRET_KEY_OLD", - "MINIO_SERVER_URL", - "MINIO_STORAGE_CLASS_COMMENT", - "MINIO_STORAGE_CLASS_RRS", - "MINIO_STORAGE_CLASS_STANDARD", -]; diff --git a/web-app/src/config.ts b/web-app/src/config.ts index 730d89c9c3c..7e59cf89694 100644 --- a/web-app/src/config.ts +++ b/web-app/src/config.ts @@ -38,8 +38,3 @@ export const getLogoVar = (): LogoVar => { } return logoVar; }; - -export const registeredCluster = (): boolean => { - const plan = getLogoVar(); - return plan === "standard" || plan === "enterprise"; -}; diff --git a/web-app/src/icons/SidebarMenus/EncryptionIcon.tsx b/web-app/src/icons/SidebarMenus/EncryptionIcon.tsx deleted file mode 100644 index 56ce672f6f4..00000000000 --- a/web-app/src/icons/SidebarMenus/EncryptionIcon.tsx +++ /dev/null @@ -1,37 +0,0 @@ -// This file is part of MinIO Operator -// Copyright (c) 2022 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 . - -import * as React from "react"; -import { SVGProps } from "react"; - -const EncryptionIcon = (props: SVGProps) => ( - - - -); - -export default EncryptionIcon; diff --git a/web-app/src/icons/SidebarMenus/EncryptionStatusIcon.tsx b/web-app/src/icons/SidebarMenus/EncryptionStatusIcon.tsx deleted file mode 100644 index 784a526d7c6..00000000000 --- a/web-app/src/icons/SidebarMenus/EncryptionStatusIcon.tsx +++ /dev/null @@ -1,38 +0,0 @@ -// This file is part of MinIO Operator -// Copyright (c) 2022 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 . - -import * as React from "react"; -import { SVGProps } from "react"; - -const EncryptionStatusIcon = (props: SVGProps) => ( - - - -); - -export default EncryptionStatusIcon; diff --git a/web-app/src/screens/Console/Common/DistributedOnly/DistributedOnly.tsx b/web-app/src/screens/Console/Common/DistributedOnly/DistributedOnly.tsx deleted file mode 100644 index aa75ee392af..00000000000 --- a/web-app/src/screens/Console/Common/DistributedOnly/DistributedOnly.tsx +++ /dev/null @@ -1,70 +0,0 @@ -// This file is part of MinIO Operator -// 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 . - -import React from "react"; -import { Box, Grid } from "@mui/material"; -import { HelpBox } from "mds"; - -interface IDistributedOnly { - iconComponent: any; - entity: string; -} - -const DistributedOnly = ({ iconComponent, entity }: IDistributedOnly) => { - return ( - - - theme.colors.link, - textDecoration: "underline", - }, - }} - > -
This feature is not available for a single-disk setup.
- -
- Please deploy a server in{" "} - - Distributed Mode - {" "} - to use this feature. -
- - } - /> -
-
- ); -}; - -export default DistributedOnly; diff --git a/web-app/src/screens/Console/Common/FormComponents/AutocompleteWrapper/AutocompleteWrapper.tsx b/web-app/src/screens/Console/Common/FormComponents/AutocompleteWrapper/AutocompleteWrapper.tsx deleted file mode 100644 index 5b191efc9c3..00000000000 --- a/web-app/src/screens/Console/Common/FormComponents/AutocompleteWrapper/AutocompleteWrapper.tsx +++ /dev/null @@ -1,133 +0,0 @@ -// This file is part of MinIO Operator -// 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 . -import React, { useState } from "react"; -import Grid from "@mui/material/Grid"; -import { - FormControl, - InputLabel, - OutlinedInputProps, - TextField, - TextFieldProps, - Tooltip, -} from "@mui/material"; -import makeStyles from "@mui/styles/makeStyles"; -import Autocomplete from "@mui/material/Autocomplete"; -import { Theme } from "@mui/material/styles"; -import createStyles from "@mui/styles/createStyles"; -import withStyles from "@mui/styles/withStyles"; -import { - fieldBasic, - inputFieldStyles, - tooltipHelper, -} from "../common/styleLibrary"; -import { HelpIcon } from "mds"; - -interface selectorTypes { - label: string; - value: string; -} - -interface SelectProps { - options: selectorTypes[]; - value: string; - label: string; - id: string; - name: string; - tooltip?: string; - onChange: (returnedValue: string) => void; - disabled?: boolean; - classes: any; -} - -const styles = (theme: Theme) => - createStyles({ - ...fieldBasic, - ...tooltipHelper, - }); - -const inputStyles = makeStyles((theme: Theme) => - createStyles({ - ...inputFieldStyles, - }), -); - -function InputField(props: TextFieldProps) { - const classes = inputStyles(); - - return ( - } - {...props} - /> - ); -} - -const AutocompleteWrapper = ({ - classes, - id, - name, - onChange, - options, - label, - tooltip = "", - value, - disabled = false, -}: SelectProps) => { - const [internalValue, setInternalValue] = useState(options[0]); - - const executeOnSelect = (_: any, selectedValue: any) => { - if (selectedValue) { - onChange(selectedValue.value); - setInternalValue(selectedValue); - } - }; - - return ( - - - {label !== "" && ( - - {label} - {tooltip !== "" && ( -
- -
- -
-
-
- )} -
- )} - - option.label} - isOptionEqualToValue={(option) => option.value === value} - disabled={disabled} - renderInput={(params) => } - value={internalValue} - onChange={executeOnSelect} - autoHighlight - /> - -
-
- ); -}; - -export default withStyles(styles)(AutocompleteWrapper); diff --git a/web-app/src/screens/Console/Common/FormComponents/CSVMultiSelector/CSVMultiSelector.tsx b/web-app/src/screens/Console/Common/FormComponents/CSVMultiSelector/CSVMultiSelector.tsx deleted file mode 100644 index a9e4c9188ea..00000000000 --- a/web-app/src/screens/Console/Common/FormComponents/CSVMultiSelector/CSVMultiSelector.tsx +++ /dev/null @@ -1,208 +0,0 @@ -// This file is part of MinIO Operator -// 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 . -import React, { - ChangeEvent, - createRef, - useCallback, - useEffect, - useRef, - useState, -} from "react"; -import get from "lodash/get"; -import { Theme } from "@mui/material/styles"; -import createStyles from "@mui/styles/createStyles"; -import withStyles from "@mui/styles/withStyles"; -import Grid from "@mui/material/Grid"; -import { InputLabel, Tooltip } from "@mui/material"; -import { fieldBasic, tooltipHelper } from "../common/styleLibrary"; -import { AddIcon, HelpIcon } from "mds"; -import InputBoxWrapper from "../InputBoxWrapper/InputBoxWrapper"; - -interface ICSVMultiSelector { - elements: string; - name: string; - label: string; - tooltip?: string; - commonPlaceholder?: string; - classes: any; - withBorder?: boolean; - onChange: (elements: string) => void; -} - -const styles = (theme: Theme) => { - return createStyles({ - ...fieldBasic, - ...tooltipHelper, - inputWithBorder: { - border: "1px solid #EAEAEA", - padding: 15, - height: 150, - overflowY: "auto", - position: "relative", - marginTop: 15, - flex: 1, - }, - inputBoxSpacer: { - marginBottom: 7, - }, - inputLabel: { - ...fieldBasic.inputLabel, - margin: 0, - alignItems: "flex-start", - paddingTop: "20px", - minWidth: 162, - }, - }); -}; - -const CSVMultiSelector = ({ - elements, - name, - label, - tooltip = "", - commonPlaceholder = "", - onChange, - withBorder = false, - classes, -}: ICSVMultiSelector) => { - const [currentElements, setCurrentElements] = useState([""]); - const bottomList = createRef(); - - // Use effect to get the initial values from props - useEffect(() => { - if ( - currentElements.length === 1 && - currentElements[0] === "" && - elements && - elements !== "" - ) { - const elementsSplit = elements.split(","); - elementsSplit.push(""); - - setCurrentElements(elementsSplit); - } - - // eslint-disable-next-line react-hooks/exhaustive-deps - }, [elements, currentElements]); - - // Use effect to send new values to onChange - useEffect(() => { - if (currentElements.length > 1) { - const refScroll = bottomList.current; - if (refScroll) { - refScroll.scrollIntoView(false); - } - } - }, [currentElements, bottomList]); - - const onChangeCallback = useCallback( - (newString: string) => { - onChange(newString); - }, - [onChange], - ); - - // We avoid multiple re-renders / hang issue typing too fast - const firstUpdate = useRef(true); - useEffect(() => { - if (firstUpdate.current) { - firstUpdate.current = false; - return; - } - const elementsString = currentElements - .filter((element) => element.trim() !== "") - .join(","); - - onChangeCallback(elementsString); - - // eslint-disable-next-line react-hooks/exhaustive-deps - }, [currentElements]); - - // If the last input is not empty, we add a new one - const addEmptyLine = (elementsUp: string[]) => { - if (elementsUp[elementsUp.length - 1].trim() !== "") { - const cpList = [...elementsUp]; - cpList.push(""); - setCurrentElements(cpList); - } - }; - - // Onchange function for input box, we get the dataset-index & only update that value in the array - const onChangeElement = (e: ChangeEvent) => { - e.persist(); - - let updatedElement = [...currentElements]; - const index = get(e.target, "dataset.index", "0"); - const indexNum = parseInt(index); - updatedElement[indexNum] = e.target.value; - - setCurrentElements(updatedElement); - }; - - const inputs = currentElements.map((element, index) => { - return ( -
- : null - } - overlayAction={() => { - addEmptyLine(currentElements); - }} - /> -
- ); - }); - - return ( - - - - {label} - {tooltip !== "" && ( -
- -
- -
-
-
- )} -
- - {inputs} -
- - - - ); -}; -export default withStyles(styles)(CSVMultiSelector); diff --git a/web-app/src/screens/Console/Common/FormComponents/CommentBoxWrapper/CommentBoxWrapper.tsx b/web-app/src/screens/Console/Common/FormComponents/CommentBoxWrapper/CommentBoxWrapper.tsx deleted file mode 100644 index d9d26357ab8..00000000000 --- a/web-app/src/screens/Console/Common/FormComponents/CommentBoxWrapper/CommentBoxWrapper.tsx +++ /dev/null @@ -1,158 +0,0 @@ -// This file is part of MinIO Operator -// 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 . - -import React from "react"; -import { Grid, InputLabel, TextField, Tooltip } from "@mui/material"; -import { Theme } from "@mui/material/styles"; -import createStyles from "@mui/styles/createStyles"; -import withStyles from "@mui/styles/withStyles"; -import { fieldBasic, tooltipHelper } from "../common/styleLibrary"; -import { HelpIcon } from "mds"; - -interface CommentBoxProps { - label: string; - classes: any; - onChange: (e: React.ChangeEvent) => void; - value: string | boolean; - id: string; - name: string; - disabled?: boolean; - tooltip?: string; - index?: number; - error?: string; - required?: boolean; - placeholder?: string; -} - -const styles = (theme: Theme) => - createStyles({ - ...fieldBasic, - ...tooltipHelper, - inputLabel: { - ...fieldBasic.inputLabel, - fontSize: 14, - margin: 0, - alignItems: "flex-start", - paddingTop: "20px", - flexWrap: "wrap", - display: "flex", - }, - textBoxContainer: { - flexGrow: 1, - position: "relative", - }, - cssOutlinedInput: { - borderColor: "#EAEAEA", - padding: 16, - }, - rootContainer: { - "& .MuiOutlinedInput-inputMultiline": { - ...fieldBasic.inputLabel, - fontSize: 13, - minHeight: 150, - }, - "&.Mui-focused .MuiOutlinedInput-notchedOutline": { - borderColor: "#07193E", - borderWidth: 1, - }, - "& textarea": { - color: "#07193E", - fontSize: 13, - fontWeight: 600, - "&:placeholder": { - color: "#858585", - opacity: 1, - fontWeight: 400, - }, - }, - }, - }); - -const CommentBoxWrapper = ({ - label, - onChange, - value, - id, - name, - disabled = false, - tooltip = "", - index = 0, - error = "", - required = false, - placeholder = "", - classes, -}: CommentBoxProps) => { - let inputProps: any = { "data-index": index }; - - return ( - - - {label !== "" && ( - - - {label} - {required ? "*" : ""} - - {tooltip !== "" && ( -
- -
- -
-
-
- )} -
- )} - -
- -
-
-
- ); -}; - -export default withStyles(styles)(CommentBoxWrapper); diff --git a/web-app/src/screens/Console/Common/FormComponents/DateRangeSelector/DateRangeSelector.tsx b/web-app/src/screens/Console/Common/FormComponents/DateRangeSelector/DateRangeSelector.tsx deleted file mode 100644 index 54fc8b6c67d..00000000000 --- a/web-app/src/screens/Console/Common/FormComponents/DateRangeSelector/DateRangeSelector.tsx +++ /dev/null @@ -1,256 +0,0 @@ -// This file is part of MinIO Operator -// 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 . - -import React from "react"; -import { Button, OpenListIcon, SyncIcon } from "mds"; -import { DateTime } from "luxon"; -import { Box, Grid } from "@mui/material"; -import ScheduleIcon from "@mui/icons-material/Schedule"; -import WatchLaterIcon from "@mui/icons-material/WatchLater"; -import DateTimePickerWrapper from "../DateTimePickerWrapper/DateTimePickerWrapper"; - -interface IDateRangeSelector { - timeStart: DateTime | null; - setTimeStart: (value: DateTime | null) => void; - timeEnd: DateTime | null; - setTimeEnd: (value: DateTime | null) => void; - triggerSync?: () => void; - label?: string; - startLabel?: string; - endLabel?: string; -} - -const DateFilterAdornIcon = () => { - return ( - - - - ); -}; - -const DateRangeSelector = ({ - timeStart, - setTimeStart, - timeEnd, - setTimeEnd, - triggerSync, - label = "Filter:", - startLabel = "Start Time:", - endLabel = "End Time:", -}: IDateRangeSelector) => { - return ( - - - - {label} - - - - - - - - {startLabel} - - - - - - - - - - - - {endLabel} - - - - - - - - {triggerSync && ( - -
}> - - - {item.badge ? : null} - - - )} - {item.name && ( - - )} - - ); - })} - - - ) : null} -
- ); -}; - -export default MenuItem; diff --git a/web-app/src/screens/Console/Menu/MenuSectionHeader.tsx b/web-app/src/screens/Console/Menu/MenuSectionHeader.tsx deleted file mode 100644 index 008911c611d..00000000000 --- a/web-app/src/screens/Console/Menu/MenuSectionHeader.tsx +++ /dev/null @@ -1,42 +0,0 @@ -// This file is part of MinIO Operator -// Copyright (c) 2022 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 . - -import React from "react"; - -interface IMenuSectionHeader { - label: string; -} - -const MenuSectionHeader = ({ label }: IMenuSectionHeader) => { - return ( -
- {label} -
- ); -}; - -export default MenuSectionHeader; diff --git a/web-app/src/screens/Console/Menu/MenuStyleUtils.tsx b/web-app/src/screens/Console/Menu/MenuStyleUtils.tsx deleted file mode 100644 index 8062bcb9890..00000000000 --- a/web-app/src/screens/Console/Menu/MenuStyleUtils.tsx +++ /dev/null @@ -1,178 +0,0 @@ -// This file is part of MinIO Operator -// Copyright (c) 2022 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 . - -export const menuItemContainerStyles: any = { - padding: "7px 0", - "div:nth-of-type(2)": { - flexGrow: 0, - marginRight: "15px", - }, - - "&.active": { - background: - "transparent linear-gradient(270deg, #00000000 0%, #005F81 53%, #54545400 100%) 0% 0% no-repeat padding-box", - backgroundBlendMode: "multiply", - - "& span": { - color: "#fff", - }, - "& svg": { - fill: "#fff", - }, - - "& div:nth-of-type(1)": { - border: "1px solid #fff", - }, - - "&:hover, &:focus": { - "& div:nth-of-type(1)": { - background: "none", - "& svg": { - fill: "#fff", - }, - }, - }, - }, -}; -export const menuItemIconStyles: any = { - width: 30, - minWidth: 30, - height: 30, - background: "#00274D", - border: "1px solid #002148", - display: "flex", - alignItems: "center", - borderRadius: "50%", - justifyContent: "center", - "& svg": { - width: 12, - height: 12, - fill: "#8399AB", - }, - "&.active": { - "& span": { - color: "#fff", - }, - "& svg": { - fill: "#fff", - }, - }, -}; - -export const LogoutItemIconStyle: any = { - width: 40, - minWidth: 40, - height: 40, - background: "#00274D", - border: "2px solid #002148", - display: "flex", - alignItems: "center", - borderRadius: "50%", - justifyContent: "center", - "& svg": { - width: 16, - height: 16, - fill: "#8399AB", - }, - "&.active": { - "& span": { - color: "#fff", - }, - "& svg": { - fill: "#fff", - }, - }, -}; - -export const menuItemTextStyles: any = { - color: "#8399AB", - fontSize: "14px", - marginLeft: "18px", - display: "flex", - position: "relative", - - "& span": { - fontSize: "14px", - }, - "&.mini": { - display: "none", - }, -}; - -export const menuItemMiniStyles: any = { - "&.mini": { - padding: 0, - display: "flex", - alignItems: "center", - justifyContent: "center", - - "& .group-icon": { - display: "none", - }, - - "&.active": { - ".menu-icon": { - border: "none", - }, - }, - }, - - "&.bottom-menu-item": { - marginBottom: "5px", - }, -}; - -export const menuItemStyle: any = { - paddingLeft: "8px", - paddingRight: "5px", - paddingBottom: "8px", - borderRadius: "2px", - marginTop: "2px", - "&.active": { - ".menu-icon": { - border: "1px solid #fff", - borderRadius: "50%", - background: "#072549", - "& svg": { - fill: "#fff", - }, - }, - "& span": { - color: "#fff", - }, - }, - "& .menu-icon": { - padding: "5px", - maxWidth: "28px", - minWidth: "28px", - height: "28px", - background: "none", - "& svg": { - width: "12px", - height: "12px", - fill: "#8399AB", - }, - }, - "&:hover, &:focus": { - "& .menu-icon": { - background: "#072549", - borderRadius: "50%", - "& svg": { - fill: "#c7c3c3", - }, - }, - }, -}; diff --git a/web-app/src/screens/Console/Menu/MenuToggle.tsx b/web-app/src/screens/Console/Menu/MenuToggle.tsx deleted file mode 100644 index 213d983a3b9..00000000000 --- a/web-app/src/screens/Console/Menu/MenuToggle.tsx +++ /dev/null @@ -1,167 +0,0 @@ -// This file is part of MinIO Operator -// 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 . - -import React, { Fragment, Suspense } from "react"; -import { ApplicationLogo, VersionIcon } from "mds"; -import { Box, IconButton } from "@mui/material"; -import MenuIcon from "@mui/icons-material/Menu"; -import { useSelector } from "react-redux"; -import { selOpMode } from "../../../systemSlice"; -import TooltipWrapper from "../Common/TooltipWrapper/TooltipWrapper"; -import { getLogoVar } from "../../../config"; - -type MenuToggleProps = { - isOpen: boolean; - onToggle: (nextState: boolean) => void; -}; -const MenuToggle = ({ isOpen, onToggle }: MenuToggleProps) => { - const stateClsName = isOpen ? "wide" : "mini"; - - const operatorMode = useSelector(selOpMode); - - let logoPlan = getLogoVar(); - - return ( - { - if (isOpen) { - onToggle(false); - } - }} - > - - {isOpen ? ( - -
- {!operatorMode ? ( - - - - ) : ( - - - - )} -
-
- ) : ( -
- ...
}> - - - - )} - - {!isOpen && ( - { - onToggle(true); - }} - size="small" - > - - - )} -
-
- ); -}; - -export default MenuToggle; diff --git a/web-app/src/screens/Console/Storage/StoragePVCs.tsx b/web-app/src/screens/Console/Storage/StoragePVCs.tsx deleted file mode 100644 index f79ac1b0b3a..00000000000 --- a/web-app/src/screens/Console/Storage/StoragePVCs.tsx +++ /dev/null @@ -1,167 +0,0 @@ -// This file is part of MinIO Operator -// Copyright (c) 2022 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 . - -import React, { Fragment, useEffect, useState } from "react"; -import get from "lodash/get"; -import { Theme } from "@mui/material/styles"; -import { Grid } from "@mui/material"; -import createStyles from "@mui/styles/createStyles"; -import withStyles from "@mui/styles/withStyles"; -import { - actionsTray, - containerForHeader, - searchField, -} from "../Common/FormComponents/common/styleLibrary"; -import { ErrorResponseHandler } from "../../../common/types"; -import { useAppDispatch } from "../../../store"; -import { setErrorSnackMessage } from "../../../systemSlice"; -import { IPVCsResponse, IStoragePVCs } from "./types"; -import api from "../../../common/api"; -import TableWrapper from "../Common/TableWrapper/TableWrapper"; -import DeletePVC from "../Tenants/TenantDetails/DeletePVC"; -import PageLayout from "../Common/Layout/PageLayout"; -import SearchBox from "../Common/SearchBox"; -import PageHeaderWrapper from "../Common/PageHeaderWrapper/PageHeaderWrapper"; - -interface IStorageVolumesProps { - classes: any; -} - -const styles = (theme: Theme) => - createStyles({ - tableWrapper: { - height: "calc(100vh - 150px)", - }, - ...actionsTray, - ...searchField, - ...containerForHeader, - }); - -const StorageVolumes = ({ classes }: IStorageVolumesProps) => { - const dispatch = useAppDispatch(); - - const [records, setRecords] = useState([]); - const [filter, setFilter] = useState(""); - const [loading, setLoading] = useState(true); - const [selectedPVC, setSelectedPVC] = useState(null); - const [deleteOpen, setDeleteOpen] = useState(false); - - useEffect(() => { - if (loading) { - api - .invoke("GET", `/api/v1/list-pvcs`) - .then((res: IPVCsResponse) => { - let volumes = get(res, "pvcs", []); - setRecords(volumes ? volumes : []); - setLoading(false); - }) - .catch((err: ErrorResponseHandler) => { - setLoading(false); - dispatch(setErrorSnackMessage(err)); - }); - } - }, [loading, dispatch]); - - const filteredRecords: IStoragePVCs[] = records.filter((elementItem) => - elementItem.name.toLowerCase().includes(filter.toLowerCase()), - ); - - const confirmDeletePVC = (pvcItem: IStoragePVCs) => { - const delPvc = { - ...pvcItem, - tenant: pvcItem.tenant, - namespace: pvcItem.namespace, - }; - setSelectedPVC(delPvc); - setDeleteOpen(true); - }; - - const tableActions = [{ type: "delete", onClick: confirmDeletePVC }]; - - const closeDeleteModalAndRefresh = (reloadData: boolean) => { - setDeleteOpen(false); - setLoading(true); - }; - - return ( - - {deleteOpen && ( - - )} - { - setFilter(val); - }} - value={filter} - /> - } - /> - - - - `${record.namespace}/${record.tenant}`, - }, - { - label: "Capacity", - elementKey: "capacity", - width: 90, - }, - { - label: "Storage Class", - elementKey: "storageClass", - }, - ]} - isLoading={loading} - records={filteredRecords} - entityName="PVCs" - idField="name" - customPaperHeight={classes.tableWrapper} - /> - - - - ); -}; - -export default withStyles(styles)(StorageVolumes); diff --git a/web-app/src/screens/Console/Storage/types.ts b/web-app/src/screens/Console/Storage/types.ts index 1ea8e030b12..6dc265d307e 100644 --- a/web-app/src/screens/Console/Storage/types.ts +++ b/web-app/src/screens/Console/Storage/types.ts @@ -25,7 +25,3 @@ export interface IStoragePVCs { age: string; tenant: string; } - -export interface IPVCsResponse { - pvcs: IStoragePVCs[]; -} diff --git a/web-app/src/screens/Console/Support/utils.tsx b/web-app/src/screens/Console/Support/utils.tsx index f581b7d9bfd..b057387fe21 100644 --- a/web-app/src/screens/Console/Support/utils.tsx +++ b/web-app/src/screens/Console/Support/utils.tsx @@ -1,8 +1,5 @@ import { Box, Grid, Link } from "@mui/material"; -import { Fragment, useState } from "react"; -import { CopyIcon, SettingsIcon } from "mds"; -import FormSwitchWrapper from "../Common/FormComponents/FormSwitchWrapper/FormSwitchWrapper"; -import InputBoxWrapper from "../Common/FormComponents/InputBoxWrapper/InputBoxWrapper"; +import { Fragment } from "react"; import RegistrationStatusBanner from "./RegistrationStatusBanner"; export const FormTitle = ({ @@ -57,101 +54,3 @@ export const ClusterRegistered = ({ email }: { email: string }) => { ); }; - -export const ProxyConfiguration = () => { - const proxyConfigurationCommand = - "mc admin config set {alias} subnet proxy={proxy}"; - const [displaySubnetProxy, setDisplaySubnetProxy] = useState(false); - return ( - - - - - -
- Proxy Configuration -
-
- - For airgap/firewalled environments it is possible to{" "} - - configure a proxy - {" "} - to connect to SUBNET . - - - {displaySubnetProxy && ( - {}} - label="" - value={proxyConfigurationCommand} - overlayIcon={} - extraInputProps={{ - readOnly: true, - }} - overlayAction={() => - navigator.clipboard.writeText(proxyConfigurationCommand) - } - /> - )} - -
- - ) => { - setDisplaySubnetProxy(event.target.checked); - }} - /> - -
-
- ); -}; diff --git a/web-app/src/screens/Console/Tenants/ListTenants/types.ts b/web-app/src/screens/Console/Tenants/ListTenants/types.ts index ddbc2ef6944..e6e06ff6706 100644 --- a/web-app/src/screens/Console/Tenants/ListTenants/types.ts +++ b/web-app/src/screens/Console/Tenants/ListTenants/types.ts @@ -96,29 +96,6 @@ export interface ITenantMonitoringStruct { prometheusEnabled: boolean; } -export interface ITenantLogsStruct { - auditLoggingEnabled: boolean; - image: string; - labels: IKeyValue[]; - annotations: IKeyValue[]; - nodeSelector: IKeyValue[]; - diskCapacityGB: number; - serviceAccountName: string; - dbImage: string; - dbInitImage: string; - dbLabels: IKeyValue[]; - dbAnnotations: IKeyValue[]; - dbNodeSelector: IKeyValue[]; - dbServiceAccountName: string; - disabled: boolean; - logCPURequest: string; - logMemRequest: string; - logDBCPURequest: string; - logDBMemRequest: string; - securityContext: SecurityContext; - dbSecurityContext: SecurityContext; -} - export interface ValueUnit { value: string; unit: string; @@ -134,10 +111,3 @@ export interface CapacityValue { label: string; color: string; } - -export interface ITenantAuditLogs { - classes: any; - labels: IKeyValue[]; - annotations: IKeyValue[]; - nodeSelector: IKeyValue[]; -} diff --git a/web-app/src/screens/Console/Tenants/ListTenants/utils.ts b/web-app/src/screens/Console/Tenants/ListTenants/utils.ts index 2df2772760a..348c9113be9 100644 --- a/web-app/src/screens/Console/Tenants/ListTenants/utils.ts +++ b/web-app/src/screens/Console/Tenants/ListTenants/utils.ts @@ -31,8 +31,6 @@ export interface IQuotas { name: string; } -export const minMemReq = 2147483648; - export interface KeyPair { id: string; encoded_cert: string; diff --git a/web-app/src/screens/Console/Tenants/TenantDetails/KeyPairEdit.tsx b/web-app/src/screens/Console/Tenants/TenantDetails/KeyPairEdit.tsx deleted file mode 100644 index 6c774c0d387..00000000000 --- a/web-app/src/screens/Console/Tenants/TenantDetails/KeyPairEdit.tsx +++ /dev/null @@ -1,152 +0,0 @@ -import React, { Fragment, useEffect } from "react"; -import createStyles from "@mui/styles/createStyles"; -import withStyles from "@mui/styles/withStyles"; -import { Theme } from "@mui/material/styles"; -import { modalBasic } from "../../Common/FormComponents/common/styleLibrary"; -import InputBoxWrapper from "../../Common/FormComponents/InputBoxWrapper/InputBoxWrapper"; -import { IconButton, Tooltip } from "@mui/material"; -import AddIcon from "@mui/icons-material/Add"; -import DeleteIcon from "@mui/icons-material/Delete"; -import { IKeyValue } from "../ListTenants/types"; -import { - commonFormValidation, - IValidation, -} from "../../../../utils/validationFunctions"; -import { clearValidationError } from "../utils"; -import Grid from "@mui/material/Grid"; - -interface IKeyPairEditProps { - classes: any; - paramName: string; - error: any; - setError: (e: any) => void; - newValues: IKeyValue[]; - setNewValues: (vals: IKeyValue[]) => void; -} - -const styles = (theme: Theme) => - createStyles({ - shortened: { - gridTemplateColumns: "auto auto 20px 20px", - display: "grid", - gridGap: 20, - paddingRight: 20, - }, - ...modalBasic, - }); - -const KeyPairEdit = ({ - classes, - paramName, - newValues, - setNewValues, - error, - setError, -}: IKeyPairEditProps) => { - const cleanValidation = (fieldName: string) => { - setError(clearValidationError(error, fieldName)); - }; - - useEffect(() => { - let keyPairValidation: IValidation[] = []; - - for (var i = 0; i < newValues.length; i++) { - keyPairValidation.push({ - fieldKey: `key-${i.toString()}`, - required: false, - value: newValues[i].key, - pattern: /^[a-zA-Z0-9-_.]{1,63}$/, - customPatternMessage: "Invalid key", - }); - keyPairValidation.push({ - fieldKey: `val-${i.toString()}`, - required: false, - value: newValues[i].value, - pattern: /^[a-zA-Z0-9-_.]{1,63}$/, - customPatternMessage: "Invalid value", - }); - } - - const commonVal = commonFormValidation(keyPairValidation); - setError(commonVal); - }, [newValues, setError]); - - let keyValueInputs = newValues.map((_, index) => { - return ( - - -
- { - let tempLabels = [...newValues]; - tempLabels[index].key = e.target.value; - setNewValues(tempLabels); - cleanValidation(`key-${index.toString()}`); - }} - index={index} - key={`csv-key-${index.toString()}`} - error={error[`key-${index.toString()}`] || ""} - /> - { - let tempLabels = [...newValues]; - tempLabels[index].value = e.target.value; - setNewValues(tempLabels); - cleanValidation(`val-${index.toString()}`); - }} - index={index} - key={`csv-val-${index.toString()}`} - error={error[`val-${index.toString()}`] || ""} - /> - - { - let tempLabels = [...newValues]; - tempLabels.push({ key: "", value: "" }); - setNewValues(tempLabels); - }} - > - - - - - { - if (newValues.length === 1) { - setNewValues([{ key: "", value: "" }]); - } - if (newValues.length > 1) { - let tempLabels = [...newValues]; - tempLabels.splice(index, 1); - setNewValues(tempLabels); - } - }} - > - - - -
-
-
- ); - }); - - return {keyValueInputs}; -}; - -export default withStyles(styles)(KeyPairEdit); diff --git a/web-app/src/screens/Console/Tenants/TenantDetails/tenantMonitoringSlice.ts b/web-app/src/screens/Console/Tenants/TenantDetails/tenantMonitoringSlice.ts deleted file mode 100644 index e4463a5964c..00000000000 --- a/web-app/src/screens/Console/Tenants/TenantDetails/tenantMonitoringSlice.ts +++ /dev/null @@ -1,131 +0,0 @@ -// This file is part of MinIO Operator -// Copyright (c) 2022 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 . -import { createSlice, PayloadAction } from "@reduxjs/toolkit"; -import { IKeyValue } from "../ListTenants/types"; - -export interface IEditTenantMonitoring { - prometheusEnabled: boolean; - image: string; - sidecarImage: string; - initImage: string; - storageClassName: string; - labels: IKeyValue[]; - annotations: IKeyValue[]; - nodeSelector: IKeyValue[]; - diskCapacityGB: string; - serviceAccountName: string; - monitoringCPURequest: string; - monitoringMemRequest: string; - runAsUser: string; - runAsGroup: string; - fsGroup: string; - runAsNonRoot: boolean; -} - -const initialState: IEditTenantMonitoring = { - prometheusEnabled: false, - image: "", - sidecarImage: "", - initImage: "", - storageClassName: "", - labels: [{ key: " ", value: " " }], - annotations: [{ key: " ", value: " " }], - nodeSelector: [{ key: " ", value: " " }], - diskCapacityGB: "0", - serviceAccountName: "", - monitoringCPURequest: "", - monitoringMemRequest: "", - runAsUser: "1000", - runAsGroup: "1000", - fsGroup: "1000", - runAsNonRoot: true, -}; - -export const editTenantMonitoringSlice = createSlice({ - name: "editTenantMonitoring", - initialState, - reducers: { - setPrometheusEnabled: (state, action: PayloadAction) => { - state.prometheusEnabled = action.payload; - }, - setImage: (state, action: PayloadAction) => { - state.image = action.payload; - }, - setSidecarImage: (state, action: PayloadAction) => { - state.sidecarImage = action.payload; - }, - setInitImage: (state, action: PayloadAction) => { - state.initImage = action.payload; - }, - setStorageClassName: (state, action: PayloadAction) => { - state.storageClassName = action.payload; - }, - setLabels: (state, action: PayloadAction) => { - state.labels = action.payload; - }, - setAnnotations: (state, action: PayloadAction) => { - state.annotations = action.payload; - }, - setNodeSelector: (state, action: PayloadAction) => { - state.nodeSelector = action.payload; - }, - setDiskCapacityGB: (state, action: PayloadAction) => { - state.diskCapacityGB = action.payload; - }, - setServiceAccountName: (state, action: PayloadAction) => { - state.serviceAccountName = action.payload; - }, - setCPURequest: (state, action: PayloadAction) => { - state.monitoringCPURequest = action.payload; - }, - setMemRequest: (state, action: PayloadAction) => { - state.monitoringMemRequest = action.payload; - }, - setRunAsUser: (state, action: PayloadAction) => { - state.runAsUser = action.payload; - }, - setRunAsGroup: (state, action: PayloadAction) => { - state.runAsGroup = action.payload; - }, - setFSGroup: (state, action: PayloadAction) => { - state.fsGroup = action.payload; - }, - setRunAsNonRoot: (state, action: PayloadAction) => { - state.runAsNonRoot = action.payload; - }, - }, -}); - -export const { - setPrometheusEnabled, - setImage, - setSidecarImage, - setInitImage, - setStorageClassName, - setLabels, - setAnnotations, - setNodeSelector, - setDiskCapacityGB, - setServiceAccountName, - setCPURequest, - setMemRequest, - setRunAsUser, - setRunAsGroup, - setFSGroup, - setRunAsNonRoot, -} = editTenantMonitoringSlice.actions; - -export default editTenantMonitoringSlice.reducer; diff --git a/web-app/src/screens/Console/Tenants/types.ts b/web-app/src/screens/Console/Tenants/types.ts index 9a8ee8fce7e..895a51f7360 100644 --- a/web-app/src/screens/Console/Tenants/types.ts +++ b/web-app/src/screens/Console/Tenants/types.ts @@ -269,11 +269,6 @@ export interface ITenantAffinity { withPodAntiAffinity: boolean; } -export interface ILabelKeyPair { - labelKey: string; - labelValue: string; -} - export interface AllocableResourcesResponse { min_allocatable_mem?: number; min_allocatable_cpu?: number; @@ -328,14 +323,6 @@ export interface ITenantSetAdministratorsRequest { group_dns?: string[]; } -export interface IEditMonitoringSecurityContext { - securityContextEnabled: boolean; - runAsUser: string; - runAsGroup: string; - fsGroup: string; - runAsNonRoot: boolean; -} - export interface IEditTenantSecurityContext { securityContextEnabled: boolean; runAsUser: string; diff --git a/web-app/src/screens/Console/Tenants/utils.ts b/web-app/src/screens/Console/Tenants/utils.ts index 77d4a9cd30c..75efdea0e36 100644 --- a/web-app/src/screens/Console/Tenants/utils.ts +++ b/web-app/src/screens/Console/Tenants/utils.ts @@ -35,7 +35,3 @@ export const getRandomString = function (length = 16): string { } return retval; }; - -export const imagePattern = "^[a-zA-Z0-9-_./:]{1,253}$"; - -export const numericPattern = "[0-9]*"; diff --git a/web-app/src/types.ts b/web-app/src/types.ts index ac5d23669ce..93fe2f416c4 100644 --- a/web-app/src/types.ts +++ b/web-app/src/types.ts @@ -29,22 +29,6 @@ export interface SRInfoStateType { siteName: string; } -export interface SystemState { - loggedIn: boolean; - operatorMode: boolean; - sidebarOpen: boolean; - session: string; - userName: string; - serverNeedsRestart: boolean; - serverIsLoading: boolean; - loadingProgress: number; - snackBar: snackBarMessage; - modalSnackBar: snackBarMessage; - serverDiagnosticStatus: string; - distributedSetup: boolean; - siteReplicationInfo: SRInfoStateType; -} - export const USER_LOGGED = "USER_LOGGED"; export const OPERATOR_MODE = "OPERATOR_MODE"; export const MENU_OPEN = "MENU_OPEN"; @@ -129,19 +113,3 @@ interface SetLicenseInfo { type: typeof SET_LICENSE_INFO; licenseInfo: SubnetInfo; } - -export type SystemActionTypes = - | UserLoggedAction - | OperatorModeAction - | SetMenuOpenAction - | ServerNeedsRestartAction - | ServerIsLoading - | SetLoadingProgress - | SetServerDiagStat - | SetSnackBarMessage - | SetErrorSnackMessage - | SetModalSnackMessage - | SetModalErrorMessage - | SetDistributedSetup - | SetSiteReplicationInfo - | SetLicenseInfo; diff --git a/web-app/src/utils/sortFunctions.ts b/web-app/src/utils/sortFunctions.ts index e9c7f47c2a2..98193b55c4e 100644 --- a/web-app/src/utils/sortFunctions.ts +++ b/web-app/src/utils/sortFunctions.ts @@ -16,65 +16,6 @@ import { redirectRule } from "../screens/LoginPage/types"; -interface userInterface { - accessKey: string; -} - -interface policyInterface { - name: string; -} - -interface policyDetailsInterface { - policy: string; -} - -export const usersSort = (a: userInterface, b: userInterface) => { - if (a.accessKey > b.accessKey) { - return 1; - } - if (a.accessKey < b.accessKey) { - return -1; - } - // a must be equal to b - return 0; -}; - -export const policySort = (a: policyInterface, b: policyInterface) => { - if (a.name > b.name) { - return 1; - } - if (a.name < b.name) { - return -1; - } - // a must be equal to b - return 0; -}; - -export const stringSort = (a: string, b: string) => { - if (a > b) { - return 1; - } - if (a < b) { - return -1; - } - // a must be equal to b - return 0; -}; - -export const policyDetailsSort = ( - a: policyDetailsInterface, - b: policyDetailsInterface, -) => { - if (a.policy > b.policy) { - return 1; - } - if (a.policy < b.policy) { - return -1; - } - // a must be equal to b - return 0; -}; - export const redirectRules = (a: redirectRule, b: redirectRule) => { if (a.displayName > b.displayName) { return 1; diff --git a/web-app/yarn.lock b/web-app/yarn.lock index aa58aab9ab2..6ef106c97fe 100644 --- a/web-app/yarn.lock +++ b/web-app/yarn.lock @@ -2250,6 +2250,16 @@ resolved "https://registry.yarnpkg.com/@trysound/sax/-/sax-0.2.0.tgz#cccaab758af56761eb7bf37af6f03f326dd798ad" integrity sha512-L7z9BgrNEcYyUYtF+HaEfiS5ebkh9jXqbszz7pC0hRBPaatV0XjSD3+eHrpqFemQfgwiFF0QPIarnIihIDn7OA== +"@ts-morph/common@~0.12.3": + version "0.12.3" + resolved "https://registry.yarnpkg.com/@ts-morph/common/-/common-0.12.3.tgz#a96e250217cd30e480ab22ec6a0ebbe65fd784ff" + integrity sha512-4tUmeLyXJnJWvTFOKtcNJ1yh0a3SsTLi2MUoyj8iUNznFRN1ZquaNe7Oukqrnki2FzZkm0J9adCNLDZxUzvj+w== + dependencies: + fast-glob "^3.2.7" + minimatch "^3.0.4" + mkdirp "^1.0.4" + path-browserify "^1.0.1" + "@types/babel__core@^7.0.0", "@types/babel__core@^7.1.14": version "7.20.1" resolved "https://registry.yarnpkg.com/@types/babel__core/-/babel__core-7.20.1.tgz#916ecea274b0c776fec721e333e55762d3a9614b" @@ -3965,6 +3975,11 @@ coa@^2.0.2: chalk "^2.4.1" q "^1.1.2" +code-block-writer@^11.0.0: + version "11.0.3" + resolved "https://registry.yarnpkg.com/code-block-writer/-/code-block-writer-11.0.3.tgz#9eec2993edfb79bfae845fbc093758c0a0b73b76" + integrity sha512-NiujjUFB4SwScJq2bwbYUtXbZhBSlY6vYzm++3Q6oC+U+injTqfPYFK8wS9COOmb2lueqp0ZRB4nK1VYeHgNyw== + coffeescript@^2.3.1: version "2.7.0" resolved "https://registry.yarnpkg.com/coffeescript/-/coffeescript-2.7.0.tgz#a43ec03be6885d6d1454850ea70b9409c391279c" @@ -4046,6 +4061,11 @@ commander@^5.0.0: resolved "https://registry.yarnpkg.com/commander/-/commander-5.1.0.tgz#46abbd1652f8e059bddaef99bbdcb2ad9cf179ae" integrity sha512-P0CysNDQ7rtVw4QIQtm+MRxV66vKFSvlsQvGYXZWR3qFU0jlMKHZZZgw8e+8DSah4UDKMqnknRDQz+xuQXQ/Zg== +commander@^6.2.1: + version "6.2.1" + resolved "https://registry.yarnpkg.com/commander/-/commander-6.2.1.tgz#0792eb682dfbc325999bb2b84fddddba110ac73c" + integrity sha512-U7VdrJFnJgo4xjrHpTzu0yrHPGImdsmD95ZlgYSEajAn2JKzDhDTPG9kBTefmObL2w/ngeZnilk+OV9CG3d7UA== + commander@^7.2.0: version "7.2.0" resolved "https://registry.yarnpkg.com/commander/-/commander-7.2.0.tgz#a36cb57d0b501ce108e4d20559a150a391d97ab7" @@ -4188,7 +4208,7 @@ cosmiconfig@^6.0.0: path-type "^4.0.0" yaml "^1.7.2" -cosmiconfig@^7.0.0: +cosmiconfig@^7.0.0, cosmiconfig@^7.0.1: version "7.1.0" resolved "https://registry.yarnpkg.com/cosmiconfig/-/cosmiconfig-7.1.0.tgz#1443b9afa596b670082ea46cbd8f6a62b84635f6" integrity sha512-AdmX6xUzdNASswsFtmwSt7Vj8po9IuqXm0UXz7QKPuEUmPB4XyjGfaAr2PSuELMwkRMVH1EpIkX5bTZGRB3eCA== @@ -5509,6 +5529,17 @@ fast-glob@^3.0.3, fast-glob@^3.2.12, fast-glob@^3.2.9: merge2 "^1.3.0" micromatch "^4.0.4" +fast-glob@^3.2.7: + version "3.3.1" + resolved "https://registry.yarnpkg.com/fast-glob/-/fast-glob-3.3.1.tgz#784b4e897340f3dbbef17413b3f11acf03c874c4" + integrity sha512-kNFPyjhh5cKjrUltxs+wFx+ZkbRaxxmZ+X0ZU31SOsxCEtP9VPgtq2teZw1DebupL5GmDaNQ6yKMMVcM41iqDg== + dependencies: + "@nodelib/fs.stat" "^2.0.2" + "@nodelib/fs.walk" "^1.2.3" + glob-parent "^5.1.2" + merge2 "^1.3.0" + micromatch "^4.0.4" + fast-json-stable-stringify@^2.0.0, fast-json-stable-stringify@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz#874bf69c6f404c2b5d99c481341399fd55892633" @@ -5855,7 +5886,14 @@ getos@^3.2.1: dependencies: async "^3.2.0" -glob-parent@^5.1.2, glob-parent@^6.0.1, glob-parent@^6.0.2, glob-parent@~5.1.2: +glob-parent@^5.1.2: + version "5.1.2" + resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-5.1.2.tgz#869832c58034fe68a4093c17dc15e8340d8401c4" + integrity sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow== + dependencies: + is-glob "^4.0.1" + +glob-parent@^6.0.1, glob-parent@^6.0.2, glob-parent@~5.1.2: version "6.0.2" resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-6.0.2.tgz#6d237d99083950c79290f24c7642a3de9a28f9e3" integrity sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A== @@ -7461,7 +7499,7 @@ json-stable-stringify-without-jsonify@^1.0.1: resolved "https://registry.yarnpkg.com/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz#9db7b59496ad3f3cfef30a75142d2d930ad72651" integrity sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw== -json5@^1.0.2, json5@^2.1.1, json5@^2.1.2, json5@^2.2.0, json5@^2.2.2: +json5@^1.0.2, json5@^2.1.1, json5@^2.1.2, json5@^2.1.3, json5@^2.2.0, json5@^2.2.2: version "2.2.3" resolved "https://registry.yarnpkg.com/json5/-/json5-2.2.3.tgz#78cd6f1a19bdc12b73db5ad0c61efd66c1e29283" integrity sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg== @@ -7948,6 +7986,11 @@ mkdirp@^0.5.1, mkdirp@~0.5.1: dependencies: minimist "^1.2.6" +mkdirp@^1.0.4: + version "1.0.4" + resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-1.0.4.tgz#3eb5ed62622756d79a5f0e2a221dfebad75c2f7e" + integrity sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw== + moment-duration-format-commonjs@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/moment-duration-format-commonjs/-/moment-duration-format-commonjs-1.0.1.tgz#ca8776466dba736a30cb7cda4e07026b5aec8cf1" @@ -8366,6 +8409,11 @@ pascal-case@^3.1.2: no-case "^3.0.4" tslib "^2.0.3" +path-browserify@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/path-browserify/-/path-browserify-1.0.1.tgz#d98454a9c3753d5790860f16f68867b9e46be1fd" + integrity sha512-b7uo2UCUOYZcnF/3ID0lulOJi/bafxa1xPe7ZPsammBSpjSWQkjNxlt635YGS2MiR9GjvuXCtz2emr3jbsz98g== + path-exists@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/path-exists/-/path-exists-3.0.0.tgz#ce0ebeaa5f78cb18925ea7d810d7b59b010fd515" @@ -10999,6 +11047,11 @@ trough@^2.0.0: resolved "https://registry.yarnpkg.com/trough/-/trough-2.1.0.tgz#0f7b511a4fde65a46f18477ab38849b22c554876" integrity sha512-AqTiAOLcj85xS7vQ8QkAV41hPDIJ71XJB4RCUrzo/1GM2CQwhkJGaf9Hgr7BOugMRpgGUrqRg/DrBDl4H40+8g== +"true-myth@^4.1.0": + version "4.1.1" + resolved "https://registry.yarnpkg.com/true-myth/-/true-myth-4.1.1.tgz#ff4ac9d5130276e34aa338757e2416ec19248ba2" + integrity sha512-rqy30BSpxPznbbTcAcci90oZ1YR4DqvKcNXNerG5gQBU2v4jk0cygheiul5J6ExIMrgDVuanv/MkGfqZbKrNNg== + truncate-utf8-bytes@^1.0.0: version "1.0.2" resolved "https://registry.yarnpkg.com/truncate-utf8-bytes/-/truncate-utf8-bytes-1.0.2.tgz#405923909592d56f78a5818434b0b78489ca5f2b" @@ -11016,6 +11069,26 @@ ts-interface-checker@^0.1.9: resolved "https://registry.yarnpkg.com/ts-interface-checker/-/ts-interface-checker-0.1.13.tgz#784fd3d679722bc103b1b4b8030bcddb5db2a699" integrity sha512-Y/arvbn+rrz3JCKl9C4kVNfTfSm2/mEp5FSz5EsZSANGPSlQrpRI5M4PKF+mJnE52jOO90PnPSc3Ur3bTQw0gA== +ts-morph@^13.0.1: + version "13.0.3" + resolved "https://registry.yarnpkg.com/ts-morph/-/ts-morph-13.0.3.tgz#c0c51d1273ae2edb46d76f65161eb9d763444c1d" + integrity sha512-pSOfUMx8Ld/WUreoSzvMFQG5i9uEiWIsBYjpU9+TTASOeUa89j5HykomeqVULm1oqWtBdleI3KEFRLrlA3zGIw== + dependencies: + "@ts-morph/common" "~0.12.3" + code-block-writer "^11.0.0" + +ts-prune@^0.10.3: + version "0.10.3" + resolved "https://registry.yarnpkg.com/ts-prune/-/ts-prune-0.10.3.tgz#b6c71a525543b38dcf947a7d3adfb7f9e8b91f38" + integrity sha512-iS47YTbdIcvN8Nh/1BFyziyUqmjXz7GVzWu02RaZXqb+e/3Qe1B7IQ4860krOeCGUeJmterAlaM2FRH0Ue0hjw== + dependencies: + commander "^6.2.1" + cosmiconfig "^7.0.1" + json5 "^2.1.3" + lodash "^4.17.21" + "true-myth" "^4.1.0" + ts-morph "^13.0.1" + tsconfig-paths@^3.14.1: version "3.14.2" resolved "https://registry.yarnpkg.com/tsconfig-paths/-/tsconfig-paths-3.14.2.tgz#6e32f1f79412decd261f92d633a9dc1cfa99f088"