(improvement)(Headless) Metric Market only displays published metrics (#867)

* (improvement)(Headless) Remove Query controller

* (improvement)(Headless) Filter metrics and dimensions based on whether they were created as tags

* (improvement)(Headless) Metric Market only displays published metrics

---------

Co-authored-by: jolunoluo
This commit is contained in:
LXW
2024-03-28 18:39:26 +08:00
committed by GitHub
parent 9a4c8fec55
commit 8cdd0b001a
32 changed files with 286 additions and 312 deletions

View File

@@ -57,11 +57,6 @@ import com.tencent.supersonic.headless.server.service.MetricService;
import com.tencent.supersonic.headless.server.service.ModelRelaService;
import com.tencent.supersonic.headless.server.service.ModelService;
import com.tencent.supersonic.headless.server.service.TagMetaService;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import com.tencent.supersonic.headless.server.service.TagObjectService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
@@ -69,6 +64,11 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.jdbc.DataSourceProperties;
import org.springframework.stereotype.Component;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
@Component
@Slf4j
public class ModelDemoDataLoader {
@@ -121,6 +121,7 @@ public class ModelDemoDataLoader {
addDataSet_2();
addAuthGroup_1();
addAuthGroup_2();
batchPushlishMetric();
} catch (Exception e) {
log.error("Failed to add model demo data", e);
}
@@ -585,6 +586,11 @@ public class ModelDemoDataLoader {
authService.addOrUpdateAuthGroup(authGroupReq);
}
private void batchPushlishMetric() {
List<Long> ids = Lists.newArrayList(1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L);
metricService.batchPublish(ids, User.getFakeUser());
}
private RelateDimension getRelateDimension(List<Long> dimensionIds) {
RelateDimension relateDimension = new RelateDimension();
for (Long id : dimensionIds) {

View File

@@ -288,4 +288,6 @@ CREATE TABLE IF NOT EXISTS `s2_query_rule` (
COMMENT ON TABLE s2_query_rule IS 'tag query rule table';
--20240325
alter table s2_metric change tags classifications varchar(500) null;
alter table s2_metric change tags classifications varchar(500) null;
alter table s2_metric add column `is_publish` int(10) DEFAULT NULL COMMENT '是否发布';
update s2_metric set is_publish = 1;

View File

@@ -170,9 +170,9 @@ create table IF NOT EXISTS s2_auth_groups
);
CREATE TABLE IF NOT EXISTS `s2_metric` (
`id` INT NOT NULL AUTO_INCREMENT,
`model_id` INT NOT NULL ,
`name` varchar(255) NOT NULL ,
`id` INT NOT NULL AUTO_INCREMENT,
`model_id` INT NOT NULL ,
`name` varchar(255) NOT NULL ,
`biz_name` varchar(255) NOT NULL ,
`description` varchar(500) DEFAULT NULL ,
`status` INT NOT NULL ,
@@ -190,6 +190,7 @@ CREATE TABLE IF NOT EXISTS `s2_metric` (
`relate_dimensions` varchar(500) DEFAULT NULL,
`ext` LONGVARCHAR DEFAULT NULL ,
`define_type` varchar(50) NOT NULL, -- MEASURE, FIELD, METRIC
`is_publish` INT,
PRIMARY KEY (`id`)
);
COMMENT ON TABLE s2_metric IS 'metric information table';

View File

@@ -295,6 +295,7 @@ CREATE TABLE `s2_metric`
`relate_dimensions` varchar(500) DEFAULT NULL COMMENT '指标相关维度',
`ext` text DEFAULT NULL,
`define_type` varchar(50) DEFAULT NULL, -- MEASURE, FIELD, METRIC
`is_publish` int(10) DEFAULT NULL COMMENT '是否发布',
PRIMARY KEY (`id`)
) ENGINE = InnoDB
DEFAULT CHARSET = utf8 COMMENT ='指标表';