Merge branch 'dev' into pr@dev_memory_component

This commit is contained in:
dataeaseShu 2022-11-29 12:03:02 +08:00
commit f8a6b33329
37 changed files with 436 additions and 226 deletions

View File

@ -12,4 +12,6 @@ public class AccountLockStatus {
private Long unlockTime;
private Integer relieveTimes;
private Integer remainderTimes;
}

View File

@ -81,8 +81,8 @@ public class AuthServer implements AuthApi {
ValidateResult<XpackLdapUserEntity> validateResult = ldapXpackService.login(request);
if (!validateResult.isSuccess()) {
authUserService.recordLoginFail(username, 1);
DataEaseException.throwException(validateResult.getMsg());
AccountLockStatus lockStatus = authUserService.recordLoginFail(username, 1);
DataEaseException.throwException(appendLoginErrorMsg(validateResult.getMsg(), lockStatus));
}
XpackLdapUserEntity ldapUserEntity = validateResult.getData();
if (StringUtils.isBlank(ldapUserEntity.getEmail())) {
@ -120,19 +120,19 @@ public class AuthServer implements AuthApi {
SysUserEntity user = authUserService.getUserByName(username);
if (ObjectUtils.isEmpty(user)) {
authUserService.recordLoginFail(username, 0);
DataEaseException.throwException(Translator.get("i18n_user_do_not_exist"));
AccountLockStatus lockStatus = authUserService.recordLoginFail(username, 0);
DataEaseException.throwException(appendLoginErrorMsg(Translator.get("i18n_id_or_pwd_error"), lockStatus));
}
// 验证登录类型是否与用户类型相同
if (!sysUserService.validateLoginType(user.getFrom(), loginType)) {
authUserService.recordLoginFail(username, 0);
DataEaseException.throwException(Translator.get("i18n_login_type_error"));
AccountLockStatus lockStatus = authUserService.recordLoginFail(username, 0);
DataEaseException.throwException(appendLoginErrorMsg(Translator.get("i18n_login_type_error"), lockStatus));
}
if (user.getEnabled() == 0) {
authUserService.recordLoginFail(username, 0);
DataEaseException.throwException(Translator.get("i18n_user_is_disable"));
AccountLockStatus lockStatus = authUserService.recordLoginFail(username, 0);
DataEaseException.throwException(appendLoginErrorMsg(Translator.get("i18n_user_is_disable"), lockStatus));
}
String realPwd = user.getPassword();
@ -144,8 +144,8 @@ public class AuthServer implements AuthApi {
pwd = CodingUtil.md5(pwd);
if (!StringUtils.equals(pwd, realPwd)) {
authUserService.recordLoginFail(username, 0);
DataEaseException.throwException(Translator.get("i18n_id_or_pwd_error"));
AccountLockStatus lockStatus = authUserService.recordLoginFail(username, 0);
DataEaseException.throwException(appendLoginErrorMsg(Translator.get("i18n_id_or_pwd_error"), lockStatus));
}
}
@ -161,6 +161,15 @@ public class AuthServer implements AuthApi {
return result;
}
private String appendLoginErrorMsg(String msg, AccountLockStatus lockStatus) {
if (ObjectUtils.isEmpty(lockStatus)) return msg;
if (ObjectUtils.isNotEmpty(lockStatus.getRemainderTimes())) {
String i18n = Translator.get("i18n_login_remainder_times");
msg += String.format(i18n, lockStatus.getRemainderTimes());
}
return msg;
}
@Override
public CurrentUserDto userInfo() {
CurrentUserDto userDto = (CurrentUserDto) SecurityUtils.getSubject().getPrincipal();

View File

@ -55,7 +55,7 @@ public interface AuthUserService {
void checkAdmin(String uname, String pwd);
void recordLoginFail(String username, Integer logintype);
AccountLockStatus recordLoginFail(String username, Integer logintype);
void unlockAccount(String username, Integer logintype);

View File

@ -277,14 +277,16 @@ public class AuthUserServiceImpl implements AuthUserService {
}
@Override
public void recordLoginFail(String username, Integer logintype) {
if (!supportLoginLimit()) return;
public AccountLockStatus recordLoginFail(String username, Integer logintype) {
if (!supportLoginLimit()) return null;
long now = System.currentTimeMillis();
SysLoginLimit sysLoginLimit = new SysLoginLimit();
sysLoginLimit.setUsername(username);
sysLoginLimit.setLoginType(logintype);
sysLoginLimit.setRecordTime(now);
sysLoginLimitMapper.insert(sysLoginLimit);
return lockStatus(username, logintype);
}
@Override
@ -312,13 +314,16 @@ public class AuthUserServiceImpl implements AuthUserService {
SysLoginLimitExample example = new SysLoginLimitExample();
example.createCriteria().andUsernameEqualTo(username).andLoginTypeEqualTo(logintype).andRecordTimeGreaterThan(dividingPointTime);
List<SysLoginLimit> sysLoginLimits = sysLoginLimitMapper.selectByExample(example);
accountLockStatus.setRemainderTimes(limitTimes);
if (CollectionUtils.isNotEmpty(sysLoginLimits)) {
boolean needLock = sysLoginLimits.size() >= limitTimes;
accountLockStatus.setRemainderTimes(limitTimes - sysLoginLimits.size());
accountLockStatus.setLocked(needLock);
if (needLock) {
long unlockTime = now + (longRelieveTimes * 60L * 1000L);
accountLockStatus.setUnlockTime(unlockTime);
accountLockStatus.setRelieveTimes(relieveTimes);
accountLockStatus.setRemainderTimes(0);
}
}

View File

@ -0,0 +1,26 @@
package io.dataease.commons.utils;
import io.dataease.dto.dataset.union.UnionDTO;
import org.apache.commons.collections4.CollectionUtils;
import java.util.List;
/**
* Author: wangjiahao
* Date: 2022/11/28
* Description:
*/
public class DatasetUtils {
public static void getUnionTable(List<String> tableIdList, List<UnionDTO> childrenDs) {
if (CollectionUtils.isNotEmpty(childrenDs)) {
for (UnionDTO unionDTO : childrenDs) {
String tableId = unionDTO.getCurrentDs().getId();
tableIdList.add(tableId);
if (CollectionUtils.isNotEmpty(unionDTO.getChildrenDs())) {
getUnionTable(tableIdList, unionDTO.getChildrenDs());
}
}
}
}
}

View File

@ -8,4 +8,6 @@ import java.util.List;
public interface ExtDataSetTableFieldMapper {
List<DatasetTableField> findByPanelId(@Param("panelId") String panelId);
List<DatasetTableField> findByTableIds(@Param("tableIds") List<String> tableIds);
}

View File

@ -7,23 +7,22 @@
</resultMap>
<select id="findByPanelId" resultMap="BaseResultMapDTO">
select
dataset_table_field.*
select dataset_table_field.*
from dataset_table_field
where table_id in (
SELECT
table_id
FROM
chart_view
WHERE
id IN (
SELECT
chart_view_id
FROM
panel_view
WHERE
panel_id = #{panelId}
)
)
where table_id in (SELECT table_id
FROM chart_view
WHERE id IN (SELECT chart_view_id
FROM panel_view
WHERE panel_id = #{panelId}))
</select>
<select id="findByTableIds" resultMap="BaseResultMapDTO">
select
dataset_table_field.*
from dataset_table_field
where dataset_table_field.table_id in
<foreach collection="tableIds" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</select>
</mapper>

View File

@ -11,8 +11,13 @@ public interface ExtDataSetTableMapper {
List<DataSetTableDTO> search(DataSetTableRequest request);
DataSetTableDTO searchOne(DataSetTableRequest request);
DataSetTableDTO findOneDetails(@Param("datasetTableId") String datasetTableId);
List<DataSetTableDTO> searchDataSetTableWithPanelId(@Param("panelId") String panelId, @Param("userId") String userId);
List<DatasetTable> findByPanelId(@Param("panelId") String panelId);
List<DatasetTable> findByTableIds(@Param("tableIds") List<String> tableIds);
}

View File

@ -25,7 +25,7 @@
`info`,
create_by,
create_time,
( SELECT nick_name FROM sys_user WHERE sys_user.username = dataset_table.create_by ) AS creator_name
(SELECT nick_name FROM sys_user WHERE sys_user.username = dataset_table.create_by) AS creator_name
from dataset_table
where id = #{datasetTableId}
</select>
@ -147,4 +147,13 @@
FROM panel_view
WHERE panel_id = #{panelId}))
</select>
<select id="findByTableIds" resultMap="BaseResultMapDTO">
select dataset_table.*
from dataset_table
where dataset_table.id in
<foreach collection="tableIds" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</select>
</mapper>

View File

@ -1,8 +1,8 @@
package io.dataease.ext;
import io.dataease.ext.query.GridExample;
import io.dataease.dto.dataset.DataSetTaskDTO;
import io.dataease.dto.dataset.DataSetTaskLogDTO;
import io.dataease.ext.query.GridExample;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@ -25,4 +25,6 @@ public interface ExtDataSetTaskMapper {
List<DataSetTaskDTO> taskWithTriggers(GridExample example);
List<DataSetTaskDTO> findByPanelId(@Param("panelId") String panelId);
List<DataSetTaskDTO> findByTableIds(@Param("tableIds") List tableIds);
}

View File

@ -8,19 +8,21 @@
<result column="dataset_name" jdbcType="VARCHAR" property="datasetName"/>
</resultMap>
<resultMap id="TaskResult" type="io.dataease.dto.dataset.DataSetTaskDTO" extends="io.dataease.plugins.common.base.mapper.DatasetTableTaskMapper.BaseResultMap">
<resultMap id="TaskResult" type="io.dataease.dto.dataset.DataSetTaskDTO"
extends="io.dataease.plugins.common.base.mapper.DatasetTableTaskMapper.BaseResultMap">
<result column="table_name" jdbcType="VARCHAR" property="datasetName"/>
<result column="privileges" jdbcType="VARCHAR" property="privileges"/>
<result column="NEXT_FIRE_TIME" jdbcType="BIGINT" property="nextExecTime"/>
</resultMap>
<select id="listTaskLog" resultMap="BaseResult" parameterType="io.dataease.plugins.common.base.domain.DatasetTableTaskLog">
<select id="listTaskLog" resultMap="BaseResult"
parameterType="io.dataease.plugins.common.base.domain.DatasetTableTaskLog">
SELECT dataset_table_task_log.*, dataset_table_task.name, dataset_table.name as dataset_name
FROM dataset_table_task_log
LEFT JOIN dataset_table_task ON dataset_table_task_log.task_id = dataset_table_task.id
LEFT JOIN dataset_table ON dataset_table_task_log.table_id = dataset_table.id
<if test="_parameter != null">
<include refid="io.dataease.ext.query.GridSql.gridCondition" />
<include refid="io.dataease.ext.query.GridSql.gridCondition"/>
</if>
<if test="orderByClause != null">
order by ${orderByClause}
@ -30,13 +32,14 @@
</if>
</select>
<select id="listUserTaskLog" resultMap="BaseResult" parameterType="io.dataease.plugins.common.base.domain.DatasetTableTaskLog">
<select id="listUserTaskLog" resultMap="BaseResult"
parameterType="io.dataease.plugins.common.base.domain.DatasetTableTaskLog">
SELECT dataset_table_task_log.*, dataset_table_task.name, dataset_table.name as dataset_name
FROM dataset_table_task_log
LEFT JOIN dataset_table_task ON dataset_table_task_log.task_id = dataset_table_task.id
LEFT JOIN dataset_table ON dataset_table_task_log.table_id = dataset_table.id
<if test="_parameter != null">
<include refid="io.dataease.ext.query.GridSql.taskListGridCondition" />
<include refid="io.dataease.ext.query.GridSql.taskListGridCondition"/>
</if>
<if test="orderByClause != null">
order by ${orderByClause}
@ -47,12 +50,13 @@
</select>
<select id="taskList" resultMap="TaskResult" parameterType="io.dataease.ext.query.GridExample">
SELECT dataset_table.name as table_name, 'grant,manage,use' as `privileges`,dataset_table_task.* , qrtz_triggers.NEXT_FIRE_TIME
SELECT dataset_table.name as table_name, 'grant,manage,use' as `privileges`,dataset_table_task.* ,
qrtz_triggers.NEXT_FIRE_TIME
FROM dataset_table_task
left join dataset_table on dataset_table.id=dataset_table_task.table_id
left join qrtz_triggers on dataset_table_task.id=qrtz_triggers.TRIGGER_NAME
<if test="_parameter != null">
<include refid="io.dataease.ext.query.GridSql.gridCondition" />
<include refid="io.dataease.ext.query.GridSql.gridCondition"/>
</if>
<if test="orderByClause != null">
order by ${orderByClause}
@ -63,12 +67,13 @@
</select>
<select id="userTaskList" resultMap="TaskResult" parameterType="io.dataease.ext.query.GridExample">
SELECT dataset_table.name as table_name, get_auths(dataset_table_task.table_id,'dataset', #{extendCondition}) as `privileges`,dataset_table_task.* , qrtz_triggers.NEXT_FIRE_TIME
SELECT dataset_table.name as table_name, get_auths(dataset_table_task.table_id,'dataset', #{extendCondition}) as
`privileges`,dataset_table_task.* , qrtz_triggers.NEXT_FIRE_TIME
FROM dataset_table_task
left join dataset_table on dataset_table.id=dataset_table_task.table_id
left join qrtz_triggers on dataset_table_task.id=qrtz_triggers.TRIGGER_NAME
<if test="_parameter != null">
<include refid="io.dataease.ext.query.GridSql.taskListGridCondition" />
<include refid="io.dataease.ext.query.GridSql.taskListGridCondition"/>
</if>
<if test="orderByClause != null">
order by ${orderByClause}
@ -79,12 +84,13 @@
</select>
<select id="taskWithTriggers" resultMap="TaskResult" parameterType="io.dataease.ext.query.GridExample">
SELECT dataset_table.name as table_name, get_auths(dataset_table_task.table_id,'dataset', #{extendCondition}) as `privileges`,dataset_table_task.* , qrtz_triggers.NEXT_FIRE_TIME
SELECT dataset_table.name as table_name, get_auths(dataset_table_task.table_id,'dataset', #{extendCondition}) as
`privileges`,dataset_table_task.* , qrtz_triggers.NEXT_FIRE_TIME
FROM dataset_table_task
left join dataset_table on dataset_table.id=dataset_table_task.table_id
left join qrtz_triggers on dataset_table_task.id=qrtz_triggers.TRIGGER_NAME
<if test="_parameter != null">
<include refid="io.dataease.ext.query.GridSql.gridCondition" />
<include refid="io.dataease.ext.query.GridSql.gridCondition"/>
</if>
<if test="orderByClause != null">
order by ${orderByClause}
@ -95,26 +101,23 @@
</select>
<select id="findByPanelId" resultMap="TaskResult">
select
dataset_table_task.*
select dataset_table_task.*
from dataset_table_task
where id in (
SELECT
table_id
FROM
chart_view
WHERE
id IN (
SELECT
chart_view_id
FROM
panel_view
WHERE
panel_id = #{panelId}
)
)
where id in (SELECT table_id
FROM chart_view
WHERE id IN (SELECT chart_view_id
FROM panel_view
WHERE panel_id = #{panelId}))
</select>
<select id="findByTableIds" resultMap="TaskResult">
select dataset_table_task.*
from dataset_table_task
where dataset_table_task.table_id in
<foreach collection="tableIds" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</select>
</mapper>

View File

@ -1,8 +1,8 @@
package io.dataease.ext;
import io.dataease.ext.query.GridExample;
import io.dataease.controller.request.DatasourceUnionRequest;
import io.dataease.dto.DatasourceDTO;
import io.dataease.ext.query.GridExample;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@ -15,7 +15,9 @@ public interface ExtDataSourceMapper {
List<DatasourceDTO> findByPanelId(@Param("panelId") String panelId);
DatasourceDTO queryDetails(@Param("datasourceId") String datasourceId,@Param("userId") String userId);
List<DatasourceDTO> findByTableIds(@Param("tableIds") List<String> tableIds);
DatasourceDTO queryDetails(@Param("datasourceId") String datasourceId, @Param("userId") String userId);
}

View File

@ -130,6 +130,19 @@
WHERE panel_view.panel_id = #{panelId}
</select>
<select id="findByTableIds" resultMap="BaseResultMapDTO">
SELECT DISTINCT datasource.id,
datasource.`name`,
datasource.DESC,
datasource.type
FROM dataset_table
INNER JOIN datasource ON dataset_table.data_source_id = datasource.id
WHERE dataset_table.id in
<foreach collection="tableIds" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</select>
<select id="queryDetails" resultMap="BaseResultMapDTO">
select datasource.*,
get_auths(id, 'link', #{userId}) as `privileges`

View File

@ -364,10 +364,11 @@ public class DorisQueryProvider extends QueryProvider {
@Override
public String getSQLWithPage(boolean isTable, String table, List<ChartViewFieldDTO> xAxis, List<ChartFieldCustomFilterDTO> fieldCustomFilter, List<DataSetRowPermissionsTreeDTO> rowPermissionsTree, List<ChartExtFilterRequest> extFilterRequestList, Datasource ds, ChartViewWithBLOBs view, PageInfo pageInfo) {
String limit = ((pageInfo.getGoPage() != null && pageInfo.getPageSize() != null) ? " LIMIT " + (pageInfo.getGoPage() - 1) * pageInfo.getPageSize() + "," + pageInfo.getPageSize() : "");
if (isTable) {
return originalTableInfo(table, xAxis, fieldCustomFilter, rowPermissionsTree, extFilterRequestList, ds, view) + " LIMIT " + (pageInfo.getGoPage() - 1) * pageInfo.getPageSize() + "," + pageInfo.getPageSize();
return originalTableInfo(table, xAxis, fieldCustomFilter, rowPermissionsTree, extFilterRequestList, ds, view) + limit;
} else {
return originalTableInfo("(" + sqlFix(table) + ")", xAxis, fieldCustomFilter, rowPermissionsTree, extFilterRequestList, ds, view) + " LIMIT " + (pageInfo.getGoPage() - 1) * pageInfo.getPageSize() + "," + pageInfo.getPageSize();
return originalTableInfo("(" + sqlFix(table) + ")", xAxis, fieldCustomFilter, rowPermissionsTree, extFilterRequestList, ds, view) + limit;
}
}

View File

@ -364,10 +364,11 @@ public class MysqlQueryProvider extends QueryProvider {
@Override
public String getSQLWithPage(boolean isTable, String table, List<ChartViewFieldDTO> xAxis, List<ChartFieldCustomFilterDTO> fieldCustomFilter, List<DataSetRowPermissionsTreeDTO> rowPermissionsTree, List<ChartExtFilterRequest> extFilterRequestList, Datasource ds, ChartViewWithBLOBs view, PageInfo pageInfo) {
String limit = ((pageInfo.getGoPage() != null && pageInfo.getPageSize() != null) ? " LIMIT " + (pageInfo.getGoPage() - 1) * pageInfo.getPageSize() + "," + pageInfo.getPageSize() : "");
if (isTable) {
return originalTableInfo(table, xAxis, fieldCustomFilter, rowPermissionsTree, extFilterRequestList, ds, view) + " LIMIT " + (pageInfo.getGoPage() - 1) * pageInfo.getPageSize() + "," + pageInfo.getPageSize();
return originalTableInfo(table, xAxis, fieldCustomFilter, rowPermissionsTree, extFilterRequestList, ds, view) + limit;
} else {
return originalTableInfo("(" + sqlFix(table) + ")", xAxis, fieldCustomFilter, rowPermissionsTree, extFilterRequestList, ds, view) + " LIMIT " + (pageInfo.getGoPage() - 1) * pageInfo.getPageSize() + "," + pageInfo.getPageSize();
return originalTableInfo("(" + sqlFix(table) + ")", xAxis, fieldCustomFilter, rowPermissionsTree, extFilterRequestList, ds, view) + limit;
}
}

View File

@ -381,10 +381,11 @@ public class MysqlQueryProvider extends QueryProvider {
@Override
public String getSQLWithPage(boolean isTable, String table, List<ChartViewFieldDTO> xAxis, List<ChartFieldCustomFilterDTO> fieldCustomFilter, List<DataSetRowPermissionsTreeDTO> rowPermissionsTree, List<ChartExtFilterRequest> extFilterRequestList, Datasource ds, ChartViewWithBLOBs view, PageInfo pageInfo) {
if(isTable){
return originalTableInfo(table, xAxis, fieldCustomFilter, rowPermissionsTree, extFilterRequestList, ds, view) + " LIMIT " + (pageInfo.getGoPage() - 1) * pageInfo.getPageSize() + "," + pageInfo.getPageSize();
}else {
return originalTableInfo("(" + sqlFix(table) + ")", xAxis, fieldCustomFilter, rowPermissionsTree, extFilterRequestList, ds, view) + " LIMIT " + (pageInfo.getGoPage() - 1) * pageInfo.getPageSize() + "," + pageInfo.getPageSize();
String limit = ((pageInfo.getGoPage() != null && pageInfo.getPageSize() != null) ? " LIMIT " + (pageInfo.getGoPage() - 1) * pageInfo.getPageSize() + "," + pageInfo.getPageSize() : "");
if (isTable) {
return originalTableInfo(table, xAxis, fieldCustomFilter, rowPermissionsTree, extFilterRequestList, ds, view) + limit;
} else {
return originalTableInfo("(" + sqlFix(table) + ")", xAxis, fieldCustomFilter, rowPermissionsTree, extFilterRequestList, ds, view) + limit;
}
}

View File

@ -1011,7 +1011,7 @@ public class ChartDataBuild {
} else {
switch (columnPermissionItem.getDesensitizationRule().getCustomBuiltInRule()) {
case RetainBeforeMAndAfterN:
if (StringUtils.isEmpty(originStr) || originStr.length() < columnPermissionItem.getDesensitizationRule().getM() + columnPermissionItem.getDesensitizationRule().getN() + 1) {
if (StringUtils.isEmpty(originStr) || originStr.length() <= columnPermissionItem.getDesensitizationRule().getM() + columnPermissionItem.getDesensitizationRule().getN() + 1) {
desensitizationStr = String.join("", Collections.nCopies(columnPermissionItem.getDesensitizationRule().getM(), "X")) + "***" + String.join("", Collections.nCopies(columnPermissionItem.getDesensitizationRule().getN(), "X"));
} else {
desensitizationStr = StringUtils.substring(originStr, 0, columnPermissionItem.getDesensitizationRule().getM() - 1) + "***" + StringUtils.substring(originStr, originStr.length() - columnPermissionItem.getDesensitizationRule().getN(), originStr.length() - 1);

View File

@ -116,4 +116,8 @@ public class DataSetTableFieldsService {
public void delete(String id) {
datasetTableFieldMapper.deleteByPrimaryKey(id);
}
public void updateByPrimaryKeySelective(DatasetTableField request) {
datasetTableFieldMapper.updateByPrimaryKeySelective(request);
}
}

View File

@ -13,6 +13,7 @@ import io.dataease.plugins.common.dto.chart.ChartCustomFilterItemDTO;
import io.dataease.plugins.common.dto.chart.ChartFieldCustomFilterDTO;
import io.dataease.plugins.config.SpringContextUtil;
import io.dataease.plugins.xpack.auth.dto.request.*;
import io.dataease.plugins.xpack.auth.dto.response.Item;
import io.dataease.plugins.xpack.auth.service.ColumnPermissionService;
import io.dataease.plugins.xpack.auth.service.RowPermissionService;
import org.apache.commons.collections4.CollectionUtils;
@ -112,14 +113,14 @@ public class PermissionService {
}
if (CollectionUtils.isNotEmpty(fieldRoleColumnPermissionItems)) {
if (fieldRoleColumnPermissionItems.stream().map(ColumnPermissionItem::getOpt).collect(Collectors.toList()).contains(ColumnPermissionConstants.Desensitization)) {
desensitizationList.put(field.getDataeaseName(), fieldUserColumnPermissionItems.get(0));
desensitizationList.put(field.getDataeaseName(), fieldRoleColumnPermissionItems.get(0));
result.add(field);
}
return;
}
if (CollectionUtils.isNotEmpty(fieldDeptColumnPermissionItems)) {
if (fieldDeptColumnPermissionItems.stream().map(ColumnPermissionItem::getOpt).collect(Collectors.toList()).contains(ColumnPermissionConstants.Desensitization)) {
desensitizationList.put(field.getDataeaseName(), fieldUserColumnPermissionItems.get(0));
desensitizationList.put(field.getDataeaseName(), fieldDeptColumnPermissionItems.get(0));
result.add(field);
}
return;
@ -209,34 +210,46 @@ public class PermissionService {
dataSetColumnPermissionsDTO.setAuthTargetType("user");
datasetColumnPermissions.addAll(columnPermissionService.searchPermissions(dataSetColumnPermissionsDTO));
if (CollectionUtils.isNotEmpty(roleIds)) {
dataSetColumnPermissionsDTO.setAuthTargetIds(roleIds);
dataSetColumnPermissionsDTO.setAuthTargetType("role");
List<DataSetColumnPermissionsDTO> roleColumnPermissionsDTOS = new ArrayList<>();
for (DataSetColumnPermissionsDTO columnPermissionsDTO : columnPermissionService.searchPermissions(dataSetColumnPermissionsDTO)) {
columnPermissionsDTO.getWhiteListUser();
List<Long> userIdList = new Gson().fromJson(columnPermissionsDTO.getWhiteListUser(), new TypeToken<List<Long>>() {
}.getType());
if (CollectionUtils.isEmpty(userIdList) || !userIdList.contains(userId)) {
roleColumnPermissionsDTOS.add(columnPermissionsDTO);
DataSetColumnPermissionsDTO request = new DataSetColumnPermissionsDTO();
request.setDatasetId(datasetId);
request.setAuthTargetType("role");
List<Item> items = (List<Item>)columnPermissionService.authObjs(request);
roleIds = roleIds.stream().filter(id -> {return items.stream().map(Item::getId).collect(Collectors.toList()).contains(id);}).collect(Collectors.toList());
if(CollectionUtils.isNotEmpty(roleIds)){
dataSetColumnPermissionsDTO.setAuthTargetIds(roleIds);
dataSetColumnPermissionsDTO.setAuthTargetType("role");
List<DataSetColumnPermissionsDTO> roleColumnPermissionsDTOS = new ArrayList<>();
for (DataSetColumnPermissionsDTO columnPermissionsDTO : columnPermissionService.searchPermissions(dataSetColumnPermissionsDTO)) {
columnPermissionsDTO.getWhiteListUser();
List<Long> userIdList = new Gson().fromJson(columnPermissionsDTO.getWhiteListUser(), new TypeToken<List<Long>>() {
}.getType());
if (CollectionUtils.isEmpty(userIdList) || !userIdList.contains(userId)) {
roleColumnPermissionsDTOS.add(columnPermissionsDTO);
}
}
datasetColumnPermissions.addAll(roleColumnPermissionsDTOS);
}
datasetColumnPermissions.addAll(roleColumnPermissionsDTOS);
}
if (deptId != null) {
dataSetColumnPermissionsDTO.setAuthTargetIds(Collections.singletonList(deptId));
dataSetColumnPermissionsDTO.setAuthTargetType("dept");
List<DataSetColumnPermissionsDTO> deptColumnPermissionsDTOS = new ArrayList<>();
for (DataSetColumnPermissionsDTO columnPermissionsDTO : columnPermissionService.searchPermissions(dataSetColumnPermissionsDTO)) {
List<Long> userIdList = new Gson().fromJson(columnPermissionsDTO.getWhiteListUser(), new TypeToken<List<Long>>() {
}.getType());
if (CollectionUtils.isEmpty(userIdList) || !userIdList.contains(userId)) {
deptColumnPermissionsDTOS.add(columnPermissionsDTO);
DataSetColumnPermissionsDTO request = new DataSetColumnPermissionsDTO();
request.setDatasetId(datasetId);
request.setAuthTargetType("dept");
List<Item> items = (List<Item>)columnPermissionService.authObjs(request);
if(items.stream().map(Item::getId).collect(Collectors.toList()).contains(deptId)){
dataSetColumnPermissionsDTO.setAuthTargetIds(Collections.singletonList(deptId));
dataSetColumnPermissionsDTO.setAuthTargetType("dept");
List<DataSetColumnPermissionsDTO> deptColumnPermissionsDTOS = new ArrayList<>();
for (DataSetColumnPermissionsDTO columnPermissionsDTO : columnPermissionService.searchPermissions(dataSetColumnPermissionsDTO)) {
List<Long> userIdList = new Gson().fromJson(columnPermissionsDTO.getWhiteListUser(), new TypeToken<List<Long>>() {
}.getType());
if (CollectionUtils.isEmpty(userIdList) || !userIdList.contains(userId)) {
deptColumnPermissionsDTOS.add(columnPermissionsDTO);
}
}
datasetColumnPermissions.addAll(deptColumnPermissionsDTOS);
}
datasetColumnPermissions.addAll(deptColumnPermissionsDTOS);
}
return datasetColumnPermissions;
}

View File

@ -5,6 +5,7 @@ import io.dataease.commons.constants.CommonConstants;
import io.dataease.commons.constants.PanelConstants;
import io.dataease.commons.utils.AuthUtils;
import io.dataease.commons.utils.BeanUtils;
import io.dataease.commons.utils.TableUtils;
import io.dataease.controller.datasource.request.UpdataDsRequest;
import io.dataease.controller.request.dataset.DataSetTableRequest;
import io.dataease.controller.request.panel.PanelAppTemplateApplyRequest;
@ -197,28 +198,44 @@ public class PanelAppTemplateService {
}
@Transactional(rollbackFor = Exception.class)
public Map<String, String> applyDatasetField(List<DatasetTableField> datasetTableFieldsInfo, Map<String, String> datasetsRealMap) {
public Map<String, String> applyDatasetField(List<DatasetTableField> datasetTableFieldsInfo, Map<String, String> datasetsRealMap, Map<String, String> datasetTypeRealMap, Map<String, String> datasetFieldsMd5FormatRealMap) {
Map<String, String> datasetFieldsRealMap = new HashMap<>();
for (DatasetTableField datasetTableField : datasetTableFieldsInfo) {
if (datasetTableField.getExtField() != 2) {
String oldId = datasetTableField.getId();
datasetTableField.setTableId(datasetsRealMap.get(datasetTableField.getTableId()));
String oldTableId = datasetTableField.getTableId();
datasetTableField.setTableId(datasetsRealMap.get(oldTableId));
datasetTableField.setId(null);
DatasetTableField newTableField = dataSetTableFieldsService.save(datasetTableField);
datasetFieldsRealMap.put(oldId, newTableField.getId());
datasetFieldsMd5FormatRealMap.put(TableUtils.fieldNameShort(oldTableId + "_" + datasetTableField.getOriginName()), TableUtils.fieldNameShort(newTableField.getTableId() + "_" + datasetTableField.getOriginName()));
System.out.println();
}
}
//数据集计算字段替换
for (DatasetTableField datasetTableField : datasetTableFieldsInfo) {
if (datasetTableField.getExtField() == 2) {
String oldId = datasetTableField.getId();
datasetTableField.setTableId(datasetsRealMap.get(datasetTableField.getTableId()));
String oldTableId = datasetTableField.getTableId();
String oldOriginName = datasetTableField.getOriginName();
datasetTableField.setTableId(datasetsRealMap.get(oldTableId));
datasetTableField.setId(null);
datasetFieldsRealMap.forEach((k, v) -> {
datasetTableField.setOriginName(datasetTableField.getOriginName().replaceAll(k, v));
});
DatasetTableField newTableField = dataSetTableFieldsService.save(datasetTableField);
datasetFieldsRealMap.put(oldId, newTableField.getId());
datasetFieldsMd5FormatRealMap.put(TableUtils.fieldNameShort(oldTableId + "_" + oldOriginName), TableUtils.fieldNameShort(newTableField.getTableId() + "_" + datasetTableField.getOriginName()));
}
}
//custom union originName替换
for (DatasetTableField datasetTableField : datasetTableFieldsInfo) {
if (DatasetType.UNION.name().equalsIgnoreCase(datasetTypeRealMap.get(datasetTableField.getTableId())) || DatasetType.CUSTOM.name().equalsIgnoreCase(datasetTypeRealMap.get(datasetTableField.getTableId()))) {
DatasetTableField updateField = new DatasetTableField();
updateField.setId(datasetTableField.getId());
updateField.setOriginName(datasetFieldsMd5FormatRealMap.get(datasetTableField.getOriginName()));
dataSetTableFieldsService.updateByPrimaryKeySelective(updateField);
}
}
return datasetFieldsRealMap;
@ -248,7 +265,7 @@ public class PanelAppTemplateService {
}
@Transactional(rollbackFor = Exception.class)
public Map<String, String> applyViews(List<ChartViewWithBLOBs> chartViewsInfo, Map<String, String> datasetsRealMap, Map<String, String> datasetFieldsRealMap, String sceneId) throws Exception {
public Map<String, String> applyViews(List<ChartViewWithBLOBs> chartViewsInfo, Map<String, String> datasetsRealMap, Map<String, String> datasetFieldsRealMap, Map<String, String> datasetFieldsMd5FormatRealMap, String sceneId) throws Exception {
Map<String, String> chartViewsRealMap = new HashMap<>();
for (ChartViewWithBLOBs chartView : chartViewsInfo) {
String oldViewId = chartView.getId();
@ -279,6 +296,19 @@ public class PanelAppTemplateService {
chartView.setCustomFilter(chartView.getCustomFilter().replaceAll(k, v));
chartView.setDrillFields(chartView.getDrillFields().replaceAll(k, v));
});
//替换originName
datasetFieldsMd5FormatRealMap.forEach((k, v) -> {
chartView.setXAxis(chartView.getXAxis().replaceAll(k, v));
chartView.setXAxisExt(chartView.getXAxisExt().replaceAll(k, v));
chartView.setYAxis(chartView.getYAxis().replaceAll(k, v));
chartView.setYAxisExt(chartView.getYAxisExt().replaceAll(k, v));
chartView.setExtStack(chartView.getExtStack().replaceAll(k, v));
chartView.setExtBubble(chartView.getExtBubble().replaceAll(k, v));
chartView.setCustomAttr(chartView.getCustomAttr().replaceAll(k, v));
chartView.setCustomStyle(chartView.getCustomStyle().replaceAll(k, v));
chartView.setCustomFilter(chartView.getCustomFilter().replaceAll(k, v));
chartView.setDrillFields(chartView.getDrillFields().replaceAll(k, v));
});
chartView.setId(null);
chartView.setSceneId(sceneId);
ChartViewWithBLOBs newOne = chartViewService.newOne(chartView);

View File

@ -18,6 +18,7 @@ import io.dataease.dto.chart.ChartViewDTO;
import io.dataease.dto.dataset.DataSetGroupDTO;
import io.dataease.dto.dataset.DataSetTableDTO;
import io.dataease.dto.dataset.DataSetTaskDTO;
import io.dataease.dto.dataset.DataTableInfoDTO;
import io.dataease.dto.panel.PanelExport2App;
import io.dataease.dto.panel.PanelGroupDTO;
import io.dataease.dto.panel.PanelTemplateFileDTO;
@ -313,7 +314,9 @@ public class PanelGroupService {
panelGroup.setPanelStyle(sourcePanel.getPanelStyle());
panelGroup.setSourcePanelName(sourcePanel.getName());
}
panelGroup.setWatermarkInfo(panelWatermarkMapper.selectByPrimaryKey("system_default"));
if (panelGroup != null) {
panelGroup.setWatermarkInfo(panelWatermarkMapper.selectByPrimaryKey("system_default"));
}
return panelGroup;
}
@ -808,12 +811,42 @@ public class PanelGroupService {
List<ChartViewField> chartViewFieldsInfo = extChartViewFieldMapper.findByPanelId(panelId);
//3.获取所有数据集信息
List<DatasetTable> datasetTablesInfo = extDataSetTableMapper.findByPanelId(panelId);
List<String> attachTableIds = new ArrayList<>();
if (CollectionUtils.isNotEmpty(datasetTablesInfo)) {
for (DatasetTable datasetTable : datasetTablesInfo) {
if ("union".equals(datasetTable.getType()) && StringUtils.isNotEmpty(datasetTable.getInfo())) {
DataTableInfoDTO dt = gson.fromJson(datasetTable.getInfo(), DataTableInfoDTO.class);
DatasetUtils.getUnionTable(attachTableIds, dt.getUnion());
} else if ("custom".equals(datasetTable.getType()) && StringUtils.isNotEmpty(datasetTable.getInfo())) {
Map result = gson.fromJson(datasetTable.getInfo(), Map.class);
List<Map> list = (List<Map>) result.get("list");
if (CollectionUtils.isNotEmpty(list)) {
for (Map details : list) {
attachTableIds.add(String.valueOf(details.get("tableId")));
}
}
}
}
if (CollectionUtils.isNotEmpty(attachTableIds)) {
List<DatasetTable> attachDatasetTables = extDataSetTableMapper.findByTableIds(attachTableIds);
if (CollectionUtils.isNotEmpty(attachDatasetTables)) {
datasetTablesInfo.addAll(attachDatasetTables);
}
}
}
// dataset check
if (CollectionUtils.isEmpty(datasetTablesInfo)) {
return new PanelExport2App(Translator.get("I18N_APP_NO_DATASET_ERROR"));
} else if (datasetTablesInfo.stream().filter(datasetTable -> datasetTable.getType().equals("excel") || datasetTable.getType().equals("api")).collect(Collectors.toList()).size() > 0) {
return new PanelExport2App(Translator.get("I18N_APP_ERROR_DATASET"));
}
List<String> allTableIds = datasetTablesInfo.stream().map(DatasetTable::getId).collect(Collectors.toList());
//4.获取所有数据集字段信息
List<DatasetTableField> datasetTableFieldsInfo = extDataSetTableFieldMapper.findByPanelId(panelId);
List<DatasetTableField> datasetTableFieldsInfo = extDataSetTableFieldMapper.findByTableIds(allTableIds);
//5.获取所有任务信息
List<DataSetTaskDTO> dataSetTasksInfo = extDataSetTaskMapper.findByPanelId(panelId);
List<DataSetTaskDTO> dataSetTasksInfo = extDataSetTaskMapper.findByTableIds(allTableIds);
//6.获取所有数据源信息
List<DatasourceDTO> datasourceDTOS = extDataSourceMapper.findByPanelId(panelId);
List<DatasourceDTO> datasourceDTOS = extDataSourceMapper.findByTableIds(allTableIds);
List<PanelView> panelViews = panelViewService.findPanelViewsByPanelId(panelId);
@ -825,13 +858,6 @@ public class PanelGroupService {
return new PanelExport2App(Translator.get("I18N_APP_TEMPLATE_VIEW_ERROR"));
}
// dataset check
if (CollectionUtils.isEmpty(datasetTablesInfo)) {
return new PanelExport2App(Translator.get("I18N_APP_NO_DATASET_ERROR"));
} else if (datasetTablesInfo.stream().filter(datasetTable -> datasetTable.getType().equals("excel") || datasetTable.getType().equals("api")).collect(Collectors.toList()).size() > 0) {
return new PanelExport2App(Translator.get("I18N_APP_ERROR_DATASET"));
}
//datasource check
if (CollectionUtils.isEmpty(datasourceDTOS)) {
return new PanelExport2App(Translator.get("I18N_APP_NO_DATASOURCE"));
@ -885,11 +911,15 @@ public class PanelGroupService {
Map<String, String> datasetsRealMap = panelAppTemplateService.applyDataset(datasetTablesInfo, datasourceRealMap, asideDatasetGroupId);
Map<String, String> datasetFieldsRealMap = panelAppTemplateService.applyDatasetField(datasetTableFieldsInfo, datasetsRealMap);
Map<String, String> datasetTypeRealMap = datasetTablesInfo.stream().collect(Collectors.toMap(DatasetTable::getId, DatasetTable::getType));
Map<String, String> datasetFieldsMd5FormatRealMap = new HashMap<>();
Map<String, String> datasetFieldsRealMap = panelAppTemplateService.applyDatasetField(datasetTableFieldsInfo, datasetsRealMap, datasetTypeRealMap, datasetFieldsMd5FormatRealMap);
panelAppTemplateService.resetCustomAndUnionDataset(datasetTablesInfo, datasetsRealMap, datasetFieldsRealMap);
Map<String, String> chartViewsRealMap = panelAppTemplateService.applyViews(chartViewsInfo, datasetsRealMap, datasetFieldsRealMap, newPanelId);
Map<String, String> chartViewsRealMap = panelAppTemplateService.applyViews(chartViewsInfo, datasetsRealMap, datasetFieldsRealMap, datasetFieldsMd5FormatRealMap, newPanelId);
panelAppTemplateService.applyViewsField(chartViewFieldsInfo, chartViewsRealMap, datasetsRealMap, datasetFieldsRealMap);

View File

@ -73,28 +73,7 @@ dataease.sqlinjection.whitelists=/dataset/table/sqlPreview,/dataset/table/update
server.compression.enabled=true
server.compression.mime-types=application/javascript,text/css,application/json,application/xml,text/html,text/xml,text/plain
server.compression.min-response-size=1024
#\u4E0B\u9762\u7684\u914D\u7F6E\u65B0\u589E\u5230/opt/dataease/conf/dataease/properties
#\u7F13\u5B58\u7C7B\u578B
##spring.cache.type=redis
#spring.cache.type=ehcache
#redis\u516C\u5171\u914D\u7F6E
#spring.redis.timeout=10000
#spring.redis.lettuce.pool.max-active=8
#spring.redis.lettuce.pool.max-wait=-1
#spring.redis.lettuce.pool.max-idle=8
#\u5355\u673A\u6A21\u5F0Fredis\u914D\u7F6E
#spring.redis.database=0
#spring.redis.host=192.168.0.110
#spring.redis.port=6379
#spring.redis.password=DataEase_ZNB@REDIS
#\u54E8\u5175\u6A21\u5F0Fredis\u914D\u7F6E
#spring.redis.sentinel.master=mymaster
#spring.redis.sentinel.nodes=192.168.0.110:26379,192.168.0.110:26380,192.168.0.110:26381
#spring.redis.sentinel.password=
#cluster\u6A21\u5F0Fredis\u914D\u7F6E
#spring.redis.cluster.nodes=192.168.0.110:7001,192.168.0.110:7002,192.168.0.110:7003,192.168.0.110:7004,192.168.0.110:7005,192.168.0.110:7006
#spring.redis.cluster.max-redirects=3
#spring.redis.password=DataEase_ZNB@REDIS
server.servlet.context-parameters.configurationStrategy=SYSTEM_PROPERTIES
server.servlet.session.cookie.http-only=true
server.servlet.session.tracking-modes=cookie

View File

@ -75,6 +75,7 @@ i18n_sql_not_empty=SQL can not be empty.
i18n_datasource_not_allow_delete_msg=datasets are using this data source and cannot be deleted
i18n_task_name_repeat=Name is used in same data set
i18n_id_or_pwd_error=Invalid ID or password
i18n_login_remainder_times=(You can still enter %s times)
i18n_user_do_not_exist=User do not exist
i18n_user_is_disable=User is disabled
i18n_login_type_error=Login type error

View File

@ -75,6 +75,7 @@ i18n_sql_not_empty=SQL \u4E0D\u80FD\u4E3A\u7A7A
i18n_datasource_not_allow_delete_msg=\u4E2A\u6570\u636E\u96C6\u6B63\u5728\u4F7F\u7528\u6B64\u6570\u636E\u6E90\uFF0C\u65E0\u6CD5\u5220\u9664
i18n_task_name_repeat=\u540C\u4E00\u6570\u636E\u96C6\u4E0B\u4EFB\u52A1\u540D\u79F0\u5DF2\u88AB\u4F7F\u7528
i18n_id_or_pwd_error=\u65E0\u6548\u7684ID\u6216\u5BC6\u7801
i18n_login_remainder_times=(\u8FD8\u80FD\u8F93\u5165%s\u6B21)
i18n_user_do_not_exist=\u7528\u6237\u4E0D\u5B58\u5728
i18n_user_is_disable=\u7528\u6237\u72B6\u6001\u65E0\u6548
i18n_login_type_error=\u767B\u5F55\u65B9\u5F0F\u9519\u8BEF

View File

@ -75,6 +75,7 @@ i18n_sql_not_empty=SQL \u4E0D\u80FD\u70BA\u7A7A
i18n_datasource_not_allow_delete_msg=\u500B\u6578\u64DA\u96C6\u6B63\u5728\u4F7F\u7528\u6B64\u6578\u64DA\u6E90\uFF0C\u7121\u6CD5\u522A\u9664
i18n_task_name_repeat=\u540C\u4E00\u6578\u64DA\u96C6\u4E0B\u4EFB\u52D9\u540D\u7A31\u5DF2\u88AB\u4F7F\u7528
i18n_id_or_pwd_error=\u7121\u6548\u7684ID\u6216\u5BC6\u78BC
i18n_login_remainder_times=(\u9084\u80FD\u8F38\u5165%s\u6B21)
i18n_user_do_not_exist=\u7528\u6236\u4E0D\u5B58\u5728
i18n_user_is_disable=\u7528\u6236\u72C0\u614B\u7121\u6548
i18n_login_type_error=\u767B\u9304\u65B9\u5F0F\u932F\u8AA4

View File

@ -8,6 +8,15 @@ export function post(url, data, loading = false) {
data
})
}
export function tableField(id) {
return request({
url: '/dataset/table/getWithPermission/' + id,
method: 'post',
loading: true,
hideMsg: true,
timeout: 60000
})
}
export function getChartTree(data) {
return request({

View File

@ -724,6 +724,7 @@ export default {
// echart
if (response.success) {
this.chart = response.data
this.view = response.data
this.$emit('fill-chart-2-parent', this.chart)
this.getDataOnly(response.data, dataBroadcast)
this.chart['position'] = this.inTab ? 'tab' : 'panel'
@ -1181,6 +1182,7 @@ export default {
}
viewData(this.chart.id, this.panelInfo.id, requestInfo).then(response => {
this.componentViewsData[this.chart.id] = response.data
this.view = response.data
if (dataBroadcast) {
bus.$emit('prop-change-data')
}

View File

@ -6,7 +6,7 @@
:round="element.options.attrs.round"
:plain="element.options.attrs.plain"
:size="size"
class="de-search-button"
:class="'de-search-button' + (useDarkClass ? ' dark-reset-button' : '')"
@click="triggerReset"
>
{{ element.options.value }}
@ -15,6 +15,7 @@
<script>
import bus from '@/utils/bus'
import { mapState } from 'vuex'
export default {
props: {
@ -34,6 +35,21 @@ export default {
values: null
}
},
computed: {
useDarkClass() {
if (this.canvasStyleData.openCommonStyle && this.canvasStyleData.panel.backgroundType === 'color') {
const themeColor = this.canvasStyleData.panel.themeColor
if (themeColor !== 'light') {
return true
}
}
return false
},
...mapState([
'canvasStyleData'
])
},
created() {
},
methods: {
@ -49,4 +65,14 @@ export default {
height: 100%;
width: 100%;
}
.dark-reset-button {
color: #f2f6fc !important;
background-color: #21333b !important;
border-color: #bbbfc4 !important;
border: 1px solid;
&:hover {
background: #bec2c7 !important;
border-color: #bbbfc4 !important;
}
}
</style>

View File

@ -61,7 +61,10 @@
class="table-page"
:style="autoStyle"
>
<span class="total-style">
<span
class="total-style"
:style="totalStyle"
>
{{ $t('chart.total') }}
<span>{{
chart.datasetMode === 0 ? chart.totalItems : ((chart.data && chart.data.tableRow) ? chart.data.tableRow.length : 0)
@ -167,6 +170,9 @@ export default {
remarkCfg: {
show: false,
content: ''
},
totalStyle: {
color: '#606266'
}
}
},
@ -426,6 +432,8 @@ export default {
this.title_class.fontFamily = customStyle.text.fontFamily ? customStyle.text.fontFamily : DEFAULT_TITLE_STYLE.fontFamily
this.title_class.letterSpacing = (customStyle.text.letterSpace ? customStyle.text.letterSpace : DEFAULT_TITLE_STYLE.letterSpace) + 'px'
this.title_class.textShadow = customStyle.text.fontShadow ? '2px 2px 4px' : 'none'
//
this.totalStyle.color = customStyle.text.color
}
if (customStyle.background) {
this.title_class.background = hexColorToRGBA(customStyle.background.color, customStyle.background.alpha)

View File

@ -49,7 +49,10 @@
class="table-page-inner"
:style="autoStyle"
>
<span class="total-style">
<span
class="total-style"
:style="totalStyle"
>
{{ $t('chart.total') }}
<span>{{
chart.datasetMode === 0 ? chart.totalItems : ((chart.data && chart.data.tableRow) ? chart.data.tableRow.length : 0)
@ -160,7 +163,10 @@ export default {
showIndex: false,
indexLabel: '序号',
scrollBarColor: DEFAULT_COLOR_CASE.tableScrollBarColor,
scrollBarHoverColor: DEFAULT_COLOR_CASE.tableScrollBarHoverColor
scrollBarHoverColor: DEFAULT_COLOR_CASE.tableScrollBarHoverColor,
totalStyle: {
color: '#606266'
}
}
},
computed: {
@ -365,6 +371,8 @@ export default {
this.title_class.textAlign = customStyle.text.hPosition
this.title_class.fontStyle = customStyle.text.isItalic ? 'italic' : 'normal'
this.title_class.fontWeight = customStyle.text.isBolder ? 'bold' : 'normal'
//
this.totalStyle.color = customStyle.text.color
}
if (customStyle.background) {
this.bg_class.background = hexColorToRGBA(customStyle.background.color, customStyle.background.alpha)

View File

@ -1610,7 +1610,8 @@ import {
pluginTypes,
post,
resetViewCacheCallBack,
viewEditSave
viewEditSave,
tableField
} from '@/api/chart/chart'
import DimensionItem from '../components/dragItem/DimensionItem'
import QuotaItem from '../components/dragItem/QuotaItem'
@ -2000,7 +2001,7 @@ export default {
},
initTableData(id, optType) {
if (id != null) {
post('/dataset/table/getWithPermission/' + id, null).then(response => {
tableField(id).then(response => {
// If click too fast on the panel, the data here may be inconsistent, so make a verification
if (this.view.tableId === id) {
this.table = response.data

View File

@ -136,7 +136,7 @@
key="__operation"
:label="$t('commons.operating')"
fixed="right"
min-width="100"
min-width="180"
>
<template slot-scope="scope">
<el-button
@ -147,6 +147,15 @@
>{{
$t(disableEdit(scope.row) ? 'auth.view' : 'commons.edit')
}}</el-button>
<el-button
class="de-text-btn mar3 mar6"
:disabled="disableExec(scope.row)"
type="text"
@click="execTask(scope.row)"
>{{ $t("emailtask.execute_now") }}
</el-button>
<el-dropdown
size="medium"
trigger="click"
@ -164,12 +173,6 @@
<template
v-if="!['Exec'].includes(scope.row.status)"
>
<el-dropdown-item
:disabled="disableExec(scope.row)"
command="exec"
>
{{ $t('components.run_once') }}
</el-dropdown-item>
<el-dropdown-item
v-if="scope.row.status === 'Pending'"
command="continue"
@ -858,8 +861,7 @@ export default {
},
disableExec(task) {
return (
task.status === 'Pending' ||
!hasDataPermission('manage', task.privileges)
task.status === 'Pending' || task.status ==='Exec' || !hasDataPermission('manage', task.privileges)
)
},
disableDelete(task) {

View File

@ -462,11 +462,7 @@ export default {
tabClick() {
if (this.tabActive === 'dataPreview') {
const reload = localStorage.getItem('reloadDsData')
if (reload === 'true') {
localStorage.setItem('reloadDsData', 'false')
this.initTable(this.param.id)
}
this.initTable(this.param.id)
}
},

View File

@ -2,6 +2,7 @@
<el-row
style="text-align: left"
class="de-search-table"
v-loading="$store.getters.loadingMap[$store.getters.currentPath]"
>
<el-row class="top-operate">
<el-col :span="12">
@ -35,8 +36,8 @@
icon="iconfont icon-icon-filter"
@click="filterShow"
>{{
$t('user.filter')
}}
$t('user.filter')
}}
<template v-if="filterTexts.length">
({{ cacheCondition.length }})
</template>
@ -49,7 +50,7 @@
>
<span class="sum">{{ paginationConfig.total }}</span>
<span class="title">{{ $t('user.result_one') }}</span>
<el-divider direction="vertical" />
<el-divider direction="vertical"/>
<i
v-if="showScroll"
class="el-icon-arrow-left arrow-filter"
@ -62,9 +63,9 @@
class="text"
>
{{ ele }} <i
class="el-icon-close"
@click="clearOneFilter(index)"
/>
class="el-icon-close"
@click="clearOneFilter(index)"
/>
</p>
</div>
<i
@ -87,7 +88,6 @@
>
<grid-table
:ref="'grid-table'"
v-loading="$store.getters.loadingMap[$store.getters.currentPath]"
:table-data="data"
:columns="[]"
:pagination="paginationConfig"
@ -101,12 +101,7 @@
:label="$t('app_template.datasource')"
>
<template #default="{ row }">
<span
v-if="row.datasourceId && hasDataPermission('use',row.datasourcePrivileges)"
class="link-span"
@click="goToDatasource(row)"
>{{ row.datasourceName }}</span>
<span v-else>{{ row.datasourceName }}</span>
<span>{{ row.datasourceName }}</span>
</template>
</el-table-column>
<el-table-column
@ -189,6 +184,7 @@
:visible.sync="deleteConfirmDialog"
:show-close="true"
width="420px"
v-loading="$store.getters.loadingMap[$store.getters.currentPath]"
>
<el-row>
<el-checkbox
@ -217,10 +213,7 @@ import GridTable from '@/components/gridTable/index.vue'
import filterUser from './FilterUser'
import _ from 'lodash'
import keyEnter from '@/components/msgCfm/keyEnter.js'
import {
addOrder,
formatOrders
} from '@/utils/index'
import { addOrder, formatOrders } from '@/utils/index'
import { deleteLogAndResource, logGrid } from '@/api/appTemplateMarket/log'
import { findOneWithParent } from '@/api/panel/panel'
import AppTemplateApply from '@/views/panel/appTemplate/component/AppTemplateApply'
@ -288,9 +281,24 @@ export default {
this.deleteConfirmDialog = false
},
confirmDel() {
deleteLogAndResource(this.deleteItemInfo).then(() => {
this.closeDel()
this.search()
const _this = this
deleteLogAndResource(_this.deleteItemInfo).then(() => {
if (_this.deleteItemInfo.deleteResource) {
_this.clearLocalStorage()
}
_this.closeDel()
_this.search()
})
},
clearLocalStorage() {
const clearParams = [
'panel-main-tree',
'panel-default-tree',
'chart-tree',
'dataset-tree'
]
clearParams.forEach(item => {
localStorage.removeItem(item)
})
},
closeDraw() {

View File

@ -385,8 +385,8 @@ export default {
desc: [
{
min: 0,
max: 200,
message: i18n.t('datasource.input_limit', { num: '0~200' }),
max: 50,
message: i18n.t('datasource.input_limit', { num: '0~50' }),
trigger: 'blur'
}
],

View File

@ -391,7 +391,6 @@ export default {
width: 40px;
height: 40px;
background: #ffffff;
border: 1px solid #dee0e3;
border-radius: 4px;
display: flex;

View File

@ -6,12 +6,14 @@
type="primary"
icon="el-icon-plus"
@click="() => selectDataset()"
>{{ $t("dataset.add_task") }}</deBtn>
>{{ $t("dataset.add_task") }}
</deBtn>
<deBtn
:disabled="!multipleSelection.length"
secondary
@click="confirmDelete"
>{{ $t("organization.delete") }}</deBtn>
>{{ $t("organization.delete") }}
</deBtn>
</el-col>
<el-col
:span="14"
@ -33,10 +35,12 @@
:plain="!!filterTexts.length"
icon="iconfont icon-icon-filter"
@click="filterShow"
>{{ $t("user.filter")
}}<template v-if="filterTexts.length">
({{ filterTexts.length }})
</template>
>{{
$t("user.filter")
}}
<template v-if="filterTexts.length">
({{ filterTexts.length }})
</template>
</deBtn>
<el-dropdown
trigger="click"
@ -45,7 +49,8 @@
<deBtn
secondary
icon="el-icon-setting"
>{{ $t("user.list") }}</deBtn>
>{{ $t("user.list") }}
</deBtn>
<el-dropdown-menu
slot="dropdown"
class="list-columns-select"
@ -55,7 +60,8 @@
v-model="checkAll"
:indeterminate="isIndeterminate"
@change="handleCheckAllChange"
>{{ $t("dataset.check_all") }}</el-checkbox>
>{{ $t("dataset.check_all") }}
</el-checkbox>
<el-checkbox-group
v-model="checkedColumnNames"
@change="handleCheckedColumnNamesChange"
@ -64,7 +70,8 @@
v-for="column in columnNames"
:key="column.props"
:label="column.props"
>{{ $t(column.label) }}</el-checkbox>
>{{ $t(column.label) }}
</el-checkbox>
</el-checkbox-group>
</el-dropdown-menu>
</el-dropdown>
@ -76,7 +83,7 @@
>
<span class="sum">{{ paginationConfig.total }}</span>
<span class="title">{{ $t("user.result_one") }}</span>
<el-divider direction="vertical" />
<el-divider direction="vertical"/>
<i
v-if="showScroll"
class="el-icon-arrow-left arrow-filter"
@ -89,9 +96,9 @@
class="text"
>
{{ ele }} <i
class="el-icon-close"
@click="clearOneFilter(index)"
/>
class="el-icon-close"
@click="clearOneFilter(index)"
/>
</p>
</div>
<i
@ -104,7 +111,8 @@
class="clear-btn"
icon="el-icon-delete"
@click="clearFilter"
>{{ $t("user.clear_filter") }}</el-button>
>{{ $t("user.clear_filter") }}
</el-button>
</div>
<div
id="resize-for-filter"
@ -154,14 +162,14 @@
>
<template slot-scope="scope">
<span v-if="scope.row.rate === 'SIMPLE'">{{
$t("dataset.execute_once")
}}</span>
$t("dataset.execute_once")
}}</span>
<span v-if="scope.row.rate === 'CRON'">{{
$t("dataset.cron_config")
}}</span>
$t("dataset.cron_config")
}}</span>
<span v-if="scope.row.rate === 'SIMPLE_CRON'">{{
$t("dataset.simple_cron")
}}</span>
$t("dataset.simple_cron")
}}</span>
</template>
</el-table-column>
@ -189,8 +197,8 @@
v-if="scope.row.lastExecStatus"
:class="[`de-${scope.row.lastExecStatus}-pre`, 'de-status']"
>{{
$t(`dataset.${scope.row.lastExecStatus.toLocaleLowerCase()}`)
}}
$t(`dataset.${scope.row.lastExecStatus.toLocaleLowerCase()}`)
}}
<svg-icon
v-if="scope.row.lastExecStatus === 'Error'"
style="cursor: pointer;"
@ -244,16 +252,22 @@
key="__operation"
:label="$t('commons.operating')"
fixed="right"
width="100"
width="160"
>
<template slot-scope="scope">
<el-button
class="de-text-btn mar3 mar6"
type="text"
@click="selectDataset(scope.row)"
>{{
$t(disableEdit(scope.row) ? "auth.view" : "commons.edit")
}}</el-button>
>{{ $t(disableEdit(scope.row) ? "auth.view" : "commons.edit") }}
</el-button>
<el-button
class="de-text-btn mar3 mar6"
:disabled="disableExec(scope.row)"
type="text"
@click="execTask(scope.row)"
>{{ $t("emailtask.execute_now") }}
</el-button>
<el-dropdown
size="medium"
trigger="click"
@ -270,12 +284,6 @@
<template
v-if="!['Exec'].includes(scope.row.status)"
>
<el-dropdown-item
:disabled="disableExec(scope.row)"
command="exec"
>
{{ $t("components.run_once") }}
</el-dropdown-item>
<el-dropdown-item
v-if="scope.row.status === 'Pending'"
command="continue"
@ -325,18 +333,18 @@
secondary
@click="show_error_massage = false"
>{{
$t("dataset.close")
}}</deBtn>
$t("dataset.close")
}}</deBtn>
</span>
</el-dialog>
</div>
</template>
<script>
import { columnOptions } from './options'
import { formatOrders } from '@/utils/index'
import { datasetTaskList, post } from '@/api/dataset/dataset'
import { hasDataPermission } from '@/utils/permission'
import {columnOptions} from './options'
import {formatOrders} from '@/utils/index'
import {datasetTaskList, post} from '@/api/dataset/dataset'
import {hasDataPermission} from '@/utils/permission'
import GridTable from '@/components/gridTable/index.vue'
import filterUser from './FilterUser.vue'
import msgCfm from '@/components/msgCfm/index'
@ -345,12 +353,13 @@ import keyEnter from '@/components/msgCfm/keyEnter.js'
export default {
name: 'DatasetTaskList',
components: { GridTable, filterUser },
components: {GridTable, filterUser},
mixins: [msgCfm, keyEnter],
props: {
transCondition: {
type: Object,
default: () => {}
default: () => {
}
}
},
data() {
@ -387,7 +396,7 @@ export default {
}
},
created() {
const { taskId, name } = this.transCondition
const {taskId, name} = this.transCondition
if (taskId) {
this.nickName = name
}
@ -418,7 +427,7 @@ export default {
document.querySelector('#resize-for-filter')
)
},
layoutResize: _.debounce(function() {
layoutResize: _.debounce(function () {
this.getScrollStatus()
}, 200),
scrollPre() {
@ -492,7 +501,7 @@ export default {
this.handleCurrentChange(1)
},
search(showLoading = true) {
const { taskId, name } = this.transCondition
const {taskId, name} = this.transCondition
const param = {
orders: formatOrders(this.orderConditions),
conditions: [...this.cacheCondition]
@ -511,7 +520,7 @@ export default {
field: 'dataset_table_task.id'
})
}
const { currentPage, pageSize } = this.paginationConfig
const {currentPage, pageSize} = this.paginationConfig
datasetTaskList(currentPage, pageSize, param, showLoading).then(
(response) => {
const multipleSelection = this.multipleSelection.map(ele => ele.id)
@ -559,7 +568,7 @@ export default {
})
},
changeTaskStatus(task) {
const { status } = task
const {status} = task
if (!['Pending', 'Underway'].includes(status)) {
return
}
@ -599,11 +608,12 @@ export default {
this.initSearch(true)
})
})
.catch(() => {})
.catch(() => {
})
},
selectDataset(row) {
if (row) {
const { datasetName, id, tableId } = row
const {datasetName, id, tableId} = row
this.$router.push({
path: '/task-ds-form',
query: {
@ -624,9 +634,7 @@ export default {
)
},
disableExec(task) {
return (task.status === 'Pending' ||
!hasDataPermission('manage', task.privileges)
)
return (task.status === 'Pending' || task.status ==='Exec' || !hasDataPermission('manage', task.privileges))
},
disableDelete(task) {
return false
@ -661,6 +669,7 @@ export default {
height: 100px;
overflow-y: auto;
}
.codemirror ::v-deep .CodeMirror-scroll {
height: 100px;
overflow-y: auto;
@ -708,6 +717,7 @@ export default {
border-radius: 4px;
}
}
.table-container {
height: calc(100% - 50px);
@ -744,8 +754,10 @@ export default {
width: 100%;
}
}
.de-card-dropdown {
margin-top: 0 !important;
.popper__arrow {
display: none !important;
}