1
0
mirror of https://github.com/lensapp/lens.git synced 2025-05-20 05:10:56 +00:00

Improve Helm release version detection (#422)

Signed-off-by: Lauri Nevala <lauri.nevala@gmail.com>
This commit is contained in:
Lauri Nevala 2020-06-10 17:07:56 +03:00 committed by GitHub
parent 78eeef2805
commit 879186999f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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 {