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 { niceBytes } from "../../../../common/utils";
|
||||
import UsageBarWrapper from "../../Common/UsageBarWrapper/UsageBarWrapper";
|
||||
import { tenantIsOnline } from "./utils";
|
||||
|
||||
const styles = (theme: Theme) =>
|
||||
createStyles({
|
||||
@@ -184,6 +185,7 @@ const TenantListItem = ({ tenant, classes }: ITenantListItem) => {
|
||||
size={"small"}
|
||||
color={"primary"}
|
||||
variant="outlined"
|
||||
disabled={!tenantIsOnline(tenant)}
|
||||
className={classes.manageButton}
|
||||
onClick={() => {
|
||||
history.push(
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import get from "lodash/get";
|
||||
import { ITenant } from "./types";
|
||||
|
||||
export interface Opts {
|
||||
label: string;
|
||||
@@ -64,3 +65,14 @@ export const getLimitSizes = (resourceQuotas: IQuotas) => {
|
||||
|
||||
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 history from "./../../../../history";
|
||||
import { CircleIcon } from "../../../../icons";
|
||||
import { tenantIsOnline } from "../ListTenants/utils";
|
||||
|
||||
interface ITenantsSummary {
|
||||
classes: any;
|
||||
@@ -328,6 +329,7 @@ const TenantSummary = ({
|
||||
`/namespaces/${tenantNamespace}/tenants/${tenantName}/hop`
|
||||
);
|
||||
}}
|
||||
disabled={!tenant || !tenantIsOnline(tenant)}
|
||||
>
|
||||
Manage Tenant
|
||||
</Button>
|
||||
|
||||
Reference in New Issue
Block a user