Skip to content

Commit

Permalink
Add Quesma logo (#23)
Browse files Browse the repository at this point in the history
Small, but we should have it before recording demos:
![Screenshot 2024-05-02 at 15 53
15](https://github.com/QuesmaOrg/quesma/assets/972989/836bb147-e5c8-4724-9013-66de7b061d77)
  • Loading branch information
jakozaur authored May 2, 2024
1 parent ea76b24 commit 09bbc61
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 21 deletions.
7 changes: 6 additions & 1 deletion quesma/quesma/ui/asset/head.html
Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,18 @@
}

.topnav h3 {
margin: 0 20px 0 10px;
margin: 4px 0 0 0;
}

.topnav h3, .topnav a, .topnav label {
font-size: 1.2em;
}

.topnav img {
height: 1.8em;
padding: 0 10px;
}

.topnav ul {
list-style-type: none;
margin: 0;
Expand Down
5 changes: 5 additions & 0 deletions quesma/quesma/ui/asset/quesma-logo-white-full.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
42 changes: 22 additions & 20 deletions quesma/quesma/ui/html_pages.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,21 @@ import (
"strings"
)

func generateSimpleTop(title string) []byte {
var buffer HtmlBuffer
buffer.Html(`<div class="topnav">` + "\n")
buffer.Html(`<div class="topnav-menu">` + "\n")
buffer.Html(`<img src="/static/asset/quesma-logo-white-full.svg" alt="Quesma logo" class="quesma-logo" />` + "\n")
buffer.Html(`<h3>`).Text(title).Html(`</h3>`)
buffer.Html("\n</div>\n</div>\n\n")
return buffer.Bytes()
}

func generateTopNavigation(target string) []byte {
var buffer HtmlBuffer
buffer.Html(`<div class="topnav">` + "\n")
buffer.Html(`<div class="topnav-menu">` + "\n")
buffer.Html("<h3>Quesma</h3>\n")
buffer.Html(`<img src="/static/asset/quesma-logo-white-full.svg" alt="Quesma logo" class="quesma-logo" />` + "\n")
buffer.Html("<ul>\n")
buffer.Html("<li")
if target == "dashboard" {
Expand Down Expand Up @@ -646,14 +656,12 @@ func (qmc *QuesmaManagementConsole) generateReportForRequestId(requestId string)
qmc.mutex.Unlock()

buffer := newBufferWithHead()
buffer.Html(`<div class="topnav">`)
if requestFound {
buffer.Html("\n<h3>Quesma Report for request Id ").Text(requestId).Html("</h3>")
buffer.Write(generateSimpleTop("Report for request Id " + requestId))
} else {
buffer.Html("\n<h3>Quesma Report not found for ").Text(requestId).Html("</h3>")
buffer.Write(generateSimpleTop("Report not found for request Id " + requestId))
}

buffer.Html("\n</div>\n")
buffer.Html(`<main id="queries">`)

debugKeyValueSlice := []DebugKeyValue{}
Expand Down Expand Up @@ -699,17 +707,15 @@ func (qmc *QuesmaManagementConsole) generateLogForRequestId(requestId string) []
logMessages, optAsyncId := generateLogMessages(request.logMessages)

buffer := newBufferWithHead()
buffer.Html(`<div class="topnav">`)
if requestFound {
buffer.Html("\n<h3>Quesma Log for request id ").Text(requestId)
if optAsyncId != nil {
buffer.Text(" and async id '").Text(*optAsyncId).Html("'")
buffer.Write(generateSimpleTop("Log for request id " + requestId + " and async id " + *optAsyncId))
} else {
buffer.Write(generateSimpleTop("Log for request id " + requestId))
}
buffer.Html("</h3>")
} else {
buffer.Html("\n<h3>Quesma Log not found for ").Text(requestId).Html("</h3>")
buffer.Write(generateSimpleTop("Log not found for request id " + requestId))
}
buffer.Html("\n</div>\n")

buffer.Html(`<main class="center" id="request-log-messages">`)
buffer.Html("\n\n")
Expand Down Expand Up @@ -830,7 +836,7 @@ func (qmc *QuesmaManagementConsole) generateReportForRequestsWithStr(requestStr
}
qmc.mutex.Unlock()

title := fmt.Sprintf("Quesma Report for str '%s' with %d results", requestStr, len(debugKeyValueSlice))
title := fmt.Sprintf("Report for str '%s' with %d results", requestStr, len(debugKeyValueSlice))
return qmc.generateReportForRequests(title, debugKeyValueSlice)
}

Expand All @@ -847,7 +853,7 @@ func (qmc *QuesmaManagementConsole) generateReportForRequestsWithError() []byte
}
qmc.mutex.Unlock()

return qmc.generateReportForRequests("Quesma Report for requests with errors", debugKeyValueSlice)
return qmc.generateReportForRequests("Report for requests with errors", debugKeyValueSlice)
}

func (qmc *QuesmaManagementConsole) generateReportForRequestsWithWarning() []byte {
Expand All @@ -863,13 +869,12 @@ func (qmc *QuesmaManagementConsole) generateReportForRequestsWithWarning() []byt
}
qmc.mutex.Unlock()

return qmc.generateReportForRequests("Quesma Report for requests with warnings", debugKeyValueSlice)
return qmc.generateReportForRequests("Report for requests with warnings", debugKeyValueSlice)
}

func (qmc *QuesmaManagementConsole) generateReportForRequests(title string, requests []DebugKeyValue) []byte {
buffer := newBufferWithHead()
buffer.Html(`<div class="topnav">`)
buffer.Html("\n<h3>").Text(title).Html("</h3>")
buffer.Write(generateSimpleTop(title))

buffer.Html("\n</div>\n\n")

Expand All @@ -893,10 +898,7 @@ func (qmc *QuesmaManagementConsole) generateReportForRequests(title string, requ

func (qmc *QuesmaManagementConsole) generateErrorForReason(reason string) []byte {
buffer := newBufferWithHead()
buffer.Html(`<div class="topnav">`)
title := fmt.Sprintf("Quesma Errors with reason '%s'", reason)
buffer.Html("\n<h3>").Text(title).Html("</h3>")
buffer.Html("\n</div>\n\n")
buffer.Write(generateTopNavigation(fmt.Sprintf("Errors with reason '%s'", reason)))

buffer.Html(`<main id="errors">`)
errors := errorstats.GlobalErrorStatistics.ErrorReportsForReason(reason)
Expand Down

0 comments on commit 09bbc61

Please sign in to comment.