mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
add waiting for extension to be enabled
Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
1 parent
b6a17eb1be
commit
28b49cc8f2
3 files changed
+12
-3
No files matched your search
@@ -73,7 +73,7 @@ export class ExtensionLoader {
|
||||
}
|
||||
|
||||
await Promise.all([this.whenLoaded, extensionsStore.whenLoaded]);
|
||||
|
||||
|
||||
// save state on change `extension.isEnabled`
|
||||
reaction(() => this.storeState, extensionsState => {
|
||||
extensionsStore.mergeState(extensionsState);
|
||||
@@ -149,7 +149,7 @@ export class ExtensionLoader {
|
||||
this.syncExtensions(extensions);
|
||||
|
||||
const receivedExtensionIds = extensions.map(([lensExtensionId]) => lensExtensionId);
|
||||
|
||||
|
||||
// Remove deleted extensions in renderer side only
|
||||
this.extensions.forEach((_, lensExtensionId) => {
|
||||
if (!receivedExtensionIds.includes(lensExtensionId)) {
|
||||
@@ -301,6 +301,10 @@ export class ExtensionLoader {
|
||||
return this.extensions.get(extId);
|
||||
}
|
||||
|
||||
public async instanceToBeEnabled(extId: LensExtensionId): Promise<void> {
|
||||
return when(() => this.instances.get(extId)?.isEnabled);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get url to the tarball of the extension package. Assumes package is found from npm regisry.
|
||||
* @param packageName e.g. "@mirantis/lens-extension-cc"
|
||||
|
||||
@@ -22,7 +22,7 @@ export class LensExtension {
|
||||
readonly manifestPath: string;
|
||||
readonly isBundled: boolean;
|
||||
|
||||
@observable private isEnabled = false;
|
||||
@observable isEnabled = false;
|
||||
|
||||
constructor({ id, manifest, manifestPath, isBundled }: InstalledExtension) {
|
||||
this.id = id;
|
||||
|
||||
Reference in new issue
Block a user