Merge branch 'dev-v2' into pr@dev2@fixds

This commit is contained in:
taojinlong 2024-09-19 16:01:11 +08:00
commit 8bf1c17d3f
11 changed files with 138 additions and 6 deletions

View File

@ -94,7 +94,7 @@ public class ExportCenterManage {
@Value("${dataease.export.max.size:10}") @Value("${dataease.export.max.size:10}")
private int max; private int max;
@Value("${dataease.export.dataset.limit:100000}") @Value("${dataease.export.dataset.limit:20}")
private int limit; private int limit;
private final static String DATA_URL_TITLE = "data:image/jpeg;base64,"; private final static String DATA_URL_TITLE = "data:image/jpeg;base64,";
private static final String exportData_path = "/opt/dataease2.0/data/exportData/"; private static final String exportData_path = "/opt/dataease2.0/data/exportData/";
@ -421,13 +421,15 @@ public class ExportCenterManage {
totalCount = totalCount > curLimit ? curLimit : totalCount; totalCount = totalCount > curLimit ? curLimit : totalCount;
Long totalPage = (totalCount / extractPageSize) + (totalCount % extractPageSize > 0 ? 1 : 0); Long totalPage = (totalCount / extractPageSize) + (totalCount % extractPageSize > 0 ? 1 : 0);
Workbook wb = new SXSSFWorkbook(); Workbook wb = new SXSSFWorkbook();
FileOutputStream fileOutputStream = new FileOutputStream(dataPath + "/" + request.getFilename() + ".xlsx"); FileOutputStream fileOutputStream = new FileOutputStream(dataPath + "/" + request.getFilename() + ".xlsx");
Sheet detailsSheet = wb.createSheet("数据"); Sheet detailsSheet = wb.createSheet("数据");
for (Integer p = 0; p < totalPage; p++) { for (Integer p = 0; p < totalPage; p++) {
String querySQL = SQLProvider.createQuerySQLWithLimit(sqlMeta, false, needOrder, false, p * extractPageSize, p * extractPageSize + extractPageSize); String querySQL = SQLProvider.createQuerySQLWithLimit(sqlMeta, false, needOrder, false, p * extractPageSize, p * extractPageSize + extractPageSize);
if (totalPage == 1) {
querySQL = SQLProvider.createQuerySQLWithLimit(sqlMeta, false, needOrder, false, 0, totalCount.intValue());
}
querySQL = provider.rebuildSQL(querySQL, sqlMeta, crossDs, dsMap); querySQL = provider.rebuildSQL(querySQL, sqlMeta, crossDs, dsMap);
DatasourceRequest datasourceRequest = new DatasourceRequest(); DatasourceRequest datasourceRequest = new DatasourceRequest();
datasourceRequest.setQuery(querySQL); datasourceRequest.setQuery(querySQL);

View File

@ -3,12 +3,20 @@ import router from '@/router'
import { usePermissionStoreWithOut } from '@/store/modules/permission' import { usePermissionStoreWithOut } from '@/store/modules/permission'
import { interactiveStoreWithOut } from '@/store/modules/interactive' import { interactiveStoreWithOut } from '@/store/modules/interactive'
import { useCache } from '@/hooks/web/useCache' import { useCache } from '@/hooks/web/useCache'
import request from '@/config/axios'
const { wsCache } = useCache() const { wsCache } = useCache()
const permissionStore = usePermissionStoreWithOut() const permissionStore = usePermissionStoreWithOut()
const userStore = useUserStoreWithOut() const userStore = useUserStoreWithOut()
const interactiveStore = interactiveStoreWithOut() const interactiveStore = interactiveStoreWithOut()
export const logoutHandler = (justClean?: boolean) => { export const logoutHandler = (justClean?: boolean) => {
const idToken = wsCache.get('oauth2-id-token')
if (idToken) {
request.get({ url: `/oauth2/logout/${idToken}` }).finally(() => {
wsCache.delete('oauth2-id-token')
})
}
userStore.clear() userStore.clear()
userStore.$reset() userStore.$reset()
permissionStore.clear() permissionStore.clear()

View File

@ -16,7 +16,7 @@ import { XpackComponent } from '@/components/plugin'
import { logoutHandler } from '@/utils/logout' import { logoutHandler } from '@/utils/logout'
import DeImage from '@/assets/login-desc-de.png' import DeImage from '@/assets/login-desc-de.png'
import elementResizeDetectorMaker from 'element-resize-detector' import elementResizeDetectorMaker from 'element-resize-detector'
import { checkPlatform, cleanPlatformFlag } from '@/utils/utils' import { checkPlatform, cleanPlatformFlag, getQueryString } from '@/utils/utils'
import xss from 'xss' import xss from 'xss'
const { wsCache } = useCache() const { wsCache } = useCache()
const appStore = useAppStoreWithOut() const appStore = useAppStoreWithOut()
@ -253,6 +253,8 @@ onMounted(async () => {
} else { } else {
preheat.value = false preheat.value = false
} }
} else if (getQueryString('state')?.includes('de-oauth2-')) {
preheat.value = true
} }
if (localStorage.getItem('DE-GATEWAY-FLAG')) { if (localStorage.getItem('DE-GATEWAY-FLAG')) {
const msg = localStorage.getItem('DE-GATEWAY-FLAG') const msg = localStorage.getItem('DE-GATEWAY-FLAG')

@ -1 +1 @@
Subproject commit adfb61c3ef5171563fdcd7db101ff2aabc5556dd Subproject commit 8ec01af68b38419a065d57f80f915b903ddc00bb

View File

@ -34,6 +34,9 @@ public interface XpackAuthenticationApi {
@PostMapping("/save/ldap") @PostMapping("/save/ldap")
String saveLdap(@RequestBody XpackLdapVO editor); String saveLdap(@RequestBody XpackLdapVO editor);
@PostMapping("/save/oauth2")
String saveOauth2(@RequestBody XpackOauth2VO editor);
@GetMapping("/info/oidc") @GetMapping("/info/oidc")
XpackOidcVO oidcInfo(); XpackOidcVO oidcInfo();
@ -44,6 +47,9 @@ public interface XpackAuthenticationApi {
@GetMapping("/info/ldap") @GetMapping("/info/ldap")
XpackLdapVO ldapInfo(); XpackLdapVO ldapInfo();
@GetMapping("/info/oauth2")
XpackOauth2VO oauth2Info();
@PostMapping("/validate/oidc") @PostMapping("/validate/oidc")
String validateOidc(@RequestBody XpackOidcVO editor); String validateOidc(@RequestBody XpackOidcVO editor);
@ -54,10 +60,14 @@ public interface XpackAuthenticationApi {
@PostMapping("/validate/ldap") @PostMapping("/validate/ldap")
String validateLdap(@RequestBody XpackLdapVO editor); String validateLdap(@RequestBody XpackLdapVO editor);
@PostMapping("/validate/oauth2")
String validateOauth2(@RequestBody XpackOauth2VO editor);
@PostMapping("/validateId/{id}") @PostMapping("/validateId/{id}")
String validate(@PathVariable("id") Long id); String validate(@PathVariable("id") Long id);
@Operation(summary = "查询状态") @Operation(summary = "查询状态")
@GetMapping("/status") @GetMapping("/status")
List<XpackAuthenticationStatusVO> status(); List<XpackAuthenticationStatusVO> status();
} }

View File

@ -0,0 +1,25 @@
package io.dataease.api.xpack.settings;
import com.github.xiaoymin.knife4j.annotations.ApiSupport;
import io.dataease.api.xpack.settings.request.XpackOauth2TokenRequest;
import io.dataease.api.xpack.settings.vo.XpackOauthAuthVO;
import io.dataease.api.xpack.settings.vo.XpackOauthTokenVO;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
@Tag(name = "Oauth2认证")
@ApiSupport(order = 899)
public interface XpackOauth2Api {
@GetMapping("/auth")
XpackOauthAuthVO auth();
@PostMapping("/token")
XpackOauthTokenVO oauth2Token(@RequestBody XpackOauth2TokenRequest request);
@GetMapping("/logout/{idToken}")
void logout(@PathVariable("idToken") String idToken);
}

View File

@ -0,0 +1,16 @@
package io.dataease.api.xpack.settings.request;
import lombok.Data;
import java.io.Serial;
import java.io.Serializable;
@Data
public class XpackOauth2TokenRequest implements Serializable {
@Serial
private static final long serialVersionUID = 489213446985742448L;
private String code;
private String state;
}

View File

@ -0,0 +1,30 @@
package io.dataease.api.xpack.settings.vo;
import lombok.Data;
import java.io.Serial;
import java.io.Serializable;
@Data
public class XpackOauth2VO implements Serializable {
@Serial
private static final long serialVersionUID = 2395518228048236146L;
private String clientId;
private String clientSecret;
private String authEndpoint;
private String tokenEndpoint;
private String userInfoEndpoint;
private String logoutEndpoint;
private String scope;
private String mapping;
private String redirectUri;
}

View File

@ -0,0 +1,22 @@
package io.dataease.api.xpack.settings.vo;
import lombok.Data;
import java.io.Serial;
import java.io.Serializable;
@Data
public class XpackOauthAuthVO implements Serializable {
@Serial
private static final long serialVersionUID = -3658093847024323465L;
private String state;
private String clientId;
private String redirectUri;
private String authEndpoint;
private String scope;
}

View File

@ -0,0 +1,16 @@
package io.dataease.api.xpack.settings.vo;
import lombok.Data;
import java.io.Serial;
import java.io.Serializable;
@Data
public class XpackOauthTokenVO implements Serializable {
@Serial
private static final long serialVersionUID = -3594367641594329352L;
private String token;
private String idToken;
}

View File

@ -68,6 +68,7 @@ public class WhitelistUtils {
|| StringUtils.startsWithAny(requestURI, "/geo/") || StringUtils.startsWithAny(requestURI, "/geo/")
|| StringUtils.startsWithAny(requestURI, "/websocket") || StringUtils.startsWithAny(requestURI, "/websocket")
|| StringUtils.startsWithAny(requestURI, "/map/") || StringUtils.startsWithAny(requestURI, "/map/")
|| StringUtils.startsWithAny(requestURI, "/oauth2/")
|| StringUtils.startsWithAny(requestURI, "/typeface/download") || StringUtils.startsWithAny(requestURI, "/typeface/download")
|| StringUtils.startsWithAny(requestURI, "/typeface/defaultFont") || StringUtils.startsWithAny(requestURI, "/typeface/defaultFont")
|| StringUtils.startsWithAny(requestURI, "/typeface/listFont") || StringUtils.startsWithAny(requestURI, "/typeface/listFont")