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

fix(dashboard): fixup Automated Analysis Card #968

Merged

Conversation

maxcao13
Copy link
Member

@maxcao13 maxcao13 commented Apr 19, 2023

Welcome to Cryostat! 👋

Before contributing, make sure you have:

  • Read the contributing guidelines
  • Linked a relevant issue which this PR resolves
  • Linked any other relevant issues, PR's, or documentation, if any
  • Resolved all conflicts, if any
  • Rebased your branch PR on top of the latest upstream main branch
  • Attached at least one of the following labels to the PR: [chore, ci, docs, feat, fix, test]
  • Signed the last commit: git commit --amend --signoff

Related: https://github.com/cryostatio/cryostat/pull/1457
Depends on: https://github.com/cryostatio/cryostat/pull/1457

Description of the change:

Fixes icons for AA results to fit the result (warning = warningTriangleIcon, error = exclamation point).

This PR also has a hack to separate new JMC IResult fields within description of Rule results.

@github-actions
Copy link

Test image available:

CRYOSTAT_IMAGE=ghcr.io/cryostatio/cryostat-web:pr-968-339e5fe37cf15248310584aea90af2329c5ee3d9 sh smoketest.sh

@github-actions
Copy link

Test image available:

CRYOSTAT_IMAGE=ghcr.io/cryostatio/cryostat-web:pr-968-339e5fe37cf15248310584aea90af2329c5ee3d9 sh smoketest.sh

@tthvo
Copy link
Member

tthvo commented Apr 19, 2023

Seems like another flanky test with jest mocks being called more than expected :((

@github-actions
Copy link

Test image available:

CRYOSTAT_IMAGE=ghcr.io/cryostatio/cryostat-web:pr-968-9db5b8495eb3763d1622735c6106afd56ff911ba sh smoketest.sh

@maxcao13 maxcao13 changed the title fix(archives): fix archived directory get response form + fix AA card result icons fix(dashboard): fix AA card result icons Apr 19, 2023
@maxcao13
Copy link
Member Author

I think I'm going to do a little more refactoring on the card. Some of the rules/results changes from updating to JMC 8.2 are making me consider some changes.

@maxcao13
Copy link
Member Author

Sort of a hack, but it's a little much to change the backend code to account for all of the JMC rule changes at this point in development but thoughts on these changes?

ClickableAALabel tooltip:

image

List view:

image

I found something interesting though, seems like some code somwhere is not picking up on this messageKey:
image
https://github.com/openjdk/jmc/blob/master/core/org.openjdk.jmc.flightrecorder.rules.jdk/src/main/resources/org/openjdk/jmc/flightrecorder/rules/jdk/messages/internal/messages.properties#L632

@maxcao13 maxcao13 changed the title fix(dashboard): fix AA card result icons fix(dashboard): fixup Automated Analysis Card Apr 20, 2023
Signed-off-by: Max Cao <[email protected]>
@maxcao13
Copy link
Member Author

Not sure where these pom property ci issues are coming from...

@github-actions
Copy link

Test image available:

CRYOSTAT_IMAGE=ghcr.io/cryostatio/cryostat-web:pr-968-f32cbc411024a62bd16c0d89952ca29768737243 sh smoketest.sh

@andrewazores
Copy link
Member

I found something interesting though, seems like some code somwhere is not picking up on this messageKey:

That's definitely weird. I'm not sure what's causing that exactly, but it's either something in JMC itself or in how I wrote the part that populates those messages:

cryostatio/cryostat-core@2336321#diff-9f4e83d307a0c834eb25732bd9c56dc920c2a4869c5611143864ee0d85d384faR229

That populateMessage() call is what should be replacing these message keys as well as filling in variable interpolations.

@github-actions
Copy link

Test image available:

CRYOSTAT_IMAGE=ghcr.io/cryostatio/cryostat-web:pr-968-70de5d83e5871cad61d7a34ab878773dd706aeb4 sh smoketest.sh

@maxcao13
Copy link
Member Author

maxcao13 commented Apr 20, 2023

I found something interesting though, seems like some code somwhere is not picking up on this messageKey:

That's definitely weird. I'm not sure what's causing that exactly, but it's either something in JMC itself or in how I wrote the part that populates those messages:

cryostatio/cryostat-core@2336321#diff-9f4e83d307a0c834eb25732bd9c56dc920c2a4869c5611143864ee0d85d384faR229

That populateMessage() call is what should be replacing these message keys as well as filling in variable interpolations.

https://github.com/openjdk/jmc/blob/1fb69d47fa54bbf98e2463c0b07be2272b6f8a87/core/org.openjdk.jmc.flightrecorder.rules.jdk/src/main/java/org/openjdk/jmc/flightrecorder/rules/jdk/io/SocketReadRule.java#L135

I think it's a bug on JMC. They don't call getString so it returns the key instead.

Messages.SocketReadRuleFactory_TEXT_NO_EVENTS -> Messages.getString(Messages.SocketReadRuleFactory_TEXT_NO_EVENTS)

@andrewazores andrewazores merged commit 8147b49 into cryostatio:main Apr 21, 2023
mergify bot pushed a commit that referenced this pull request Apr 21, 2023
* fix aa result icons as well

Signed-off-by: Max Cao <[email protected]>

* revert directoryName field

Signed-off-by: Max Cao <[email protected]>

* summary and explanation, change description wrapping to breakWord

Signed-off-by: Max Cao <[email protected]>

* remove summary on N/A scores

Signed-off-by: Max Cao <[email protected]>

* update snapshot

Signed-off-by: Max Cao <[email protected]>

* split on double newlines

Signed-off-by: Max Cao <[email protected]>

* snapshots, eslint

Signed-off-by: Max Cao <[email protected]>

---------

Signed-off-by: Max Cao <[email protected]>
(cherry picked from commit 8147b49)

export const transformAADescription = (description: string): JSX.Element => {
const splitDesc = description.split('\n\n');
const boldRegex = /^([^:]+:\s?)/; // match text up to and including the first colon
Copy link
Member

Choose a reason for hiding this comment

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

Lets try this:

^([^:]+):\s*(.*)

Tester: https://regex101.com/r/iP2RoX/1

This way, u can pull the matched group out easily.

// Must check matched first
const [_, boldText, content] = matched;

Copy link
Member

Choose a reason for hiding this comment

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

also, we need to check the content (hide it maybe?) as it might be empty (not sure when but best to check).

Copy link
Member

Choose a reason for hiding this comment

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

Opps nvmind :)) I guess this could be a nice refactoring idea then :)

andrewazores pushed a commit that referenced this pull request Apr 21, 2023
* fix aa result icons as well

Signed-off-by: Max Cao <[email protected]>

* revert directoryName field

Signed-off-by: Max Cao <[email protected]>

* summary and explanation, change description wrapping to breakWord

Signed-off-by: Max Cao <[email protected]>

* remove summary on N/A scores

Signed-off-by: Max Cao <[email protected]>

* update snapshot

Signed-off-by: Max Cao <[email protected]>

* split on double newlines

Signed-off-by: Max Cao <[email protected]>

* snapshots, eslint

Signed-off-by: Max Cao <[email protected]>

---------

Signed-off-by: Max Cao <[email protected]>
(cherry picked from commit 8147b49)

Co-authored-by: Max Cao <[email protected]>
@maxcao13 maxcao13 deleted the archive-directory-front-end-handling branch April 21, 2023 21:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
Status: Done
Development

Successfully merging this pull request may close these issues.

3 participants