Skip to content
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

fix(web-templates): use CleanedBasePath for static content #2079

Merged
merged 2 commits into from
Feb 28, 2022

Conversation

jvrplmlmn
Copy link
Contributor

@jvrplmlmn jvrplmlmn commented Feb 24, 2022

When setting '--atlantis-url' this static content 404s.

For example, we can see this when comparig:

  • /lock --> works seamless with a custom --atlantis-url
  • /jobs --> doesn't work when using a custom --atlantis-url

Note that for the different templates, we are configuring CleanedBasePath: s.AtlantisURL.Path:

atlantis/server/server.go

Lines 879 to 884 in 58e9b42

err = s.IndexTemplate.Execute(w, templates.IndexData{
Locks: lockResults,
ApplyLock: applyLockData,
AtlantisVersion: s.AtlantisVersion,
CleanedBasePath: s.AtlantisURL.Path,
})

viewData := templates.LockDetailData{
LockKeyEncoded: id,
LockKey: idUnencoded,
PullRequestLink: lock.Pull.URL,
LockedBy: lock.Pull.Author,
Workspace: lock.Workspace,
AtlantisVersion: l.AtlantisVersion,
CleanedBasePath: l.AtlantisURL.Path,
RepoOwner: owner,
RepoName: repo,
}
err = l.LockDetailTemplate.Execute(w, viewData)

viewData := templates.ProjectJobData{
AtlantisVersion: j.AtlantisVersion,
ProjectPath: jobID,
CleanedBasePath: j.AtlantisURL.Path,
}
if err = j.ProjectJobsTemplate.Execute(w, viewData); err != nil {
j.Logger.Err(err.Error())
}
}

Credit goes to @iainlane 👍

When setting '--atlantis-url' this static content 404s.

For example, we can see this when comparig:
- /lock --> works seamless with a custom `--atlantis-url`
- /jobs --> doesn't work when using a custom `--atlantis-url`
@jvrplmlmn jvrplmlmn marked this pull request as ready for review February 24, 2022 15:05
@jvrplmlmn jvrplmlmn requested a review from a team as a code owner February 24, 2022 15:05
@inkel
Copy link
Contributor

inkel commented Feb 24, 2022

Thank you!

@@ -102,7 +102,7 @@ func staticCssCustomCss() (*asset, error) {
return nil, err
}

info := bindataFileInfo{name: "static/css/custom.css", size: 6946, mode: os.FileMode(420), modTime: time.Unix(1641777138, 0)}
info := bindataFileInfo{name: "static/css/custom.css", size: 6946, mode: os.FileMode(420), modTime: time.Unix(1635422826, 0)}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm unsure if this changes are required, I generated this file via:

make dist

Copy link
Member

@chenrui333 chenrui333 left a comment

Choose a reason for hiding this comment

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

lgtm

@chenrui333 chenrui333 merged commit 51d434d into runatlantis:master Feb 28, 2022
@chenrui333
Copy link
Member

Thanks @jvrplmlmn!

jvrplmlmn added a commit to jvrplmlmn/atlantis that referenced this pull request Mar 1, 2022
A follow-up to runatlantis#2079

After upgrading to https://github.com/runatlantis/atlantis/releases/tag/v0.18.3 in our own
infra, I noticed a minor issue with the links in the titles, they are still pointing to /
even when '--atlantis-url' is provided.
@jvrplmlmn jvrplmlmn deleted the use-base-path branch March 1, 2022 09:06
chenrui333 pushed a commit that referenced this pull request Mar 1, 2022
A follow-up to #2079

After upgrading to https://github.com/runatlantis/atlantis/releases/tag/v0.18.3 in our own
infra, I noticed a minor issue with the links in the titles, they are still pointing to /
even when '--atlantis-url' is provided.
krrrr38 pushed a commit to krrrr38/atlantis that referenced this pull request Dec 16, 2022
…is#2079)

* fix(web-templates): use CleanedBasePath for static content

When setting '--atlantis-url' this static content 404s.

For example, we can see this when comparig:
- /lock --> works seamless with a custom `--atlantis-url`
- /jobs --> doesn't work when using a custom `--atlantis-url`

* fix(web-templates): regenerate bindata_assetfs
krrrr38 pushed a commit to krrrr38/atlantis that referenced this pull request Dec 16, 2022
A follow-up to runatlantis#2079

After upgrading to https://github.com/runatlantis/atlantis/releases/tag/v0.18.3 in our own
infra, I noticed a minor issue with the links in the titles, they are still pointing to /
even when '--atlantis-url' is provided.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants