Don't complain if repo is not found for chart

Fixes #116
This commit is contained in:
Andrei Pohilko
2022-11-24 15:15:20 +00:00
parent 4f75ee06a0
commit 2557e6b73d

View File

@@ -48,11 +48,12 @@ function buildChartCard(elm) {
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 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) 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) // we're ok if we can't show icon and description
console.log("Failed to get repo name for charts", xhr)
}).done(function (data) { }).done(function (data) {
if (data.length > 0) { if (data.length > 0) {
$.getJSON("/api/helm/charts/show?name=" + data[0].name).fail(function (xhr) { $.getJSON("/api/helm/charts/show?name=" + data[0].name).fail(function (xhr) {
reportError("Failed to get list of charts", xhr) console.log("Failed to get chart", xhr)
}).done(function (data) { }).done(function (data) {
if (data) { if (data) {
const res = data[0]; const res = data[0];