Disable Manage button if (#1198)
Signed-off-by: Daniel Valdivia <18384552+dvaldivia@users.noreply.github.com>
This commit is contained in:
@@ -28,6 +28,7 @@ import createStyles from "@mui/styles/createStyles";
|
|||||||
import withStyles from "@mui/styles/withStyles";
|
import withStyles from "@mui/styles/withStyles";
|
||||||
import { niceBytes } from "../../../../common/utils";
|
import { niceBytes } from "../../../../common/utils";
|
||||||
import UsageBarWrapper from "../../Common/UsageBarWrapper/UsageBarWrapper";
|
import UsageBarWrapper from "../../Common/UsageBarWrapper/UsageBarWrapper";
|
||||||
|
import { tenantIsOnline } from "./utils";
|
||||||
|
|
||||||
const styles = (theme: Theme) =>
|
const styles = (theme: Theme) =>
|
||||||
createStyles({
|
createStyles({
|
||||||
@@ -184,6 +185,7 @@ const TenantListItem = ({ tenant, classes }: ITenantListItem) => {
|
|||||||
size={"small"}
|
size={"small"}
|
||||||
color={"primary"}
|
color={"primary"}
|
||||||
variant="outlined"
|
variant="outlined"
|
||||||
|
disabled={!tenantIsOnline(tenant)}
|
||||||
className={classes.manageButton}
|
className={classes.manageButton}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
history.push(
|
history.push(
|
||||||
|
|||||||
@@ -15,6 +15,7 @@
|
|||||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
import get from "lodash/get";
|
import get from "lodash/get";
|
||||||
|
import { ITenant } from "./types";
|
||||||
|
|
||||||
export interface Opts {
|
export interface Opts {
|
||||||
label: string;
|
label: string;
|
||||||
@@ -64,3 +65,14 @@ export const getLimitSizes = (resourceQuotas: IQuotas) => {
|
|||||||
|
|
||||||
return returnQuotas;
|
return returnQuotas;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const tenantIsOnline = (tenant: ITenant): boolean => {
|
||||||
|
var isOnline = true;
|
||||||
|
if (tenant.currentState === "") {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (tenant.health_status !== "green" && tenant.health_status !== "yellow") {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return isOnline;
|
||||||
|
};
|
||||||
|
|||||||
@@ -34,6 +34,7 @@ import UpdateTenantModal from "./UpdateTenantModal";
|
|||||||
import { AppState } from "../../../../store";
|
import { AppState } from "../../../../store";
|
||||||
import history from "./../../../../history";
|
import history from "./../../../../history";
|
||||||
import { CircleIcon } from "../../../../icons";
|
import { CircleIcon } from "../../../../icons";
|
||||||
|
import { tenantIsOnline } from "../ListTenants/utils";
|
||||||
|
|
||||||
interface ITenantsSummary {
|
interface ITenantsSummary {
|
||||||
classes: any;
|
classes: any;
|
||||||
@@ -328,6 +329,7 @@ const TenantSummary = ({
|
|||||||
`/namespaces/${tenantNamespace}/tenants/${tenantName}/hop`
|
`/namespaces/${tenantNamespace}/tenants/${tenantName}/hop`
|
||||||
);
|
);
|
||||||
}}
|
}}
|
||||||
|
disabled={!tenant || !tenantIsOnline(tenant)}
|
||||||
>
|
>
|
||||||
Manage Tenant
|
Manage Tenant
|
||||||
</Button>
|
</Button>
|
||||||
|
|||||||
Reference in New Issue
Block a user