Allow user to configure kubectl binary preferences (#800)

Signed-off-by: Lauri Nevala <lauri.nevala@gmail.com>

Co-authored-by: Alex Andreev <alex.andreev.email@gmail.com>
This commit is contained in:
Lauri NevalaandAlex Andreev authored and GitHub committed 2020-09-04 22:50:50 +03:00
1 parent 8f94f4a3da
commit 4250523fe4
7 files changed
+185 -88

No files matched your search

@@ -2,6 +2,7 @@ import type { InputProps } from "./input";
import { ReactNode } from "react";
import { t } from "@lingui/macro";
import { _i18n } from '../../i18n';
import fse from "fs-extra";
export interface Validator {
debounce?: number; // debounce for async validators in ms
@@ -41,6 +42,12 @@ export const isUrl: Validator = {
validate: value => !!value.match(/^http(s)?:\/\/\w+(\.\w+)*(:[0-9]+)?\/?(\/[\w\-\._~:/?#[\]@!\$&'\(\)\*\+,;=.]*)*$/),
};
export const isPath: Validator = {
condition: ({ type }) => type === "text",
message: () => _i18n._(t`This field must be a path to an existing file`),
validate: value => !value || fse.pathExistsSync(value),
}
export const minLength: Validator = {
condition: ({ minLength }) => !!minLength,
message: (value, { minLength }) => _i18n._(t`Minimum length is ${minLength}`),