X-Git-Url: https://git.arvados.org/arvados-workbench2.git/blobdiff_plain/435d259b65ca110065a96581c1d568fb3ddd205d..631d2a3780d7d6ae292dc4e5b8a277880e1ef2ca:/src/components/warning/warning.tsx
diff --git a/src/components/warning/warning.tsx b/src/components/warning/warning.tsx
index 9a49ff0f..bd330361 100644
--- a/src/components/warning/warning.tsx
+++ b/src/components/warning/warning.tsx
@@ -4,8 +4,10 @@
import * as React from "react";
import { ErrorIcon } from "~/components/icon/icon";
-import { invalidNamingRules } from "~/validators/valid-name";
import { Tooltip } from "@material-ui/core";
+import { disallowSlash } from "~/validators/valid-name";
+import { connect } from "react-redux";
+import { RootState } from "~/store/store";
interface WarningComponentProps {
text: string;
@@ -15,16 +17,24 @@ interface WarningComponentProps {
export const WarningComponent = ({ text, rules, message }: WarningComponentProps) =>
rules.find(aRule => text.match(aRule) !== null)
- ? message
- ?
- :
- : null;
+ ? message
+ ?
+ :
+ : null;
interface IllegalNamingWarningProps {
name: string;
+ validate: RegExp[];
}
-export const IllegalNamingWarning = ({ name }: IllegalNamingWarningProps) =>
- ;
\ No newline at end of file
+
+export const IllegalNamingWarning = connect(
+ (state: RootState) => {
+ return {
+ validate: (state.auth.config.clusterConfig.Collections.ForwardSlashNameSubstitution === "" ?
+ [disallowSlash] : [])
+ };
+ })(({ name, validate }: IllegalNamingWarningProps) =>
+ );