When creating service groups in the topology, it is better if the service names are sorted. (#478)
* When creating a service group, the service names are sorted in alphabetical order.
* Set types for a and b.
Co-authored-by: Qiuxia Fan <fine0830@outlook.com>
diff --git a/src/views/components/topology/topo-group/index.vue b/src/views/components/topology/topo-group/index.vue
index f2400b3..abe31ce 100644
--- a/src/views/components/topology/topo-group/index.vue
+++ b/src/views/components/topology/topo-group/index.vue
@@ -44,6 +44,7 @@
import CreateGroup from './create-group.vue';
import GroupItem from './group-item.vue';
import Axios, { AxiosResponse } from 'axios';
+ import { Option } from '@/types/global';
@Component({
components: {
@@ -98,7 +99,10 @@
duration: this.durationTime,
},
}).then((res: AxiosResponse) => {
- this.servicesMap = res.data.data.services ? res.data.data.services : [];
+ const map = res.data.data.services ? res.data.data.services : [];
+ this.servicesMap = map.sort((a: Option, b: Option) => {
+ return a.label.localeCompare(b.label);
+ });
});
}
private initGroupTopo() {