-
Notifications
You must be signed in to change notification settings - Fork 70
Fix dashboard URLs direct accessing issue and Modified URL patterns #732
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
Conversation
In order to fix direct accessing issue, it is required to have these APIs. Since we are changing the URL patterns, changed web context root path parameter as well.
Modified URLs of the TESTGRID dashboard pages and fixed the direct accessing issue of those pages. Further added bootstrap styling for pages and fixed issues which are related to displaying info on infra combination page. Further fixed formatting issues as well.
status.setId(product.getId()); | ||
status.setName(StringUtil.concatStrings(product.getName())); | ||
status.setProductId(product.getId()); | ||
status.setProductName(StringUtil.concatStrings(product.getName())); |
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 we don't need to use StringUtil.concatStrings here.
@@ -138,6 +138,44 @@ public Response getAllProductStatuses() { | |||
return Response.status(Response.Status.OK).entity(list).build(); | |||
} | |||
|
|||
/** | |||
* This method returns the product that are currently in TestGrid. |
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.
This comment does not properly imply the purpose of the API. Shall we change it?
if (productInstance.isPresent()) { | ||
product = productInstance.get(); | ||
productStatus.setProductId(product.getId()); | ||
productStatus.setProductName(StringUtil.concatStrings(product.getName())); |
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 we don't need to use StringUtil.concatStrings here.
<img | ||
src={require('../success.png')} | ||
style={{ | ||
verticalAlign: "middle", |
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.
Shall we specify classes for these elements and write the styles in a separate css file? That way we will not need to duplicate the styles. We can do it as a separate effort btw.
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.
+1 yes, we have to move this type of repeating styling into a separate CSS file. This fix resolves formatting issues and +1 for addressing this in a separate effort. Further, IMO we can use icons instead of these images. WDYT
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.
+1 for moving to icons. Using images will slow down page loading time plus increase the size.
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.
Let's raise a ticket and handle it elsewhere. We will have new set of statuses pretty soon as well.
Added requested changes from PR review and fixed some minor issues
productStatus.setProductStatus(testPlanUOW.getCurrentStatus(product).toString()); | ||
} else { | ||
String msg = "Could not found a product for requested product name in the TestGrid."; | ||
logger.error(msg); |
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.
How meaningful is this error log? Shall we improve the log message?
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.
Fixed with 4be247e
return Response.status(Response.Status.OK).entity(productStatus).build(); | ||
} catch (TestGridDAOException e) { | ||
String msg = "Error occurred while fetching the Product statuses "; | ||
logger.error(msg, e); |
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.
Same as above. When running multiple products a production system, this error log won't provide enough data to debug an issue.
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.
Fixed with 4be247e
<td> <img src={require('../play.png')} width="36" height="36" data-tip="Execute job" => | ||
{ window.location = '/job/'+ product.productName +'/build' }} /> <ReactTooltip /></td> | ||
<td ><img src={require('../configure.png')} width="36" height="36" => { window.location = | ||
'/job/'+ product.productName +'/configure' }} data-tip="Configure job" style={{ cursor: 'pointer' }}/> |
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.
Is this URL correct? The /job/job-name/configure is coming from Jenkins webapp.
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.
Fixed with 12488d2
</Modal> | ||
</div> | ||
) | ||
} | ||
} | ||
|
||
export default ProductStatusView; |
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.
Missing new line. Not your code though. :)
6D4EThere 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.
Fixed with 5abab08
@@ -18,120 +18,120 @@ | |||
|
|||
import React, { Component } from 'react'; | |||
import Moment from 'moment'; | |||
import {FAIL,SUCCESS,ERROR,PENDING,RUNNING,INCOMPLETE,DID_NOT_RUN} from '../constants.js'; | |||
import {SUCCESS,ERROR,PENDING,RUNNING,INCOMPLETE,DID_NOT_RUN} from '../constants.js'; |
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 FAIL?
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.
Do we have some kind of js linting mechanism?
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.
AFAIK we don't use js linting mechanism. IMO we can use https://eslint.org/. WDYT?
SingleRecord is a component and we have used it to return respective image for given status. In here we have used a switch statement and FAIL is treated as default. Hence removed the import of FAIL.
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.
+1 for eslint.
} | ||
} | ||
} | ||
|
||
export default SingleRecord |
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.
missing new line.
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.
Fixed with 5abab08
this.state = { | ||
testScenarioSummaries: [], | ||
scenarioTestCaseEntries: [], | ||
testSummaryLoadStatus: PENDING, |
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.
PENDING status means that the test is still running. Does it make sense to change the default status to DID_NOT_RUN which shows a gray-colored icon? When the actual data comes, we can populate with correct properties. wdyt?
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.
+1 It is the better approach and let's raise a separate ticket and handle this as well.
let currentInfra = {}; | ||
let currentUrl = window.location.href.split("/"); | ||
currentInfra.relatedProduct = currentUrl[currentUrl.length - 4]; | ||
currentInfra.relatedDeplymentPattern = currentUrl[currentUrl.length - 3]; |
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.
L63-L64 code logic is vulnerable for any change in URL contexts. It may fail silently. Is there a better way to handle this? Probably we can use some kind of regex or something similar to jax-rs @path annotation value.
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.
This page will render when URL pattern matches to https://<host>:<port>/<product-ame>/<deployment-pattern-name>/test-plans/<testplan-id>
.
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.
Ah ok..
} | ||
return response; | ||
} | ||
handleError(response) { |
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.
Shall we go with two-space indentation for JS files?
JS and HTML files tend to have lot of inner elements. Four-space indentation makes it a bit harder to read.
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.
+1 Let's add two-space indentation for JS files.
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.
Cool.. Can you change and re-send?
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.
Fixed with 5c24430
case FAIL: | ||
return <Subheader style={{ | ||
fontSize: '20px', | ||
backgroundColor: "#ffd6d3" |
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.
Is it advisable set css styling info within the js files like this? What's the best practice for better maintainability of the 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.
AFAIK inline CSS is not a good practice. Let's raise a ticket and handle these kind of things. WDYT?
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.
+1
textAlign: "center", | ||
fontSize: "20px", | ||
wordWrap: "break-word", | ||
whiteSpace: "wrap" |
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.
hard-coded css within js files.
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.
Shall we raise a separate ticket and handle this?
: | ||
<img width="36" | ||
height="36" | ||
src={require('../close.png')}/>} |
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.
@lasanthaDLPDS As you see, four-space indentation tend to make the codes right-aligned. :)
It's a bit harder to read as well.
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.
Fixed with 5c24430
|
||
const ScenarioContainer = connect( | ||
mapStateToProps | ||
)(ScenarioView) | ||
)(ScenarioView); | ||
|
||
export default ScenarioContainer; |
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.
Missing new line.
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.
Fixed with 5abab08
Some js files has missed new line at the end of the file. Hence added it for missed js files
Purpose
The purpose of this PR is to fix TESTGRID dashboard URLs direct accessing issue. This resolves #425, resolves #731, resolves #730
Goals
In order to fix TESTGRID dashboard URLs direct accessing issue, check the existing of properties at the page loading time. If those are not available invoke d backend API and get required data to render pages. Further added bootstrap styling for pages and fixed issues which are related to displaying info on infra combination page and fixed formatting issues as well.
Approach
User stories
N/A
Release note
N/A
Documentation
N/A
Training
N/A
Certification
N/A
Marketing
N/A
Automation tests
N/A
N/A
Security checks
Samples
N/A
Related PRs
N/A
Migrations (if applicable)
N/A
Test environment
JDK - 1.8
OS - Ubuntu
DB - MySQL
Browser - Chrome
Learning
N/A