Implement widgets' external URL action (#635)

Signed-off-by: Yannick Schaus <github@schaus.net>
pull/636/head
Yannick Schaus 2020-12-14 01:58:17 +01:00 committed by GitHub
parent 2d8b4f2537
commit 7388db03a6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 2 deletions

View File

@ -1,5 +1,5 @@
// parameter group & parameters definitions for actions
import { po, pt, pi } from './helpers'
import { po, pt, pi, pb } from './helpers'
export const actionGroup = (label, description, groupPrefix) => {
groupPrefix = (groupPrefix) ? groupPrefix += '_' : ''
@ -33,6 +33,10 @@ export const actionParams = (groupName, paramPrefix) => {
.v((value, configuration, configDescription, parameters) => {
return ['url'].indexOf(configuration[paramPrefix + 'action']) >= 0
}),
pb(paramPrefix + 'actionUrlSameWindow', 'Open in same tab/window', 'Open the URL in the same tab/window instead of a new one. This will exit the app.')
.v((value, configuration, configDescription, parameters) => {
return ['url'].indexOf(configuration[paramPrefix + 'action']) >= 0
}),
pi(paramPrefix + 'actionItem', 'Action Item', 'Item to perform the action on')
.v((value, configuration, configDescription, parameters) => {
return ['command', 'toggle', 'options'].indexOf(configuration[paramPrefix + 'action']) >= 0

View File

@ -218,7 +218,8 @@ export const actionsMixin = {
break
case 'url':
const actionUrl = actionConfig[prefix + 'actionUrl']
console.log('opening URL: ' + actionUrl)
const actionUrlSameWindow = actionConfig[prefix + 'actionUrlSameWindow']
window.open(actionUrl, (actionUrlSameWindow) ? '_top' : '_blank')
break
case 'variable':
const actionVariable = actionConfig[prefix + 'actionVariable']