mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Specify id for all <Select /> to satisfy previous commit
Signed-off-by: Iku-turso <mikko.aspiala@gmail.com>
This commit is contained in:
parent
9c024b98d3
commit
ec33125373
@ -4,7 +4,7 @@
|
||||
*/
|
||||
import { getInjectable } from "@ogre-tools/injectable";
|
||||
import { Kubectl } from "./kubectl";
|
||||
import directoryForKubectlBinariesInjectable from "./directory-for-kubectl-binaries/directory-for-kubectl-binaries.injectable";
|
||||
import directoryForKubectlBinariesInjectable from "../../common/app-paths/directory-for-kubectl-binaries/directory-for-kubectl-binaries.injectable";
|
||||
import userStoreInjectable from "../../common/user-store/user-store.injectable";
|
||||
|
||||
const createKubectlInjectable = getInjectable({
|
||||
|
||||
@ -168,6 +168,7 @@ export class AddQuotaDialog extends React.Component<AddQuotaDialogProps> {
|
||||
|
||||
<SubTitle title="Namespace" />
|
||||
<NamespaceSelect
|
||||
id="namespace-input"
|
||||
value={this.namespace}
|
||||
placeholder="Namespace"
|
||||
themeName="light"
|
||||
@ -178,6 +179,7 @@ export class AddQuotaDialog extends React.Component<AddQuotaDialogProps> {
|
||||
<SubTitle title="Values" />
|
||||
<div className="flex gaps align-center">
|
||||
<Select
|
||||
id="quota-input"
|
||||
className="quota-select"
|
||||
themeName="light"
|
||||
placeholder="Select a quota.."
|
||||
|
||||
@ -216,6 +216,7 @@ export class AddSecretDialog extends React.Component<AddSecretDialogProps> {
|
||||
<div className="secret-namespace">
|
||||
<SubTitle title="Namespace" />
|
||||
<NamespaceSelect
|
||||
id="secret-namespace-input"
|
||||
themeName="light"
|
||||
value={namespace}
|
||||
onChange={({ value }) => this.namespace = value}
|
||||
@ -224,6 +225,7 @@ export class AddSecretDialog extends React.Component<AddSecretDialogProps> {
|
||||
<div className="secret-type">
|
||||
<SubTitle title="Secret type" />
|
||||
<Select
|
||||
id="secret-input"
|
||||
themeName="light"
|
||||
options={this.types}
|
||||
value={type} onChange={({ value }: SelectOption) => this.type = value}
|
||||
|
||||
@ -101,6 +101,7 @@ export class CustomResourceDefinitions extends React.Component {
|
||||
<>
|
||||
{filters}
|
||||
<Select
|
||||
id="crd-input"
|
||||
className="group-select"
|
||||
placeholder={placeholder}
|
||||
options={Object.keys(crdStore.groups)}
|
||||
|
||||
@ -117,6 +117,7 @@ class NonInjectedHelmChartDetails extends Component<HelmChartDetailsProps & Depe
|
||||
</div>
|
||||
<DrawerItem name="Version" className="version" onClick={stopPropagation}>
|
||||
<Select
|
||||
id="chart-version-input"
|
||||
themeName="outlined"
|
||||
menuPortalTarget={null}
|
||||
options={chartVersions.map(chart => ({
|
||||
|
||||
@ -75,6 +75,7 @@ class NonInjectedReleaseRollbackDialog extends React.Component<ReleaseRollbackDi
|
||||
<div className="flex gaps align-center">
|
||||
<b>Revision</b>
|
||||
<Select
|
||||
id="revision-input"
|
||||
themeName="light"
|
||||
value={revision}
|
||||
options={revisions}
|
||||
|
||||
@ -178,7 +178,7 @@ class NonInjectedHelmReleases extends Component<Dependencies> {
|
||||
filters: (
|
||||
<>
|
||||
{filters}
|
||||
<NamespaceSelectFilter />
|
||||
<NamespaceSelectFilter id="namespace-select-filter" />
|
||||
</>
|
||||
),
|
||||
searchProps: {
|
||||
|
||||
@ -30,6 +30,7 @@ const NonInjectedNamespaceSelectFilter = observer(({ model }: SelectProps & Depe
|
||||
onClick={model.onClick}
|
||||
>
|
||||
<NamespaceSelect
|
||||
id="namespace-select-filter-input"
|
||||
isMulti={true}
|
||||
menuIsOpen={model.menuIsOpen}
|
||||
components={{ Placeholder }}
|
||||
|
||||
@ -77,6 +77,7 @@ class NonInjectedNamespaceSelect extends React.Component<NamespaceSelectProps &
|
||||
|
||||
return (
|
||||
<Select
|
||||
id="namespace-input"
|
||||
className={cssNames("NamespaceSelect", className)}
|
||||
menuClass="NamespaceSelectMenu"
|
||||
formatOptionLabel={this.formatOptionLabel}
|
||||
|
||||
@ -49,6 +49,7 @@ const NonInjectedApplication: React.FC<Dependencies> = ({ appPreferenceItems, us
|
||||
<section id="appearance">
|
||||
<SubTitle title="Theme" />
|
||||
<Select
|
||||
id="theme-input"
|
||||
options={[
|
||||
{ label: "Sync with computer", value: "system" },
|
||||
...themeStore.themeOptions,
|
||||
@ -64,6 +65,7 @@ const NonInjectedApplication: React.FC<Dependencies> = ({ appPreferenceItems, us
|
||||
<section id="extensionRegistryUrl">
|
||||
<SubTitle title="Extension Install Registry" />
|
||||
<Select
|
||||
id="extension-install-registry-input"
|
||||
options={Object.values(ExtensionRegistryLocation)}
|
||||
value={userStore.extensionRegistryUrl.location}
|
||||
onChange={action(({ value }) => {
|
||||
@ -110,6 +112,7 @@ const NonInjectedApplication: React.FC<Dependencies> = ({ appPreferenceItems, us
|
||||
<section id="update-channel">
|
||||
<SubTitle title="Update Channel" />
|
||||
<Select
|
||||
id="update-channel-input"
|
||||
options={updateChannelOptions}
|
||||
value={userStore.updateChannel}
|
||||
onChange={({ value }) => userStore.updateChannel = value}
|
||||
@ -122,6 +125,7 @@ const NonInjectedApplication: React.FC<Dependencies> = ({ appPreferenceItems, us
|
||||
<section id="locale">
|
||||
<SubTitle title="Locale Timezone" />
|
||||
<Select
|
||||
id="timezone-input"
|
||||
options={timezoneOptions}
|
||||
value={userStore.localeTimezone}
|
||||
onChange={({ value }) => userStore.setLocaleTimezone(value)}
|
||||
|
||||
@ -47,6 +47,7 @@ const NonInjectedEditor = observer(({ userStore }: Dependencies) => {
|
||||
<div className="flex gaps align-center">
|
||||
<SubHeader compact>Position</SubHeader>
|
||||
<Select
|
||||
id="minimap-input"
|
||||
themeName="lens"
|
||||
options={["left", "right"]}
|
||||
value={editorConfiguration.minimap.side}
|
||||
@ -59,6 +60,7 @@ const NonInjectedEditor = observer(({ userStore }: Dependencies) => {
|
||||
<section>
|
||||
<SubTitle title="Line numbers" />
|
||||
<Select
|
||||
id="editor-line-numbers-input"
|
||||
options={Object.entries(EditorLineNumbersStyles).map(([value, label]) => ({
|
||||
label,
|
||||
value,
|
||||
|
||||
@ -144,7 +144,8 @@ export class HelmCharts extends React.Component {
|
||||
return (
|
||||
<div>
|
||||
<div className="flex gaps">
|
||||
<Select id="HelmRepoSelect"
|
||||
<Select
|
||||
id="HelmRepoSelect"
|
||||
placeholder="Repositories"
|
||||
isLoading={this.loadingAvailableRepos}
|
||||
isDisabled={this.loadingAvailableRepos}
|
||||
|
||||
@ -30,35 +30,38 @@ const NonInjectedKubectlBinaries: React.FC<Dependencies> = observer(({ defaultPa
|
||||
([value, { label, platforms }]) => ({ value, label, platforms }),
|
||||
);
|
||||
|
||||
const save = () => {
|
||||
userStore.downloadBinariesPath = downloadPath;
|
||||
userStore.kubectlBinariesPath = binariesPath;
|
||||
};
|
||||
const save = () => {
|
||||
userStore.downloadBinariesPath = downloadPath;
|
||||
userStore.kubectlBinariesPath = binariesPath;
|
||||
};
|
||||
|
||||
return (
|
||||
<>
|
||||
<section>
|
||||
<SubTitle title="Kubectl binary download"/>
|
||||
<Switch
|
||||
checked={userStore.downloadKubectlBinaries}
|
||||
return (
|
||||
<>
|
||||
<section>
|
||||
<SubTitle title="Kubectl binary download" />
|
||||
<Switch
|
||||
checked={userStore.downloadKubectlBinaries}
|
||||
onChange={() => userStore.downloadKubectlBinaries = !userStore.downloadKubectlBinaries}
|
||||
>
|
||||
Download kubectl binaries matching the Kubernetes cluster version
|
||||
</Switch>
|
||||
</section>
|
||||
>
|
||||
Download kubectl binaries matching the Kubernetes cluster version
|
||||
</Switch>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<SubTitle title="Download mirror" />
|
||||
<Select
|
||||
placeholder="Download mirror for kubectl"
|
||||
options={downloadMirrorOptions}
|
||||
value={userStore.downloadMirror}
|
||||
onChange={({ value }: SelectOption) => userStore.downloadMirror = value}
|
||||
disabled={!userStore.downloadKubectlBinaries}
|
||||
isOptionDisabled={({ platforms }) => !platforms.has(process.platform)}
|
||||
themeName="lens"
|
||||
/>
|
||||
</section>
|
||||
<section>
|
||||
<SubTitle title="Download mirror" />
|
||||
<Select
|
||||
id="download-mirror-input"
|
||||
placeholder="Download mirror for kubectl"
|
||||
options={downloadMirrorOptions}
|
||||
value={userStore.downloadMirror}
|
||||
onChange={({ value }: SelectOption) => userStore.downloadMirror = value}
|
||||
disabled={!userStore.downloadKubectlBinaries}
|
||||
isOptionDisabled={({ platforms }) =>
|
||||
!platforms.has(process.platform)
|
||||
}
|
||||
themeName="lens"
|
||||
/>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<SubTitle title="Directory for binaries" />
|
||||
|
||||
@ -59,6 +59,7 @@ const NonInjectedTerminal = observer(({ userStore, themeStore }: Dependencies) =
|
||||
<section id="terminalTheme">
|
||||
<SubTitle title="Terminal theme" />
|
||||
<Select
|
||||
id="terminal-theme-input"
|
||||
themeName="lens"
|
||||
options={[
|
||||
{ label: "Match theme", value: "" },
|
||||
|
||||
@ -172,6 +172,7 @@ export class ClusterRoleBindingDialog extends React.Component<ClusterRoleBinding
|
||||
<>
|
||||
<SubTitle title="Cluster Role Reference" />
|
||||
<Select
|
||||
id="cluster-role-input"
|
||||
themeName="light"
|
||||
placeholder="Select cluster role ..."
|
||||
isDisabled={this.isEditing}
|
||||
@ -229,6 +230,7 @@ export class ClusterRoleBindingDialog extends React.Component<ClusterRoleBinding
|
||||
|
||||
<b>Service Accounts</b>
|
||||
<Select
|
||||
id="service-account-input"
|
||||
isMulti
|
||||
themeName="light"
|
||||
placeholder="Select service accounts ..."
|
||||
|
||||
@ -176,6 +176,7 @@ export class RoleBindingDialog extends React.Component<RoleBindingDialogProps> {
|
||||
<>
|
||||
<SubTitle title="Namespace" />
|
||||
<NamespaceSelect
|
||||
id="dialog-namespace-input"
|
||||
themeName="light"
|
||||
isDisabled={this.isEditing}
|
||||
value={this.bindingNamespace}
|
||||
@ -185,6 +186,7 @@ export class RoleBindingDialog extends React.Component<RoleBindingDialogProps> {
|
||||
|
||||
<SubTitle title="Role Reference" />
|
||||
<Select
|
||||
id="role-reference-input"
|
||||
themeName="light"
|
||||
placeholder="Select role or cluster role ..."
|
||||
isDisabled={this.isEditing}
|
||||
@ -226,6 +228,7 @@ export class RoleBindingDialog extends React.Component<RoleBindingDialogProps> {
|
||||
|
||||
<b>Service Accounts</b>
|
||||
<Select
|
||||
id="service-account-input"
|
||||
isMulti
|
||||
themeName="light"
|
||||
placeholder="Select service accounts ..."
|
||||
|
||||
@ -85,6 +85,7 @@ export class AddRoleDialog extends React.Component<AddRoleDialogProps> {
|
||||
/>
|
||||
<SubTitle title="Namespace" />
|
||||
<NamespaceSelect
|
||||
id="add-dialog-namespace-select-input"
|
||||
themeName="light"
|
||||
value={this.namespace}
|
||||
onChange={({ value }) => this.namespace = value}
|
||||
|
||||
@ -81,6 +81,7 @@ export class CreateServiceAccountDialog extends React.Component<CreateServiceAcc
|
||||
/>
|
||||
<SubTitle title="Namespace" />
|
||||
<NamespaceSelect
|
||||
id="create-dialog-namespace-select-input"
|
||||
themeName="light"
|
||||
value={namespace}
|
||||
onChange={({ value }) => this.namespace = value}
|
||||
|
||||
@ -94,7 +94,7 @@ class NonInjectedWorkloadsOverview extends React.Component<Dependencies> {
|
||||
<div className="header flex gaps align-center">
|
||||
<h5 className="box grow">Overview</h5>
|
||||
{this.renderLoadErrors()}
|
||||
<NamespaceSelectFilter />
|
||||
<NamespaceSelectFilter id="overview-namespace-select-filter-input" />
|
||||
</div>
|
||||
|
||||
{this.props.detailComponents.get().map((Details, index) => (
|
||||
|
||||
@ -32,6 +32,7 @@ const NonInjectedActivateEntityCommand = observer(({ closeCommandOverlay, entiti
|
||||
|
||||
return (
|
||||
<Select
|
||||
id="activate-entity-input"
|
||||
menuPortalTarget={null}
|
||||
onChange={(v) => onSelect(v.value)}
|
||||
components={{ DropdownIndicator: null, IndicatorSeparator: null }}
|
||||
|
||||
@ -75,6 +75,7 @@ export class ClusterMetricsSetting extends React.Component<ClusterMetricsSetting
|
||||
return (
|
||||
<>
|
||||
<Select
|
||||
id="cluster-metric-resource-type-input"
|
||||
className="box grow"
|
||||
placeholder="Select metrics to hide..."
|
||||
isMulti
|
||||
|
||||
@ -116,6 +116,7 @@ export class ClusterPrometheusSetting extends React.Component<ClusterPrometheusS
|
||||
? <Spinner />
|
||||
: <>
|
||||
<Select
|
||||
id="cluster-prometheus-settings-input"
|
||||
value={this.provider}
|
||||
onChange={({ value }) => {
|
||||
this.provider = value;
|
||||
|
||||
@ -79,6 +79,7 @@ const NonInjectedCommandDialog = observer(({ commands, activeEntity, closeComman
|
||||
|
||||
return (
|
||||
<Select
|
||||
id="command-palette-search-input"
|
||||
menuPortalTarget={null}
|
||||
onChange={v => executeAction(v.value)}
|
||||
components={{
|
||||
|
||||
@ -134,6 +134,7 @@ export class DeleteClusterDialog extends React.Component<DeleteClusterDialogProp
|
||||
return (
|
||||
<div className="mt-4">
|
||||
<Select
|
||||
id="delete-cluster-input"
|
||||
options={options}
|
||||
value={this.newCurrentContext}
|
||||
onChange={({ value }) => this.newCurrentContext = value}
|
||||
|
||||
@ -106,6 +106,7 @@ class NonInjectedCreateResource extends React.Component<CreateResourceProps & De
|
||||
return (
|
||||
<div className="flex gaps align-center">
|
||||
<Select
|
||||
id="create-resource-resource-templates-input"
|
||||
autoConvertOptions={false}
|
||||
controlShouldRenderValue={false} // always keep initial placeholder
|
||||
className="TemplateSelect"
|
||||
|
||||
@ -171,6 +171,7 @@ class NonInjectedInstallChart extends Component<InstallCharProps & Dependencies>
|
||||
<Badge label={`${repo}/${name}`} title="Repo/Name"/>
|
||||
<span>Version</span>
|
||||
<Select
|
||||
id="chart-version-input"
|
||||
className="chart-version"
|
||||
value={version}
|
||||
options={versions}
|
||||
@ -180,6 +181,7 @@ class NonInjectedInstallChart extends Component<InstallCharProps & Dependencies>
|
||||
/>
|
||||
<span>Namespace</span>
|
||||
<NamespaceSelect
|
||||
id="install-chart-namespace-select-input"
|
||||
showIcons={false}
|
||||
menuPlacement="top"
|
||||
themeName="outlined"
|
||||
|
||||
@ -83,6 +83,7 @@ export const LogResourceSelector = observer(({ model }: LogResourceSelectorProps
|
||||
}
|
||||
<span>Pod</span>
|
||||
<Select
|
||||
id="pod-selection-input"
|
||||
options={podSelectOptions}
|
||||
value={podSelectOptions.find(opt => opt.value === pod)}
|
||||
formatOptionLabel={option => option.label}
|
||||
@ -93,6 +94,7 @@ export const LogResourceSelector = observer(({ model }: LogResourceSelectorProps
|
||||
/>
|
||||
<span>Container</span>
|
||||
<Select
|
||||
id="container-selector-input"
|
||||
options={containerSelectOptions}
|
||||
value={{ label: selectedContainer, value: selectedContainer }}
|
||||
onChange={onContainerChange}
|
||||
|
||||
@ -147,6 +147,7 @@ export class NonInjectedUpgradeChart extends React.Component<UpgradeChartProps &
|
||||
<span>Version</span> <Badge label={currentVersion}/>
|
||||
<span>Upgrade version</span>
|
||||
<Select
|
||||
id="char-version-input"
|
||||
className="chart-version"
|
||||
menuPlacement="top"
|
||||
themeName="outlined"
|
||||
|
||||
@ -56,6 +56,7 @@ const NonInjectedHotbarRemoveCommand = observer(({ closeCommandOverlay, hotbarSt
|
||||
|
||||
return (
|
||||
<Select
|
||||
id="remove-hotbar-input"
|
||||
menuPortalTarget={null}
|
||||
onChange={(v) => onChange(v.value)}
|
||||
components={{ DropdownIndicator: null, IndicatorSeparator: null }}
|
||||
|
||||
@ -69,6 +69,7 @@ const NonInjectedHotbarRenameCommand = observer(({ closeCommandOverlay, hotbarSt
|
||||
|
||||
return (
|
||||
<Select
|
||||
id="rename-hotbar-input"
|
||||
menuPortalTarget={null}
|
||||
onChange={(v) => onSelect(v.value)}
|
||||
components={{ DropdownIndicator: null, IndicatorSeparator: null }}
|
||||
|
||||
@ -63,6 +63,7 @@ const NonInjectedHotbarSwitchCommand = observer(({ hotbarStore, commandOverlay }
|
||||
|
||||
return (
|
||||
<Select
|
||||
id="switch-to-hotbar-input"
|
||||
menuPortalTarget={null}
|
||||
onChange={(v) => onChange(v.value)}
|
||||
components={{ DropdownIndicator: null, IndicatorSeparator: null }}
|
||||
|
||||
@ -24,9 +24,13 @@ import clusterFrameContextInjectable from "../../cluster-frame-context/cluster-f
|
||||
import kubeWatchApiInjectable from "../../kube-watch-api/kube-watch-api.injectable";
|
||||
import type { KubeWatchSubscribeStoreOptions } from "../../kube-watch-api/kube-watch-api";
|
||||
|
||||
type ItemListLayoutPropsWithoutGetItems<K extends KubeObject> = Omit<ItemListLayoutProps<K>, "getItems">;
|
||||
type ItemListLayoutPropsWithoutGetItems<K extends KubeObject> = Omit<
|
||||
ItemListLayoutProps<K>,
|
||||
"getItems"
|
||||
>;
|
||||
|
||||
export interface KubeObjectListLayoutProps<K extends KubeObject> extends ItemListLayoutPropsWithoutGetItems<K> {
|
||||
export interface KubeObjectListLayoutProps<K extends KubeObject>
|
||||
extends ItemListLayoutPropsWithoutGetItems<K> {
|
||||
items?: K[];
|
||||
getItems?: () => K[];
|
||||
store: KubeObjectStore<K>;
|
||||
@ -41,7 +45,10 @@ const defaultProps: Partial<KubeObjectListLayoutProps<KubeObject>> = {
|
||||
|
||||
interface Dependencies {
|
||||
clusterFrameContext: ClusterFrameContext;
|
||||
subscribeToStores: (stores: KubeObjectStore<KubeObject>[], options: KubeWatchSubscribeStoreOptions) => Disposer;
|
||||
subscribeToStores: (
|
||||
stores: KubeObjectStore<KubeObject>[],
|
||||
options: KubeWatchSubscribeStoreOptions
|
||||
) => Disposer;
|
||||
}
|
||||
|
||||
@observer
|
||||
@ -63,10 +70,12 @@ class NonInjectedKubeObjectListLayout<K extends KubeObject> extends React.Compon
|
||||
const { store, dependentStores = [], subscribeStores } = this.props;
|
||||
const stores = Array.from(new Set([store, ...dependentStores]));
|
||||
const reactions: Disposer[] = [
|
||||
reaction(() => this.props.clusterFrameContext.contextNamespaces.slice(), () => {
|
||||
// clear load errors
|
||||
this.loadErrors.length = 0;
|
||||
}),
|
||||
reaction(
|
||||
() => this.props.clusterFrameContext.contextNamespaces.slice(),
|
||||
() => {
|
||||
// clear load errors
|
||||
this.loadErrors.length = 0;
|
||||
}),
|
||||
];
|
||||
|
||||
if (subscribeStores) {
|
||||
@ -102,8 +111,10 @@ class NonInjectedKubeObjectListLayout<K extends KubeObject> extends React.Compon
|
||||
}
|
||||
|
||||
render() {
|
||||
const { className, customizeHeader, store, items, ...layoutProps } = this.props;
|
||||
const placeholderString = ResourceNames[ResourceKindMap[store.api.kind]] || store.api.kind;
|
||||
const { className, customizeHeader, store, items, ...layoutProps } =
|
||||
this.props;
|
||||
const placeholderString =
|
||||
ResourceNames[ResourceKindMap[store.api.kind]] || store.api.kind;
|
||||
|
||||
return (
|
||||
<ItemListLayout
|
||||
@ -117,7 +128,7 @@ class NonInjectedKubeObjectListLayout<K extends KubeObject> extends React.Compon
|
||||
filters: (
|
||||
<>
|
||||
{filters}
|
||||
{store.api.isNamespaced && <NamespaceSelectFilter />}
|
||||
{store.api.isNamespaced && <NamespaceSelectFilter id="kube-object-list-layout-namespace-select-input" />}
|
||||
</>
|
||||
),
|
||||
searchProps: {
|
||||
@ -141,7 +152,10 @@ class NonInjectedKubeObjectListLayout<K extends KubeObject> extends React.Compon
|
||||
}
|
||||
}
|
||||
|
||||
const InjectedKubeObjectListLayout = withInjectables<Dependencies, KubeObjectListLayoutProps<KubeObject>>(NonInjectedKubeObjectListLayout, {
|
||||
const InjectedKubeObjectListLayout = withInjectables<
|
||||
Dependencies,
|
||||
KubeObjectListLayoutProps<KubeObject>
|
||||
>(NonInjectedKubeObjectListLayout, {
|
||||
getProps: (di, props) => ({
|
||||
clusterFrameContext: di.inject(clusterFrameContextInjectable),
|
||||
subscribeToStores: di.inject(kubeWatchApiInjectable).subscribeStores,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user