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
[Improvement][ui] improving to find current version identifier(#15815) #15933
base: dev
Are you sure you want to change the base?
Conversation
|
||
@Data | ||
@TableName("t_ds_version") | ||
public class 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.
There already exist DsVersion
/** | ||
* user mapper interface | ||
*/ | ||
public interface VersionMapper extends BaseMapper<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.
Duplicate with DsVersionMapper
.
@@ -30,4 +32,6 @@ public interface UiPluginService { | |||
|
|||
Map<String, Object> queryUiPluginDetailById(int id); | |||
|
|||
Map<String, Object> queryProductInfo(User loginUser, int userId); |
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.
Please use a specific object rather than `Map<String, Object> as the service method result.
Is this PR want to solve #15875 ? |
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 can't find the code for the UI part. Where is it?
The front-end code has also been completed and will be submitted after the back-end is error free |
Features like this need to be committed at both the backend and frontend. |
Okay, then I will modify the interface return class and resubmit the front-end and back-end code |
+1 |
...heduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/UiPluginController.java
Outdated
Show resolved
Hide resolved
...ler-api/src/test/java/org/apache/dolphinscheduler/api/controller/UiPluginControllerTest.java
Outdated
Show resolved
Hide resolved
public Result<ProductInfoDto> queryProductInfo( | ||
@Parameter(hidden = true) @RequestAttribute(value = Constants.SESSION_USER) User loginUser, | ||
@RequestParam(value = "userId") Integer userId) { | ||
ProductInfoDto result = uiPluginService.queryProductInfo(loginUser, userId); | ||
return Result.success(result); |
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.
public Result<ProductInfoDto> queryProductInfo( | |
@Parameter(hidden = true) @RequestAttribute(value = Constants.SESSION_USER) User loginUser, | |
@RequestParam(value = "userId") Integer userId) { | |
ProductInfoDto result = uiPluginService.queryProductInfo(loginUser, userId); | |
return Result.success(result); | |
public Result<ProductInfoDto> queryProductInfo( | |
@Parameter(hidden = true) @RequestAttribute(value = Constants.SESSION_USER) User loginUser) { | |
ProductInfoDto result = uiPluginService.queryProductInfo(loginUser); | |
return Result.success(result); |
ProductInfoDto queryProductInfo(User loginUser, int userId); | ||
|
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's weird that there exists a method queryProductInfo
in uiPluginServer.
public ProductInfoDto queryProductInfo(User loginUser, int userId) { | ||
|
||
// check if user is existed | ||
if (userId <= 0 || !(loginUser.getId() == userId)) { | ||
throw new ServiceException(Status.REQUEST_PARAMS_NOT_VALID_ERROR, | ||
"User id: " + userId + " should not less than or equals to 0."); | ||
} | ||
// persist to the database | ||
DsVersion dsVersion = dsVersionMapper.selectById(1); | ||
|
||
if(StringUtils.isBlank(dsVersion.getVersion())){ | ||
throw new ServiceException(Status.VERSION_INFO_STATE_ERROR); | ||
} | ||
ProductInfoDto result = new ProductInfoDto(); | ||
result.setId(dsVersion.getId()); | ||
result.setVersion(dsVersion.getVersion()); | ||
return result; |
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.
Don't query the version by id, id might changed.
|
||
Result result = JSONUtils.parseObject(mvcResult.getResponse().getContentAsString(), Result.class); | ||
Assertions.assertEquals(Status.SUCCESS.getCode(), result.getCode().intValue()); | ||
logger.info(mvcResult.getResponse().getContentAsString()); |
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.
Don't use log in UT
private User getLoginUser() { | ||
User user = new User(); | ||
user.setId(1); | ||
user.setUserName("admin"); | ||
return user; | ||
} |
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.
Don't add useless code
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.
Don't add useless code
Based on your proposal, I have made the following modifications:
- Remove the userid from the input parameter
- Change the query for version to selectVersion ()
- Remove log() and redundant methods in UT
In addition, the queryProductInfo method in uiPluginService was submitted this time and there are no duplicate named methods in the project, so the method name has not been changed
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.
LGTM
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.
some nip
// * @param loginUser login user | ||
// * @param userId token for user |
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.
// * @param loginUser login user | |
// * @param userId token for user |
@Autowired | ||
DsVersionMapper dsVersionMapper; | ||
|
||
@Autowired | ||
private DsVersionDao dsVersionDao; |
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's better to use dao in service but not mapper.
@Autowired | |
DsVersionMapper dsVersionMapper; | |
@Autowired | |
private DsVersionDao dsVersionDao; | |
@Autowired | |
private DsVersionDao dsVersionDao; |
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.
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.
LGTM
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.
Personally, I feel that there is no need to use a separate page to display the current version. You can put the version information at the top of this drop-down menu. |
Okay, I have removed the unused front-end references. According to my original plan, after completing the version function, document help, problem report submission, policy instructions, and service terms will also be placed on this page. If the version information is placed separately in the homepage column and other functions are added, it will appear crowded |
Purpose of the pull request
close #15815
Brief change log
The version identifier of dolphinscheduler cannot be found on the UI. Please add the current version identifier on the UI.
在WEB 的UI界面上 无法找到当前运行的 dolphinscheduler 版本信息,无法确定当前运行的版本。
Verify this pull request
This pull request is code cleanup without any test coverage.
(or)
This pull request is already covered by existing tests, such as (please describe tests).
(or)
This change added tests and can be verified as follows:
at testQueryProductInfo() method of UiPluginControllerTest class
(or)
If your pull request contain incompatible change, you should also add it to
docs/docs/en/guide/upgrede/incompatible.md