Skip to content

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

Kind: static class of octoprint_uptime/navbar

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).

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

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

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).

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)

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

Check whether the system uptime entry should be shown.

Kind: inner method of NavbarUptimeViewModel Returns: boolean - true when enabled, false otherwise

Check whether OctoPrint uptime should be shown alongside system uptime.

Kind: inner method of NavbarUptimeViewModel Returns: boolean - true when enabled, false otherwise

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

Get the configured display format (fallback to "full").

Kind: inner method of NavbarUptimeViewModel Returns: string - one of "full", "dhm", "dh", or "d"

Schedule the next polling cycle.

Kind: inner method of NavbarUptimeViewModel

Param Type Description
intervalSeconds number seconds until next poll (clamped by caller)

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.

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

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

Cancel any pending compact toggle timer. Safe to call when no timer is active.

Kind: inner method of NavbarUptimeViewModel

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.

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
// }

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).

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)

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

Check whether the system uptime entry should be shown.

Kind: inner method of NavbarUptimeViewModel Returns: boolean - true when enabled, false otherwise

Check whether OctoPrint uptime should be shown alongside system uptime.

Kind: inner method of NavbarUptimeViewModel Returns: boolean - true when enabled, false otherwise

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

Get the configured display format (fallback to "full").

Kind: inner method of NavbarUptimeViewModel Returns: string - one of "full", "dhm", "dh", or "d"

Schedule the next polling cycle.

Kind: inner method of NavbarUptimeViewModel

Param Type Description
intervalSeconds number seconds until next poll (clamped by caller)

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.

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

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

Cancel any pending compact toggle timer. Safe to call when no timer is active.

Kind: inner method of NavbarUptimeViewModel

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.

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

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).

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

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

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).

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)

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

Check whether the system uptime entry should be shown.

Kind: inner method of NavbarUptimeViewModel Returns: boolean - true when enabled, false otherwise

Check whether OctoPrint uptime should be shown alongside system uptime.

Kind: inner method of NavbarUptimeViewModel Returns: boolean - true when enabled, false otherwise

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

Get the configured display format (fallback to "full").

Kind: inner method of NavbarUptimeViewModel Returns: string - one of "full", "dhm", "dh", or "d"

Schedule the next polling cycle.

Kind: inner method of NavbarUptimeViewModel

Param Type Description
intervalSeconds number seconds until next poll (clamped by caller)

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.

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

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

Cancel any pending compact toggle timer. Safe to call when no timer is active.

Kind: inner method of NavbarUptimeViewModel

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.

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
// }

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).

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)

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

Check whether the system uptime entry should be shown.

Kind: inner method of NavbarUptimeViewModel Returns: boolean - true when enabled, false otherwise

Check whether OctoPrint uptime should be shown alongside system uptime.

Kind: inner method of NavbarUptimeViewModel Returns: boolean - true when enabled, false otherwise

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

Get the configured display format (fallback to "full").

Kind: inner method of NavbarUptimeViewModel Returns: string - one of "full", "dhm", "dh", or "d"

Schedule the next polling cycle.

Kind: inner method of NavbarUptimeViewModel

Param Type Description
intervalSeconds number seconds until next poll (clamped by caller)

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.

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

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

Cancel any pending compact toggle timer. Safe to call when no timer is active.

Kind: inner method of NavbarUptimeViewModel

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.

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

Kind: static class of octoprint_uptime/navbar

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).

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

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

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).

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)

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

Check whether the system uptime entry should be shown.

Kind: inner method of NavbarUptimeViewModel Returns: boolean - true when enabled, false otherwise

Check whether OctoPrint uptime should be shown alongside system uptime.

Kind: inner method of NavbarUptimeViewModel Returns: boolean - true when enabled, false otherwise

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

Get the configured display format (fallback to "full").

Kind: inner method of NavbarUptimeViewModel Returns: string - one of "full", "dhm", "dh", or "d"

Schedule the next polling cycle.

Kind: inner method of NavbarUptimeViewModel

Param Type Description
intervalSeconds number seconds until next poll (clamped by caller)

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.

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

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

Cancel any pending compact toggle timer. Safe to call when no timer is active.

Kind: inner method of NavbarUptimeViewModel

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.

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
// }

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).

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)

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

Check whether the system uptime entry should be shown.

Kind: inner method of NavbarUptimeViewModel Returns: boolean - true when enabled, false otherwise

Check whether OctoPrint uptime should be shown alongside system uptime.

Kind: inner method of NavbarUptimeViewModel Returns: boolean - true when enabled, false otherwise

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

Get the configured display format (fallback to "full").

Kind: inner method of NavbarUptimeViewModel Returns: string - one of "full", "dhm", "dh", or "d"

Schedule the next polling cycle.

Kind: inner method of NavbarUptimeViewModel

Param Type Description
intervalSeconds number seconds until next poll (clamped by caller)

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.

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

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

Cancel any pending compact toggle timer. Safe to call when no timer is active.

Kind: inner method of NavbarUptimeViewModel

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.

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

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).

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

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

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).

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)

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

Check whether the system uptime entry should be shown.

Kind: inner method of NavbarUptimeViewModel Returns: boolean - true when enabled, false otherwise

Check whether OctoPrint uptime should be shown alongside system uptime.

Kind: inner method of NavbarUptimeViewModel Returns: boolean - true when enabled, false otherwise

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

Get the configured display format (fallback to "full").

Kind: inner method of NavbarUptimeViewModel Returns: string - one of "full", "dhm", "dh", or "d"

Schedule the next polling cycle.

Kind: inner method of NavbarUptimeViewModel

Param Type Description
intervalSeconds number seconds until next poll (clamped by caller)

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.

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

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

Cancel any pending compact toggle timer. Safe to call when no timer is active.

Kind: inner method of NavbarUptimeViewModel

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.

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
// }

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).

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)

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

Check whether the system uptime entry should be shown.

Kind: inner method of NavbarUptimeViewModel Returns: boolean - true when enabled, false otherwise

Check whether OctoPrint uptime should be shown alongside system uptime.

Kind: inner method of NavbarUptimeViewModel Returns: boolean - true when enabled, false otherwise

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

Get the configured display format (fallback to "full").

Kind: inner method of NavbarUptimeViewModel Returns: string - one of "full", "dhm", "dh", or "d"

Schedule the next polling cycle.

Kind: inner method of NavbarUptimeViewModel

Param Type Description
intervalSeconds number seconds until next poll (clamped by caller)

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.

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

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

Cancel any pending compact toggle timer. Safe to call when no timer is active.

Kind: inner method of NavbarUptimeViewModel

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.

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
// }