You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

60 lines
2.0 KiB

1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
  1. <template>
  2. <div class="h-full flex flex-col">
  3. <div class="flex-grow">
  4. <service-configuration-status-viewer :service-key="props.serviceKey" />
  5. <service-configuration-actions v-model:actionLog="actionLog" :service-key="props.serviceKey" />
  6. </div>
  7. <div class="flex-none" style="display: none;">
  8. <service-configuration-action-log :log="actionLog" />
  9. </div>
  10. </div>
  11. </template>
  12. <script setup>
  13. import { ref, watch } from 'vue';
  14. import ApiClient from '@/utils/ApiClient';
  15. import ServiceConfigurationParamValueEdit from './ServiceConfigurationParamValueEdit.vue'
  16. import ServiceConfigurationActionLog from './ServiceConfigurationActionLog.vue'
  17. import ServiceConfigurationStatusViewer from './ServiceConfigurationStatusViewer.vue'
  18. import ServiceConfigurationActions from './ServiceConfigurationActions.vue'
  19. /** @var {Object} */
  20. const props = defineProps({
  21. serviceKey: String,
  22. });
  23. /** @var {Array} */
  24. const params = ref([]);
  25. /** @var {Object} */
  26. const actionLog = ref(null);
  27. // watch service key
  28. watch(() => props.serviceKey, handleServiceKeyChange);
  29. // on mounted
  30. async function handleServiceKeyChange() {
  31. if (null === props.serviceKey) {
  32. return;
  33. }
  34. await actionServiceParamReload();
  35. }
  36. // service param reload
  37. async function actionServiceParamReload() {
  38. try {
  39. params.value = [];
  40. let client = ApiClient.getClient();
  41. let list = await client.call('service-config/service-params-list', { serviceKey: props.serviceKey });
  42. for (var item of list) {
  43. let groupName = item.group;
  44. let group = params.value.find(i => i.name === groupName);
  45. if (undefined === group) {
  46. group = { name: groupName, items: [], order: 0 };
  47. group.order = Math.max(group.order, item.order);
  48. params.value.push(group);
  49. }
  50. group.items.push(item);
  51. }
  52. params.value.map(g => g.items.sort((a, b) => a.order - b.order));
  53. params.value.sort((a, b) => a.order - b.order || b.items.length - a.items.length || b.name.localeCompare(a.name));
  54. } catch (e) {/** nothing to do here */ }
  55. }
  56. </script>