From 3647872369c630993d0d0cd1ff37aac69fd16c1d Mon Sep 17 00:00:00 2001 From: ihiverlet <94982379+ihiverlet@users.noreply.github.com> Date: Fri, 19 Jul 2024 10:43:18 +0200 Subject: [PATCH] Add friendly name in events when installing a service (#454) --- .../onyxia/api/events/InstallServiceEvent.java | 13 ++++++++++++- .../api/events/SuspendResumeServiceEvent.java | 2 +- .../onyxia/api/services/impl/HelmAppsService.java | 3 ++- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/onyxia-api/src/main/java/fr/insee/onyxia/api/events/InstallServiceEvent.java b/onyxia-api/src/main/java/fr/insee/onyxia/api/events/InstallServiceEvent.java index 8e33423d..89bb1558 100644 --- a/onyxia-api/src/main/java/fr/insee/onyxia/api/events/InstallServiceEvent.java +++ b/onyxia-api/src/main/java/fr/insee/onyxia/api/events/InstallServiceEvent.java @@ -6,6 +6,7 @@ public class InstallServiceEvent extends OnyxiaEvent { private String namespace; private String releaseName; private String packageName; + private String friendlyName; public String getReleaseName() { return releaseName; @@ -23,6 +24,14 @@ public void setPackageName(String packageName) { this.packageName = packageName; } + public String getFriendlyName() { + return friendlyName; + } + + public void setFriendlyName(String friendlyName) { + this.friendlyName = friendlyName; + } + private String username; private String catalogId; @@ -33,12 +42,14 @@ public InstallServiceEvent( String namespace, String releaseName, String packageName, - String catalogId) { + String catalogId, + String friendlyName) { this.namespace = namespace; this.releaseName = releaseName; this.catalogId = catalogId; this.username = username; this.packageName = packageName; + this.friendlyName = friendlyName; } public String getUsername() { diff --git a/onyxia-api/src/main/java/fr/insee/onyxia/api/events/SuspendResumeServiceEvent.java b/onyxia-api/src/main/java/fr/insee/onyxia/api/events/SuspendResumeServiceEvent.java index 5c9427ca..8ba57c2c 100644 --- a/onyxia-api/src/main/java/fr/insee/onyxia/api/events/SuspendResumeServiceEvent.java +++ b/onyxia-api/src/main/java/fr/insee/onyxia/api/events/SuspendResumeServiceEvent.java @@ -13,7 +13,7 @@ public SuspendResumeServiceEvent( String packageName, String catalogId, boolean suspend) { - super(username, namespace, releaseName, packageName, catalogId); + super(username, namespace, releaseName, packageName, catalogId, null); this.isSuspend = suspend; } diff --git a/onyxia-api/src/main/java/fr/insee/onyxia/api/services/impl/HelmAppsService.java b/onyxia-api/src/main/java/fr/insee/onyxia/api/services/impl/HelmAppsService.java index 93ba7702..bcd95952 100644 --- a/onyxia-api/src/main/java/fr/insee/onyxia/api/services/impl/HelmAppsService.java +++ b/onyxia-api/src/main/java/fr/insee/onyxia/api/services/impl/HelmAppsService.java @@ -127,7 +127,8 @@ public Collection installApp( namespaceId, requestDTO.getName(), pkg.getName(), - catalogId); + catalogId, + requestDTO.getFriendlyName()); onyxiaEventPublisher.publishEvent(installServiceEvent); Map metadata = new HashMap<>(); metadata.put("catalog", Base64Utils.base64Encode(catalogId));