From ca47c5e0e317aa7f631bf7843afa492cf6b80d4d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=A2=D0=B5=D1=80=D0=B5=D0=BD=D1=82=D1=8C=D0=B5=D0=B2=20?= =?UTF-8?q?=D0=92=D0=B0=D0=B4=D0=B8=D0=BC=20=D0=90=D0=BB=D0=B5=D0=BA=D1=81?= =?UTF-8?q?=D0=B5=D0=B5=D0=B2=D0=B8=D1=87?= Date: Mon, 15 Apr 2024 08:52:17 +0300 Subject: [PATCH] =?UTF-8?q?GL-17:=20=D0=90=D0=B2=D1=82=D0=BE=D0=BC=D0=B0?= =?UTF-8?q?=D1=82=D0=B8=D1=87=D0=B5=D1=81=D0=BA=D0=B0=D1=8F=20=D0=B1=D0=BB?= =?UTF-8?q?=D0=BE=D0=BA=D0=B8=D1=80=D0=BE=D0=B2=D0=BA=D0=B0=20=D0=B7=D0=B0?= =?UTF-8?q?=D0=B3=D1=80=D1=83=D0=B7=D0=BA=D0=B8=20=D0=B8=20=D1=81=D0=B1?= =?UTF-8?q?=D0=BE=D1=80=D0=BA=D0=B8=20=D0=BF=D1=80=D0=BE=D0=B5=D0=BA=D1=82?= =?UTF-8?q?=D0=B0,=20=D0=B5=D1=81=D0=BB=D0=B8=20=D0=B7=D0=B0=D0=BF=D1=80?= =?UTF-8?q?=D0=B5=D1=89=D0=B5=D0=BD=D0=BE=20=D0=BE=D0=B1=D0=BD=D0=BE=D0=B2?= =?UTF-8?q?=D0=BB=D0=B5=D0=BD=D0=B8=D0=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/screens/Profile/ui/Profile.tsx | 2 +- .../api/contracts/profiles/ProfileBaseEntity.ts | 1 + src/widgets/client-hub/lib/useConnectionHub.ts | 9 +++++---- src/widgets/client-hub/ui/DownloadClientHub.tsx | 15 ++++++++++++--- 4 files changed, 19 insertions(+), 8 deletions(-) diff --git a/src/screens/Profile/ui/Profile.tsx b/src/screens/Profile/ui/Profile.tsx index 23f17e5..e2371af 100644 --- a/src/screens/Profile/ui/Profile.tsx +++ b/src/screens/Profile/ui/Profile.tsx @@ -57,7 +57,7 @@ export const ProfilePage = ({ params }: { params: { name: string } }) => {
- +
); diff --git a/src/shared/api/contracts/profiles/ProfileBaseEntity.ts b/src/shared/api/contracts/profiles/ProfileBaseEntity.ts index 461175a..4180316 100644 --- a/src/shared/api/contracts/profiles/ProfileBaseEntity.ts +++ b/src/shared/api/contracts/profiles/ProfileBaseEntity.ts @@ -15,6 +15,7 @@ export type ProfileExtendedBaseEntity = { iconBase64: string; description: string; arguments: string; + hasUpdate: boolean; files: ProfileFileBaseEntity[]; whiteListFiles: ProfileFileBaseEntity[]; }; diff --git a/src/widgets/client-hub/lib/useConnectionHub.ts b/src/widgets/client-hub/lib/useConnectionHub.ts index 1947cb5..02d605c 100644 --- a/src/widgets/client-hub/lib/useConnectionHub.ts +++ b/src/widgets/client-hub/lib/useConnectionHub.ts @@ -2,9 +2,10 @@ import { useEffect, useState } from "react"; import { HubConnection, HubConnectionBuilder } from "@microsoft/signalr"; import { getStorageAccessToken } from "@/shared/services"; import { useToast } from "@/shared/ui/use-toast"; +import { ProfileExtendedBaseEntity } from "@/shared/api/contracts"; interface ConnectionHubProps { - profileName: string; + profile?: ProfileExtendedBaseEntity; isLoading?: boolean; } @@ -12,7 +13,7 @@ const CONNECTION_URL = (token: string) => `${process.env.NEXT_PUBLIC_BASE_URL}/ws/profiles/restore?access_token=${token}`; export const useConnectionHub = (props: ConnectionHubProps) => { - const { profileName, isLoading } = props; + const { profile, isLoading } = props; const { toast } = useToast(); const accessToken = getStorageAccessToken(); @@ -70,7 +71,7 @@ export const useConnectionHub = (props: ConnectionHubProps) => { const onDownloadDistributive = () => { setIsRestoring(true); connectionHub - ?.invoke("Restore", profileName) + ?.invoke("Restore", profile?.profileName) .then(() => { toast({ title: "Успешно", @@ -92,7 +93,7 @@ export const useConnectionHub = (props: ConnectionHubProps) => { const onBuildDistributive = () => { setIsRestoring(true); connectionHub - ?.invoke("Build", profileName) + ?.invoke("Build", profile?.profileName) .then(() => { toast({ title: "Успешно", diff --git a/src/widgets/client-hub/ui/DownloadClientHub.tsx b/src/widgets/client-hub/ui/DownloadClientHub.tsx index e661dff..d6ce1bd 100644 --- a/src/widgets/client-hub/ui/DownloadClientHub.tsx +++ b/src/widgets/client-hub/ui/DownloadClientHub.tsx @@ -5,9 +5,10 @@ import { Button } from "@/shared/ui/button"; import { Progress } from "@/shared/ui/progress"; import { useConnectionHub } from "../lib/useConnectionHub"; +import { ProfileExtendedBaseEntity } from "@/shared/api/contracts"; interface DownloadClientHubProps { - profileName: string; + profile: ProfileExtendedBaseEntity; isLoading?: boolean; } @@ -23,7 +24,11 @@ export function DownloadClientHub(props: DownloadClientHubProps) {

Необходимо загрузить клиент

-
@@ -34,7 +39,11 @@ export function DownloadClientHub(props: DownloadClientHubProps) {

Необходимо собрать профиль

-