Fixes JS part of #95 (#110)

Co-authored-by: Harshit Mehta <harshitm@nvidia.com>
This commit is contained in:
Harshit Mehta
2022-11-24 13:54:57 +05:30
committed by GitHub
parent db9cdeb1c9
commit 5cccb1caa0

View File

@@ -30,8 +30,10 @@ function buildChartCard(elm) {
<div class="col-1 rel-ns text-nowrap"><span>default</span><div>Namespace</div></div> <div class="col-1 rel-ns text-nowrap"><span>default</span><div>Namespace</div></div>
<div class="col-1 rel-date text-nowrap"><span>today</span><div>Updated</div></div> <div class="col-1 rel-date text-nowrap"><span>today</span><div>Updated</div></div>
</div>`) </div>`)
const chartName = elm.chart.substring(0, elm.chart.lastIndexOf("-")) // semver2 regex , add optional v prefix
const chartNameRegex = 'v?(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)(?:-((?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\\.(?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\\+([0-9a-zA-Z-]+(?:\\.[0-9a-zA-Z-]+)*))?'
const chartName = elm.chart.substring(0, elm.chart.match(chartNameRegex).index - 1)
$.getJSON("/api/helm/repo/search?name=" + chartName).fail(function (xhr) { $.getJSON("/api/helm/repo/search?name=" + chartName).fail(function (xhr) {
reportError("Failed to get repo name for charts", xhr) reportError("Failed to get repo name for charts", xhr)
}).done(function (data) { }).done(function (data) {