Merge pull request #11683 from dataease/pr@dev-v2@perf_threshold

perf(X-Pack): 阈值告警跟随视图删除
This commit is contained in:
fit2cloud-chenyw 2024-08-22 12:41:43 +08:00 committed by GitHub
commit af9aca15ac
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 27 additions and 3 deletions

View File

@ -754,16 +754,22 @@ public class ChartDataManage {
public void saveChartViewFromVisualization(String checkData, Long sceneId, Map<Long, ChartViewDTO> chartViewsInfo) { public void saveChartViewFromVisualization(String checkData, Long sceneId, Map<Long, ChartViewDTO> chartViewsInfo) {
if (!MapUtils.isEmpty(chartViewsInfo)) { if (!MapUtils.isEmpty(chartViewsInfo)) {
List<Long> disuseChartIdList = new ArrayList<>();
chartViewsInfo.forEach((key, chartViewDTO) -> { chartViewsInfo.forEach((key, chartViewDTO) -> {
if (checkData.indexOf(chartViewDTO.getId() + "") > -1) { if (checkData.contains(chartViewDTO.getId() + "")) {
try { try {
chartViewDTO.setSceneId(sceneId); chartViewDTO.setSceneId(sceneId);
chartViewManege.save(chartViewDTO); chartViewManege.save(chartViewDTO);
} catch (Exception e) { } catch (Exception e) {
DEException.throwException(e); DEException.throwException(e);
} }
} else {
disuseChartIdList.add(chartViewDTO.getId());
} }
}); });
if (CollectionUtils.isNotEmpty(disuseChartIdList)) {
chartViewManege.disuse(disuseChartIdList);
}
} }
} }
} }

View File

@ -26,6 +26,7 @@ import io.dataease.extensions.datasource.model.SQLObj;
import io.dataease.extensions.view.dto.*; import io.dataease.extensions.view.dto.*;
import io.dataease.extensions.view.filter.FilterTreeObj; import io.dataease.extensions.view.filter.FilterTreeObj;
import io.dataease.i18n.Translator; import io.dataease.i18n.Translator;
import io.dataease.license.config.XpackInteract;
import io.dataease.utils.BeanUtils; import io.dataease.utils.BeanUtils;
import io.dataease.utils.IDUtils; import io.dataease.utils.IDUtils;
import io.dataease.utils.JsonUtil; import io.dataease.utils.JsonUtil;
@ -98,6 +99,9 @@ public class ChartViewManege {
coreChartViewMapper.deleteById(id); coreChartViewMapper.deleteById(id);
} }
@XpackInteract(value = "chartViewManage")
public void disuse(List<Long> chartIdList) {}
@Transactional @Transactional
public void deleteBySceneId(Long sceneId, List<Long> chartIds) { public void deleteBySceneId(Long sceneId, List<Long> chartIds) {
QueryWrapper<CoreChartView> wrapper = new QueryWrapper<>(); QueryWrapper<CoreChartView> wrapper = new QueryWrapper<>();

View File

@ -2788,6 +2788,8 @@ export default {
name: '告警名称', name: '告警名称',
grid_title: '告警管理', grid_title: '告警管理',
grid: '告警列表', grid: '告警列表',
record: '告警记录' record: '告警记录',
module_name: '阈值告警',
setting: '阈值告警设置'
} }
} }

View File

@ -20,6 +20,7 @@ import { storeToRefs } from 'pinia'
import { BASE_VIEW_CONFIG } from '../util/chart' import { BASE_VIEW_CONFIG } from '../util/chart'
import { cloneDeep, defaultsDeep } from 'lodash-es' import { cloneDeep, defaultsDeep } from 'lodash-es'
import BubbleAnimateCfg from '@/views/chart/components/editor/editor-senior/components/BubbleAnimateCfg.vue' import BubbleAnimateCfg from '@/views/chart/components/editor/editor-senior/components/BubbleAnimateCfg.vue'
import { XpackComponent } from '@/components/plugin'
const dvMainStore = dvMainStoreWithOut() const dvMainStore = dvMainStoreWithOut()
const { nowPanelTrackInfo, nowPanelJumpInfo, dvInfo, componentData } = storeToRefs(dvMainStore) const { nowPanelTrackInfo, nowPanelJumpInfo, dvInfo, componentData } = storeToRefs(dvMainStore)
@ -282,6 +283,13 @@ const isDataEaseBi = computed(() => appStore.getIsDataEaseBi)
/> />
</collapse-switch-item> </collapse-switch-item>
<xpack-component
v-if="chart.id"
:chart="chart"
:themes="themes"
jsname="L2NvbXBvbmVudC90aHJlc2hvbGQtd2FybmluZy9TZW5pb3JIYW5kbGVy"
/>
<collapse-switch-item <collapse-switch-item
v-if="showProperties('linkage')" v-if="showProperties('linkage')"
:themes="themes" :themes="themes"

@ -1 +1 @@
Subproject commit 43b6ff1f0d11c1920e79ce082f35182a73fa17c2 Subproject commit 902de4d87eb7e93ab0e3fc6263f4007fb888e9fb

View File

@ -66,4 +66,8 @@ public interface ThresholdApi {
@Operation(summary = "预览信息") @Operation(summary = "预览信息")
@PostMapping("/preview") @PostMapping("/preview")
String preview(@RequestBody ThresholdPreviewRequest request); String preview(@RequestBody ThresholdPreviewRequest request);
@Operation(summary = "视图是否设置了阈值告警")
@GetMapping("/anyThreshold/{chartId}")
boolean anyThreshold(@PathVariable("chartId") Long chartId);
} }