1 // Copyright (C) The Arvados Authors. All rights reserved.
3 // SPDX-License-Identifier: AGPL-3.0
5 import * as 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 rules.find(aRule => text.match(aRule) !== null)
21 ? <Tooltip title={message}><ErrorIcon /></Tooltip>
25 interface IllegalNamingWarningProps {
31 export const IllegalNamingWarning = connect(
32 (state: RootState) => {
34 validate: (state.auth.config.clusterConfig.Collections.ForwardSlashNameSubstitution === "" ?
37 })(({ name, validate }: IllegalNamingWarningProps) =>
39 text={name} rules={validate}
40 message="Names embedding '/' will be renamed or invisible to file system access (arv-mount or WebDAV)" />);