JavaScript
Modules¶
- octoprint_uptime/navbar
Frontend module for the navbar uptime widget.
- octoprint_uptime/navbar
Frontend module for the navbar uptime widget.
octoprint_uptime/navbar¶
Frontend module for the navbar uptime widget.
- octoprint_uptime/navbar
- .NavbarUptimeViewModel
- new NavbarUptimeViewModel(parameters)
- new NavbarUptimeViewModel(parameters)
- static
- .onStartupComplete() ⇒
void - .onStartupComplete() ⇒
void
- .onStartupComplete() ⇒
- inner
- ~getPluginSettings() ⇒
Object|null - ~getCompactToggleInterval() ⇒
number - ~isNavbarEnabled() ⇒
boolean - ~showSystemUptime() ⇒
boolean - ~showOctoprintUptime() ⇒
boolean - ~isCompactDisplay() ⇒
boolean - ~displayFormat() ⇒
string - ~scheduleNext(intervalSeconds) ⇒
void - ~scheduleNextFromData(data) ⇒
void - ~renderCompactDisplay() ⇒
void - ~scheduleCompactToggle() ⇒
void - ~stopCompactToggleLoop() ⇒
void - ~updateNavbarTooltip(data, includeOctoprint) ⇒
void - ~fetchUptime() ⇒
void - ~getPluginSettings() ⇒
Object|null - ~getCompactToggleInterval() ⇒
number - ~isNavbarEnabled() ⇒
boolean - ~showSystemUptime() ⇒
boolean - ~showOctoprintUptime() ⇒
boolean - ~isCompactDisplay() ⇒
boolean - ~displayFormat() ⇒
string - ~scheduleNext(intervalSeconds) ⇒
void - ~scheduleNextFromData(data) ⇒
void - ~renderCompactDisplay() ⇒
void - ~scheduleCompactToggle() ⇒
void - ~stopCompactToggleLoop() ⇒
void - ~updateNavbarTooltip(data, includeOctoprint) ⇒
void - ~fetchUptime() ⇒
void
- ~getPluginSettings() ⇒
- .NavbarUptimeViewModel
- new NavbarUptimeViewModel(parameters)
- new NavbarUptimeViewModel(parameters)
- static
- .onStartupComplete() ⇒
void - .onStartupComplete() ⇒
void
- .onStartupComplete() ⇒
- inner
- ~getPluginSettings() ⇒
Object|null - ~getCompactToggleInterval() ⇒
number - ~isNavbarEnabled() ⇒
boolean - ~showSystemUptime() ⇒
boolean - ~showOctoprintUptime() ⇒
boolean - ~isCompactDisplay() ⇒
boolean - ~displayFormat() ⇒
string - ~scheduleNext(intervalSeconds) ⇒
void - ~scheduleNextFromData(data) ⇒
void - ~renderCompactDisplay() ⇒
void - ~scheduleCompactToggle() ⇒
void - ~stopCompactToggleLoop() ⇒
void - ~updateNavbarTooltip(data, includeOctoprint) ⇒
void - ~fetchUptime() ⇒
void - ~getPluginSettings() ⇒
Object|null - ~getCompactToggleInterval() ⇒
number - ~isNavbarEnabled() ⇒
boolean - ~showSystemUptime() ⇒
boolean - ~showOctoprintUptime() ⇒
boolean - ~isCompactDisplay() ⇒
boolean - ~displayFormat() ⇒
string - ~scheduleNext(intervalSeconds) ⇒
void - ~scheduleNextFromData(data) ⇒
void - ~renderCompactDisplay() ⇒
void - ~scheduleCompactToggle() ⇒
void - ~stopCompactToggleLoop() ⇒
void - ~updateNavbarTooltip(data, includeOctoprint) ⇒
void - ~fetchUptime() ⇒
void
- ~getPluginSettings() ⇒
- .NavbarUptimeViewModel
octoprint_uptime/navbar.NavbarUptimeViewModel¶
Kind: static class of octoprint_uptime/navbar
- .NavbarUptimeViewModel
- new NavbarUptimeViewModel(parameters)
- new NavbarUptimeViewModel(parameters)
- static
- .onStartupComplete() ⇒
void - .onStartupComplete() ⇒
void
- .onStartupComplete() ⇒
- inner
- ~getPluginSettings() ⇒
Object|null - ~getCompactToggleInterval() ⇒
number - ~isNavbarEnabled() ⇒
boolean - ~showSystemUptime() ⇒
boolean - ~showOctoprintUptime() ⇒
boolean - ~isCompactDisplay() ⇒
boolean - ~displayFormat() ⇒
string - ~scheduleNext(intervalSeconds) ⇒
void - ~scheduleNextFromData(data) ⇒
void - ~renderCompactDisplay() ⇒
void - ~scheduleCompactToggle() ⇒
void - ~stopCompactToggleLoop() ⇒
void - ~updateNavbarTooltip(data, includeOctoprint) ⇒
void - ~fetchUptime() ⇒
void - ~getPluginSettings() ⇒
Object|null - ~getCompactToggleInterval() ⇒
number - ~isNavbarEnabled() ⇒
boolean - ~showSystemUptime() ⇒
boolean - ~showOctoprintUptime() ⇒
boolean - ~isCompactDisplay() ⇒
boolean - ~displayFormat() ⇒
string - ~scheduleNext(intervalSeconds) ⇒
void - ~scheduleNextFromData(data) ⇒
void - ~renderCompactDisplay() ⇒
void - ~scheduleCompactToggle() ⇒
void - ~stopCompactToggleLoop() ⇒
void - ~updateNavbarTooltip(data, includeOctoprint) ⇒
void - ~fetchUptime() ⇒
void
- ~getPluginSettings() ⇒
new NavbarUptimeViewModel(parameters)¶
NavbarUptimeViewModel
Displays the system uptime in the navbar and keeps it updated via polling.
| Param | Type | Description |
|---|---|---|
| parameters | Array |
ViewModel parameters (expects settingsViewModel). |
new NavbarUptimeViewModel(parameters)¶
NavbarUptimeViewModel
Displays the system uptime in the navbar and keeps it updated via polling.
| Param | Type | Description |
|---|---|---|
| parameters | Array |
ViewModel parameters (expects settingsViewModel). |
NavbarUptimeViewModel.onStartupComplete() ⇒ void¶
OctoPrint lifecycle hook - called once after all ViewModels have been bound and the settings are fully populated.
Polling is deliberately deferred to this hook instead of starting
immediately in the constructor, so that getPluginSettings() can
resolve the Knockout observables from settingsViewModel.settings
reliably on the very first call.
Kind: static method of NavbarUptimeViewModel
NavbarUptimeViewModel.onStartupComplete() ⇒ void¶
OctoPrint lifecycle hook - called once after all ViewModels have been bound and the settings are fully populated.
Polling is deliberately deferred to this hook instead of starting
immediately in the constructor, so that getPluginSettings() can
resolve the Knockout observables from settingsViewModel.settings
reliably on the very first call.
Kind: static method of NavbarUptimeViewModel
NavbarUptimeViewModel~getPluginSettings() ⇒ Object | null¶
Return the plugin-specific settings object (settings.plugins.octoprint_uptime).
Re-resolves on every call so that the ViewModel never holds a stale
reference captured before settingsViewModel.settings was ready.
Kind: inner method of NavbarUptimeViewModel
Returns: Object | null - The KO-mapped plugin settings node, or null when
unavailable (e.g. during early startup before settings are loaded).
NavbarUptimeViewModel~getCompactToggleInterval() ⇒ number¶
Return the configured compact toggle interval in seconds.
Reads compact_toggle_interval_seconds from plugin settings and validates
the result against the allowed range (5-60). Falls back to
DEFAULT_COMPACT_TOGGLE_INTERVAL when settings are unavailable or the
stored value is out of range.
Kind: inner method of NavbarUptimeViewModel
Returns: number - interval in seconds (integer, 5-60)
NavbarUptimeViewModel~isNavbarEnabled() ⇒ boolean¶
Determine whether the navbar widget should be visible.
Returns true when at least one of show_system_uptime or
show_octoprint_uptime is enabled in the plugin settings, or when
settings are not yet available (fail-safe: show by default).
Kind: inner method of NavbarUptimeViewModel
NavbarUptimeViewModel~showSystemUptime() ⇒ boolean¶
Check whether the system uptime entry should be shown.
Kind: inner method of NavbarUptimeViewModel
Returns: boolean - true when enabled, false otherwise
NavbarUptimeViewModel~showOctoprintUptime() ⇒ boolean¶
Check whether OctoPrint uptime should be shown alongside system uptime.
Kind: inner method of NavbarUptimeViewModel
Returns: boolean - true when enabled, false otherwise
NavbarUptimeViewModel~isCompactDisplay() ⇒ boolean¶
Check whether compact display mode is enabled. In compact mode, system and OctoPrint uptime alternate in the navbar instead of being shown side-by-side.
Kind: inner method of NavbarUptimeViewModel
Returns: boolean - true when compact display is enabled, false otherwise
NavbarUptimeViewModel~displayFormat() ⇒ string¶
Get the configured display format (fallback to "full").
Kind: inner method of NavbarUptimeViewModel
Returns: string - one of "full", "dhm", "dh", or "d"
NavbarUptimeViewModel~scheduleNext(intervalSeconds) ⇒ void¶
Schedule the next polling cycle.
Kind: inner method of NavbarUptimeViewModel
| Param | Type | Description |
|---|---|---|
| intervalSeconds | number |
seconds until next poll (clamped by caller) |
NavbarUptimeViewModel~scheduleNextFromData(data) ⇒ void¶
Schedule the next polling cycle using the poll interval from the last API
response. Falls back to the local setting or DEFAULT_POLL if the
response does not include poll_interval_seconds.
Kind: inner method of NavbarUptimeViewModel
| Param | Type | Description |
|---|---|---|
| data | Object | null |
The API response object, or null/undefined. |
NavbarUptimeViewModel~renderCompactDisplay() ⇒ void¶
Render the current frame of the compact display.
Reads compactDisplayUptimeType ("system" or "octoprint") and updates
uptimeDisplayText with the corresponding uptime string.
Kind: inner method of NavbarUptimeViewModel
NavbarUptimeViewModel~scheduleCompactToggle() ⇒ void¶
Schedule the compact display toggle timer.
Alternates compactDisplayUptimeType between "system" and "octoprint"
using the interval from getCompactToggleInterval() (reads the
compact_toggle_interval_seconds plugin setting on every cycle, 5-60 s).
No-ops if already scheduled.
Kind: inner method of NavbarUptimeViewModel
NavbarUptimeViewModel~stopCompactToggleLoop() ⇒ void¶
Cancel any pending compact toggle timer. Safe to call when no timer is active.
Kind: inner method of NavbarUptimeViewModel
NavbarUptimeViewModel~updateNavbarTooltip(data, includeOctoprint) ⇒ void¶
Update navbar anchor tooltip with localized start times. Keeps tooltip behavior identical across compact and non-compact display.
Kind: inner method of NavbarUptimeViewModel
| Param | Type | Description |
|---|---|---|
| data | Object |
API payload that may include uptime second counters. |
| includeOctoprint | boolean |
Whether to include OctoPrint start time. |
NavbarUptimeViewModel~fetchUptime() ⇒ void¶
Fetch uptime from the plugin API and update the navbar display and tooltip. Silently updates polling interval based on server or local settings.
Kind: inner method of NavbarUptimeViewModel
Example
// Expected API response (partial):
// {
// "seconds": 3600,
// "uptime": "1 hour",
// "uptime_dhm": "0d 1h 0m",
// "display_format": "dhm",
// "poll_interval_seconds": 5
// }
NavbarUptimeViewModel~getPluginSettings() ⇒ Object | null¶
Return the plugin-specific settings object (settings.plugins.octoprint_uptime).
Re-resolves on every call so that the ViewModel never holds a stale
reference captured before settingsViewModel.settings was ready.
Kind: inner method of NavbarUptimeViewModel
Returns: Object | null - The KO-mapped plugin settings node, or null when
unavailable (e.g. during early startup before settings are loaded).
NavbarUptimeViewModel~getCompactToggleInterval() ⇒ number¶
Return the configured compact toggle interval in seconds.
Reads compact_toggle_interval_seconds from plugin settings and validates
the result against the allowed range (5-60). Falls back to
DEFAULT_COMPACT_TOGGLE_INTERVAL when settings are unavailable or the
stored value is out of range.
Kind: inner method of NavbarUptimeViewModel
Returns: number - interval in seconds (integer, 5-60)
NavbarUptimeViewModel~isNavbarEnabled() ⇒ boolean¶
Determine whether the navbar widget should be visible.
Returns true when at least one of show_system_uptime or
show_octoprint_uptime is enabled in the plugin settings, or when
settings are not yet available (fail-safe: show by default).
Kind: inner method of NavbarUptimeViewModel
NavbarUptimeViewModel~showSystemUptime() ⇒ boolean¶
Check whether the system uptime entry should be shown.
Kind: inner method of NavbarUptimeViewModel
Returns: boolean - true when enabled, false otherwise
NavbarUptimeViewModel~showOctoprintUptime() ⇒ boolean¶
Check whether OctoPrint uptime should be shown alongside system uptime.
Kind: inner method of NavbarUptimeViewModel
Returns: boolean - true when enabled, false otherwise
NavbarUptimeViewModel~isCompactDisplay() ⇒ boolean¶
Check whether compact display mode is enabled. In compact mode, system and OctoPrint uptime alternate in the navbar instead of being shown side-by-side.
Kind: inner method of NavbarUptimeViewModel
Returns: boolean - true when compact display is enabled, false otherwise
NavbarUptimeViewModel~displayFormat() ⇒ string¶
Get the configured display format (fallback to "full").
Kind: inner method of NavbarUptimeViewModel
Returns: string - one of "full", "dhm", "dh", or "d"
NavbarUptimeViewModel~scheduleNext(intervalSeconds) ⇒ void¶
Schedule the next polling cycle.
Kind: inner method of NavbarUptimeViewModel
| Param | Type | Description |
|---|---|---|
| intervalSeconds | number |
seconds until next poll (clamped by caller) |
NavbarUptimeViewModel~scheduleNextFromData(data) ⇒ void¶
Schedule the next polling cycle using the poll interval from the last API
response. Falls back to the local setting or DEFAULT_POLL if the
response does not include poll_interval_seconds.
Kind: inner method of NavbarUptimeViewModel
| Param | Type | Description |
|---|---|---|
| data | Object | null |
The API response object, or null/undefined. |
NavbarUptimeViewModel~renderCompactDisplay() ⇒ void¶
Render the current frame of the compact display.
Reads compactDisplayUptimeType ("system" or "octoprint") and updates
uptimeDisplayText with the corresponding uptime string.
Kind: inner method of NavbarUptimeViewModel
NavbarUptimeViewModel~scheduleCompactToggle() ⇒ void¶
Schedule the compact display toggle timer.
Alternates compactDisplayUptimeType between "system" and "octoprint"
using the interval from getCompactToggleInterval() (reads the
compact_toggle_interval_seconds plugin setting on every cycle, 5-60 s).
No-ops if already scheduled.
Kind: inner method of NavbarUptimeViewModel
NavbarUptimeViewModel~stopCompactToggleLoop() ⇒ void¶
Cancel any pending compact toggle timer. Safe to call when no timer is active.
Kind: inner method of NavbarUptimeViewModel
NavbarUptimeViewModel~updateNavbarTooltip(data, includeOctoprint) ⇒ void¶
Update navbar anchor tooltip with localized start times. Keeps tooltip behavior identical across compact and non-compact display.
Kind: inner method of NavbarUptimeViewModel
| Param | Type | Description |
|---|---|---|
| data | Object |
API payload that may include uptime second counters. |
| includeOctoprint | boolean |
Whether to include OctoPrint start time. |
NavbarUptimeViewModel~fetchUptime() ⇒ void¶
Fetch uptime from the plugin API and update the navbar display and tooltip. Silently updates polling interval based on server or local settings.
Kind: inner method of NavbarUptimeViewModel
Example
// Expected API response (partial):
// {
// "seconds": 3600,
// "uptime": "1 hour",
// "uptime_dhm": "0d 1h 0m",
// "display_format": "dhm",
// "poll_interval_seconds": 5
// }
octoprint_uptime/navbar.NavbarUptimeViewModel¶
Kind: static class of octoprint_uptime/navbar
- .NavbarUptimeViewModel
- new NavbarUptimeViewModel(parameters)
- new NavbarUptimeViewModel(parameters)
- static
- .onStartupComplete() ⇒
void - .onStartupComplete() ⇒
void
- .onStartupComplete() ⇒
- inner
- ~getPluginSettings() ⇒
Object|null - ~getCompactToggleInterval() ⇒
number - ~isNavbarEnabled() ⇒
boolean - ~showSystemUptime() ⇒
boolean - ~showOctoprintUptime() ⇒
boolean - ~isCompactDisplay() ⇒
boolean - ~displayFormat() ⇒
string - ~scheduleNext(intervalSeconds) ⇒
void - ~scheduleNextFromData(data) ⇒
void - ~renderCompactDisplay() ⇒
void - ~scheduleCompactToggle() ⇒
void - ~stopCompactToggleLoop() ⇒
void - ~updateNavbarTooltip(data, includeOctoprint) ⇒
void - ~fetchUptime() ⇒
void - ~getPluginSettings() ⇒
Object|null - ~getCompactToggleInterval() ⇒
number - ~isNavbarEnabled() ⇒
boolean - ~showSystemUptime() ⇒
boolean - ~showOctoprintUptime() ⇒
boolean - ~isCompactDisplay() ⇒
boolean - ~displayFormat() ⇒
string - ~scheduleNext(intervalSeconds) ⇒
void - ~scheduleNextFromData(data) ⇒
void - ~renderCompactDisplay() ⇒
void - ~scheduleCompactToggle() ⇒
void - ~stopCompactToggleLoop() ⇒
void - ~updateNavbarTooltip(data, includeOctoprint) ⇒
void - ~fetchUptime() ⇒
void
- ~getPluginSettings() ⇒
new NavbarUptimeViewModel(parameters)¶
NavbarUptimeViewModel
Displays the system uptime in the navbar and keeps it updated via polling.
| Param | Type | Description |
|---|---|---|
| parameters | Array |
ViewModel parameters (expects settingsViewModel). |
new NavbarUptimeViewModel(parameters)¶
NavbarUptimeViewModel
Displays the system uptime in the navbar and keeps it updated via polling.
| Param | Type | Description |
|---|---|---|
| parameters | Array |
ViewModel parameters (expects settingsViewModel). |
NavbarUptimeViewModel.onStartupComplete() ⇒ void¶
OctoPrint lifecycle hook - called once after all ViewModels have been bound and the settings are fully populated.
Polling is deliberately deferred to this hook instead of starting
immediately in the constructor, so that getPluginSettings() can
resolve the Knockout observables from settingsViewModel.settings
reliably on the very first call.
Kind: static method of NavbarUptimeViewModel
NavbarUptimeViewModel.onStartupComplete() ⇒ void¶
OctoPrint lifecycle hook - called once after all ViewModels have been bound and the settings are fully populated.
Polling is deliberately deferred to this hook instead of starting
immediately in the constructor, so that getPluginSettings() can
resolve the Knockout observables from settingsViewModel.settings
reliably on the very first call.
Kind: static method of NavbarUptimeViewModel
NavbarUptimeViewModel~getPluginSettings() ⇒ Object | null¶
Return the plugin-specific settings object (settings.plugins.octoprint_uptime).
Re-resolves on every call so that the ViewModel never holds a stale
reference captured before settingsViewModel.settings was ready.
Kind: inner method of NavbarUptimeViewModel
Returns: Object | null - The KO-mapped plugin settings node, or null when
unavailable (e.g. during early startup before settings are loaded).
NavbarUptimeViewModel~getCompactToggleInterval() ⇒ number¶
Return the configured compact toggle interval in seconds.
Reads compact_toggle_interval_seconds from plugin settings and validates
the result against the allowed range (5-60). Falls back to
DEFAULT_COMPACT_TOGGLE_INTERVAL when settings are unavailable or the
stored value is out of range.
Kind: inner method of NavbarUptimeViewModel
Returns: number - interval in seconds (integer, 5-60)
NavbarUptimeViewModel~isNavbarEnabled() ⇒ boolean¶
Determine whether the navbar widget should be visible.
Returns true when at least one of show_system_uptime or
show_octoprint_uptime is enabled in the plugin settings, or when
settings are not yet available (fail-safe: show by default).
Kind: inner method of NavbarUptimeViewModel
NavbarUptimeViewModel~showSystemUptime() ⇒ boolean¶
Check whether the system uptime entry should be shown.
Kind: inner method of NavbarUptimeViewModel
Returns: boolean - true when enabled, false otherwise
NavbarUptimeViewModel~showOctoprintUptime() ⇒ boolean¶
Check whether OctoPrint uptime should be shown alongside system uptime.
Kind: inner method of NavbarUptimeViewModel
Returns: boolean - true when enabled, false otherwise
NavbarUptimeViewModel~isCompactDisplay() ⇒ boolean¶
Check whether compact display mode is enabled. In compact mode, system and OctoPrint uptime alternate in the navbar instead of being shown side-by-side.
Kind: inner method of NavbarUptimeViewModel
Returns: boolean - true when compact display is enabled, false otherwise
NavbarUptimeViewModel~displayFormat() ⇒ string¶
Get the configured display format (fallback to "full").
Kind: inner method of NavbarUptimeViewModel
Returns: string - one of "full", "dhm", "dh", or "d"
NavbarUptimeViewModel~scheduleNext(intervalSeconds) ⇒ void¶
Schedule the next polling cycle.
Kind: inner method of NavbarUptimeViewModel
| Param | Type | Description |
|---|---|---|
| intervalSeconds | number |
seconds until next poll (clamped by caller) |
NavbarUptimeViewModel~scheduleNextFromData(data) ⇒ void¶
Schedule the next polling cycle using the poll interval from the last API
response. Falls back to the local setting or DEFAULT_POLL if the
response does not include poll_interval_seconds.
Kind: inner method of NavbarUptimeViewModel
| Param | Type | Description |
|---|---|---|
| data | Object | null |
The API response object, or null/undefined. |
NavbarUptimeViewModel~renderCompactDisplay() ⇒ void¶
Render the current frame of the compact display.
Reads compactDisplayUptimeType ("system" or "octoprint") and updates
uptimeDisplayText with the corresponding uptime string.
Kind: inner method of NavbarUptimeViewModel
NavbarUptimeViewModel~scheduleCompactToggle() ⇒ void¶
Schedule the compact display toggle timer.
Alternates compactDisplayUptimeType between "system" and "octoprint"
using the interval from getCompactToggleInterval() (reads the
compact_toggle_interval_seconds plugin setting on every cycle, 5-60 s).
No-ops if already scheduled.
Kind: inner method of NavbarUptimeViewModel
NavbarUptimeViewModel~stopCompactToggleLoop() ⇒ void¶
Cancel any pending compact toggle timer. Safe to call when no timer is active.
Kind: inner method of NavbarUptimeViewModel
NavbarUptimeViewModel~updateNavbarTooltip(data, includeOctoprint) ⇒ void¶
Update navbar anchor tooltip with localized start times. Keeps tooltip behavior identical across compact and non-compact display.
Kind: inner method of NavbarUptimeViewModel
| Param | Type | Description |
|---|---|---|
| data | Object |
API payload that may include uptime second counters. |
| includeOctoprint | boolean |
Whether to include OctoPrint start time. |
NavbarUptimeViewModel~fetchUptime() ⇒ void¶
Fetch uptime from the plugin API and update the navbar display and tooltip. Silently updates polling interval based on server or local settings.
Kind: inner method of NavbarUptimeViewModel
Example
// Expected API response (partial):
// {
// "seconds": 3600,
// "uptime": "1 hour",
// "uptime_dhm": "0d 1h 0m",
// "display_format": "dhm",
// "poll_interval_seconds": 5
// }
NavbarUptimeViewModel~getPluginSettings() ⇒ Object | null¶
Return the plugin-specific settings object (settings.plugins.octoprint_uptime).
Re-resolves on every call so that the ViewModel never holds a stale
reference captured before settingsViewModel.settings was ready.
Kind: inner method of NavbarUptimeViewModel
Returns: Object | null - The KO-mapped plugin settings node, or null when
unavailable (e.g. during early startup before settings are loaded).
NavbarUptimeViewModel~getCompactToggleInterval() ⇒ number¶
Return the configured compact toggle interval in seconds.
Reads compact_toggle_interval_seconds from plugin settings and validates
the result against the allowed range (5-60). Falls back to
DEFAULT_COMPACT_TOGGLE_INTERVAL when settings are unavailable or the
stored value is out of range.
Kind: inner method of NavbarUptimeViewModel
Returns: number - interval in seconds (integer, 5-60)
NavbarUptimeViewModel~isNavbarEnabled() ⇒ boolean¶
Determine whether the navbar widget should be visible.
Returns true when at least one of show_system_uptime or
show_octoprint_uptime is enabled in the plugin settings, or when
settings are not yet available (fail-safe: show by default).
Kind: inner method of NavbarUptimeViewModel
NavbarUptimeViewModel~showSystemUptime() ⇒ boolean¶
Check whether the system uptime entry should be shown.
Kind: inner method of NavbarUptimeViewModel
Returns: boolean - true when enabled, false otherwise
NavbarUptimeViewModel~showOctoprintUptime() ⇒ boolean¶
Check whether OctoPrint uptime should be shown alongside system uptime.
Kind: inner method of NavbarUptimeViewModel
Returns: boolean - true when enabled, false otherwise
NavbarUptimeViewModel~isCompactDisplay() ⇒ boolean¶
Check whether compact display mode is enabled. In compact mode, system and OctoPrint uptime alternate in the navbar instead of being shown side-by-side.
Kind: inner method of NavbarUptimeViewModel
Returns: boolean - true when compact display is enabled, false otherwise
NavbarUptimeViewModel~displayFormat() ⇒ string¶
Get the configured display format (fallback to "full").
Kind: inner method of NavbarUptimeViewModel
Returns: string - one of "full", "dhm", "dh", or "d"
NavbarUptimeViewModel~scheduleNext(intervalSeconds) ⇒ void¶
Schedule the next polling cycle.
Kind: inner method of NavbarUptimeViewModel
| Param | Type | Description |
|---|---|---|
| intervalSeconds | number |
seconds until next poll (clamped by caller) |
NavbarUptimeViewModel~scheduleNextFromData(data) ⇒ void¶
Schedule the next polling cycle using the poll interval from the last API
response. Falls back to the local setting or DEFAULT_POLL if the
response does not include poll_interval_seconds.
Kind: inner method of NavbarUptimeViewModel
| Param | Type | Description |
|---|---|---|
| data | Object | null |
The API response object, or null/undefined. |
NavbarUptimeViewModel~renderCompactDisplay() ⇒ void¶
Render the current frame of the compact display.
Reads compactDisplayUptimeType ("system" or "octoprint") and updates
uptimeDisplayText with the corresponding uptime string.
Kind: inner method of NavbarUptimeViewModel
NavbarUptimeViewModel~scheduleCompactToggle() ⇒ void¶
Schedule the compact display toggle timer.
Alternates compactDisplayUptimeType between "system" and "octoprint"
using the interval from getCompactToggleInterval() (reads the
compact_toggle_interval_seconds plugin setting on every cycle, 5-60 s).
No-ops if already scheduled.
Kind: inner method of NavbarUptimeViewModel
NavbarUptimeViewModel~stopCompactToggleLoop() ⇒ void¶
Cancel any pending compact toggle timer. Safe to call when no timer is active.
Kind: inner method of NavbarUptimeViewModel
NavbarUptimeViewModel~updateNavbarTooltip(data, includeOctoprint) ⇒ void¶
Update navbar anchor tooltip with localized start times. Keeps tooltip behavior identical across compact and non-compact display.
Kind: inner method of NavbarUptimeViewModel
| Param | Type | Description |
|---|---|---|
| data | Object |
API payload that may include uptime second counters. |
| includeOctoprint | boolean |
Whether to include OctoPrint start time. |
NavbarUptimeViewModel~fetchUptime() ⇒ void¶
Fetch uptime from the plugin API and update the navbar display and tooltip. Silently updates polling interval based on server or local settings.
Kind: inner method of NavbarUptimeViewModel
Example
// Expected API response (partial):
// {
// "seconds": 3600,
// "uptime": "1 hour",
// "uptime_dhm": "0d 1h 0m",
// "display_format": "dhm",
// "poll_interval_seconds": 5
// }
octoprint_uptime/navbar¶
Frontend module for the navbar uptime widget.
- octoprint_uptime/navbar
- .NavbarUptimeViewModel
- new NavbarUptimeViewModel(parameters)
- new NavbarUptimeViewModel(parameters)
- static
- .onStartupComplete() ⇒
void - .onStartupComplete() ⇒
void
- .onStartupComplete() ⇒
- inner
- ~getPluginSettings() ⇒
Object|null - ~getCompactToggleInterval() ⇒
number - ~isNavbarEnabled() ⇒
boolean - ~showSystemUptime() ⇒
boolean - ~showOctoprintUptime() ⇒
boolean - ~isCompactDisplay() ⇒
boolean - ~displayFormat() ⇒
string - ~scheduleNext(intervalSeconds) ⇒
void - ~scheduleNextFromData(data) ⇒
void - ~renderCompactDisplay() ⇒
void - ~scheduleCompactToggle() ⇒
void - ~stopCompactToggleLoop() ⇒
void - ~updateNavbarTooltip(data, includeOctoprint) ⇒
void - ~fetchUptime() ⇒
void - ~getPluginSettings() ⇒
Object|null - ~getCompactToggleInterval() ⇒
number - ~isNavbarEnabled() ⇒
boolean - ~showSystemUptime() ⇒
boolean - ~showOctoprintUptime() ⇒
boolean - ~isCompactDisplay() ⇒
boolean - ~displayFormat() ⇒
string - ~scheduleNext(intervalSeconds) ⇒
void - ~scheduleNextFromData(data) ⇒
void - ~renderCompactDisplay() ⇒
void - ~scheduleCompactToggle() ⇒
void - ~stopCompactToggleLoop() ⇒
void - ~updateNavbarTooltip(data, includeOctoprint) ⇒
void - ~fetchUptime() ⇒
void
- ~getPluginSettings() ⇒
- .NavbarUptimeViewModel
- new NavbarUptimeViewModel(parameters)
- new NavbarUptimeViewModel(parameters)
- static
- .onStartupComplete() ⇒
void - .onStartupComplete() ⇒
void
- .onStartupComplete() ⇒
- inner
- ~getPluginSettings() ⇒
Object|null - ~getCompactToggleInterval() ⇒
number - ~isNavbarEnabled() ⇒
boolean - ~showSystemUptime() ⇒
boolean - ~showOctoprintUptime() ⇒
boolean - ~isCompactDisplay() ⇒
boolean - ~displayFormat() ⇒
string - ~scheduleNext(intervalSeconds) ⇒
void - ~scheduleNextFromData(data) ⇒
void - ~renderCompactDisplay() ⇒
void - ~scheduleCompactToggle() ⇒
void - ~stopCompactToggleLoop() ⇒
void - ~updateNavbarTooltip(data, includeOctoprint) ⇒
void - ~fetchUptime() ⇒
void - ~getPluginSettings() ⇒
Object|null - ~getCompactToggleInterval() ⇒
number - ~isNavbarEnabled() ⇒
boolean - ~showSystemUptime() ⇒
boolean - ~showOctoprintUptime() ⇒
boolean - ~isCompactDisplay() ⇒
boolean - ~displayFormat() ⇒
string - ~scheduleNext(intervalSeconds) ⇒
void - ~scheduleNextFromData(data) ⇒
void - ~renderCompactDisplay() ⇒
void - ~scheduleCompactToggle() ⇒
void - ~stopCompactToggleLoop() ⇒
void - ~updateNavbarTooltip(data, includeOctoprint) ⇒
void - ~fetchUptime() ⇒
void
- ~getPluginSettings() ⇒
- .NavbarUptimeViewModel
octoprint_uptime/navbar.NavbarUptimeViewModel¶
Kind: static class of octoprint_uptime/navbar
- .NavbarUptimeViewModel
- new NavbarUptimeViewModel(parameters)
- new NavbarUptimeViewModel(parameters)
- static
- .onStartupComplete() ⇒
void - .onStartupComplete() ⇒
void
- .onStartupComplete() ⇒
- inner
- ~getPluginSettings() ⇒
Object|null - ~getCompactToggleInterval() ⇒
number - ~isNavbarEnabled() ⇒
boolean - ~showSystemUptime() ⇒
boolean - ~showOctoprintUptime() ⇒
boolean - ~isCompactDisplay() ⇒
boolean - ~displayFormat() ⇒
string - ~scheduleNext(intervalSeconds) ⇒
void - ~scheduleNextFromData(data) ⇒
void - ~renderCompactDisplay() ⇒
void - ~scheduleCompactToggle() ⇒
void - ~stopCompactToggleLoop() ⇒
void - ~updateNavbarTooltip(data, includeOctoprint) ⇒
void - ~fetchUptime() ⇒
void - ~getPluginSettings() ⇒
Object|null - ~getCompactToggleInterval() ⇒
number - ~isNavbarEnabled() ⇒
boolean - ~showSystemUptime() ⇒
boolean - ~showOctoprintUptime() ⇒
boolean - ~isCompactDisplay() ⇒
boolean - ~displayFormat() ⇒
string - ~scheduleNext(intervalSeconds) ⇒
void - ~scheduleNextFromData(data) ⇒
void - ~renderCompactDisplay() ⇒
void - ~scheduleCompactToggle() ⇒
void - ~stopCompactToggleLoop() ⇒
void - ~updateNavbarTooltip(data, includeOctoprint) ⇒
void - ~fetchUptime() ⇒
void
- ~getPluginSettings() ⇒
new NavbarUptimeViewModel(parameters)¶
NavbarUptimeViewModel
Displays the system uptime in the navbar and keeps it updated via polling.
| Param | Type | Description |
|---|---|---|
| parameters | Array |
ViewModel parameters (expects settingsViewModel). |
new NavbarUptimeViewModel(parameters)¶
NavbarUptimeViewModel
Displays the system uptime in the navbar and keeps it updated via polling.
| Param | Type | Description |
|---|---|---|
| parameters | Array |
ViewModel parameters (expects settingsViewModel). |
NavbarUptimeViewModel.onStartupComplete() ⇒ void¶
OctoPrint lifecycle hook - called once after all ViewModels have been bound and the settings are fully populated.
Polling is deliberately deferred to this hook instead of starting
immediately in the constructor, so that getPluginSettings() can
resolve the Knockout observables from settingsViewModel.settings
reliably on the very first call.
Kind: static method of NavbarUptimeViewModel
NavbarUptimeViewModel.onStartupComplete() ⇒ void¶
OctoPrint lifecycle hook - called once after all ViewModels have been bound and the settings are fully populated.
Polling is deliberately deferred to this hook instead of starting
immediately in the constructor, so that getPluginSettings() can
resolve the Knockout observables from settingsViewModel.settings
reliably on the very first call.
Kind: static method of NavbarUptimeViewModel
NavbarUptimeViewModel~getPluginSettings() ⇒ Object | null¶
Return the plugin-specific settings object (settings.plugins.octoprint_uptime).
Re-resolves on every call so that the ViewModel never holds a stale
reference captured before settingsViewModel.settings was ready.
Kind: inner method of NavbarUptimeViewModel
Returns: Object | null - The KO-mapped plugin settings node, or null when
unavailable (e.g. during early startup before settings are loaded).
NavbarUptimeViewModel~getCompactToggleInterval() ⇒ number¶
Return the configured compact toggle interval in seconds.
Reads compact_toggle_interval_seconds from plugin settings and validates
the result against the allowed range (5-60). Falls back to
DEFAULT_COMPACT_TOGGLE_INTERVAL when settings are unavailable or the
stored value is out of range.
Kind: inner method of NavbarUptimeViewModel
Returns: number - interval in seconds (integer, 5-60)
NavbarUptimeViewModel~isNavbarEnabled() ⇒ boolean¶
Determine whether the navbar widget should be visible.
Returns true when at least one of show_system_uptime or
show_octoprint_uptime is enabled in the plugin settings, or when
settings are not yet available (fail-safe: show by default).
Kind: inner method of NavbarUptimeViewModel
NavbarUptimeViewModel~showSystemUptime() ⇒ boolean¶
Check whether the system uptime entry should be shown.
Kind: inner method of NavbarUptimeViewModel
Returns: boolean - true when enabled, false otherwise
NavbarUptimeViewModel~showOctoprintUptime() ⇒ boolean¶
Check whether OctoPrint uptime should be shown alongside system uptime.
Kind: inner method of NavbarUptimeViewModel
Returns: boolean - true when enabled, false otherwise
NavbarUptimeViewModel~isCompactDisplay() ⇒ boolean¶
Check whether compact display mode is enabled. In compact mode, system and OctoPrint uptime alternate in the navbar instead of being shown side-by-side.
Kind: inner method of NavbarUptimeViewModel
Returns: boolean - true when compact display is enabled, false otherwise
NavbarUptimeViewModel~displayFormat() ⇒ string¶
Get the configured display format (fallback to "full").
Kind: inner method of NavbarUptimeViewModel
Returns: string - one of "full", "dhm", "dh", or "d"
NavbarUptimeViewModel~scheduleNext(intervalSeconds) ⇒ void¶
Schedule the next polling cycle.
Kind: inner method of NavbarUptimeViewModel
| Param | Type | Description |
|---|---|---|
| intervalSeconds | number |
seconds until next poll (clamped by caller) |
NavbarUptimeViewModel~scheduleNextFromData(data) ⇒ void¶
Schedule the next polling cycle using the poll interval from the last API
response. Falls back to the local setting or DEFAULT_POLL if the
response does not include poll_interval_seconds.
Kind: inner method of NavbarUptimeViewModel
| Param | Type | Description |
|---|---|---|
| data | Object | null |
The API response object, or null/undefined. |
NavbarUptimeViewModel~renderCompactDisplay() ⇒ void¶
Render the current frame of the compact display.
Reads compactDisplayUptimeType ("system" or "octoprint") and updates
uptimeDisplayText with the corresponding uptime string.
Kind: inner method of NavbarUptimeViewModel
NavbarUptimeViewModel~scheduleCompactToggle() ⇒ void¶
Schedule the compact display toggle timer.
Alternates compactDisplayUptimeType between "system" and "octoprint"
using the interval from getCompactToggleInterval() (reads the
compact_toggle_interval_seconds plugin setting on every cycle, 5-60 s).
No-ops if already scheduled.
Kind: inner method of NavbarUptimeViewModel
NavbarUptimeViewModel~stopCompactToggleLoop() ⇒ void¶
Cancel any pending compact toggle timer. Safe to call when no timer is active.
Kind: inner method of NavbarUptimeViewModel
NavbarUptimeViewModel~updateNavbarTooltip(data, includeOctoprint) ⇒ void¶
Update navbar anchor tooltip with localized start times. Keeps tooltip behavior identical across compact and non-compact display.
Kind: inner method of NavbarUptimeViewModel
| Param | Type | Description |
|---|---|---|
| data | Object |
API payload that may include uptime second counters. |
| includeOctoprint | boolean |
Whether to include OctoPrint start time. |
NavbarUptimeViewModel~fetchUptime() ⇒ void¶
Fetch uptime from the plugin API and update the navbar display and tooltip. Silently updates polling interval based on server or local settings.
Kind: inner method of NavbarUptimeViewModel
Example
// Expected API response (partial):
// {
// "seconds": 3600,
// "uptime": "1 hour",
// "uptime_dhm": "0d 1h 0m",
// "display_format": "dhm",
// "poll_interval_seconds": 5
// }
NavbarUptimeViewModel~getPluginSettings() ⇒ Object | null¶
Return the plugin-specific settings object (settings.plugins.octoprint_uptime).
Re-resolves on every call so that the ViewModel never holds a stale
reference captured before settingsViewModel.settings was ready.
Kind: inner method of NavbarUptimeViewModel
Returns: Object | null - The KO-mapped plugin settings node, or null when
unavailable (e.g. during early startup before settings are loaded).
NavbarUptimeViewModel~getCompactToggleInterval() ⇒ number¶
Return the configured compact toggle interval in seconds.
Reads compact_toggle_interval_seconds from plugin settings and validates
the result against the allowed range (5-60). Falls back to
DEFAULT_COMPACT_TOGGLE_INTERVAL when settings are unavailable or the
stored value is out of range.
Kind: inner method of NavbarUptimeViewModel
Returns: number - interval in seconds (integer, 5-60)
NavbarUptimeViewModel~isNavbarEnabled() ⇒ boolean¶
Determine whether the navbar widget should be visible.
Returns true when at least one of show_system_uptime or
show_octoprint_uptime is enabled in the plugin settings, or when
settings are not yet available (fail-safe: show by default).
Kind: inner method of NavbarUptimeViewModel
NavbarUptimeViewModel~showSystemUptime() ⇒ boolean¶
Check whether the system uptime entry should be shown.
Kind: inner method of NavbarUptimeViewModel
Returns: boolean - true when enabled, false otherwise
NavbarUptimeViewModel~showOctoprintUptime() ⇒ boolean¶
Check whether OctoPrint uptime should be shown alongside system uptime.
Kind: inner method of NavbarUptimeViewModel
Returns: boolean - true when enabled, false otherwise
NavbarUptimeViewModel~isCompactDisplay() ⇒ boolean¶
Check whether compact display mode is enabled. In compact mode, system and OctoPrint uptime alternate in the navbar instead of being shown side-by-side.
Kind: inner method of NavbarUptimeViewModel
Returns: boolean - true when compact display is enabled, false otherwise
NavbarUptimeViewModel~displayFormat() ⇒ string¶
Get the configured display format (fallback to "full").
Kind: inner method of NavbarUptimeViewModel
Returns: string - one of "full", "dhm", "dh", or "d"
NavbarUptimeViewModel~scheduleNext(intervalSeconds) ⇒ void¶
Schedule the next polling cycle.
Kind: inner method of NavbarUptimeViewModel
| Param | Type | Description |
|---|---|---|
| intervalSeconds | number |
seconds until next poll (clamped by caller) |
NavbarUptimeViewModel~scheduleNextFromData(data) ⇒ void¶
Schedule the next polling cycle using the poll interval from the last API
response. Falls back to the local setting or DEFAULT_POLL if the
response does not include poll_interval_seconds.
Kind: inner method of NavbarUptimeViewModel
| Param | Type | Description |
|---|---|---|
| data | Object | null |
The API response object, or null/undefined. |
NavbarUptimeViewModel~renderCompactDisplay() ⇒ void¶
Render the current frame of the compact display.
Reads compactDisplayUptimeType ("system" or "octoprint") and updates
uptimeDisplayText with the corresponding uptime string.
Kind: inner method of NavbarUptimeViewModel
NavbarUptimeViewModel~scheduleCompactToggle() ⇒ void¶
Schedule the compact display toggle timer.
Alternates compactDisplayUptimeType between "system" and "octoprint"
using the interval from getCompactToggleInterval() (reads the
compact_toggle_interval_seconds plugin setting on every cycle, 5-60 s).
No-ops if already scheduled.
Kind: inner method of NavbarUptimeViewModel
NavbarUptimeViewModel~stopCompactToggleLoop() ⇒ void¶
Cancel any pending compact toggle timer. Safe to call when no timer is active.
Kind: inner method of NavbarUptimeViewModel
NavbarUptimeViewModel~updateNavbarTooltip(data, includeOctoprint) ⇒ void¶
Update navbar anchor tooltip with localized start times. Keeps tooltip behavior identical across compact and non-compact display.
Kind: inner method of NavbarUptimeViewModel
| Param | Type | Description |
|---|---|---|
| data | Object |
API payload that may include uptime second counters. |
| includeOctoprint | boolean |
Whether to include OctoPrint start time. |
NavbarUptimeViewModel~fetchUptime() ⇒ void¶
Fetch uptime from the plugin API and update the navbar display and tooltip. Silently updates polling interval based on server or local settings.
Kind: inner method of NavbarUptimeViewModel
Example
// Expected API response (partial):
// {
// "seconds": 3600,
// "uptime": "1 hour",
// "uptime_dhm": "0d 1h 0m",
// "display_format": "dhm",
// "poll_interval_seconds": 5
// }
octoprint_uptime/navbar.NavbarUptimeViewModel¶
Kind: static class of octoprint_uptime/navbar
- .NavbarUptimeViewModel
- new NavbarUptimeViewModel(parameters)
- new NavbarUptimeViewModel(parameters)
- static
- .onStartupComplete() ⇒
void - .onStartupComplete() ⇒
void
- .onStartupComplete() ⇒
- inner
- ~getPluginSettings() ⇒
Object|null - ~getCompactToggleInterval() ⇒
number - ~isNavbarEnabled() ⇒
boolean - ~showSystemUptime() ⇒
boolean - ~showOctoprintUptime() ⇒
boolean - ~isCompactDisplay() ⇒
boolean - ~displayFormat() ⇒
string - ~scheduleNext(intervalSeconds) ⇒
void - ~scheduleNextFromData(data) ⇒
void - ~renderCompactDisplay() ⇒
void - ~scheduleCompactToggle() ⇒
void - ~stopCompactToggleLoop() ⇒
void - ~updateNavbarTooltip(data, includeOctoprint) ⇒
void - ~fetchUptime() ⇒
void - ~getPluginSettings() ⇒
Object|null - ~getCompactToggleInterval() ⇒
number - ~isNavbarEnabled() ⇒
boolean - ~showSystemUptime() ⇒
boolean - ~showOctoprintUptime() ⇒
boolean - ~isCompactDisplay() ⇒
boolean - ~displayFormat() ⇒
string - ~scheduleNext(intervalSeconds) ⇒
void - ~scheduleNextFromData(data) ⇒
void - ~renderCompactDisplay() ⇒
void - ~scheduleCompactToggle() ⇒
void - ~stopCompactToggleLoop() ⇒
void - ~updateNavbarTooltip(data, includeOctoprint) ⇒
void - ~fetchUptime() ⇒
void
- ~getPluginSettings() ⇒
new NavbarUptimeViewModel(parameters)¶
NavbarUptimeViewModel
Displays the system uptime in the navbar and keeps it updated via polling.
| Param | Type | Description |
|---|---|---|
| parameters | Array |
ViewModel parameters (expects settingsViewModel). |
new NavbarUptimeViewModel(parameters)¶
NavbarUptimeViewModel
Displays the system uptime in the navbar and keeps it updated via polling.
| Param | Type | Description |
|---|---|---|
| parameters | Array |
ViewModel parameters (expects settingsViewModel). |
NavbarUptimeViewModel.onStartupComplete() ⇒ void¶
OctoPrint lifecycle hook - called once after all ViewModels have been bound and the settings are fully populated.
Polling is deliberately deferred to this hook instead of starting
immediately in the constructor, so that getPluginSettings() can
resolve the Knockout observables from settingsViewModel.settings
reliably on the very first call.
Kind: static method of NavbarUptimeViewModel
NavbarUptimeViewModel.onStartupComplete() ⇒ void¶
OctoPrint lifecycle hook - called once after all ViewModels have been bound and the settings are fully populated.
Polling is deliberately deferred to this hook instead of starting
immediately in the constructor, so that getPluginSettings() can
resolve the Knockout observables from settingsViewModel.settings
reliably on the very first call.
Kind: static method of NavbarUptimeViewModel
NavbarUptimeViewModel~getPluginSettings() ⇒ Object | null¶
Return the plugin-specific settings object (settings.plugins.octoprint_uptime).
Re-resolves on every call so that the ViewModel never holds a stale
reference captured before settingsViewModel.settings was ready.
Kind: inner method of NavbarUptimeViewModel
Returns: Object | null - The KO-mapped plugin settings node, or null when
unavailable (e.g. during early startup before settings are loaded).
NavbarUptimeViewModel~getCompactToggleInterval() ⇒ number¶
Return the configured compact toggle interval in seconds.
Reads compact_toggle_interval_seconds from plugin settings and validates
the result against the allowed range (5-60). Falls back to
DEFAULT_COMPACT_TOGGLE_INTERVAL when settings are unavailable or the
stored value is out of range.
Kind: inner method of NavbarUptimeViewModel
Returns: number - interval in seconds (integer, 5-60)
NavbarUptimeViewModel~isNavbarEnabled() ⇒ boolean¶
Determine whether the navbar widget should be visible.
Returns true when at least one of show_system_uptime or
show_octoprint_uptime is enabled in the plugin settings, or when
settings are not yet available (fail-safe: show by default).
Kind: inner method of NavbarUptimeViewModel
NavbarUptimeViewModel~showSystemUptime() ⇒ boolean¶
Check whether the system uptime entry should be shown.
Kind: inner method of NavbarUptimeViewModel
Returns: boolean - true when enabled, false otherwise
NavbarUptimeViewModel~showOctoprintUptime() ⇒ boolean¶
Check whether OctoPrint uptime should be shown alongside system uptime.
Kind: inner method of NavbarUptimeViewModel
Returns: boolean - true when enabled, false otherwise
NavbarUptimeViewModel~isCompactDisplay() ⇒ boolean¶
Check whether compact display mode is enabled. In compact mode, system and OctoPrint uptime alternate in the navbar instead of being shown side-by-side.
Kind: inner method of NavbarUptimeViewModel
Returns: boolean - true when compact display is enabled, false otherwise
NavbarUptimeViewModel~displayFormat() ⇒ string¶
Get the configured display format (fallback to "full").
Kind: inner method of NavbarUptimeViewModel
Returns: string - one of "full", "dhm", "dh", or "d"
NavbarUptimeViewModel~scheduleNext(intervalSeconds) ⇒ void¶
Schedule the next polling cycle.
Kind: inner method of NavbarUptimeViewModel
| Param | Type | Description |
|---|---|---|
| intervalSeconds | number |
seconds until next poll (clamped by caller) |
NavbarUptimeViewModel~scheduleNextFromData(data) ⇒ void¶
Schedule the next polling cycle using the poll interval from the last API
response. Falls back to the local setting or DEFAULT_POLL if the
response does not include poll_interval_seconds.
Kind: inner method of NavbarUptimeViewModel
| Param | Type | Description |
|---|---|---|
| data | Object | null |
The API response object, or null/undefined. |
NavbarUptimeViewModel~renderCompactDisplay() ⇒ void¶
Render the current frame of the compact display.
Reads compactDisplayUptimeType ("system" or "octoprint") and updates
uptimeDisplayText with the corresponding uptime string.
Kind: inner method of NavbarUptimeViewModel
NavbarUptimeViewModel~scheduleCompactToggle() ⇒ void¶
Schedule the compact display toggle timer.
Alternates compactDisplayUptimeType between "system" and "octoprint"
using the interval from getCompactToggleInterval() (reads the
compact_toggle_interval_seconds plugin setting on every cycle, 5-60 s).
No-ops if already scheduled.
Kind: inner method of NavbarUptimeViewModel
NavbarUptimeViewModel~stopCompactToggleLoop() ⇒ void¶
Cancel any pending compact toggle timer. Safe to call when no timer is active.
Kind: inner method of NavbarUptimeViewModel
NavbarUptimeViewModel~updateNavbarTooltip(data, includeOctoprint) ⇒ void¶
Update navbar anchor tooltip with localized start times. Keeps tooltip behavior identical across compact and non-compact display.
Kind: inner method of NavbarUptimeViewModel
| Param | Type | Description |
|---|---|---|
| data | Object |
API payload that may include uptime second counters. |
| includeOctoprint | boolean |
Whether to include OctoPrint start time. |
NavbarUptimeViewModel~fetchUptime() ⇒ void¶
Fetch uptime from the plugin API and update the navbar display and tooltip. Silently updates polling interval based on server or local settings.
Kind: inner method of NavbarUptimeViewModel
Example
// Expected API response (partial):
// {
// "seconds": 3600,
// "uptime": "1 hour",
// "uptime_dhm": "0d 1h 0m",
// "display_format": "dhm",
// "poll_interval_seconds": 5
// }
NavbarUptimeViewModel~getPluginSettings() ⇒ Object | null¶
Return the plugin-specific settings object (settings.plugins.octoprint_uptime).
Re-resolves on every call so that the ViewModel never holds a stale
reference captured before settingsViewModel.settings was ready.
Kind: inner method of NavbarUptimeViewModel
Returns: Object | null - The KO-mapped plugin settings node, or null when
unavailable (e.g. during early startup before settings are loaded).
NavbarUptimeViewModel~getCompactToggleInterval() ⇒ number¶
Return the configured compact toggle interval in seconds.
Reads compact_toggle_interval_seconds from plugin settings and validates
the result against the allowed range (5-60). Falls back to
DEFAULT_COMPACT_TOGGLE_INTERVAL when settings are unavailable or the
stored value is out of range.
Kind: inner method of NavbarUptimeViewModel
Returns: number - interval in seconds (integer, 5-60)
NavbarUptimeViewModel~isNavbarEnabled() ⇒ boolean¶
Determine whether the navbar widget should be visible.
Returns true when at least one of show_system_uptime or
show_octoprint_uptime is enabled in the plugin settings, or when
settings are not yet available (fail-safe: show by default).
Kind: inner method of NavbarUptimeViewModel
NavbarUptimeViewModel~showSystemUptime() ⇒ boolean¶
Check whether the system uptime entry should be shown.
Kind: inner method of NavbarUptimeViewModel
Returns: boolean - true when enabled, false otherwise
NavbarUptimeViewModel~showOctoprintUptime() ⇒ boolean¶
Check whether OctoPrint uptime should be shown alongside system uptime.
Kind: inner method of NavbarUptimeViewModel
Returns: boolean - true when enabled, false otherwise
NavbarUptimeViewModel~isCompactDisplay() ⇒ boolean¶
Check whether compact display mode is enabled. In compact mode, system and OctoPrint uptime alternate in the navbar instead of being shown side-by-side.
Kind: inner method of NavbarUptimeViewModel
Returns: boolean - true when compact display is enabled, false otherwise
NavbarUptimeViewModel~displayFormat() ⇒ string¶
Get the configured display format (fallback to "full").
Kind: inner method of NavbarUptimeViewModel
Returns: string - one of "full", "dhm", "dh", or "d"
NavbarUptimeViewModel~scheduleNext(intervalSeconds) ⇒ void¶
Schedule the next polling cycle.
Kind: inner method of NavbarUptimeViewModel
| Param | Type | Description |
|---|---|---|
| intervalSeconds | number |
seconds until next poll (clamped by caller) |
NavbarUptimeViewModel~scheduleNextFromData(data) ⇒ void¶
Schedule the next polling cycle using the poll interval from the last API
response. Falls back to the local setting or DEFAULT_POLL if the
response does not include poll_interval_seconds.
Kind: inner method of NavbarUptimeViewModel
| Param | Type | Description |
|---|---|---|
| data | Object | null |
The API response object, or null/undefined. |
NavbarUptimeViewModel~renderCompactDisplay() ⇒ void¶
Render the current frame of the compact display.
Reads compactDisplayUptimeType ("system" or "octoprint") and updates
uptimeDisplayText with the corresponding uptime string.
Kind: inner method of NavbarUptimeViewModel
NavbarUptimeViewModel~scheduleCompactToggle() ⇒ void¶
Schedule the compact display toggle timer.
Alternates compactDisplayUptimeType between "system" and "octoprint"
using the interval from getCompactToggleInterval() (reads the
compact_toggle_interval_seconds plugin setting on every cycle, 5-60 s).
No-ops if already scheduled.
Kind: inner method of NavbarUptimeViewModel
NavbarUptimeViewModel~stopCompactToggleLoop() ⇒ void¶
Cancel any pending compact toggle timer. Safe to call when no timer is active.
Kind: inner method of NavbarUptimeViewModel
NavbarUptimeViewModel~updateNavbarTooltip(data, includeOctoprint) ⇒ void¶
Update navbar anchor tooltip with localized start times. Keeps tooltip behavior identical across compact and non-compact display.
Kind: inner method of NavbarUptimeViewModel
| Param | Type | Description |
|---|---|---|
| data | Object |
API payload that may include uptime second counters. |
| includeOctoprint | boolean |
Whether to include OctoPrint start time. |
NavbarUptimeViewModel~fetchUptime() ⇒ void¶
Fetch uptime from the plugin API and update the navbar display and tooltip. Silently updates polling interval based on server or local settings.
Kind: inner method of NavbarUptimeViewModel
Example
// Expected API response (partial):
// {
// "seconds": 3600,
// "uptime": "1 hour",
// "uptime_dhm": "0d 1h 0m",
// "display_format": "dhm",
// "poll_interval_seconds": 5
// }