diff --git a/bigtop-manager-ui/src/api/cluster/index.ts b/bigtop-manager-ui/src/api/cluster/index.ts index ed38562f4..ac5206c83 100644 --- a/bigtop-manager-ui/src/api/cluster/index.ts +++ b/bigtop-manager-ui/src/api/cluster/index.ts @@ -18,9 +18,10 @@ */ import request from '@/api/request.ts' -import type { ClusterVO, UpdateClusterParam } from './types' +import type { PageVO, ListParams } from '@/api/types' +import type { ClusterVO, ServiceUserVO, UpdateClusterParam } from './types' -export const getCluster = (id: number): Promise => { +export const getCluster = (id: number): Promise => { return request({ method: 'get', url: `/clusters/${id}` @@ -41,3 +42,11 @@ export const getClusterList = (): Promise => { url: '/clusters' }) } + +export const getUserListOfService = (id: number, params: ListParams): Promise> => { + return request({ + method: 'get', + url: `/clusters/${id}/services/users`, + params + }) +} diff --git a/bigtop-manager-ui/src/api/cluster/types.ts b/bigtop-manager-ui/src/api/cluster/types.ts index b9f8beb53..4ddb4769a 100644 --- a/bigtop-manager-ui/src/api/cluster/types.ts +++ b/bigtop-manager-ui/src/api/cluster/types.ts @@ -19,6 +19,8 @@ export type UpdateClusterParam = { name: string; desc: string } +export type ClusterStatusType = 1 | 2 | 3 + export interface ClusterVO { createUser?: string desc?: string @@ -26,7 +28,7 @@ export interface ClusterVO { id?: number name?: string rootDir?: string - status?: number + status?: ClusterStatusType totalDisk?: number totalHost?: number totalMemory?: number @@ -35,3 +37,11 @@ export interface ClusterVO { type?: number userGroup?: string } + +export interface ServiceUserVO { + desc?: string + displayName?: string + user?: string + userGroup?: string + [property: string]: any +} diff --git a/bigtop-manager-ui/src/api/command/types.ts b/bigtop-manager-ui/src/api/command/types.ts index 30f599906..ca24cdbe2 100644 --- a/bigtop-manager-ui/src/api/command/types.ts +++ b/bigtop-manager-ui/src/api/command/types.ts @@ -20,8 +20,8 @@ export interface CommandRequest { clusterCommand?: ClusterCommandReq clusterId?: number - command: Command - commandLevel: CommandLevel + command: keyof typeof Command + commandLevel: keyof typeof CommandLevel componentCommands?: ComponentCommandReq[] customCommand?: string hostCommands?: HostCommandReq[] @@ -70,10 +70,10 @@ export enum Command { } export enum CommandLevel { - Cluster = 'cluster', - Component = 'component', - Host = 'host', - Service = 'service' + cluster = 'cluster', + component = 'component', + host = 'host', + service = 'service' } export interface ComponentCommandReq { diff --git a/bigtop-manager-ui/src/api/hosts/index.ts b/bigtop-manager-ui/src/api/hosts/index.ts index f970167ea..0f401364b 100644 --- a/bigtop-manager-ui/src/api/hosts/index.ts +++ b/bigtop-manager-ui/src/api/hosts/index.ts @@ -18,12 +18,13 @@ */ import request from '@/api/request.ts' -import { HostParams, HostVO, HostVOList, InstalledStatusVO } from '@/api/hosts/types.ts' +import type { HostListParams, HostParams, HostVO, HostVOList, InstalledStatusVO } from '@/api/hosts/types.ts' -export const getHosts = (): Promise => { +export const getHosts = (params?: HostListParams): Promise => { return request({ method: 'get', - url: '/hosts' + url: '/hosts', + params }) } diff --git a/bigtop-manager-ui/src/api/hosts/types.ts b/bigtop-manager-ui/src/api/hosts/types.ts index 519a3c29c..06e67b0ad 100644 --- a/bigtop-manager-ui/src/api/hosts/types.ts +++ b/bigtop-manager-ui/src/api/hosts/types.ts @@ -54,6 +54,17 @@ export interface HostVO { [property: string]: any } +export interface HostListParams { + clusterId?: number + hostname?: string + ipv4?: string + orderBy?: string + pageNum?: number + pageSize?: number + sort?: string + status?: number +} + export interface HostParams { agentDir?: string authType?: number | string // '1-password,2-key,3-no_auth', @@ -77,8 +88,15 @@ export interface InstalledStatusVO { } export enum Status { - Failed = 'FAILED', Installing = 'INSTALLING', Success = 'SUCCESS', + Failed = 'FAILED', Unknown = 'UNKNOW' } + +export enum BaseStatus { + 'INSTALLING', + 'SUCCESS', + 'FAILED', + 'UNKNOW' +} diff --git a/bigtop-manager-ui/src/api/job/index.ts b/bigtop-manager-ui/src/api/job/index.ts index c7aaa0520..ebfc4f35b 100644 --- a/bigtop-manager-ui/src/api/job/index.ts +++ b/bigtop-manager-ui/src/api/job/index.ts @@ -16,47 +16,57 @@ * specific language governing permissions and limitations * under the License. */ -import request from '@/api/request.ts' -import type { JobParams, JobList, TaskLogParams, TaskParams, JobVO, StageVO, TaskVO } from './types' +import type { + JobParams, + JobList, + TaskLogParams, + JobVO, + JobListParams, + TaskListParams, + StageListParams, + StageList, + TaskList, + LogsRes +} from './types' +import type { ListParams } from '../types' +import { get, post } from '../request-util' +import axios, { type AxiosProgressEvent, type CancelTokenSource } from 'axios' +import request from '../request' -export const retryJob = (pathParams: JobParams): Promise => { - return request({ - method: 'post', - url: `/clusters/${pathParams.clusterId}/jobs/${pathParams.jobId}/retry` - }) +export const retryJob = (pathParams: JobParams) => { + return post(`/clusters/${pathParams.clusterId}/jobs/${pathParams.jobId}/retry`) } -export const getJobList = (clusterId: number): Promise => { - return request({ - method: 'get', - url: `/clusters/${clusterId}/jobs` - }) +export const getJobDetails = (pathParams: JobParams) => { + return get(`/clusters/${pathParams.clusterId}/jobs/${pathParams.jobId}`) } -export const getJobDetails = (pathParams: JobParams): Promise => { - return request({ - method: 'get', - url: `/clusters/${pathParams.clusterId}/jobs/${pathParams.jobId}` - }) +export const getJobList = (pathParams: JobListParams, params: ListParams) => { + return get(`/clusters/${pathParams.clusterId}/jobs`, params) } -export const getStageList = (pathParams: JobParams): Promise => { - return request({ - method: 'get', - url: `/clusters/${pathParams.clusterId}/jobs/${pathParams.jobId}/stages` - }) +export const getStageList = (pathParams: StageListParams, params: ListParams) => { + return get(`/clusters/${pathParams.clusterId}/jobs/${pathParams.jobId}/stages`, params) } -export const getTaskList = (pathParams: TaskParams): Promise => { - return request({ - method: 'get', - url: `/clusters/${pathParams.clusterId}/jobs/${pathParams.jobId}/stages/${pathParams.stageId}/tasks` - }) +export const getTaskList = (pathParams: TaskListParams, params: ListParams) => { + return get( + `/clusters/${pathParams.clusterId}/jobs/${pathParams.jobId}/stages/${pathParams.stageId}/tasks`, + params + ) } -export const getTaskLog = (pathParams: TaskLogParams): Promise => { - return request({ +export const getTaskLog = (pathParams: TaskLogParams, func: Function): LogsRes => { + const source: CancelTokenSource = axios.CancelToken.source() + + const promise = request({ method: 'get', - url: `/clusters/${pathParams.clusterId}/jobs/${pathParams.jobId}/stages/${pathParams.stageId}/tasks/${pathParams.taskId}/log` + url: `/clusters/${pathParams.clusterId}/jobs/${pathParams.jobId}/stages/${pathParams.stageId}/tasks/${pathParams.taskId}/log`, + responseType: 'stream', + timeout: 0, + cancelToken: source.token, + onDownloadProgress: (progressEvent: AxiosProgressEvent) => func(progressEvent) }) + + return { promise, cancel: source.cancel } } diff --git a/bigtop-manager-ui/src/api/job/types.ts b/bigtop-manager-ui/src/api/job/types.ts index 86e545554..cbfd27647 100644 --- a/bigtop-manager-ui/src/api/job/types.ts +++ b/bigtop-manager-ui/src/api/job/types.ts @@ -18,22 +18,21 @@ */ import type { PageVO } from '@/api/types' +import { JobState } from '@/enums/state' export type JobList = PageVO export type StageList = PageVO +export type TaskList = PageVO + export type JobParams = { clusterId: number; jobId: number } export type TaskParams = JobParams & { stageId: number } export type TaskLogParams = TaskParams & { taskId: number } -export type StateType = keyof typeof State +export type StateType = keyof typeof JobState -export enum State { - 'Pending' = 'pending', - 'Processing' = 'processing', - 'Successful' = 'successful', - 'Failed' = 'failed', - 'Canceled' = 'canceled' -} +export type JobListParams = { clusterId: number } +export type StageListParams = JobParams +export type TaskListParams = TaskParams export interface JobVO { createTime?: string @@ -65,3 +64,8 @@ export interface TaskVO { updateTime?: string [property: string]: any } + +export interface LogsRes { + promise: Promise + cancel: () => void +} diff --git a/bigtop-manager-ui/src/api/request-util.ts b/bigtop-manager-ui/src/api/request-util.ts index 7a2da40e3..a2086b7b9 100644 --- a/bigtop-manager-ui/src/api/request-util.ts +++ b/bigtop-manager-ui/src/api/request-util.ts @@ -16,23 +16,22 @@ * specific language governing permissions and limitations * under the License. */ -import type { ResponseEntity } from './types' import request from './request' import { AxiosRequestConfig } from 'axios' -const get = (url: string, config?: AxiosRequestConfig): Promise> => { - return request.get(url, config) +const get = (url: string, params?: U, config?: AxiosRequestConfig): Promise => { + return request.get(url, { ...config, params }) } -const post = (url: string, data?: U, config?: AxiosRequestConfig): Promise> => { +const post = (url: string, data?: U, config?: AxiosRequestConfig): Promise => { return request.post(url, data, config) } -const put = (url: string, data: U, config?: AxiosRequestConfig): Promise> => { +const put = (url: string, data: U, config?: AxiosRequestConfig): Promise => { return request.put(url, data, config) } -const del = (url: string, config?: AxiosRequestConfig): Promise> => { +const del = (url: string, config?: AxiosRequestConfig): Promise => { return request.delete(url, config) } diff --git a/bigtop-manager-ui/src/api/service/index.ts b/bigtop-manager-ui/src/api/service/index.ts index 6642f0948..507061e7d 100644 --- a/bigtop-manager-ui/src/api/service/index.ts +++ b/bigtop-manager-ui/src/api/service/index.ts @@ -17,6 +17,7 @@ * under the License. */ +import type { ListParams } from '../types' import type { ServiceParams, ServiceVO, @@ -24,66 +25,43 @@ import type { ServiceConfigSnapshot, ServiceList, SnapshotData, - SnapshotRecovery + SnapshotRecovery, + ServiceListParams } from './types' -import request from '@/api/request.ts' +import { get, post, del } from '@/api/request-util' -export const getServiceList = (clusterId: number): Promise => { - return request({ - method: 'get', - url: `/clusters/${clusterId}/services` - }) +export const getServiceList = (clusterId: number, params?: ListParams & ServiceListParams) => { + return get(`/clusters/${clusterId}/services`, params) } -export const getService = (params: ServiceParams): Promise => { - return request({ - method: 'get', - url: `/clusters/${params.clusterId}/services/${params.id}` - }) +export const getService = (pathParams: ServiceParams) => { + return get(`/clusters/${pathParams.clusterId}/services/${pathParams.id}`) } -export const getServiceConfigs = (params: ServiceParams): Promise => { - return request({ - method: 'get', - url: `/clusters/${params.clusterId}/services/${params.id}/configs` - }) +export const getServiceConfigs = (pathParams: ServiceParams) => { + return get(`/clusters/${pathParams.clusterId}/services/${pathParams.id}/configs`) } -export const updateServiceConfigs = (params: ServiceParams, data: ServiceConfig): Promise => { - return request({ - method: 'post', - url: `/clusters/${params.clusterId}/services/${params.id}/configs`, - data - }) +export const updateServiceConfigs = (pathParams: ServiceParams, data: ServiceConfig) => { + return post(`/clusters/${pathParams.clusterId}/services/${pathParams.id}/configs`, data) } -export const getServiceConfigSnapshotsList = (params: ServiceParams): Promise => { - return request({ - method: 'get', - url: `/clusters/${params.clusterId}/services/${params.id}/config-snapshots` - }) +export const getServiceConfigSnapshotsList = (pathParams: ServiceParams) => { + return get(`/clusters/${pathParams.clusterId}/services/${pathParams.id}/config-snapshots`) } -export const takeServiceConfigSnapshot = ( - params: ServiceParams, - data: SnapshotData -): Promise => { - return request({ - method: 'post', - url: `/clusters/${params.clusterId}/services/${params.id}/config-snapshots`, +export const takeServiceConfigSnapshot = (pathParams: ServiceParams, data: SnapshotData) => { + return post( + `/clusters/${pathParams.clusterId}/services/${pathParams.id}/config-snapshots`, data - }) + ) } -export const recoveryServiceConfigSnapshot = (params: SnapshotRecovery): Promise => { - return request({ - method: 'post', - url: `/clusters/${params.clusterId}/services/${params.id}/config-snapshots/${params.snapshotId}` - }) +export const recoveryServiceConfigSnapshot = (pathParams: SnapshotRecovery): Promise => { + return post( + `/clusters/${pathParams.clusterId}/services/${pathParams.id}/config-snapshots/${pathParams.snapshotId}` + ) } -export const deleteServiceConfigSnapshot = (params: SnapshotRecovery): Promise => { - return request({ - method: 'delete', - url: `/clusters/${params.clusterId}/services/${params.id}/config-snapshots/${params.snapshotId}` - }) +export const deleteServiceConfigSnapshot = (pathParams: SnapshotRecovery): Promise => { + return del(`/clusters/${pathParams.clusterId}/services/${pathParams.id}/config-snapshots/${pathParams.snapshotId}`) } diff --git a/bigtop-manager-ui/src/api/service/types.ts b/bigtop-manager-ui/src/api/service/types.ts index 2afefea75..9ecd25a8e 100644 --- a/bigtop-manager-ui/src/api/service/types.ts +++ b/bigtop-manager-ui/src/api/service/types.ts @@ -24,6 +24,12 @@ export type ServiceList = PageVO export type ServiceParams = { clusterId: number; id: number } export type SnapshotData = { desc?: string; name?: string } export type SnapshotRecovery = ServiceParams & { snapshotId: string } +export type ServiceStatusType = 1 | 2 | 3 +export type ServiceListParams = { + name?: string + restartFlag?: boolean + status?: ServiceStatusType +} export interface ServiceVO { components?: ComponentVO[] @@ -35,7 +41,7 @@ export interface ServiceVO { requiredServices?: string[] restartFlag?: boolean stack?: string - status?: number + status: ServiceStatusType user?: string version?: string } diff --git a/bigtop-manager-ui/src/api/types.ts b/bigtop-manager-ui/src/api/types.ts index 007cbb3ac..91d65f124 100644 --- a/bigtop-manager-ui/src/api/types.ts +++ b/bigtop-manager-ui/src/api/types.ts @@ -27,3 +27,10 @@ export interface PageVO { total: number content: T[] } + +export interface ListParams { + orderBy?: string + pageNum?: number + pageSize?: number + sort?: string +} diff --git a/bigtop-manager-ui/src/api/user/types.ts b/bigtop-manager-ui/src/api/user/types.ts index 9692e5cf4..5ce2bcdce 100644 --- a/bigtop-manager-ui/src/api/user/types.ts +++ b/bigtop-manager-ui/src/api/user/types.ts @@ -16,7 +16,6 @@ * specific language governing permissions and limitations * under the License. */ - export interface UserVO { id: number username: string diff --git a/bigtop-manager-ui/src/assets/images/svg/bottom-activated.svg b/bigtop-manager-ui/src/assets/images/svg/bottom-activated.svg new file mode 100644 index 000000000..46a1a50d8 --- /dev/null +++ b/bigtop-manager-ui/src/assets/images/svg/bottom-activated.svg @@ -0,0 +1,25 @@ + + + + + + \ No newline at end of file diff --git a/bigtop-manager-ui/src/assets/images/svg/copy.svg b/bigtop-manager-ui/src/assets/images/svg/copy.svg new file mode 100644 index 000000000..bee762616 --- /dev/null +++ b/bigtop-manager-ui/src/assets/images/svg/copy.svg @@ -0,0 +1,29 @@ + + + + + + + + \ No newline at end of file diff --git a/bigtop-manager-ui/src/assets/images/svg/download.svg b/bigtop-manager-ui/src/assets/images/svg/download.svg new file mode 100644 index 000000000..eff45651b --- /dev/null +++ b/bigtop-manager-ui/src/assets/images/svg/download.svg @@ -0,0 +1,31 @@ + + + + + + + + + + \ No newline at end of file diff --git a/bigtop-manager-ui/src/components/common/button-group/index.vue b/bigtop-manager-ui/src/components/common/button-group/index.vue index 75b3f5813..b2dd417fe 100644 --- a/bigtop-manager-ui/src/components/common/button-group/index.vue +++ b/bigtop-manager-ui/src/components/common/button-group/index.vue @@ -68,7 +68,7 @@