Skip to content

Commit 2d91745

Browse files
committed
chore: refinements to dashboard
This PR splits dashboard.md into an offline (dashboard.md) and live (dashboard-live.md) variant. This PR also picks up some bug fixes from Kui.
1 parent 1f0280c commit 2d91745

File tree

9 files changed

+539
-434
lines changed

9 files changed

+539
-434
lines changed

package-lock.json

Lines changed: 376 additions & 370 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -82,10 +82,10 @@
8282
"printWidth": 120
8383
},
8484
"devDependencies": {
85-
"@kui-shell/builder": "11.5.0-dev-20220616-173547",
86-
"@kui-shell/proxy": "11.5.0-dev-20220616-173547",
87-
"@kui-shell/react": "11.5.0-dev-20220616-173547",
88-
"@kui-shell/webpack": "11.5.0-dev-20220616-173547",
85+
"@kui-shell/builder": "11.5.0-dev-20220617-172311",
86+
"@kui-shell/proxy": "11.5.0-dev-20220617-172311",
87+
"@kui-shell/react": "11.5.0-dev-20220617-172311",
88+
"@kui-shell/webpack": "11.5.0-dev-20220617-172311",
8989
"@playwright/test": "^1.22.2",
9090
"@types/debug": "^4.1.7",
9191
"@types/node": "14.11.8",
@@ -107,17 +107,17 @@
107107
},
108108
"dependencies": {
109109
"@kui-shell/client": "file:./plugins/plugin-client-default",
110-
"@kui-shell/core": "11.5.0-dev-20220616-173547",
111-
"@kui-shell/plugin-bash-like": "11.5.0-dev-20220616-173547",
112-
"@kui-shell/plugin-carbon-themes": "11.5.0-dev-20220616-173547",
113-
"@kui-shell/plugin-client-common": "11.5.0-dev-20220616-173547",
110+
"@kui-shell/core": "11.5.0-dev-20220617-172311",
111+
"@kui-shell/plugin-bash-like": "11.5.0-dev-20220617-172311",
112+
"@kui-shell/plugin-carbon-themes": "11.5.0-dev-20220617-172311",
113+
"@kui-shell/plugin-client-common": "11.5.0-dev-20220617-172311",
114114
"@kui-shell/plugin-codeflare": "file:./plugins/plugin-codeflare",
115-
"@kui-shell/plugin-core-support": "11.5.0-dev-20220616-173547",
116-
"@kui-shell/plugin-electron-components": "11.5.0-dev-20220616-173547",
117-
"@kui-shell/plugin-kubectl": "11.5.0-dev-20220616-173547",
115+
"@kui-shell/plugin-core-support": "11.5.0-dev-20220617-172311",
116+
"@kui-shell/plugin-electron-components": "11.5.0-dev-20220617-172311",
117+
"@kui-shell/plugin-kubectl": "11.5.0-dev-20220617-172311",
118118
"@kui-shell/plugin-madwizard": "file:./plugins/plugin-madwizard",
119-
"@kui-shell/plugin-patternfly4-themes": "11.5.0-dev-20220616-173547",
120-
"@kui-shell/plugin-proxy-support": "11.5.0-dev-20220616-173547",
121-
"@kui-shell/plugin-s3": "11.5.0-dev-20220616-173547"
119+
"@kui-shell/plugin-patternfly4-themes": "11.5.0-dev-20220617-172311",
120+
"@kui-shell/plugin-proxy-support": "11.5.0-dev-20220617-172311",
121+
"@kui-shell/plugin-s3": "11.5.0-dev-20220617-172311"
122122
}
123123
}
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"label": "Notebooks",
33
"submenu": [
4-
{ "notebook": "Dashboard", "filepath": "dashboard.md" }
4+
{ "notebook": "Dashboard", "filepath": "dashboard.md" },
5+
{ "notebook": "Dashboard (live)", "filepath": "dashboard-live.md" }
56
]
67
}
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
---
2+
layout:
3+
1:
4+
position: left
5+
maximized: true
6+
2:
7+
position: default
8+
maximized: true
9+
---
10+
11+
=== "Summary"
12+
13+
```json
14+
--8<-- "$LOGDIR/job.json"
15+
```
16+
17+
---
18+
19+
=== "Application Logs"
20+
21+
```shell
22+
---
23+
execute: now
24+
maximize: true
25+
outputOnly: true
26+
---
27+
tail -f $LOGDIR/logs/job.txt
28+
```
29+
30+
=== "GPU Utilization"
31+
32+
```shell
33+
---
34+
execute: now
35+
maximize: true
36+
outputOnly: true
37+
---
38+
tail -f $LOGDIR/resources/gpu.txt
39+
```
40+
41+
42+
<!--
43+
---
44+
45+
# Kubernetes Events
46+
47+
```shell
48+
---
49+
execute: now
50+
maximize: true
51+
outputOnly: true
52+
---
53+
$TAIL $LOGDIR/events/kubernetes.txt
54+
```
55+
-->

plugins/plugin-client-default/notebooks/dashboard.md

Lines changed: 18 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,33 @@
11
---
22
layout:
3-
1: default
4-
2: default
5-
3: default
3+
1:
4+
position: left
5+
maximized: true
6+
2:
7+
position: default
8+
maximized: true
69
---
710

8-
# Job Description
9-
10-
```shell
11-
---
12-
execute: now
13-
maximize: true
14-
outputOnly: true
15-
---
16-
cat $LOGDIR/job.json
17-
```
11+
=== "Summary"
1812

13+
```json
14+
--8<-- "$LOGDIR/job.json"
15+
```
1916

2017
---
2118

22-
# GPU Utilization
19+
=== "Application Logs"
2320

24-
```shell
25-
---
26-
execute: now
27-
maximize: true
28-
outputOnly: true
29-
---
30-
$TAIL $LOGDIR/resources/gpu.txt
31-
```
21+
```ansi
22+
--8<-- "$LOGDIR/logs/job.txt"
23+
```
3224

33-
---
25+
=== "GPU Utilization"
3426

35-
# Job Logs
27+
```ansi
28+
--8<-- "$LOGDIR/resources/gpu.txt"
29+
```
3630

37-
```shell
38-
---
39-
execute: now
40-
maximize: true
41-
outputOnly: true
42-
---
43-
$TAIL $LOGDIR/logs/job.txt
44-
```
4531

4632
<!--
4733
---

plugins/plugin-codeflare/src/controller/dashboard.ts

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@
1414
* limitations under the License.
1515
*/
1616

17-
import { Arguments, CommandOptions, Registrar } from '@kui-shell/core'
17+
import { Arguments, CommandOptions, Registrar } from "@kui-shell/core"
18+
19+
import "../../web/scss/components/Dashboard/_index.scss"
1820

1921
interface DashboardOptions {
2022
f: boolean
@@ -24,10 +26,10 @@ interface DashboardOptions {
2426
function dashboardcli(args: Arguments) {
2527
const filepath = args.argvNoOptions[1]
2628
if (!filepath) {
27-
throw new Error('Usage: codeflare dashboard <filepath>')
29+
throw new Error("Usage: codeflare dashboard <filepath>")
2830
}
2931

30-
const restIdx = args.command.indexOf('dashboard') + 'dashboard'.length
32+
const restIdx = args.command.indexOf("dashboard") + "dashboard".length
3133
return args.REPL.qexec(`codeflare dashboardui ${args.command.slice(restIdx)}`)
3234
}
3335

@@ -38,21 +40,16 @@ async function dashboardui(args: Arguments<DashboardOptions>) {
3840
const filepath = args.argvNoOptions[2]
3941
process.env.LOGDIR = filepath
4042

41-
if (args.parsedOptions.follow) {
42-
process.env.TAIL = 'tail -f'
43-
} else {
44-
process.env.TAIL = 'cat'
45-
}
46-
47-
return args.REPL.qexec(`commentary -f /kui/client/dashboard.md`)
43+
const db = args.parsedOptions.follow ? "dashboard-live.md" : "dashboard.md"
44+
return args.REPL.qexec(`commentary -f /kui/client/${db}`)
4845
}
4946

5047
export default function registerDashboardCommands(registrar: Registrar) {
51-
const flags: CommandOptions['flags'] = {
52-
boolean: ['f', 'follow'],
53-
alias: { follow: ['f'] }
48+
const flags: CommandOptions["flags"] = {
49+
boolean: ["f", "follow"],
50+
alias: { follow: ["f"] },
5451
}
5552

56-
registrar.listen('/dashboard', dashboardcli, { flags })
57-
registrar.listen('/codeflare/dashboardui', dashboardui, { needsUI: true, outputOnly: true, flags })
53+
registrar.listen("/dashboard", dashboardcli, { flags })
54+
registrar.listen("/codeflare/dashboardui", dashboardui, { needsUI: true, outputOnly: true, flags })
5855
}

plugins/plugin-codeflare/src/plugin.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17-
import { Registrar } from '@kui-shell/core'
17+
import { Registrar } from "@kui-shell/core"
1818
import dashboard from "./controller/dashboard"
1919

2020
function help() {
@@ -26,5 +26,5 @@ codeflare dashboard /path/to/logdir`
2626
/** Register Kui Commands */
2727
export default function registerCodeflareCommands(registrar: Registrar) {
2828
dashboard(registrar)
29-
registrar.listen('/help', help)
29+
registrar.listen("/help", help)
3030
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
/*
2+
* Copyright 2022 The Kubernetes Authors
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
/*
2+
* Copyright 2022 The Kubernetes Authors
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
@import "@kui-shell/plugin-client-common/web/scss/components/Terminal/_mixins";
18+
@import "@kui-shell/plugin-client-common/web/scss/components/Terminal/Maximized";
19+
20+
@include Scrollback {
21+
@include Block {
22+
@include IsMaximized {
23+
overflow: hidden;
24+
}
25+
@include MarkdownTabContent {
26+
overflow: auto;
27+
font-size: 0.875em;
28+
}
29+
}
30+
31+
@include Markdown {
32+
pre > .paragraph {
33+
padding: 0;
34+
}
35+
code.kui--code--editor {
36+
padding: 0;
37+
}
38+
}
39+
.xterm-container.xterm-terminated {
40+
padding: 0;
41+
border: none;
42+
background: none;
43+
}
44+
}

0 commit comments

Comments
 (0)