Skip to content
This repository was archived by the owner on Apr 13, 2020. It is now read-only.

spk deployment get includes PR column (if available) #450

Merged
merged 13 commits into from
Mar 27, 2020

Conversation

samiyaakhtar
Copy link
Collaborator

@samiyaakhtar samiyaakhtar commented Mar 25, 2020

Adding PR column for wide output
Screen Shot 2020-03-24 at 3 36 14 PM

Closes microsoft/bedrock#1167

@dennisseah
Copy link
Collaborator

it am not sure if having a Promise.all in a Promise.all in a good thing to do.

return new Promise((resolve, reject) => {
    Promise.all([deploymentsPromise, syncStatusesPromise])
      .then((tuple: [IDeployment[] | undefined, ITag[] | undefined]) => {
        const deployments: IDeployment[] | undefined = tuple[0];
        const syncStatuses: ITag[] | undefined = tuple[1];
        if (values.outputFormat === OUTPUT_FORMAT.WIDE) {
          getPRs(deployments);
        }
        if (values.outputFormat === OUTPUT_FORMAT.JSON) {
          console.log(JSON.stringify(deployments, null, 2));
          resolve(deployments);
        } else {
          Promise.all(promises).then(() => {
            printDeployments(
              deployments,
              values.outputFormat,
              values.nTop,
              syncStatuses
            );
            resolve(deployments);
          });
        }
      })
      .catch((e) => {
        reject(new Error(e));
      });
  });

you may want to break this block into smaller functions

@samiyaakhtar samiyaakhtar changed the title [DO NOT MERGE] spk deployment get includes PR column (if available) spk deployment get includes PR column (if available) Mar 25, 2020
@samiyaakhtar
Copy link
Collaborator Author

@dennisseah could you provide context as to why that's not a good thing to do? I'm reading online and not finding anything related. The second promise.all is needed and will only block when PR info has to be fetched, only in the case of wide output

@andrebriggs
Copy link
Collaborator

@dennisseah could you provide context as to why that's not a good thing to do? I'm reading online and not finding anything related. The second promise.all is needed and will only block when PR info has to be fetched, only in the case of wide output

@samiyaakhtar Breaking things down leads to a more testable design. Being able to try/catch is important for error handling. In our contributing page we highlight this:

// Async/Await based
try {
  const passwd = await promiseBasedReadFile("etc/passwd");
  console.log(passwd);
} catch (err) {
  console.error(err);
  throw err;
}```

@gemorris
Copy link
Collaborator

I would like to find a way to bring the "needs attention" nature of rows which are awaiting approval to the regular (non-wide) view. One way would be truncating the very wide columns trhat are already present (if this could be done meaningfully) to make room for the Merged by column (although this is not communicating the issue very strongly). Another option is to substitute the string "Awaiting Approval" or similar, for the em dash in the HLD to Manifest column. A third option would be to bring in the Status column to the CLI somehow.

@samiyaakhtar
Copy link
Collaborator Author

@gemorris @andrebriggs i think we should make the suggested changes a part of this task microsoft/bedrock#743, since this one is open and awaiting tasks under it. Perhaps we should close out this one since it adds the columns we need?

@samiyaakhtar
Copy link
Collaborator Author

Bump. Looking for some eyes on this since more improvements to this table will come as part of microsoft/bedrock#743

@samiyaakhtar samiyaakhtar merged commit 0c6cada into CatalystCode:master Mar 27, 2020
@samiyaakhtar samiyaakhtar deleted the 1167 branch March 27, 2020 20:06
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

spk deployment get should display PR column
5 participants