Various fixes for Tenant details page (#2181)
- fixed refresh tenant details page after changing Domains and updating image - Relax tenant domains to allow including port number Signed-off-by: Lenin Alevski <alevsk.8772@gmail.com>
This commit is contained in:
@@ -181,8 +181,7 @@ const Configure = ({ classes }: IConfigureProps) => {
|
|||||||
fieldKey: `minio-domain-${index.toString()}`,
|
fieldKey: `minio-domain-${index.toString()}`,
|
||||||
required: false,
|
required: false,
|
||||||
value: validation,
|
value: validation,
|
||||||
pattern:
|
pattern: /^(https?):\/\/([a-zA-Z0-9\-.]+)(:[0-9]+)?$/,
|
||||||
/((http|https):\/\/)+[a-zA-Z0-9\-.]{3,}\.[a-zA-Z]{2,}(\.[a-zA-Z]{2,})?$/,
|
|
||||||
customPatternMessage:
|
customPatternMessage:
|
||||||
"MinIO domain is not in the form of http|https://subdomain.domain",
|
"MinIO domain is not in the form of http|https://subdomain.domain",
|
||||||
};
|
};
|
||||||
@@ -196,7 +195,7 @@ const Configure = ({ classes }: IConfigureProps) => {
|
|||||||
required: false,
|
required: false,
|
||||||
value: consoleDomain,
|
value: consoleDomain,
|
||||||
pattern:
|
pattern:
|
||||||
/((http|https):\/\/)+[a-zA-Z0-9\-.]{3,}\.[a-zA-Z]{2,}(\.[a-zA-Z]{2,})?(:[1-9]{1}([0-9]{1,4})?)?(\/[a-zA-Z0-9]{1,})*?$/,
|
/^(https?):\/\/([a-zA-Z0-9\-.]+)(:[0-9]+)?(\/[a-zA-Z0-9\-./]*)?$/,
|
||||||
customPatternMessage:
|
customPatternMessage:
|
||||||
"Console domain is not in the form of http|https://subdomain.domain:port/subpath1/subpath2",
|
"Console domain is not in the form of http|https://subdomain.domain:port/subpath1/subpath2",
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -33,7 +33,10 @@ import ModalWrapper from "../../Common/ModalWrapper/ModalWrapper";
|
|||||||
import InputBoxWrapper from "../../Common/FormComponents/InputBoxWrapper/InputBoxWrapper";
|
import InputBoxWrapper from "../../Common/FormComponents/InputBoxWrapper/InputBoxWrapper";
|
||||||
import api from "../../../../common/api";
|
import api from "../../../../common/api";
|
||||||
import RemoveIcon from "../../../../icons/RemoveIcon";
|
import RemoveIcon from "../../../../icons/RemoveIcon";
|
||||||
import { setModalErrorSnackMessage } from "../../../../systemSlice";
|
import {
|
||||||
|
setModalErrorSnackMessage,
|
||||||
|
setSnackBarMessage,
|
||||||
|
} from "../../../../systemSlice";
|
||||||
import { useAppDispatch } from "../../../../store";
|
import { useAppDispatch } from "../../../../store";
|
||||||
|
|
||||||
interface IEditDomains {
|
interface IEditDomains {
|
||||||
@@ -90,7 +93,7 @@ const EditDomains = ({
|
|||||||
if (consoleDomainSet !== "") {
|
if (consoleDomainSet !== "") {
|
||||||
// We Validate console domain
|
// We Validate console domain
|
||||||
const consoleRegExp = new RegExp(
|
const consoleRegExp = new RegExp(
|
||||||
/((http|https):\/\/)+[a-zA-Z0-9\-.]{3,}\.[a-zA-Z]{2,}(\.[a-zA-Z]{2,})?(:[1-9]{1}([0-9]{1,4})?)?(\/[a-zA-Z0-9]{1,})*?$/
|
/^(https?):\/\/([a-zA-Z0-9\-.]+)(:[0-9]+)?(\/[a-zA-Z0-9\-./]*)?$/
|
||||||
);
|
);
|
||||||
|
|
||||||
setConsoleDomainValid(consoleRegExp.test(consoleDomainSet));
|
setConsoleDomainValid(consoleRegExp.test(consoleDomainSet));
|
||||||
@@ -102,7 +105,7 @@ const EditDomains = ({
|
|||||||
setMinioDomains(domains.minio);
|
setMinioDomains(domains.minio);
|
||||||
|
|
||||||
const minioRegExp = new RegExp(
|
const minioRegExp = new RegExp(
|
||||||
/((http|https):\/\/)+[a-zA-Z0-9\-.]{3,}\.[a-zA-Z]{2,}(\.[a-zA-Z]{2,})?$/
|
/^(https?):\/\/([a-zA-Z0-9\-.]+)(:[0-9]+)?$/
|
||||||
);
|
);
|
||||||
|
|
||||||
const initialValidations = domains.minio.map((domain) => {
|
const initialValidations = domains.minio.map((domain) => {
|
||||||
@@ -146,11 +149,12 @@ const EditDomains = ({
|
|||||||
)
|
)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
setIsSending(false);
|
setIsSending(false);
|
||||||
|
dispatch(setSnackBarMessage(`Domains updated successfully`));
|
||||||
closeModalAndRefresh(true);
|
closeModalAndRefresh(true);
|
||||||
})
|
})
|
||||||
.catch((error: ErrorResponseHandler) => {
|
.catch((error: ErrorResponseHandler) => {
|
||||||
dispatch(setModalErrorSnackMessage(error));
|
|
||||||
setIsSending(false);
|
setIsSending(false);
|
||||||
|
dispatch(setModalErrorSnackMessage(error));
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -191,7 +195,6 @@ const EditDomains = ({
|
|||||||
|
|
||||||
setMinioDomainValid(cloneValidation);
|
setMinioDomainValid(cloneValidation);
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<ModalWrapper
|
<ModalWrapper
|
||||||
title={`Edit Tenant Domains - ${idTenant}`}
|
title={`Edit Tenant Domains - ${idTenant}`}
|
||||||
@@ -216,7 +219,7 @@ const EditDomains = ({
|
|||||||
"Eg. http://subdomain.domain:port/subpath1/subpath2"
|
"Eg. http://subdomain.domain:port/subpath1/subpath2"
|
||||||
}
|
}
|
||||||
pattern={
|
pattern={
|
||||||
"((http|https):\\/\\/)+[a-zA-Z0-9\\-.]{3,}\\.[a-zA-Z]{2,}(\\.[a-zA-Z]{2,})?(:[1-9]{1}([0-9]{1,4})?)?(\\/[a-zA-Z0-9]{1,})*?$"
|
"^(https?):\\/\\/([a-zA-Z0-9\\-.]+)(:[0-9]+)?(\\/[a-zA-Z0-9\\-.\\/]*)?$"
|
||||||
}
|
}
|
||||||
error={
|
error={
|
||||||
!consoleDomainValid
|
!consoleDomainValid
|
||||||
@@ -248,7 +251,7 @@ const EditDomains = ({
|
|||||||
value={domain}
|
value={domain}
|
||||||
placeholder={"Eg. http://subdomain.domain"}
|
placeholder={"Eg. http://subdomain.domain"}
|
||||||
pattern={
|
pattern={
|
||||||
"((http|https):\\/\\/)+[a-zA-Z0-9\\-.]{3,}\\.[a-zA-Z]{2,}(\\.[a-zA-Z]{2,})?$"
|
"^(https?):\\/\\/([a-zA-Z0-9\\-.]+)(:[0-9]+)?$"
|
||||||
}
|
}
|
||||||
error={
|
error={
|
||||||
!minioDomainValid[index]
|
!minioDomainValid[index]
|
||||||
|
|||||||
@@ -35,9 +35,9 @@ import SectionTitle from "../../Common/SectionTitle";
|
|||||||
import RBIconButton from "../../Buckets/BucketDetails/SummaryItems/RBIconButton";
|
import RBIconButton from "../../Buckets/BucketDetails/SummaryItems/RBIconButton";
|
||||||
import { EditIcon } from "../../../../icons";
|
import { EditIcon } from "../../../../icons";
|
||||||
import EditDomains from "./EditDomains";
|
import EditDomains from "./EditDomains";
|
||||||
import { setTenantDetailsLoad } from "../tenantsSlice";
|
|
||||||
import { ITenant } from "../ListTenants/types";
|
import { ITenant } from "../ListTenants/types";
|
||||||
import { useParams } from "react-router-dom";
|
import { useParams } from "react-router-dom";
|
||||||
|
import { getTenantAsync } from "../thunks/tenantDetailsAsync";
|
||||||
|
|
||||||
interface ITenantsSummary {
|
interface ITenantsSummary {
|
||||||
classes: any;
|
classes: any;
|
||||||
@@ -221,9 +221,8 @@ const TenantSummary = ({ classes }: ITenantsSummary) => {
|
|||||||
|
|
||||||
const closeEditDomainsModal = (refresh: boolean) => {
|
const closeEditDomainsModal = (refresh: boolean) => {
|
||||||
setEditDomainsOpen(false);
|
setEditDomainsOpen(false);
|
||||||
|
|
||||||
if (refresh) {
|
if (refresh) {
|
||||||
dispatch(setTenantDetailsLoad(true));
|
dispatch(getTenantAsync());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -232,8 +231,11 @@ const TenantSummary = ({ classes }: ITenantsSummary) => {
|
|||||||
{updateMinioVersion && (
|
{updateMinioVersion && (
|
||||||
<UpdateTenantModal
|
<UpdateTenantModal
|
||||||
open={updateMinioVersion}
|
open={updateMinioVersion}
|
||||||
closeModalAndRefresh={() => {
|
closeModalAndRefresh={(refresh: boolean) => {
|
||||||
setUpdateMinioVersion(false);
|
setUpdateMinioVersion(false);
|
||||||
|
if (refresh) {
|
||||||
|
dispatch(getTenantAsync());
|
||||||
|
}
|
||||||
}}
|
}}
|
||||||
idTenant={tenantName || ""}
|
idTenant={tenantName || ""}
|
||||||
namespace={tenantNamespace || ""}
|
namespace={tenantNamespace || ""}
|
||||||
|
|||||||
@@ -29,7 +29,10 @@ import ModalWrapper from "../../Common/ModalWrapper/ModalWrapper";
|
|||||||
import InputBoxWrapper from "../../Common/FormComponents/InputBoxWrapper/InputBoxWrapper";
|
import InputBoxWrapper from "../../Common/FormComponents/InputBoxWrapper/InputBoxWrapper";
|
||||||
import FormSwitchWrapper from "../../Common/FormComponents/FormSwitchWrapper/FormSwitchWrapper";
|
import FormSwitchWrapper from "../../Common/FormComponents/FormSwitchWrapper/FormSwitchWrapper";
|
||||||
import api from "../../../../common/api";
|
import api from "../../../../common/api";
|
||||||
import { setModalErrorSnackMessage } from "../../../../systemSlice";
|
import {
|
||||||
|
setModalErrorSnackMessage,
|
||||||
|
setSnackBarMessage,
|
||||||
|
} from "../../../../systemSlice";
|
||||||
import { useAppDispatch } from "../../../../store";
|
import { useAppDispatch } from "../../../../store";
|
||||||
|
|
||||||
interface IUpdateTenantModal {
|
interface IUpdateTenantModal {
|
||||||
@@ -127,6 +130,7 @@ const UpdateTenantModal = ({
|
|||||||
)
|
)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
setIsSending(false);
|
setIsSending(false);
|
||||||
|
dispatch(setSnackBarMessage(`Image updated successfully`));
|
||||||
closeModalAndRefresh(true);
|
closeModalAndRefresh(true);
|
||||||
})
|
})
|
||||||
.catch((error: ErrorResponseHandler) => {
|
.catch((error: ErrorResponseHandler) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user