Skip to content

Commit 680a6d7

Browse files
feat: add databases page (#3246)
1 parent e0fe2df commit 680a6d7

File tree

33 files changed

+770
-240
lines changed

33 files changed

+770
-240
lines changed

src/components/TenantNameWrapper/TenantNameWrapper.tsx

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import i18n from './i18n';
1616
interface TenantNameWrapperProps {
1717
tenant: PreparedTenant;
1818
additionalTenantsProps?: AdditionalTenantsProps;
19+
externalLink?: boolean;
1920
}
2021

2122
const getTenantBackend = (
@@ -35,12 +36,16 @@ const getTenantBackend = (
3536
return additionalTenantsProps.prepareTenantBackend(nodeId);
3637
};
3738

38-
export function TenantNameWrapper({tenant, additionalTenantsProps}: TenantNameWrapperProps) {
39+
export function TenantNameWrapper({
40+
tenant,
41+
additionalTenantsProps,
42+
externalLink,
43+
}: TenantNameWrapperProps) {
3944
const isUserAllowedToMakeChanges = useIsUserAllowedToMakeChanges();
4045
const {settings} = useClusterBaseInfo();
4146

4247
const backend = getTenantBackend(tenant, additionalTenantsProps);
43-
const isExternalLink = Boolean(backend);
48+
const isExternalLink = externalLink || Boolean(backend);
4449

4550
const links = getDatabaseLinks(additionalTenantsProps, tenant?.Name, tenant?.Type);
4651
const {monitoring: clusterMonitoring} = useClusterBaseInfo();
@@ -72,6 +77,7 @@ export function TenantNameWrapper({tenant, additionalTenantsProps}: TenantNameWr
7277
hasClipboardButton
7378
path={getTenantPath(
7479
{
80+
clusterName: tenant.Cluster,
7581
database: useDatabaseId ? tenant.Id : tenant.Name,
7682
backend,
7783
},

src/containers/App/Content.tsx

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ import {useAppTitle} from './AppTitleContext';
3434
import {SettingsBootstrap} from './SettingsBootstrap';
3535
import {
3636
ClusterSlot,
37-
ClustersSlot,
37+
HomePageSlot,
3838
NodeSlot,
3939
PDiskPageSlot,
4040
RedirectSlot,
@@ -104,7 +104,15 @@ const routesSlots: RouteSlot[] = [
104104
},
105105
];
106106

107-
const Clusters = lazyComponent(() => import('../Clusters/Clusters'), 'Clusters');
107+
const multiClusterRoutes: RouteSlot[] = [
108+
{
109+
path: routes.homePage,
110+
exact: true,
111+
component: lazyComponent(() => import('../HomePage/HomePage'), 'HomePage'),
112+
slot: HomePageSlot,
113+
wrapper: HomePageDataWrapper,
114+
},
115+
];
108116

109117
function renderRouteSlot(slots: SlotMap, route: RouteSlot) {
110118
return (
@@ -147,7 +155,7 @@ export function Content(props: ContentProps) {
147155

148156
const redirect = slots.get(RedirectSlot);
149157
const redirectProps: RedirectProps =
150-
redirect?.props ?? (singleClusterMode ? {to: getClusterPath()} : {to: routes.clusters});
158+
redirect?.props ?? (singleClusterMode ? {to: getClusterPath()} : {to: routes.homePage});
151159

152160
return (
153161
<Switch>
@@ -157,12 +165,8 @@ export function Content(props: ContentProps) {
157165
<Switch>
158166
{singleClusterMode
159167
? null
160-
: renderRouteSlot(slots, {
161-
path: routes.clusters,
162-
exact: true,
163-
component: Clusters,
164-
slot: ClustersSlot,
165-
wrapper: ClustersDataWrapper,
168+
: multiClusterRoutes.map((route) => {
169+
return renderRouteSlot(slots, route);
166170
})}
167171
{/* Single cluster routes */}
168172
{routesSlots.map((route) => {
@@ -193,7 +197,7 @@ function DataWrapper({children}: {children: React.ReactNode}) {
193197
);
194198
}
195199

196-
function ClustersDataWrapper({children}: {children: React.ReactNode}) {
200+
function HomePageDataWrapper({children}: {children: React.ReactNode}) {
197201
return (
198202
<GetMetaCapabilities>
199203
<GetMetaUser>{children}</GetMetaUser>

src/containers/App/appSlots.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,19 @@ import type {RedirectProps, RouteComponentProps} from 'react-router-dom';
22

33
import {createSlot} from '../../components/slots';
44
import type {Cluster} from '../Cluster/Cluster';
5-
import type {Clusters} from '../Clusters/Clusters';
5+
import type {HomePage} from '../HomePage/HomePage';
66
import type {Node} from '../Node/Node';
77
import type {PDiskPage} from '../PDiskPage/PDiskPage';
88
import type {StorageGroupPage} from '../StorageGroupPage/StorageGroupPage';
99
import type {Tablet} from '../Tablet';
1010
import type {Tenant} from '../Tenant/Tenant';
1111
import type {VDiskPage} from '../VDiskPage/VDiskPage';
1212

13-
export const ClustersSlot = createSlot<{
13+
export const HomePageSlot = createSlot<{
1414
children:
1515
| React.ReactNode
16-
| ((props: {component: typeof Clusters} & RouteComponentProps) => React.ReactNode);
17-
}>('clusters');
16+
| ((props: {component: typeof HomePage} & RouteComponentProps) => React.ReactNode);
17+
}>('homePage');
1818
export const ClusterSlot = createSlot<{
1919
children:
2020
| React.ReactNode

src/containers/Cluster/Cluster.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ import {Configs} from '../Configs/Configs';
3939
import {Nodes} from '../Nodes/Nodes';
4040
import {PaginatedStorage} from '../Storage/PaginatedStorage';
4141
import {TabletsTable} from '../Tablets/TabletsTable';
42-
import {Tenants} from '../Tenants/Tenants';
42+
import {TenantsClusterTab} from '../Tenants/TenantsClusterTab';
4343
import {VersionsContainer} from '../Versions/Versions';
4444

4545
import {ClusterOverview} from './ClusterOverview/ClusterOverview';
@@ -217,7 +217,7 @@ export function Cluster({additionalClusterProps, additionalTenantsProps}: Cluste
217217
).pathname
218218
}
219219
>
220-
<Tenants
220+
<TenantsClusterTab
221221
additionalTenantsProps={additionalTenantsProps}
222222
scrollContainerRef={container}
223223
/>

src/containers/Clusters/Clusters.scss

Lines changed: 1 addition & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,8 @@
11
@use '../../styles/mixins.scss';
22

3-
.clusters {
4-
overflow: auto;
5-
gap: var(--g-spacing-4);
6-
7-
padding: var(--g-spacing-4) 0 0 var(--g-spacing-5);
8-
3+
.ydb-clusters {
94
@include mixins.body-2-typography();
10-
@include mixins.flex-container();
11-
12-
&__title-wrapper,
13-
&__controls-wrapper {
14-
padding-right: var(--g-spacing-5);
15-
}
165

17-
&__autorefresh {
18-
margin-left: auto;
19-
}
206
&__cluster-name {
217
white-space: normal;
228
text-decoration: none;
@@ -31,17 +17,6 @@
3117
white-space: normal;
3218
}
3319

34-
&__control {
35-
width: 200px;
36-
margin-right: 15px;
37-
38-
&_wide {
39-
width: 320px;
40-
}
41-
}
42-
&__column-setup {
43-
margin-left: auto;
44-
}
4520
&__empty-cell {
4621
color: var(--g-color-text-secondary);
4722
}
@@ -57,21 +32,8 @@
5732
}
5833

5934
&__table-wrapper {
60-
overflow: auto;
61-
62-
@include mixins.flex-container();
63-
}
64-
65-
&__table-content {
66-
overflow: auto;
67-
68-
height: 100%;
69-
}
70-
71-
&__table {
7235
--data-table-cell-align: top;
7336
--data-table-cell-vertical-padding: var(--g-spacing-3);
74-
@include mixins.freeze-nth-column(1);
7537
}
7638

7739
&__balancer-copy-icon {

0 commit comments

Comments
 (0)