Implement widgets' external URL action (#635)
Signed-off-by: Yannick Schaus <github@schaus.net>pull/636/head
parent
2d8b4f2537
commit
7388db03a6
|
@ -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
|
||||
|
|
|
@ -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']
|
||||
|
|
Loading…
Reference in New Issue