1 // Copyright (C) The Arvados Authors. All rights reserved.
3 // SPDX-License-Identifier: AGPL-3.0
5 import React from "react";
6 import { ErrorIcon } from "components/icon/icon";
7 import { Tooltip } from "@material-ui/core";
8 import { disallowSlash } from "validators/valid-name";
9 import { connect } from "react-redux";
10 import { RootState } from "store/store";
12 interface WarningComponentProps {
18 export const WarningComponent = ({ text, rules, message }: WarningComponentProps) =>
19 !text ? <Tooltip title={"No name"}><ErrorIcon /></Tooltip>
20 : (rules.find(aRule => text.match(aRule) !== null)
22 ? <Tooltip title={message}><ErrorIcon /></Tooltip>
26 interface IllegalNamingWarningProps {
32 export const IllegalNamingWarning = connect(
33 (state: RootState) => {
35 validate: (state.auth.config.clusterConfig.Collections.ForwardSlashNameSubstitution === "" ?
38 })(({ name, validate }: IllegalNamingWarningProps) =>
40 text={name} rules={validate}
41 message="Names embedding '/' will be renamed or invisible to file system access (arv-mount or WebDAV)" />);