mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Multiple pods logging
This commit is contained in:
1 parent
33c405bdcf
commit
b2ddcb527d
15 files changed
+7983
-14
No files matched your search
+7600
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,25 @@
|
||||
{
|
||||
"name": "lens-deployment-menu",
|
||||
"version": "0.1.0",
|
||||
"description": "Lens deployment menu",
|
||||
"renderer": "dist/renderer.js",
|
||||
"lens": {
|
||||
"metadata": {},
|
||||
"styles": []
|
||||
},
|
||||
"scripts": {
|
||||
"build": "webpack --config webpack.config.js",
|
||||
"dev": "npm run build --watch",
|
||||
"test": "jest --passWithNoTests --env=jsdom src $@"
|
||||
},
|
||||
"dependencies": {},
|
||||
"devDependencies": {
|
||||
"@k8slens/extensions": "file:../../src/extensions/npm/extensions",
|
||||
"jest": "^26.6.3",
|
||||
"mobx": "^5.15.5",
|
||||
"react": "^16.13.1",
|
||||
"ts-loader": "^8.0.4",
|
||||
"typescript": "^4.0.3",
|
||||
"webpack": "^4.44.2"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
import { LensRendererExtension } from "@k8slens/extensions";
|
||||
import { DeploymentLogsMenu, DeploymentLogsMenuProps } from "./src/logs-menu";
|
||||
import React from "react";
|
||||
|
||||
export default class DeploymentMenuRendererExtension extends LensRendererExtension {
|
||||
kubeObjectMenuItems = [
|
||||
{
|
||||
kind: "Deployment",
|
||||
apiVersions: ["apps/v1"],
|
||||
components: {
|
||||
MenuItem: (props: DeploymentLogsMenuProps) => <DeploymentLogsMenu {...props} />
|
||||
}
|
||||
}
|
||||
];
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
import React from "react";
|
||||
import { Component, K8sApi, Navigation} from "@k8slens/extensions";
|
||||
|
||||
export interface DeploymentLogsMenuProps extends Component.KubeObjectMenuProps<K8sApi.Deployment> {
|
||||
}
|
||||
|
||||
export class DeploymentLogsMenu extends React.Component<DeploymentLogsMenuProps> {
|
||||
showLogs() {
|
||||
Navigation.hideDetails();
|
||||
const deployment = this.props.object;
|
||||
const deploymentStore : K8sApi.DeploymentStore = K8sApi.apiManager.getStore(K8sApi.deploymentApi);
|
||||
|
||||
deploymentStore.getChildPods(deployment);
|
||||
|
||||
Component.logTabStore.createPodTab({
|
||||
selectedPod: deploymentStore.getChildPods(deployment)[0],
|
||||
selectedContainer: deploymentStore.getChildPods(deployment)[0].getContainers()[0],
|
||||
});
|
||||
}
|
||||
|
||||
render() {
|
||||
const { object: deployment, toolbar } = this.props;
|
||||
|
||||
return (
|
||||
<Component.MenuItem onClick={() => this.showLogs()}>
|
||||
<Component.Icon material="subject" title="Logs" interactive={toolbar}/>
|
||||
<span className="title">Logs</span>
|
||||
</Component.MenuItem>
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"outDir": "dist",
|
||||
"module": "CommonJS",
|
||||
"target": "ES2017",
|
||||
"lib": ["ESNext", "DOM", "DOM.Iterable"],
|
||||
"moduleResolution": "Node",
|
||||
"sourceMap": false,
|
||||
"declaration": false,
|
||||
"strict": false,
|
||||
"noImplicitAny": true,
|
||||
"skipLibCheck": true,
|
||||
"esModuleInterop": true,
|
||||
"allowSyntheticDefaultImports": true,
|
||||
"experimentalDecorators": true,
|
||||
"jsx": "react"
|
||||
},
|
||||
"include": [
|
||||
"./*.ts",
|
||||
"./*.tsx"
|
||||
],
|
||||
"exclude": [
|
||||
"node_modules",
|
||||
"*.js"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
const path = require("path");
|
||||
|
||||
module.exports = [
|
||||
{
|
||||
entry: "./renderer.tsx",
|
||||
context: __dirname,
|
||||
target: "electron-renderer",
|
||||
mode: "production",
|
||||
module: {
|
||||
rules: [
|
||||
{
|
||||
test: /\.tsx?$/,
|
||||
use: "ts-loader",
|
||||
exclude: /node_modules/,
|
||||
},
|
||||
],
|
||||
},
|
||||
externals: [
|
||||
{
|
||||
"@k8slens/extensions": "var global.LensExtensions",
|
||||
"react": "var global.React",
|
||||
"mobx": "var global.Mobx"
|
||||
}
|
||||
],
|
||||
resolve: {
|
||||
extensions: [ ".tsx", ".ts", ".js" ],
|
||||
},
|
||||
output: {
|
||||
libraryTarget: "commonjs2",
|
||||
globalObject: "this",
|
||||
filename: "renderer.js",
|
||||
path: path.resolve(__dirname, "dist"),
|
||||
},
|
||||
},
|
||||
];
|
||||
Reference in new issue
Block a user