Skip to content

Commit

Permalink
refresh env vars on save for switching tabs (#4248)
Browse files Browse the repository at this point in the history
  • Loading branch information
jusrhee authored Feb 8, 2024
1 parent fb08a45 commit 3ec3845
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
9 changes: 8 additions & 1 deletion dashboard/src/main/home/env-dashboard/ExpandedEnv.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,14 @@ const ExpandedEnv: React.FC = () => {
/>
<Spacer y={1} />
{match(tab)
.with("env-vars", () => <EnvVarsTab envGroup={envGroup} />)
.with("env-vars", () => {
return (
<EnvVarsTab
envGroup={envGroup}
fetchEnvGroup={fetchEnvGroup}
/>
);
})
.with("synced-apps", () => <SyncedAppsTab envGroup={envGroup} />)
.with("settings", () => <SettingsTab envGroup={envGroup} />)
.otherwise(() => null)}
Expand Down
5 changes: 3 additions & 2 deletions dashboard/src/main/home/env-dashboard/tabs/EnvVarsTab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,10 @@ type Props = {
secret_variables?: Record<string, string>;
type?: string;
};
fetchEnvGroup: () => void;
}

const EnvVarsTab: React.FC<Props> = ({ envGroup }) => {
const EnvVarsTab: React.FC<Props> = ({ envGroup, fetchEnvGroup }) => {
const { currentProject, currentCluster } = useContext(Context);
const [buttonStatus, setButtonStatus] = useState<string | React.ReactNode>("");

Expand Down Expand Up @@ -149,7 +150,7 @@ const EnvVarsTab: React.FC<Props> = ({ envGroup }) => {
cluster_id: currentCluster?.id || -1,
}
);

fetchEnvGroup();
setButtonStatus("success");
} catch (err) {
const errorMessage =
Expand Down

0 comments on commit 3ec3845

Please sign in to comment.