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
|
// 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) => {
|
export const actionGroup = (label, description, groupPrefix) => {
|
||||||
groupPrefix = (groupPrefix) ? groupPrefix += '_' : ''
|
groupPrefix = (groupPrefix) ? groupPrefix += '_' : ''
|
||||||
|
@ -33,6 +33,10 @@ export const actionParams = (groupName, paramPrefix) => {
|
||||||
.v((value, configuration, configDescription, parameters) => {
|
.v((value, configuration, configDescription, parameters) => {
|
||||||
return ['url'].indexOf(configuration[paramPrefix + 'action']) >= 0
|
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')
|
pi(paramPrefix + 'actionItem', 'Action Item', 'Item to perform the action on')
|
||||||
.v((value, configuration, configDescription, parameters) => {
|
.v((value, configuration, configDescription, parameters) => {
|
||||||
return ['command', 'toggle', 'options'].indexOf(configuration[paramPrefix + 'action']) >= 0
|
return ['command', 'toggle', 'options'].indexOf(configuration[paramPrefix + 'action']) >= 0
|
||||||
|
|
|
@ -218,7 +218,8 @@ export const actionsMixin = {
|
||||||
break
|
break
|
||||||
case 'url':
|
case 'url':
|
||||||
const actionUrl = actionConfig[prefix + 'actionUrl']
|
const actionUrl = actionConfig[prefix + 'actionUrl']
|
||||||
console.log('opening URL: ' + actionUrl)
|
const actionUrlSameWindow = actionConfig[prefix + 'actionUrlSameWindow']
|
||||||
|
window.open(actionUrl, (actionUrlSameWindow) ? '_top' : '_blank')
|
||||||
break
|
break
|
||||||
case 'variable':
|
case 'variable':
|
||||||
const actionVariable = actionConfig[prefix + 'actionVariable']
|
const actionVariable = actionConfig[prefix + 'actionVariable']
|
||||||
|
|
Loading…
Reference in New Issue