From 879186999fad75b5ac1939aebd77be38da4f15bc Mon Sep 17 00:00:00 2001 From: Lauri Nevala Date: Wed, 10 Jun 2020 17:07:56 +0300 Subject: [PATCH] Improve Helm release version detection (#422) Signed-off-by: Lauri Nevala --- dashboard/client/api/endpoints/helm-releases.api.ts | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/dashboard/client/api/endpoints/helm-releases.api.ts b/dashboard/client/api/endpoints/helm-releases.api.ts index 5e676f3472..52f797b006 100644 --- a/dashboard/client/api/endpoints/helm-releases.api.ts +++ b/dashboard/client/api/endpoints/helm-releases.api.ts @@ -156,9 +156,12 @@ export class HelmRelease implements ItemObject { } getChart(withVersion = false) { - return withVersion ? - this.chart : - this.chart.substr(0, this.chart.lastIndexOf("-")); + let chart = this.chart + if(!withVersion && this.getVersion() != "" ) { + const search = new RegExp(`-${this.getVersion()}`) + chart = chart.replace(search, ""); + } + return chart } getRevision() { @@ -170,7 +173,7 @@ export class HelmRelease implements ItemObject { } getVersion() { - const versions = this.chart.match(/(\d+)[^-]*$/) + const versions = this.chart.match(/(v?\d+)[^-].*$/) if (versions) { return versions[0] } else {