Skip to content

Conversation

@hehoon
Copy link
Collaborator

@hehoon hehoon commented Jan 5, 2026

I have JIRA issue created

  • branch and/or PR name(s) includes JIRA ID
  • issue has "Fix version" assigned
  • issue "Status" is set to "In review"
  • PR labels are selected
  • FLP integration tests were ran successful

Depends on:

Changes:

  • Added a websocket to broadcast new runs from backend towards front-end
  • Added a menu item in the profile (click on top left profile button to open menu) to enable browser notifications.
    • Front-end browser checks whether the user enabled this settings before displaying a notification

@hehoon hehoon force-pushed the feature/QCG/OGUI-1854/notify-user-when-a-new-run-has-started branch from caf1e3f to db1b8f2 Compare January 6, 2026 13:19
@hehoon hehoon marked this pull request as ready for review January 6, 2026 14:03
@hehoon hehoon requested a review from graduta as a code owner January 6, 2026 14:03
this._ongoingRuns.delete(runNumber);
}

const wsMessage = new WebSocketMessage();
Copy link
Member

Choose a reason for hiding this comment

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

Each event sent by Kafka on the run track has multiple transitions. For the notification of the user, we should only send one broadcast message when we receive the event of START_ACTIVITY: L127
Otherwise, we risk sending up to 10 messages for a run start at various intervals of seconds
This information should have been provided in the ticket but it was not, I apologise for the confusion

bookkeepingService,
dataService,
eventEmitter,
ws,
Copy link
Member

Choose a reason for hiding this comment

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

As this is passed as a parameter, could you please use a more descriptive naming? Perhaps webSocketService or something along those lines

* @returns {undefined}
*/
async _handleWSRunTrack({ runNumber, transition }) {
if (transition !== Transition.START_ACTIVITY) {
Copy link
Member

Choose a reason for hiding this comment

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

With the backend change to only notify on start activity, this check can be removed

let permissionGranted = false;
if (event.target.checked) {
const permission = await requestBrowserNotificationPermissions();
permissionGranted = permission === BrowserNotificationPermission.GRANTED;
Copy link
Member

Choose a reason for hiding this comment

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

What about using the framework's method areBrowserNotificationsGranted instead?

model.session.personid === 0 // Anonymous user has id 0
? h('p.m3.gray-darker', 'This instance of the application does not require authentication.')
: h('a.menu-item', { onclick: () => alert('Not implemented') }, 'Logout'),
h(
Copy link
Member

Choose a reason for hiding this comment

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

It would be great to extract this into its own documented component which should recieve only the needed model notificationRunStartModel

Comment on lines 87 to 96
onclick: () => {
const { isRunModeActivated } = this.model.filterModel;
if (!isRunModeActivated) {
const viewModel = this.model.filterModel.getPageTargetModel();
if (viewModel) {
this.model.filterModel.activateRunsMode(viewModel);
}
}

this.model.filterModel.setFilterValue('RunNumber', runNumber?.toString(), true);
Copy link
Member

Choose a reason for hiding this comment

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

I believe this method's logic can be improved and I should have provided more details in the requirements.

Basically, when such a notification is provided the user can either be:

  1. In RunMode of a previous RunNumber (for sure it cannot be in the current one)
  • in this case, the method should update the run mode with new runNumber
  1. Outside of runMode
    a. If Kafka is configured, then the method should activate run mode with new run number
    b. If Kafka is not configured, the method simply update the Filter RunNumber parameter with new run number and trigger the filtering

In all scenarios, the user should be taken back to objectTree page no matter where they were

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This has been adjusted to support scenario 1 and 2a 👍 .

To receive notifications from the websocket kafka must be enabled, so I believe scenario 2b cannot occur. Do let me know if I missed something.

* are enabled for the current user.
* @returns {boolean} `true` if notifications are enabled, `false` otherwise.
*/
getBrowserNotificationSetting() {
Copy link
Member

Choose a reason for hiding this comment

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

Should this method not take into account the browser's permissions?
I am thinking of the following use case:

  • user enables notifications via QCG which in turns saves it as true in the local storage
  • at some point they disable the notifications via the browser instead. At this point, QCG still thinks notifications are enabled and will be sent but instead they will not be.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Good catch, this has been adjusted 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

3 participants