1
0
mirror of https://github.com/lensapp/lens.git synced 2025-05-20 05:10:56 +00:00

Always set up default container

Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>
This commit is contained in:
Alex Andreev 2020-10-06 11:31:26 +03:00
parent 3095ed4f7c
commit 68fd6014b9
2 changed files with 3 additions and 7 deletions

View File

@ -3,10 +3,9 @@ import "./pod-menu.scss";
import React from "react";
import { t, Trans } from "@lingui/macro";
import { MenuItem, SubMenu } from "../menu";
import { IPodContainer, Pod, nodesApi } from "../../api/endpoints";
import { IPodContainer, Pod } from "../../api/endpoints";
import { Icon } from "../icon";
import { StatusBrick } from "../status-brick";
import { PodLogsDialog } from "./pod-logs-dialog";
import { KubeObjectMenu, KubeObjectMenuProps } from "../kube-object/kube-object-menu";
import { cssNames, prevDefault } from "../../utils";
import { terminalStore, createTerminalTab } from "../dock/terminal.store";

View File

@ -62,6 +62,7 @@ export class PodLogs extends React.Component<Props> {
const { pod, container } = this.tabData;
this.containers = pod.getContainers();
this.initContainers = pod.getInitContainers();
this.selectedContainer = container || this.containers[0];
await this.load();
this.refresher.start();
}
@ -158,9 +159,6 @@ export class PodLogs extends React.Component<Props> {
get containerSelectOptions() {
return [
{
label: _i18n._(t`All Containers`),
},
{
label: _i18n._(t`Containers`),
options: this.containers.map(container => {
@ -178,7 +176,6 @@ export class PodLogs extends React.Component<Props> {
formatOptionLabel = (option: SelectOption) => {
const { value, label } = option;
if (!value) return _i18n._(t`All Containers`);
return label || <><Icon small material="view_carousel"/> {value}</>;
}
@ -190,7 +187,7 @@ export class PodLogs extends React.Component<Props> {
<span><Trans>Container</Trans></span>
<Select
options={this.containerSelectOptions}
value={{ value: this.selectedContainer?.name }}
value={{ value: this.selectedContainer.name }}
formatOptionLabel={this.formatOptionLabel}
onChange={this.onContainerChange}
autoConvertOptions={false}