Skip to content

Commit

Permalink
Start starting/stopping indicator, reload indicator on status changes (
Browse files Browse the repository at this point in the history
…#168)

* re-load unit status

* lint
  • Loading branch information
leigh-johnson committed Jul 13, 2023
1 parent 23edfef commit b2842ef
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 12 deletions.
22 changes: 22 additions & 0 deletions src/components/WidgetStatus.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,28 @@
></div>
<span class="text-grey-600">Active</span>
</div>
<div
class="flex items-center space-x-3 font-medium text-gray-600 justify-self-start"
v-else-if="store.unit?.active_state == SystemdUnitActiveState.ACTIVATING"
>
<div
class="bg-blue-500 flex-shrink-0 w-2.5 h-2.5 rounded-full"
aria-hidden="true"
></div>
<span class="text-grey-600">Starting</span>
</div>
<div
class="flex items-center space-x-3 font-medium text-gray-600 justify-self-start"
v-else-if="
store.unit?.active_state == SystemdUnitActiveState.DEACTIVATING
"
>
<div
class="bg-blue-500 flex-shrink-0 w-2.5 h-2.5 rounded-full"
aria-hidden="true"
></div>
<span class="text-grey-600">Stopping</span>
</div>
<div
class="flex items-center space-x-3 font-medium text-gray-600 justify-self-start"
v-else-if="store.unit?.active_state == SystemdUnitActiveState.INACTIVE"
Expand Down
6 changes: 4 additions & 2 deletions src/stores/systemdService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ export const useSystemdServiceStore = (
);
}
}
await this.load();
},
async enableService() {
// get nats connection (awaits until NATS server is available)
Expand Down Expand Up @@ -173,7 +174,6 @@ export const useSystemdServiceStore = (
res.changes
);
}

await this.startService();
}
},
Expand Down Expand Up @@ -225,6 +225,7 @@ export const useSystemdServiceStore = (
console.log(`Started ${widget.service}, start job id:`, res.job);
}
}
await this.load();
},

async stopService(notify: boolean) {
Expand Down Expand Up @@ -274,9 +275,10 @@ export const useSystemdServiceStore = (
);
}

console.log(`Started ${widget.service}, start job id:`, res.job);
console.log(`Stopped ${widget.service}, start job id:`, res.job);
}
}
await this.load();
},

async restartService(notify: boolean) {
Expand Down
20 changes: 10 additions & 10 deletions src/utils/browser.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
import { detect } from "detect-browser"
import { detect } from "detect-browser";
import { error } from "@/stores/alerts";

const SUPPORTED_BROWSERS = [
"chrome",
"chromium-webview",
]
const SUPPORTED_BROWSERS = ["chrome", "chromium-webview"];

function checkBrowserSupport(): boolean {
const browser = detect();
if (browser && SUPPORTED_BROWSERS.includes(browser.name)) {
return true
return true;
}
error(`Your browser (${browser?.name}) is not supported`, `Please re-open this page using Google Chrome: https://www.google.com/chrome/
error(
`Your browser (${browser?.name}) is not supported`,
`Please re-open this page using Google Chrome: https://www.google.com/chrome/
Track support for other browsers by subscribing to this issue: https://github.com/bitsy-ai/printnanny-os/issues/281`)
return false
Track support for other browsers by subscribing to this issue: https://github.com/bitsy-ai/printnanny-os/issues/281`
);
return false;
}

export { checkBrowserSupport }
export { checkBrowserSupport };

0 comments on commit b2842ef

Please sign in to comment.