Skip to content

Commit 036ffc7

Browse files
committed
Show Setup Wizard pop-up once setup is required
This ensures that pop-up appears if setup is required at the start. Instead of synchronizing changes at the start we decided to have pop-up appearing every time the setup is broken. This shouldn't happen normally, but when it happens then setup wizard pop-up in addition to painting setup bar red can actually be helpful.
1 parent 7f45357 commit 036ffc7

File tree

2 files changed

+38
-13
lines changed

2 files changed

+38
-13
lines changed

src/plugins/setup.ts

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -368,17 +368,22 @@ export default createPlugin(
368368
),
369369
);
370370

371-
if (setupStatusTracker.status() === "setup_required") {
372-
window
373-
.showInformationMessage("Setup LocalStack to get started.", {
374-
title: "Setup",
375-
command: "localstack.setup",
376-
})
377-
.then((selected) => {
378-
if (selected) {
379-
commands.executeCommand(selected.command, "extension_startup");
380-
}
381-
});
382-
}
371+
setupStatusTracker.onChange((status) => {
372+
if (status === "setup_required") {
373+
void window
374+
.showInformationMessage("Setup LocalStack to get started.", {
375+
title: "Setup",
376+
command: "localstack.setup",
377+
})
378+
.then((selected) => {
379+
if (selected) {
380+
void commands.executeCommand(
381+
selected.command,
382+
"extension_startup",
383+
);
384+
}
385+
});
386+
}
387+
});
383388
},
384389
);

src/utils/setup-status.ts

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,26 @@ export async function createSetupStatusTracker(
4747
);
4848

4949
const checkStatusNow = async () => {
50+
const allStatusesInitialized = Object.values({
51+
awsProfileTracker: awsProfileTracker.status(),
52+
authTracker: localStackAuthenticationTracker.status(),
53+
licenseTracker: licenseTracker.status(),
54+
}).every((check) => check !== undefined);
55+
56+
if (!allStatusesInitialized) {
57+
outputChannel.trace(
58+
`[setup-status] File watchers not initialized yet, skipping status check : ${JSON.stringify(
59+
{
60+
awsProfileTracker: awsProfileTracker.status() ?? "undefined",
61+
authTracker:
62+
localStackAuthenticationTracker.status() ?? "undefined",
63+
licenseTracker: licenseTracker.status() ?? "undefined",
64+
},
65+
)}`,
66+
);
67+
return;
68+
}
69+
5070
statuses = await checkSetupStatus(outputChannel);
5171

5272
const setupRequired = [
@@ -255,7 +275,7 @@ function createLicenseStatusTracker(
255275
return createFileStatusTracker(
256276
outputChannel,
257277
"[setup-status.license]",
258-
[LOCALSTACK_AUTH_FILENAME, LICENSE_FILENAME], //TODO rewrite to depend on change in localStackAuthenticationTracker
278+
[LOCALSTACK_AUTH_FILENAME, LICENSE_FILENAME], //TODO rewrite to depend on change in localStackAuthenticationTrackerl
259279
async () =>
260280
(await checkIsLicenseValid(outputChannel)) ? "ok" : "setup_required",
261281
);

0 commit comments

Comments
 (0)