Skip to content

Commit

Permalink
BIGTOP-4358: Add cluster creation page (#174)
Browse files Browse the repository at this point in the history
  • Loading branch information
FU-design authored Feb 11, 2025
1 parent 8467fed commit 4ebd2f7
Show file tree
Hide file tree
Showing 107 changed files with 5,447 additions and 283 deletions.
19 changes: 17 additions & 2 deletions bigtop-manager-ui/src/api/cluster/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,24 @@
*/

import request from '@/api/request.ts'
import { ClusterVO } from '@/api/cluster/types.ts'
import type { ClusterVO, UpdateClusterParam } from './types'

export const getClusters = (): Promise<ClusterVO[]> => {
export const getCluster = (id: number): Promise<ClusterVO[]> => {
return request({
method: 'get',
url: `/clusters/${id}`
})
}

export const updateCluster = (id: number, data: UpdateClusterParam) => {
return request({
method: 'put',
url: `/clusters/${id}`,
data
})
}

export const getClusterList = (): Promise<ClusterVO[]> => {
return request({
method: 'get',
url: '/clusters'
Expand Down
37 changes: 15 additions & 22 deletions bigtop-manager-ui/src/api/cluster/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,28 +17,21 @@
* under the License.
*/

export interface ClusterReq {
clusterName: string
clusterType: number
stackName: string
stackVersion: string
repoInfoList: RepoReq[]
hostnames: string[]
}
export type UpdateClusterParam = { name: string; desc: string }

export interface ClusterVO {
id: number
clusterName: string
clusterType: number
stackName: string
stackVersion: string
selected: boolean
}

export interface RepoReq {
repoId: string
repoName: string
baseUrl: string
os: string
arch: string
createUser?: string
desc?: string
displayName?: string
id?: number
name?: string
rootDir?: string
status?: number
totalDisk?: number
totalHost?: number
totalMemory?: number
totalProcessor?: number
totalService?: number
type?: number
userGroup?: string
}
4 changes: 2 additions & 2 deletions bigtop-manager-ui/src/api/command/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@
*/

import request from '@/api/request.ts'
import { CommandVO } from '@/api/command/types.ts'
import { CommandRequest, CommandVO } from '@/api/command/types.ts'

export const execCommand = (data: any): Promise<CommandVO> => {
export const execCommand = (data: CommandRequest): Promise<CommandVO> => {
return request({
method: 'post',
url: '/command',
Expand Down
120 changes: 118 additions & 2 deletions bigtop-manager-ui/src/api/command/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,123 @@
* under the License.
*/

export interface CommandRequest {
clusterCommand?: ClusterCommandReq
clusterId?: number
command: Command
commandLevel: CommandLevel
componentCommands?: ComponentCommandReq[]
customCommand?: string
hostCommands?: HostCommandReq[]
serviceCommands?: ServiceCommandReq[]
[property: string]: any
}

export interface ClusterCommandReq {
desc?: string
displayName: string
hosts: HostReq[]
name: string
rootDir?: string
type: number
userGroup?: string
[property: string]: any
}

export interface HostReq {
agentDir?: string
authType?: number | string
clusterId?: number
desc?: string
grpcPort?: number
hostnames?: string[]
sshKeyFilename?: string
sshKeyPassword?: string
sshKeyString?: string
sshPassword?: string
sshPort?: number
sshUser?: string
[property: string]: any
}

export enum Command {
Add = 'Add',
Check = 'Check',
Configure = 'Configure',
Custom = 'Custom',
Init = 'Init',
Prepare = 'Prepare',
Restart = 'Restart',
Start = 'Start',
Status = 'Status',
Stop = 'Stop'
}

export enum CommandLevel {
Cluster = 'cluster',
Component = 'component',
Host = 'host',
Service = 'service'
}

export interface ComponentCommandReq {
componentName: string
hostnames: string[]
[property: string]: any
}

export interface HostCommandReq {
agentDir?: string
authType?: number
clusterId?: number
desc?: string
grpcPort?: number
hostnames?: string[]
sshKeyFilename?: string
sshKeyPassword?: string
sshKeyString?: string
sshPassword?: string
sshPort?: number
sshUser?: string
[property: string]: any
}

export interface ServiceCommandReq {
componentHosts: ComponentHostReq[]
configs: ServiceConfigReq[]
serviceName: string
[property: string]: any
}

export interface ComponentHostReq {
componentName: string
hostnames: string[]
[property: string]: any
}

export interface ServiceConfigReq {
id?: number
name?: string
properties?: PropertyReq[]
[property: string]: any
}

export interface PropertyReq {
attrs?: AttrsReq
desc?: string
displayName?: string
name: string
value?: string
[property: string]: any
}

export interface AttrsReq {
type?: string
[property: string]: any
}

export interface CommandVO {
id: number
state: string
id?: number
state?: string
[property: string]: any
}
10 changes: 0 additions & 10 deletions bigtop-manager-ui/src/api/component/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,3 @@
* specific language governing permissions and limitations
* under the License.
*/

import { HostComponentVO } from '@/api/component/types.ts'
import request from '@/api/request.ts'

export const getHostComponents = (clusterId: number): Promise<HostComponentVO[]> => {
return request({
method: 'get',
url: '/clusters/' + clusterId + '/host-components'
})
}
46 changes: 23 additions & 23 deletions bigtop-manager-ui/src/api/component/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,30 +17,30 @@
* under the License.
*/

import { MaintainState } from '@/enums/state'

/**
* ComponentVO
*/
export interface ComponentVO {
id: number
componentName: string
displayName: string
category: string
serviceName: string
clusterName: string
cardinality: string
cardinality?: string
category?: string
displayName?: string
hostname?: string
id?: number
name?: string
quickLink?: QuickLinkVO
serviceDisplayName?: string
serviceId?: number
serviceName?: string
stack?: string
status?: number
[property: string]: any
}

export interface ServiceComponentVO {
serviceName: string
components: ComponentVO[]
}

export interface HostComponentVO {
id: number
componentName: string
displayName: string
category: string
serviceName: string
clusterName: string
hostname: string
state: MaintainState
/**
* QuickLinkVO
*/
export interface QuickLinkVO {
displayName?: string
url?: string
[property: string]: any
}
29 changes: 26 additions & 3 deletions bigtop-manager-ui/src/api/hosts/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,34 @@
*/

import request from '@/api/request.ts'
import { HostVO } from '@/api/hosts/types.ts'
import { HostParams, HostVO, HostVOList, InstalledStatusVO } from '@/api/hosts/types.ts'

export const getHosts = (clusterId: number): Promise<HostVO[]> => {
export const getHosts = (): Promise<HostVOList> => {
return request({
method: 'get',
url: '/clusters/' + clusterId + '/hosts'
url: '/hosts'
})
}

export const addHost = (data: HostParams): Promise<HostVO> => {
return request({
method: 'post',
url: '/hosts',
data
})
}

export const installDependencies = (data: HostParams) => {
return request({
method: 'post',
url: '/hosts/install-dependencies',
data
})
}

export const getInstalledStatus = (): Promise<InstalledStatusVO[]> => {
return request({
method: 'get',
url: '/hosts/installed-status'
})
}
75 changes: 63 additions & 12 deletions bigtop-manager-ui/src/api/hosts/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,68 @@
* under the License.
*/

import type { PageVO } from '@/api/types'

export type HostVOList = PageVO<HostVO>

/**
* HostVO
*/
export interface HostVO {
id: number
clusterName: string
hostname: string
ipv4: string
arch: string
os: string
availableProcessors: string
freeMemorySize: string
totalMemorySize: string
state: string
freeDisk: string
totalDisk: string
agentDir?: string
arch?: string
authType?: number
availableProcessors?: number
clusterDisplayName?: string
clusterName?: string
componentNum?: number
desc?: string
errInfo?: string
freeDisk?: number
freeMemorySize?: number
grpcPort?: number
hostname?: string
id?: number
ipv4?: string
ipv6?: string
os?: string
sshKeyFilename?: string
sshKeyPassword?: string
sshKeyString?: string
sshPassword?: string
sshPort?: number
sshUser?: string
status?: number
totalDisk?: number
totalMemorySize?: number
[property: string]: any
}

export interface HostParams {
agentDir?: string
authType?: number | string // '1-password,2-key,3-no_auth',
clusterId?: number
desc?: string
grpcPort?: number
hostnames?: string[]
sshKeyFilename?: string
sshKeyPassword?: string
sshKeyString?: string
sshPassword?: string
sshPort?: number
sshUser?: string
[property: string]: any
}

export interface InstalledStatusVO {
hostname?: string
message?: string
status?: Status
}

export enum Status {
Failed = 'FAILED',
Installing = 'INSTALLING',
Success = 'SUCCESS',
Unknown = 'UNKNOW'
}
Loading

0 comments on commit 4ebd2f7

Please sign in to comment.