From 2549c164024fd82601f4885dd51645c2f2c6d6ec Mon Sep 17 00:00:00 2001 From: Roman Date: Thu, 25 Nov 2021 17:20:11 +0200 Subject: [PATCH] responding to comments Signed-off-by: Roman --- src/renderer/components/+extensions/extensions.tsx | 4 ++-- src/renderer/components/dock/create-resource.tsx | 11 +++-------- .../components/notifications/notifications.tsx | 4 ++-- 3 files changed, 7 insertions(+), 12 deletions(-) diff --git a/src/renderer/components/+extensions/extensions.tsx b/src/renderer/components/+extensions/extensions.tsx index 985ef3e044..21d3d78acc 100644 --- a/src/renderer/components/+extensions/extensions.tsx +++ b/src/renderer/components/+extensions/extensions.tsx @@ -356,7 +356,7 @@ export async function attemptInstallByInfo({ name, version, requireConfirmation return attemptInstall({ fileName, dataP }, disposer); } -async function attemptInstall(request: InstallRequest, d?: ExtendableDisposer): Promise { +async function attemptInstall(request: InstallRequest, d?: ExtendableDisposer): Promise void)> { const dispose = disposer(ExtensionInstallationStateStore.startPreInstall(), d); const validatedRequest = await createTempFilesAndValidate(request); @@ -416,7 +416,7 @@ async function attemptInstall(request: InstallRequest, d?: ExtendableDisposer): } async function attemptInstalls(filePaths: string[]): Promise { - const promises: Promise[] = []; + const promises: Promise[] = []; for (const filePath of filePaths) { promises.push(attemptInstall({ diff --git a/src/renderer/components/dock/create-resource.tsx b/src/renderer/components/dock/create-resource.tsx index 14d844045f..b7a94c868a 100644 --- a/src/renderer/components/dock/create-resource.tsx +++ b/src/renderer/components/dock/create-resource.tsx @@ -116,13 +116,8 @@ export class CreateResource extends React.Component { const creatingResources = resources.map(async (resource: string) => { try { const data: KubeJsonApiData = await resourceApplierApi.update(resource); - const resourceName = data.metadata.name; - const resourceLink = apiManager.lookupApiLink({ - kind: data.kind, - apiVersion: data.apiVersion, - name: resourceName, - namespace: data.metadata.namespace, - }); + const { kind, apiVersion, metadata: { name, namespace }} = data; + const resourceLink = apiManager.lookupApiLink({ kind, apiVersion, name, namespace }); const showDetails = () => { navigate(getDetailsUrl(resourceLink)); @@ -131,7 +126,7 @@ export class CreateResource extends React.Component { const close = Notifications.ok(

- Resource {resourceName} successfully created. + {kind} {name} successfully created.

, ); } catch (error) { diff --git a/src/renderer/components/notifications/notifications.tsx b/src/renderer/components/notifications/notifications.tsx index 8b43571975..71f63a63b1 100644 --- a/src/renderer/components/notifications/notifications.tsx +++ b/src/renderer/components/notifications/notifications.tsx @@ -43,7 +43,7 @@ export class Notifications extends React.Component { } static error(message: NotificationMessage, customOpts: Partial = {}) { - notificationsStore.add({ + return notificationsStore.add({ message, timeout: 10_000, status: NotificationStatus.ERROR, @@ -52,7 +52,7 @@ export class Notifications extends React.Component { } static shortInfo(message: NotificationMessage, customOpts: Partial = {}) { - this.info(message, { + return this.info(message, { timeout: 5_000, ...customOpts, });