diff --git a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/controller/FlinkEnvController.java b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/controller/FlinkEnvController.java index c8304b7a69..a4a663b81a 100644 --- a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/controller/FlinkEnvController.java +++ b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/controller/FlinkEnvController.java @@ -17,10 +17,10 @@ package org.apache.streampark.console.core.controller; -import org.apache.streampark.common.enums.FlinkEnvStatus; import org.apache.streampark.console.base.domain.RestResponse; import org.apache.streampark.console.base.exception.ApiDetailException; import org.apache.streampark.console.core.entity.FlinkEnv; +import org.apache.streampark.console.core.enums.FlinkEnvCheckEnum; import org.apache.streampark.console.core.service.FlinkEnvService; import io.swagger.v3.oas.annotations.Operation; @@ -53,7 +53,7 @@ public RestResponse list() { @Operation(summary = "Verify flink environment") @PostMapping("check") public RestResponse check(FlinkEnv version) { - FlinkEnvStatus checkResp = flinkEnvService.check(version); + FlinkEnvCheckEnum checkResp = flinkEnvService.check(version); return RestResponse.success(checkResp.getCode()); } diff --git a/streampark-common/src/main/java/org/apache/streampark/common/enums/FlinkEnvStatus.java b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/enums/FlinkEnvCheckEnum.java similarity index 75% rename from streampark-common/src/main/java/org/apache/streampark/common/enums/FlinkEnvStatus.java rename to streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/enums/FlinkEnvCheckEnum.java index 8e47123e31..4edac0e003 100644 --- a/streampark-common/src/main/java/org/apache/streampark/common/enums/FlinkEnvStatus.java +++ b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/enums/FlinkEnvCheckEnum.java @@ -15,30 +15,33 @@ * limitations under the License. */ -package org.apache.streampark.common.enums; +package org.apache.streampark.console.core.enums; + +import lombok.Getter; /* the flink environment status */ -public enum FlinkEnvStatus { +@Getter +public enum FlinkEnvCheckEnum { /* FLINK_HOME path invalid */ - INVALID(-1), + INVALID_PATH(-1), - /* this add/update operation are feasible */ - FEASIBLE(0), + /* this add/update operation ok */ + OK(0), - /* defined flink name repeated */ + /* flink name repeated */ NAME_REPEATED(1), - /* dist Jar more than one */ - FLINK_DIST_REPEATED(2); + /* FLINK_DIST file not found */ + + FLINK_DIST_NOT_FOUND(2), + + /* defined flink name repeated */ + FLINK_DIST_REPEATED(3); private final int code; - FlinkEnvStatus(int code) { + FlinkEnvCheckEnum(int code) { this.code = code; } - - public int getCode() { - return code; - } } diff --git a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/service/FlinkEnvService.java b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/service/FlinkEnvService.java index 02bc04c41e..0c20689ff5 100644 --- a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/service/FlinkEnvService.java +++ b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/service/FlinkEnvService.java @@ -17,8 +17,8 @@ package org.apache.streampark.console.core.service; -import org.apache.streampark.common.enums.FlinkEnvStatus; import org.apache.streampark.console.core.entity.FlinkEnv; +import org.apache.streampark.console.core.enums.FlinkEnvCheckEnum; import com.baomidou.mybatisplus.extension.service.IService; @@ -32,7 +32,7 @@ public interface FlinkEnvService extends IService { * @param version The version of Flink to check. * @return Returns enum value indicating the existence of the specified version. */ - FlinkEnvStatus check(FlinkEnv version); + FlinkEnvCheckEnum check(FlinkEnv version); /** * Create a new instance. diff --git a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/service/impl/FlinkEnvServiceImpl.java b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/service/impl/FlinkEnvServiceImpl.java index 1878e6388e..86fef80107 100644 --- a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/service/impl/FlinkEnvServiceImpl.java +++ b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/service/impl/FlinkEnvServiceImpl.java @@ -17,9 +17,9 @@ package org.apache.streampark.console.core.service.impl; -import org.apache.streampark.common.enums.FlinkEnvStatus; import org.apache.streampark.console.base.exception.ApiAlertException; import org.apache.streampark.console.core.entity.FlinkEnv; +import org.apache.streampark.console.core.enums.FlinkEnvCheckEnum; import org.apache.streampark.console.core.mapper.FlinkEnvMapper; import org.apache.streampark.console.core.service.FlinkClusterService; import org.apache.streampark.console.core.service.FlinkEnvService; @@ -52,7 +52,7 @@ public class FlinkEnvServiceImpl extends ServiceImpl * 2) flink-dist repeated
*/ @Override - public FlinkEnvStatus check(FlinkEnv version) { + public FlinkEnvCheckEnum check(FlinkEnv version) { // 1) check name LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper().eq(FlinkEnv::getFlinkName, version.getFlinkName()); @@ -60,21 +60,27 @@ public FlinkEnvStatus check(FlinkEnv version) { queryWrapper.ne(FlinkEnv::getId, version.getId()); } if (this.count(queryWrapper) > 0) { - return FlinkEnvStatus.NAME_REPEATED; + return FlinkEnvCheckEnum.NAME_REPEATED; } - // 2) check dist_jar String lib = version.getFlinkHome().concat("/lib"); File flinkLib = new File(lib); - if (flinkLib.exists() && flinkLib.isDirectory()) { - int distSize = flinkLib.listFiles(f -> f.getName().matches("flink-dist.*\\.jar")).length; - if (distSize > 1) { - return FlinkEnvStatus.FLINK_DIST_REPEATED; - } - } else { - return FlinkEnvStatus.INVALID; + // 2) flink/lib path exists and is a directory + if (!flinkLib.exists() || !flinkLib.isDirectory()) { + return FlinkEnvCheckEnum.INVALID_PATH; } - return FlinkEnvStatus.FEASIBLE; + + // 3) check flink-dist + File[] files = flinkLib.listFiles(f -> f.getName().matches("flink-dist.*\\.jar")); + if (files == null || files.length == 0) { + return FlinkEnvCheckEnum.FLINK_DIST_NOT_FOUND; + } + + if (files.length > 1) { + return FlinkEnvCheckEnum.FLINK_DIST_REPEATED; + } + + return FlinkEnvCheckEnum.OK; } @Override diff --git a/streampark-console/streampark-console-webapp/src/components/Application/src/AppDarkModeToggle.vue b/streampark-console/streampark-console-webapp/src/components/Application/src/AppDarkModeToggle.vue index d4e0ce1646..19ba3b1514 100644 --- a/streampark-console/streampark-console-webapp/src/components/Application/src/AppDarkModeToggle.vue +++ b/streampark-console/streampark-console-webapp/src/components/Application/src/AppDarkModeToggle.vue @@ -63,9 +63,7 @@ height: 18px; background-color: #fff; border-radius: 50%; - transition: - transform 0.5s, - background-color 0.5s; + transition: transform 0.5s, background-color 0.5s; will-change: transform; } diff --git a/streampark-console/streampark-console-webapp/src/components/ContextMenu/src/ContextMenu.vue b/streampark-console/streampark-console-webapp/src/components/ContextMenu/src/ContextMenu.vue index 78cac5c5b6..e08c25f36b 100644 --- a/streampark-console/streampark-console-webapp/src/components/ContextMenu/src/ContextMenu.vue +++ b/streampark-console/streampark-console-webapp/src/components/ContextMenu/src/ContextMenu.vue @@ -179,9 +179,7 @@ background-color: @component-background; border: 1px solid rgb(0 0 0 / 8%); border-radius: 0.25rem; - box-shadow: - 0 2px 2px 0 rgb(0 0 0 / 14%), - 0 3px 1px -2px rgb(0 0 0 / 10%), + box-shadow: 0 2px 2px 0 rgb(0 0 0 / 14%), 0 3px 1px -2px rgb(0 0 0 / 10%), 0 1px 5px 0 rgb(0 0 0 / 6%); background-clip: padding-box; user-select: none; diff --git a/streampark-console/streampark-console-webapp/src/components/Form/src/BasicForm.vue b/streampark-console/streampark-console-webapp/src/components/Form/src/BasicForm.vue index e5a9dacf62..1cd7e3809b 100644 --- a/streampark-console/streampark-console-webapp/src/components/Form/src/BasicForm.vue +++ b/streampark-console/streampark-console-webapp/src/components/Form/src/BasicForm.vue @@ -113,7 +113,7 @@ }); const getBindValue = computed( - () => ({ ...attrs, ...props, ...unref(getProps) }) as Recordable, + () => ({ ...attrs, ...props, ...unref(getProps) } as Recordable), ); const getSchema = computed((): FormSchema[] => { diff --git a/streampark-console/streampark-console-webapp/src/components/Form/src/components/FormItem.vue b/streampark-console/streampark-console-webapp/src/components/Form/src/components/FormItem.vue index 9bbb5023fa..137ae94d6c 100644 --- a/streampark-console/streampark-console-webapp/src/components/Form/src/components/FormItem.vue +++ b/streampark-console/streampark-console-webapp/src/components/Form/src/components/FormItem.vue @@ -333,8 +333,8 @@ return slot ? getSlot(slots, slot, unref(getValues)) : render - ? render(unref(getValues)) - : renderComponent(); + ? render(unref(getValues)) + : renderComponent(); }; const showSuffix = !!suffix; @@ -382,8 +382,8 @@ return colSlot ? getSlot(slots, colSlot, values) : renderColContent - ? renderColContent(values) - : renderItem(); + ? renderColContent(values) + : renderItem(); }; return ( diff --git a/streampark-console/streampark-console-webapp/src/components/Modal/src/components/ModalWrapper.vue b/streampark-console/streampark-console-webapp/src/components/Modal/src/components/ModalWrapper.vue index 52c8b5eb8b..1b1b9a6137 100644 --- a/streampark-console/streampark-console-webapp/src/components/Modal/src/components/ModalWrapper.vue +++ b/streampark-console/streampark-console-webapp/src/components/Modal/src/components/ModalWrapper.vue @@ -153,8 +153,8 @@ realHeightRef.value = props.height ? props.height : realHeight > maxHeight - ? maxHeight - : realHeight; + ? maxHeight + : realHeight; } emit('height-change', unref(realHeightRef)); } catch (error) { diff --git a/streampark-console/streampark-console-webapp/src/components/Page/src/PageFooter.vue b/streampark-console/streampark-console-webapp/src/components/Page/src/PageFooter.vue index 8fdbc8f41a..e89a6ce979 100644 --- a/streampark-console/streampark-console-webapp/src/components/Page/src/PageFooter.vue +++ b/streampark-console/streampark-console-webapp/src/components/Page/src/PageFooter.vue @@ -39,9 +39,7 @@ line-height: 44px; background-color: @component-background; border-top: 1px solid @border-color-base; - box-shadow: - 0 -6px 16px -8px rgb(0 0 0 / 8%), - 0 -9px 28px 0 rgb(0 0 0 / 5%), + box-shadow: 0 -6px 16px -8px rgb(0 0 0 / 8%), 0 -9px 28px 0 rgb(0 0 0 / 5%), 0 -12px 48px 16px rgb(0 0 0 / 3%); transition: width 0.2s; diff --git a/streampark-console/streampark-console-webapp/src/components/Table/src/components/HeaderCell.vue b/streampark-console/streampark-console-webapp/src/components/Table/src/components/HeaderCell.vue index 36ab854c59..35c0802696 100644 --- a/streampark-console/streampark-console-webapp/src/components/Table/src/components/HeaderCell.vue +++ b/streampark-console/streampark-console-webapp/src/components/Table/src/components/HeaderCell.vue @@ -22,7 +22,7 @@ props: { column: { type: Object as PropType, - default: () => ({}) as BasicColumn, + default: () => ({} as BasicColumn), }, }, setup(props) { diff --git a/streampark-console/streampark-console-webapp/src/enums/flinkEnum.ts b/streampark-console/streampark-console-webapp/src/enums/flinkEnum.ts index 7a2359c427..6098378cdf 100644 --- a/streampark-console/streampark-console-webapp/src/enums/flinkEnum.ts +++ b/streampark-console/streampark-console-webapp/src/enums/flinkEnum.ts @@ -235,9 +235,10 @@ export enum AppExistsEnum { INVALID = 4, } -export enum FlinkEvnEnum { - INVALID = -1, - FEASIBLE = 0, +export enum FlinkEnvCheckEnum { + INVALID_PATH = -1, + OK = 0, NAME_REPEATED = 1, - FLINK_DIST_REPEATED = 2, + FLINK_DIST_NOT_FOUND = 2, + FLINK_DIST_REPEATED = 3, } diff --git a/streampark-console/streampark-console-webapp/src/hooks/setting/useMenuSetting.ts b/streampark-console/streampark-console-webapp/src/hooks/setting/useMenuSetting.ts index f501c6e80d..3566bfd27c 100644 --- a/streampark-console/streampark-console-webapp/src/hooks/setting/useMenuSetting.ts +++ b/streampark-console/streampark-console-webapp/src/hooks/setting/useMenuSetting.ts @@ -105,8 +105,8 @@ export function useMenuSetting() { return siderHidden ? 0 : collapsedShowTitle - ? SIDE_BAR_SHOW_TIT_MINI_WIDTH - : SIDE_BAR_MINI_WIDTH; + ? SIDE_BAR_SHOW_TIT_MINI_WIDTH + : SIDE_BAR_MINI_WIDTH; }); const getCalcContentWidth = computed(() => { @@ -114,9 +114,9 @@ export function useMenuSetting() { unref(getIsTopMenu) || !unref(getShowMenu) || (unref(getSplit) && unref(getMenuHidden)) ? 0 : unref(getIsMixSidebar) - ? (unref(getCollapsed) ? SIDE_BAR_MINI_WIDTH : SIDE_BAR_SHOW_TIT_MINI_WIDTH) + - (unref(getMixSideFixed) && unref(mixSideHasChildren) ? unref(getRealWidth) : 0) - : unref(getRealWidth); + ? (unref(getCollapsed) ? SIDE_BAR_MINI_WIDTH : SIDE_BAR_SHOW_TIT_MINI_WIDTH) + + (unref(getMixSideFixed) && unref(mixSideHasChildren) ? unref(getRealWidth) : 0) + : unref(getRealWidth); return `calc(100% - ${unref(width)}px)`; }); diff --git a/streampark-console/streampark-console-webapp/src/hooks/web/useLockPage.ts b/streampark-console/streampark-console-webapp/src/hooks/web/useLockPage.ts index 9a66074210..c543be9542 100644 --- a/streampark-console/streampark-console-webapp/src/hooks/web/useLockPage.ts +++ b/streampark-console/streampark-console-webapp/src/hooks/web/useLockPage.ts @@ -32,12 +32,9 @@ export function useLockPage() { } clear(); - timeId = setTimeout( - () => { - lockPage(); - }, - lockTime * 60 * 1000, - ); + timeId = setTimeout(() => { + lockPage(); + }, lockTime * 60 * 1000); } function lockPage(): void { diff --git a/streampark-console/streampark-console-webapp/src/locales/lang/en/setting/flinkHome.ts b/streampark-console/streampark-console-webapp/src/locales/lang/en/setting/flinkHome.ts index e4b2f77be5..c847e2d218 100644 --- a/streampark-console/streampark-console-webapp/src/locales/lang/en/setting/flinkHome.ts +++ b/streampark-console/streampark-console-webapp/src/locales/lang/en/setting/flinkHome.ts @@ -28,11 +28,13 @@ export default { descriptionPlaceholder: 'Please enter description', operateMessage: { flinkNameTips: 'the flink name, e.g: flink-1.12', - flinkNameIsUnique: 'flink name is already exists', + flinkNameIsRepeated: 'flink name is already exists', flinkNameIsRequired: 'flink name is required', flinkHomeTips: 'The absolute path of the FLINK_HOME', flinkHomeIsRequired: 'flink home is required', - flinkDistIsRepeated: 'FLINK_HOME error: can no found flink-dist or found multiple flink-dist.', + flinkHomePathIsInvalid: 'flink home path is invalid', + flinkDistNotFound: 'can no found flink-dist in FLINK_HOME/lib', + flinkDistIsRepeated: 'found multiple flink-dist in FLINK_HOME/lib, Must be only one', createFlinkHomeSuccessful: ' create successful!', updateFlinkHomeSuccessful: ' update successful!', }, diff --git a/streampark-console/streampark-console-webapp/src/locales/lang/zh-CN/setting/flinkHome.ts b/streampark-console/streampark-console-webapp/src/locales/lang/zh-CN/setting/flinkHome.ts index 20c1f7563c..c69f59925b 100644 --- a/streampark-console/streampark-console-webapp/src/locales/lang/zh-CN/setting/flinkHome.ts +++ b/streampark-console/streampark-console-webapp/src/locales/lang/zh-CN/setting/flinkHome.ts @@ -31,8 +31,10 @@ export default { flinkNameIsRepeated: 'Flink名称已存在', flinkNameIsRequired: 'Flink名称必填', flinkHomeTips: 'Flink所在服务器的绝对路径,举例: /usr/local/flink', - flinkHomeIsRequired: 'Flink安装路径必填', - flinkDistIsRepeated: 'flink/lib 路径下有且只能有一个flink-dist jar文件,当前未找到或找到多个,请检查!', + flinkHomeIsRequired: 'Flink Home必填', + flinkHomePathIsInvalid: 'Flink Home路径无效', + flinkDistNotFound: 'flink/lib 路径下未找到 flink-dist jar文件', + flinkDistIsRepeated: 'flink/lib 路径下存在多个flink-dist jar文件, 必须只能有一个!', createFlinkHomeSuccessful: ' 创建成功!', updateFlinkHomeSuccessful: ' 更新成功!', }, diff --git a/streampark-console/streampark-console-webapp/src/utils/props.ts b/streampark-console/streampark-console-webapp/src/utils/props.ts index 4a5491b270..4a15ec465b 100644 --- a/streampark-console/streampark-console-webapp/src/utils/props.ts +++ b/streampark-console/streampark-console-webapp/src/utils/props.ts @@ -28,8 +28,8 @@ export type BuildPropOption, R, V, C> = { default?: R extends true ? never : D extends Record | Array - ? () => D - : (() => D) | D; + ? () => D + : (() => D) | D; validator?: ((val: any) => val is C) | ((val: any) => boolean); }; @@ -37,8 +37,8 @@ type _BuildPropType = | (T extends PropWrapper ? T[typeof wrapperKey] : [V] extends [never] - ? ResolvePropTypeWithReadonly - : never) + ? ResolvePropTypeWithReadonly + : never) | V | C; export type BuildPropType = _BuildPropType< @@ -53,8 +53,8 @@ type _BuildPropDefault = [T] extends [ ] ? D : D extends () => T - ? ReturnType - : D; + ? ReturnType + : D; export type BuildPropDefault = R extends true ? { readonly default?: undefined } @@ -146,12 +146,12 @@ export const buildProps = < [K in keyof O]: O[K] extends BuildPropReturn ? O[K] : [O[K]] extends NativePropType - ? O[K] - : O[K] extends BuildPropOption - ? D extends BuildPropType - ? BuildPropOption - : never - : never; + ? O[K] + : O[K] extends BuildPropOption + ? D extends BuildPropType + ? BuildPropOption + : never + : never; }, >( props: O, @@ -162,20 +162,20 @@ export const buildProps = < [K in keyof O]: O[K] extends { [propKey]: boolean } ? O[K] : [O[K]] extends NativePropType - ? O[K] - : O[K] extends BuildPropOption< - infer T, - // eslint-disable-next-line @typescript-eslint/no-unused-vars - infer _D, - infer R, - infer V, - infer C - > - ? BuildPropReturn - : never; + ? O[K] + : O[K] extends BuildPropOption< + infer T, + // eslint-disable-next-line @typescript-eslint/no-unused-vars + infer _D, + infer R, + infer V, + infer C + > + ? BuildPropReturn + : never; }; -export const definePropType = (val: any) => ({ [wrapperKey]: val }) as PropWrapper; +export const definePropType = (val: any) => ({ [wrapperKey]: val } as PropWrapper); export const keyOf = (arr: T) => Object.keys(arr) as Array; export const mutable = >(val: T) => diff --git a/streampark-console/streampark-console-webapp/src/views/base/error-log/data.tsx b/streampark-console/streampark-console-webapp/src/views/base/error-log/data.tsx index 73120a425e..3ffc2f4537 100644 --- a/streampark-console/streampark-console-webapp/src/views/base/error-log/data.tsx +++ b/streampark-console/streampark-console-webapp/src/views/base/error-log/data.tsx @@ -16,12 +16,12 @@ export function getColumns(): BasicColumn[] { text === ErrorTypeEnum.VUE ? 'green' : text === ErrorTypeEnum.RESOURCE - ? 'cyan' - : text === ErrorTypeEnum.PROMISE - ? 'blue' - : ErrorTypeEnum.AJAX - ? 'red' - : 'purple'; + ? 'cyan' + : text === ErrorTypeEnum.PROMISE + ? 'blue' + : ErrorTypeEnum.AJAX + ? 'red' + : 'purple'; return {() => text}; }, }, diff --git a/streampark-console/streampark-console-webapp/src/views/flink/home/components/Modal.vue b/streampark-console/streampark-console-webapp/src/views/flink/home/components/Modal.vue index 1cd7264e30..d53259cdf7 100644 --- a/streampark-console/streampark-console-webapp/src/views/flink/home/components/Modal.vue +++ b/streampark-console/streampark-console-webapp/src/views/flink/home/components/Modal.vue @@ -29,7 +29,7 @@ import { BasicModal, useModalInner } from '/@/components/Modal'; import { useMessage } from '/@/hooks/web/useMessage'; import { fetchCheckEnv, fetchFlinkCreate, fetchFlinkUpdate } from '/@/api/flink/flinkEnv'; - import { FlinkEvnEnum } from '/@/enums/flinkEnum'; + import { FlinkEnvCheckEnum } from '/@/enums/flinkEnum'; const emit = defineEmits(['reload', 'register']); const versionId = ref(null); const { t } = useI18n(); @@ -100,16 +100,24 @@ flinkHome: formValue.flinkHome, }); const checkResp = parseInt(resp.data); - if (checkResp !== FlinkEvnEnum.FEASIBLE) { + if (checkResp !== FlinkEnvCheckEnum.OK) { switch (checkResp) { - case FlinkEvnEnum.INVALID: - Swal.fire('Failed', t('setting.flinkHome.operateMessage.flinkHomePathIsInvalid'), 'error'); + case FlinkEnvCheckEnum.INVALID_PATH: + Swal.fire( + 'Failed', + t('setting.flinkHome.operateMessage.flinkHomePathIsInvalid'), + 'error', + ); break; - case FlinkEvnEnum.NAME_REPEATED: + case FlinkEnvCheckEnum.NAME_REPEATED: Swal.fire('Failed', t('setting.flinkHome.operateMessage.flinkNameIsRepeated'), 'error'); break; - case FlinkEvnEnum.FLINK_DIST_REPEATED: + case FlinkEnvCheckEnum.FLINK_DIST_NOT_FOUND: + Swal.fire('Failed', t('setting.flinkHome.operateMessage.flinkDistNotFound'), 'error'); + break; + case FlinkEnvCheckEnum.FLINK_DIST_REPEATED: Swal.fire('Failed', t('setting.flinkHome.operateMessage.flinkDistIsRepeated'), 'error'); + break; } changeOkLoading(false); return;