Skip to content

Commit

Permalink
Add success message to Getting Started page (#616)
Browse files Browse the repository at this point in the history
This change adds a InitSuccessFeedback variable for the Getting
Started page's html template so we can show a success message if
the OVA init tasks (tag and PSC register) finish with success.

This commit does not include the html template changes.
  • Loading branch information
Anchal Agrawal authored and jak-atx committed Aug 22, 2017
1 parent 486f35d commit e9cb434
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 12 deletions.
6 changes: 3 additions & 3 deletions installer/fileserver/html/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@
</header>
<main class="content-container">
<div class="content-area">
{{if .Feedback }}
{{if .InitErrorFeedback }}
<div id="feedback-alert" class="alert alert-danger">
<div class="alert-item">
<span class="alert-text">{{ .Feedback }}</span>
<span class="alert-text">{{ .InitErrorFeedback }}</span>
<div class="alert-actions">
<a href="/?login=true" title="Login" class="alert-action">Re-initialize</a>
</div>
Expand Down Expand Up @@ -161,7 +161,7 @@ <h4>Infrastructure Deployment Tools</h4>
</div>
</div>
</div>
{{if .Feedback}}
{{if .InitErrorFeedback}}
<a href="/?login=true" id="feedback-link" class="btn btn-link px-0 my-2">
Re-initialize the vSphere Integrated Container Appliance
</a>
Expand Down
25 changes: 16 additions & 9 deletions installer/fileserver/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,13 @@ type config struct {

// IndexHTMLOptions contains fields for html templating in index.html
type IndexHTMLOptions struct {
InvalidLogin bool
Feedback string
NeedLogin bool
AdmiralAddr string
DemoVCHAddr string
FileserverAddr string
InvalidLogin bool
InitErrorFeedback string
InitSuccessFeedback string
NeedLogin bool
AdmiralAddr string
DemoVCHAddr string
FileserverAddr string
}

var (
Expand Down Expand Up @@ -189,8 +190,9 @@ func indexHandler(resp http.ResponseWriter, req *http.Request) {
defer trace.End(trace.Begin(""))

html := &IndexHTMLOptions{
NeedLogin: needInitializationServices(req),
Feedback: "",
NeedLogin: needInitializationServices(req),
InitErrorFeedback: "",
InitSuccessFeedback: "",
}

if req.Method == http.MethodPost {
Expand All @@ -205,7 +207,12 @@ func indexHandler(resp http.ResponseWriter, req *http.Request) {

} else {
log.Infof("Validation succeeded")
html.Feedback = startInitializationServices()
html.InitErrorFeedback = startInitializationServices()
// Display success message upon init success.
if html.InitErrorFeedback == "" {
html.InitSuccessFeedback = "Installation successful. Refer to the Post-install and Deployment tasks below."
}

html.NeedLogin = false
}
}
Expand Down

0 comments on commit e9cb434

Please sign in to comment.