From 32f06a6ae190c8632182f3461aa382d29213a5e2 Mon Sep 17 00:00:00 2001 From: sige Date: Sat, 27 Jul 2024 17:39:18 +0800 Subject: [PATCH] 0 --- src/components/ServiceConfiguration.vue | 105 +-------------------- src/components/ServiceConfigurationActions.vue | 125 +++++++++++++++++++++++++ 2 files changed, 128 insertions(+), 102 deletions(-) create mode 100644 src/components/ServiceConfigurationActions.vue diff --git a/src/components/ServiceConfiguration.vue b/src/components/ServiceConfiguration.vue index 4ee4d6b..181d3a4 100644 --- a/src/components/ServiceConfiguration.vue +++ b/src/components/ServiceConfiguration.vue @@ -24,37 +24,7 @@
- - -
- {{ group.name }} - - - - - -
- {{ action.name }} - -
-
{{ actionParam.name }}
- - TRUE - FALSE - - - - - {{ enumItem.name }} - - - {{ actionParam }} -
-
-
-
-
+
@@ -71,16 +41,14 @@ import { ref, watch } from 'vue'; import ApiClient from '@/utils/ApiClient'; import ServiceConfigurationParamValueEdit from './ServiceConfigurationParamValueEdit.vue' import ServiceConfigurationActionLog from './ServiceConfigurationActionLog.vue' -import ServiceConfigurationActionParamFile from './ServiceConfigurationActionParamFile.vue' import ServiceConfigurationStatusViewer from './ServiceConfigurationStatusViewer.vue' +import ServiceConfigurationActions from './ServiceConfigurationActions.vue' /** @var {Object} */ const props = defineProps({ serviceKey : String, }); /** @var {Array} */ const params = ref([]); -/** @var {Array} */ -const actions = ref([]); /** @var {Object} */ const actionLog = ref(null); // watch service key @@ -88,13 +56,11 @@ watch(() => props.serviceKey, handleServiceKeyChange); // on mounted async function handleServiceKeyChange() { - actionLog.value = null; if ( null === props.serviceKey ) { return ; } await actionServiceParamReload(); - await serviceActionReload(); } // service param reload @@ -139,69 +105,4 @@ async function actionServiceParamReset() { await actionServiceParamReload(); } catch ( e ) {/** nothing to do here */} } - -// service actions reload -async function serviceActionReload() { - try { - actions.value = []; - let client = ApiClient.getClient(); - let list = await client.call('service-config/service-action-list', {serviceKey:props.serviceKey}); - for ( let item of list ) { - let group = actions.value.find(i => i.name === item.group); - if ( undefined === group ) { - 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) => a.order - b.order || a.params.length - b.params.length); - } - actions.value.sort((a,b) => a.order - b.order || b.items.length - a.items.length || a.name.localeCompare(b.name)); - } catch ( e ) {/** nothing to do here */} -} - -// service action execute -async function actionServiceExecute(action) { - try { - let client = ApiClient.getClient(); - let params = {}; - params.serviceKey = props.serviceKey; - params.action = action.key; - params.params = []; - params.paramTypes = []; - for ( let item of action.params ) { - params.params.push(item.value); - let type = item.type; - if ( 'Enum' === type ) { - type = item.typeEnum; - } - params.paramTypes.push(type); - } - - actionLog.value = {}; - actionLog.value.action = params.action; - actionLog.value.params = params.params; - actionLog.value.response = null; - action.isExecuting = true; - actionLog.value.response = await client.call('service-config/service-action-exec',params); - action.isExecuting = false; - } catch ( e ) { - /** nothing to do here */ - } finally { - action.isExecuting = false; - } -} - - \ No newline at end of file + \ No newline at end of file diff --git a/src/components/ServiceConfigurationActions.vue b/src/components/ServiceConfigurationActions.vue new file mode 100644 index 0000000..e2bba81 --- /dev/null +++ b/src/components/ServiceConfigurationActions.vue @@ -0,0 +1,125 @@ + + + \ No newline at end of file