|
|
@ -1,10 +1,5 @@ |
|
|
|
<template> |
|
|
|
<div class="h-full flex flex-col"> |
|
|
|
<div class="bg-white border-b p-5"> |
|
|
|
<div v-for="(status,index) in statuses" :key="index" class="inline-block py-1 px-2 rounded border ml-1"> |
|
|
|
{{ status.name }} : {{ status.value }} |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<a-row class="h-0 grow"> |
|
|
|
<a-col class="border-r h-full overflow-y-auto" :span="16"> |
|
|
|
<div class="p-5 border-t border-b" v-if="0 < params.length"> |
|
|
@ -28,33 +23,48 @@ |
|
|
|
<a-button @click="actionServiceParamSave">保存</a-button> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<div class="p-5"> |
|
|
|
<fieldset v-for="(group,groupIndex) in actions" :key="groupIndex" class="border my-1 p-1"> |
|
|
|
<legend>{{ group.name }}</legend> |
|
|
|
<div v-for="action in group.items" :key="action.key" :class="{'inline-block ml-1':0 === action.params.length}"> |
|
|
|
<a-button v-if="0 === action.params.length" class="my-1 w-64 text-left" |
|
|
|
:loading="action.isExecuting" |
|
|
|
@click="actionServiceExecute(action)" |
|
|
|
>{{ action.name }}</a-button> |
|
|
|
<div v-else class="border rounded-md my-1 pr-3 bg-white"> |
|
|
|
<a-button class="m-1 w-64 text-left" :loading="action.isExecuting" @click="actionServiceExecute(action)">{{ action.name }}</a-button> |
|
|
|
<div class="inline-block mx-2" v-for="actionParam in action.params" :key="actionParam.key"> |
|
|
|
{{ actionParam.name }} : |
|
|
|
<a-switch v-if="'java.lang.Boolean' === actionParam.type" v-model:checked="actionParam.value" /> |
|
|
|
<a-input v-else-if="'java.lang.String' === actionParam.type" class="w-24" v-model:value="actionParam.value" /> |
|
|
|
<a-input-number v-else-if="'java.lang.Integer' === actionParam.type" class="w-24" v-model:value="actionParam.value" /> |
|
|
|
<a-select v-else-if="'Enum' === actionParam.type" v-model:value="actionParam.value" :dropdownMatchSelectWidth="false"> |
|
|
|
<a-select-option v-for="(enumItem,enumIndex) in actionParam.options" :key="enumIndex" :value="enumItem.value">{{ enumItem.name }}</a-select-option> |
|
|
|
</a-select> |
|
|
|
<span v-else>{{ actionParam }}</span> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</fieldset> |
|
|
|
<div class="p-3"> |
|
|
|
<a-row> |
|
|
|
<a-col class="p-1" :span="12" v-for="(group,groupIndex) in actions" :key="groupIndex"> |
|
|
|
<fieldset class="border my-1 p-1"> |
|
|
|
<legend>{{ group.name }}</legend> |
|
|
|
<table class="w-full"> |
|
|
|
<tr v-for="action in group.items" :key="action.key"> |
|
|
|
<td> |
|
|
|
<a-button class="m-1 w-full text-left" :loading="action.isExecuting" @click="actionServiceExecute(action)" |
|
|
|
>{{ action.name }}</a-button> |
|
|
|
</td> |
|
|
|
<td> |
|
|
|
<div class="inline-block ml-2" v-for="actionParam in action.params" :key="actionParam.key"> |
|
|
|
<a-select v-if="'java.lang.Boolean' === actionParam.type" v-model:value="actionParam.value" :dropdownMatchSelectWidth="false"> |
|
|
|
<a-select-option :value="true">TRUE</a-select-option> |
|
|
|
<a-select-option :value="false">FALSE</a-select-option> |
|
|
|
</a-select> |
|
|
|
<a-input v-else-if="'java.lang.String' === actionParam.type" class="w-24" v-model:value="actionParam.value" :placeholder="actionParam.name"/> |
|
|
|
<a-input-number v-else-if="'java.lang.Integer' === actionParam.type" class="w-24" v-model:value="actionParam.value" :placeholder="actionParam.name"/> |
|
|
|
<a-select v-else-if="'Enum' === actionParam.type" v-model:value="actionParam.value" :dropdownMatchSelectWidth="false"> |
|
|
|
<a-select-option v-for="(enumItem,enumIndex) in actionParam.options" :key="enumIndex" :value="enumItem.value">{{ enumItem.name }}</a-select-option> |
|
|
|
</a-select> |
|
|
|
<service-configuration-action-param-file v-else-if="'a8k.utils.HardwareParamFile' === actionParam.type" v-model:value="actionParam.value" /> |
|
|
|
<span v-else>{{ actionParam }}</span> |
|
|
|
</div> |
|
|
|
</td> |
|
|
|
</tr> |
|
|
|
</table> |
|
|
|
</fieldset> |
|
|
|
</a-col> |
|
|
|
</a-row> |
|
|
|
</div> |
|
|
|
</a-col> |
|
|
|
<a-col :span="8" class="p-5 h-full"> |
|
|
|
<service-configuration-action-log :log="actionLog"/> |
|
|
|
<a-col :span="8" class="h-full flex flex-col"> |
|
|
|
<a-row class="bg-white border-b p-5"> |
|
|
|
<a-col :span="8" v-for="(status,index) in statuses" :key="index" class="p-1"> |
|
|
|
<div class="py-1 px-2 rounded border">{{ status.name }} : {{ status.value }}</div> |
|
|
|
</a-col> |
|
|
|
</a-row> |
|
|
|
<div class="h-0 grow p-5"> |
|
|
|
<service-configuration-action-log :log="actionLog"/> |
|
|
|
</div> |
|
|
|
</a-col> |
|
|
|
</a-row> |
|
|
|
</div> |
|
|
@ -64,6 +74,7 @@ import { onUnmounted, ref, watch } from 'vue'; |
|
|
|
import ApiClient from '@/utils/ApiClient'; |
|
|
|
import ServiceConfigurationParamValueEdit from './ServiceConfigurationParamValueEdit.vue' |
|
|
|
import ServiceConfigurationActionLog from './ServiceConfigurationActionLog.vue' |
|
|
|
import ServiceConfigurationActionParamFile from './ServiceConfigurationActionParamFile.vue' |
|
|
|
/** @var {Object} */ |
|
|
|
const props = defineProps({ |
|
|
|
serviceKey : String, |
|
|
@ -167,13 +178,16 @@ async function serviceActionReload() { |
|
|
|
for ( let item of list ) { |
|
|
|
let group = actions.value.find(i => i.name === item.group); |
|
|
|
if ( undefined === group ) { |
|
|
|
group = {name:item.group, items:[]}; |
|
|
|
group = {name:item.group, items:[], order:0}; |
|
|
|
actions.value.push(group); |
|
|
|
} |
|
|
|
if ( item.groupOrder > group.order ) { |
|
|
|
group.order = item.groupOrder; |
|
|
|
} |
|
|
|
group.items.push(item); |
|
|
|
group.items.sort((a,b) => b.order - a.order || a.params.length - b.params.length); |
|
|
|
} |
|
|
|
actions.value.sort((a,b) => a.name.localeCompare(b.name)); |
|
|
|
actions.value.sort((a,b) => b.order - a.order || b.items.length - a.items.length || a.name.localeCompare(b.name)); |
|
|
|
} catch ( e ) {/** nothing to do here */} |
|
|
|
} |
|
|
|
|
|
|
|