Remove dead code and add job in CI to find it (#2882)

This commit is contained in:
Javier Adriel
2023-06-15 10:24:24 -06:00
committed by GitHub
parent cbd2c4682d
commit b76f460979
27 changed files with 74 additions and 1468 deletions

View File

@@ -120,6 +120,11 @@ jobs:
continue-on-error: false
run: |
./check-prettier.sh
- name: Check for dead code
working-directory: ./portal-ui
continue-on-error: false
run: |
./check-deadcode.sh
reuse-golang-dependencies:
name: reuse golang dependencies
runs-on: ubuntu-latest

8
portal-ui/check-deadcode.sh Executable file
View File

@@ -0,0 +1,8 @@
#!/bin/bash
if [ -f "$NVM_DIR/nvm.sh" ]
then
\. "$NVM_DIR/nvm.sh";
nvm use;
fi
yarn find-deadcode

View File

@@ -45,7 +45,8 @@
"buildistanbulcoverage": "PORT=9090 USE_BABEL_PLUGIN_ISTANBUL=1 react-app-rewired build",
"test": "react-scripts test",
"eject": "react-scripts eject",
"playwright": "PORT=5005 USE_BABEL_PLUGIN_ISTANBUL=1 react-app-rewired start"
"playwright": "PORT=5005 USE_BABEL_PLUGIN_ISTANBUL=1 react-app-rewired start",
"find-deadcode": "ts-prune -s consoleApi.ts | (! grep -v 'used in module')"
},
"eslintConfig": {
"extends": "react-app",
@@ -93,6 +94,7 @@
"react-app-rewired": "^2.2.1",
"react-scripts": "5.0.1",
"testcafe": "^2.6.2",
"ts-prune": "^0.10.3",
"typescript": "^4.4.3"
},
"resolutions": {

View File

@@ -34,7 +34,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;
@@ -54,18 +53,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;";
};
@@ -86,13 +73,6 @@ export const timeFromDate = (d: Date) => {
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
@@ -137,12 +117,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,
@@ -518,189 +492,6 @@ export const getClientOS = (): string => {
return getPlatform;
};
export const MinIOEnvVarsSettings: any = {
MINIO_ACCESS_KEY: { secret: true },
MINIO_ACCESS_KEY_OLD: { secret: true },
MINIO_AUDIT_WEBHOOK_AUTH_TOKEN: { secret: true },
MINIO_IDENTITY_LDAP_LOOKUP_BIND_PASSWORD: { secret: true },
MINIO_IDENTITY_OPENID_CLIENT_SECRET: { secret: true },
MINIO_KMS_SECRET_KEY: { secret: true },
MINIO_LOGGER_WEBHOOK_AUTH_TOKEN: { secret: true },
MINIO_NOTIFY_ELASTICSEARCH_PASSWORD: { secret: true },
MINIO_NOTIFY_KAFKA_SASL_PASSWORD: { secret: true },
MINIO_NOTIFY_MQTT_PASSWORD: { secret: true },
MINIO_NOTIFY_NATS_PASSWORD: { secret: true },
MINIO_NOTIFY_NATS_TOKEN: { secret: true },
MINIO_NOTIFY_REDIS_PASSWORD: { secret: true },
MINIO_NOTIFY_WEBHOOK_AUTH_TOKEN: { secret: true },
MINIO_ROOT_PASSWORD: { secret: true },
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_REDIRECT_URI",
"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",
];
// Generates a valid access/secret key string
export const getRandomString = function (length = 16): string {
let retval = "";

View File

@@ -1,83 +0,0 @@
// This file is part of MinIO Console Server
// 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 <http://www.gnu.org/licenses/>.
import React from "react";
import { Button } from "@mui/material";
import { Theme } from "@mui/material/styles";
import createStyles from "@mui/styles/createStyles";
import withStyles from "@mui/styles/withStyles";
import clsx from "clsx";
type ObjectActionButtonProps = {
disabled?: boolean;
onClick: () => void | any;
icon: React.ReactNode;
label: string;
[x: string]: any;
};
const styles = (theme: Theme) =>
createStyles({
root: {
padding: "0 15px",
height: 22,
margin: 0,
color: "#5E5E5E",
fontWeight: "normal",
fontSize: 14,
whiteSpace: "nowrap",
width: "100%",
justifyContent: "flex-start",
"&:hover": {
backgroundColor: "transparent",
color: "#000",
},
"& .min-icon": {
width: 11,
},
"&:disabled": {
color: "#EBEBEB",
borderColor: "#EBEBEB",
},
},
});
// TODO: Create an mds version of this.
const ObjectActionButton = ({
disabled,
onClick,
icon,
label,
classes,
...restProps
}: ObjectActionButtonProps) => {
return (
<Button
{...restProps}
disabled={disabled}
onClick={onClick}
className={clsx(classes.root, "noDefaultHeight")}
startIcon={icon}
sx={{
height: "initial",
}}
>
<span className={"buttonItem"}>{label}</span>
</Button>
);
};
export default withStyles(styles)(ObjectActionButton);

View File

@@ -27,11 +27,6 @@ export interface BucketObjectItem {
is_latest?: boolean;
}
export interface BucketObjectItemsList {
objects: BucketObjectItem[];
total?: number;
}
export interface WebsocketRequest {
mode: "objects" | "rewind" | "close" | "cancel";
bucket_name?: string;

View File

@@ -28,12 +28,6 @@ export interface IFileInfo {
is_delete_marker?: boolean;
user_metadata?: object;
}
export interface FileInfoResponse {
objects: IFileInfo[];
total: number;
}
export interface MetadataResponse {
objectMetadata: object;
}

View File

@@ -19,22 +19,6 @@ export interface BucketEncryptionInfo {
kmsMasterKeyID: string;
}
export interface Details {
tags?: object;
locking?: boolean;
quota?: object;
versioning?: boolean;
}
export interface BucketInfo {
name: string;
access: string;
definition: string;
creation_date?: string;
objects?: number;
size?: number;
}
export interface BucketEvent {
id: string;
arn: string;
@@ -47,11 +31,6 @@ export interface BucketEventList {
events: BucketEvent[];
total: number;
}
export interface ArnList {
arns: string[];
}
export interface BucketVersioningInfo {
excludeFolders?: boolean;
excludedPrefixes?: Record<"Prefix", string>[];

View File

@@ -101,13 +101,6 @@ export const tooltipHelper = {
},
};
export const helpMarkdown = {
markdown: {
whiteSpace: "pre-wrap",
display: "block",
},
};
const checkBoxBasic = {
width: 16,
height: 16,

View File

@@ -1,27 +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 <http://www.gnu.org/licenses/>.
import styled from "@emotion/styled";
const FormHr = styled("hr")`
border-top: 0;
border-left: 0;
border-right: 0;
border-color: #999999;
background-color: transparent;
`;
export default FormHr;

View File

@@ -1,22 +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 <http://www.gnu.org/licenses/>.
import styled from "@emotion/styled";
const H3Section = styled("h3")`
margin: 0px;
`;
export default H3Section;

View File

@@ -1,31 +0,0 @@
// This file is part of MinIO Console Server
// 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 <http://www.gnu.org/licenses/>.
import React from "react";
type Props = {
children: string;
};
const SectionH1: React.FC<Props> = ({ children }) => {
return (
<h1 style={{ margin: 0, marginBottom: ".8rem", fontSize: "1.3rem" }}>
{children}
</h1>
);
};
export default SectionH1;

View File

@@ -1,66 +0,0 @@
// This file is part of MinIO Console Server
// 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 <http://www.gnu.org/licenses/>.
import React from "react";
export interface ISizeBarItem {
value: number;
itemName: string;
color: string;
}
export interface IUsageBar {
totalValue: number;
sizeItems: ISizeBarItem[];
bgColor?: string;
}
const UsageBar = ({
totalValue,
sizeItems,
bgColor = "#ededed",
}: IUsageBar) => {
return (
<div
style={{
width: "100%",
height: 12,
backgroundColor: bgColor,
borderRadius: 30,
display: "flex",
transitionDuration: "0.3s",
overflow: "hidden",
}}
>
{sizeItems.map((sizeElement, index) => {
const itemPercentage = (sizeElement.value * 100) / totalValue;
return (
<div
key={`itemSize-${index.toString()}`}
style={{
width: `${itemPercentage}%`,
height: "100%",
backgroundColor: sizeElement.color,
transitionDuration: "0.3s",
}}
/>
);
})}
</div>
);
};
export default UsageBar;

View File

@@ -82,12 +82,6 @@ export interface ITierResponse {
items: ITierElement[];
}
export interface ITierUpdateCreds {
access_key: string;
secret_key: string;
creds: string;
}
export interface RegionEntry {
label: string;
value: string;

View File

@@ -531,17 +531,6 @@ const constructLabelNames = (metrics: any, legendFormat: string) => {
return cleanLegend;
};
export const getWidgetsWithValue = (payload: any[]): IDashboardPanel[] => {
return panelsConfiguration.map((panelItem: IDashboardPanel) => {
const payloadData = payload.find(
(panelT) =>
panelT.title.toLowerCase().trim() ===
panelItem.title.toLowerCase().trim()
);
return widgetDetailsToPanel(payloadData, panelItem);
});
};
export const widgetDetailsToPanel = (
payloadData: any,
panelItem: IDashboardPanel

View File

@@ -14,12 +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 NotificationEndpoint {
service: string;
account_id: string;
properties: Map<string, string>;
}
export interface NotificationEndpointItem {
service: string;
account_id: string;

View File

@@ -14,16 +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 Group {
name: string;
id: string;
email: string;
is_me: boolean;
enabled: boolean;
accessKey: string;
secretKey: string;
}
export interface GroupsList {
groups: string[];
total: number;

View File

@@ -14,12 +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 LDAPEntitiesRequest {
users?: string[];
groups?: string[];
policies?: string[];
}
export interface LDAPEntitiesResponse {
timestamp: string;
users?: LDAPUsersResponse[];

View File

@@ -1,264 +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 React, { Suspense, useCallback } from "react";
import {
Collapse,
ListItem,
ListItemIcon,
ListItemText,
Tooltip,
} from "@mui/material";
import {
menuItemContainerStyles,
menuItemIconStyles,
menuItemMiniStyles,
menuItemStyle,
menuItemTextStyles,
} from "./MenuStyleUtils";
import List from "@mui/material/List";
import { MenuCollapsedIcon, MenuExpandedIcon } from "mds";
import { hasPermission } from "../../../common/SecureComponent";
import {
CONSOLE_UI_RESOURCE,
IAM_PAGES_PERMISSIONS,
} from "../../../common/SecureComponent/permissions";
const MenuItem = ({
page,
stateClsName = "",
onExpand,
selectedMenuItem,
pathValue = "",
expandedGroup = "",
setSelectedMenuItem,
id = `${Math.random()}`,
setPreviewMenuGroup,
previewMenuGroup,
displayImage = false,
}: {
page: any;
stateClsName?: string;
setSelectedMenuItem: (value: string) => void;
selectedMenuItem?: any;
pathValue?: string;
onExpand: (id: any) => void;
expandedGroup?: string;
id?: string;
setPreviewMenuGroup: (value: string) => void;
previewMenuGroup: string;
displayImage?: boolean;
}) => {
const childrenMenuList = page?.children?.filter(
(item: any) =>
((item.customPermissionFnc
? item.customPermissionFnc()
: hasPermission(CONSOLE_UI_RESOURCE, IAM_PAGES_PERMISSIONS[item.to])) ||
item.forceDisplay) &&
!item.fsHidden
);
let hasChildren = childrenMenuList?.length;
const expandCollapseHandler = useCallback(
(e: any) => {
e.preventDefault();
if (previewMenuGroup === page.id) {
setPreviewMenuGroup("");
} else if (page.id !== selectedMenuItem) {
setPreviewMenuGroup(page.id);
onExpand("");
}
if (page.id === selectedMenuItem && selectedMenuItem === expandedGroup) {
onExpand(null);
} else if (page.id === selectedMenuItem) {
onExpand(selectedMenuItem);
setPreviewMenuGroup("");
}
},
// eslint-disable-next-line react-hooks/exhaustive-deps
[page, selectedMenuItem, previewMenuGroup, expandedGroup]
);
const selectMenuHandler = useCallback(
(e: any) => {
onExpand(page.id);
setSelectedMenuItem(page.id);
page.onClick && page.onClick(e);
},
// eslint-disable-next-line react-hooks/exhaustive-deps
[page]
);
const onClickHandler = hasChildren
? expandCollapseHandler
: selectMenuHandler;
const isActiveGroup = expandedGroup === page.id;
const activeClsName =
pathValue.includes(selectedMenuItem) && page.id === selectedMenuItem
? "active"
: "";
return (
<React.Fragment>
<ListItem
key={page.to}
button
onClick={(e: any) => {
onClickHandler(e);
setSelectedMenuItem(selectedMenuItem);
}}
component={page.component}
to={page.to}
id={id}
className={`${activeClsName} ${stateClsName} main-menu-item `}
disableRipple
sx={{
...menuItemContainerStyles,
marginTop: "5px",
...menuItemMiniStyles,
"& .expanded-icon": {
border: "1px solid #35393c",
},
}}
>
{page.icon && (
<Tooltip title={`${page.name}`} placement="right">
<ListItemIcon
sx={{ ...menuItemIconStyles }}
className={`${
isActiveGroup && hasChildren ? "expanded-icon" : ""
}`}
>
<Suspense fallback={<div>...</div>}>
<page.icon />
</Suspense>
</ListItemIcon>
</Tooltip>
)}
{page.name && (
<ListItemText
className={stateClsName}
sx={{ ...menuItemTextStyles }}
primary={page.name}
secondary={page.badge ? <page.badge /> : null}
/>
)}
{hasChildren ? (
isActiveGroup || previewMenuGroup === page.id ? (
<MenuExpandedIcon
height={15}
width={15}
className="group-icon"
style={{ color: "#8399AB" }}
/>
) : (
<MenuCollapsedIcon
height={15}
width={15}
className="group-icon"
style={{ color: "#8399AB" }}
/>
)
) : null}
</ListItem>
{(isActiveGroup || previewMenuGroup === page.id) && hasChildren ? (
<Collapse
key={page.id}
id={`${page.id}-children`}
in={true}
timeout="auto"
unmountOnExit
>
<List
component="div"
disablePadding
key={page.id}
sx={{
marginLeft: "15px",
"&.mini": {
marginLeft: "0px",
},
}}
className={`${stateClsName}`}
>
{childrenMenuList.map((item: any) => {
return (
<ListItem
key={item.to}
button
component={item.component}
to={item.to}
onClick={(e: any) => {
if (page.id) {
setPreviewMenuGroup("");
setSelectedMenuItem(page.id);
}
}}
disableRipple
sx={{
...menuItemStyle,
...menuItemMiniStyles,
}}
className={`${stateClsName}`}
>
{item.icon && (
<Tooltip title={`${item.name}`} placement="right">
<ListItemIcon
sx={{
background: "#00274D",
display: "flex",
alignItems: "center",
justifyContent: "center",
"& svg": {
fill: "#fff",
minWidth: "12px",
maxWidth: "12px",
},
}}
className="menu-icon"
>
<Suspense fallback={<div>...</div>}>
<item.icon />
</Suspense>
{item.badge ? <item.badge /> : null}
</ListItemIcon>
</Tooltip>
)}
{item.name && (
<ListItemText
className={stateClsName}
sx={{ ...menuItemTextStyles, marginLeft: "16px" }}
primary={item.name}
/>
)}
</ListItem>
);
})}
</List>
</Collapse>
) : null}
</React.Fragment>
);
};
export default MenuItem;

View File

@@ -1,42 +0,0 @@
// This file is part of MinIO Console Server
// 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 <http://www.gnu.org/licenses/>.
import React from "react";
interface IMenuSectionHeader {
label: string;
}
const MenuSectionHeader = ({ label }: IMenuSectionHeader) => {
return (
<div
style={{
fontSize: 15,
color: "#b3c9d9",
marginTop: 20,
marginBottom: 10,
borderBottom: "#0F446C 1px solid",
marginRight: 25,
paddingBottom: 5,
}}
className={"menuHeader"}
>
{label}
</div>
);
};
export default MenuSectionHeader;

View File

@@ -1,178 +0,0 @@
// This file is part of MinIO Console Server
// 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 <http://www.gnu.org/licenses/>.
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",
},
},
},
};

View File

@@ -1,157 +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 React, { Fragment, Suspense } from "react";
import { ApplicationLogo, VersionIcon } from "mds";
import { Box, IconButton } from "@mui/material";
import MenuIcon from "@mui/icons-material/Menu";
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";
let logoPlan = getLogoVar();
return (
<Box
className={`${stateClsName}`}
sx={{
width: "100%",
cursor: "pointer",
"&::after": {
height: "1px",
display: "block",
content: "' '",
backgroundColor: "#0F446C",
margin: "0px auto",
},
"&.wide:hover": {
background:
"transparent linear-gradient(270deg, #00000000 0%, #051d39 53%, #54545400 100%) 0% 0% no-repeat padding-box",
},
}}
onClick={() => {
if (isOpen) {
onToggle(false);
}
}}
>
<Box
className={`${stateClsName}`}
sx={{
marginLeft: "26px",
marginRight: "8px",
display: "flex",
alignItems: "center",
height: "82px",
"&.mini": {
flexFlow: "column",
display: "flex",
justifyContent: "center",
gap: "3px",
alignItems: "center",
marginLeft: "auto",
marginRight: "auto",
},
"& .logo": {
background: "transparent",
width: "180px",
display: "flex",
alignItems: "center",
justifyContent: "center",
"&.wide": {
flex: "1",
"& svg": {
width: "100%",
maxWidth: 180,
fill: "white",
},
},
"&.mini": {
color: "#ffffff",
"& svg": {
width: 24,
fill: "rgba(255, 255, 255, 0.8)",
},
},
},
}}
>
{isOpen ? (
<TooltipWrapper
tooltip={"Click to Collapse Menu"}
placement={"right"}
>
<div className={`logo ${stateClsName}`}>
<Fragment>
<ApplicationLogo
applicationName={"console"}
subVariant={logoPlan}
inverse
/>
</Fragment>
</div>
</TooltipWrapper>
) : (
<div className={`logo ${stateClsName}`}>
<Suspense fallback={<div>...</div>}>
<VersionIcon />
</Suspense>
</div>
)}
{!isOpen && (
<IconButton
className={`${stateClsName}`}
sx={{
height: "30px",
width: "30px",
"&.mini": {
"&:hover": {
background: "#081C42",
},
},
"&:hover": {
borderRadius: "50%",
background: "#073052",
},
"& svg": {
fill: "#ffffff",
height: "18px",
width: "18px",
},
}}
onClick={() => {
onToggle(true);
}}
size="small"
>
<MenuIcon />
</IconButton>
)}
</Box>
</Box>
);
};
export default MenuToggle;

View File

@@ -20,47 +20,6 @@ import {
GetBucketRetentionConfig,
} from "api/consoleApi";
export const REWIND_SET_ENABLE = "REWIND/SET_ENABLE";
export const REWIND_RESET_REWIND = "REWIND/RESET_REWIND";
export const OBJECT_MANAGER_SET_LOADING = "OBJECT_MANAGER/SET_LOADING";
export const OBJECT_MANAGER_NEW_OBJECT = "OBJECT_MANAGER/NEW_OBJECT";
export const OBJECT_MANAGER_UPDATE_PROGRESS_OBJECT =
"OBJECT_MANAGER/UPDATE_PROGRESS_OBJECT";
export const OBJECT_MANAGER_COMPLETE_OBJECT = "OBJECT_MANAGER/COMPLETE_OBJECT";
export const OBJECT_MANAGER_ERROR_IN_OBJECT = "OBJECT_MANAGER/ERROR_IN_OBJECT";
export const OBJECT_MANAGER_DELETE_FROM_OBJECT_LIST =
"OBJECT_MANAGER/DELETE_FROM_OBJECT_LIST";
export const OBJECT_MANAGER_CLEAN_LIST = "OBJECT_MANAGER/CLEAN_LIST";
export const OBJECT_MANAGER_TOGGLE_LIST = "OBJECT_MANAGER/TOGGLE_LIST";
export const OBJECT_MANAGER_OPEN_LIST = "OBJECT_MANAGER/OPEN_LIST";
export const OBJECT_MANAGER_CLOSE_LIST = "OBJECT_MANAGER/CLOSE_LIST";
export const OBJECT_MANAGER_SET_SEARCH_OBJECT =
"OBJECT_MANAGER/SET_SEARCH_OBJECT";
export const OBJECT_MANAGER_CANCEL_OBJECT = "OBJECT_MANAGER/CANCEL_OBJECT";
export const BUCKET_BROWSER_VERSIONS_MODE_ENABLED =
"BUCKET_BROWSER/VERSIONS_MODE_ENABLED";
export const BUCKET_BROWSER_VERSIONS_SET_SEARCH =
"BUCKET_BROWSER/VERSIONS_SET_SEARCH";
export const BUCKET_BROWSER_SET_SELECTED_VERSION =
"BUCKET_BROWSER/SET_SELECTED_VERSION";
export const BUCKET_BROWSER_SHOW_DELETED = "BUCKET_BROWSER/SHOW_DELETED";
export const BUCKET_BROWSER_LOAD_VERSIONS = "BUCKET_BROWSER/LOAD_VERSIONS";
export const BUCKET_BROWSER_LOAD_OBJECT_DETAILS =
"BUCKET_BROWSER/LOAD_OBJECT_DETAILS";
export const BUCKET_BROWSER_OBJECT_DETAILS_STATE =
"BUCKET_BROWSER/OBJECT_DETAILS_STATE";
export const BUCKET_BROWSER_SET_SELECTED_OBJECT =
"BUCKET_BROWSER/SET_SELECTED_OBJECT";
export const BUCKET_BROWSER_SET_SIMPLE_PATH = "BUCKET_BROWSER/SET_SIMPLE_PATH";
export interface Route {
route: string;
label: string;
type: string;
}
export interface RewindItem {
rewindEnabled: boolean;
bucketToRewind: string;
@@ -123,143 +82,3 @@ export interface IFileItem {
cancelled: boolean;
errorMessage: string;
}
interface RewindSetEnabled {
type: typeof REWIND_SET_ENABLE;
bucket: string;
state: boolean;
dateRewind: any;
}
interface RewindReset {
type: typeof REWIND_RESET_REWIND;
}
interface VersionsModeEnabled {
type: typeof BUCKET_BROWSER_VERSIONS_MODE_ENABLED;
status: boolean;
objectName: string;
}
interface OMNewObject {
type: typeof OBJECT_MANAGER_NEW_OBJECT;
newObject: IFileItem;
}
interface OMUpdateProgress {
type: typeof OBJECT_MANAGER_UPDATE_PROGRESS_OBJECT;
instanceID: string;
progress: number;
}
interface OMCompleteObject {
type: typeof OBJECT_MANAGER_COMPLETE_OBJECT;
instanceID: string;
}
interface OMDeleteFromList {
type: typeof OBJECT_MANAGER_DELETE_FROM_OBJECT_LIST;
instanceID: string;
}
interface OMCleanList {
type: typeof OBJECT_MANAGER_CLEAN_LIST;
}
interface OMToggleList {
type: typeof OBJECT_MANAGER_TOGGLE_LIST;
}
interface OMOpenList {
type: typeof OBJECT_MANAGER_OPEN_LIST;
}
interface OMCloseList {
type: typeof OBJECT_MANAGER_CLOSE_LIST;
}
interface OMSetObjectError {
type: typeof OBJECT_MANAGER_ERROR_IN_OBJECT;
status: boolean;
instanceID: string;
}
interface SetSearchObjects {
type: typeof OBJECT_MANAGER_SET_SEARCH_OBJECT;
searchString: string;
}
interface SetSearchVersions {
type: typeof BUCKET_BROWSER_VERSIONS_SET_SEARCH;
searchString: string;
}
interface SetSelectedversion {
type: typeof BUCKET_BROWSER_SET_SELECTED_VERSION;
selectedVersion: string;
}
interface SetShowDeletedObjects {
type: typeof BUCKET_BROWSER_SHOW_DELETED;
status: boolean;
}
interface SetLoadingVersions {
type: typeof BUCKET_BROWSER_LOAD_VERSIONS;
status: boolean;
}
interface SetLoadingObjectInfo {
type: typeof BUCKET_BROWSER_LOAD_OBJECT_DETAILS;
status: boolean;
}
interface SetObjectDetailsState {
type: typeof BUCKET_BROWSER_OBJECT_DETAILS_STATE;
status: boolean;
}
interface SetSelectedObject {
type: typeof BUCKET_BROWSER_SET_SELECTED_OBJECT;
object: string | null;
}
interface SetObjectManagerLoading {
type: typeof OBJECT_MANAGER_SET_LOADING;
status: boolean;
}
interface CancelObjectInManager {
type: typeof OBJECT_MANAGER_CANCEL_OBJECT;
instanceID: string;
}
interface SetBrowserPath {
type: typeof BUCKET_BROWSER_SET_SIMPLE_PATH;
path: string;
}
export type ObjectBrowserActionTypes =
| RewindSetEnabled
| RewindReset
| VersionsModeEnabled
| OMNewObject
| OMUpdateProgress
| OMCompleteObject
| OMDeleteFromList
| OMCleanList
| OMToggleList
| OMOpenList
| OMCloseList
| OMSetObjectError
| SetSearchObjects
| SetSearchVersions
| SetSelectedversion
| SetShowDeletedObjects
| SetLoadingVersions
| SetLoadingObjectInfo
| SetObjectDetailsState
| SetSelectedObject
| SetObjectManagerLoading
| CancelObjectInManager
| SetBrowserPath;

View File

@@ -1,68 +0,0 @@
// This file is part of MinIO Console Server
// 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 <http://www.gnu.org/licenses/>.
import makeStyles from "@mui/styles/makeStyles";
import { Theme } from "@mui/material/styles";
import createStyles from "@mui/styles/createStyles";
import { TextFieldProps } from "@mui/material";
import TextField from "@mui/material/TextField";
import React from "react";
const inputStyles = makeStyles((theme: Theme) =>
createStyles({
root: {
"& .MuiOutlinedInput-root": {
paddingLeft: 0,
"& svg": {
marginLeft: 4,
height: 14,
color: theme.palette.primary.main,
},
"& input": {
padding: 10,
fontSize: 14,
paddingLeft: 0,
"&::placeholder": {
fontSize: 12,
},
"@media (max-width: 900px)": {
padding: 10,
},
},
"& fieldset": {},
"& fieldset:hover": {
borderBottom: "2px solid #000000",
borderRadius: 0,
},
},
},
})
);
export const LoginField = (props: TextFieldProps) => {
const classes = inputStyles();
return (
<TextField
classes={{
root: classes.root,
}}
variant="standard"
{...props}
/>
);
};

View File

@@ -14,62 +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 IValidation {
fieldKey: string;
required: boolean;
pattern?: RegExp;
customPatternMessage?: string;
customValidation?: boolean; // The validation to trigger the error
customValidationMessage?: string;
value: string;
}
export const commonFormValidation = (fieldsValidate: IValidation[]) => {
let returnErrors: any = {};
fieldsValidate.forEach((field) => {
if (
field.required &&
typeof field.value !== "undefined" &&
field.value.trim &&
field.value.trim() === ""
) {
returnErrors[field.fieldKey] = "Field cannot be empty";
return;
}
// if it's not required and the value is empty, we are done here
if (
!field.required &&
typeof field.value !== "undefined" &&
field.value.trim &&
field.value.trim() === ""
) {
return;
}
if (field.customValidation && field.customValidationMessage) {
returnErrors[field.fieldKey] = field.customValidationMessage;
return;
}
if (field.pattern && field.customPatternMessage) {
const rgx = new RegExp(field.pattern, "g");
if (
field.value &&
field.value.trim() !== "" &&
!field.value.match(rgx) &&
typeof field.value !== "undefined"
) {
returnErrors[field.fieldKey] = field.customPatternMessage;
}
return;
}
});
return returnErrors;
};
export const isVersionedMode = (status: string | undefined) => {
return status === "Enabled" || status === "Suspended";
};

View File

@@ -15,8 +15,6 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>.
// Close codes for websockets defined in RFC 6455
export const WSCloseNormalClosure = 1000;
export const WSCloseCloseGoingAway = 1001;
export const WSCloseAbnormalClosure = 1006;
export const WSClosePolicyViolation = 1008;
export const WSCloseInternalServerErr = 1011;

View File

@@ -2246,6 +2246,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"
@@ -4094,6 +4104,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"
@@ -4175,6 +4190,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"
@@ -4317,7 +4337,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==
@@ -5748,7 +5768,7 @@ fast-equals@^5.0.0:
resolved "https://registry.yarnpkg.com/fast-equals/-/fast-equals-5.0.1.tgz#a4eefe3c5d1c0d021aeed0bc10ba5e0c12ee405d"
integrity sha512-WF1Wi8PwwSY7/6Kx0vKXtw8RwuSGoM1bvDaJbu7MxDlR1vovZjIAKrnzyrThgAjm6JDTu0fVgWXDlMGspodfoQ==
fast-glob@^3.0.3, fast-glob@^3.2.12, fast-glob@^3.2.9:
fast-glob@^3.0.3, fast-glob@^3.2.12, fast-glob@^3.2.7, fast-glob@^3.2.9:
version "3.2.12"
resolved "https://registry.yarnpkg.com/fast-glob/-/fast-glob-3.2.12.tgz#7f39ec99c2e6ab030337142da9e0c18f37afae80"
integrity sha512-DVj4CQIYYow0BlaelwK1pHl5n5cRSJfM60UA0zK891sVInoPri2Ekj7+e1CT3/3qxXenpI+nBBmQAcJPJgaj4w==
@@ -7846,7 +7866,7 @@ json-stream@^1.0.0:
resolved "https://registry.yarnpkg.com/json-stream/-/json-stream-1.0.0.tgz#1a3854e28d2bbeeab31cc7ddf683d2ddc5652708"
integrity sha512-H/ZGY0nIAg3QcOwE1QN/rK/Fa7gJn7Ii5obwp6zyPO4xiPNwpIMjqy2gwjBEGqzkF/vSWEIBQCBuN19hYiL6Qg==
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==
@@ -8624,6 +8644,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"
@@ -9115,6 +9140,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"
@@ -11932,6 +11962,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"
@@ -11949,6 +11984,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"