Merge pull request #81 from OliveTin/feature-input-description
feature: #61 - Descriptions in arguments
This commit is contained in:
commit
65afdeca36
|
|
@ -20,6 +20,8 @@ message ActionArgument {
|
||||||
string defaultValue = 4;
|
string defaultValue = 4;
|
||||||
|
|
||||||
repeated ActionArgumentChoice choices = 5;
|
repeated ActionArgumentChoice choices = 5;
|
||||||
|
|
||||||
|
string description = 6;
|
||||||
}
|
}
|
||||||
|
|
||||||
message ActionArgumentChoice {
|
message ActionArgumentChoice {
|
||||||
|
|
|
||||||
|
|
@ -25,11 +25,13 @@ actions:
|
||||||
title: host
|
title: host
|
||||||
type: ascii_identifier
|
type: ascii_identifier
|
||||||
default: example.com
|
default: example.com
|
||||||
|
description: The host that you want to ping
|
||||||
|
|
||||||
- name: count
|
- name: count
|
||||||
title: Count
|
title: Count
|
||||||
type: int
|
type: int
|
||||||
default: 1
|
default: 1
|
||||||
|
description: How many times to do you want to ping?
|
||||||
|
|
||||||
# Restart lightdm on host "server1"
|
# Restart lightdm on host "server1"
|
||||||
# Docs: https://docs.olivetin.app/action-ping.html
|
# Docs: https://docs.olivetin.app/action-ping.html
|
||||||
|
|
|
||||||
|
|
@ -17,6 +17,7 @@ type Action struct {
|
||||||
type ActionArgument struct {
|
type ActionArgument struct {
|
||||||
Name string
|
Name string
|
||||||
Title string
|
Title string
|
||||||
|
Description string
|
||||||
Type string
|
Type string
|
||||||
Default string
|
Default string
|
||||||
Choices []ActionArgumentChoice
|
Choices []ActionArgumentChoice
|
||||||
|
|
|
||||||
|
|
@ -36,6 +36,7 @@ func actionCfgToPb(action config.Action, user *acl.AuthenticatedUser) *pb.Action
|
||||||
Name: cfgArg.Name,
|
Name: cfgArg.Name,
|
||||||
Title: cfgArg.Title,
|
Title: cfgArg.Title,
|
||||||
Type: cfgArg.Type,
|
Type: cfgArg.Type,
|
||||||
|
Description: cfgArg.Description,
|
||||||
DefaultValue: cfgArg.Default,
|
DefaultValue: cfgArg.Default,
|
||||||
Choices: buildChoices(cfgArg.Choices),
|
Choices: buildChoices(cfgArg.Choices),
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -64,6 +64,7 @@ class ArgumentForm extends window.HTMLElement {
|
||||||
|
|
||||||
domFieldWrapper.appendChild(this.createDomLabel(arg))
|
domFieldWrapper.appendChild(this.createDomLabel(arg))
|
||||||
domFieldWrapper.appendChild(this.createDomInput(arg))
|
domFieldWrapper.appendChild(this.createDomInput(arg))
|
||||||
|
domFieldWrapper.appendChild(this.createDomDescription(arg))
|
||||||
|
|
||||||
this.domArgs.appendChild(domFieldWrapper)
|
this.domArgs.appendChild(domFieldWrapper)
|
||||||
}
|
}
|
||||||
|
|
@ -130,6 +131,14 @@ class ArgumentForm extends window.HTMLElement {
|
||||||
return domEl
|
return domEl
|
||||||
}
|
}
|
||||||
|
|
||||||
|
createDomDescription (arg) {
|
||||||
|
const domArgumentDescription = document.createElement('span')
|
||||||
|
domArgumentDescription.classList.add('argument-description')
|
||||||
|
domArgumentDescription.innerText = arg.description
|
||||||
|
|
||||||
|
return domArgumentDescription
|
||||||
|
}
|
||||||
|
|
||||||
createSelectOption (choice) {
|
createSelectOption (choice) {
|
||||||
const domEl = document.createElement('option')
|
const domEl = document.createElement('option')
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -282,6 +282,10 @@ input[name="start"]:hover {
|
||||||
background-color: #aceaac;
|
background-color: #aceaac;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
span.argument-description {
|
||||||
|
margin-left: 1em;
|
||||||
|
}
|
||||||
|
|
||||||
form div.buttons {
|
form div.buttons {
|
||||||
text-align: right;
|
text-align: right;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue