17782: Fixes almost all tests (4 left) mostly by fixing namespace-type imports.
[arvados-workbench2.git] / src / components / warning / warning.tsx
index bd3303616d7e41a9b7f618ec6742df558c8cc159..d459a37db004b7f09e193dbaf83627d4c3118fbc 100644 (file)
@@ -2,12 +2,12 @@
 //
 // SPDX-License-Identifier: AGPL-3.0
 
-import * as React from "react";
-import { ErrorIcon } from "~/components/icon/icon";
+import React from "react";
+import { ErrorIcon } from "components/icon/icon";
 import { Tooltip } from "@material-ui/core";
-import { disallowSlash } from "~/validators/valid-name";
+import { disallowSlash } from "validators/valid-name";
 import { connect } from "react-redux";
-import { RootState } from "~/store/store";
+import { RootState } from "store/store";
 
 interface WarningComponentProps {
     text: string;
@@ -16,11 +16,12 @@ interface WarningComponentProps {
 }
 
 export const WarningComponent = ({ text, rules, message }: WarningComponentProps) =>
-    rules.find(aRule => text.match(aRule) !== null)
-        ? message
-            ? <Tooltip title={message}><ErrorIcon /></Tooltip>
-            : <ErrorIcon />
-        : null;
+    !text ? <Tooltip title={"No name"}><ErrorIcon /></Tooltip>
+        : (rules.find(aRule => text.match(aRule) !== null)
+            ? message
+                ? <Tooltip title={message}><ErrorIcon /></Tooltip>
+                : <ErrorIcon />
+            : null);
 
 interface IllegalNamingWarningProps {
     name: string;