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