perf(X-Pack): 阈值告警

This commit is contained in:
fit2cloud-chenyw 2024-08-13 18:18:17 +08:00
parent dd1eb07be2
commit 8c2525ce6a
10 changed files with 75 additions and 6 deletions

View File

@ -1,5 +1,6 @@
package io.dataease.chart.dao.ext.mapper; package io.dataease.chart.dao.ext.mapper;
import io.dataease.api.chart.vo.ChartBaseVO;
import io.dataease.api.chart.vo.ViewSelectorVO; import io.dataease.api.chart.vo.ViewSelectorVO;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
@ -14,4 +15,19 @@ public interface ExtChartViewMapper {
select id, scene_id as pid, title, type from core_chart_view where type != 'VQuery' and scene_id = #{resourceId} select id, scene_id as pid, title, type from core_chart_view where type != 'VQuery' and scene_id = #{resourceId}
""") """)
List<ViewSelectorVO> queryViewOption(@Param("resourceId") Long resourceId); List<ViewSelectorVO> queryViewOption(@Param("resourceId") Long resourceId);
@Select("""
select
ccv.id as chart_id,
ccv.title as chart_name,
ccv.type as chart_type,
ccv.table_id,
dvi.id as resource_id,
dvi.name as resource_name,
dvi.type as resource_type
from core_chart_view ccv
left join data_visualization_info dvi on dvi.id = ccv.scene_id
where ccv.id = #{id}
""")
ChartBaseVO queryChart(@Param("id") Long id);
} }

View File

@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectMapper;
import io.dataease.api.chart.vo.ChartBaseVO;
import io.dataease.api.chart.vo.ViewSelectorVO; import io.dataease.api.chart.vo.ViewSelectorVO;
import io.dataease.chart.dao.auto.entity.CoreChartView; import io.dataease.chart.dao.auto.entity.CoreChartView;
import io.dataease.chart.dao.auto.mapper.CoreChartViewMapper; import io.dataease.chart.dao.auto.mapper.CoreChartViewMapper;
@ -244,6 +245,10 @@ public class ChartViewManege {
coreDatasetTableFieldMapper.delete(queryWrapper); coreDatasetTableFieldMapper.delete(queryWrapper);
} }
public ChartBaseVO chartBaseInfo(Long id) {
return extChartViewMapper.queryChart(id);
}
public DatasetTableFieldDTO createCountField(Long id) { public DatasetTableFieldDTO createCountField(Long id) {
DatasetTableFieldDTO dto = new DatasetTableFieldDTO(); DatasetTableFieldDTO dto = new DatasetTableFieldDTO();
dto.setId(-1L); dto.setId(-1L);

View File

@ -1,6 +1,7 @@
package io.dataease.chart.server; package io.dataease.chart.server;
import io.dataease.api.chart.ChartViewApi; import io.dataease.api.chart.ChartViewApi;
import io.dataease.api.chart.vo.ChartBaseVO;
import io.dataease.extensions.view.dto.ChartViewDTO; import io.dataease.extensions.view.dto.ChartViewDTO;
import io.dataease.extensions.view.dto.ChartViewFieldDTO; import io.dataease.extensions.view.dto.ChartViewFieldDTO;
import io.dataease.api.chart.vo.ViewSelectorVO; import io.dataease.api.chart.vo.ViewSelectorVO;
@ -72,4 +73,9 @@ public class ChartViewServer implements ChartViewApi {
public void deleteFieldByChart(Long chartId) { public void deleteFieldByChart(Long chartId) {
chartViewManege.deleteFieldByChartId(chartId); chartViewManege.deleteFieldByChartId(chartId);
} }
@Override
public ChartBaseVO chartBaseInfo(Long id) {
return chartViewManege.chartBaseInfo(id);
}
} }

View File

@ -9,6 +9,7 @@ import _403 from '@/assets/svg/403.svg'
import APIDs from '@/assets/svg/API-ds.svg' import APIDs from '@/assets/svg/API-ds.svg'
import Apache_Hive from '@/assets/svg/Apache Hive.svg' import Apache_Hive from '@/assets/svg/Apache Hive.svg'
import Checkbox from '@/assets/svg/Checkbox.svg' import Checkbox from '@/assets/svg/Checkbox.svg'
import clock from '@/assets/svg/clock.svg'
import DM from '@/assets/svg/DM.svg' import DM from '@/assets/svg/DM.svg'
import DataEase from '@/assets/svg/DataEase.svg' import DataEase from '@/assets/svg/DataEase.svg'
import Elasticsearch from '@/assets/svg/Elasticsearch.svg' import Elasticsearch from '@/assets/svg/Elasticsearch.svg'
@ -1340,7 +1341,8 @@ const iconMap = {
'word-cloud': wordCloud, 'word-cloud': wordCloud,
calculate, calculate,
'icon_file-doc_colorful': icon_file_doc_colorful, 'icon_file-doc_colorful': icon_file_doc_colorful,
icon_font icon_font,
clock
} }
const props = defineProps({ const props = defineProps({

View File

@ -143,7 +143,7 @@
</el-dropdown-item> </el-dropdown-item>
</template> </template>
<xpack-component <xpack-component
:chart-id="element.id" :chart="element"
jsname="L2NvbXBvbmVudC90aHJlc2hvbGQtd2FybmluZy9FZGl0QmFySGFuZGxlcg==" jsname="L2NvbXBvbmVudC90aHJlc2hvbGQtd2FybmluZy9FZGl0QmFySGFuZGxlcg=="
/> />
<el-dropdown-item divided @click="deleteComponent" v-if="barShowCheck('delete')" <el-dropdown-item divided @click="deleteComponent" v-if="barShowCheck('delete')"

View File

@ -1,6 +1,7 @@
package io.dataease.api.chart; package io.dataease.api.chart;
import com.github.xiaoymin.knife4j.annotations.ApiSupport; import com.github.xiaoymin.knife4j.annotations.ApiSupport;
import io.dataease.api.chart.vo.ChartBaseVO;
import io.dataease.api.chart.vo.ViewSelectorVO; import io.dataease.api.chart.vo.ViewSelectorVO;
import io.dataease.extensions.view.dto.ChartViewDTO; import io.dataease.extensions.view.dto.ChartViewDTO;
import io.dataease.extensions.view.dto.ChartViewFieldDTO; import io.dataease.extensions.view.dto.ChartViewFieldDTO;
@ -55,4 +56,7 @@ public interface ChartViewApi {
@Operation(summary = "清空当前视图计算字段") @Operation(summary = "清空当前视图计算字段")
@PostMapping("deleteFieldByChart/{chartId}") @PostMapping("deleteFieldByChart/{chartId}")
void deleteFieldByChart(@PathVariable Long chartId); void deleteFieldByChart(@PathVariable Long chartId);
@GetMapping("/chartBaseInfo/{id}")
ChartBaseVO chartBaseInfo(@PathVariable("id") Long id);
} }

View File

@ -0,0 +1,31 @@
package io.dataease.api.chart.vo;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import lombok.Data;
import java.io.Serial;
import java.io.Serializable;
@Data
public class ChartBaseVO implements Serializable {
@Serial
private static final long serialVersionUID = -2445689467486374464L;
@JsonSerialize(using = ToStringSerializer.class)
private Long chartId;
private String chartType;
private String chartName;
@JsonSerialize(using = ToStringSerializer.class)
private Long resourceId;
private String resourceType;
private String resourceName;
@JsonSerialize(using = ToStringSerializer.class)
private Long tableId;
}

View File

@ -14,6 +14,7 @@ import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Parameters; import io.swagger.v3.oas.annotations.Parameters;
import io.swagger.v3.oas.annotations.enums.ParameterIn; import io.swagger.v3.oas.annotations.enums.ParameterIn;
import io.swagger.v3.oas.annotations.tags.Tag; import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
@ -41,6 +42,10 @@ public interface ThresholdApi {
@PostMapping("/pager/{goPage}/{pageSize}") @PostMapping("/pager/{goPage}/{pageSize}")
IPage<ThresholdGridVO> pager(@PathVariable("goPage") int goPage, @PathVariable("pageSize") int pageSize, @RequestBody ThresholdGridRequest request); IPage<ThresholdGridVO> pager(@PathVariable("goPage") int goPage, @PathVariable("pageSize") int pageSize, @RequestBody ThresholdGridRequest request);
@Operation(summary = "查询表单")
@GetMapping("/formInfo/{id}")
ThresholdCreator formInfo(@PathVariable("id") Long id);
@Operation(summary = "切换可用") @Operation(summary = "切换可用")
@PostMapping("/switch") @PostMapping("/switch")
void switchEnable(@RequestBody ThresholdSwitchRequest request); void switchEnable(@RequestBody ThresholdSwitchRequest request);

View File

@ -20,9 +20,7 @@ public class ThresholdCreator extends BaseReciDTO implements Serializable {
private Integer rateType = 1; private Integer rateType = 1;
private Integer rateValue = 1; private String rateValue;
private Long rateTime;
private Long resourceId; private Long resourceId;
@ -40,5 +38,5 @@ public class ThresholdCreator extends BaseReciDTO implements Serializable {
private String msgContent; private String msgContent;
private Boolean repeat = true; private Boolean repeatSend = true;
} }

View File

@ -21,4 +21,6 @@ public class ThresholdGridRequest implements Serializable {
private List<Long> timeList; private List<Long> timeList;
private Long chartId;
} }