Skip to content

Commit

Permalink
Feature bailongsen (#625)
Browse files Browse the repository at this point in the history
* fix: 调试请求接口

* fix: 添加执行结果

* fix: 完善执行结果

* fix: 调试执行sql结果

* [Bug][scaleph-engine-sql-gateway] fix flink sql gateway query result error (#616)

fix: flink sql gateway query result error

* [Bug][scaleph-engine-sql-gateway] fix flink sql gateway query result error (#617)

fix: flink sql gateway query result error

* [Feature][scaleph-engine-sql-gateway] add column info for flink sql query result (#618)

feature: add column info for flink sql query result

* [Feature][scaleph-engine-sql-gateway] optimize Flink TimestampData and DecimalData format (#619)

feature: optimize Flink TimestampData and DecimalData format

* [Feature][scaleph-engine-sql-gateway] add sql gateway splited service (#623)

* feature: add flink sql gateway service interface

* feature: upgrade flink kubernetes operator api

* feature: upgrade flink kubernetes operator api

* feature: add dataservice module

* feature: add flink sql gateway service interface

* feature: add dataservice module

* fix: dataservice sql script error

* feature: dataservice config mapper

* feature: dataservice config controller

* feature: dataservice parameter and result map sql table

* feature: dataservice parameter and result map mapper

* feature: dataservice parameter and result map interface

* feature: dataservice parameter and result map service

* feature: add dataservice parameter and result mapping sql table

* feature: add dataservice parameter and result mapping mapper

* fix: jobId NPE

* fix: jobId NPE

* feature: add parametermap and resultmap

* feature: add parametermap and resultmap

* feature: add parametermap and resultmap

* feature: add parametermap and resultmap

* feature: add parametermapping and resultmapping

* feature: add parametermapping and resultmapping

* feature: add flink custom artifact table

* fix: docker build

* fix: docker build

* fix: docker build

* fix: flink sql gateway feitch results api page param error

* fix: 修改sql执行结果

---------

Co-authored-by: bailongsen <bailongsen@xinxuan.net>
Co-authored-by: kalencaya <1942460489@qq.com>
  • Loading branch information
3 people authored Oct 11, 2023
1 parent 88d0f56 commit f5cb4f1
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ const EditorRightResult: React.FC = () => {
const [isLoading, setIsLoading] = useState<boolean>(false); // 加载状态标志
const { executionData, setExecutionData } = useModel('executionResult'); // 执行结果和设置执行结果的model
const [sessionClusterId, setSessionClusterId] = useState<string | undefined>(); // 会话集群id
const [activeKey, setActiveKey] = useState<string | undefined>(); // 控制当前激活的tab
const flinkArtifactSql = urlParams.state; // Flink SQL参数对象
const [activeKey, setActiveKey] = useState<string | undefined | number>(); // 控制当前激活的tab
const flinkArtifactSql: string | unknown = urlParams.state; // Flink SQL参数对象
let sqlData: string;
const executionDataString = useRef<string>();
const sessionClusterIdString = useRef<string>();
Expand All @@ -41,19 +41,23 @@ const EditorRightResult: React.FC = () => {
};

useEffect(() => {
const getResults = async (data: string) => {
const getResults = async (data: string, nextToken = 0) => {
if (sqlData !== data) {
setIsLoading(false);
clearTimeout(clearTimeOut.current);
stopSqlCarryOut();
sqlData = data;
}
// 调用后端接口获取SQL结果
const catalogArray = await WsFlinkSqlGatewayService.getSqlResults(sessionClusterId!, data);
const catalogArray: any = await WsFlinkSqlGatewayService.getSqlResults(
sessionClusterId!,
data,
nextToken,
);
if (catalogArray?.resultType === 'NOT_READY' || catalogArray?.resultType === 'PAYLOAD') {
setIsLoading(true);
clearTimeOut.current = setTimeout(() => {
getResults(data);
getResults(data, catalogArray?.nextToken);
}, 5000);
if (catalogArray?.resultType === 'PAYLOAD') {
setDataList((prevDataList) => {
Expand Down Expand Up @@ -82,14 +86,13 @@ const EditorRightResult: React.FC = () => {
};
}, [executionData]);

useEffect(() => {
useEffect((): any => {
return stopSqlCarryOut;
}, []);

useEffect(() => {
const handleTabs = (result: any[]) => {
if (!result || !dataList) return [];

return dataList.map((item, index) => ({
label: (
<div className={styles.bottomIcon}>
Expand Down Expand Up @@ -117,14 +120,23 @@ const EditorRightResult: React.FC = () => {
}, [dataList]);

const onEdit = (key: string | number | null | undefined) => {
let index = items.findIndex((item) => item?.key === key);
if (index === items?.length - 1) {
setDataList((prevList) => prevList.filter((item) => item?.jobID !== key));

const lastIndex = items?.length - 1;
const lastKey = items?.[lastIndex]?.key;

if (key === lastKey) {
setActiveKey(items?.[lastIndex - 1]?.key || '');
} else {
setActiveKey(lastKey || '');
}

setItems((prevItems) => prevItems.filter((item) => item?.key !== key));

if (lastIndex !== undefined && key === items[lastIndex]?.key) {
setIsLoading(false);
stopSqlCarryOut();
clearTimeout(clearTimeOut.current);
setItems(items.filter((item) => item?.key !== key));
} else {
setItems(items.filter((item) => item?.key !== key));
}
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,14 @@ export const WsFlinkSqlGatewayService = {
});
},

getSqlResults: async (sessionClusterId?: string | null, operationHandleId?: string) => {
getSqlResults: async (
sessionClusterId?: string | null,
operationHandleId?: string,
nextToken?: string | number,
) => {
return request<Array<string>>(`${url}/${sessionClusterId}/${operationHandleId}/results`, {
method: 'GET',
params: { token: nextToken },
});
},

Expand Down

0 comments on commit f5cb4f1

Please sign in to comment.