async getStrategyList()

in src/store/modules/continous-profiling.ts [99:129]


    async getStrategyList(params: { serviceId: string }) {
      if (!params.serviceId) {
        return new Promise((resolve) => resolve({}));
      }
      this.policyLoading = true;
      const response = await graphql.query("getStrategyList").params(params);

      this.policyLoading = false;
      if (response.errors) {
        return response;
      }
      const list = response.data.strategyList || [];
      if (!list.length) {
        this.taskList = [];
        this.instances = [];
        this.instance = null;
      }
      const arr = list.length ? response.data.strategyList : [{ type: "", checkItems: [{ type: "" }] }];
      this.strategyList = arr.map((d: StrategyItem, index: number) => {
        return {
          ...d,
          id: index,
        };
      });
      this.setSelectedStrategy(this.strategyList[0]);
      if (!this.selectedStrategy.type) {
        return response;
      }
      this.getMonitoringInstances(params.serviceId);
      return response;
    },