Skip to content

Commit 7bc9a5a

Browse files
committed
feat: add stub for ray job logs visual enhancements
See plugins/plugin-codeflare/ray/src/components/Logs.tsx
1 parent 4259a27 commit 7bc9a5a

File tree

5 files changed

+88
-2
lines changed

5 files changed

+88
-2
lines changed
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
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 React from "react"
18+
19+
interface Props {
20+
jobid: string
21+
}
22+
23+
/** TODO. Probably follow the lead from here:
24+
* https://github.com/kubernetes-sigs/kui/blob/master/plugins/plugin-kubectl/src/lib/view/modes/Terminal.tsx
25+
*/
26+
export default class Logs extends React.PureComponent<Props> {
27+
public constructor(props: Props) {
28+
super(props)
29+
}
30+
31+
public render() {
32+
return "TODO"
33+
}
34+
}
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
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 React from "react"
18+
import { Mode, ReactProvider, Registrar } from "@kui-shell/core"
19+
20+
import Logs from "./components/Logs"
21+
22+
/** Register Kui Commands */
23+
export default function registerCodeflareCommands(registrar: Registrar) {
24+
registrar.listen("/ray/job/logs", (args) => {
25+
const jobid = args.argvNoOptions[args.argvNoOptions.indexOf("logs") + 1]
26+
27+
const logsMode: Mode & ReactProvider = {
28+
mode: "Logs",
29+
react: () => React.createElement(Logs, { jobid }),
30+
}
31+
32+
return {
33+
metadata: {
34+
name: "Ray Logs",
35+
namespace: jobid,
36+
},
37+
modes: [logsMode],
38+
}
39+
})
40+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"extends": "../../../node_modules/@kui-shell/builder/tsconfig-base.json",
3+
"include": ["src/**/*"],
4+
"compilerOptions": {
5+
"strict": true,
6+
"composite": true,
7+
"jsx": "react",
8+
"outDir": "mdist",
9+
"rootDir": "src"
10+
}
11+
}

plugins/plugin-codeflare/src/plugin.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2020 The Kubernetes Authors
2+
* Copyright 2022 The Kubernetes Authors
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.

plugins/plugin-codeflare/tsconfig.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,6 @@
77
"jsx": "react",
88
"outDir": "mdist",
99
"rootDir": "src"
10-
}
10+
},
11+
"references": [{ "path": "./ray" }]
1112
}

0 commit comments

Comments
 (0)