-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Improve]Improve flink env check method #3461
Conversation
…o improvement-flink-env-check # Conflicts: # streampark-common/src/main/java/org/apache/streampark/common/enums/FlinkEnvStatus.java
Looks good, The front-end code also needs improvement. Looking forward to your next update! 😊 Line 103 in 203c751
|
*/ | ||
Integer check(FlinkEnv version); | ||
String check(FlinkEnv version); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it should be better to return type FlinkEnvStatus
FEASIBLE("ok"), | ||
|
||
/* defined flink name repeated */ | ||
NAME_REPEATED("name repeated"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why remove the code? Need an attribute of type Int(code)
@@ -52,7 +52,7 @@ public RestResponse list() { | |||
@Operation(summary = "Verify flink environment") | |||
@PostMapping("check") | |||
public RestResponse check(FlinkEnv version) { | |||
Integer checkResp = flinkEnvService.check(version); | |||
String checkResp = flinkEnvService.check(version); | |||
return RestResponse.success(checkResp); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Return the code value of the enum FlinkEnvStatus
const checkResp = parseInt(resp.data); | ||
if (checkResp != 0) { | ||
const checkResp = resp.data; | ||
if (checkResp != 'ok') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here is how the front-end (FE) use enums to adapt to the values returned by the back-end (BE), You can refer to it:
27f13ff
to
5b90bdf
Compare
@@ -49,8 +50,6 @@ public class FlinkEnvServiceImpl extends ServiceImpl<FlinkEnvMapper, FlinkEnv> | |||
* two places will be checked: <br> | |||
* 1) name repeated <br> | |||
* 2) flink-dist repeated <br> | |||
* -1) invalid path <br> | |||
* 0) ok <br> | |||
*/ | |||
@Override | |||
public Integer check(FlinkEnv version) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It should be better to return FlinkEnvStatus type instead of Integer
streampark-console/streampark-console-webapp/src/views/flink/home/components/Modal.vue
Show resolved
Hide resolved
if (checkResp !== FlinkEvnEnum.FEASIBLE) { | ||
switch (checkResp) { | ||
case FlinkEvnEnum.INVALID: | ||
Swal.fire('Failed', 'FLINK_HOME invalid path.', 'error'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
error msg should use i18n
case FlinkEvnEnum.FLINK_DIST_REPEATED: | ||
Swal.fire( | ||
'Failed', | ||
'can no found flink-dist or found multiple flink-dist, FLINK_HOME error.', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
error msg should use i18n, e.g: t('setting.flinkHome.operateMessage.FLINK_DIST_REPEATED')
...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sry I know nothing about the front end
cc @RocMarshal |
@@ -32,6 +32,8 @@ export default { | |||
flinkNameIsRequired: 'Flink名称必填', | |||
flinkHomeTips: 'Flink所在服务器的绝对路径,举例: /usr/local/flink', | |||
flinkHomeIsRequired: 'Flink安装路径必填', | |||
flinkHomePathIsInvalid: 'Flink所在路径不合法', | |||
flinkDistIsRepeated: '找不到发行版代码', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
flink lib 路径下有且只能有一个 flink-dist jar 文件
@@ -32,6 +32,8 @@ export default { | |||
flinkNameIsRequired: 'Flink名称必填', | |||
flinkHomeTips: 'Flink所在服务器的绝对路径,举例: /usr/local/flink', | |||
flinkHomeIsRequired: 'Flink安装路径必填', | |||
flinkHomePathIsInvalid: 'Flink所在路径不合法', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Flink Home 路径无效
* [Improve] improve hard code in FlinkEnvServiceImpl * improve front end hard code and back end check method * improve check method return type * improve front end check method logic * improve message support i18n * improve i18n error message --------- Co-authored-by: benjobs <[email protected]>
What changes were proposed in this pull request
improve hard code in FlinkEnvServiceImpl check method
Brief change log
add FlinkEnvStatus.java in
streampark-common/src/main/java/org/apache/streampark/common/enums/
modifty FlinkEnvServiceImpl.java in
streampark-console-service/src/main/java/org/apache/streampark/console/core/service/impl/FlinkEnvServiceImpl.java
Verifying this change
This change is a trivial rework / code cleanup without any test coverage.
Does this pull request potentially affect one of the following parts