mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Merge remote-tracking branch 'origin/master' into monaco_editor_refactoring
# Conflicts: # src/common/user-store/preferences-helpers.ts # src/common/user-store/user-store.ts # src/renderer/bootstrap.tsx # src/renderer/components/+add-cluster/add-cluster.tsx # src/renderer/components/+apps-releases/release-details.tsx # src/renderer/components/+custom-resources/crd-details.tsx # src/renderer/components/+preferences/editor.tsx # src/renderer/components/+workloads-pods/pod-details-affinities.tsx # src/renderer/components/dock/create-resource.store.ts # src/renderer/components/dock/create-resource.tsx # src/renderer/components/dock/dock.store.ts # src/renderer/components/dock/edit-resource.store.ts # src/renderer/components/dock/editor-panel.tsx # src/renderer/components/dock/monaco-model-manager.ts # src/renderer/components/kubeconfig-dialog/kubeconfig-dialog.tsx
This commit is contained in:
commit
5f90caa112
45
.eslintrc.js
45
.eslintrc.js
@ -59,6 +59,11 @@ module.exports = {
|
|||||||
"SwitchCase": 1,
|
"SwitchCase": 1,
|
||||||
}],
|
}],
|
||||||
"no-unused-vars": "off",
|
"no-unused-vars": "off",
|
||||||
|
"space-before-function-paren": ["error", {
|
||||||
|
"anonymous": "always",
|
||||||
|
"named": "never",
|
||||||
|
"asyncArrow": "always",
|
||||||
|
}],
|
||||||
"unused-imports/no-unused-imports": "error",
|
"unused-imports/no-unused-imports": "error",
|
||||||
"unused-imports/no-unused-vars": [
|
"unused-imports/no-unused-vars": [
|
||||||
"warn", {
|
"warn", {
|
||||||
@ -71,12 +76,17 @@ module.exports = {
|
|||||||
"avoidEscape": true,
|
"avoidEscape": true,
|
||||||
"allowTemplateLiterals": true,
|
"allowTemplateLiterals": true,
|
||||||
}],
|
}],
|
||||||
|
"object-curly-spacing": ["error", "always", {
|
||||||
|
"objectsInObjects": false,
|
||||||
|
"arraysInObjects": true,
|
||||||
|
}],
|
||||||
"linebreak-style": ["error", "unix"],
|
"linebreak-style": ["error", "unix"],
|
||||||
"eol-last": ["error", "always"],
|
"eol-last": ["error", "always"],
|
||||||
"semi": ["error", "always"],
|
"semi": ["error", "always"],
|
||||||
"object-shorthand": "error",
|
"object-shorthand": "error",
|
||||||
"prefer-template": "error",
|
"prefer-template": "error",
|
||||||
"template-curly-spacing": "error",
|
"template-curly-spacing": "error",
|
||||||
|
"no-unused-expressions": "error",
|
||||||
"padding-line-between-statements": [
|
"padding-line-between-statements": [
|
||||||
"error",
|
"error",
|
||||||
{ "blankLine": "always", "prev": "*", "next": "return" },
|
{ "blankLine": "always", "prev": "*", "next": "return" },
|
||||||
@ -85,7 +95,8 @@ module.exports = {
|
|||||||
{ "blankLine": "always", "prev": "*", "next": "class" },
|
{ "blankLine": "always", "prev": "*", "next": "class" },
|
||||||
{ "blankLine": "always", "prev": ["const", "let", "var"], "next": "*" },
|
{ "blankLine": "always", "prev": ["const", "let", "var"], "next": "*" },
|
||||||
{ "blankLine": "any", "prev": ["const", "let", "var"], "next": ["const", "let", "var"] },
|
{ "blankLine": "any", "prev": ["const", "let", "var"], "next": ["const", "let", "var"] },
|
||||||
]
|
],
|
||||||
|
"no-template-curly-in-string": "error",
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -115,6 +126,12 @@ module.exports = {
|
|||||||
"@typescript-eslint/ban-ts-comment": "off",
|
"@typescript-eslint/ban-ts-comment": "off",
|
||||||
"@typescript-eslint/no-empty-interface": "off",
|
"@typescript-eslint/no-empty-interface": "off",
|
||||||
"@typescript-eslint/no-unused-vars": "off",
|
"@typescript-eslint/no-unused-vars": "off",
|
||||||
|
"space-before-function-paren": "off",
|
||||||
|
"@typescript-eslint/space-before-function-paren": ["error", {
|
||||||
|
"anonymous": "always",
|
||||||
|
"named": "never",
|
||||||
|
"asyncArrow": "always",
|
||||||
|
}],
|
||||||
"unused-imports/no-unused-imports-ts": process.env.PROD === "true" ? "error" : "warn",
|
"unused-imports/no-unused-imports-ts": process.env.PROD === "true" ? "error" : "warn",
|
||||||
"unused-imports/no-unused-vars-ts": [
|
"unused-imports/no-unused-vars-ts": [
|
||||||
"warn", {
|
"warn", {
|
||||||
@ -130,6 +147,11 @@ module.exports = {
|
|||||||
"avoidEscape": true,
|
"avoidEscape": true,
|
||||||
"allowTemplateLiterals": true,
|
"allowTemplateLiterals": true,
|
||||||
}],
|
}],
|
||||||
|
"object-curly-spacing": "off",
|
||||||
|
"@typescript-eslint/object-curly-spacing": ["error", "always", {
|
||||||
|
"objectsInObjects": false,
|
||||||
|
"arraysInObjects": true,
|
||||||
|
}],
|
||||||
"react/prop-types": "off",
|
"react/prop-types": "off",
|
||||||
"semi": "off",
|
"semi": "off",
|
||||||
"@typescript-eslint/semi": ["error"],
|
"@typescript-eslint/semi": ["error"],
|
||||||
@ -138,6 +160,8 @@ module.exports = {
|
|||||||
"object-shorthand": "error",
|
"object-shorthand": "error",
|
||||||
"prefer-template": "error",
|
"prefer-template": "error",
|
||||||
"template-curly-spacing": "error",
|
"template-curly-spacing": "error",
|
||||||
|
"no-unused-expressions": "off",
|
||||||
|
"@typescript-eslint/no-unused-expressions": "error",
|
||||||
"padding-line-between-statements": [
|
"padding-line-between-statements": [
|
||||||
"error",
|
"error",
|
||||||
{ "blankLine": "always", "prev": "*", "next": "return" },
|
{ "blankLine": "always", "prev": "*", "next": "return" },
|
||||||
@ -146,7 +170,8 @@ module.exports = {
|
|||||||
{ "blankLine": "always", "prev": "*", "next": "class" },
|
{ "blankLine": "always", "prev": "*", "next": "class" },
|
||||||
{ "blankLine": "always", "prev": ["const", "let", "var"], "next": "*" },
|
{ "blankLine": "always", "prev": ["const", "let", "var"], "next": "*" },
|
||||||
{ "blankLine": "any", "prev": ["const", "let", "var"], "next": ["const", "let", "var"] },
|
{ "blankLine": "any", "prev": ["const", "let", "var"], "next": ["const", "let", "var"] },
|
||||||
]
|
],
|
||||||
|
"no-template-curly-in-string": "error",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -183,6 +208,12 @@ module.exports = {
|
|||||||
"@typescript-eslint/no-empty-function": "off",
|
"@typescript-eslint/no-empty-function": "off",
|
||||||
"react/display-name": "off",
|
"react/display-name": "off",
|
||||||
"@typescript-eslint/no-unused-vars": "off",
|
"@typescript-eslint/no-unused-vars": "off",
|
||||||
|
"space-before-function-paren": "off",
|
||||||
|
"@typescript-eslint/space-before-function-paren": ["error", {
|
||||||
|
"anonymous": "always",
|
||||||
|
"named": "never",
|
||||||
|
"asyncArrow": "always",
|
||||||
|
}],
|
||||||
"unused-imports/no-unused-imports-ts": process.env.PROD === "true" ? "error" : "warn",
|
"unused-imports/no-unused-imports-ts": process.env.PROD === "true" ? "error" : "warn",
|
||||||
"unused-imports/no-unused-vars-ts": [
|
"unused-imports/no-unused-vars-ts": [
|
||||||
"warn", {
|
"warn", {
|
||||||
@ -198,6 +229,11 @@ module.exports = {
|
|||||||
"avoidEscape": true,
|
"avoidEscape": true,
|
||||||
"allowTemplateLiterals": true,
|
"allowTemplateLiterals": true,
|
||||||
}],
|
}],
|
||||||
|
"object-curly-spacing": "off",
|
||||||
|
"@typescript-eslint/object-curly-spacing": ["error", "always", {
|
||||||
|
"objectsInObjects": false,
|
||||||
|
"arraysInObjects": true,
|
||||||
|
}],
|
||||||
"react/prop-types": "off",
|
"react/prop-types": "off",
|
||||||
"semi": "off",
|
"semi": "off",
|
||||||
"@typescript-eslint/semi": ["error"],
|
"@typescript-eslint/semi": ["error"],
|
||||||
@ -206,6 +242,8 @@ module.exports = {
|
|||||||
"object-shorthand": "error",
|
"object-shorthand": "error",
|
||||||
"prefer-template": "error",
|
"prefer-template": "error",
|
||||||
"template-curly-spacing": "error",
|
"template-curly-spacing": "error",
|
||||||
|
"no-unused-expressions": "off",
|
||||||
|
"@typescript-eslint/no-unused-expressions": "error",
|
||||||
"padding-line-between-statements": [
|
"padding-line-between-statements": [
|
||||||
"error",
|
"error",
|
||||||
{ "blankLine": "always", "prev": "*", "next": "return" },
|
{ "blankLine": "always", "prev": "*", "next": "return" },
|
||||||
@ -216,7 +254,8 @@ module.exports = {
|
|||||||
{ "blankLine": "any", "prev": ["const", "let", "var"], "next": ["const", "let", "var"] },
|
{ "blankLine": "any", "prev": ["const", "let", "var"], "next": ["const", "let", "var"] },
|
||||||
],
|
],
|
||||||
"react-hooks/rules-of-hooks": "error",
|
"react-hooks/rules-of-hooks": "error",
|
||||||
"react-hooks/exhaustive-deps": "off"
|
"react-hooks/exhaustive-deps": "off",
|
||||||
|
"no-template-curly-in-string": "error",
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|||||||
@ -297,7 +297,7 @@
|
|||||||
"@types/request-promise-native": "^1.0.18",
|
"@types/request-promise-native": "^1.0.18",
|
||||||
"@types/semver": "^7.3.9",
|
"@types/semver": "^7.3.9",
|
||||||
"@types/sharp": "^0.29.2",
|
"@types/sharp": "^0.29.2",
|
||||||
"@types/spdy": "^3.4.4",
|
"@types/spdy": "^3.4.5",
|
||||||
"@types/tar": "^4.0.5",
|
"@types/tar": "^4.0.5",
|
||||||
"@types/tcp-port-used": "^1.0.0",
|
"@types/tcp-port-used": "^1.0.0",
|
||||||
"@types/tempy": "^0.3.0",
|
"@types/tempy": "^0.3.0",
|
||||||
@ -378,7 +378,7 @@
|
|||||||
"webpack-dev-server": "^3.11.2",
|
"webpack-dev-server": "^3.11.2",
|
||||||
"webpack-node-externals": "^1.7.2",
|
"webpack-node-externals": "^1.7.2",
|
||||||
"what-input": "^5.2.10",
|
"what-input": "^5.2.10",
|
||||||
"xterm": "^4.12.0",
|
"xterm": "^4.14.1",
|
||||||
"xterm-addon-fit": "^0.5.0"
|
"xterm-addon-fit": "^0.5.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -32,11 +32,9 @@ import esbuild from "esbuild";
|
|||||||
const getTSLoader = (
|
const getTSLoader = (
|
||||||
testRegExp: RegExp, transpileOnly = true
|
testRegExp: RegExp, transpileOnly = true
|
||||||
) => {
|
) => {
|
||||||
const useEsbuildLoader = process.env.LENS_DEV_USE_ESBUILD_LOADER === "true";
|
if (process.env.LENS_DEV_USE_ESBUILD_LOADER === "true") {
|
||||||
|
console.info(`\n🚀 using esbuild-loader for ts(x)`);
|
||||||
|
|
||||||
useEsbuildLoader && console.info(`\n🚀 using esbuild-loader for ts(x)`);
|
|
||||||
|
|
||||||
if (useEsbuildLoader) {
|
|
||||||
return {
|
return {
|
||||||
test: testRegExp,
|
test: testRegExp,
|
||||||
loader: "esbuild-loader",
|
loader: "esbuild-loader",
|
||||||
|
|||||||
@ -53,7 +53,7 @@ export interface Service {
|
|||||||
clusterIP: string;
|
clusterIP: string;
|
||||||
clusterIPs?: string[];
|
clusterIPs?: string[];
|
||||||
externalTrafficPolicy?: string;
|
externalTrafficPolicy?: string;
|
||||||
externalName: string;
|
externalName?: string;
|
||||||
loadBalancerIP?: string;
|
loadBalancerIP?: string;
|
||||||
loadBalancerSourceRanges?: string[];
|
loadBalancerSourceRanges?: string[];
|
||||||
sessionAffinity: string;
|
sessionAffinity: string;
|
||||||
@ -100,11 +100,15 @@ export class Service extends KubeObject {
|
|||||||
getExternalIps() {
|
getExternalIps() {
|
||||||
const lb = this.getLoadBalancer();
|
const lb = this.getLoadBalancer();
|
||||||
|
|
||||||
if (lb && lb.ingress) {
|
if (lb?.ingress) {
|
||||||
return lb.ingress.map(val => val.ip || val.hostname);
|
return lb.ingress.map(val => val.ip || val.hostname);
|
||||||
}
|
}
|
||||||
|
|
||||||
return this.spec.externalIPs || [];
|
if (Array.isArray(this.spec?.externalIPs)) {
|
||||||
|
return this.spec.externalIPs;
|
||||||
|
}
|
||||||
|
|
||||||
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
getType() {
|
getType() {
|
||||||
|
|||||||
@ -346,10 +346,10 @@ export class Kubectl {
|
|||||||
bashScript += `export PATH="${helmPath}:${kubectlPath}:$PATH"\n`;
|
bashScript += `export PATH="${helmPath}:${kubectlPath}:$PATH"\n`;
|
||||||
bashScript += "export KUBECONFIG=\"$tempkubeconfig\"\n";
|
bashScript += "export KUBECONFIG=\"$tempkubeconfig\"\n";
|
||||||
|
|
||||||
bashScript += "NO_PROXY=\",${NO_PROXY:-localhost},\"\n";
|
bashScript += `NO_PROXY=\",\${NO_PROXY:-localhost},\"\n`;
|
||||||
bashScript += "NO_PROXY=\"${NO_PROXY//,localhost,/,}\"\n";
|
bashScript += `NO_PROXY=\"\${NO_PROXY//,localhost,/,}\"\n`;
|
||||||
bashScript += "NO_PROXY=\"${NO_PROXY//,127.0.0.1,/,}\"\n";
|
bashScript += `NO_PROXY=\"\${NO_PROXY//,127.0.0.1,/,}\"\n`;
|
||||||
bashScript += "NO_PROXY=\"localhost,127.0.0.1${NO_PROXY%,}\"\n";
|
bashScript += `NO_PROXY=\"localhost,127.0.0.1\${NO_PROXY%,}\"\n`;
|
||||||
bashScript += "export NO_PROXY\n";
|
bashScript += "export NO_PROXY\n";
|
||||||
bashScript += "unset tempkubeconfig\n";
|
bashScript += "unset tempkubeconfig\n";
|
||||||
await fsPromises.writeFile(bashScriptPath, bashScript.toString(), { mode: 0o644 });
|
await fsPromises.writeFile(bashScriptPath, bashScript.toString(), { mode: 0o644 });
|
||||||
@ -371,14 +371,14 @@ export class Kubectl {
|
|||||||
zshScript += `helmpath=\"${helmPath}"\n`;
|
zshScript += `helmpath=\"${helmPath}"\n`;
|
||||||
zshScript += "p=\":$kubectlpath:\"\n";
|
zshScript += "p=\":$kubectlpath:\"\n";
|
||||||
zshScript += "d=\":$PATH:\"\n";
|
zshScript += "d=\":$PATH:\"\n";
|
||||||
zshScript += "d=${d//$p/:}\n";
|
zshScript += `d=\${d//$p/:}\n`;
|
||||||
zshScript += "d=${d/#:/}\n";
|
zshScript += `d=\${d/#:/}\n`;
|
||||||
zshScript += "export PATH=\"$helmpath:$kubectlpath:${d/%:/}\"\n";
|
zshScript += `export PATH=\"$helmpath:$kubectlpath:\${d/%:/}\"\n`;
|
||||||
zshScript += "export KUBECONFIG=\"$tempkubeconfig\"\n";
|
zshScript += "export KUBECONFIG=\"$tempkubeconfig\"\n";
|
||||||
zshScript += "NO_PROXY=\",${NO_PROXY:-localhost},\"\n";
|
zshScript += `NO_PROXY=\",\${NO_PROXY:-localhost},\"\n`;
|
||||||
zshScript += "NO_PROXY=\"${NO_PROXY//,localhost,/,}\"\n";
|
zshScript += `NO_PROXY=\"\${NO_PROXY//,localhost,/,}\"\n`;
|
||||||
zshScript += "NO_PROXY=\"${NO_PROXY//,127.0.0.1,/,}\"\n";
|
zshScript += `NO_PROXY=\"\${NO_PROXY//,127.0.0.1,/,}\"\n`;
|
||||||
zshScript += "NO_PROXY=\"localhost,127.0.0.1${NO_PROXY%,}\"\n";
|
zshScript += `NO_PROXY=\"localhost,127.0.0.1\${NO_PROXY%,}\"\n`;
|
||||||
zshScript += "export NO_PROXY\n";
|
zshScript += "export NO_PROXY\n";
|
||||||
zshScript += "unset tempkubeconfig\n";
|
zshScript += "unset tempkubeconfig\n";
|
||||||
zshScript += "unset OLD_ZDOTDIR\n";
|
zshScript += "unset OLD_ZDOTDIR\n";
|
||||||
|
|||||||
@ -27,14 +27,17 @@ import type { CatalogEntity } from "../../api/catalog-entity";
|
|||||||
|
|
||||||
export function HotbarToggleMenuItem(props: { entity: CatalogEntity, addContent: ReactNode, removeContent: ReactNode }) {
|
export function HotbarToggleMenuItem(props: { entity: CatalogEntity, addContent: ReactNode, removeContent: ReactNode }) {
|
||||||
const store = HotbarStore.getInstance();
|
const store = HotbarStore.getInstance();
|
||||||
const add = () => store.addToHotbar(props.entity);
|
|
||||||
const remove = () => store.removeFromHotbar(props.entity.getId());
|
|
||||||
const [itemInHotbar, setItemInHotbar] = useState(store.isAddedToActive(props.entity));
|
const [itemInHotbar, setItemInHotbar] = useState(store.isAddedToActive(props.entity));
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<MenuItem onClick={() => {
|
<MenuItem onClick={() => {
|
||||||
itemInHotbar ? remove() : add();
|
if (itemInHotbar) {
|
||||||
setItemInHotbar(!itemInHotbar);
|
store.removeFromHotbar(props.entity.getId());
|
||||||
|
setItemInHotbar(false);
|
||||||
|
} else {
|
||||||
|
store.addToHotbar(props.entity);
|
||||||
|
setItemInHotbar(true);
|
||||||
|
}
|
||||||
}}>
|
}}>
|
||||||
{itemInHotbar ? props.removeContent : props.addContent }
|
{itemInHotbar ? props.removeContent : props.addContent }
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
|
|||||||
@ -67,6 +67,11 @@ export class ServiceDetails extends React.Component<Props> {
|
|||||||
|
|
||||||
const { spec } = service;
|
const { spec } = service;
|
||||||
const endpoint = endpointStore.getByName(service.getName(), service.getNs());
|
const endpoint = endpointStore.getByName(service.getName(), service.getNs());
|
||||||
|
const externalIps = service.getExternalIps();
|
||||||
|
|
||||||
|
if (externalIps.length === 0 && spec?.externalName) {
|
||||||
|
externalIps.push(spec.externalName);
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="ServicesDetails">
|
<div className="ServicesDetails">
|
||||||
@ -106,9 +111,9 @@ export class ServiceDetails extends React.Component<Props> {
|
|||||||
{service.getIpFamilyPolicy()}
|
{service.getIpFamilyPolicy()}
|
||||||
</DrawerItem>
|
</DrawerItem>
|
||||||
|
|
||||||
{service.getExternalIps().length > 0 && (
|
{externalIps.length > 0 && (
|
||||||
<DrawerItem name="External IPs">
|
<DrawerItem name="External IPs">
|
||||||
{service.getExternalIps().map(ip => <div key={ip}>{ip}</div>)}
|
{externalIps.map(ip => <div key={ip}>{ip}</div>)}
|
||||||
</DrawerItem>
|
</DrawerItem>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
|
|||||||
@ -81,18 +81,26 @@ export class Services extends React.Component<Props> {
|
|||||||
{ title: "Age", className: "age", sortBy: columnId.age, id: columnId.age },
|
{ title: "Age", className: "age", sortBy: columnId.age, id: columnId.age },
|
||||||
{ title: "Status", className: "status", sortBy: columnId.status, id: columnId.status },
|
{ title: "Status", className: "status", sortBy: columnId.status, id: columnId.status },
|
||||||
]}
|
]}
|
||||||
renderTableContents={service => [
|
renderTableContents={service => {
|
||||||
|
const externalIps = service.getExternalIps();
|
||||||
|
|
||||||
|
if (externalIps.length === 0 && service.spec?.externalName) {
|
||||||
|
externalIps.push(service.spec.externalName);
|
||||||
|
}
|
||||||
|
|
||||||
|
return [
|
||||||
service.getName(),
|
service.getName(),
|
||||||
<KubeObjectStatusIcon key="icon" object={service} />,
|
<KubeObjectStatusIcon key="icon" object={service} />,
|
||||||
service.getNs(),
|
service.getNs(),
|
||||||
service.getType(),
|
service.getType(),
|
||||||
service.getClusterIp(),
|
service.getClusterIp(),
|
||||||
service.getPorts().join(", "),
|
service.getPorts().join(", "),
|
||||||
service.getExternalIps().join(", ") || "-",
|
externalIps.join(", ") || "-",
|
||||||
service.getSelector().map(label => <Badge key={label} label={label} />),
|
service.getSelector().map(label => <Badge key={label} label={label} />),
|
||||||
service.getAge(),
|
service.getAge(),
|
||||||
{ title: service.getStatus(), className: service.getStatus().toLowerCase() },
|
{ title: service.getStatus(), className: service.getStatus().toLowerCase() },
|
||||||
]}
|
];
|
||||||
|
}}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -118,12 +118,14 @@ export class DeploymentScaleDialog extends Component<Props> {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
private readonly scaleMin = 0;
|
||||||
|
|
||||||
desiredReplicasUp = () => {
|
desiredReplicasUp = () => {
|
||||||
this.desiredReplicas < this.scaleMax && this.desiredReplicas++;
|
this.desiredReplicas = Math.min(this.scaleMax, this.desiredReplicas + 1);
|
||||||
};
|
};
|
||||||
|
|
||||||
desiredReplicasDown = () => {
|
desiredReplicasDown = () => {
|
||||||
this.desiredReplicas > 0 && this.desiredReplicas--;
|
this.desiredReplicas = Math.max(this.scaleMin, this.desiredReplicas - 1);
|
||||||
};
|
};
|
||||||
|
|
||||||
renderContents() {
|
renderContents() {
|
||||||
|
|||||||
@ -40,30 +40,23 @@ interface Props {
|
|||||||
export const ContainerEnvironment = observer((props: Props) => {
|
export const ContainerEnvironment = observer((props: Props) => {
|
||||||
const { container: { env, envFrom }, namespace } = props;
|
const { container: { env, envFrom }, namespace } = props;
|
||||||
|
|
||||||
useEffect(
|
useEffect( () => autorun(() => {
|
||||||
() =>
|
for (const { valueFrom } of env ?? []) {
|
||||||
autorun(() => {
|
if (valueFrom?.configMapKeyRef) {
|
||||||
env && env.forEach(variable => {
|
|
||||||
const { valueFrom } = variable;
|
|
||||||
|
|
||||||
if (valueFrom && valueFrom.configMapKeyRef) {
|
|
||||||
configMapsStore.load({ name: valueFrom.configMapKeyRef.name, namespace });
|
configMapsStore.load({ name: valueFrom.configMapKeyRef.name, namespace });
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
envFrom && envFrom.forEach(item => {
|
|
||||||
const { configMapRef, secretRef } = item;
|
|
||||||
|
|
||||||
if (secretRef && secretRef.name) {
|
for (const { configMapRef, secretRef } of envFrom ?? []) {
|
||||||
|
if (secretRef?.name) {
|
||||||
secretsStore.load({ name: secretRef.name, namespace });
|
secretsStore.load({ name: secretRef.name, namespace });
|
||||||
}
|
}
|
||||||
|
|
||||||
if (configMapRef && configMapRef.name) {
|
if (configMapRef?.name) {
|
||||||
configMapsStore.load({ name: configMapRef.name, namespace });
|
configMapsStore.load({ name: configMapRef.name, namespace });
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
}),
|
}), []);
|
||||||
[]
|
|
||||||
);
|
|
||||||
|
|
||||||
const renderEnv = () => {
|
const renderEnv = () => {
|
||||||
const orderedEnv = _.sortBy(env, "name");
|
const orderedEnv = _.sortBy(env, "name");
|
||||||
|
|||||||
@ -118,12 +118,14 @@ export class ReplicaSetScaleDialog extends Component<Props> {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
private readonly scaleMin = 0;
|
||||||
|
|
||||||
desiredReplicasUp = () => {
|
desiredReplicasUp = () => {
|
||||||
this.desiredReplicas < this.scaleMax && this.desiredReplicas++;
|
this.desiredReplicas = Math.min(this.scaleMax, this.desiredReplicas + 1);
|
||||||
};
|
};
|
||||||
|
|
||||||
desiredReplicasDown = () => {
|
desiredReplicasDown = () => {
|
||||||
this.desiredReplicas > 0 && this.desiredReplicas--;
|
this.desiredReplicas = Math.max(this.scaleMin, this.desiredReplicas - 1);
|
||||||
};
|
};
|
||||||
|
|
||||||
renderContents() {
|
renderContents() {
|
||||||
|
|||||||
@ -117,12 +117,14 @@ export class StatefulSetScaleDialog extends Component<Props> {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
private readonly scaleMin = 0;
|
||||||
|
|
||||||
desiredReplicasUp = () => {
|
desiredReplicasUp = () => {
|
||||||
this.desiredReplicas < this.scaleMax && this.desiredReplicas++;
|
this.desiredReplicas = Math.min(this.scaleMax, this.desiredReplicas + 1);
|
||||||
};
|
};
|
||||||
|
|
||||||
desiredReplicasDown = () => {
|
desiredReplicasDown = () => {
|
||||||
this.desiredReplicas > 0 && this.desiredReplicas--;
|
this.desiredReplicas = Math.max(this.scaleMin, this.desiredReplicas - 1);
|
||||||
};
|
};
|
||||||
|
|
||||||
renderContents() {
|
renderContents() {
|
||||||
|
|||||||
@ -90,6 +90,10 @@ export class Menu extends React.Component<MenuProps, State> {
|
|||||||
return !!this.props.isOpen;
|
return !!this.props.isOpen;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get isClosed() {
|
||||||
|
return !this.isOpen;
|
||||||
|
}
|
||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
if (!this.props.usePortal) {
|
if (!this.props.usePortal) {
|
||||||
const parent = this.elem.parentElement;
|
const parent = this.elem.parentElement;
|
||||||
@ -202,19 +206,32 @@ export class Menu extends React.Component<MenuProps, State> {
|
|||||||
};
|
};
|
||||||
|
|
||||||
open() {
|
open() {
|
||||||
if (this.isOpen) return;
|
if (this.isOpen) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
this.props.open();
|
this.props.open();
|
||||||
this.refreshPosition();
|
this.refreshPosition();
|
||||||
if (this.props.autoFocus) this.focusNextItem();
|
|
||||||
|
if (this.props.autoFocus) {
|
||||||
|
this.focusNextItem();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
close() {
|
close() {
|
||||||
if (!this.isOpen) return;
|
if (this.isClosed) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
this.props.close();
|
this.props.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
toggle() {
|
toggle() {
|
||||||
this.isOpen ? this.close() : this.open();
|
if (this.isOpen) {
|
||||||
|
this.close();
|
||||||
|
} else {
|
||||||
|
this.open();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
onKeyDown(evt: KeyboardEvent) {
|
onKeyDown(evt: KeyboardEvent) {
|
||||||
|
|||||||
16
yarn.lock
16
yarn.lock
@ -1856,10 +1856,10 @@
|
|||||||
resolved "https://registry.yarnpkg.com/@types/source-list-map/-/source-list-map-0.1.2.tgz#0078836063ffaf17412349bba364087e0ac02ec9"
|
resolved "https://registry.yarnpkg.com/@types/source-list-map/-/source-list-map-0.1.2.tgz#0078836063ffaf17412349bba364087e0ac02ec9"
|
||||||
integrity sha512-K5K+yml8LTo9bWJI/rECfIPrGgxdpeNbj+d53lwN4QjW1MCwlkhUms+gtdzigTeUyBr09+u8BwOIY3MXvHdcsA==
|
integrity sha512-K5K+yml8LTo9bWJI/rECfIPrGgxdpeNbj+d53lwN4QjW1MCwlkhUms+gtdzigTeUyBr09+u8BwOIY3MXvHdcsA==
|
||||||
|
|
||||||
"@types/spdy@^3.4.4":
|
"@types/spdy@^3.4.5":
|
||||||
version "3.4.4"
|
version "3.4.5"
|
||||||
resolved "https://registry.yarnpkg.com/@types/spdy/-/spdy-3.4.4.tgz#3282fd4ad8c4603aa49f7017dd520a08a345b2bc"
|
resolved "https://registry.yarnpkg.com/@types/spdy/-/spdy-3.4.5.tgz#194dc132312ddcd31e8053789ae83a7bb32a8aaf"
|
||||||
integrity sha512-N9LBlbVRRYq6HgYpPkqQc3a9HJ/iEtVZToW6xlTtJiMhmRJ7jJdV7TaZQJw/Ve/1ePUsQiCTDc4JMuzzag94GA==
|
integrity sha512-/33fIRK/aqkKNxg9BSjpzt1ucmvPremgeDywm9z2C2mOlIh5Ljjvgc3UhQHqwXsSLDLHPT9jlsnrjKQ1XiVJzA==
|
||||||
dependencies:
|
dependencies:
|
||||||
"@types/node" "*"
|
"@types/node" "*"
|
||||||
|
|
||||||
@ -14602,10 +14602,10 @@ xterm-addon-fit@^0.5.0:
|
|||||||
resolved "https://registry.yarnpkg.com/xterm-addon-fit/-/xterm-addon-fit-0.5.0.tgz#2d51b983b786a97dcd6cde805e700c7f913bc596"
|
resolved "https://registry.yarnpkg.com/xterm-addon-fit/-/xterm-addon-fit-0.5.0.tgz#2d51b983b786a97dcd6cde805e700c7f913bc596"
|
||||||
integrity sha512-DsS9fqhXHacEmsPxBJZvfj2la30Iz9xk+UKjhQgnYNkrUIN5CYLbw7WEfz117c7+S86S/tpHPfvNxJsF5/G8wQ==
|
integrity sha512-DsS9fqhXHacEmsPxBJZvfj2la30Iz9xk+UKjhQgnYNkrUIN5CYLbw7WEfz117c7+S86S/tpHPfvNxJsF5/G8wQ==
|
||||||
|
|
||||||
xterm@^4.12.0:
|
xterm@^4.14.1:
|
||||||
version "4.12.0"
|
version "4.14.1"
|
||||||
resolved "https://registry.yarnpkg.com/xterm/-/xterm-4.12.0.tgz#db09b425b4dcae5b96f8cbbaaa93b3bc60997ca9"
|
resolved "https://registry.yarnpkg.com/xterm/-/xterm-4.14.1.tgz#6884cb8fb3b83353b1a98139ea23daedf8e35796"
|
||||||
integrity sha512-K5mF/p3txUV18mjiZFlElagoHFpqXrm5OYHeoymeXSu8GG/nMaOO/+NRcNCwfdjzAbdQ5VLF32hEHiWWKKm0bw==
|
integrity sha512-jgzNg5BuGPwq5/M4dGnmbghZvHx2jaj+9crSEt15bV34Za49VziBmCu7zIy88zUKKiGTxeo7aVzirFSJArIMFw==
|
||||||
|
|
||||||
y18n@^3.2.1:
|
y18n@^3.2.1:
|
||||||
version "3.2.2"
|
version "3.2.2"
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user