Skip to content

Commit 4ebd2f7

Browse files
authored
BIGTOP-4358: Add cluster creation page (#174)
1 parent 8467fed commit 4ebd2f7

File tree

107 files changed

+5447
-283
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

107 files changed

+5447
-283
lines changed

bigtop-manager-ui/src/api/cluster/index.ts

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,24 @@
1818
*/
1919

2020
import request from '@/api/request.ts'
21-
import { ClusterVO } from '@/api/cluster/types.ts'
21+
import type { ClusterVO, UpdateClusterParam } from './types'
2222

23-
export const getClusters = (): Promise<ClusterVO[]> => {
23+
export const getCluster = (id: number): Promise<ClusterVO[]> => {
24+
return request({
25+
method: 'get',
26+
url: `/clusters/${id}`
27+
})
28+
}
29+
30+
export const updateCluster = (id: number, data: UpdateClusterParam) => {
31+
return request({
32+
method: 'put',
33+
url: `/clusters/${id}`,
34+
data
35+
})
36+
}
37+
38+
export const getClusterList = (): Promise<ClusterVO[]> => {
2439
return request({
2540
method: 'get',
2641
url: '/clusters'

bigtop-manager-ui/src/api/cluster/types.ts

Lines changed: 15 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -17,28 +17,21 @@
1717
* under the License.
1818
*/
1919

20-
export interface ClusterReq {
21-
clusterName: string
22-
clusterType: number
23-
stackName: string
24-
stackVersion: string
25-
repoInfoList: RepoReq[]
26-
hostnames: string[]
27-
}
20+
export type UpdateClusterParam = { name: string; desc: string }
2821

2922
export interface ClusterVO {
30-
id: number
31-
clusterName: string
32-
clusterType: number
33-
stackName: string
34-
stackVersion: string
35-
selected: boolean
36-
}
37-
38-
export interface RepoReq {
39-
repoId: string
40-
repoName: string
41-
baseUrl: string
42-
os: string
43-
arch: string
23+
createUser?: string
24+
desc?: string
25+
displayName?: string
26+
id?: number
27+
name?: string
28+
rootDir?: string
29+
status?: number
30+
totalDisk?: number
31+
totalHost?: number
32+
totalMemory?: number
33+
totalProcessor?: number
34+
totalService?: number
35+
type?: number
36+
userGroup?: string
4437
}

bigtop-manager-ui/src/api/command/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@
1818
*/
1919

2020
import request from '@/api/request.ts'
21-
import { CommandVO } from '@/api/command/types.ts'
21+
import { CommandRequest, CommandVO } from '@/api/command/types.ts'
2222

23-
export const execCommand = (data: any): Promise<CommandVO> => {
23+
export const execCommand = (data: CommandRequest): Promise<CommandVO> => {
2424
return request({
2525
method: 'post',
2626
url: '/command',

bigtop-manager-ui/src/api/command/types.ts

Lines changed: 118 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,123 @@
1717
* under the License.
1818
*/
1919

20+
export interface CommandRequest {
21+
clusterCommand?: ClusterCommandReq
22+
clusterId?: number
23+
command: Command
24+
commandLevel: CommandLevel
25+
componentCommands?: ComponentCommandReq[]
26+
customCommand?: string
27+
hostCommands?: HostCommandReq[]
28+
serviceCommands?: ServiceCommandReq[]
29+
[property: string]: any
30+
}
31+
32+
export interface ClusterCommandReq {
33+
desc?: string
34+
displayName: string
35+
hosts: HostReq[]
36+
name: string
37+
rootDir?: string
38+
type: number
39+
userGroup?: string
40+
[property: string]: any
41+
}
42+
43+
export interface HostReq {
44+
agentDir?: string
45+
authType?: number | string
46+
clusterId?: number
47+
desc?: string
48+
grpcPort?: number
49+
hostnames?: string[]
50+
sshKeyFilename?: string
51+
sshKeyPassword?: string
52+
sshKeyString?: string
53+
sshPassword?: string
54+
sshPort?: number
55+
sshUser?: string
56+
[property: string]: any
57+
}
58+
59+
export enum Command {
60+
Add = 'Add',
61+
Check = 'Check',
62+
Configure = 'Configure',
63+
Custom = 'Custom',
64+
Init = 'Init',
65+
Prepare = 'Prepare',
66+
Restart = 'Restart',
67+
Start = 'Start',
68+
Status = 'Status',
69+
Stop = 'Stop'
70+
}
71+
72+
export enum CommandLevel {
73+
Cluster = 'cluster',
74+
Component = 'component',
75+
Host = 'host',
76+
Service = 'service'
77+
}
78+
79+
export interface ComponentCommandReq {
80+
componentName: string
81+
hostnames: string[]
82+
[property: string]: any
83+
}
84+
85+
export interface HostCommandReq {
86+
agentDir?: string
87+
authType?: number
88+
clusterId?: number
89+
desc?: string
90+
grpcPort?: number
91+
hostnames?: string[]
92+
sshKeyFilename?: string
93+
sshKeyPassword?: string
94+
sshKeyString?: string
95+
sshPassword?: string
96+
sshPort?: number
97+
sshUser?: string
98+
[property: string]: any
99+
}
100+
101+
export interface ServiceCommandReq {
102+
componentHosts: ComponentHostReq[]
103+
configs: ServiceConfigReq[]
104+
serviceName: string
105+
[property: string]: any
106+
}
107+
108+
export interface ComponentHostReq {
109+
componentName: string
110+
hostnames: string[]
111+
[property: string]: any
112+
}
113+
114+
export interface ServiceConfigReq {
115+
id?: number
116+
name?: string
117+
properties?: PropertyReq[]
118+
[property: string]: any
119+
}
120+
121+
export interface PropertyReq {
122+
attrs?: AttrsReq
123+
desc?: string
124+
displayName?: string
125+
name: string
126+
value?: string
127+
[property: string]: any
128+
}
129+
130+
export interface AttrsReq {
131+
type?: string
132+
[property: string]: any
133+
}
134+
20135
export interface CommandVO {
21-
id: number
22-
state: string
136+
id?: number
137+
state?: string
138+
[property: string]: any
23139
}

bigtop-manager-ui/src/api/component/index.ts

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,3 @@
1616
* specific language governing permissions and limitations
1717
* under the License.
1818
*/
19-
20-
import { HostComponentVO } from '@/api/component/types.ts'
21-
import request from '@/api/request.ts'
22-
23-
export const getHostComponents = (clusterId: number): Promise<HostComponentVO[]> => {
24-
return request({
25-
method: 'get',
26-
url: '/clusters/' + clusterId + '/host-components'
27-
})
28-
}

bigtop-manager-ui/src/api/component/types.ts

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -17,30 +17,30 @@
1717
* under the License.
1818
*/
1919

20-
import { MaintainState } from '@/enums/state'
21-
20+
/**
21+
* ComponentVO
22+
*/
2223
export interface ComponentVO {
23-
id: number
24-
componentName: string
25-
displayName: string
26-
category: string
27-
serviceName: string
28-
clusterName: string
29-
cardinality: string
24+
cardinality?: string
25+
category?: string
26+
displayName?: string
27+
hostname?: string
28+
id?: number
29+
name?: string
30+
quickLink?: QuickLinkVO
31+
serviceDisplayName?: string
32+
serviceId?: number
33+
serviceName?: string
34+
stack?: string
35+
status?: number
36+
[property: string]: any
3037
}
3138

32-
export interface ServiceComponentVO {
33-
serviceName: string
34-
components: ComponentVO[]
35-
}
36-
37-
export interface HostComponentVO {
38-
id: number
39-
componentName: string
40-
displayName: string
41-
category: string
42-
serviceName: string
43-
clusterName: string
44-
hostname: string
45-
state: MaintainState
39+
/**
40+
* QuickLinkVO
41+
*/
42+
export interface QuickLinkVO {
43+
displayName?: string
44+
url?: string
45+
[property: string]: any
4646
}

bigtop-manager-ui/src/api/hosts/index.ts

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,34 @@
1818
*/
1919

2020
import request from '@/api/request.ts'
21-
import { HostVO } from '@/api/hosts/types.ts'
21+
import { HostParams, HostVO, HostVOList, InstalledStatusVO } from '@/api/hosts/types.ts'
2222

23-
export const getHosts = (clusterId: number): Promise<HostVO[]> => {
23+
export const getHosts = (): Promise<HostVOList> => {
2424
return request({
2525
method: 'get',
26-
url: '/clusters/' + clusterId + '/hosts'
26+
url: '/hosts'
27+
})
28+
}
29+
30+
export const addHost = (data: HostParams): Promise<HostVO> => {
31+
return request({
32+
method: 'post',
33+
url: '/hosts',
34+
data
35+
})
36+
}
37+
38+
export const installDependencies = (data: HostParams) => {
39+
return request({
40+
method: 'post',
41+
url: '/hosts/install-dependencies',
42+
data
43+
})
44+
}
45+
46+
export const getInstalledStatus = (): Promise<InstalledStatusVO[]> => {
47+
return request({
48+
method: 'get',
49+
url: '/hosts/installed-status'
2750
})
2851
}

bigtop-manager-ui/src/api/hosts/types.ts

Lines changed: 63 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,68 @@
1717
* under the License.
1818
*/
1919

20+
import type { PageVO } from '@/api/types'
21+
22+
export type HostVOList = PageVO<HostVO>
23+
24+
/**
25+
* HostVO
26+
*/
2027
export interface HostVO {
21-
id: number
22-
clusterName: string
23-
hostname: string
24-
ipv4: string
25-
arch: string
26-
os: string
27-
availableProcessors: string
28-
freeMemorySize: string
29-
totalMemorySize: string
30-
state: string
31-
freeDisk: string
32-
totalDisk: string
28+
agentDir?: string
29+
arch?: string
30+
authType?: number
31+
availableProcessors?: number
32+
clusterDisplayName?: string
33+
clusterName?: string
34+
componentNum?: number
35+
desc?: string
36+
errInfo?: string
37+
freeDisk?: number
38+
freeMemorySize?: number
39+
grpcPort?: number
40+
hostname?: string
41+
id?: number
42+
ipv4?: string
43+
ipv6?: string
44+
os?: string
45+
sshKeyFilename?: string
46+
sshKeyPassword?: string
47+
sshKeyString?: string
48+
sshPassword?: string
49+
sshPort?: number
50+
sshUser?: string
51+
status?: number
52+
totalDisk?: number
53+
totalMemorySize?: number
54+
[property: string]: any
55+
}
56+
57+
export interface HostParams {
58+
agentDir?: string
59+
authType?: number | string // '1-password,2-key,3-no_auth',
60+
clusterId?: number
61+
desc?: string
62+
grpcPort?: number
63+
hostnames?: string[]
64+
sshKeyFilename?: string
65+
sshKeyPassword?: string
66+
sshKeyString?: string
67+
sshPassword?: string
68+
sshPort?: number
69+
sshUser?: string
70+
[property: string]: any
71+
}
72+
73+
export interface InstalledStatusVO {
74+
hostname?: string
75+
message?: string
76+
status?: Status
77+
}
78+
79+
export enum Status {
80+
Failed = 'FAILED',
81+
Installing = 'INSTALLING',
82+
Success = 'SUCCESS',
83+
Unknown = 'UNKNOW'
3384
}

0 commit comments

Comments
 (0)