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

Add generic alert #395

Merged
merged 41 commits into from
Feb 8, 2019
Merged

Add generic alert #395

merged 41 commits into from
Feb 8, 2019

Conversation

jesusreal
Copy link
Contributor

@jesusreal jesusreal commented Feb 6, 2019

Description

Changes proposed in this pull request:

  • Implement generic alert, based on promises and reusing existing alert component for not found paths. Features:
    • Types: 'info'|'success'|'warning'|'error'
    • Optional links to app internal views as part of the alert message
  • In angular example app, add example and e2e tests for generic luigi alert
  • Add documentation for Luigi client
  • Alerts content is sanitised since due to the links we are rendering the content as html, not as a string

Related issue(s)

@bszwarc bszwarc self-assigned this Feb 6, 2019
})
});
processedData.links.forEach(l => {
this.addCLickListener(l.url, l.elemId);
Copy link
Contributor

Choose a reason for hiding this comment

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

here as well :)

Suggested change
this.addCLickListener(l.url, l.elemId);
this.addClickListener(l.url, l.elemId);

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Already pushed that one :)

oncreate() {
const defaultSettings = {
text:
'I am a Luigi alert with extremely relevant information for the user',
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we display an alert with the default value? I don't see any values from showing this kind of message. Maybe we shouldn't show the alert at all in this situation?

Copy link
Contributor Author

@jesusreal jesusreal Feb 6, 2019

Choose a reason for hiding this comment

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

Great point. I will display a message in the browser console if an alert has no text and will not display the alert in the UI. Additionally, I will remove the default values for alerts, since this makes no sense:

      const defaultSettings = {
        type: 'info',
        links: undefined
      };

Copy link
Contributor

@dariadomagala-sap dariadomagala-sap left a comment

Choose a reason for hiding this comment

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

Alerts work good.
Could you just update the overview page - there are links to the uxManager methods that redirect to the same view (backdrop, confirmation modal + now it would also be alerts). We can squash those links to just one.

class="fd-form__control"
data-cy="luigi-alert-text"
/>
With text (if alert has not text it is not displayed)
Copy link
Contributor

Choose a reason for hiding this comment

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

Tiny thing but: has no text 😉

Copy link
Contributor Author

Choose a reason for hiding this comment

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

both updates are done

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.

Added a couple of comments to the js file

client/src/luigi-client.js Outdated Show resolved Hide resolved
client/src/luigi-client.js Outdated Show resolved Hide resolved
* @param {('info'|'success'|'warning'|'error')} settings.type sets the type of the alert
* @param {Object} settings.links provides links data
* @param {Object} settings.links.LINK_KEY object containing the data for a concrete link.
* Read above on how to use the key to for the link to be properly rendered in the alert message.
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
* Read above on how to use the key to for the link to be properly rendered in the alert message.
* To properly render the link in the alert message refer to the description of the **settings.links.LINK.KEY** parameter.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Almost, it is settings.text instead of settings.links.LINK.KEY. I will commit it separately.

client/src/luigi-client.js Outdated Show resolved Hide resolved
client/src/luigi-client.js Outdated Show resolved Hide resolved
client/src/luigi-client.js Outdated Show resolved Hide resolved
bszwarc and others added 6 commits February 7, 2019 11:55
Co-Authored-By: jesusreal <8238188+jesusreal@users.noreply.github.com>
Co-Authored-By: jesusreal <8238188+jesusreal@users.noreply.github.com>
Co-Authored-By: jesusreal <8238188+jesusreal@users.noreply.github.com>
Co-Authored-By: jesusreal <8238188+jesusreal@users.noreply.github.com>
Co-Authored-By: jesusreal <8238188+jesusreal@users.noreply.github.com>
Copy link
Contributor

@dariadomagala-sap dariadomagala-sap left a comment

Choose a reason for hiding this comment

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

LGTM. Great work!

@jesusreal jesusreal merged commit a9dc4b9 into SAP:master Feb 8, 2019
@jesusreal jesusreal deleted the add-generic-alert branch March 13, 2019 10:29
stanleychh pushed a commit to stanleychh/luigi that referenced this pull request Dec 30, 2021
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.

4 participants