Skip to content

Commit

Permalink
Merge pull request #87 from ReCodee/modernize-table-appearance
Browse files Browse the repository at this point in the history
Modernize table appearance
  • Loading branch information
olivergondza authored Aug 14, 2023
2 parents a64a7bd + 7af3c22 commit d6d6b29
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 12 deletions.
20 changes: 12 additions & 8 deletions src/main/resources/lib/cloudstats/attempts.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Jenkins j = app

style("""
#cloud-stat-grid {
border: 1px solid #BBB;
}
td.status-WARN {
Expand Down Expand Up @@ -52,22 +52,25 @@ style("""
padding-left: 4em;
}
""")
table(class: "pane sortable bigtable", width: "100%", id: "cloud-stat-grid") {
tr {
th("Cloud"); th("Template"); th("Name"); th("Started"); th("Provisioning"); th("Launch"); th("Operation"); th("Completed")
table(class: "sortable jenkins-table", width: "100%", id: "cloud-stat-grid") {
thead {
tr {
th("Cloud"); th("Template"); th("Name"); th("Started"); th("Provisioning"); th("Launch"); th("Operation");
th("Completed")
}
}

DateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss")

String[] computerNames = j.getComputers().collect { it.name }

tbody {
acts.reverseEach { ProvisioningActivity activity ->
def activityStatus = activity.status
List<PhaseExecution> executions = new ArrayList<>(activity.phaseExecutions.values())
tr("class": "status-${activityStatus}") {
td(activity.id.cloudName)
td(activity.id.templateName)
td{
td {
def n = activity.name
if (computerNames.contains(n)) {
a(href: rootURL + "/computer/" + n + "/") { text(n) }
Expand All @@ -78,7 +81,7 @@ table(class: "pane sortable bigtable", width: "100%", id: "cloud-stat-grid") {
td(data: executions[0].startedTimestamp) {
text(df.format(executions[0].started))
}
for (PhaseExecution execution: executions) {
for (PhaseExecution execution : executions) {
if (execution == null) {
td() // empty cell
continue
Expand All @@ -98,7 +101,7 @@ table(class: "pane sortable bigtable", width: "100%", id: "cloud-stat-grid") {
data = execution.startedTimestamp
}

def attrs = [ "data": data ]
def attrs = ["data": data]
if (execution.status.ordinal() >= activityStatus.ordinal()) {
attrs["class"] = "status-${execution.status}"
}
Expand All @@ -124,3 +127,4 @@ table(class: "pane sortable bigtable", width: "100%", id: "cloud-stat-grid") {
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -36,18 +36,22 @@ CloudStatistics stats = my

style("""
#cloud-stats-overview th {
text-align: left;
text-align: left;
}
""")

l.layout(permission: stats.getRequiredPermission()) {
l.header(title: stats.displayName)
l.main_panel {
h1(stats.displayName)
table(class: "pane sortable bigtable", width: "100%", id: "cloud-stats-overview") {
tr {
th("Cloud"); th("Template"); th("Overall success rate"); th("Current success rate"); th("Sample count")
table(class: "sortable jenkins-table", width: "100%", id: "cloud-stats-overview") {
thead {
tr {
th("Cloud"); th("Template"); th("Overall success rate"); th("Current success rate");
th("Sample count")
}
}
tbody {
def index = stats.index
def templateHealth = index.healthByTemplate()
index.healthByCloud().each { String cloud, Health ch ->
Expand Down Expand Up @@ -92,6 +96,7 @@ l.layout(permission: stats.getRequiredPermission()) {
}
}
}
}

h2("Provisioning attempts")
cs.attempts(stats: stats, activities: stats.activities)
Expand Down

0 comments on commit d6d6b29

Please sign in to comment.