Skip to content

Commit

Permalink
Add links to Komodor
Browse files Browse the repository at this point in the history
  • Loading branch information
undera committed Mar 7, 2023
1 parent d95cac9 commit a0680a4
Show file tree
Hide file tree
Showing 6 changed files with 48 additions and 13 deletions.
19 changes: 15 additions & 4 deletions pkg/dashboard/handlers/helmHandlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,6 @@ func (h *HelmHandler) RepoCharts(c *gin.Context) {
return
}

// TODO: enrich with installed
enrichRepoChartsWithInstalled(charts, installed)

sort.Slice(charts, func(i, j int) bool {
Expand Down Expand Up @@ -580,18 +579,30 @@ func (h *HelmHandler) repoFromArtifactHub(name string) (string, error) {
}

sort.SliceStable(results, func(i, j int) bool {
ri, rj := results[i], results[j]

// we prefer official repos
if results[i].Repository.Official && !results[j].Repository.Official {
if ri.Repository.Official && !rj.Repository.Official {
return true
}

// or from verified publishers
if results[i].Repository.VerifiedPublisher && !results[j].Repository.VerifiedPublisher {
if ri.Repository.VerifiedPublisher && !rj.Repository.VerifiedPublisher {
return true
}

// or just more popular
return results[i].Stars > results[j].Stars
if ri.Stars > rj.Stars {
return true
}

// or with more recent app version

if semver.Compare("v"+ri.AppVersion, "v"+rj.AppVersion) > 0 {
return true
}

return false
})

r := results[0]
Expand Down
6 changes: 5 additions & 1 deletion pkg/dashboard/static/details-view.js
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ function showResources(namespace, chart, revision) {
const statusBlock = resBlock.find(".res-status");
statusBlock.empty().append(badge).attr("title", data.status.phase)
const statusMessage = getStatusMessage(data.status)
resBlock.find(".res-statusmsg").html("<span class='text-muted small'>" + (statusMessage ? statusMessage : '') + "</span>")
resBlock.find(".res-statusmsg").html("<span class='text-muted small me-2'>" + (statusMessage ? statusMessage : '') + "</span>")

if (badge.text() !== "NotFound" && revision == $("#specRev").data("last-rev")) {
resBlock.find(".res-actions")
Expand All @@ -215,6 +215,10 @@ function showResources(namespace, chart, revision) {
})
}
}

if (badge.hasClass("bg-danger")) {
resBlock.find(".res-statusmsg").append("<a href='" + KomodorCTALink + "' class='btn btn-primary btn-sm fw-normal fs-80' target='_blank'>Troubleshoot in Komodor <i class='bi-box-arrow-up-right'></i></a>")
}
})
}
})
Expand Down
26 changes: 20 additions & 6 deletions pkg/dashboard/static/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,15 @@
</a></li>
</ul>
<div>
<a class="btn" href="https://komodor.com/?utm_campaign=Helm-Dash&utm_source=helm-dash"><img
src="static/komodor-logo.svg" alt="komodor.io"
style="height: 1.2rem; vertical-align: text-bottom; filter: grayscale(00%);"></a>
<div class="border-muted text-muted border rounded p-1 pe-2 me-3 d-flex">
<img alt="Komodor" src="./static/komodor-icon.png" class="me-2" style="width: 42px; height: 42px"/>
<span class="text-nowrap">
<a href="https://www.komodor.com/helm-dash/?utm_campaign=Helm%20Dashboard%20%7C%20CTA&utm_source=helm-dash&utm_medium=cta&utm_content=helm-dash"
class="link text-primary fw-bold text-decoration-none">Upgrade your HELM experience - Free
<i class="bi-box-arrow-up-right ms-1"></i></a><br/>
Auth & RBAC, k8s events, troubleshooting and more
</span>
</div>
</div>
<div class="separator-vertical"><span></span></div>
<i class="btn bi-power text-muted p-2 m-1 mx-2" title="Shut down the Helm Dashboard application"></i>
Expand All @@ -89,7 +95,9 @@ <h4 class="fs-6">Repositories</h4>
<button class="btn btn-sm border-secondary text-muted">
<i class="bi-plus-lg"></i> Add Repository
</button>
<div class="mt-2 p-2 small">Charts developers: you can also add local directories as chart source. Use <span class="font-monospace text-success">--local-chart</span> CLI switch to specify it.</div>
<div class="mt-2 p-2 small">Charts developers: you can also add local directories as chart source. Use
<span class="font-monospace text-success">--local-chart</span> CLI switch to specify it.
</div>
</div>
</div>
<div class="col-9 repo-details bg-white b-shadow pt-4 px-5 overflow-auto rounded">
Expand Down Expand Up @@ -305,6 +313,8 @@ <h4 class="alert-heading"><i class="bi-exclamation-triangle-fill"></i> <span></s
<hr>
<p style="white-space: pre-wrap"></p>
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
<hr/>
<span class="small text-muted fs-80">Hint: Komodor has the same HELM capabilities, with enterprise features and support. <a href="https://www.komodor.com/helm-dash/?utm_campaign=Helm%20Dashboard%20%7C%20CTA&utm_source=helm-dash&utm_medium=cta&utm_content=helm-dash" target="_blank">Sign up for free.</a></span>
</div>

<div class="offcanvas offcanvas-end rounded-start" tabindex="-1" id="describeModal"
Expand All @@ -314,8 +324,12 @@ <h4 class="alert-heading"><i class="bi-exclamation-triangle-fill"></i> <span></s
<h5 id="describeModalLabel"></h5>
<p class="m-0 mt-4">ResourceType</p>
</div>
<button type="button" class="btn-close text-reset" data-bs-dismiss="offcanvas" aria-label="Close"></button>

<div>
<a href='https://www.komodor.com/helm-dash/?utm_campaign=Helm%20Dashboard%20%7C%20CTA&utm_source=helm-dash&utm_medium=cta&utm_content=helm-dash'
class='btn btn-primary btn-sm me-2' target='_blank'>See more details in Komodor <i
class='bi-box-arrow-up-right'></i></a>
<button type="button" class="btn-close text-reset" data-bs-dismiss="offcanvas" aria-label="Close"></button>
</div>
</div>
<div class="offcanvas-body p-2 ps-4" id="describeModalBody">
</div>
Expand Down
Binary file added pkg/dashboard/static/komodor-icon.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 5 additions & 1 deletion pkg/dashboard/static/list-view.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,13 +89,17 @@ function buildChartCard(elm) {
}

if (isNewerVersion(elm.chartVersion, data[0].version)) {
const icon = $("<span class='ms-2 text-success' title='Upgrade available: " + data[0].version + " from " + data[0].repository + "'></span>")
const icon = $("<span class='ms-2 text-success' data-bs-toggle='tooltip' data-bs-placement='bottom' data-bs-title='Upgrade available: " + data[0].version + " from " + data[0].repository + "'></span>")
if (data[0].isSuggestedRepo) {
icon.addClass("bi-arrow-up-circle")
} else {
icon.addClass("bi-arrow-up-circle-fill")
}
card.find(".rel-name span").append(icon)

const tooltipTriggerList = card.find('[data-bs-toggle="tooltip"]')
const tooltipList = [...tooltipTriggerList].map(tooltipTriggerEl => new bootstrap.Tooltip(tooltipTriggerEl))
sendStats('upgradeIconShown', {'isProbable': data[0].isSuggestedRepo})
}
})

Expand Down
4 changes: 3 additions & 1 deletion pkg/dashboard/static/scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -356,4 +356,6 @@ function setFilteredNamespaces(filteredNamespaces) {
} else if (filteredNamespaces.length !== 0) {
setHashParam("filteredNamespace", filteredNamespaces.join('+'))
}
}
}

const KomodorCTALink="https://www.komodor.com/helm-dash/?utm_campaign=Helm%20Dashboard%20%7C%20CTA&utm_source=helm-dash&utm_medium=cta&utm_content=helm-dash"

0 comments on commit a0680a4

Please sign in to comment.