イベント送信時に指定の変数の値を添付出来るように
This commit is contained in:
parent
e97dd13e81
commit
e9251debe0
4 changed files with 27 additions and 2 deletions
|
@ -2035,6 +2035,8 @@ pages:
|
||||||
_pushEvent:
|
_pushEvent:
|
||||||
event: "イベント名"
|
event: "イベント名"
|
||||||
message: "押したときに表示するメッセージ"
|
message: "押したときに表示するメッセージ"
|
||||||
|
variable: "送信する変数"
|
||||||
|
no-variable: "なし"
|
||||||
|
|
||||||
script:
|
script:
|
||||||
categories:
|
categories:
|
||||||
|
|
|
@ -17,6 +17,17 @@
|
||||||
<template v-else-if="value.action === 'pushEvent'">
|
<template v-else-if="value.action === 'pushEvent'">
|
||||||
<ui-input v-model="value.event"><span>{{ $t('blocks._button._action._pushEvent.event') }}</span></ui-input>
|
<ui-input v-model="value.event"><span>{{ $t('blocks._button._action._pushEvent.event') }}</span></ui-input>
|
||||||
<ui-input v-model="value.message"><span>{{ $t('blocks._button._action._pushEvent.message') }}</span></ui-input>
|
<ui-input v-model="value.message"><span>{{ $t('blocks._button._action._pushEvent.message') }}</span></ui-input>
|
||||||
|
<ui-select v-model="value.var">
|
||||||
|
<template #label>{{ $t('blocks._button._action._pushEvent.variable') }}</template>
|
||||||
|
<option :value="null">{{ $t('blocks._button._action._pushEvent.no-variable') }}</option>
|
||||||
|
<option v-for="v in aiScript.getVarsByType()" :value="v.name">{{ v.name }}</option>
|
||||||
|
<optgroup :label="$t('script.pageVariables')">
|
||||||
|
<option v-for="v in aiScript.getPageVarsByType()" :value="v">{{ v }}</option>
|
||||||
|
</optgroup>
|
||||||
|
<optgroup :label="$t('script.enviromentVariables')">
|
||||||
|
<option v-for="v in aiScript.getEnvVarsByType()" :value="v">{{ v }}</option>
|
||||||
|
</optgroup>
|
||||||
|
</ui-select>
|
||||||
</template>
|
</template>
|
||||||
</section>
|
</section>
|
||||||
</x-container>
|
</x-container>
|
||||||
|
@ -39,6 +50,9 @@ export default Vue.extend({
|
||||||
value: {
|
value: {
|
||||||
required: true
|
required: true
|
||||||
},
|
},
|
||||||
|
aiScript: {
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
data() {
|
data() {
|
||||||
|
@ -53,7 +67,8 @@ export default Vue.extend({
|
||||||
if (this.value.content == null) Vue.set(this.value, 'content', null);
|
if (this.value.content == null) Vue.set(this.value, 'content', null);
|
||||||
if (this.value.event == null) Vue.set(this.value, 'event', null);
|
if (this.value.event == null) Vue.set(this.value, 'event', null);
|
||||||
if (this.value.message == null) Vue.set(this.value, 'message', null);
|
if (this.value.message == null) Vue.set(this.value, 'message', null);
|
||||||
if (this.value.message == null) Vue.set(this.value, 'primary', false);
|
if (this.value.primary == null) Vue.set(this.value, 'primary', false);
|
||||||
|
if (this.value.var == null) Vue.set(this.value, 'var', null);
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -30,7 +30,10 @@ export default Vue.extend({
|
||||||
} else if (this.value.action === 'pushEvent') {
|
} else if (this.value.action === 'pushEvent') {
|
||||||
this.$root.api('page-push', {
|
this.$root.api('page-push', {
|
||||||
pageId: this.script.page.id,
|
pageId: this.script.page.id,
|
||||||
event: this.value.event
|
event: this.value.event,
|
||||||
|
...(this.value.var ? {
|
||||||
|
var: this.script.vars[this.value.var]
|
||||||
|
} : {})
|
||||||
});
|
});
|
||||||
|
|
||||||
this.$root.dialog({
|
this.$root.dialog({
|
||||||
|
|
|
@ -16,6 +16,10 @@ export const meta = {
|
||||||
|
|
||||||
event: {
|
event: {
|
||||||
validator: $.str
|
validator: $.str
|
||||||
|
},
|
||||||
|
|
||||||
|
var: {
|
||||||
|
validator: $.optional.nullable.any
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -37,6 +41,7 @@ export default define(meta, async (ps, user) => {
|
||||||
publishMainStream(user.id, 'pageEvent', {
|
publishMainStream(user.id, 'pageEvent', {
|
||||||
pageId: ps.pageId,
|
pageId: ps.pageId,
|
||||||
event: ps.event,
|
event: ps.event,
|
||||||
|
var: ps.var,
|
||||||
user: await Users.pack(user, page.userId, {
|
user: await Users.pack(user, page.userId, {
|
||||||
detail: true
|
detail: true
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in a new issue