add kubernetes version to cluster table
parent
2a0ea2eecb
commit
04f55e9d1e
|
@ -69,7 +69,7 @@ int ClusterModel::rowCount(const QModelIndex &) const
|
|||
|
||||
int ClusterModel::columnCount(const QModelIndex &) const
|
||||
{
|
||||
return 6;
|
||||
return 7;
|
||||
}
|
||||
|
||||
static QStringList binaryAbbrs = { "B", "KiB", "MiB", "GiB", "TiB", "PiB", "EiB", "ZiB", "YiB" };
|
||||
|
@ -81,7 +81,7 @@ QVariant ClusterModel::data(const QModelIndex &index, int role) const
|
|||
|
||||
if (index.row() >= clusterList.size())
|
||||
return QVariant();
|
||||
if (index.column() >= 6)
|
||||
if (index.column() >= 7)
|
||||
return QVariant();
|
||||
|
||||
if (role == Qt::TextAlignmentRole) {
|
||||
|
@ -97,6 +97,8 @@ QVariant ClusterModel::data(const QModelIndex &index, int role) const
|
|||
case 4:
|
||||
// fall-through
|
||||
case 5:
|
||||
// fall-through
|
||||
case 6:
|
||||
return QVariant(Qt::AlignHCenter | Qt::AlignVCenter);
|
||||
}
|
||||
}
|
||||
|
@ -112,8 +114,10 @@ QVariant ClusterModel::data(const QModelIndex &index, int role) const
|
|||
case 3:
|
||||
return cluster.containerRuntime();
|
||||
case 4:
|
||||
return QString::number(cluster.cpus());
|
||||
return cluster.k8sVersion();
|
||||
case 5:
|
||||
return QString::number(cluster.cpus());
|
||||
case 6:
|
||||
return QString::number(cluster.memory());
|
||||
}
|
||||
}
|
||||
|
@ -136,8 +140,10 @@ QVariant ClusterModel::headerData(int section, Qt::Orientation orientation, int
|
|||
case 3:
|
||||
return tr("Container Runtime");
|
||||
case 4:
|
||||
return tr("CPUs");
|
||||
return tr("Kubernetes Version");
|
||||
case 5:
|
||||
return tr("CPUs");
|
||||
case 6:
|
||||
return tr("Memory (MB)");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -64,7 +64,13 @@ class Cluster
|
|||
public:
|
||||
Cluster() : Cluster("") { }
|
||||
Cluster(const QString &name)
|
||||
: m_name(name), m_status(""), m_driver(""), m_container_runtime(""), m_cpus(0), m_memory(0)
|
||||
: m_name(name),
|
||||
m_status(""),
|
||||
m_driver(""),
|
||||
m_container_runtime(""),
|
||||
m_k8s_version(""),
|
||||
m_cpus(0),
|
||||
m_memory(0)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -75,6 +81,8 @@ public:
|
|||
void setDriver(QString driver) { m_driver = driver; }
|
||||
QString containerRuntime() const { return m_container_runtime; }
|
||||
void setContainerRuntime(QString containerRuntime) { m_container_runtime = containerRuntime; }
|
||||
QString k8sVersion() const { return m_k8s_version; }
|
||||
void setK8sVersion(QString k8sVersion) { m_k8s_version = k8sVersion; }
|
||||
int cpus() const { return m_cpus; }
|
||||
void setCpus(int cpus) { m_cpus = cpus; }
|
||||
int memory() const { return m_memory; }
|
||||
|
@ -85,6 +93,7 @@ private:
|
|||
QString m_status;
|
||||
QString m_driver;
|
||||
QString m_container_runtime;
|
||||
QString m_k8s_version;
|
||||
int m_cpus;
|
||||
int m_memory;
|
||||
};
|
||||
|
|
|
@ -373,6 +373,10 @@ Cluster Window::createClusterObject(QJsonObject obj)
|
|||
QString containerRuntime = k8sConfig["ContainerRuntime"].toString();
|
||||
cluster.setContainerRuntime(containerRuntime);
|
||||
}
|
||||
if (k8sConfig.contains("KubernetesVersion")) {
|
||||
QString k8sVersion = k8sConfig["KubernetesVersion"].toString();
|
||||
cluster.setK8sVersion(k8sVersion);
|
||||
}
|
||||
return cluster;
|
||||
}
|
||||
|
||||
|
@ -417,6 +421,7 @@ void Window::createClusterGroupBox()
|
|||
clusterListView->horizontalHeader()->setSectionResizeMode(3, QHeaderView::ResizeToContents);
|
||||
clusterListView->horizontalHeader()->setSectionResizeMode(4, QHeaderView::ResizeToContents);
|
||||
clusterListView->horizontalHeader()->setSectionResizeMode(5, QHeaderView::ResizeToContents);
|
||||
clusterListView->horizontalHeader()->setSectionResizeMode(6, QHeaderView::ResizeToContents);
|
||||
setSelectedCluster("default");
|
||||
|
||||
connect(clusterListView, SIGNAL(clicked(QModelIndex)), this, SLOT(updateButtons()));
|
||||
|
|
Loading…
Reference in New Issue