forked from kubeflow/pipelines
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[UI] Show step pod yaml and events in RunDetails page (kubeflow#3304)
* [UI Server] Pod info handler * [UI] Pod info tab in run details page * Change pod info preview to use yaml editor * Fix namespace * Adds error handling for PodInfo * Adjust to warning message * [UI] Pod events in RunDetails page * Adjust error message * Refactor k8s helper to get rid of in cluster limit * Tests for pod info handler * Tests for pod event list handler * Move pod yaml viewer related components to separate file. * Unit tests for PodYaml component * Fix react unit tests * Fix error message * Address CR comments * Add permission to ui role
- Loading branch information
Showing
17 changed files
with
765 additions
and
130 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
// Copyright 2020 Google LLC | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
import { Handler } from 'express'; | ||
import * as k8sHelper from '../k8s-helper'; | ||
|
||
/** | ||
* podInfoHandler retrieves pod info and sends back as JSON format. | ||
*/ | ||
export const podInfoHandler: Handler = async (req, res) => { | ||
const { podname, podnamespace } = req.query; | ||
if (!podname) { | ||
// 422 status code "Unprocessable entity", refer to https://stackoverflow.com/a/42171674 | ||
res.status(422).send('podname argument is required'); | ||
return; | ||
} | ||
if (!podnamespace) { | ||
res.status(422).send('podnamespace argument is required'); | ||
return; | ||
} | ||
const podName = decodeURIComponent(podname); | ||
const podNamespace = decodeURIComponent(podnamespace); | ||
|
||
const [pod, err] = await k8sHelper.getPod(podName, podNamespace); | ||
if (err) { | ||
const { message, additionalInfo } = err; | ||
console.error(message, additionalInfo); | ||
res.status(500).send(message); | ||
return; | ||
} | ||
res.status(200).send(JSON.stringify(pod)); | ||
}; | ||
|
||
export const podEventsHandler: Handler = async (req, res) => { | ||
const { podname, podnamespace } = req.query; | ||
if (!podname) { | ||
res.status(422).send('podname argument is required'); | ||
return; | ||
} | ||
if (!podnamespace) { | ||
res.status(422).send('podnamespace argument is required'); | ||
return; | ||
} | ||
const podName = decodeURIComponent(podname); | ||
const podNamespace = decodeURIComponent(podnamespace); | ||
|
||
const [eventList, err] = await k8sHelper.listPodEvents(podName, podNamespace); | ||
if (err) { | ||
const { message, additionalInfo } = err; | ||
console.error(message, additionalInfo); | ||
res.status(500).send(message); | ||
return; | ||
} | ||
res.status(200).send(JSON.stringify(eventList)); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.