forked from github/dataease
feat: 社区版资源同步到企业版
This commit is contained in:
parent
207abf0f6e
commit
846aebaf6d
@ -3,3 +3,7 @@ import request from '@/config/axios'
|
||||
export const validateApi = data => request.post({ url: '/license/validate', data })
|
||||
export const buildVersionApi = () => request.get({ url: '/license/version' })
|
||||
export const updateInfoApi = data => request.post({ url: '/license/update', data })
|
||||
|
||||
export const checkFreeApi = () => request.get({ url: '/rmonitor/existFree' })
|
||||
export const syncFreeApi = () => request.post({ url: '/rmonitor/sync' })
|
||||
export const delFreeApi = () => request.post({ url: '/rmonitor/delete' })
|
||||
|
@ -1,10 +1,17 @@
|
||||
<script lang="ts" setup>
|
||||
import aboutBg from '@/assets/img/about-bg.png'
|
||||
import { ref, reactive, onMounted } from 'vue'
|
||||
import { ref, reactive, onMounted, h } from 'vue'
|
||||
import { useUserStoreWithOut } from '@/store/modules/user'
|
||||
import { F2CLicense } from './index'
|
||||
import { validateApi, buildVersionApi, updateInfoApi } from '@/api/about'
|
||||
import { ElMessage } from 'element-plus-secondary'
|
||||
import {
|
||||
validateApi,
|
||||
buildVersionApi,
|
||||
updateInfoApi,
|
||||
checkFreeApi,
|
||||
syncFreeApi,
|
||||
delFreeApi
|
||||
} from '@/api/about'
|
||||
import { ElMessage, ElMessageBox } from 'element-plus-secondary'
|
||||
import { useI18n } from '@/hooks/web/useI18n'
|
||||
import { useEmitt } from '@/hooks/web/useEmitt'
|
||||
const dialogVisible = ref(false)
|
||||
@ -113,11 +120,54 @@ const update = (licKey: string) => {
|
||||
ElMessage.success(t('about.update_success'))
|
||||
const info = getLicense(response.data)
|
||||
setLicense(info)
|
||||
checkFree()
|
||||
} else {
|
||||
ElMessage.warning(response.data.message)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
const checkFree = () => {
|
||||
checkFreeApi().then(res => {
|
||||
if (res.data) {
|
||||
// do something
|
||||
const title = '存在未同步的资源数据,请谨慎操作!'
|
||||
const childrenDomList = [h('strong', null, title)]
|
||||
ElMessageBox.confirm('', {
|
||||
confirmButtonType: 'primary',
|
||||
type: 'warning',
|
||||
autofocus: false,
|
||||
dangerouslyUseHTMLString: true,
|
||||
message: h('div', { class: 'free-sync-tip-box' }, childrenDomList),
|
||||
showClose: false,
|
||||
cancelButtonText: '删除',
|
||||
confirmButtonText: '同步'
|
||||
})
|
||||
.then(() => {
|
||||
syncFree()
|
||||
})
|
||||
.catch(() => {
|
||||
delFree()
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
const delFree = () => {
|
||||
delFreeApi().then(res => {
|
||||
if (!res.code && !res.msg) {
|
||||
ElMessage.success(t('common.delete_success'))
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
const syncFree = () => {
|
||||
syncFreeApi().then(res => {
|
||||
if (!res.code && !res.msg) {
|
||||
ElMessage.success('同步成功')
|
||||
}
|
||||
})
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
2
de-xpack
2
de-xpack
@ -1 +1 @@
|
||||
Subproject commit c941619c1cb929453b6a8bf4517e3f0036232128
|
||||
Subproject commit e71e6152874ed49933d3befeee6ea2c9310a94f4
|
@ -0,0 +1,16 @@
|
||||
package io.dataease.api.rmonitor;
|
||||
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
|
||||
public interface ResourceMonitorApi {
|
||||
|
||||
@GetMapping("/existFree")
|
||||
boolean existFree();
|
||||
|
||||
@PostMapping("/delete")
|
||||
void delete();
|
||||
|
||||
@PostMapping("/sync")
|
||||
void sync();
|
||||
}
|
@ -75,4 +75,6 @@ public interface InteractiveAuthApi {
|
||||
@GetMapping("/query2Root/{id}/{flag}")
|
||||
List<ResourceNodeVO> query2Root(@PathVariable("id") Long id, @PathVariable("flag") Integer flag);
|
||||
|
||||
@GetMapping("/checkEmpty")
|
||||
boolean checkEmpty();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user