Skip to content

fix: Don't show broken url if a site is undeployed #327

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions src/commands/sites/list.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ class SitesListCommand extends Command {
id: site.id,
name: site.name,
ssl_url: site.ssl_url,
account_name: site.account_name
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i need to doublecheck this as i lack context on this specific command but whats up with the rename of these props?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

site.ssl_url is always defined in the API, even if the site is not deployed.

I needed to check if site is deployed, so I used site.published_deploy; because published_deploy also contained ssl_url, I decided to use that instead of site.ssl_url

I'm not sure if they are the same though. An alternative approach would be to keep using site.ssl_url and only use published_deploy as a flag.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh man ok. thanks very much. i dont have bandwidth to look at this right now but appreciate the input and will need to come back to this to confirm that these are the right values.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey, just fyi. There is one more case where cli output is broken — the site is deployed, but the recent build fails. It seems, that the API data doesn't contain any information about the recent broken build.

A possible solution might be to list the deployments for each site, and calculate status from there, but probably it's better to add the status of most recent build to the API.

In any case, this MR doesn't cover all use cases, so feel free to close.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thank you. still very tied up here but will get to it eventually. hugely appreciate the PR though!

account_name: site.account_name,
published_deploy: site.published_deploy,
admin_url: site.admin_url
}

if (site.build_settings && site.build_settings.repo_url) {
Expand Down Expand Up @@ -49,7 +51,13 @@ class SitesListCommand extends Command {

logSites.forEach(s => {
console.log(`${chalk.greenBright(s.name)} - ${s.id}`)
console.log(` ${chalk.whiteBright.bold('url:')} ${chalk.yellowBright(s.ssl_url)}`)

if (s.published_deploy) {
console.log(` ${chalk.whiteBright.bold('url:')} ${chalk.yellowBright(s.ssl_url)}`)
} else {
console.log(` ${chalk.whiteBright.bold('url:')} ${chalk.redBright('Site deploy failed')} (${s.admin_url}/deploys)`)
}

if (s.repo_url) {
console.log(` ${chalk.whiteBright.bold('repo:')} ${chalk.white(s.repo_url)}`)
}
Expand Down