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 { invalidNamingRules } from "~/validators/valid-name";
8 import { Tooltip } from "@material-ui/core";
10 interface WarningComponentProps {
16 export const WarningComponent = ({ text, rules, message }: WarningComponentProps) =>
17 rules.find(aRule => text.match(aRule) !== null)
19 ? <Tooltip title={message}><ErrorIcon /></Tooltip>
23 interface IllegalNamingWarningProps {
27 export const IllegalNamingWarning = ({ name }: IllegalNamingWarningProps) =>
29 text={name} rules={invalidNamingRules}
30 message="Names being '.', '..' or including '/' cause issues with WebDAV, please edit it to something different." />;