async getMonitoringInstances()

in src/store/modules/continous-profiling.ts [130:164]


    async getMonitoringInstances(serviceId: string) {
      this.instancesLoading = true;
      if (!serviceId) {
        return null;
      }
      const response = await graphql.query("getMonitoringInstances").params({
        serviceId,
        target: this.selectedStrategy.type,
      });
      this.instancesLoading = false;
      if (response.errors) {
        return response;
      }
      this.instances = (response.data.instances || [])
        .map((d: MonitorInstance) => {
          const processes = (d.processes || [])
            .sort((c: MonitorProcess, d: MonitorProcess) => d.lastTriggerTimestamp - c.lastTriggerTimestamp)
            .map((p: MonitorProcess) => {
              return {
                ...p,
                lastTriggerTime: d.lastTriggerTimestamp ? dateFormat(d.lastTriggerTimestamp) : "",
                labels: p.labels.join("; "),
              };
            });

          return {
            ...d,
            processes,
            lastTriggerTime: d.lastTriggerTimestamp ? dateFormat(d.lastTriggerTimestamp) : "",
          };
        })
        .sort((a: MonitorInstance, b: MonitorInstance) => b.lastTriggerTimestamp - a.lastTriggerTimestamp);
      this.instance = this.instances[0] || null;
      return response;
    },