|
@@ -27,11 +27,11 @@
|
|
|
{{ choice.title || choice.value }}
|
|
{{ choice.title || choice.value }}
|
|
|
</option>
|
|
</option>
|
|
|
</select>
|
|
</select>
|
|
|
-
|
|
|
|
|
- <component v-else :is="getInputComponent(arg)" :id="arg.name" :name="arg.name"
|
|
|
|
|
|
|
+
|
|
|
|
|
+ <component v-else :is="getInputComponent(arg)" :id="arg.name" :name="arg.name"
|
|
|
:value="(arg.type === 'checkbox' || arg.type === 'confirmation') ? undefined : getArgumentValue(arg)"
|
|
:value="(arg.type === 'checkbox' || arg.type === 'confirmation') ? undefined : getArgumentValue(arg)"
|
|
|
:checked="(arg.type === 'checkbox' || arg.type === 'confirmation') ? getArgumentValue(arg) : undefined"
|
|
:checked="(arg.type === 'checkbox' || arg.type === 'confirmation') ? getArgumentValue(arg) : undefined"
|
|
|
- :list="(arg.suggestions || getBrowserSuggestions(arg).length > 0) ? `${arg.name}-choices` : undefined"
|
|
|
|
|
|
|
+ :list="(arg.suggestions || getBrowserSuggestions(arg).length > 0) ? `${arg.name}-choices` : undefined"
|
|
|
:type="getInputComponent(arg) !== 'select' ? getInputType(arg) : undefined"
|
|
:type="getInputComponent(arg) !== 'select' ? getInputType(arg) : undefined"
|
|
|
:rows="arg.type === 'raw_string_multiline' ? 5 : undefined"
|
|
:rows="arg.type === 'raw_string_multiline' ? 5 : undefined"
|
|
|
:step="arg.type === 'datetime' ? 1 : undefined" :pattern="getPattern(arg)"
|
|
:step="arg.type === 'datetime' ? 1 : undefined" :pattern="getPattern(arg)"
|
|
@@ -174,7 +174,7 @@ function getInputType(arg) {
|
|
|
return 'checkbox'
|
|
return 'checkbox'
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- if (arg.type === 'ascii_identifier' || arg.type === 'ascii') {
|
|
|
|
|
|
|
+ if (arg.type === 'ascii_identifier' || arg.type === 'ascii' || arg.type === 'ascii_sentence') {
|
|
|
return 'text'
|
|
return 'text'
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -252,7 +252,7 @@ async function validateArgument(arg, value) {
|
|
|
|
|
|
|
|
// Get the input element to set custom validity
|
|
// Get the input element to set custom validity
|
|
|
const inputElement = document.getElementById(arg.name)
|
|
const inputElement = document.getElementById(arg.name)
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
if (validation.valid) {
|
|
if (validation.valid) {
|
|
|
delete formErrors.value[arg.name]
|
|
delete formErrors.value[arg.name]
|
|
|
// Clear custom validity message
|
|
// Clear custom validity message
|
|
@@ -322,7 +322,7 @@ function getBrowserSuggestions(arg) {
|
|
|
if (!arg.suggestionsBrowserKey) {
|
|
if (!arg.suggestionsBrowserKey) {
|
|
|
return []
|
|
return []
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
try {
|
|
try {
|
|
|
const stored = localStorage.getItem(`olivetin-suggestions-${arg.suggestionsBrowserKey}`)
|
|
const stored = localStorage.getItem(`olivetin-suggestions-${arg.suggestionsBrowserKey}`)
|
|
|
if (stored) {
|
|
if (stored) {
|
|
@@ -332,7 +332,7 @@ function getBrowserSuggestions(arg) {
|
|
|
} catch (err) {
|
|
} catch (err) {
|
|
|
console.warn('Failed to load browser suggestions:', err)
|
|
console.warn('Failed to load browser suggestions:', err)
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
return []
|
|
return []
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -340,21 +340,21 @@ function saveBrowserSuggestions() {
|
|
|
for (const arg of actionArguments.value) {
|
|
for (const arg of actionArguments.value) {
|
|
|
if (arg.suggestionsBrowserKey) {
|
|
if (arg.suggestionsBrowserKey) {
|
|
|
const value = argValues.value[arg.name]
|
|
const value = argValues.value[arg.name]
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
// Only save non-empty values for non-checkbox/confirmation/password types
|
|
// Only save non-empty values for non-checkbox/confirmation/password types
|
|
|
if (value && value !== '' && arg.type !== 'checkbox' && arg.type !== 'confirmation' && arg.type !== 'password') {
|
|
if (value && value !== '' && arg.type !== 'checkbox' && arg.type !== 'confirmation' && arg.type !== 'password') {
|
|
|
try {
|
|
try {
|
|
|
const key = `olivetin-suggestions-${arg.suggestionsBrowserKey}`
|
|
const key = `olivetin-suggestions-${arg.suggestionsBrowserKey}`
|
|
|
const stored = localStorage.getItem(key)
|
|
const stored = localStorage.getItem(key)
|
|
|
let suggestions = []
|
|
let suggestions = []
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
if (stored) {
|
|
if (stored) {
|
|
|
suggestions = JSON.parse(stored)
|
|
suggestions = JSON.parse(stored)
|
|
|
if (!Array.isArray(suggestions)) {
|
|
if (!Array.isArray(suggestions)) {
|
|
|
suggestions = []
|
|
suggestions = []
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
// Add value if not already present
|
|
// Add value if not already present
|
|
|
if (!suggestions.includes(value)) {
|
|
if (!suggestions.includes(value)) {
|
|
|
suggestions.unshift(value) // Add to beginning
|
|
suggestions.unshift(value) // Add to beginning
|
|
@@ -390,11 +390,13 @@ async function startAction(actionArgs) {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
async function handleSubmit(event) {
|
|
async function handleSubmit(event) {
|
|
|
|
|
+ event.preventDefault()
|
|
|
|
|
+
|
|
|
// Set custom validity for required fields
|
|
// Set custom validity for required fields
|
|
|
for (const arg of actionArguments.value) {
|
|
for (const arg of actionArguments.value) {
|
|
|
const value = argValues.value[arg.name]
|
|
const value = argValues.value[arg.name]
|
|
|
const inputElement = document.getElementById(arg.name)
|
|
const inputElement = document.getElementById(arg.name)
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
if (arg.required && (!value || value === '')) {
|
|
if (arg.required && (!value || value === '')) {
|
|
|
formErrors.value[arg.name] = 'This field is required'
|
|
formErrors.value[arg.name] = 'This field is required'
|
|
|
// Set custom validity for required field validation
|
|
// Set custom validity for required field validation
|
|
@@ -410,14 +412,12 @@ async function handleSubmit(event) {
|
|
|
return
|
|
return
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- event.preventDefault()
|
|
|
|
|
-
|
|
|
|
|
const argvs = getArgumentValues()
|
|
const argvs = getArgumentValues()
|
|
|
console.log('argument form has elements that passed validation')
|
|
console.log('argument form has elements that passed validation')
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
// Save values to localStorage for arguments with suggestionsBrowserKey
|
|
// Save values to localStorage for arguments with suggestionsBrowserKey
|
|
|
saveBrowserSuggestions()
|
|
saveBrowserSuggestions()
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
try {
|
|
try {
|
|
|
const response = await startAction(argvs)
|
|
const response = await startAction(argvs)
|
|
|
if (popupOnStart.value && popupOnStart.value.includes('execution-dialog')) {
|
|
if (popupOnStart.value && popupOnStart.value.includes('execution-dialog')) {
|
|
@@ -496,4 +496,4 @@ form {
|
|
|
display: inline;
|
|
display: inline;
|
|
|
font-weight: normal;
|
|
font-weight: normal;
|
|
|
}
|
|
}
|
|
|
-</style>
|
|
|
|
|
|
|
+</style>
|