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

Alert improvements #480

Merged
merged 35 commits into from
Apr 24, 2019
Merged

Conversation

parostatkiem-zz
Copy link
Contributor

@parostatkiem-zz parostatkiem-zz commented Apr 12, 2019

Description

Changes proposed in this pull request:

  • Alerts are queued
  • a closeAfter property can be provided via Luigi API to (surprise!) close the Alert after the desired time
  • Client API part is backwards compatible
  • add UI tests for the new features
  • update Client API docu
  • showing Alert from Core is not backwards-compatible so the only place where it is used needed to be tuned up a bit

Related issue(s)

Copy link
Contributor

@bszwarc bszwarc left a comment

Choose a reason for hiding this comment

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

just one :D

client/src/luigi-client.js Outdated Show resolved Hide resolved
@maxmarkus maxmarkus added area/luigi enhancement New feature or request labels Apr 15, 2019
…lert-improvements

# Conflicts:
#	client/src/luigi-client.js
#	docs/luigi-client-api.md
@pekura pekura self-assigned this Apr 16, 2019
Copy link
Contributor

@pekura pekura left a comment

Choose a reason for hiding this comment

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

Please take a look at the code-related comments plus this one:

If multiple alerts are shown coming from older clients (without IDs) and you close one of them, then all of them are closed at once. We need to accept alerts without IDs (backwards-compatibility) but we need to distinguish them on the core side so that they can by closed one by one.

settings: Object.assign(this.get().settings, {
text: processedData.sanitizedText
}),
alertQueue: processedAlerts,
dataSanitized: true
Copy link
Contributor

Choose a reason for hiding this comment

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

We need the 'dataSanitized' flag per alert - not globally. Otherwise when a new alert comes it will be displayed unprocessed and unsanitized for a moment (if malicious client sends us an alert with 'sanitizedText' property already set and containing malicious code) which is enough for injected code to get executed.

}

if (settings.closeAfter) {
setTimeout(() => {
Copy link
Contributor

Choose a reason for hiding this comment

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

If the alert gets closed manually before the timeout an error is shown in the console: "An unexisting alert has been dismissed.". There is nothing wrong with closing an alert manually so there should not be any error shown.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll investigate it.

@y-kkamil y-kkamil self-assigned this Apr 16, 2019
Copy link
Contributor

@pekura pekura left a comment

Choose a reason for hiding this comment

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

Having multiple alerts with the same link (link id) makes the link only work in the topmost alert.
We need to incorporate the (sanitized) alert id when we generate the "elemId" used for click listener.

client/src/luigi-client.js Outdated Show resolved Hide resolved
@@ -1,6 +1,7 @@
var crypto = require("crypto");

Choose a reason for hiding this comment

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

we have singleQuote set to true in the prettier's options. somehow it didn't work here - please check if your hooks are installed properly and run prettier again.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@parostatkiem-zz parostatkiem-zz merged commit 75b9a33 into SAP:master Apr 24, 2019
@parostatkiem-zz parostatkiem-zz deleted the alert-improvements branch April 24, 2019 09:35
stanleychh pushed a commit to stanleychh/luigi that referenced this pull request Dec 30, 2021
* Assign IDs; add ability to remove alerts

* Add 'closeAfter' mechanizm

* Update docu

* Correct linter errors

* e2e tests 

* Update TTL mechanizm to respect the queue; tiny update of Alert usage from Core

* Fix error with closing already closed alerts

* Make 'dataSanitized' flag individual per alert

* Generate ID on Core side in case it hasn't came from Client

* Fix bug with Example app disabling Type input field

* formatting

* Pass alert id to link IDs

* Fix failing test
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants