Global Refresh for Tenant Details (#822)
Signed-off-by: Daniel Valdivia <18384552+dvaldivia@users.noreply.github.com>
This commit is contained in:
@@ -26,10 +26,19 @@ import { IPodListElement } from "../ListTenants/types";
|
|||||||
import { setErrorSnackMessage } from "../../../../actions";
|
import { setErrorSnackMessage } from "../../../../actions";
|
||||||
import api from "../../../../common/api";
|
import api from "../../../../common/api";
|
||||||
import TableWrapper from "../../Common/TableWrapper/TableWrapper";
|
import TableWrapper from "../../Common/TableWrapper/TableWrapper";
|
||||||
|
import { AppState } from "../../../../store";
|
||||||
|
import {
|
||||||
|
setTenantDetailsLoad,
|
||||||
|
setTenantInfo,
|
||||||
|
setTenantName,
|
||||||
|
setTenantTab,
|
||||||
|
} from "../actions";
|
||||||
|
|
||||||
interface IPodsSummary {
|
interface IPodsSummary {
|
||||||
match: any;
|
match: any;
|
||||||
history: any;
|
history: any;
|
||||||
|
loadingTenant: boolean;
|
||||||
|
setTenantDetailsLoad: typeof setTenantDetailsLoad;
|
||||||
}
|
}
|
||||||
|
|
||||||
const styles = (theme: Theme) =>
|
const styles = (theme: Theme) =>
|
||||||
@@ -38,7 +47,7 @@ const styles = (theme: Theme) =>
|
|||||||
...containerForHeader(theme.spacing(4)),
|
...containerForHeader(theme.spacing(4)),
|
||||||
});
|
});
|
||||||
|
|
||||||
const PodsSummary = ({ match, history }: IPodsSummary) => {
|
const PodsSummary = ({ match, history, loadingTenant }: IPodsSummary) => {
|
||||||
const [pods, setPods] = useState<IPodListElement[]>([]);
|
const [pods, setPods] = useState<IPodListElement[]>([]);
|
||||||
const [loadingPods, setLoadingPods] = useState<boolean>(true);
|
const [loadingPods, setLoadingPods] = useState<boolean>(true);
|
||||||
|
|
||||||
@@ -53,6 +62,12 @@ const PodsSummary = ({ match, history }: IPodsSummary) => {
|
|||||||
};
|
};
|
||||||
const podTableActions = [{ type: "view", onClick: podViewAction }];
|
const podTableActions = [{ type: "view", onClick: podViewAction }];
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (loadingTenant) {
|
||||||
|
setLoadingPods(true);
|
||||||
|
}
|
||||||
|
}, [loadingTenant]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (loadingPods) {
|
if (loadingPods) {
|
||||||
api
|
api
|
||||||
@@ -104,7 +119,11 @@ const PodsSummary = ({ match, history }: IPodsSummary) => {
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
const connector = connect(null, {
|
const mapState = (state: AppState) => ({
|
||||||
|
loadingTenant: state.tenants.tenantDetails.loadingTenant,
|
||||||
|
});
|
||||||
|
|
||||||
|
const connector = connect(mapState, {
|
||||||
setErrorSnackMessage,
|
setErrorSnackMessage,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -46,6 +46,7 @@ import PodsSummary from "./PodsSummary";
|
|||||||
import { AppState } from "../../../../store";
|
import { AppState } from "../../../../store";
|
||||||
import TenantMetrics from "./TenantMetrics";
|
import TenantMetrics from "./TenantMetrics";
|
||||||
import TenantSecurity from "./TenantSecurity";
|
import TenantSecurity from "./TenantSecurity";
|
||||||
|
import RefreshIcon from "@material-ui/icons/Refresh";
|
||||||
|
|
||||||
interface ITenantDetailsProps {
|
interface ITenantDetailsProps {
|
||||||
classes: any;
|
classes: any;
|
||||||
@@ -217,6 +218,18 @@ const TenantDetails = ({
|
|||||||
</Menu>
|
</Menu>
|
||||||
</Fragment>
|
</Fragment>
|
||||||
}
|
}
|
||||||
|
actions={
|
||||||
|
<IconButton
|
||||||
|
color="primary"
|
||||||
|
aria-label="Refresh List"
|
||||||
|
component="span"
|
||||||
|
onClick={() => {
|
||||||
|
setTenantDetailsLoad(true);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<RefreshIcon />
|
||||||
|
</IconButton>
|
||||||
|
}
|
||||||
/>
|
/>
|
||||||
<Grid item xs={12} className={classes.container} />
|
<Grid item xs={12} className={classes.container} />
|
||||||
<Grid container>
|
<Grid container>
|
||||||
|
|||||||
Reference in New Issue
Block a user