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

Simplifying Helm loading state

Signed-off-by: alexfront <alex.andreev.email@gmail.com>
This commit is contained in:
alexfront 2020-08-17 12:41:06 +03:00
parent bba4d96386
commit 86ac718ee9
2 changed files with 5 additions and 6 deletions

View File

@ -21,7 +21,6 @@ import { Tooltip } from "../tooltip";
@observer @observer
export class Preferences extends React.Component { export class Preferences extends React.Component {
@observable helmLoading = false; @observable helmLoading = false;
@observable helmUpdating = false;
@observable helmRepos: HelmRepo[] = []; @observable helmRepos: HelmRepo[] = [];
@observable helmAddedRepos = observable.map<string, HelmRepo>(); @observable helmAddedRepos = observable.map<string, HelmRepo>();
@ -90,9 +89,9 @@ export class Preferences extends React.Component {
Notifications.ok(<Trans>Helm branch <b>{repo.name}</b> already in use</Trans>) Notifications.ok(<Trans>Helm branch <b>{repo.name}</b> already in use</Trans>)
return; return;
} }
this.helmUpdating = false; this.helmLoading = true;
await this.addRepo(repo); await this.addRepo(repo);
this.helmUpdating = false; this.helmLoading = false;
} }
formatHelmOptionLabel = ({ value: repo }: SelectOption<HelmRepo>) => { formatHelmOptionLabel = ({ value: repo }: SelectOption<HelmRepo>) => {
@ -135,14 +134,14 @@ export class Preferences extends React.Component {
<Select <Select
placeholder={<Trans>Repositories</Trans>} placeholder={<Trans>Repositories</Trans>}
isLoading={this.helmLoading} isLoading={this.helmLoading}
isDisabled={this.helmUpdating} isDisabled={this.helmLoading}
options={this.helmOptions} options={this.helmOptions}
onChange={this.onRepoSelect} onChange={this.onRepoSelect}
formatOptionLabel={this.formatHelmOptionLabel} formatOptionLabel={this.formatHelmOptionLabel}
controlShouldRenderValue={false} controlShouldRenderValue={false}
/> />
<div className="repos flex gaps column"> <div className="repos flex gaps column">
{this.helmLoading && <Spinner center />}
{Array.from(this.helmAddedRepos).map(([name, repo]) => { {Array.from(this.helmAddedRepos).map(([name, repo]) => {
const tooltipId = `message-${name}`; const tooltipId = `message-${name}`;
return ( return (

View File

@ -23,7 +23,7 @@ html {
&--is-disabled { &--is-disabled {
opacity: .75; opacity: .75;
cursor: not-allowed; cursor: not-allowed;
pointer-events: auto; pointer-events: none;
} }
&__control { &__control {