-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Provide a notification system (#790)
* Add QbicDialog and interfaces * Add a NotificationDialog.java * Adapt AddProjectDialog.java * update EditProjectInformationDialog.java * Adapt ProjectUserRemovalConfirmationNotification.java * make VariableLevel.java serializable * Move shortcut handling to QBiC dialog * adapt ExperimentalGroupsDialog.java * adapt ExperimentalVariablesDialog.java * close variable dialog after confirm * adapt EditExperimentDialog.java * fix closing on confirm for experiment dialogs * adapt ExistingSamplesPreventGroupEdit.java * fix ProjectDetailsComponent.java * fix ProjectInformationMain.java * adapt MeasurementDeletionConfirmationNotification.java * adapt measurement dialog * adapt sample batch dialogs * adapt dialogs * fix code smells * Add toast notifications * Fix closing on confirmation * remove unused method * do not require close confirmation by default * Use NotificationDialog instead of styled notification * add todo * Add duration configuration * add duration * Modify scope and default values * Fix imports * fix imports * add level to toast properties * adapt styling * add missing comma * add missing parameter * refactor API Co-authored-by: Sven F. <sven1103@users.noreply.github.com> * change toast construction * Update Javadoc * Improve javadoc Co-authored-by: wow-such-code <andreas.friedrich@uni-tuebingen.de> * Fix broken merge * Remove cancel confirmation interfaces * add batch label to event * rename message key * add notification * switch to notificatino factory * switch to notificatino factory * fix imports * fix constructors * remove unused code * remove unused method * add javadoc * remove MessageSourceToastFactory.java * add more javadoc * Change level to warning Co-authored-by: wow-such-code <andreas.friedrich@uni-tuebingen.de> * Add missing reset Co-authored-by: wow-such-code <andreas.friedrich@uni-tuebingen.de> * add missing reset Co-authored-by: wow-such-code <andreas.friedrich@uni-tuebingen.de> * fix closing in AddExperimentDialog.java * Fix closing of EditExperimentDialog.java * adjust EditProjectInformationDialog.java closing * Fix constructors * fire missing events * use cancel confirmation on measurement upload dialog * add ESC behaviour * add missing message * add cancel confirmation for experimental variables * add ESC check for experimental variable editing and creation * Add sample batch registration cancel confirmation * fire missing events * adapt to 5 seconds instead of 5000 --------- Co-authored-by: Sven F. <sven1103@users.noreply.github.com> Co-authored-by: wow-such-code <andreas.friedrich@uni-tuebingen.de>
- Loading branch information
1 parent
1376430
commit 0b11090
Showing
53 changed files
with
1,296 additions
and
550 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
user-interface/frontend/themes/datamanager/components/toast.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
.toast-notification::part(content) { | ||
/*you can style the notification content here*/ | ||
} | ||
|
||
.toast-notification.success-toast::part(content) { | ||
background-color: var(--lumo-success-color-10pct); | ||
/*you can style the notification content here*/ | ||
} | ||
|
||
.toast-notification.info-toast::part(content) { | ||
/*you can style the notification content here*/ | ||
background-color: var(--lumo-primary-color-10pct); | ||
} | ||
|
||
.toast-notification .toast-content { | ||
/*this is the content of your notification excluding the close button*/ | ||
width: 100%; | ||
} | ||
|
||
.toast-notification .toast-content strong { | ||
margin-left: .5ch; | ||
margin-right: .5ch; | ||
} | ||
|
||
.toast-notification .close-button { | ||
/*you can style the toast close button here*/ | ||
} | ||
|
||
.toast-notification .routing-container { | ||
display: grid; | ||
grid-template-columns: minmax(min-content, max-content) auto minmax(min-content, max-content); | ||
column-gap: var(--lumo-space-m); | ||
} | ||
|
||
.toast-notification .routing-content { | ||
/*in case of routing this can style the content without the routing link*/ | ||
align-content: center; | ||
} | ||
|
||
.toast-notification .routing-link { | ||
grid-column: 3; | ||
align-content: center; | ||
justify-content: center; | ||
} |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 0 additions & 47 deletions
47
...rface/src/main/java/life/qbic/datamanager/views/CancelConfirmationNotificationDialog.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
user-interface/src/main/java/life/qbic/datamanager/views/general/ComponentFunctions.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package life.qbic.datamanager.views.general; | ||
|
||
import static java.util.Objects.nonNull; | ||
|
||
import com.vaadin.flow.component.Component; | ||
|
||
public class ComponentFunctions { | ||
|
||
private ComponentFunctions() { | ||
} | ||
|
||
/** | ||
* Navigates up through the tree and checks whether the potential parent is an actual ancestor of | ||
* the other component. | ||
* | ||
* @param potentialParent the component suspected to be a parent of the other component | ||
* @param other the potential child component | ||
* @return true if protential parent is a parent of the other component | ||
*/ | ||
public static boolean isParentOf(Component potentialParent, Component other) { | ||
var currentParent = other.getParent().orElse(null); | ||
while (nonNull(currentParent)) { | ||
if (currentParent.equals(potentialParent)) { | ||
return true; | ||
} | ||
currentParent = currentParent.getParent().orElse(null); | ||
} | ||
return false; | ||
} | ||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
user-interface/src/main/java/life/qbic/datamanager/views/general/QbicDialog.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package life.qbic.datamanager.views.general; | ||
|
||
import com.vaadin.flow.component.Key; | ||
import com.vaadin.flow.component.ShortcutEventListener; | ||
import com.vaadin.flow.component.ShortcutRegistration; | ||
import com.vaadin.flow.component.Shortcuts; | ||
import com.vaadin.flow.component.dialog.Dialog; | ||
import com.vaadin.flow.server.Command; | ||
import java.util.Objects; | ||
|
||
/** | ||
* A {@link Dialog} with additional functionality. | ||
* <p> | ||
* | ||
* @see Dialog | ||
* @since 1.4.0 | ||
*/ | ||
public class QbicDialog extends Dialog { | ||
|
||
private ShortcutRegistration escShortcut; | ||
|
||
public QbicDialog() { | ||
setCloseOnOutsideClick(false); | ||
setCloseOnEsc(false); | ||
setEscAction(it -> this.close()); | ||
} | ||
|
||
public void setEscAction(ShortcutEventListener listener) { | ||
if (Objects.nonNull(escShortcut)) { | ||
escShortcut.remove(); | ||
} | ||
escShortcut = Shortcuts.addShortcutListener(this, listener, Key.ESCAPE); | ||
} | ||
|
||
public void setEscAction(Command command) { | ||
if (Objects.nonNull(escShortcut)) { | ||
escShortcut.remove(); | ||
} | ||
escShortcut = Shortcuts.addShortcutListener(this, command, Key.ESCAPE); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.