Skip to content
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

Open
wants to merge 12 commits into
base: dev
Choose a base branch
from

Conversation

FalconSL
Copy link

@FalconSL FalconSL commented Apr 28, 2024

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


@Data
@TableName("t_ds_version")
public class Version {
Copy link
Member

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> {
Copy link
Member

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);
Copy link
Member

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.

@ruanwenjun
Copy link
Member

Is this PR want to solve #15875 ?

Copy link
Member

@SbloodyS SbloodyS left a 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?

@FalconSL
Copy link
Author

Is this PR want to solve #15875 ?

Is this PR want to solve #15875 ?
Yes, I am currently addressing the issue you mentioned

Is this PR want to solve #15875 ?
I am currently addressing the issue you mentioned, yes, and also addressing 15875

@FalconSL
Copy link
Author

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

@SbloodyS
Copy link
Member

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.

@FalconSL
Copy link
Author

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

@ruanwenjun
Copy link
Member

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.

+1

@github-actions github-actions bot added the UI ui and front end related label Apr 30, 2024
@FalconSL
Copy link
Author

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.

+1
I have modified the backend code as required and submitted the frontend code at the same time. Here is a screenshot of the completed version
image

@FalconSL
Copy link
Author

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.

I have modified the backend code as required and submitted the frontend code at the same time. Here is a screenshot of the completed version
image

wangxj3
wangxj3 previously approved these changes May 6, 2024
@FalconSL FalconSL changed the title [Improvement][ui] improving to find current version identifier(#15815) [Improvement - 15815][ui] improving to find current version identifier(#15815) May 6, 2024
@FalconSL FalconSL changed the title [Improvement - 15815][ui] improving to find current version identifier(#15815) [Improvement-15815][ui] improving to find current version identifier May 6, 2024
@FalconSL FalconSL changed the title [Improvement-15815][ui] improving to find current version identifier [Improvement-15815][ui] Improvement finding current version identifier May 6, 2024
@FalconSL FalconSL changed the title [Improvement-15815][ui] Improvement finding current version identifier [Improvement][ui] improving to find current version identifier(#15815) May 7, 2024
@wangxj3 wangxj3 added the first time contributor First-time contributor label May 8, 2024
Comment on lines 104 to 108
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);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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);

Comment on lines 35 to 36
ProductInfoDto queryProductInfo(User loginUser, int userId);

Copy link
Member

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.

Comment on lines 96 to 112
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;
Copy link
Member

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());
Copy link
Member

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

Comment on lines 127 to 132
private User getLoginUser() {
User user = new User();
user.setId(1);
user.setUserName("admin");
return user;
}
Copy link
Member

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

Copy link
Author

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:

  1. Remove the userid from the input parameter
  2. Change the query for version to selectVersion ()
  3. 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

@SbloodyS SbloodyS added the improvement make more easy to user or prompt friendly label May 8, 2024
@@ -30,4 +32,6 @@

Map<String, Object> queryUiPluginDetailById(int id);

ProductInfoDto queryProductInfo(User loginUser);

Check notice

Code scanning / CodeQL

Useless parameter Note

The parameter 'loginUser' is never used.
@FalconSL FalconSL requested a review from ruanwenjun May 9, 2024 03:18
wangxj3
wangxj3 previously approved these changes May 11, 2024
Copy link
Contributor

@wangxj3 wangxj3 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

caishunfeng
caishunfeng previously approved these changes May 11, 2024
Copy link
Contributor

@caishunfeng caishunfeng left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

some nip

Comment on lines 96 to 97
// * @param loginUser login user
// * @param userId token for user
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// * @param loginUser login user
// * @param userId token for user

Comment on lines 56 to 60
@Autowired
DsVersionMapper dsVersionMapper;

@Autowired
private DsVersionDao dsVersionDao;
Copy link
Contributor

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.

Suggested change
@Autowired
DsVersionMapper dsVersionMapper;
@Autowired
private DsVersionDao dsVersionDao;
@Autowired
private DsVersionDao dsVersionDao;

Copy link
Author

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.

You are right. The actual method used is dsVersionDao, which was not deleted during the last modification. I will delete it immediately
image

@FalconSL FalconSL dismissed stale reviews from caishunfeng and wangxj3 via a524f5e May 11, 2024 10:19
wangxj3
wangxj3 previously approved these changes May 13, 2024
Copy link
Contributor

@wangxj3 wangxj3 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Member

@songjianet songjianet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image
Please deal with the above issues.

@songjianet
Copy link
Member

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.

@FalconSL
Copy link
Author

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

@FalconSL FalconSL requested a review from songjianet May 15, 2024 06:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend first time contributor First-time contributor improvement make more easy to user or prompt friendly UI ui and front end related
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Improvement][ui] Unable to find current version identifier
7 participants