|
|
@ -1,46 +1,12 @@ |
|
|
|
<template> |
|
|
|
<div class="h-full flex flex-col"> |
|
|
|
<a-row class="h-0 grow"> |
|
|
|
<a-col class="border-r h-full overflow-y-auto" :span="16"> |
|
|
|
<div class="flex-grow"> |
|
|
|
<service-configuration-status-viewer :service-key="props.serviceKey" /> |
|
|
|
|
|
|
|
<div class="p-5 border-t border-b" v-if="0 < params.length"> |
|
|
|
<div class="flex flex-row flex-wrap"> |
|
|
|
<div v-for="group in params" :key="group.name" class="p-1" style="min-width: 30%;"> |
|
|
|
<fieldset class="border h-full"> |
|
|
|
<legend class="px-3">{{ group.name }}</legend> |
|
|
|
<table class="w-full"> |
|
|
|
<tr v-for="item in group.items" :key="item.key"> |
|
|
|
<td class="py-1 px-2">{{ item.name }} : </td> |
|
|
|
<td class="py-1 px-2"> |
|
|
|
<service-configuration-param-value-edit |
|
|
|
:param="item" |
|
|
|
v-model:value="item.value" |
|
|
|
@save-request="actionServiceParamSave" |
|
|
|
></service-configuration-param-value-edit> |
|
|
|
</td> |
|
|
|
</tr> |
|
|
|
</table> |
|
|
|
</fieldset> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<div class="p-1 text-right"> |
|
|
|
<a-button class="mr-1" @click="actionServiceParamReset">重置</a-button> |
|
|
|
<a-button class="mr-1" @click="actionServiceParamReload">刷新</a-button> |
|
|
|
<a-button @click="actionServiceParamSave">保存</a-button> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
|
|
|
|
<div class="p-3"> |
|
|
|
<service-configuration-actions v-model:actionLog="actionLog" :service-key="props.serviceKey" /> |
|
|
|
</div> |
|
|
|
</a-col> |
|
|
|
<a-col :span="8" class="h-full flex flex-col"> |
|
|
|
<div class="h-0 grow p-5"> |
|
|
|
<service-configuration-action-log :log="actionLog"/> |
|
|
|
<div class="flex-none" style="display: none;"> |
|
|
|
<service-configuration-action-log :log="actionLog" /> |
|
|
|
</div> |
|
|
|
</a-col> |
|
|
|
</a-row> |
|
|
|
</div> |
|
|
|
</template> |
|
|
|
<script setup> |
|
|
@ -52,7 +18,7 @@ import ServiceConfigurationStatusViewer from './ServiceConfigurationStatusViewer |
|
|
|
import ServiceConfigurationActions from './ServiceConfigurationActions.vue' |
|
|
|
/** @var {Object} */ |
|
|
|
const props = defineProps({ |
|
|
|
serviceKey : String, |
|
|
|
serviceKey: String, |
|
|
|
}); |
|
|
|
/** @var {Array} */ |
|
|
|
const params = ref([]); |
|
|
@ -63,8 +29,8 @@ watch(() => props.serviceKey, handleServiceKeyChange); |
|
|
|
|
|
|
|
// on mounted |
|
|
|
async function handleServiceKeyChange() { |
|
|
|
if ( null === props.serviceKey ) { |
|
|
|
return ; |
|
|
|
if (null === props.serviceKey) { |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
await actionServiceParamReload(); |
|
|
@ -75,43 +41,21 @@ async function actionServiceParamReload() { |
|
|
|
try { |
|
|
|
params.value = []; |
|
|
|
let client = ApiClient.getClient(); |
|
|
|
let list = await client.call('service-config/service-params-list', {serviceKey:props.serviceKey}); |
|
|
|
for ( var item of list ) { |
|
|
|
let list = await client.call('service-config/service-params-list', { serviceKey: props.serviceKey }); |
|
|
|
for (var item of list) { |
|
|
|
let groupName = item.group; |
|
|
|
let group = params.value.find( i => i.name === groupName); |
|
|
|
if ( undefined === group ) { |
|
|
|
group = {name:groupName, items:[], order:0}; |
|
|
|
let group = params.value.find(i => i.name === groupName); |
|
|
|
if (undefined === group) { |
|
|
|
group = { name: groupName, items: [], order: 0 }; |
|
|
|
group.order = Math.max(group.order, item.order); |
|
|
|
params.value.push(group); |
|
|
|
} |
|
|
|
group.items.push(item); |
|
|
|
} |
|
|
|
params.value.map(g => g.items.sort((a,b) => a.order - b.order)); |
|
|
|
params.value.sort((a,b) => a.order - b.order || b.items.length - a.items.length || b.name.localeCompare(a.name)); |
|
|
|
} catch ( e ) {/** nothing to do here */} |
|
|
|
params.value.map(g => g.items.sort((a, b) => a.order - b.order)); |
|
|
|
params.value.sort((a, b) => a.order - b.order || b.items.length - a.items.length || b.name.localeCompare(a.name)); |
|
|
|
} catch (e) {/** nothing to do here */ } |
|
|
|
} |
|
|
|
|
|
|
|
// service param save |
|
|
|
async function actionServiceParamSave() { |
|
|
|
try { |
|
|
|
let values = {}; |
|
|
|
for ( let group of params.value ) { |
|
|
|
for ( let item of group.items ) { |
|
|
|
values[item.key] = item.value; |
|
|
|
} |
|
|
|
} |
|
|
|
let client = ApiClient.getClient(); |
|
|
|
await client.call('service-config/service-params-update', {serviceKey:props.serviceKey,params:values}); |
|
|
|
await actionServiceParamReload(); |
|
|
|
} catch ( e ) {/** nothing to do here */} |
|
|
|
} |
|
|
|
|
|
|
|
// service param reset |
|
|
|
async function actionServiceParamReset() { |
|
|
|
try { |
|
|
|
let client = ApiClient.getClient(); |
|
|
|
await client.call('service-config/service-params-reset', {serviceKey:props.serviceKey}); |
|
|
|
await actionServiceParamReload(); |
|
|
|
} catch ( e ) {/** nothing to do here */} |
|
|
|
} |
|
|
|
</script> |