async function fetchNotes()

in source/portal/src/pages/detail/DetailS3.tsx [164:217]


  async function fetchNotes(taskId: string) {
    // setIsLoading(true);
    try {
      const query = gql(getTask);
      const apiData: any = await client?.query({
        fetchPolicy: "no-cache",
        query: query,
        variables: {
          id: taskId,
        },
      });

      const tmpCurTask = apiData.data.getTask;

      if (tmpCurTask.parameters && tmpCurTask.parameters.length > 0) {
        tmpCurTask.parameters.forEach((element: any) => {
          tmpCurTask[element.ParameterKey] = element.ParameterValue
            ? element.ParameterValue
            : "-";
        });
      }
      // if the task engine is lambda
      if (tmpCurTask.type === EnumTaskType.S3) {
        if (tmpCurTask.jobType === "PUT") {
          setAccountInSrc(YES_NO.YES);
          setAccountInDest(YES_NO.NO);
        }
        if (tmpCurTask.jobType === "GET") {
          setAccountInSrc(YES_NO.NO);
          setAccountInDest(YES_NO.YES);
        }
      }
      // if the task engine is ec2
      if (tmpCurTask.type === EnumTaskType.S3_EC2) {
        if (tmpCurTask.srcInCurrentAccount === "true") {
          setAccountInSrc(YES_NO.YES);
        }
        if (tmpCurTask.srcInCurrentAccount === "false") {
          setAccountInSrc(YES_NO.NO);
        }
        if (tmpCurTask.destInCurrentAccount === "true") {
          setAccountInDest(YES_NO.YES);
        }
        if (tmpCurTask.destInCurrentAccount === "false") {
          setAccountInDest(YES_NO.NO);
        }
      }
      setCurTaskInfo(tmpCurTask);
      setIsLoading(false);
    } catch (error: any) {
      setIsLoading(false);
      Swal.fire("Oops...", error.message, "error");
    }
  }