async getHierarchyServiceTopology()

in src/store/modules/topology.ts [492:516]


    async getHierarchyServiceTopology() {
      const dashboardStore = useDashboardStore();
      const { currentService } = useSelectorStore();
      const id = this.node ? this.node.id : (currentService || {}).id;
      let layer = dashboardStore.layerId;
      if (this.node) {
        layer = this.node.layers.includes(dashboardStore.layerId)
          ? dashboardStore.layerId
          : this.node.layers.filter((d: string) => d !== dashboardStore.layerId)[0];
      }
      if (!(id && layer)) {
        return new Promise((resolve) => resolve({}));
      }
      const res = await graphql.query("getHierarchyServiceTopology").params({ serviceId: id, layer: layer });
      if (res.errors) {
        return res;
      }
      const resp = await this.getListLayerLevels();
      if (resp.errors) {
        return resp;
      }
      const levels = resp.levels || [];
      this.setHierarchyServiceTopology(res.data.hierarchyServiceTopology || {}, levels);
      return res;
    },