viewmodels

package
v1.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 10, 2025 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package viewmodels provides view models for the web UI templates.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExtractOSInfo

func ExtractOSInfo(device *gitmdm.Device) (osName, version string)

ExtractOSInfo extracts OS name and version from system_info check output.

Types

type CheckResult

type CheckResult struct {
	Status      string
	Reason      string
	Emoji       string
	Remediation []string
}

CheckResult represents the display info for a check.

type DeviceDetail

type DeviceDetail struct {
	*gitmdm.Device

	CheckResults      map[string]CheckResult
	ComplianceMessage string
	FormattedUptime   string
	SortedChecks      []string
	FailingChecks     []string
	PassingChecks     []string
	NAChecks          []string
	PassCount         int
	FailCount         int
	NACount           int
}

DeviceDetail represents the detailed device view with analysis results.

func BuildDeviceDetail

func BuildDeviceDetail(device *gitmdm.Device, staleThreshold time.Time) *DeviceDetail

BuildDeviceDetail creates a detailed view model for a single device. staleThreshold determines which checks to include - zero time means include all.

type DeviceListItem

type DeviceListItem struct {
	LastSeen        time.Time
	HardwareID      string
	Hostname        string
	User            string
	OS              string
	Version         string
	ComplianceEmoji string
	ComplianceClass string
	ComplianceScore float64
	PassCount       int
	FailCount       int
	NACount         int
}

DeviceListItem represents a device in the list view with compliance summary.

type DeviceListView

type DeviceListView struct {
	Search      string
	Status      string
	Devices     []DeviceListItem
	Page        int
	TotalPages  int
	Total       int
	HasPrevious bool
	HasNext     bool
}

DeviceListView represents the device list page view model with filters.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL