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: change description validating logic in lablup-notification #2503

Merged
merged 1 commit into from
Jul 3, 2024

Conversation

ironAiken2
Copy link
Contributor

@ironAiken2 ironAiken2 commented Jul 1, 2024

Existing Problems

The existing web component notification does not output any accompanying description when a text field is provided for the title. ref

However, most of the usage of notifications in web components is providing the notification title through the painkiller, so even if the title of the error is undefined, the painkiller will always provide a specific string (e.g. problem occured). Therefore, a description of the error is never provided.

Changes

  • Changed the logic for checking if description is visible to a comparison to see if it is the same as title.
  • Fixed an issue where the same notification would appear twice when deleting a session.

How to Test

  1. After causing an error in the webui, make sure both title and description are displayed
  2. Delete the session that is causing the deletion error, then verify that the same notification doesn't occur more than once

Checklist: (if applicable)

  • Mention to the original issue
  • Documentation
  • Minium required manager version
  • Specific setting for review (eg., KB link, endpoint or how to setup)
  • Minimum requirements to check during review
  • Test case(s) to demonstrate the difference of before/after

Copy link

graphite-app bot commented Jul 1, 2024

Your org requires the Graphite merge queue for merging into main

Add the label “flow:merge-queue” to the PR and Graphite will automatically add it to the merge queue when it’s ready to merge. Or use the label “flow:hotfix” to add to the merge queue as a hot fix.

You must have a Graphite account and log in to Graphite in order to use the merge queue. Sign up using this link.

Copy link
Contributor Author

ironAiken2 commented Jul 1, 2024

@github-actions github-actions bot added the size:M 30~100 LoC label Jul 1, 2024
@ironAiken2 ironAiken2 requested review from yomybaby and agatha197 July 1, 2024 05:15
@ironAiken2 ironAiken2 marked this pull request as ready for review July 1, 2024 05:27
@ironAiken2 ironAiken2 requested a review from lizable July 2, 2024 01:39
Comment on lines -1895 to -1903
const event = new CustomEvent('backend-ai-resource-refreshed', {
detail: 'running',
});
document.dispatchEvent(event);
Copy link
Member

Choose a reason for hiding this comment

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

Is there any reason to delete this part?

Copy link
Contributor Author

@ironAiken2 ironAiken2 Jul 3, 2024

Choose a reason for hiding this comment

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

The _terminateSessionWithCheck function uses the _terminateKernel function internally. The catch statement is the error catching syntax for the _terminateKernel function, and if an error occurs inside that function, it outputs the error to the notification. Therefore, I removed that code to avoid duplication of the notification. (Duplicate handling in the parent PR is determined by the existence of log, but the corresponding error is the absence of log).

@yomybaby

@ironAiken2 ironAiken2 requested a review from yomybaby July 3, 2024 02:30
Copy link
Contributor

@lizable lizable left a comment

Choose a reason for hiding this comment

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

Works fine. LGTM.

Copy link
Member

@yomybaby yomybaby 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

graphite-app bot commented Jul 3, 2024

Merge activity

### Existing Problems
The existing web component notification does not output any accompanying description when a text field is provided for the title. [ref](https://github.com/lablup/backend.ai-webui/blob/119f64e320befec545680934722a05cce00ede65/src/components/lablup-notification.ts#L196)

However, most of the usage of notifications in web components is providing the notification title through the painkiller, so even if the title of the error is undefined, the painkiller will always provide a specific string (e.g. `problem occured`). Therefore, a description of the error is never provided.

### Changes
- Changed the logic for checking if description is visible to a comparison to see if it is the same as title.
- Fixed an issue where the same notification would appear twice when deleting a session.

### How to Test
1. After causing an error in the webui, make sure both title and description are displayed
2. Delete the session that is causing the deletion error, then verify that the same notification doesn't occur more than once

<!--
Please precisely, concisely, and concretely describe what this PR changes, the rationale behind codes,
and how it affects the users and other developers.
-->

**Checklist:** (if applicable)

- [ ] Mention to the original issue
- [ ] Documentation
- [ ] Minium required manager version
- [ ] Specific setting for review (eg., KB link, endpoint or how to setup)
- [ ] Minimum requirements to check during review
- [ ] Test case(s) to demonstrate the difference of before/after
@yomybaby yomybaby force-pushed the feature/prevent-staking-duplicated-notifications branch from 082820c to e4145c4 Compare July 3, 2024 10:49
@yomybaby yomybaby force-pushed the fix/validate-notification-description branch from f50ad51 to a50d0f4 Compare July 3, 2024 10:50
@yomybaby yomybaby changed the base branch from feature/prevent-staking-duplicated-notifications to main July 3, 2024 10:52
@graphite-app graphite-app bot merged commit a50d0f4 into main Jul 3, 2024
3 checks passed
@graphite-app graphite-app bot deleted the fix/validate-notification-description branch July 3, 2024 10:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size:M 30~100 LoC
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants