mirror of
https://github.com/komodorio/helm-dashboard.git
synced 2026-03-24 11:48:04 +00:00
Show better message for empty contexts
This commit is contained in:
@@ -129,22 +129,28 @@ function statusStyle(status, card, txt) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function getCleanClusterName(rawClusterName){
|
function getCleanClusterName(rawClusterName) {
|
||||||
if (rawClusterName.indexOf('arn') === 0) {
|
if (rawClusterName.indexOf('arn') === 0) {
|
||||||
// AWS cluster
|
// AWS cluster
|
||||||
const clusterSplit = rawClusterName.split(':')
|
const clusterSplit = rawClusterName.split(':')
|
||||||
const clusterName = clusterSplit.slice(-1)[0].replace('cluster/','')
|
const clusterName = clusterSplit.slice(-1)[0].replace('cluster/', '')
|
||||||
const region = clusterSplit.at(-3)
|
const region = clusterSplit.at(-3)
|
||||||
return region + "/" + clusterName + ' [AWS]'
|
return region + "/" + clusterName + ' [AWS]'
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rawClusterName.indexOf('gke') === 0) {
|
if (rawClusterName.indexOf('gke') === 0) {
|
||||||
// GKE cluster
|
// GKE cluster
|
||||||
return rawClusterName.split('_').at(-2) + '/' + rawClusterName.split('_').at(-1) + ' [GKE]'
|
return rawClusterName.split('_').at(-2) + '/' + rawClusterName.split('_').at(-1) + ' [GKE]'
|
||||||
}
|
}
|
||||||
|
|
||||||
return rawClusterName
|
return rawClusterName
|
||||||
}
|
}
|
||||||
|
|
||||||
function fillClusterList(data, context) {
|
function fillClusterList(data, context) {
|
||||||
|
if (!data || !data.length) {
|
||||||
|
$("#cluster").append("No clusters listed in kubectl config, please configure some")
|
||||||
|
return
|
||||||
|
}
|
||||||
data.forEach(function (elm) {
|
data.forEach(function (elm) {
|
||||||
let label = getCleanClusterName(elm.Name)
|
let label = getCleanClusterName(elm.Name)
|
||||||
let opt = $('<li><label><input type="radio" name="cluster" class="me-2"/><span></span></label></li>');
|
let opt = $('<li><label><input type="radio" name="cluster" class="me-2"/><span></span></label></li>');
|
||||||
|
|||||||
Reference in New Issue
Block a user