2018-12-30 23:16:09 +01:00
|
|
|
<template>
|
|
|
|
<div class="">
|
|
|
|
<div class="window-content">
|
|
|
|
<!-- ACTION SELECT -->
|
|
|
|
<div class="flex flex-row">
|
|
|
|
<div class="flex label-secondary form-label">
|
|
|
|
<span class="w100">
|
|
|
|
Select action:
|
|
|
|
</span>
|
|
|
|
</div>
|
|
|
|
<div class="flex flex-grow flex-input">
|
|
|
|
<select class=""
|
2019-03-10 16:31:50 +01:00
|
|
|
:value="selectedAction"
|
2018-12-30 23:16:09 +01:00
|
|
|
@change="setAction($event.target.value)"
|
|
|
|
>
|
2019-03-10 16:31:50 +01:00
|
|
|
<option :value="undefined" selected disabled>Select ...</option>
|
2018-12-30 23:16:09 +01:00
|
|
|
<option v-for="(action, key) in ActionList"
|
|
|
|
:value="key"
|
2019-02-27 21:59:57 +01:00
|
|
|
:key="key"
|
2018-12-30 23:16:09 +01:00
|
|
|
>
|
|
|
|
{{action.name}}
|
|
|
|
</option>
|
|
|
|
</select>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<!-- ARGUMENT SELECT -->
|
|
|
|
<div v-if="selectedAction && ActionList[selectedAction]"
|
|
|
|
class="flex flex-row">
|
|
|
|
<div class="flex label-secondary form-label">
|
|
|
|
<span class="w100">
|
|
|
|
Select action parameter:
|
|
|
|
</span>
|
|
|
|
</div>
|
|
|
|
<div class="flex flex-grow flex-input">
|
2019-02-27 21:59:57 +01:00
|
|
|
<select class=""
|
2019-03-10 16:31:50 +01:00
|
|
|
:value="selectedArgument ? selectedArgument.arg : undefined"
|
2019-02-27 21:59:57 +01:00
|
|
|
@change="setArgument($event.target.value)"
|
|
|
|
>
|
2019-03-10 16:31:50 +01:00
|
|
|
<option :value="undefined" selected disabled>Select ...</option>
|
2019-02-27 21:59:57 +01:00
|
|
|
<option v-for="(arg, key) of ActionList[selectedAction].args"
|
|
|
|
:key="key"
|
|
|
|
:value="key"
|
2018-12-30 23:16:09 +01:00
|
|
|
>
|
|
|
|
{{arg.name}}
|
|
|
|
</option>
|
|
|
|
</select>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<!-- CUSTOM ARGUMENT INPUT -->
|
|
|
|
<div v-if="selectedArgument && selectedArgument.customArg"
|
|
|
|
class="flex flex-row">
|
|
|
|
<div class="flex label-secondary form-label">
|
|
|
|
<span class="w100">
|
|
|
|
{{selectedArgument.name}}:
|
|
|
|
</span>
|
|
|
|
</div>
|
|
|
|
<div class="flex flex-grow flex-input">
|
|
|
|
<input type="text"
|
|
|
|
class="w100"
|
|
|
|
v-model="customArgumentValue"
|
|
|
|
>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="window-footer">
|
|
|
|
<div class="button"
|
|
|
|
@click="$emit('close-popup')"
|
|
|
|
>
|
|
|
|
Cancel
|
|
|
|
</div>
|
|
|
|
<div class="button"
|
|
|
|
@click="emitCommand()"
|
|
|
|
>
|
|
|
|
Save
|
|
|
|
</div>
|
|
|
|
</div>
|
2019-03-10 16:31:50 +01:00
|
|
|
<pre>
|
|
|
|
----- [ COMMAND DATA ] -----
|
|
|
|
|
|
|
|
:: Action:
|
|
|
|
{{action}}
|
|
|
|
|
|
|
|
:: Selected Action:
|
|
|
|
{{selectedAction}}
|
|
|
|
|
|
|
|
:: Selected Argumennt:
|
|
|
|
{{selectedArgument}}
|
|
|
|
--- [ END COMMAND DATA ] ---
|
|
|
|
</pre>
|
|
|
|
|
2018-12-30 23:16:09 +01:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
import ActionList from '../../../ext/conf/ActionList';
|
2019-02-19 21:10:49 +01:00
|
|
|
import Stretch from '../../../common/enums/stretch.enum';
|
2018-12-30 23:16:09 +01:00
|
|
|
|
|
|
|
export default {
|
|
|
|
data () {
|
|
|
|
return {
|
2019-02-19 21:10:49 +01:00
|
|
|
Stretch: Stretch,
|
2018-12-30 23:16:09 +01:00
|
|
|
ActionList: ActionList,
|
2019-03-10 16:31:50 +01:00
|
|
|
selectedAction: undefined,
|
|
|
|
selectedArgument: undefined,
|
|
|
|
customArgumentValue: undefined
|
2018-12-30 23:16:09 +01:00
|
|
|
}
|
|
|
|
},
|
|
|
|
created () {
|
2019-03-10 16:31:50 +01:00
|
|
|
if (this.action) {
|
|
|
|
this.selectedAction = this.action.cmd;
|
|
|
|
this.selectedArgument = {
|
|
|
|
name: ActionList[this.action.cmd].args.find(x => x.arg === this.action.arg) || ActionList[this.action.cmd].args.find(x => x.customArg),
|
|
|
|
arg: this.action.arg
|
|
|
|
}
|
|
|
|
this.customArgumentValue = this.action.arg;
|
2018-12-30 23:16:09 +01:00
|
|
|
}
|
2019-03-10 16:31:50 +01:00
|
|
|
|
|
|
|
// console.log("this.actionList", ActionList, this.ActionList)
|
|
|
|
// for(const a in ActionList) {
|
|
|
|
// console.log(a);
|
|
|
|
// }
|
|
|
|
},
|
|
|
|
mounted() {
|
|
|
|
|
2018-12-30 23:16:09 +01:00
|
|
|
},
|
|
|
|
props: {
|
|
|
|
action: Object,
|
|
|
|
scope: String,
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
setAction(cmd) {
|
|
|
|
console.log("SETTING ACTION", cmd);
|
|
|
|
this.selectedAction = cmd;
|
|
|
|
this.selectedArgument = undefined;
|
|
|
|
this.customArgumentValue = undefined;
|
|
|
|
},
|
|
|
|
setArgument(arg) {
|
2019-02-27 21:59:57 +01:00
|
|
|
this.selectedArgument = ActionList[this.selectedAction].args[arg];
|
2018-12-30 23:16:09 +01:00
|
|
|
this.customArgumentValue = undefined;
|
|
|
|
},
|
|
|
|
emitCommand() {
|
|
|
|
this.$emit(
|
|
|
|
'set-command',
|
|
|
|
this.selectedAction,
|
|
|
|
this.customArgumentValue ? this.customArgumentValue : this.selectedArgument.arg
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|