mirror of
https://github.com/tencentmusic/supersonic.git
synced 2026-04-19 13:04:21 +08:00
Compare commits
12 Commits
36b2b4c4db
...
8ce7fc7dd6
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8ce7fc7dd6 | ||
|
|
0c8c2d4804 | ||
|
|
f05a4b523c | ||
|
|
b7369abcca | ||
|
|
b40cb13740 | ||
|
|
6f8cf9853b | ||
|
|
75906037ac | ||
|
|
b58e041e8d | ||
|
|
93d585c0d5 | ||
|
|
0dbf56d357 | ||
|
|
668f872743 | ||
|
|
acb9cef64e |
5
assembly/bin/supersonic-docker-compose.sh
Normal file
5
assembly/bin/supersonic-docker-compose.sh
Normal file
@@ -0,0 +1,5 @@
|
||||
#!/usr/bin/env sh
|
||||
|
||||
export SUPERSONIC_VERSION=latest
|
||||
|
||||
docker-compose -f docker-compose.yml -p supersonic up
|
||||
23
assembly/bin/supersonic-docker-run.sh
Normal file
23
assembly/bin/supersonic-docker-run.sh
Normal file
@@ -0,0 +1,23 @@
|
||||
#!/usr/bin/env sh
|
||||
|
||||
export SUPERSONIC_VERSION=latest
|
||||
|
||||
#### Set below DB configs to connect to your own database
|
||||
# Supported DB_TYPE: h2, mysql, postgres
|
||||
export S2_DB_TYPE=h2
|
||||
export S2_DB_HOST=
|
||||
export S2_DB_PORT=
|
||||
export S2_DB_USER=
|
||||
export S2_DB_PASSWORD=
|
||||
export S2_DB_DATABASE=
|
||||
|
||||
docker run --rm -it -d \
|
||||
--name supersonic_standalone \
|
||||
-p 9080:9080 \
|
||||
-e S2_DB_TYPE=${S2_DB_TYPE} \
|
||||
-e S2_DB_HOST=${S2_DB_HOST} \
|
||||
-e S2_DB_PORT=${S2_DB_PORT} \
|
||||
-e S2_DB_USER=${S2_DB_USER} \
|
||||
-e S2_DB_PASSWORD=${S2_DB_PASSWORD} \
|
||||
-e S2_DB_DATABASE=${S2_DB_DATABASE} \
|
||||
supersonicbi/supersonic:${SUPERSONIC_VERSION}
|
||||
@@ -1,10 +1,11 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
#### Set below DB configs to connect to your own database
|
||||
# Comment out below exports to config your DB connection
|
||||
# Supported DB_TYPE: h2, mysql, postgres
|
||||
export S2_DB_TYPE=h2
|
||||
export S2_DB_HOST=
|
||||
export S2_DB_PORT=
|
||||
export S2_DB_USER=
|
||||
export S2_DB_PASSWORD=
|
||||
export S2_DB_DATABASE=
|
||||
#export S2_DB_TYPE=h2
|
||||
#export S2_DB_HOST=
|
||||
#export S2_DB_PORT=
|
||||
#export S2_DB_USER=
|
||||
#export S2_DB_PASSWORD=
|
||||
#export S2_DB_DATABASE=
|
||||
@@ -5,5 +5,7 @@ import com.tencent.supersonic.chat.server.pojo.ExecuteContext;
|
||||
|
||||
public interface ChatQueryExecutor {
|
||||
|
||||
boolean accept(ExecuteContext executeContext);
|
||||
|
||||
QueryResult execute(ExecuteContext executeContext);
|
||||
}
|
||||
|
||||
@@ -37,11 +37,12 @@ public class PlainTextExecutor implements ChatQueryExecutor {
|
||||
}
|
||||
|
||||
@Override
|
||||
public QueryResult execute(ExecuteContext executeContext) {
|
||||
if (!"PLAIN_TEXT".equals(executeContext.getParseInfo().getQueryMode())) {
|
||||
return null;
|
||||
}
|
||||
public boolean accept(ExecuteContext executeContext) {
|
||||
return "PLAIN_TEXT".equals(executeContext.getParseInfo().getQueryMode());
|
||||
}
|
||||
|
||||
@Override
|
||||
public QueryResult execute(ExecuteContext executeContext) {
|
||||
AgentService agentService = ContextUtils.getBean(AgentService.class);
|
||||
Agent chatAgent = agentService.getAgent(executeContext.getAgent().getId());
|
||||
ChatApp chatApp = chatAgent.getChatAppConfig().get(APP_KEY);
|
||||
|
||||
@@ -8,6 +8,11 @@ import com.tencent.supersonic.headless.api.pojo.SemanticParseInfo;
|
||||
|
||||
public class PluginExecutor implements ChatQueryExecutor {
|
||||
|
||||
@Override
|
||||
public boolean accept(ExecuteContext executeContext) {
|
||||
return PluginQueryManager.isPluginQuery(executeContext.getParseInfo().getQueryMode());
|
||||
}
|
||||
|
||||
@Override
|
||||
public QueryResult execute(ExecuteContext executeContext) {
|
||||
SemanticParseInfo parseInfo = executeContext.getParseInfo();
|
||||
|
||||
@@ -25,6 +25,11 @@ import java.util.Objects;
|
||||
|
||||
public class SqlExecutor implements ChatQueryExecutor {
|
||||
|
||||
@Override
|
||||
public boolean accept(ExecuteContext executeContext) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@SneakyThrows
|
||||
@Override
|
||||
public QueryResult execute(ExecuteContext executeContext) {
|
||||
@@ -80,9 +85,9 @@ public class SqlExecutor implements ChatQueryExecutor {
|
||||
queryResult.setQueryId(executeContext.getRequest().getQueryId());
|
||||
queryResult.setChatContext(parseInfo);
|
||||
queryResult.setQueryMode(parseInfo.getQueryMode());
|
||||
queryResult.setQueryTimeCost(System.currentTimeMillis() - startTime);
|
||||
SemanticQueryResp queryResp =
|
||||
semanticLayer.queryByReq(sqlReq, executeContext.getRequest().getUser());
|
||||
queryResult.setQueryTimeCost(System.currentTimeMillis() - startTime);
|
||||
if (queryResp != null) {
|
||||
queryResult.setQueryAuthorization(queryResp.getQueryAuthorization());
|
||||
queryResult.setQuerySql(queryResp.getSql());
|
||||
|
||||
@@ -4,5 +4,7 @@ import com.tencent.supersonic.chat.server.pojo.ParseContext;
|
||||
|
||||
public interface ChatQueryParser {
|
||||
|
||||
boolean accept(ParseContext parseContext);
|
||||
|
||||
void parse(ParseContext parseContext);
|
||||
}
|
||||
|
||||
@@ -14,12 +14,12 @@ public class NL2PluginParser implements ChatQueryParser {
|
||||
private final List<PluginRecognizer> pluginRecognizers =
|
||||
ComponentFactory.getPluginRecognizers();
|
||||
|
||||
public boolean accept(ParseContext parseContext) {
|
||||
return parseContext.getAgent().containsPluginTool();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void parse(ParseContext parseContext) {
|
||||
if (!parseContext.getAgent().containsPluginTool()) {
|
||||
return;
|
||||
}
|
||||
|
||||
pluginRecognizers.forEach(pluginRecognizer -> {
|
||||
pluginRecognizer.recognize(parseContext);
|
||||
log.info("{} recallResult:{}", pluginRecognizer.getClass().getSimpleName(),
|
||||
|
||||
@@ -73,12 +73,12 @@ public class NL2SQLParser implements ChatQueryParser {
|
||||
.build());
|
||||
}
|
||||
|
||||
public boolean accept(ParseContext parseContext) {
|
||||
return parseContext.enableNL2SQL();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void parse(ParseContext parseContext) {
|
||||
if (!parseContext.enableNL2SQL()) {
|
||||
return;
|
||||
}
|
||||
|
||||
// first go with rule-based parsers unless the user has already selected one parse.
|
||||
if (Objects.isNull(parseContext.getRequest().getSelectedParse())) {
|
||||
QueryNLReq queryNLReq = QueryReqConverter.buildQueryNLReq(parseContext);
|
||||
|
||||
@@ -6,12 +6,12 @@ import com.tencent.supersonic.headless.api.pojo.response.ParseResp;
|
||||
|
||||
public class PlainTextParser implements ChatQueryParser {
|
||||
|
||||
public boolean accept(ParseContext parseContext) {
|
||||
return !parseContext.getAgent().containsAnyTool();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void parse(ParseContext parseContext) {
|
||||
if (parseContext.getAgent().containsAnyTool()) {
|
||||
return;
|
||||
}
|
||||
|
||||
SemanticParseInfo parseInfo = new SemanticParseInfo();
|
||||
parseInfo.setQueryMode("PLAIN_TEXT");
|
||||
parseInfo.setId(1);
|
||||
|
||||
@@ -66,8 +66,10 @@ public class ChatConfigController {
|
||||
}
|
||||
|
||||
@GetMapping("/getDomainDataSetTree")
|
||||
public List<ItemResp> getDomainDataSetTree() {
|
||||
return semanticLayerService.getDomainDataSetTree();
|
||||
public List<ItemResp> getDomainDataSetTree(HttpServletRequest request,
|
||||
HttpServletResponse response) {
|
||||
User user = UserHolder.findUser(request, response);
|
||||
return semanticLayerService.getDomainDataSetTree(user);
|
||||
}
|
||||
|
||||
@GetMapping("/getDataSetSchema/{id}")
|
||||
|
||||
@@ -95,7 +95,11 @@ public class ChatQueryServiceImpl implements ChatQueryService {
|
||||
}
|
||||
|
||||
ParseContext parseContext = buildParseContext(chatParseReq, new ChatParseResp(queryId));
|
||||
chatQueryParsers.forEach(p -> p.parse(parseContext));
|
||||
for (ChatQueryParser parser : chatQueryParsers) {
|
||||
if (parser.accept(parseContext)) {
|
||||
parser.parse(parseContext);
|
||||
}
|
||||
}
|
||||
|
||||
for (ParseResultProcessor processor : parseResultProcessors) {
|
||||
if (processor.accept(parseContext)) {
|
||||
@@ -116,9 +120,11 @@ public class ChatQueryServiceImpl implements ChatQueryService {
|
||||
QueryResult queryResult = new QueryResult();
|
||||
ExecuteContext executeContext = buildExecuteContext(chatExecuteReq);
|
||||
for (ChatQueryExecutor chatQueryExecutor : chatQueryExecutors) {
|
||||
queryResult = chatQueryExecutor.execute(executeContext);
|
||||
if (queryResult != null) {
|
||||
break;
|
||||
if (chatQueryExecutor.accept(executeContext)) {
|
||||
queryResult = chatQueryExecutor.execute(executeContext);
|
||||
if (queryResult != null) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
package com.tencent.supersonic.common.config;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import com.tencent.supersonic.common.pojo.ChatModelConfig;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class ChatModel {
|
||||
@@ -25,5 +27,11 @@ public class ChatModel {
|
||||
|
||||
private String admin;
|
||||
|
||||
private String viewer;
|
||||
private List<String> viewers = Lists.newArrayList();
|
||||
|
||||
private Integer isOpen = 0;
|
||||
|
||||
public boolean isPublic() {
|
||||
return isOpen != null && isOpen == 1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -225,7 +225,7 @@ public class SqlSelectHelper {
|
||||
public static Select getSelect(String sql) {
|
||||
Statement statement = null;
|
||||
try {
|
||||
statement = CCJSqlParserUtil.parse(sql);
|
||||
statement = CCJSqlParserUtil.parse(sql, parser -> parser.withTimeOut(20000));
|
||||
} catch (JSQLParserException e) {
|
||||
log.error("parse error, sql:{}", sql, e);
|
||||
throw new RuntimeException(e);
|
||||
|
||||
@@ -30,4 +30,6 @@ public class ChatModelDO {
|
||||
private String admin;
|
||||
|
||||
private String viewer;
|
||||
|
||||
private Integer isOpen;
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ import com.tencent.supersonic.common.pojo.User;
|
||||
import java.util.List;
|
||||
|
||||
public interface ChatModelService {
|
||||
List<ChatModel> getChatModels();
|
||||
List<ChatModel> getChatModels(User user);
|
||||
|
||||
ChatModel getChatModel(Integer id);
|
||||
|
||||
|
||||
@@ -23,8 +23,15 @@ import java.util.stream.Collectors;
|
||||
public class ChatModelServiceImpl extends ServiceImpl<ChatModelMapper, ChatModelDO>
|
||||
implements ChatModelService {
|
||||
@Override
|
||||
public List<ChatModel> getChatModels() {
|
||||
return list().stream().map(this::convert).collect(Collectors.toList());
|
||||
public List<ChatModel> getChatModels(User user) {
|
||||
return list().stream().map(this::convert).filter(chatModel -> {
|
||||
if (chatModel.isPublic() || user.isSuperAdmin()
|
||||
|| chatModel.getCreatedBy().equals(user.getName())
|
||||
|| chatModel.getViewers().contains(user.getName())) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -41,12 +48,15 @@ public class ChatModelServiceImpl extends ServiceImpl<ChatModelMapper, ChatModel
|
||||
chatModelDO.setCreatedBy(user.getName());
|
||||
chatModelDO.setCreatedAt(new Date());
|
||||
chatModelDO.setUpdatedBy(user.getName());
|
||||
chatModelDO.setUpdatedAt(new Date());
|
||||
chatModelDO.setUpdatedAt(chatModelDO.getCreatedAt());
|
||||
chatModelDO.setIsOpen(chatModel.getIsOpen());
|
||||
if (StringUtils.isBlank(chatModel.getAdmin())) {
|
||||
chatModelDO.setAdmin(user.getName());
|
||||
}
|
||||
if (!chatModel.getViewers().isEmpty()) {
|
||||
chatModelDO.setViewer(JsonUtil.toString(chatModel.getViewers()));
|
||||
}
|
||||
save(chatModelDO);
|
||||
chatModel.setId(chatModelDO.getId());
|
||||
return chatModel;
|
||||
}
|
||||
|
||||
@@ -55,9 +65,13 @@ public class ChatModelServiceImpl extends ServiceImpl<ChatModelMapper, ChatModel
|
||||
ChatModelDO chatModelDO = convert(chatModel);
|
||||
chatModelDO.setUpdatedBy(user.getName());
|
||||
chatModelDO.setUpdatedAt(new Date());
|
||||
chatModelDO.setIsOpen(chatModel.getIsOpen());
|
||||
if (StringUtils.isBlank(chatModel.getAdmin())) {
|
||||
chatModel.setAdmin(user.getName());
|
||||
}
|
||||
if (!chatModel.getViewers().isEmpty()) {
|
||||
chatModelDO.setViewer(JsonUtil.toString(chatModel.getViewers()));
|
||||
}
|
||||
updateById(chatModelDO);
|
||||
return chatModel;
|
||||
}
|
||||
@@ -74,6 +88,7 @@ public class ChatModelServiceImpl extends ServiceImpl<ChatModelMapper, ChatModel
|
||||
ChatModel chatModel = new ChatModel();
|
||||
BeanUtils.copyProperties(chatModelDO, chatModel);
|
||||
chatModel.setConfig(JsonUtil.toObject(chatModelDO.getConfig(), ChatModelConfig.class));
|
||||
chatModel.setViewers(JsonUtil.toList(chatModelDO.getViewer(), String.class));
|
||||
return chatModel;
|
||||
}
|
||||
|
||||
|
||||
@@ -27,4 +27,4 @@ WORKDIR /usr/src/app/supersonic-standalone-${SUPERSONIC_VERSION}
|
||||
EXPOSE 9080
|
||||
# Command to run the supersonic daemon
|
||||
RUN chmod +x bin/supersonic-daemon.sh
|
||||
CMD ["bash", "-c", "bin/supersonic-daemon.sh restart standalone docker && tail -f /dev/null"]
|
||||
CMD ["bash", "-c", "bin/supersonic-daemon.sh restart standalone ${S2_DB_TYPE} && tail -f /dev/null"]
|
||||
@@ -2,8 +2,8 @@
|
||||
|
||||
# Function to execute the build script
|
||||
execute_build_script() {
|
||||
echo "Executing build script: assembly/bin/supersonic-build.sh"
|
||||
assembly/bin/supersonic-build.sh
|
||||
echo "Executing build script: sh assembly/bin/supersonic-build.sh"
|
||||
sh assembly/bin/supersonic-build.sh
|
||||
}
|
||||
|
||||
# Function to build the Docker image
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
SUPERSONIC_VERSION=latest docker-compose -f docker-compose.yml -p supersonic up
|
||||
@@ -30,10 +30,12 @@ services:
|
||||
privileged: true
|
||||
container_name: supersonic_standalone
|
||||
environment:
|
||||
DB_HOST: supersonic_postgres
|
||||
DB_NAME: postgres
|
||||
DB_USERNAME: supersonic_user
|
||||
DB_PASSWORD: supersonic_password
|
||||
S2_DB_TYPE: postgres
|
||||
S2_DB_HOST: supersonic_postgres
|
||||
S2_DB_PORT: 5432
|
||||
S2_DB_DATABASE: postgres
|
||||
S2_DB_USER: supersonic_user
|
||||
S2_DB_PASSWORD: supersonic_password
|
||||
ports:
|
||||
- "9080:9080"
|
||||
depends_on:
|
||||
|
||||
@@ -24,6 +24,8 @@ public class ModelDetail {
|
||||
|
||||
private String tableQuery;
|
||||
|
||||
private String filterSql;
|
||||
|
||||
private List<Identify> identifiers = Lists.newArrayList();
|
||||
|
||||
private List<Dimension> dimensions = Lists.newArrayList();
|
||||
|
||||
@@ -32,9 +32,12 @@ public class DatabaseReq extends RecordInfo {
|
||||
private String description;
|
||||
|
||||
private String schema;
|
||||
|
||||
private String url;
|
||||
|
||||
private List<String> admins = Lists.newArrayList();
|
||||
|
||||
private List<String> viewers = Lists.newArrayList();
|
||||
|
||||
private Integer isOpen = 0;
|
||||
}
|
||||
|
||||
@@ -19,6 +19,8 @@ public class ModelBuildReq {
|
||||
|
||||
private String sql;
|
||||
|
||||
private String filterSql;
|
||||
|
||||
private String catalog;
|
||||
|
||||
private String db;
|
||||
|
||||
@@ -28,6 +28,8 @@ public class DatabaseResp extends RecordInfo {
|
||||
|
||||
private List<String> viewers = Lists.newArrayList();
|
||||
|
||||
private Integer isOpen = 0;
|
||||
|
||||
private String type;
|
||||
|
||||
private String url;
|
||||
@@ -48,6 +50,10 @@ public class DatabaseResp extends RecordInfo {
|
||||
|
||||
private boolean hasEditPermission = false;
|
||||
|
||||
public boolean isPublic() {
|
||||
return isOpen != null && isOpen == 1;
|
||||
}
|
||||
|
||||
public String getHost() {
|
||||
Pattern p = Pattern.compile("jdbc:(?<db>\\w+):.*((//)|@)(?<host>.+):(?<port>\\d+).*");
|
||||
Matcher m = p.matcher(url);
|
||||
|
||||
@@ -40,11 +40,23 @@ public class DataModelNode extends SemanticNode {
|
||||
.equalsIgnoreCase(EngineType.POSTGRESQL.getName())) {
|
||||
String fullTableName = String.join(".public.",
|
||||
dataModel.getModelDetail().getTableQuery().split("\\."));
|
||||
sqlTable = "select * from " + fullTableName;
|
||||
sqlTable = "SELECT * FROM " + fullTableName;
|
||||
} else {
|
||||
sqlTable = "select * from " + dataModel.getModelDetail().getTableQuery();
|
||||
sqlTable = "SELECT * FROM " + dataModel.getModelDetail().getTableQuery();
|
||||
}
|
||||
}
|
||||
|
||||
// String filterSql = dataModel.getFilterSql();
|
||||
String filterSql = dataModel.getModelDetail().getFilterSql();
|
||||
if (filterSql != null && !filterSql.isEmpty()) {
|
||||
boolean sqlContainWhere = sqlTable.toUpperCase().matches("(?s).*\\bWHERE\\b.*");
|
||||
if (sqlContainWhere) {
|
||||
sqlTable = String.format("%s AND %s", sqlTable, filterSql);
|
||||
} else {
|
||||
sqlTable = String.format("%s WHERE %s", sqlTable, filterSql);
|
||||
}
|
||||
}
|
||||
|
||||
if (sqlTable.isEmpty()) {
|
||||
throw new Exception("DataModelNode build error [tableSqlNode not found]");
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ public interface SemanticLayerService {
|
||||
|
||||
DataSetSchema getDataSetSchema(Long id);
|
||||
|
||||
List<ItemResp> getDomainDataSetTree();
|
||||
List<ItemResp> getDomainDataSetTree(User user);
|
||||
|
||||
List<DimensionResp> getDimensions(MetaFilter metaFilter);
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ import com.google.common.collect.Sets;
|
||||
import com.tencent.supersonic.common.pojo.Constants;
|
||||
import com.tencent.supersonic.common.pojo.QueryColumn;
|
||||
import com.tencent.supersonic.common.pojo.User;
|
||||
import com.tencent.supersonic.common.pojo.enums.AuthType;
|
||||
import com.tencent.supersonic.common.pojo.enums.TaskStatusEnum;
|
||||
import com.tencent.supersonic.headless.api.pojo.DataSetSchema;
|
||||
import com.tencent.supersonic.headless.api.pojo.Dimension;
|
||||
@@ -29,10 +30,7 @@ import com.tencent.supersonic.headless.core.utils.ComponentFactory;
|
||||
import com.tencent.supersonic.headless.server.annotation.S2DataPermission;
|
||||
import com.tencent.supersonic.headless.server.facade.service.SemanticLayerService;
|
||||
import com.tencent.supersonic.headless.server.manager.SemanticSchemaManager;
|
||||
import com.tencent.supersonic.headless.server.service.DataSetService;
|
||||
import com.tencent.supersonic.headless.server.service.DimensionService;
|
||||
import com.tencent.supersonic.headless.server.service.MetricService;
|
||||
import com.tencent.supersonic.headless.server.service.SchemaService;
|
||||
import com.tencent.supersonic.headless.server.service.*;
|
||||
import com.tencent.supersonic.headless.server.utils.MetricDrillDownChecker;
|
||||
import com.tencent.supersonic.headless.server.utils.QueryUtils;
|
||||
import com.tencent.supersonic.headless.server.utils.StatUtils;
|
||||
@@ -59,6 +57,7 @@ public class S2SemanticLayerService implements SemanticLayerService {
|
||||
private final MetricDrillDownChecker metricDrillDownChecker;
|
||||
private final KnowledgeBaseService knowledgeBaseService;
|
||||
private final MetricService metricService;
|
||||
private final DomainService domainService;
|
||||
private final DimensionService dimensionService;
|
||||
private final TranslatorConfig translatorConfig;
|
||||
private final QueryCache queryCache = ComponentFactory.getQueryCache();
|
||||
@@ -69,7 +68,8 @@ public class S2SemanticLayerService implements SemanticLayerService {
|
||||
SchemaService schemaService, SemanticTranslator semanticTranslator,
|
||||
MetricDrillDownChecker metricDrillDownChecker,
|
||||
KnowledgeBaseService knowledgeBaseService, MetricService metricService,
|
||||
DimensionService dimensionService, TranslatorConfig translatorConfig) {
|
||||
DimensionService dimensionService, DomainService domainService,
|
||||
TranslatorConfig translatorConfig) {
|
||||
this.statUtils = statUtils;
|
||||
this.queryUtils = queryUtils;
|
||||
this.semanticSchemaManager = semanticSchemaManager;
|
||||
@@ -80,6 +80,7 @@ public class S2SemanticLayerService implements SemanticLayerService {
|
||||
this.knowledgeBaseService = knowledgeBaseService;
|
||||
this.metricService = metricService;
|
||||
this.dimensionService = dimensionService;
|
||||
this.domainService = domainService;
|
||||
this.translatorConfig = translatorConfig;
|
||||
}
|
||||
|
||||
@@ -262,8 +263,11 @@ public class S2SemanticLayerService implements SemanticLayerService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ItemResp> getDomainDataSetTree() {
|
||||
return schemaService.getDomainDataSetTree();
|
||||
public List<ItemResp> getDomainDataSetTree(User user) {
|
||||
List<Long> domainsWithAuth = domainService.getDomainAuthSet(user, AuthType.VIEWER).stream()
|
||||
.map(DomainResp::getId).toList();
|
||||
return schemaService.getDomainDataSetTree().stream()
|
||||
.filter(item -> domainsWithAuth.contains(item.getId())).toList();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -36,6 +36,7 @@ public class ModelYamlManager {
|
||||
} else {
|
||||
dataModelYamlTpl.setTableQuery(modelDetail.getTableQuery());
|
||||
}
|
||||
dataModelYamlTpl.setFilterSql(modelDetail.getFilterSql());
|
||||
dataModelYamlTpl.setFields(modelResp.getModelDetail().getFields());
|
||||
dataModelYamlTpl.setId(modelResp.getId());
|
||||
return dataModelYamlTpl;
|
||||
|
||||
@@ -97,6 +97,7 @@ public class SemanticSchemaManager {
|
||||
modelDetail.setDbType(d.getType());
|
||||
modelDetail.setSqlQuery(d.getSqlQuery());
|
||||
modelDetail.setTableQuery(d.getTableQuery());
|
||||
modelDetail.setFilterSql(d.getFilterSql());
|
||||
modelDetail.getIdentifiers().addAll(getIdentify(d.getIdentifiers()));
|
||||
modelDetail.getMeasures().addAll(getMeasureParams(d.getMeasures()));
|
||||
modelDetail.getDimensions().addAll(getDimensions(d.getDimensions()));
|
||||
|
||||
@@ -44,6 +44,8 @@ public class DatabaseDO {
|
||||
/** */
|
||||
private String viewer;
|
||||
|
||||
private Integer isOpen = 0;
|
||||
|
||||
/** 配置信息 */
|
||||
private String config;
|
||||
|
||||
|
||||
@@ -21,6 +21,8 @@ public class DataModelYamlTpl {
|
||||
|
||||
private String tableQuery;
|
||||
|
||||
private String filterSql;
|
||||
|
||||
private List<IdentifyYamlTpl> identifiers;
|
||||
|
||||
private List<DimensionYamlTpl> dimensions;
|
||||
|
||||
@@ -52,8 +52,10 @@ public class ChatModelController {
|
||||
}
|
||||
|
||||
@RequestMapping("/getModelList")
|
||||
public List<ChatModel> getModelList() {
|
||||
return chatModelService.getChatModels();
|
||||
public List<ChatModel> getModelList(HttpServletRequest httpServletRequest,
|
||||
HttpServletResponse httpServletResponse) {
|
||||
User user = UserHolder.findUser(httpServletRequest, httpServletResponse);
|
||||
return chatModelService.getChatModels(user);
|
||||
}
|
||||
|
||||
@RequestMapping("/getModelAppList")
|
||||
|
||||
@@ -96,14 +96,15 @@ public class DatabaseServiceImpl extends ServiceImpl<DatabaseDOMapper, DatabaseD
|
||||
databaseResp.setHasEditPermission(true);
|
||||
databaseResp.setHasUsePermission(true);
|
||||
}
|
||||
if (databaseResp.getViewers().contains(user.getName())) {
|
||||
if (databaseResp.getViewers().contains(user.getName()) || databaseResp.isPublic()) {
|
||||
databaseResp.setHasUsePermission(true);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private boolean filterByAuth(DatabaseResp database, User user, AuthType authType) {
|
||||
if (user.isSuperAdmin() || user.getName().equals(database.getCreatedBy())) {
|
||||
if (database.isPublic() || user.isSuperAdmin()
|
||||
|| user.getName().equals(database.getCreatedBy())) {
|
||||
return true;
|
||||
}
|
||||
authType = authType == null ? AuthType.VIEWER : authType;
|
||||
|
||||
@@ -179,6 +179,7 @@ public class ModelConverter {
|
||||
}
|
||||
}
|
||||
modelDetail.setFields(fields);
|
||||
modelDetail.setFilterSql(modelBuildReq.getFilterSql());
|
||||
modelReq.setModelDetail(modelDetail);
|
||||
return modelReq;
|
||||
}
|
||||
|
||||
@@ -140,7 +140,7 @@ public abstract class S2BaseDemo implements CommandLineRunner {
|
||||
}
|
||||
|
||||
protected ChatModel addChatModelIfNotExist() {
|
||||
List<ChatModel> chatModels = chatModelService.getChatModels();
|
||||
List<ChatModel> chatModels = chatModelService.getChatModels(defaultUser);
|
||||
if (!chatModels.isEmpty()) {
|
||||
return chatModels.get(0);
|
||||
} else {
|
||||
|
||||
@@ -1,26 +0,0 @@
|
||||
spring:
|
||||
datasource:
|
||||
driver-class-name: org.postgresql.Driver
|
||||
url: jdbc:postgresql://${DB_HOST}:${DB_PORT:5432}/${DB_NAME}?stringtype=unspecified
|
||||
username: ${DB_USERNAME}
|
||||
password: ${DB_PASSWORD}
|
||||
sql:
|
||||
init:
|
||||
continue-on-error: true
|
||||
mode: always
|
||||
username: ${DB_USERNAME}
|
||||
password: ${DB_PASSWORD}
|
||||
schema-locations: classpath:db/schema-postgres.sql,classpath:db/schema-postgres-demo.sql
|
||||
data-locations: classpath:db/data-postgres.sql,classpath:db/data-postgres-demo.sql
|
||||
|
||||
s2:
|
||||
embedding:
|
||||
store:
|
||||
provider: PGVECTOR
|
||||
base:
|
||||
url: ${DB_HOST}
|
||||
port: ${DB_PORT:5432}
|
||||
databaseName: ${DB_NAME}
|
||||
user: ${DB_USERNAME}
|
||||
password: ${DB_PASSWORD}
|
||||
dimension: 512
|
||||
@@ -413,4 +413,8 @@ ALTER TABLE s2_agent add column `view_org` varchar(3000) DEFAULT NULL COMMENT '
|
||||
ALTER TABLE s2_agent add column `is_open` tinyint DEFAULT NULL COMMENT '是否公开';
|
||||
|
||||
--20250309
|
||||
ALTER TABLE s2_model_rela alter column join_condition type text;
|
||||
ALTER TABLE s2_model_rela alter column join_condition type text;
|
||||
|
||||
--20250310
|
||||
ALTER TABLE s2_chat_model add column is_open tinyint DEFAULT NULL COMMENT '是否公开';
|
||||
ALTER TABLE s2_database add column is_open tinyint DEFAULT NULL COMMENT '是否公开';
|
||||
@@ -116,6 +116,7 @@ CREATE TABLE IF NOT EXISTS `s2_chat_model`
|
||||
`updated_by` varchar(100) NOT NULL,
|
||||
`admin` varchar(500) NOT NULL,
|
||||
`viewer` varchar(500) DEFAULT NULL,
|
||||
`is_open` TINYINT DEFAULT NULL , -- whether public
|
||||
PRIMARY KEY (`id`)
|
||||
); COMMENT ON TABLE s2_chat_model IS 'chat model table';
|
||||
|
||||
@@ -197,6 +198,7 @@ CREATE TABLE IF NOT EXISTS `s2_database` (
|
||||
`updated_by` varchar(100) NOT NULL,
|
||||
`admin` varchar(500) NOT NULL,
|
||||
`viewer` varchar(500) DEFAULT NULL,
|
||||
`is_open` TINYINT DEFAULT NULL , -- whether public
|
||||
PRIMARY KEY (`id`)
|
||||
);
|
||||
COMMENT ON TABLE s2_database IS 'database instance table';
|
||||
@@ -379,7 +381,7 @@ CREATE TABLE IF NOT EXISTS s2_agent
|
||||
enable_feedback int null,
|
||||
`admin` varchar(3000) DEFAULT NULL , -- administrator
|
||||
`admin_org` varchar(3000) DEFAULT NULL , -- administrators organization
|
||||
`is_open` TINYINT DEFAULT NULL , -- whether the public
|
||||
`is_open` TINYINT DEFAULT NULL , -- whether public
|
||||
`viewer` varchar(3000) DEFAULT NULL , -- available users
|
||||
`view_org` varchar(3000) DEFAULT NULL , -- available organization
|
||||
PRIMARY KEY (`id`)
|
||||
|
||||
@@ -161,6 +161,7 @@ CREATE TABLE IF NOT EXISTS `s2_chat_model` (
|
||||
`updated_by` varchar(100) NOT NULL COMMENT '更新人',
|
||||
`admin` varchar(500) DEFAULT NULL,
|
||||
`viewer` varchar(500) DEFAULT NULL,
|
||||
`is_open` tinyint DEFAULT NULL COMMENT '是否公开',
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='对话大模型实例表';
|
||||
|
||||
@@ -177,6 +178,7 @@ CREATE TABLE IF NOT EXISTS `s2_database` (
|
||||
`updated_by` varchar(100) NOT NULL COMMENT '更新人',
|
||||
`admin` varchar(500) DEFAULT NULL,
|
||||
`viewer` varchar(500) DEFAULT NULL,
|
||||
`is_open` tinyint DEFAULT NULL COMMENT '是否公开',
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='数据库实例表';
|
||||
|
||||
|
||||
@@ -147,7 +147,8 @@ CREATE TABLE IF NOT EXISTS s2_chat_model (
|
||||
updated_at timestamp NOT NULL,
|
||||
updated_by varchar(100) NOT NULL,
|
||||
admin varchar(500) DEFAULT NULL,
|
||||
viewer varchar(500) DEFAULT NULL
|
||||
viewer varchar(500) DEFAULT NULL,
|
||||
is_open smallint DEFAULT NULL
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS s2_database (
|
||||
@@ -162,7 +163,8 @@ CREATE TABLE IF NOT EXISTS s2_database (
|
||||
updated_at timestamp NOT NULL,
|
||||
updated_by varchar(100) NOT NULL,
|
||||
admin varchar(500) DEFAULT NULL,
|
||||
viewer varchar(500) DEFAULT NULL
|
||||
viewer varchar(500) DEFAULT NULL,
|
||||
is_open smallint DEFAULT NULL
|
||||
);
|
||||
|
||||
|
||||
|
||||
2
pom.xml
2
pom.xml
@@ -32,7 +32,7 @@
|
||||
<maven.compiler.source>21</maven.compiler.source>
|
||||
<maven.compiler.target>21</maven.compiler.target>
|
||||
<file.encoding>UTF-8</file.encoding>
|
||||
<jsqlparser.version>4.7</jsqlparser.version>
|
||||
<jsqlparser.version>4.9</jsqlparser.version>
|
||||
<pagehelper.version>6.1.0</pagehelper.version>
|
||||
<pagehelper.spring.version>2.1.0</pagehelper.spring.version>
|
||||
<mybatis.version>3.5.3</mybatis.version>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import React, { useState } from 'react';
|
||||
import { Form, Button, Modal, Input } from 'antd';
|
||||
import { Form, Button, Modal, Input, message } from 'antd';
|
||||
|
||||
import type { RegisterFormDetail } from './types';
|
||||
|
||||
@@ -37,8 +37,9 @@ const RegisterForm: React.FC<RegisterFormProps> = (props) => {
|
||||
try {
|
||||
await handleUpdate(formValus);
|
||||
setSaveLoading(false);
|
||||
} catch (error) {
|
||||
} catch (error: any) {
|
||||
setSaveLoading(false);
|
||||
message.error(error.message);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -41,8 +41,9 @@ const LoginPage: React.FC = () => {
|
||||
}
|
||||
history.push('/');
|
||||
return;
|
||||
} else {
|
||||
message.error(msg);
|
||||
}
|
||||
message.success(msg);
|
||||
};
|
||||
|
||||
// 处理登录按钮响应
|
||||
@@ -55,12 +56,14 @@ const LoginPage: React.FC = () => {
|
||||
// 处理注册弹窗确定按钮
|
||||
const handleRegister = async (values: RegisterFormDetail) => {
|
||||
const enCodeValues = { ...values, password: encryptPassword(values.password, encryptKey) };
|
||||
const { code } = await userRegister(enCodeValues);
|
||||
const { code, msg } = await userRegister(enCodeValues);
|
||||
if (code === 200) {
|
||||
message.success('注册成功');
|
||||
setCreateModalVisible(false);
|
||||
// 注册完自动帮用户登录
|
||||
await loginDone(enCodeValues);
|
||||
} else {
|
||||
message.error(msg);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -107,20 +107,8 @@ const MetricDetail: React.FC<Props> = () => {
|
||||
|
||||
return (
|
||||
<>
|
||||
<Helmet
|
||||
title={`${metircData?.id ? `[指标]${metircData?.name}-${BASE_TITLE}` : '新建指标'}`}
|
||||
/>
|
||||
<div className={styles.metricDetailWrapper}>
|
||||
<div className={styles.metricDetail}>
|
||||
<div className={styles.siderContainer}>
|
||||
<MetricInfoSider
|
||||
relationDimensionOptions={relationDimensionOptions}
|
||||
metircData={metircData}
|
||||
onDimensionRelationBtnClick={() => {
|
||||
setMetricRelationModalOpenState(true);
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
<div className={styles.tabContainer}>
|
||||
<Tabs
|
||||
defaultActiveKey="metricCaliberInput"
|
||||
@@ -146,6 +134,15 @@ const MetricDetail: React.FC<Props> = () => {
|
||||
className={styles.metricDetailTab}
|
||||
/>
|
||||
</div>
|
||||
<div className={styles.siderContainer}>
|
||||
<MetricInfoSider
|
||||
relationDimensionOptions={relationDimensionOptions}
|
||||
metircData={metircData}
|
||||
onDimensionRelationBtnClick={() => {
|
||||
setMetricRelationModalOpenState(true);
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<DimensionAndMetricRelationModal
|
||||
metricItem={metircData}
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
.metricWrapper {
|
||||
width: 100%;
|
||||
margin-left: auto;
|
||||
@@ -12,7 +11,6 @@
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
|
||||
.metricFilterWrapper {
|
||||
margin: 20px;
|
||||
padding: 20px;
|
||||
@@ -183,7 +181,68 @@
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
.metricEditWrapper {
|
||||
.metricDetailTab {
|
||||
:global {
|
||||
.ant-tabs-nav {
|
||||
margin: 10px 20px 0 20px;
|
||||
padding: 0 20px;
|
||||
background-color: rgb(255, 255, 255);
|
||||
border-radius: 8px;
|
||||
transition: box-shadow 300ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;
|
||||
}
|
||||
.ant-tabs-tab {
|
||||
padding: 12px 0;
|
||||
color: #344767;
|
||||
font-weight: 500;
|
||||
}
|
||||
}
|
||||
}
|
||||
.metricDetail {
|
||||
position: relative;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
width: 100%;
|
||||
padding: 0px;
|
||||
background-color: transparent;
|
||||
height: 100%;
|
||||
.tabContainer {
|
||||
padding: 24px;
|
||||
min-height: calc(100vh - 78px);
|
||||
width: calc(100vw - 350px);
|
||||
background-color: #fafafb;
|
||||
}
|
||||
.metricInfoContent {
|
||||
padding: 25px;
|
||||
.title {
|
||||
position: relative;
|
||||
margin-bottom: 12px;
|
||||
color: #0e73ff;
|
||||
font-weight: bold;
|
||||
font-size: 16px;
|
||||
&::before {
|
||||
position: absolute;
|
||||
top: 10px;
|
||||
left: -10px;
|
||||
display: block;
|
||||
width: 3px;
|
||||
height: 14px;
|
||||
font-size: 0;
|
||||
background: #0e73ff;
|
||||
border: 1px solid #0e73ff;
|
||||
border-radius: 2px;
|
||||
content: '';
|
||||
}
|
||||
}
|
||||
}
|
||||
.siderContainer {
|
||||
width: 350px;
|
||||
min-height: calc(100vh - 78px);
|
||||
border-radius: 6px;
|
||||
padding: 24px 0 24px 24px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.metricDetailWrapper {
|
||||
height: calc(100vh - 56px);
|
||||
@@ -215,8 +274,7 @@
|
||||
.tabContainer {
|
||||
height: 100%;
|
||||
min-height: calc(100vh - 78px);
|
||||
// width: calc(100vw - 450px);
|
||||
width: 100%;
|
||||
width: calc(100vw - 450px);
|
||||
background-color: #fafafb;
|
||||
}
|
||||
.metricInfoContent {
|
||||
@@ -245,8 +303,9 @@
|
||||
.siderContainer {
|
||||
width: 450px;
|
||||
min-height: calc(100vh - 78px);
|
||||
margin: 10px 20px 20px 0;
|
||||
background-color: rgb(255, 255, 255);
|
||||
border-radius: 6px;
|
||||
padding: 10px 0 24px 24px;
|
||||
box-shadow: rgba(0, 0, 0, 0.08) 6px 0px 16px 0px, rgba(0, 0, 0, 0.12) 3px 0px 6px -4px,
|
||||
rgba(0, 0, 0, 0.05) 9px 0px 28px 8px;
|
||||
}
|
||||
@@ -265,5 +324,260 @@
|
||||
transition: box-shadow 300ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;
|
||||
}
|
||||
|
||||
.metricInfoSider {
|
||||
padding: 20px;
|
||||
color: #344767;
|
||||
background-color: #fff;
|
||||
height: 100%;
|
||||
border: 1px solid #e6ebf1;
|
||||
border-radius: 6px;
|
||||
.createTitle {
|
||||
margin-bottom: 10px;
|
||||
color: #344767;
|
||||
font-weight: 500;
|
||||
font-size: 16px;
|
||||
font-family: var(--tencent-font-family);
|
||||
}
|
||||
.gotoMetricListIcon {
|
||||
color: #3182ce;
|
||||
cursor: pointer;
|
||||
&:hover {
|
||||
color: #5493ff;
|
||||
}
|
||||
}
|
||||
.title {
|
||||
margin-bottom: 20px;
|
||||
.name {
|
||||
font-weight: 600;
|
||||
font-size: 18px;
|
||||
}
|
||||
.bizName {
|
||||
margin: 5px 0 0 25px;
|
||||
color: #7b809a;
|
||||
font-weight: 400;
|
||||
}
|
||||
}
|
||||
.desc {
|
||||
display: block;
|
||||
margin-top: 8px;
|
||||
color: #7b809a;
|
||||
font-weight: 500;
|
||||
font-size: 14px;
|
||||
line-height: 1.9;
|
||||
}
|
||||
.subTitle {
|
||||
margin: 0px;
|
||||
color: rgb(123, 128, 154);
|
||||
font-weight: 700;
|
||||
font-size: 14px;
|
||||
line-height: 1.25;
|
||||
letter-spacing: 0.03333em;
|
||||
text-transform: uppercase;
|
||||
text-decoration: none;
|
||||
vertical-align: unset;
|
||||
opacity: 1;
|
||||
}
|
||||
.sectionContainer {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
position: relative;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
overflow: scroll;
|
||||
|
||||
overflow: hidden;
|
||||
background-image: none;
|
||||
border-radius: 6px;
|
||||
.section {
|
||||
padding: 16px;
|
||||
color: rgb(52, 71, 103);
|
||||
line-height: 1.25;
|
||||
background: transparent;
|
||||
box-shadow: none;
|
||||
opacity: 1;
|
||||
.sectionTitleBox {
|
||||
padding: 8px 0;
|
||||
color: rgb(52, 71, 103);
|
||||
background: transparent;
|
||||
box-shadow: none;
|
||||
opacity: 1;
|
||||
.sectionTitle {
|
||||
margin: 0px;
|
||||
color: rgb(52, 71, 103);
|
||||
font-weight: 600;
|
||||
font-size: 16px;
|
||||
line-height: 1.625;
|
||||
letter-spacing: 0.0075em;
|
||||
text-transform: capitalize;
|
||||
text-decoration: none;
|
||||
vertical-align: unset;
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
|
||||
.item {
|
||||
display: flex;
|
||||
padding-top: 8px;
|
||||
padding-right: 16px;
|
||||
padding-bottom: 8px;
|
||||
color: rgb(52, 71, 103);
|
||||
background: transparent;
|
||||
box-shadow: none;
|
||||
opacity: 1;
|
||||
.itemLable {
|
||||
min-width: fit-content;
|
||||
margin: 0px;
|
||||
margin-right: 10px;
|
||||
color: #344767;
|
||||
font-weight: 700;
|
||||
font-size: 14px;
|
||||
line-height: 1.5;
|
||||
letter-spacing: 0.02857em;
|
||||
text-transform: capitalize;
|
||||
text-decoration: none;
|
||||
vertical-align: unset;
|
||||
opacity: 1;
|
||||
}
|
||||
.itemValue {
|
||||
margin: 0px;
|
||||
color: #7b809a;
|
||||
font-weight: 400;
|
||||
font-size: 14px;
|
||||
line-height: 1.5;
|
||||
letter-spacing: 0.02857em;
|
||||
text-transform: none;
|
||||
text-decoration: none;
|
||||
vertical-align: unset;
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
.hr {
|
||||
flex-shrink: 0;
|
||||
margin: 0px;
|
||||
border-color: rgb(242, 244, 247);
|
||||
// border-width: 0px 0px thin;
|
||||
border-style: solid;
|
||||
}
|
||||
.ctrlBox {
|
||||
.ctrlList {
|
||||
position: relative;
|
||||
margin: 0px;
|
||||
padding: 8px 0px;
|
||||
list-style: none;
|
||||
background-color: rgb(249, 250, 251);
|
||||
li {
|
||||
position: relative;
|
||||
display: flex;
|
||||
flex-grow: 1;
|
||||
align-items: center;
|
||||
justify-content: flex-start;
|
||||
box-sizing: border-box;
|
||||
min-width: 0px;
|
||||
margin: 4px;
|
||||
padding: 4px 16px;
|
||||
color: inherit;
|
||||
text-align: left;
|
||||
text-decoration: none;
|
||||
vertical-align: middle;
|
||||
background-color: transparent;
|
||||
border: 0px;
|
||||
border-radius: 0px;
|
||||
outline: 0px;
|
||||
cursor: pointer;
|
||||
transition: background-color 150ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;
|
||||
appearance: none;
|
||||
user-select: none;
|
||||
-webkit-tap-highlight-color: transparent;
|
||||
-webkit-box-flex: 1;
|
||||
-webkit-box-pack: start;
|
||||
-webkit-box-align: center;
|
||||
&:hover {
|
||||
color: #3182ce;
|
||||
text-decoration: none;
|
||||
background-color: rgba(16, 24, 40, 0.04);
|
||||
}
|
||||
}
|
||||
.ctrlItemIcon {
|
||||
flex-shrink: 0;
|
||||
min-width: unset;
|
||||
margin-right: 5px;
|
||||
font-size: 14px;
|
||||
}
|
||||
.styles.ctrlItemLable {
|
||||
display: block;
|
||||
margin: 0px;
|
||||
font-weight: 400;
|
||||
font-size: 14px;
|
||||
line-height: 1.6;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.settingList {
|
||||
list-style: none;
|
||||
margin: 0px;
|
||||
position: relative;
|
||||
padding: 0px;
|
||||
li {
|
||||
-webkit-tap-highlight-color: transparent;
|
||||
background-color: transparent;
|
||||
outline: 0px;
|
||||
border: 0px;
|
||||
margin: 0px;
|
||||
border-radius: 0px;
|
||||
cursor: pointer;
|
||||
user-select: none;
|
||||
vertical-align: middle;
|
||||
appearance: none;
|
||||
display: flex;
|
||||
flex-grow: 1;
|
||||
justify-content: flex-start;
|
||||
align-items: center;
|
||||
position: relative;
|
||||
text-decoration: none;
|
||||
min-width: 0px;
|
||||
box-sizing: border-box;
|
||||
text-align: left;
|
||||
padding: 8px 16px;
|
||||
transition: background-color 150ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;
|
||||
&.active {
|
||||
background-color: rgba(22, 119, 255, 0.08);
|
||||
.icon {
|
||||
color: rgb(22, 119, 255);
|
||||
}
|
||||
.content {
|
||||
.text {
|
||||
color: rgb(22, 119, 255);
|
||||
}
|
||||
}
|
||||
}
|
||||
.icon {
|
||||
min-width: 32px;
|
||||
color: #344767;
|
||||
flex-shrink: 0;
|
||||
display: inline-flex;
|
||||
}
|
||||
.content {
|
||||
flex: 1 1 auto;
|
||||
min-width: 0px;
|
||||
margin-top: 4px;
|
||||
margin-bottom: 4px;
|
||||
.text {
|
||||
margin: 0px;
|
||||
color: #344767;
|
||||
font-size: 16px;
|
||||
// line-height: 1.57;
|
||||
// font-family: var(--tencent-font-family);
|
||||
font-weight: 600;
|
||||
display: block;
|
||||
}
|
||||
}
|
||||
&:hover {
|
||||
text-decoration: none;
|
||||
background-color: rgba(0, 0, 0, 0.04);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -99,6 +99,7 @@ const DatasetCreateForm: React.FC<ModelCreateFormModalProps> = forwardRef(
|
||||
setSaveLoading(false);
|
||||
if (code === 200) {
|
||||
onSubmit?.(queryData);
|
||||
message.success('保存成功');
|
||||
} else {
|
||||
message.error(msg);
|
||||
}
|
||||
|
||||
@@ -109,6 +109,7 @@ const ViewCreateFormModal: React.FC<ModelCreateFormModalProps> = ({
|
||||
setSaveLoading(false);
|
||||
if (code === 200) {
|
||||
onSubmit?.(queryData);
|
||||
message.success('保存成功');
|
||||
} else {
|
||||
message.error(msg);
|
||||
}
|
||||
|
||||
@@ -87,6 +87,7 @@ const ViewSearchFormModal: React.FC<ModelCreateFormModalProps> = ({
|
||||
setSaveLoading(false);
|
||||
if (code === 200) {
|
||||
onSubmit?.(queryData);
|
||||
message.success('保存成功');
|
||||
} else {
|
||||
message.error(msg);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user