Skip to content

Commit

Permalink
Send app events on upgrade for UI (#14183)
Browse files Browse the repository at this point in the history
  • Loading branch information
sonicaj authored Aug 11, 2024
1 parent e1c750f commit 595b315
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/middlewared/middlewared/plugins/apps/crud.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ def create_internal(
update_app_config(app_name, version, new_values)
update_app_metadata(app_name, app_version_details, migrated_app)
# At this point the app exists
self.middleware.send_event('app.query', 'ADDED', id=app_name)
self.middleware.send_event('app.query', 'ADDED', id=app_name, fields=self.get_instance__sync(app_name))

job.set_progress(60, 'App installation in progress, pulling images')
if dry_run is False:
Expand Down Expand Up @@ -294,7 +294,7 @@ def update_internal(self, job, app, data, progress_keyword='Update'):
# TODO: Eventually we would want this to be executed for custom apps as well
update_app_metadata_for_portals(app_name, app['version'])
job.set_progress(60, 'Configuration updated, updating docker resources')
self.middleware.send_event('app.query', 'CHANGED', id=app_name)
self.middleware.send_event('app.query', 'CHANGED', id=app_name, fields=self.get_instance__sync(app_name))
compose_action(app_name, app['version'], 'up', force_recreate=True, remove_orphans=True)

job.set_progress(100, f'{progress_keyword} completed for {app_name!r}')
Expand Down
4 changes: 3 additions & 1 deletion src/middlewared/middlewared/plugins/apps/rollback.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,9 @@ def rollback(self, job, app_name, options):
# 5) Roll back ix_volume dataset's snapshots if available
# 6) Finally update collective metadata config to reflect new version
update_app_metadata(app_name, rollback_version)
self.middleware.send_event('app.query', 'CHANGED', id=app_name)
self.middleware.send_event(
'app.query', 'CHANGED', id=app_name, fields=self.middleware.call_sync('app.get_instance', app_name)
)
try:
if options['rollback_snapshot'] and (
app_volume_ds := self.middleware.call_sync('app.get_app_volume_ds', app_name)
Expand Down
4 changes: 3 additions & 1 deletion src/middlewared/middlewared/plugins/apps/upgrade.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,9 @@ def upgrade(self, job, app_name, options):

job.set_progress(40, f'Configuration updated for {app_name!r}, upgrading app')

self.middleware.send_event('app.query', 'CHANGED', id=app_name)
self.middleware.send_event(
'app.query', 'CHANGED', id=app_name, fields=self.middleware.call_sync('app.get_instance', app_name)
)
try:
compose_action(app_name, upgrade_version['version'], 'up', force_recreate=True, remove_orphans=True)
finally:
Expand Down

0 comments on commit 595b315

Please sign in to comment.