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 api from "../../../../common/api";
|
||||
import TableWrapper from "../../Common/TableWrapper/TableWrapper";
|
||||
import { AppState } from "../../../../store";
|
||||
import {
|
||||
setTenantDetailsLoad,
|
||||
setTenantInfo,
|
||||
setTenantName,
|
||||
setTenantTab,
|
||||
} from "../actions";
|
||||
|
||||
interface IPodsSummary {
|
||||
match: any;
|
||||
history: any;
|
||||
loadingTenant: boolean;
|
||||
setTenantDetailsLoad: typeof setTenantDetailsLoad;
|
||||
}
|
||||
|
||||
const styles = (theme: Theme) =>
|
||||
@@ -38,7 +47,7 @@ const styles = (theme: Theme) =>
|
||||
...containerForHeader(theme.spacing(4)),
|
||||
});
|
||||
|
||||
const PodsSummary = ({ match, history }: IPodsSummary) => {
|
||||
const PodsSummary = ({ match, history, loadingTenant }: IPodsSummary) => {
|
||||
const [pods, setPods] = useState<IPodListElement[]>([]);
|
||||
const [loadingPods, setLoadingPods] = useState<boolean>(true);
|
||||
|
||||
@@ -53,6 +62,12 @@ const PodsSummary = ({ match, history }: IPodsSummary) => {
|
||||
};
|
||||
const podTableActions = [{ type: "view", onClick: podViewAction }];
|
||||
|
||||
useEffect(() => {
|
||||
if (loadingTenant) {
|
||||
setLoadingPods(true);
|
||||
}
|
||||
}, [loadingTenant]);
|
||||
|
||||
useEffect(() => {
|
||||
if (loadingPods) {
|
||||
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,
|
||||
});
|
||||
|
||||
|
||||
@@ -46,6 +46,7 @@ import PodsSummary from "./PodsSummary";
|
||||
import { AppState } from "../../../../store";
|
||||
import TenantMetrics from "./TenantMetrics";
|
||||
import TenantSecurity from "./TenantSecurity";
|
||||
import RefreshIcon from "@material-ui/icons/Refresh";
|
||||
|
||||
interface ITenantDetailsProps {
|
||||
classes: any;
|
||||
@@ -217,6 +218,18 @@ const TenantDetails = ({
|
||||
</Menu>
|
||||
</Fragment>
|
||||
}
|
||||
actions={
|
||||
<IconButton
|
||||
color="primary"
|
||||
aria-label="Refresh List"
|
||||
component="span"
|
||||
onClick={() => {
|
||||
setTenantDetailsLoad(true);
|
||||
}}
|
||||
>
|
||||
<RefreshIcon />
|
||||
</IconButton>
|
||||
}
|
||||
/>
|
||||
<Grid item xs={12} className={classes.container} />
|
||||
<Grid container>
|
||||
|
||||
Reference in New Issue
Block a user