-
Notifications
You must be signed in to change notification settings - Fork 327
/
index.tke.tsx
385 lines (346 loc) · 10.3 KB
/
index.tke.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
/*
* Tencent is pleased to support the open source community by making TKEStack
* available.
*
* Copyright (C) 2012-2021 Tencent. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use
* this file except in compliance with the License. You may obtain a copy of the
* License at
*
* https://opensource.org/licenses/Apache-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OF ANY KIND, either express or implied. See the License for the
* specific language governing permissions and limitations under the License.
*/
import './i18n';
import * as React from 'react';
import { Entry, insertCSS } from '@tencent/ff-redux';
import { t, Trans } from '@tencent/tea-app/lib/i18n';
import { Wrapper } from './Wrapper';
import { Addon } from './src/modules/addon';
import { PersistentEvent } from './src/modules/persistentEvent';
import { Audit } from './src/modules/audit';
import { AlarmRecord } from './src/modules/alarmRecord';
import { TipDialog } from './src/modules/common';
import { Button, Alert, Text } from '@tencent/tea-component';
import { Init_Forbiddent_Config } from './helpers/reduceNetwork';
// 公有云的图表组件为异步加载,这里为了减少路径配置,还是保留为同步加载,预先import即可变成不split
// import '@tencent/tchart/build/ChartsComponents';
import { BlankPage } from './blankPage';
import { Overview } from '@src/modules/overview';
import { PlatformTypeEnum } from './config';
import { VNCPage } from '@src/modules/vnc';
const ClusterPromise = import(/* webpackPrefetch: true */ './src/modules/cluster');
const Cluster = React.lazy(() => ClusterPromise);
const UamPromise = import(/* webpackPrefetch: true */ './src/modules/uam');
const Uam = React.lazy(() => UamPromise);
const RegistryPromise = import(/* webpackPrefetch: true */ './src/modules/registry');
const Registry = React.lazy(() => RegistryPromise);
const LogStashPromise = import(/* webpackPrefetch: true */ './src/modules/logStash');
const LogStash = React.lazy(() => LogStashPromise);
const ProjectPromise = import(/* webpackPrefetch: true */ './src/modules/project');
const Project = React.lazy(() => ProjectPromise);
const HelmPromise = import(/* webpackPrefetch: true */ './src/modules/helm');
const Helm = React.lazy(() => HelmPromise);
const ApplicationPromise = import(/* webpackPrefetch: true */ './src/modules/application');
const Application = React.lazy(() => ApplicationPromise);
const AlarmPolicyPromise = import(/* webpackPrefetch: true */ './src/modules/alarmPolicy');
const AlarmPolicy = React.lazy(() => AlarmPolicyPromise);
const NotifyPromise = import(/* webpackPrefetch: true */ './src/modules/notify');
const Notify = React.lazy(() => NotifyPromise);
insertCSS(
'hidden-checkbox',
`.hidden-checkbox .tea-form-check { display : none }
`
);
insertCSS(
'singleDatePicker',
`.tc-15-calendar-i-pre-m:hover span { display : block }
.tc-15-calendar-i-pre-m span { display : none }
.tc-15-calendar-i-next-m:hover span { display : block }
.tc-15-calendar-i-next-m span { display : none }
`
);
insertCSS(
'myTagSearchBox',
`.myTagSearchBox{ width:100% !important; background-color: #fff; }
.myTagSearchBox .tea-search__inner{ width:100% !important; }
.myTagSearchBox .tea-tag-group{ float:left; }
.myTagSearchBox .tea-search__tips{ float:left; }
.myTagSearchBox.is-active .tea-search__tips{ display:none; }
`
);
insertCSS(
'back-link',
`
.back-link { margin-right:24px; }
`
);
/** ======= hack外层,使其能够接受参数,触发state变化,进行侧边栏的更新 ======== */
interface TempWrapperProps {
/** 当前业务的businessKey */
businessKey: string;
children: React.ReactNode;
}
class TempWrapper extends React.Component<TempWrapperProps, any> {
render() {
return <Wrapper platformType={PlatformTypeEnum.Manager}>{this.props.children}</Wrapper>;
}
}
/** ======= hack外层,使其能够接受参数,触发state变化,进行侧边栏的更新 ======== */
/** ========================== 展示没有权限弹窗 ================================ */
export let changeForbiddentConfig;
interface ForbiddentDialogState {
forbiddentConfig: { isShow: boolean; message: string };
}
class ForbiddentDialog extends React.Component<any, ForbiddentDialogState> {
constructor(props: any) {
super(props);
this.state = {
forbiddentConfig: Init_Forbiddent_Config
};
changeForbiddentConfig = (config: { isShow: boolean; message: string }) => {
this.setState({ forbiddentConfig: config });
};
}
render() {
const { isShow, message } = this.state.forbiddentConfig;
return (
<TipDialog
isShow={isShow}
caption="系统提示"
cancelAction={() => {
this._closeDialog();
}}
footerButton={
<Button
type="weak"
onClick={() => {
this._closeDialog();
}}
>
关闭
</Button>
}
>
<React.Fragment>
<Alert type="info">{message}</Alert>
<Text>请联系平台管理员进行相关资源的调整</Text>
</React.Fragment>
</TipDialog>
);
}
private _closeDialog() {
changeForbiddentConfig(Init_Forbiddent_Config);
}
}
/** ========================== 展示没有权限弹窗 ================================ */
/** ============================== start 容器服务 模块 ================================= */
Entry.register({
businessKey: 'tkestack',
routes: {
/**
* @url https://{{domain}}/tkestack
*/
index: {
title: 'TKEStack',
container: (
<Wrapper platformType={PlatformTypeEnum.Manager}>
<ForbiddentDialog />
<Overview />
</Wrapper>
)
},
/**
* @url https://{{domain}}/tkestack/overview
*/
overview: {
title: t('概览 - TKEStack'),
container: (
<Wrapper platformType={PlatformTypeEnum.Manager}>
<ForbiddentDialog />
<Overview />
</Wrapper>
)
},
/**
* @url https://{{domain}}/tkestack/cluster
*/
cluster: {
title: t('集群管理 - TKEStack'),
container: (
<Wrapper platformType={PlatformTypeEnum.Manager}>
<ForbiddentDialog />
<Cluster />
</Wrapper>
)
},
/**
* @url https://{{domain}}/tkestack/project
*/
project: {
title: t('业务管理 - TKEStack'),
container: (
<Wrapper platformType={PlatformTypeEnum.Manager}>
<ForbiddentDialog />
<Project />
</Wrapper>
)
},
/**
* @url https://{{domain}}/tkestack/addon
*/
addon: {
title: t('扩展组件 - TKEStack'),
container: (
<Wrapper platformType={PlatformTypeEnum.Manager}>
<ForbiddentDialog />
<Addon />
</Wrapper>
)
},
/**
* @url https://dev.console.tke.com/tke/regitry
*/
registry: {
title: t('组织资源 - TKEStack'),
container: (
<Wrapper platformType={PlatformTypeEnum.Manager}>
<ForbiddentDialog />
<Registry />
</Wrapper>
)
},
/**
* @url https://{{domain}}/tkestack/access
*/
uam: {
title: t('访问管理 - TKEStack'),
container: (
<Wrapper platformType={PlatformTypeEnum.Manager}>
<ForbiddentDialog />
<Uam />
</Wrapper>
)
},
/**
* @url https://{{domain}}/tkestack/alarm
*/
alarm: {
title: t('告警设置 - TKEStack'),
container: (
<Wrapper platformType={PlatformTypeEnum.Manager}>
<ForbiddentDialog />
<AlarmPolicy />
</Wrapper>
)
},
/**
* @url https://{{domain}}/tkestack/notify
*/
notify: {
title: t('通知设置 - TKEStack'),
container: (
<Wrapper platformType={PlatformTypeEnum.Manager}>
<ForbiddentDialog />
<Notify />
</Wrapper>
)
},
/**
* @url https://{{domain}}/tkestack/alarm-record
*/
'alarm-record': {
title: t('告警记录 - TKEStack'),
container: (
<Wrapper platformType={PlatformTypeEnum.Manager}>
<ForbiddentDialog />
<AlarmRecord />
</Wrapper>
)
},
/**
* @url https://{{domain}}/tkestack/application
*/
application: {
title: t('Helm 应用 - TKEStack'),
container: (
<Wrapper platformType={PlatformTypeEnum.Manager}>
<ForbiddentDialog />
<Application />
</Wrapper>
)
},
/**
* @url https://{{domain}}/tkestack/helm
*/
helm: {
title: t('Helm2 应用 - TKEStack'),
container: (
<Wrapper platformType={PlatformTypeEnum.Manager}>
<ForbiddentDialog />
<Helm />
</Wrapper>
)
},
/**
* @url https://{{domian}}/tkestack/log
*/
log: {
title: t('日志采集 - TKEStack'),
container: (
<Wrapper platformType={PlatformTypeEnum.Manager}>
<ForbiddentDialog />
<LogStash />
</Wrapper>
)
},
/**
* @url https://{{domain}}/tkestack/persistent-event
*/
'persistent-event': {
title: t('事件持久化 - TKEStack'),
container: (
<Wrapper platformType={PlatformTypeEnum.Manager}>
<ForbiddentDialog />
<PersistentEvent />
</Wrapper>
)
},
/**
* @url https://{{domain}}/tkestack/audit
*/
audit: {
title: t('审计记录 - TKEStack'),
container: (
<Wrapper platformType={PlatformTypeEnum.Manager}>
<ForbiddentDialog />
<Audit />
</Wrapper>
)
},
/**
* @url https://{{domain}}/tkestack/blank
*/
blank: {
title: t('暂无权限'),
container: (
<Wrapper platformType={PlatformTypeEnum.Manager} sideBar={false}>
<ForbiddentDialog />
<BlankPage />
</Wrapper>
)
},
/**
* @url https://{{domain}}/tkestack/vnc
*/
vnc: {
title: t('VNC'),
container: <VNCPage />
}
}
});
/** ============================== end 容器服务 模块 ================================= */