show and edit ovh monitoring
This commit is contained in:
parent
4ef55e2f6d
commit
5945f18c75
|
@ -29,10 +29,12 @@
|
|||
<location filename="dedicatedserverinfowidget.ui" line="236"/>
|
||||
<location filename="dedicatedserverinfowidget.ui" line="262"/>
|
||||
<location filename="dedicatedserverinfowidget.ui" line="288"/>
|
||||
<location filename="dedicatedserverinfowidget.ui" line="323"/>
|
||||
<location filename="dedicatedserverinfowidget.ui" line="349"/>
|
||||
<location filename="dedicatedserverinfowidget.ui" line="375"/>
|
||||
<location filename="dedicatedserverinfowidget.ui" line="401"/>
|
||||
<location filename="dedicatedserverinfowidget.ui" line="316"/>
|
||||
<location filename="dedicatedserverinfowidget.ui" line="326"/>
|
||||
<location filename="dedicatedserverinfowidget.ui" line="357"/>
|
||||
<location filename="dedicatedserverinfowidget.ui" line="383"/>
|
||||
<location filename="dedicatedserverinfowidget.ui" line="409"/>
|
||||
<location filename="dedicatedserverinfowidget.ui" line="435"/>
|
||||
<source>...</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
|
@ -88,103 +90,133 @@
|
|||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="dedicatedserverinfowidget.ui" line="304"/>
|
||||
<location filename="dedicatedserverinfowidget.ui" line="301"/>
|
||||
<source>OVH Network monitoring</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="dedicatedserverinfowidget.ui" line="338"/>
|
||||
<source>Hardware information</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="dedicatedserverinfowidget.ui" line="310"/>
|
||||
<location filename="dedicatedserverinfowidget.ui" line="344"/>
|
||||
<source>CPU</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="dedicatedserverinfowidget.ui" line="336"/>
|
||||
<location filename="dedicatedserverinfowidget.ui" line="370"/>
|
||||
<source>RAM</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="dedicatedserverinfowidget.ui" line="362"/>
|
||||
<location filename="dedicatedserverinfowidget.ui" line="396"/>
|
||||
<source>Storage</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="dedicatedserverinfowidget.ui" line="388"/>
|
||||
<location filename="dedicatedserverinfowidget.ui" line="422"/>
|
||||
<source>Description</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="dedicatedserverinfowidget.ui" line="435"/>
|
||||
<location filename="dedicatedserverinfowidget.ui" line="469"/>
|
||||
<source><html><head/><body><p>Open renew.cgi for this server only.</p><p>Why would you do that while autorenew exists? renew.cgi is by far the simplest way to use your fidelity account on your current servers...</p></body></html></source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="dedicatedserverinfowidget.ui" line="438"/>
|
||||
<location filename="dedicatedserverinfowidget.ui" line="472"/>
|
||||
<source>Go to renew.cgi</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="dedicatedserverinfowidget.ui" line="458"/>
|
||||
<location filename="dedicatedserverinfowidget.ui" line="492"/>
|
||||
<source>Find the last bill</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="dedicatedserverinfowidget.ui" line="478"/>
|
||||
<location filename="dedicatedserverinfowidget.ui" line="512"/>
|
||||
<source>Open KVM</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="dedicatedserverinfowidget.cpp" line="62"/>
|
||||
<location filename="dedicatedserverinfowidget.cpp" line="34"/>
|
||||
<source>Enabled with intervention</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="dedicatedserverinfowidget.cpp" line="35"/>
|
||||
<source>Enabled without intervention</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="dedicatedserverinfowidget.cpp" line="36"/>
|
||||
<source>Disabled</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="dedicatedserverinfowidget.cpp" line="80"/>
|
||||
<source>Until %1, <b>automatic reactivation</b></source>
|
||||
<oldsource>Until %1, <b>automatic reactivation<b></oldsource>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="dedicatedserverinfowidget.cpp" line="64"/>
|
||||
<location filename="dedicatedserverinfowidget.cpp" line="82"/>
|
||||
<source>Until %1, stopping engagement after</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="dedicatedserverinfowidget.cpp" line="66"/>
|
||||
<location filename="dedicatedserverinfowidget.cpp" line="84"/>
|
||||
<source>Until %1, unknown strategy %2</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="dedicatedserverinfowidget.cpp" line="78"/>
|
||||
<location filename="dedicatedserverinfowidget.cpp" line="96"/>
|
||||
<source><b>Upfront payment for %1 months at once</b></source>
|
||||
<oldsource>Upfront payment for %1 months at once</oldsource>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="dedicatedserverinfowidget.cpp" line="80"/>
|
||||
<location filename="dedicatedserverinfowidget.cpp" line="98"/>
|
||||
<source>Periodic payment, engage for %1 months at once</source>
|
||||
<oldsource>Periodic payment for %1 months at once</oldsource>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="dedicatedserverinfowidget.cpp" line="82"/>
|
||||
<location filename="dedicatedserverinfowidget.cpp" line="100"/>
|
||||
<source>Unknown type %1 for %2 months at once</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="dedicatedserverinfowidget.cpp" line="86"/>
|
||||
<location filename="dedicatedserverinfowidget.cpp" line="104"/>
|
||||
<source>No engagement</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="dedicatedserverinfowidget.cpp" line="117"/>
|
||||
<location filename="dedicatedserverinfowidget.cpp" line="135"/>
|
||||
<source>IPMI disabled, no KVM</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="dedicatedserverinfowidget.cpp" line="123"/>
|
||||
<location filename="dedicatedserverinfowidget.cpp" line="141"/>
|
||||
<source>No KVM available</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="dedicatedserverinfowidget.cpp" line="137"/>
|
||||
<location filename="dedicatedserverinfowidget.cpp" line="155"/>
|
||||
<source>Searching</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="dedicatedserverinfowidget.cpp" line="203"/>
|
||||
<source>New monitoring mode</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="dedicatedserverinfowidget.cpp" line="203"/>
|
||||
<source>What status do you want for OVH monitoring</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>MainWindow</name>
|
||||
|
|
|
@ -11,12 +11,16 @@
|
|||
#include <QDebug>
|
||||
#include <QDesktopServices>
|
||||
#include <QMessageBox>
|
||||
#include <QInputDialog>
|
||||
|
||||
#include <ranges>
|
||||
#include "ovhapi.h"
|
||||
|
||||
const auto ten_years = 87600h;
|
||||
|
||||
// Translated QString, stored there for easy single translation...
|
||||
QString monitoringWithIntervention, monitoringWithoutIntervention, noMonitoring;
|
||||
|
||||
DedicatedServerInfoWidget::DedicatedServerInfoWidget(OvhApi *api, const QString &serverName, QWidget *parent) :
|
||||
QWidget(parent),
|
||||
api(api),
|
||||
|
@ -25,6 +29,12 @@ DedicatedServerInfoWidget::DedicatedServerInfoWidget(OvhApi *api, const QString
|
|||
{
|
||||
ui->setupUi(this);
|
||||
QTimer::singleShot(0, this, &DedicatedServerInfoWidget::fetchOvhServerInfo);
|
||||
|
||||
if (monitoringWithIntervention.isEmpty()) {
|
||||
monitoringWithIntervention = tr("Enabled with intervention");
|
||||
monitoringWithoutIntervention = tr("Enabled without intervention");
|
||||
noMonitoring = tr("Disabled");
|
||||
}
|
||||
}
|
||||
|
||||
DedicatedServerInfoWidget::~DedicatedServerInfoWidget()
|
||||
|
@ -39,6 +49,14 @@ QCoro::Task<> DedicatedServerInfoWidget::fetchOvhServerInfo()
|
|||
ui->serverName->setText(serverInfo["name"].toString());
|
||||
ui->datacenter->setText(serverInfo["datacenter"].toString());
|
||||
ui->rack->setText(serverInfo["rack"].toString());
|
||||
if (serverInfo["monitoring"].toBool()) {
|
||||
if (serverInfo["noIntervention"].toBool())
|
||||
ui->ovhMonitoring->setText(monitoringWithoutIntervention);
|
||||
else
|
||||
ui->ovhMonitoring->setText(monitoringWithIntervention);
|
||||
} else {
|
||||
ui->ovhMonitoring->setText(noMonitoring);
|
||||
}
|
||||
|
||||
auto serviceInfo = (co_await api->get(QString("/dedicated/server/%1/serviceInfos").arg(_serverName), 1h)).object();
|
||||
auto serviceId = serviceInfo["serviceId"].toInt();
|
||||
|
@ -177,3 +195,28 @@ void DedicatedServerInfoWidget::on_renewCgi_clicked()
|
|||
QDesktopServices::openUrl(renewCgiUrl);
|
||||
}
|
||||
|
||||
QCoro::Task<> DedicatedServerInfoWidget::on_changeMonitoringButton_clicked()
|
||||
{
|
||||
QStringList monitoringStatus = {monitoringWithIntervention, monitoringWithoutIntervention, noMonitoring};
|
||||
int currentStatus = monitoringStatus.indexOf(ui->ovhMonitoring->text());
|
||||
bool ok;
|
||||
auto newMode = QInputDialog::getItem(this, tr("New monitoring mode"), tr("What status do you want for OVH monitoring"), monitoringStatus, currentStatus, false, &ok);
|
||||
if (ok && newMode != ui->ovhMonitoring->text()) {
|
||||
// Build change data
|
||||
QJsonObject data;
|
||||
if (newMode == noMonitoring)
|
||||
data.insert("monitoring", false);
|
||||
else {
|
||||
data.insert("monitoring", true);
|
||||
if (newMode == monitoringWithIntervention)
|
||||
data.insert("noIntervention", false);
|
||||
else
|
||||
data.insert("noIntervention", true);
|
||||
}
|
||||
// Put and refresh
|
||||
co_await api->put("/dedicated/server/" + _serverName, QJsonDocument(data).toJson());
|
||||
co_await api->get("/dedicated/server/" + _serverName, 1h, true);
|
||||
fetchOvhServerInfo();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -33,6 +33,8 @@ private slots:
|
|||
|
||||
void on_renewCgi_clicked();
|
||||
|
||||
QCoro::Task<> on_changeMonitoringButton_clicked();
|
||||
|
||||
private:
|
||||
Ui::DedicatedServerInfoWidget *ui;
|
||||
OvhApi *api;
|
||||
|
|
|
@ -190,7 +190,7 @@
|
|||
<property name="title">
|
||||
<string>Network</string>
|
||||
</property>
|
||||
<layout class="QFormLayout" name="formLayout_2">
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
|
@ -295,6 +295,40 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="label_15">
|
||||
<property name="text">
|
||||
<string>OVH Network monitoring</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<widget class="QLabel" name="ovhMonitoring">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="changeMonitoringButton">
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
|
|
Loading…
Reference in New Issue