Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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) =>
Expand All @@ -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);

Expand All @@ -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
Expand Down Expand Up @@ -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,
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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>
Expand Down