提交 4fc20313 authored 作者: fit2cloud-chenyw's avatar fit2cloud-chenyw

Merge branch 'dev' of fit2cloud:dataease/dataease into dev

...@@ -11,7 +11,9 @@ public enum DatasourceTypes { ...@@ -11,7 +11,9 @@ public enum DatasourceTypes {
oracle("oracle", "oracle", "oracle.jdbc.driver.OracleDriver", "\"", "\"", "\"", "\""), oracle("oracle", "oracle", "oracle.jdbc.driver.OracleDriver", "\"", "\"", "\"", "\""),
mongo("mongo", "mongodb", "com.mongodb.jdbc.MongoDriver", "`", "`", "\"", "\""), mongo("mongo", "mongodb", "com.mongodb.jdbc.MongoDriver", "`", "`", "\"", "\""),
ck("ch", "ch", "ru.yandex.clickhouse.ClickHouseDriver", "`", "`", "'", "'"), ck("ch", "ch", "ru.yandex.clickhouse.ClickHouseDriver", "`", "`", "'", "'"),
es("es", "es", "", "\"", "\"", "\"", "\""); es("es", "es", "", "\"", "\"", "\"", "\""),
redshift("redshift", "redshift", "org.postgresql.Driver", "\"", "\"", "\"", "\"");
private String feature; private String feature;
private String desc; private String desc;
......
package io.dataease.datasource.dto;
import lombok.Getter;
import lombok.Setter;
@Getter
@Setter
public class RedshiftConfigration extends JdbcConfiguration {
private String driver = "com.amazon.redshift.jdbc42.Driver";
public String getJdbc() {
// 连接参数先写死,后边要把编码、时区等参数放到数据源的设置中
return "jdbc:redshift://HOSTNAME:PORT/DATABASE"
.replace("HOSTNAME", getHost().trim())
.replace("PORT", getPort().toString().trim())
.replace("DATABASE", getDataBase().trim());
}
}
\ No newline at end of file
...@@ -453,6 +453,12 @@ public class JdbcProvider extends DatasourceProvider { ...@@ -453,6 +453,12 @@ public class JdbcProvider extends DatasourceProvider {
case ck: case ck:
CHConfiguration chConfiguration = new Gson().fromJson(datasourceRequest.getDatasource().getConfiguration(), CHConfiguration.class); CHConfiguration chConfiguration = new Gson().fromJson(datasourceRequest.getDatasource().getConfiguration(), CHConfiguration.class);
return "SELECT name FROM system.tables where database='DATABASE';".replace("DATABASE", chConfiguration.getDataBase()); return "SELECT name FROM system.tables where database='DATABASE';".replace("DATABASE", chConfiguration.getDataBase());
case redshift:
RedshiftConfigration redshiftConfigration = new Gson().fromJson(datasourceRequest.getDatasource().getConfiguration(), RedshiftConfigration.class);
if(StringUtils.isEmpty(redshiftConfigration.getSchema())){
throw new Exception(Translator.get("i18n_schema_is_empty"));
}
return "SELECT tablename FROM pg_tables WHERE schemaname='SCHEMA' ;".replace("SCHEMA", redshiftConfigration.getSchema());
default: default:
return "show tables;"; return "show tables;";
} }
...@@ -487,6 +493,12 @@ public class JdbcProvider extends DatasourceProvider { ...@@ -487,6 +493,12 @@ public class JdbcProvider extends DatasourceProvider {
throw new Exception(Translator.get("i18n_schema_is_empty")); throw new Exception(Translator.get("i18n_schema_is_empty"));
} }
return "SELECT viewname FROM pg_views WHERE schemaname='SCHEMA' ;".replace("SCHEMA", pgConfiguration.getSchema()); return "SELECT viewname FROM pg_views WHERE schemaname='SCHEMA' ;".replace("SCHEMA", pgConfiguration.getSchema());
case redshift:
RedshiftConfigration redshiftConfigration = new Gson().fromJson(datasourceRequest.getDatasource().getConfiguration(), RedshiftConfigration.class);
if(StringUtils.isEmpty(redshiftConfigration.getSchema())){
throw new Exception(Translator.get("i18n_schema_is_empty"));
}
return "SELECT viewname FROM pg_views WHERE schemaname='SCHEMA' ;".replace("SCHEMA", redshiftConfigration.getSchema());
default: default:
return null; return null;
} }
......
...@@ -86,7 +86,7 @@ public abstract class QueryProvider { ...@@ -86,7 +86,7 @@ public abstract class QueryProvider {
} }
} }
public String convertTableToSql(String tableName, Datasource ds) { public String convertTableToSql(String tableName, Datasource ds){
return "select * from tableName"; return "select * from TABLE_NAME".replace("TABLE_NAME", tableName);
} }
} }
package io.dataease.provider.redshift;
import io.dataease.provider.SQLConstants;
import static io.dataease.datasource.constants.DatasourceTypes.pg;
/**
* Redshift 静态变量
*
* @className: RedshiftConstants
* @description: Redshift 静态变量
* @author: Jiantao Yan
* @date: 2021/10/11 17:12
**/
public class RedshiftConstants extends SQLConstants {
public static final String KEYWORD_TABLE = pg.getKeywordPrefix() + "%s" + pg.getKeywordSuffix();
public static final String KEYWORD_FIX = "%s." + pg.getKeywordPrefix() + "%s" + pg.getKeywordSuffix();
public static final String UNIX_TIMESTAMP = "floor(extract(epoch from(( %s - timestamp '1970-01-01 00:00:00')*1000))) ";
public static final String DATE_FORMAT = "to_char(%s, %s)";
public static final String FROM_UNIXTIME = "to_timestamp(%s)";
public static final String TO_DATE = "to_date(%s,'%s')";
public static final String CAST = "CAST(%s AS %s)";
public static final String DEFAULT_DATE_FORMAT = "'YYYY-MM-DD HH24:MI:SS'";
public static final String DEFAULT_INT_FORMAT = "numeric(18,0)";
public static final String DEFAULT_FLOAT_FORMAT = "numeric(18,2)";
public static final String WHERE_VALUE_NULL = "(NULL,'')";
public static final String WHERE_VALUE_VALUE = "'%s'";
public static final String AGG_COUNT = "COUNT(*)";
public static final String AGG_FIELD = "%s(%s)";
public static final String WHERE_BETWEEN = "'%s' AND '%s'";
public static final String BRACKETS = "(%s)";
}
...@@ -1105,13 +1105,12 @@ public class ExtractDataService { ...@@ -1105,13 +1105,12 @@ public class ExtractDataService {
} catch (Exception e) { } catch (Exception e) {
return false; return false;
} }
HttpGet getMethod = new HttpGet("http://" + carte + ":" + port); HttpGet getMethod = new HttpGet("http://" + carte + ":" + port);
HttpClientManager.HttpClientBuilderFacade clientBuilder = HttpClientManager.getInstance().createBuilder(); HttpClientManager.HttpClientBuilderFacade clientBuilder = HttpClientManager.getInstance().createBuilder();
clientBuilder.setConnectionTimeout(1); clientBuilder.setConnectionTimeout(1);
clientBuilder.setCredentials(user, passwd); clientBuilder.setCredentials(user, passwd);
CloseableHttpClient httpClient = clientBuilder.build();
try { try {
CloseableHttpClient httpClient = clientBuilder.build();
HttpResponse httpResponse = httpClient.execute(getMethod); HttpResponse httpResponse = httpClient.execute(getMethod);
int statusCode = httpResponse.getStatusLine().getStatusCode(); int statusCode = httpResponse.getStatusLine().getStatusCode();
if (statusCode != -1 && statusCode < 400) { if (statusCode != -1 && statusCode < 400) {
......
...@@ -50,7 +50,8 @@ ALTER TABLE `chart_view` ADD COLUMN `result_mode` varchar(50) COMMENT '展示 ...@@ -50,7 +50,8 @@ ALTER TABLE `chart_view` ADD COLUMN `result_mode` varchar(50) COMMENT '展示
UPDATE `chart_view` SET `result_count` = 1000; UPDATE `chart_view` SET `result_count` = 1000;
UPDATE `chart_view` SET `result_mode` = 'custom'; UPDATE `chart_view` SET `result_mode` = 'custom';
ALTER TABLE `dataset_table`
MODIFY COLUMN `name` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL;
-- ---------------------------- -- ----------------------------
-- Table structure for sys_theme -- Table structure for sys_theme
......
...@@ -61,6 +61,7 @@ export default { ...@@ -61,6 +61,7 @@ export default {
methods: { methods: {
onSubmit() { onSubmit() {
this.curComponent.hyperlinks = deepCopy(this.linkInfo) this.curComponent.hyperlinks = deepCopy(this.linkInfo)
this.$store.state.styleChangeTimes++
this.popoverClose() this.popoverClose()
}, },
onClose() { onClose() {
......
...@@ -1253,7 +1253,7 @@ export default { ...@@ -1253,7 +1253,7 @@ export default {
export_to_pdf: '导出为PDF', export_to_pdf: '导出为PDF',
preview: '预览', preview: '预览',
fullscreen_preview: '全屏预览', fullscreen_preview: '全屏预览',
ta: '新Tab页预览', new_tab_preview: '新Tab页预览',
select_panel_from_left: '请从左侧选择仪表板', select_panel_from_left: '请从左侧选择仪表板',
template_nale: '模板名称', template_nale: '模板名称',
template: '模板', template: '模板',
......
...@@ -20,10 +20,12 @@ export function baseWaterfallOptionAntV(plot, container, chart, action) { ...@@ -20,10 +20,12 @@ export function baseWaterfallOptionAntV(plot, container, chart, action) {
const xAxis = getXAxis(chart) const xAxis = getXAxis(chart)
const yAxis = getYAxis(chart) const yAxis = getYAxis(chart)
// fix yAxis // fix yAxis
yAxis.min = yAxis.minLimit if (yAxis) {
yAxis.max = yAxis.maxLimit yAxis.min = yAxis.minLimit
delete yAxis.minLimit yAxis.max = yAxis.maxLimit
delete yAxis.maxLimit delete yAxis.minLimit
delete yAxis.maxLimit
}
// data // data
const data = chart.data.datas const data = chart.data.datas
// total // total
......
...@@ -409,7 +409,9 @@ export default { ...@@ -409,7 +409,9 @@ export default {
sql: '', sql: '',
incrementalConfig: {}, incrementalConfig: {},
cronEdit: false, cronEdit: false,
lang: this.$store.getters.language === 'en_US' ? 'en' : 'cn' lang: this.$store.getters.language === 'en_US' ? 'en' : 'cn',
taskLastRequestComplete: true,
taskLogLastRequestComplete: true
} }
}, },
computed: { computed: {
...@@ -430,16 +432,27 @@ export default { ...@@ -430,16 +432,27 @@ export default {
this.calHeight() this.calHeight()
}, },
created() { created() {
this.timer = setInterval(() => { this.taskLogTimer = setInterval(() => {
if (!this.taskLogLastRequestComplete) {
return
} else {
this.taskLogLastRequestComplete = false
}
this.listTaskLog(false) this.listTaskLog(false)
}, 5000) }, 10000)
this.taskTimer = setInterval(() => { this.taskTimer = setInterval(() => {
if (!this.taskLastRequestComplete) {
return
} else {
this.taskLastRequestComplete = false
}
this.listTask(false) this.listTask(false)
}, 5000) }, 10000)
}, },
beforeDestroy() { beforeDestroy() {
clearInterval(this.timer)
clearInterval(this.taskTimer) clearInterval(this.taskTimer)
clearInterval(this.taskLogTimer)
}, },
methods: { methods: {
calHeight() { calHeight() {
...@@ -516,6 +529,9 @@ export default { ...@@ -516,6 +529,9 @@ export default {
listTask(loading = true) { listTask(loading = true) {
post('/dataset/task/list', { tableId: this.table.id }, loading).then(response => { post('/dataset/task/list', { tableId: this.table.id }, loading).then(response => {
this.taskData = response.data this.taskData = response.data
this.taskLastRequestComplete = true
}).catch(() => {
this.taskLastRequestComplete = true
}) })
}, },
getIncrementalConfig() { getIncrementalConfig() {
...@@ -658,6 +674,9 @@ export default { ...@@ -658,6 +674,9 @@ export default {
post('/dataset/taskLog/list/' + this.table.type + '/' + this.page.currentPage + '/' + this.page.pageSize, params, loading).then(response => { post('/dataset/taskLog/list/' + this.table.type + '/' + this.page.currentPage + '/' + this.page.pageSize, params, loading).then(response => {
this.taskLogData = response.data.listObject this.taskLogData = response.data.listObject
this.page.total = response.data.itemCount this.page.total = response.data.itemCount
this.taskLogLastRequestComplete = true
}).catch(() => {
this.taskLogLastRequestComplete = true
}) })
}, },
handleSizeChange(val) { handleSizeChange(val) {
......
...@@ -57,7 +57,7 @@ ...@@ -57,7 +57,7 @@
<union-view :param="param" :table="table" /> <union-view :param="param" :table="table" />
</el-tab-pane> </el-tab-pane>
<el-tab-pane v-if="table.mode === 1 && (table.type === 'excel' || table.type === 'db' || table.type === 'sql')" :label="$t('dataset.update_info')" name="updateInfo"> <el-tab-pane v-if="table.mode === 1 && (table.type === 'excel' || table.type === 'db' || table.type === 'sql')" :label="$t('dataset.update_info')" name="updateInfo">
<update-info :param="param" :table="table" /> <update-info v-if="tabActive=='updateInfo'" :param="param" :table="table" />
</el-tab-pane> </el-tab-pane>
</el-tabs> </el-tabs>
</el-row> </el-row>
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
<el-radio v-model="panel.backgroundType" label="color" @change="onChangeType">{{ $t('chart.color') }}</el-radio> <el-radio v-model="panel.backgroundType" label="color" @change="onChangeType">{{ $t('chart.color') }}</el-radio>
</el-col> </el-col>
<el-col :span="18"> <el-col :span="18">
<el-color-picker v-model="panel.color" size="mini" style="cursor: pointer;z-index: 1004;" /> <el-color-picker v-model="panel.color" size="mini" style="cursor: pointer;z-index: 1004;" @change="onChangeType"/>
</el-col> </el-col>
</el-row> </el-row>
<el-row style="height: 60px;margin-top:10px;overflow: hidden"> <el-row style="height: 60px;margin-top:10px;overflow: hidden">
......
...@@ -159,6 +159,7 @@ export default { ...@@ -159,6 +159,7 @@ export default {
{ name: 'mariadb', label: 'MariaDB', type: 'jdbc', extraParams: 'characterEncoding=UTF-8&connectTimeout=5000&useSSL=false&allowPublicKeyRetrieval=true' }, { name: 'mariadb', label: 'MariaDB', type: 'jdbc', extraParams: 'characterEncoding=UTF-8&connectTimeout=5000&useSSL=false&allowPublicKeyRetrieval=true' },
{ name: 'ds_doris', label: 'Doris', type: 'jdbc', extraParams: 'characterEncoding=UTF-8&connectTimeout=5000&useSSL=false&allowPublicKeyRetrieval=true' }, { name: 'ds_doris', label: 'Doris', type: 'jdbc', extraParams: 'characterEncoding=UTF-8&connectTimeout=5000&useSSL=false&allowPublicKeyRetrieval=true' },
{ name: 'ck', label: 'ClickHouse', type: 'jdbc', extraParams: '' }, { name: 'ck', label: 'ClickHouse', type: 'jdbc', extraParams: '' },
{ name: 'redshift', label: 'AWS Redshift', type: 'jdbc' },
{ name: 'mongo', label: 'MongoDB', type: 'jdbc', extraParams: '' } { name: 'mongo', label: 'MongoDB', type: 'jdbc', extraParams: '' }
], ],
schemas: [], schemas: [],
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论