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

Cleaning up

Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>
This commit is contained in:
Alex Andreev 2021-05-19 11:40:51 +03:00
parent 1f8e816e62
commit 405f3dbee5
3 changed files with 27 additions and 27 deletions

View File

@ -212,42 +212,42 @@ export class ExtensionInstallationStateStore {
/** /**
* The current number of extensions uninstalling * The current number of extensions uninstalling
*/ */
@computed static get uninstalling(): number { static get uninstalling(): number {
return ExtensionInstallationStateStore.UninstallingExtensions.size; return ExtensionInstallationStateStore.UninstallingExtensions.size;
} }
/** /**
* If there is at least one extension currently installing * If there is at least one extension currently installing
*/ */
@computed static get anyInstalling(): boolean { static get anyInstalling(): boolean {
return ExtensionInstallationStateStore.installing > 0; return ExtensionInstallationStateStore.installing > 0;
} }
/** /**
* If there is at least one extension currently ininstalling * If there is at least one extension currently ininstalling
*/ */
@computed static get anyUninstalling(): boolean { static get anyUninstalling(): boolean {
return ExtensionInstallationStateStore.uninstalling > 0; return ExtensionInstallationStateStore.uninstalling > 0;
} }
/** /**
* The current number of extensions preinstalling * The current number of extensions preinstalling
*/ */
@computed static get preinstalling(): number { static get preinstalling(): number {
return ExtensionInstallationStateStore.PreInstallIds.size; return ExtensionInstallationStateStore.PreInstallIds.size;
} }
/** /**
* If there is at least one extension currently downloading * If there is at least one extension currently downloading
*/ */
@computed static get anyPreinstalling(): boolean { static get anyPreinstalling(): boolean {
return ExtensionInstallationStateStore.preinstalling > 0; return ExtensionInstallationStateStore.preinstalling > 0;
} }
/** /**
* If there is at least one installing or preinstalling step taking place * If there is at least one installing or preinstalling step taking place
*/ */
@computed static get anyPreInstallingOrInstalling(): boolean { static get anyPreInstallingOrInstalling(): boolean {
return ExtensionInstallationStateStore.anyInstalling || ExtensionInstallationStateStore.anyPreinstalling; return ExtensionInstallationStateStore.anyInstalling || ExtensionInstallationStateStore.anyPreinstalling;
} }
} }

View File

@ -534,7 +534,7 @@ export class Extensions extends React.Component {
installPath={this.installPath} installPath={this.installPath}
/> />
{extensions.length && <hr/>} {extensions.length > 0 && <hr/>}
<InstalledExtensions <InstalledExtensions
extensions={extensions} extensions={extensions}

View File

@ -29,7 +29,7 @@ import { Spinner } from "../spinner";
import { ExtensionInstallationStateStore } from "./extension-install.store"; import { ExtensionInstallationStateStore } from "./extension-install.store";
import { cssNames } from "../../utils"; import { cssNames } from "../../utils";
import { observer } from "mobx-react"; import { observer } from "mobx-react";
import type { Column, Row } from "react-table"; import type { Row } from "react-table";
import type { LensExtensionId } from "../../../extensions/lens-extension"; import type { LensExtensionId } from "../../../extensions/lens-extension";
interface Props { interface Props {
@ -44,29 +44,13 @@ function getStatus(isEnabled: boolean) {
} }
export const InstalledExtensions = observer(({ extensions, uninstall, enable, disable }: Props) => { export const InstalledExtensions = observer(({ extensions, uninstall, enable, disable }: Props) => {
if (!ExtensionDiscovery.getInstance().isLoaded) {
return <div><Spinner center /></div>;
}
if (extensions.length == 0) {
return (
<div className="flex column h-full items-center justify-center">
<Icon material="extension" className={styles.noItemsIcon}/>
<h3 className="font-medium text-3xl mt-5 mb-2">
There are no extensions installed.
</h3>
<p>Please use the form above to install or drag tarbar-file here.</p>
</div>
);
}
const filters = [ const filters = [
(extension: InstalledExtension) => extension.manifest.name, (extension: InstalledExtension) => extension.manifest.name,
(extension: InstalledExtension) => getStatus(extension.isEnabled), (extension: InstalledExtension) => getStatus(extension.isEnabled),
(extension: InstalledExtension) => extension.manifest.version, (extension: InstalledExtension) => extension.manifest.version,
]; ];
const columns: Column<any>[] = useMemo( const columns = useMemo(
() => [ () => [
{ {
Header: "Name", Header: "Name",
@ -155,6 +139,22 @@ export const InstalledExtensions = observer(({ extensions, uninstall, enable, di
}, [extensions, ExtensionInstallationStateStore.anyUninstalling] }, [extensions, ExtensionInstallationStateStore.anyUninstalling]
); );
if (!ExtensionDiscovery.getInstance().isLoaded) {
return <div><Spinner center /></div>;
}
if (extensions.length == 0) {
return (
<div className="flex column h-full items-center justify-center">
<Icon material="extension" className={styles.noItemsIcon}/>
<h3 className="font-medium text-3xl mt-5 mb-2">
There are no extensions installed.
</h3>
<p>Please use the form above to install or drag tarbar-file here.</p>
</div>
);
}
return ( return (
<section data-testid="extensions-table"> <section data-testid="extensions-table">
<List <List