feature: entities wip (#226)

This commit is contained in:
James Read 2024-02-07 10:36:57 +01:00 committed by GitHub
parent 759e747f54
commit 5b0cfb5c33
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 112 additions and 80 deletions

View File

@ -8,6 +8,18 @@ listenAddressSingleHTTPFrontend: 0.0.0.0:1337
# Choose from INFO (default), WARN and DEBUG
logLevel: "INFO"
entities:
- name: container
file: /etc/OliveTin/entities/containers.yaml
icon: container
helpers:
- title: refresh container file
shell: "docker ps --format '{{ .state }}' > /etc/OliveTin/entities/containers.yaml"
execOnStartup: true
execOnCron:
- "*/1 * * * * *"
# Actions (buttons) to show up on the WebUI:
actions:
- title: date
@ -15,15 +27,17 @@ actions:
icon: clock
popupOnStart: true
- title: start
shell: docker start {{ container.name }}
icon: start
entity: container
# This will run a simple script that you create.
- title: Run backup script
shell: /opt/backupScript.sh
shellAfterCompleted: "apprise -t 'Notification: Backup script completed' -b 'The backup script completed with code {{ exitCode}}. The log is: \n {{ stdout }} '"
maxConcurrent: 1
icon: backup
execOnCron: # https://docs.olivetin.app/exec-cron.html
- "@monthly" # Once per month
- "0 12 25 12 *" # And on Christmas day!
# This will send 1 ping (-c 1)
# Docs: https://docs.olivetin.app/action-ping.html

View File

@ -12,6 +12,7 @@ type Action struct {
CSS map[string]string `mapstructure:"omitempty"`
Timeout int
Acls []string
Entity []string
ExecOnStartup bool
ExecOnCron []string
ExecOnFileCreatedInDir []string
@ -37,12 +38,22 @@ type ActionArgumentChoice struct {
Title string
}
// HelperAction is an action that is used normally to generate entities, it cannot be started manually.
type HelperAction struct {
Title string
Shell string
ExecOnStartup bool
ExecOnCron []string
ExecOnFileCreatedInDir []string
ExecOnFileChangedInDir []string
}
// Entity represents a "thing" that can have multiple actions associated with it.
// for example, a media player with a start and stop action.
type Entity struct {
Title string
type EntityFile struct {
File string
Name string
Icon string
Actions []Action `mapstructure:"actions"`
CSS map[string]string
}
@ -72,8 +83,8 @@ type Config struct {
ExternalRestAddress string
LogLevel string
Actions []Action `mapstructure:"actions"`
Entities []EntityFile `mapstructure:"entities"`
Dashboards []DashboardItem `mapstructure:"dashboards"`
Entities []Entity `mapstructure:"entities"`
CheckForUpdates bool
PageTitle string
ShowFooter bool
@ -89,6 +100,7 @@ type Config struct {
DefaultPermissions PermissionsList
AccessControlLists []AccessControlList
WebUIDir string
HelperActions []HelperAction `mapstructure:"helperActions"`
CronSupportForSeconds bool
SectionNavigationStyle string
}

View File

@ -0,0 +1,6 @@
sonarr:
state: started
plex:
state: started
sabnzbd:
state: stopped