Skip to content

Commit 059df02

Browse files
committed
feat(FR-2838): show private-deployment alert with access-token shortcut on deployment detail
1 parent 8a5a711 commit 059df02

22 files changed

Lines changed: 97 additions & 7 deletions

react/src/pages/DeploymentDetailPage.tsx

Lines changed: 34 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import DeploymentStatusTag, {
1313
} from '../components/DeploymentStatusTag';
1414
import { useCurrentUserInfo } from '../hooks/backendai';
1515
import { QuestionCircleOutlined } from '@ant-design/icons';
16-
import { Skeleton, Tooltip, Typography, theme } from 'antd';
16+
import { Alert, Button, Skeleton, Tooltip, Typography, theme } from 'antd';
1717
import { BAICard, BAIFlex, toGlobalId } from 'backend.ai-ui';
1818
import React, { Suspense } from 'react';
1919
import { useTranslation } from 'react-i18next';
@@ -40,6 +40,9 @@ const DeploymentDetailPage: React.FC = () => {
4040
name
4141
status
4242
}
43+
networkAccess {
44+
openToPublic
45+
}
4346
creator @since(version: "26.4.3") {
4447
basicInfo {
4548
email
@@ -74,6 +77,15 @@ const DeploymentDetailPage: React.FC = () => {
7477
const isOwnedByCurrentUser =
7578
!creatorEmail || creatorEmail === currentUser.email;
7679

80+
const isPrivateDeployment =
81+
deployment.networkAccess.openToPublic === false && !isDeploymentDestroying;
82+
83+
const scrollToAccessTokens = () => {
84+
document
85+
.getElementById('deployment-access-tokens')
86+
?.scrollIntoView({ behavior: 'smooth', block: 'start' });
87+
};
88+
7789
return (
7890
<BAIFlex direction="column" align="stretch" gap="md">
7991
<BAIFlex direction="row" align="center" gap="sm">
@@ -82,6 +94,19 @@ const DeploymentDetailPage: React.FC = () => {
8294
</Typography.Title>
8395
<DeploymentStatusTag status={deploymentStatus} />
8496
</BAIFlex>
97+
{isPrivateDeployment && (
98+
<Alert
99+
type="info"
100+
showIcon
101+
title={t('deployment.PrivateDeploymentAlertTitle')}
102+
description={t('deployment.PrivateDeploymentAlertDescription')}
103+
action={
104+
<Button onClick={scrollToAccessTokens}>
105+
{t('deployment.ManageAccessTokens')}
106+
</Button>
107+
}
108+
/>
109+
)}
85110
<DeploymentConfigurationSection
86111
deploymentId={toGlobalId('ModelDeployment', deploymentId)}
87112
isDeploymentDestroying={isDeploymentDestroying}
@@ -109,12 +134,14 @@ const DeploymentDetailPage: React.FC = () => {
109134
</BAIErrorBoundary>
110135
</BAICard>
111136
<DeploymentAutoScalingTab deploymentFrgmt={deployment} />
112-
<DeploymentAccessTokensTab
113-
deploymentFrgmt={deployment}
114-
deploymentId={toGlobalId('ModelDeployment', deploymentId)}
115-
isOwnedByCurrentUser={isOwnedByCurrentUser}
116-
isDeploymentDestroying={isDeploymentDestroying}
117-
/>
137+
<div id="deployment-access-tokens">
138+
<DeploymentAccessTokensTab
139+
deploymentFrgmt={deployment}
140+
deploymentId={toGlobalId('ModelDeployment', deploymentId)}
141+
isOwnedByCurrentUser={isOwnedByCurrentUser}
142+
isDeploymentDestroying={isDeploymentDestroying}
143+
/>
144+
</div>
118145
</BAIFlex>
119146
);
120147
};

resources/i18n/de.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -945,6 +945,7 @@
945945
"Image": "Image",
946946
"LegacyRouteRedirected": "Die Endpunkt-URL wurde verschoben. Sie wurden zur neuen Bereitstellungsseite weitergeleitet.",
947947
"LivenessStatus": "Liveness-Status",
948+
"ManageAccessTokens": "Zugriffstoken verwalten",
948949
"Model": "Modell",
949950
"ModelDefinitionPath": "Pfad zur Modelldefinitionsdatei",
950951
"ModelFolder": "Modellordner",
@@ -965,6 +966,8 @@
965966
"Overview": "Übersicht",
966967
"Owner": "Eigentümer",
967968
"Private": "Privat",
969+
"PrivateDeploymentAlertDescription": "Verwenden Sie ein Zugriffstoken, um den Endpunkt dieser Bereitstellung zu nutzen.",
970+
"PrivateDeploymentAlertTitle": "Private Bereitstellung",
968971
"Project": "Projekt",
969972
"Public": "Öffentlich",
970973
"QuickDeploy": "Bereitstellen",

resources/i18n/el.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -945,6 +945,7 @@
945945
"Image": "Image",
946946
"LegacyRouteRedirected": "Το URL τελικού σημείου μετακινήθηκε. Ανακατευθυνθήκατε στη νέα σελίδα αναπτύξεων.",
947947
"LivenessStatus": "Κατάσταση Liveness",
948+
"ManageAccessTokens": "Διαχείριση διακριτικών πρόσβασης",
948949
"Model": "Μοντέλο",
949950
"ModelDefinitionPath": "Διαδρομή αρχείου ορισμού μοντέλου",
950951
"ModelFolder": "Φάκελος μοντέλου",
@@ -965,6 +966,8 @@
965966
"Overview": "Επισκόπηση",
966967
"Owner": "Ιδιοκτήτης",
967968
"Private": "Ιδιωτικό",
969+
"PrivateDeploymentAlertDescription": "Χρησιμοποιήστε ένα διακριτικό πρόσβασης για να αποκτήσετε πρόσβαση στο τελικό σημείο αυτής της ανάπτυξης.",
970+
"PrivateDeploymentAlertTitle": "Ιδιωτική ανάπτυξη",
968971
"Project": "Έργο",
969972
"Public": "Δημόσιο",
970973
"QuickDeploy": "Ανάπτυξη",

resources/i18n/en.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -947,6 +947,7 @@
947947
"Image": "Image",
948948
"LegacyRouteRedirected": "The endpoint URL has moved. You have been redirected to the new Deployments page.",
949949
"LivenessStatus": "Liveness Status",
950+
"ManageAccessTokens": "Manage Access Tokens",
950951
"Model": "Model",
951952
"ModelDefinitionPath": "Model Definition File Path",
952953
"ModelFolder": "Model Folder",
@@ -967,6 +968,8 @@
967968
"Overview": "Overview",
968969
"Owner": "Owner",
969970
"Private": "Private",
971+
"PrivateDeploymentAlertDescription": "Use an access token to access this deployment's endpoint.",
972+
"PrivateDeploymentAlertTitle": "Private deployment",
970973
"Project": "Project",
971974
"Public": "Public",
972975
"QuickDeploy": "Deploy",

resources/i18n/es.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -945,6 +945,7 @@
945945
"Image": "Imagen",
946946
"LegacyRouteRedirected": "La URL del endpoint ha cambiado. Ha sido redirigido a la nueva página de despliegues.",
947947
"LivenessStatus": "Estado de Liveness",
948+
"ManageAccessTokens": "Administrar tokens de acceso",
948949
"Model": "Modelo",
949950
"ModelDefinitionPath": "Ruta del archivo de definición del modelo",
950951
"ModelFolder": "Carpeta del modelo",
@@ -965,6 +966,8 @@
965966
"Overview": "Resumen",
966967
"Owner": "Propietario",
967968
"Private": "Privado",
969+
"PrivateDeploymentAlertDescription": "Use un token de acceso para acceder al endpoint de este despliegue.",
970+
"PrivateDeploymentAlertTitle": "Despliegue privado",
968971
"Project": "Proyecto",
969972
"Public": "Público",
970973
"QuickDeploy": "Desplegar",

resources/i18n/fi.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -945,6 +945,7 @@
945945
"Image": "Image",
946946
"LegacyRouteRedirected": "Päätepisteen URL on muuttunut. Sinut on ohjattu uudelle käyttöönottosivulle.",
947947
"LivenessStatus": "Liveness-tila",
948+
"ManageAccessTokens": "Hallitse käyttöoikeustunnuksia",
948949
"Model": "Malli",
949950
"ModelDefinitionPath": "Mallimäärittelytiedoston polku",
950951
"ModelFolder": "Mallikansio",
@@ -965,6 +966,8 @@
965966
"Overview": "Yleiskatsaus",
966967
"Owner": "Omistaja",
967968
"Private": "Yksityinen",
969+
"PrivateDeploymentAlertDescription": "Käytä käyttöoikeustunnusta tämän käyttöönoton päätepisteen käyttämiseen.",
970+
"PrivateDeploymentAlertTitle": "Yksityinen käyttöönotto",
968971
"Project": "Projekti",
969972
"Public": "Julkinen",
970973
"QuickDeploy": "Ota käyttöön",

resources/i18n/fr.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -945,6 +945,7 @@
945945
"Image": "Image",
946946
"LegacyRouteRedirected": "L'URL du point de terminaison a changé. Vous avez été redirigé vers la nouvelle page de déploiements.",
947947
"LivenessStatus": "État Liveness",
948+
"ManageAccessTokens": "Gérer les jetons d'accès",
948949
"Model": "Modèle",
949950
"ModelDefinitionPath": "Chemin du fichier de définition du modèle",
950951
"ModelFolder": "Dossier du modèle",
@@ -965,6 +966,8 @@
965966
"Overview": "Aperçu",
966967
"Owner": "Propriétaire",
967968
"Private": "Privé",
969+
"PrivateDeploymentAlertDescription": "Utilisez un jeton d'accès pour accéder au point de terminaison de ce déploiement.",
970+
"PrivateDeploymentAlertTitle": "Déploiement privé",
968971
"Project": "Projet",
969972
"Public": "Public",
970973
"QuickDeploy": "Déployer",

resources/i18n/id.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -945,6 +945,7 @@
945945
"Image": "Image",
946946
"LegacyRouteRedirected": "URL titik akhir telah dipindahkan. Anda telah diarahkan ke halaman Penerapan baru.",
947947
"LivenessStatus": "Status Liveness",
948+
"ManageAccessTokens": "Kelola token akses",
948949
"Model": "Model",
949950
"ModelDefinitionPath": "Jalur File Definisi Model",
950951
"ModelFolder": "Folder Model",
@@ -965,6 +966,8 @@
965966
"Overview": "Ikhtisar",
966967
"Owner": "Pemilik",
967968
"Private": "Privat",
969+
"PrivateDeploymentAlertDescription": "Gunakan token akses untuk mengakses endpoint penerapan ini.",
970+
"PrivateDeploymentAlertTitle": "Penerapan privat",
968971
"Project": "Proyek",
969972
"Public": "Publik",
970973
"QuickDeploy": "Terapkan",

resources/i18n/it.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -945,6 +945,7 @@
945945
"Image": "Image",
946946
"LegacyRouteRedirected": "L'URL dell'endpoint è stata spostata. Sei stato reindirizzato alla nuova pagina Distribuzioni.",
947947
"LivenessStatus": "Stato Liveness",
948+
"ManageAccessTokens": "Gestisci token di accesso",
948949
"Model": "Modello",
949950
"ModelDefinitionPath": "Percorso file di definizione modello",
950951
"ModelFolder": "Cartella modello",
@@ -965,6 +966,8 @@
965966
"Overview": "Panoramica",
966967
"Owner": "Proprietario",
967968
"Private": "Privato",
969+
"PrivateDeploymentAlertDescription": "Usa un token di accesso per accedere all'endpoint di questa distribuzione.",
970+
"PrivateDeploymentAlertTitle": "Distribuzione privata",
968971
"Project": "Progetto",
969972
"Public": "Pubblico",
970973
"QuickDeploy": "Distribuisci",

resources/i18n/ja.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -945,6 +945,7 @@
945945
"Image": "イメージ",
946946
"LegacyRouteRedirected": "エンドポイントURLが変更されました。新しいデプロイページにリダイレクトされました。",
947947
"LivenessStatus": "Liveness 状態",
948+
"ManageAccessTokens": "アクセストークンを管理",
948949
"Model": "モデル",
949950
"ModelDefinitionPath": "モデル定義ファイルパス",
950951
"ModelFolder": "モデルフォルダー",
@@ -965,6 +966,8 @@
965966
"Overview": "概要",
966967
"Owner": "オーナー",
967968
"Private": "非公開",
969+
"PrivateDeploymentAlertDescription": "このデプロイメントのエンドポイントにアクセスするには、アクセストークンを使用してください。",
970+
"PrivateDeploymentAlertTitle": "非公開デプロイメント",
968971
"Project": "プロジェクト",
969972
"Public": "公開",
970973
"QuickDeploy": "デプロイ",

0 commit comments

Comments
 (0)