Skip to content

Commit 8308294

Browse files
authored
Merge pull request #188 from CodexRaunak/toolkit-ux
Improve toolkit ux
2 parents 9b6f11b + 0656343 commit 8308294

3 files changed

Lines changed: 70 additions & 41 deletions

File tree

layouts/partials/academy-validation/collect-content-health.html

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@
6868
{{- $issue := "" -}}
6969
{{- $fix := "" -}}
7070
{{- $registryStatus := "" -}}
71+
{{- $cloudStatus := "" -}}
7172
{{- $isDraft := or .Draft (eq (printf "%v" .Params.draft | lower) "true") -}}
7273
{{- if not $isDraft -}}
7374
{{- $sourcePath := printf "content/%s" $filePath -}}
@@ -109,6 +110,10 @@
109110
{{- $status = "broken" -}}
110111
{{- $issue = printf "Content ID '%s' does not exist in the Academy registry for org '%s'." $contentID $orgID -}}
111112
{{- $fix = "Use the registered ID from the Instructor Console, or create/register this content before publishing." -}}
113+
{{- else -}}
114+
{{- with index $registry.contentStatuses $contentID -}}
115+
{{- $cloudStatus = printf "%v" . | strings.TrimSpace | lower -}}
116+
{{- end -}}
112117
{{- end -}}
113118
{{- end -}}
114119

@@ -143,6 +148,7 @@
143148
"fix" $fix
144149
"draft" $isDraft
145150
"registryStatus" $registryStatus
151+
"cloudStatus" $cloudStatus
146152
"registryURL" $registryURL
147153
) -}}
148154
{{- end -}}

layouts/partials/academy-validation/validate-academy-registry-ids.html

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@
1111
{{- $separator := cond (in $registryURL "?") "&" "?" -}}
1212
{{- $url := printf "%s%sorgId=%s&status=ready,not_ready" $registryURL $separator $orgID -}}
1313
{{- $registeredIDs := slice -}}
14-
{{- $result := dict "status" "ok" "ids" $registeredIDs "message" "" "url" $url -}}
14+
{{- $contentStatuses := dict -}}
15+
{{- $result := dict "status" "ok" "ids" $registeredIDs "contentStatuses" $contentStatuses "message" "" "url" $url -}}
1516
{{- $remoteCacheEpochKey := "academy-theme-registry-cache-epoch" -}}
1617
{{- if not ($site.Store.Get $remoteCacheEpochKey) -}}
1718
{{- $site.Store.Set $remoteCacheEpochKey (now.Format "20060102150405") -}}
@@ -36,14 +37,20 @@
3637
{{- end -}}
3738
{{- end -}}
3839
{{- range $records -}}
39-
{{- with index . "id" -}}
40+
{{- $record := . -}}
41+
{{- with index $record "id" -}}
4042
{{- $id := printf "%v" . | strings.TrimSpace -}}
4143
{{- if ne $id "" -}}
4244
{{- $registeredIDs = $registeredIDs | append $id -}}
45+
{{- $contentStatus := "" -}}
46+
{{- with index $record "status" -}}
47+
{{- $contentStatus = printf "%v" . | strings.TrimSpace | lower -}}
48+
{{- end -}}
49+
{{- $contentStatuses = merge $contentStatuses (dict $id $contentStatus) -}}
4350
{{- end -}}
4451
{{- end -}}
4552
{{- end -}}
46-
{{- $result = dict "status" "ok" "ids" $registeredIDs "message" "" "url" $url -}}
53+
{{- $result = dict "status" "ok" "ids" $registeredIDs "contentStatuses" $contentStatuses "message" "" "url" $url -}}
4754
{{- end -}}
4855
{{- end -}}
4956

layouts/shortcodes/instructor-toolkit.html

Lines changed: 54 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,12 @@
1616
{{- $publishable := and (gt (len $items) 0) (eq $problemCount 0) -}}
1717

1818
<section class="academy-toolkit academy-toolkit--{{ $report.summary }}">
19-
<header class="academy-toolkit__header">
20-
<h2>ID Validation</h2>
21-
</header>
2219

2320
<p class="academy-toolkit__verdict {{ cond $publishable "academy-toolkit__verdict--good" "academy-toolkit__verdict--bad" }}">
2421
{{- if $publishable -}}
25-
<em>Ready to publish to the Academy.</em>
22+
Ready to publish
2623
{{- else -}}
27-
<em>Not ready to publish to the Academy.</em>
24+
Not ready to publish
2825
{{- end -}}
2926
</p>
3027

@@ -52,18 +49,12 @@ <h2>ID Validation</h2>
5249
</strong>
5350
</p>
5451
</div>
55-
56-
{{- if ne $consoleURL "" -}}
57-
<p class="academy-toolkit__action">
58-
Fix the invalid IDs in the <a href="{{ $consoleURL }}" target="_blank" rel="noopener">Instructor Console</a> using the <a href="https://docs.layer5.io/cloud/academy/creating-content/instructor-console-guide/#using-the-content-creation-tool" target="_blank" rel="noopener">Content Creation Tool</a>.
59-
</p>
60-
{{- end -}}
6152
{{- end -}}
6253

6354
{{- if ne (len $items) 0 -}}
6455
<p class="academy-toolkit__legend">
65-
<span>⚠️ Draft page: Content ID is not registered or missing.</span>
66-
<span> Content ID is not registered or missing.</span>
56+
<span>{{- if ne $consoleURL "" -}}<a href="{{ $consoleURL }}" target="_blank" rel="noopener" aria-label="Open Instructor Console">⚠️</a>{{- else -}}⚠️{{- end -}} Draft page: Content ID is not registered or missing.</span>
57+
<span>{{- if ne $consoleURL "" -}}<a href="{{ $consoleURL }}" target="_blank" rel="noopener" aria-label="Open Instructor Console"></a>{{- else -}}❌{{- end -}} Content ID is not registered or missing.</span>
6758
<span>✅ Content ID is registered.</span>
6859
</p>
6960
{{- end -}}
@@ -87,22 +78,36 @@ <h2>ID Validation</h2>
8778
<tbody>
8879
{{- range $items -}}
8980
{{- $pageURL := .relPermalink -}}
90-
{{- if and (eq .status "good") (ne .productionPermalink "") -}}
81+
{{- if and (eq .status "good") (eq .cloudStatus "ready") (ne .productionPermalink "") -}}
9182
{{- $pageURL = .productionPermalink -}}
9283
{{- end -}}
9384
<tr>
9485
<th scope="row"><a href="{{ $pageURL }}">{{ .title }}</a></th>
9586
<td>{{ cond .draft "True" "False" }}</td>
96-
<td>{{ cond (ne .contentID "") .contentID "Missing ID" }}</td>
87+
<td>
88+
{{- if eq .status "good" -}}
89+
{{ cond (ne .contentID "") .contentID "Missing ID" }}
90+
{{- else if and (ne $consoleURL "") (or (eq .status "draft_warning") (eq .status "broken") (eq .status "unchecked")) -}}
91+
<a href="{{ $consoleURL }}" target="_blank" rel="noopener" aria-label="Open Instructor Console">
92+
{{- if eq .contentID "" -}}
93+
Missing ID
94+
{{- else -}}
95+
{{ .contentID }}
96+
{{- end -}}
97+
</a>
98+
{{- else -}}
99+
{{ cond (ne .contentID "") .contentID "Missing ID" }}
100+
{{- end -}}
101+
</td>
97102
<td>
98103
{{- if eq .status "draft_warning" -}}
99-
⚠️
104+
{{- if ne $consoleURL "" -}}<a href="{{ $consoleURL }}" target="_blank" rel="noopener" aria-label="Open Instructor Console">⚠️</a>{{- else -}}⚠️{{- end -}}
100105
{{- else if eq .status "good" -}}
101106
102107
{{- else if eq .status "unchecked" -}}
103108
Not checked
104109
{{- else -}}
105-
110+
{{- if ne $consoleURL "" -}}<a href="{{ $consoleURL }}" target="_blank" rel="noopener" aria-label="Open Instructor Console"></a>{{- else -}}❌{{- end -}}
106111
{{- end -}}
107112
</td>
108113
</tr>
@@ -111,11 +116,17 @@ <h2>ID Validation</h2>
111116
</table>
112117
{{- end -}}
113118

114-
{{- if gt $draftWarningCount 0 -}}
115-
<p class="academy-toolkit__draft-note">
116-
Draft ID warnings do not block publishing, but fix missing or invalid IDs before publishing those draft pages.
119+
{{- if and (gt $problemCount 0) (ne $consoleURL "") -}}
120+
<p class="academy-toolkit__action">
121+
Fix invalid IDs in the <a href="{{ $consoleURL }}" target="_blank" rel="noopener">Instructor Console</a> using the <a href="https://docs.layer5.io/cloud/academy/creating-content/instructor-console-guide/#using-the-content-creation-tool" target="_blank" rel="noopener">Content Creation tool</a>.
117122
</p>
118123
{{- end -}}
124+
125+
{{- if gt $draftWarningCount 0 -}}
126+
<blockquote>
127+
<p>Note: Draft ID warnings do not block publishing, but fix missing or invalid IDs before publishing draft pages.</p>
128+
</blockquote>
129+
{{- end -}}
119130
</section>
120131

121132
<style>
@@ -151,6 +162,7 @@ <h2>ID Validation</h2>
151162
display: inline-flex;
152163
align-items: center;
153164
margin: 0;
165+
font-size: 1.15rem;
154166
}
155167

156168
.academy-toolkit__legend {
@@ -166,20 +178,31 @@ <h2>ID Validation</h2>
166178
white-space: nowrap;
167179
}
168180

169-
.academy-toolkit__draft-note {
170-
margin: 0 0 0.75rem;
171-
color: #52616b;
172-
font-style: italic;
181+
.academy-toolkit__action {
182+
margin: 0.85rem 0 0.75rem;
183+
color: #182126;
184+
font-size: 1rem;
173185
}
174186

175-
.academy-toolkit__action {
176-
margin: 0 0 0.75rem;
177-
color: #52616b;
187+
.academy-toolkit__action a {
188+
color: #00b39f;
178189
}
179190

180191
.academy-toolkit__verdict {
181-
margin: 0.9rem 0 0;
182-
font-weight: 700;
192+
margin: 0.9rem 0 0.25rem;
193+
font-size: 1.55rem;
194+
font-weight: 800;
195+
line-height: 1.2;
196+
}
197+
198+
.academy-toolkit a {
199+
color: #00b39f;
200+
text-decoration: none;
201+
}
202+
203+
.academy-toolkit a:hover,
204+
.academy-toolkit a:focus {
205+
color: rgba(0, 179, 159, 0.7);
183206
}
184207

185208
.academy-toolkit__table {
@@ -214,18 +237,11 @@ <h2>ID Validation</h2>
214237
}
215238

216239
.academy-toolkit__table tbody th a {
217-
color: inherit;
218240
font-weight: inherit;
219-
text-decoration: none;
220241
}
221242

222-
.academy-toolkit__table tbody th a:hover,
223-
.academy-toolkit__table tbody th a:focus {
224-
text-decoration: underline;
225-
}
226-
227-
.academy-toolkit__table tbody td {
228-
color: #52616b;
243+
.academy-toolkit__table tbody td a {
244+
text-decoration: none;
229245
}
230246

231247
.academy-toolkit__table tbody td:last-child {

0 commit comments

Comments
 (0)