Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
77 commits
Select commit Hold shift + click to select a range
8b17aaa
feat: Add components about host page
FU-design Mar 24, 2025
d7cb4b4
feat: Add components about host page
FU-design Mar 24, 2025
9ab642e
feat: Add components about host page
FU-design Mar 24, 2025
6eb36ec
feat: Add remove method for host list
FU-design Mar 24, 2025
4b2fcdb
feat: Improve host management page
FU-design Mar 24, 2025
2fd1439
feat: Improve host management page
FU-design Mar 24, 2025
e6b3151
feat: Add overview page for host
FU-design Mar 25, 2025
806261a
feat: Update overview page for host
FU-design Mar 25, 2025
93fcbd8
Merge remote-tracking branch 'origin/main' into bigtop-ui-test
FU-design Mar 25, 2025
5b6c0a8
feat: Add service page for cluster
FU-design Mar 25, 2025
74c7a60
feat: Remove file upload limit for add host
FU-design Mar 25, 2025
6f09aae
fix: bugfixed
FU-design Mar 26, 2025
8d0cf3c
Merge remote-tracking branch 'origin/main' into bigtop-ui-test
FU-design Mar 26, 2025
9e2d95f
Merge remote-tracking branch 'origin/bigtop-ui-test' into bigtop-ui-dev
FU-design Mar 26, 2025
b77aeae
feat: Update service-manage component
FU-design Mar 26, 2025
f0c6d41
feat: Update service-manage component
FU-design Mar 26, 2025
2aa03df
feat: Add snapshot page
FU-design Mar 27, 2025
24d9f93
feat: Update configs page of service management
FU-design Mar 28, 2025
4c93862
feat: Updata components page of service management
FU-design Mar 28, 2025
d68aad7
merge
FU-design Mar 28, 2025
773a7a2
feat: Replace action to operation
FU-design Mar 28, 2025
8b73022
bugfixed
FU-design Mar 28, 2025
d90c25a
feat: Rename service-manage to service-management
FU-design Mar 28, 2025
9f6fc46
feat: Add service detail for infra
FU-design Mar 28, 2025
7020b9f
feat: Disabled delete of component list
FU-design Mar 28, 2025
94dabb6
feat: Add job progress store
FU-design Mar 31, 2025
44d709e
feat: Add animation for processing svg
FU-design Apr 1, 2025
e6fb258
feat: Add job modal component for job progress store
FU-design Apr 2, 2025
bf31a91
feat: Extract dot loading style
FU-design Apr 3, 2025
59b632a
feat: Add command api for some operations
FU-design Apr 3, 2025
370c55b
feat: Add job progress floating window
FU-design Apr 7, 2025
056a24b
fixed test
FU-design Apr 7, 2025
4c49a91
resolve merge
FU-design Apr 7, 2025
8775c2e
bugfixed
FU-design Apr 7, 2025
1478f86
feat: Add job progress in detail of service
FU-design Apr 7, 2025
d24f767
bugfixed
FU-design Apr 7, 2025
933006a
feat: Rename StackrelationMap to StackRelationMap
FU-design Apr 7, 2025
330da05
feat: Add create component page for service
FU-design Apr 8, 2025
21e94ca
merge code
FU-design Apr 8, 2025
ab3e8ff
bugfixed
FU-design Apr 8, 2025
b2f74ac
bugfixed
FU-design Apr 9, 2025
788aa9d
feat: Add bigtop-manager doc url
FU-design Apr 9, 2025
5b76501
feat: Move service-management page to components
FU-design Apr 9, 2025
26e4bb7
merge code
FU-design Apr 9, 2025
2c4b22f
feat: Add license information in service-selector page
FU-design Apr 9, 2025
0ca4415
feat: Add license information in service-selector page
FU-design Apr 9, 2025
6c32bce
feat: Refactor infra page
FU-design Apr 9, 2025
99761d2
Add license tag for service in service-selector page
FU-design Apr 10, 2025
8ea14a8
Add license tag for service in service-selector page
FU-design Apr 10, 2025
6ca1e79
Merge remote-tracking branch 'origin/main' into bigtop-ui-dev
FU-design Apr 10, 2025
329a15d
bugfix
FU-design Apr 10, 2025
608132e
feat: Modify i18n of menu
FU-design Apr 10, 2025
07a6589
refactor menu store
FU-design Apr 11, 2025
3f6bacf
refactor menu store
FU-design Apr 14, 2025
a03fa24
merge code
FU-design Apr 14, 2025
151e4d1
Adjust the timing of getting component stack
FU-design Apr 14, 2025
b5b72e4
Adjust job progress fetch timing
FU-design Apr 14, 2025
8fed5fe
Merge remote-tracking branch 'origin/main' into bigtop-ui-dev
FU-design Apr 15, 2025
f65f474
merge code
FU-design Apr 28, 2025
97d99db
fix: Add dependency validation for pre-install service removal
FU-design Apr 28, 2025
3b03014
bug fix
FU-design May 6, 2025
1e5f330
bugfix
FU-design May 7, 2025
76a3bf4
refactor cluster store
FU-design May 13, 2025
8c93069
Merge branch 'bigtop-ui-dev' of https://github.com/FU-design/bigtop-m…
FU-design May 13, 2025
1cd7360
refactor service store
FU-design May 13, 2025
70addc8
bugfix
FU-design May 13, 2025
46d4160
refactor router params
FU-design May 14, 2025
ddda607
feat: implement cardinality check for component-to-host assignments
FU-design May 15, 2025
10ae212
feat: validate component cardinality on addition
FU-design May 16, 2025
1cf5e49
fix redirect bug in route guard when token is missing
FU-design May 21, 2025
e1d2ec8
refactor service-create store
FU-design May 21, 2025
a38c0c8
Merge remote-tracking branch 'origin/main' into bigtop-ui-dev_create-…
FU-design May 21, 2025
5e80654
rename service-create to create-service
FU-design May 22, 2025
3ca376b
remove log
FU-design May 22, 2025
d76e028
bugfix
FU-design May 29, 2025
a15fef4
bugfix
FU-design May 29, 2025
0c59009
Merge remote-tracking branch 'origin/bigtop-ui-dev_create-service' in…
FU-design May 29, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,16 @@
-->

<script setup lang="ts">
import { useI18n } from 'vue-i18n'
import { computed, onActivated, reactive, ref, shallowRef } from 'vue'
import { useI18n } from 'vue-i18n'
import { TableColumnType, Empty } from 'ant-design-vue'
import { HostVO } from '@/api/hosts/types'
import { getHosts } from '@/api/hosts'
import useCreateService from './use-create-service'
import { useCreateServiceStore } from '@/store/create-service'
import { useServiceStore } from '@/store/service'
import { storeToRefs } from 'pinia'
import useBaseTable from '@/composables/use-base-table'
import TreeSelector from './tree-selector.vue'
import type { HostVO } from '@/api/hosts/types'
import type { FilterConfirmProps, FilterResetProps, TableRowSelection } from 'ant-design-vue/es/table/interface'
import type { Key } from 'ant-design-vue/es/_util/type'

Expand All @@ -36,6 +38,10 @@
}

const { t } = useI18n()
const createStore = useCreateServiceStore()
const serviceStore = useServiceStore()
const { stepContext, selectedServices, allComps, allCompsMeta } = storeToRefs(createStore)

const searchInputRef = ref()
const currComp = ref<string>('')
const fieldNames = shallowRef({
Expand All @@ -48,15 +54,6 @@
searchedColumn: '',
selectedRowKeys: []
})
const {
clusterId,
installedStore,
allComps,
allCompsMeta,
creationModeType,
selectedServices,
updateHostsForComponent
} = useCreateService()

const serviceList = computed(() =>
selectedServices.value.map((v) => ({
Expand All @@ -67,7 +64,9 @@

const currCompInfo = computed(() => allComps.value.get(currComp.value.split('/')[1]))
const currCompInfoMeta = computed(() => allCompsMeta.value.get(currComp.value.split('/')[1]))
const installedServices = computed(() => installedStore.getInstalledNamesOrIdsOfServiceByKey(`${clusterId.value}`))
const installedServices = computed(() =>
serviceStore.getInstalledNamesOrIdsOfServiceByKey(`${stepContext.value.clusterId}`)
)
const hostsOfCurrComp = computed((): HostVO[] => {
const temp = currComp.value.split('/').at(-1)
return allComps.value.has(temp!) ? allComps.value.get(temp!)?.hosts ?? [] : []
Expand Down Expand Up @@ -115,7 +114,8 @@
return
}
try {
const res = await getHosts({ ...filtersParams.value, clusterId: clusterId.value })
const { clusterId } = stepContext.value
const res = await getHosts({ ...filtersParams.value, clusterId })
dataSource.value = res.content.map((v) => ({ ...v, name: v.id, displayName: v.hostname }))
paginationProps.value.total = res.total
loading.value = false
Expand All @@ -133,8 +133,9 @@
})

const validateHostIsCheck = (host: HostVO) => {
const { type } = stepContext.value
const notAdd = currCompInfoMeta.value?.hosts.findIndex((v) => v.hostname === host.hostname) == -1
if (creationModeType.value === 'component') {
if (type === 'component') {
return !currCompInfo.value?.uninstall && !notAdd
} else {
return installedServices.value.includes(currComp.value.split('/')[0]) && !notAdd
Expand All @@ -149,8 +150,21 @@
}

const onSelectChange: TableRowSelection['onChange'] = (selectedRowKeys, selectedRows) => {
allComps.value.has(currComp.value.split('/').at(-1)!) && updateHostsForComponent(currComp.value, selectedRows)
state.selectedRowKeys = selectedRowKeys
const { cardinality, displayName } = currCompInfo.value || {}
const newCount = selectedRowKeys.length
const compKey = currComp.value.split('/').at(-1)!
const isInAllComps = allComps.value.has(compKey)
const shouldValidate = !!cardinality
const isValid = !shouldValidate || createStore.validCardinality(cardinality, newCount, displayName || '')

const isDeselecting = newCount < state.selectedRowKeys.length

if (isValid || isDeselecting) {
state.selectedRowKeys = selectedRowKeys
if (isInAllComps) {
createStore.setComponentHosts(currComp.value, selectedRows)
}
}
}

const resetSelectedRowKeys = (key: string) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,12 @@

<script setup lang="ts">
import { computed, onActivated, onDeactivated, ref, shallowRef, watch } from 'vue'
import { storeToRefs } from 'pinia'
import { debounce } from 'lodash'
import { Empty } from 'ant-design-vue'
import TreeSelector from './tree-selector.vue'
import useCreateService from './use-create-service'
import { useCreateServiceStore } from '@/store/create-service'
import { useServiceStore } from '@/store/service'
import type { ServiceConfigReq } from '@/api/command/types'
import type { ComponentVO } from '@/api/component/types'
import type { Key } from 'ant-design-vue/es/_util/type'
Expand All @@ -36,7 +38,9 @@
isView: false
})

const { clusterId, installedStore, selectedServices } = useCreateService()
const createStore = useCreateServiceStore()
const serviceStore = useServiceStore()
const { stepContext, selectedServices } = storeToRefs(createStore)
const searchStr = ref('')
const currService = ref<Key>('')
const configs = ref<ServiceConfigReq[]>([])
Expand Down Expand Up @@ -65,15 +69,16 @@

const serviceList = computed(() => selectedServices.value)
const disabled = computed(() => {
return installedStore
.getInstalledNamesOrIdsOfServiceByKey(`${clusterId.value}`)
const clusterId = stepContext.value.clusterId
return serviceStore
.getInstalledNamesOrIdsOfServiceByKey(`${clusterId}`)
.includes(currService.value.toString().split('/').at(-1)!)
})

// const disabled = computed(() => {
// return creationModeType.value === 'component'
// ? false
// : installedStore
// : serviceStore
// .getInstalledNamesOrIdsOfServiceByKey(`${clusterId.value}`)
// .includes(currService.value.toString().split('/').at(-1)!)
// })
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@
<script setup lang="ts">
import { computed, onActivated, reactive, ref, shallowRef, toRefs } from 'vue'
import { usePngImage } from '@/utils/tools'
import useCreateService from './use-create-service'
import { useStackStore } from '@/store/stack'
import { useServiceStore } from '@/store/service'
import { useCreateServiceStore } from '@/store/create-service'
import { storeToRefs } from 'pinia'
import type { ExpandServiceVO } from '@/store/stack'
import type { ComponentVO } from '@/api/component/types.ts'
import type { ServiceVO } from '@/api/service/types'
Expand All @@ -30,28 +33,20 @@
selectedData: ExpandServiceVO[]
}

const stackStore = useStackStore()
const createStore = useCreateServiceStore()
const serviceStore = useServiceStore()
const searchStr = ref('')
const spinning = ref(false)
const licenseOfConflictService = shallowRef(['AGPL-3.0', 'GPLv2'])
const state = reactive<State>({
isAddableData: [],
selectedData: []
})
const {
clusterId,
routeParams,
selectedServices,
servicesOfInfra,
servicesOfExcludeInfra,
installedStore,
creationMode,
creationModeType,
confirmServiceDependencies,
setDataByCurrent
} = useCreateService()
const { stepContext, selectedServices, infraServices, excludeInfraServices } = storeToRefs(createStore)
const { isAddableData } = toRefs(state)
const checkSelectedServicesOnlyInstalled = computed(
() => selectedServices.value.filter((v: ExpandServiceVO) => !v.isInstalled).length === 0
)
const targetServiceName = computed(() => serviceStore.serviceFlatMap[stepContext.value.serviceId].name!)
const checkIfInstalled = computed(() => selectedServices.value.filter((v) => !v.isInstalled).length === 0)
const filterAddableData = computed(() =>
isAddableData.value.filter(
(v) =>
Expand Down Expand Up @@ -92,22 +87,22 @@
const handleInstallItem = (item: ExpandServiceVO, from: ExpandServiceVO[], to: ExpandServiceVO[]) => {
item.components = item.components?.map((v) => ({ ...v, hosts: [] }))
moveItem(from, to, item)
setDataByCurrent(state.selectedData)
createStore.updateSelectedService(state.selectedData)
}

const addInstallItem = async (item: ExpandServiceVO) => {
const items = await confirmServiceDependencies(item)
const modifyInstallItems = async (type: 'add' | 'remove', item: ExpandServiceVO) => {
const items = await createStore.confirmServiceDependencyAction(type, item)
if (items.length > 0) {
items.forEach((i) => {
handleInstallItem(i, state.isAddableData, state.selectedData)
if (type === 'add') {
handleInstallItem(i, state.isAddableData, state.selectedData)
} else {
handleInstallItem(i, state.selectedData, state.isAddableData)
}
})
}
}

const removeInstallItem = (item: ExpandServiceVO) => {
handleInstallItem(item, state.selectedData, state.isAddableData)
}

const splitSearchStr = (splitStr: string) => {
return splitStr.toString().split(new RegExp(`(?<=${searchStr.value})|(?=${searchStr.value})`, 'i'))
}
Expand All @@ -119,7 +114,8 @@
if (!acc[name!]) {
acc[name!] = {
...item,
hosts: [{ hostname, name: hostname, displayName: hostname }]
hosts: [{ hostname, name: hostname, displayName: hostname }],
cardinality: stackStore.stackRelationMap?.components[item.name!].cardinality
}
} else {
acc[name!].hosts.push({ hostname, name: hostname, displayName: hostname })
Expand All @@ -130,7 +126,8 @@
}

const initInstalledServicesDetail = async () => {
const detailRes = await installedStore.getInstalledServicesDetailByKey(`${clusterId.value}`)
const clusterId = stepContext.value.clusterId
const detailRes = await serviceStore.getInstalledServicesDetailByKey(`${clusterId}`)
const detailMap = new Map<string, ExpandServiceVO>()
if (!detailRes) {
return detailMap
Expand All @@ -146,60 +143,77 @@
}
}

const mergeInherentServiceAndInstalledService = (
const buildCompleteServiceInfo = (
installedServiceMap: Map<string, ExpandServiceVO>,
inherentServices: ServiceVO[]
) => {
const inherentService = inherentServices.filter((v) => v.name === routeParams.value.service)[0]
const installedService = { ...installedServiceMap.get(routeParams.value.service)! }
installedService.license = inherentService.license
const map = new Map(installedService.components!.map((item) => [item.name, item]))
inherentService.components!.forEach((item) => {
!map.has(item.name) && map.set(item.name, { ...item, hosts: [], uninstall: true })
})
installedService.components = [...map.values()]
return installedService
const inherent = inherentServices.find((v) => v.name === targetServiceName.value)!
const installed = { ...installedServiceMap.get(targetServiceName.value)! }
const mergedComponentsMap = new Map(
(installed.components ?? []).map((component) => [component.name, { ...component }])
)
for (const component of inherent.components ?? []) {
if (!mergedComponentsMap.has(component.name)) {
mergedComponentsMap.set(component.name, { ...component, hosts: [], uninstall: true })
}
}
installed.components = [...mergedComponentsMap.values()]
installed.license = inherent.license

return installed as ExpandServiceVO
}

const addInstalledSymbolForSelectedServices = async (onlyInstalled: boolean) => {
if (onlyInstalled) {
const installedServiceMap = await initInstalledServicesDetail()
const installedServiceNames = installedStore.getInstalledNamesOrIdsOfServiceByKey(`${clusterId.value}`)
const inherentServices = creationMode.value === 'internal' ? servicesOfExcludeInfra.value : servicesOfInfra.value
const markSelectedAsInstalled = async (hasInstalled: boolean) => {
const { type, creationMode, clusterId } = stepContext.value
if (!hasInstalled) {
state.selectedData = [...selectedServices.value]
return
}
const installedServiceMap = await initInstalledServicesDetail()
const installedServiceNames = serviceStore.getInstalledNamesOrIdsOfServiceByKey(`${clusterId}`)
const rawServices = creationMode === 'internal' ? excludeInfraServices.value : infraServices.value
// Clone to prevent mutation of original data
const inherentServices = rawServices.map((s) => ({ ...s }))

if (creationModeType.value === 'component' && installedServiceMap.has(routeParams.value.service)) {
state.selectedData[0] = mergeInherentServiceAndInstalledService(installedServiceMap, inherentServices)
state.selectedData[0].isInstalled = true
state.isAddableData = []
} else {
for (const service of inherentServices) {
if (installedServiceNames.includes(service.name || '')) {
Object.assign(service, installedServiceMap.get(service.name!))
if (type === 'component' && installedServiceMap.has(targetServiceName.value!)) {
const completeService = buildCompleteServiceInfo(installedServiceMap, inherentServices)
state.selectedData[0] = { ...completeService, isInstalled: true }
state.isAddableData = []
} else {
for (const service of inherentServices) {
const name = service.name || ''
if (installedServiceNames.includes(name)) {
const installed = installedServiceMap.get(name)
if (installed) {
Object.assign(service, installed)
service.isInstalled = true
state.selectedData.push(service as ExpandServiceVO)
} else {
state.isAddableData.push(service as ExpandServiceVO)
}
state.selectedData.push(service as ExpandServiceVO)
} else {
state.isAddableData.push(service as ExpandServiceVO)
}
}
setDataByCurrent(state.selectedData)
} else {
state.selectedData = [...selectedServices.value]
}

createStore.updateSelectedService(state.selectedData)
createStore.setTempData(state.selectedData)
}

onActivated(async () => {
await addInstalledSymbolForSelectedServices(checkSelectedServicesOnlyInstalled.value)
spinning.value = true
markSelectedAsInstalled(checkIfInstalled.value).finally(() => {
spinning.value = false
})
})

defineExpose({
addInstallItem
modifyInstallItems
})
</script>

<template>
<div class="service-selector">
<div>
<a-spin :spinning="spinning">
<div class="list-title">
<div>{{ $t('service.select_service') }}</div>
<a-input v-model:value="searchStr" :placeholder="$t('service.please_enter_search_keyword')" />
Expand All @@ -208,7 +222,7 @@
<template #renderItem="{ item }">
<a-list-item>
<template #actions>
<a-button type="primary" @click="addInstallItem(item)">{{ $t('common.add') }}</a-button>
<a-button type="primary" @click="modifyInstallItems('add', item)">{{ $t('common.add') }}</a-button>
</template>
<a-list-item-meta>
<template #title>
Expand Down Expand Up @@ -248,17 +262,17 @@
</a-list-item>
</template>
</a-list>
</div>
</a-spin>
<a-divider type="vertical" class="divider" />
<div>
<a-spin :spinning="spinning">
<div class="list-title">
<div>{{ $t('service.pending_installation_services') }}</div>
</div>
<a-list item-layout="horizontal" :data-source="state.selectedData">
<template #renderItem="{ item }">
<a-list-item>
<template #actions>
<a-button danger :disabled="item.isInstalled" type="primary" @click="removeInstallItem(item)">
<a-button danger :disabled="item.isInstalled" type="primary" @click="modifyInstallItems('remove', item)">
{{ $t('common.remove') }}
</a-button>
</template>
Expand Down Expand Up @@ -290,7 +304,7 @@
</a-list-item>
</template>
</a-list>
</div>
</a-spin>
</div>
</template>

Expand Down
Loading
Loading