Skip to content

Commit

Permalink
Redirect to apply logs upon confirming plan
Browse files Browse the repository at this point in the history
  • Loading branch information
leg100 committed Nov 12, 2022
1 parent f698d72 commit 8bfd6fe
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion http/html/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ func (app *Application) applyRun(w http.ResponseWriter, r *http.Request) {
writeError(w, err.Error(), http.StatusInternalServerError)
return
}
http.Redirect(w, r, getRunPath(runRequest{workspaceRequest{r}}), http.StatusFound)
http.Redirect(w, r, getRunPath(runRequest{workspaceRequest{r}})+"#apply", http.StatusFound)
}

func (app *Application) discardRun(w http.ResponseWriter, r *http.Request) {
Expand Down
1 change: 1 addition & 0 deletions http/html/static/css/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -538,4 +538,5 @@ button.delete:hover {
#run-confirm-container {
display: flex;
gap: 1em;
margin-bottom: 1em;
}
6 changes: 6 additions & 0 deletions http/html/static/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,12 @@ function watchRunUpdates(path, stream, run) {
var actions = document.getElementById('run-confirm-container');
if (obj['run-status'] == 'planned') {
actions.style.display = 'flex';
// if user is at/near very bottom of page then scroll down to
// bring buttons into view.
atBottom = (Math.floor(window.scrollY) + window.innerHeight) >= (document.body.scrollHeight - 100);
if (atBottom) {
document.body.scrollIntoView(false);
}
} else {
actions.style.display = 'none';
}
Expand Down

0 comments on commit 8bfd6fe

Please sign in to comment.