29 |
29 |
30 DetailNode::DetailNode(int id, QWidget *parent) : QDialog(parent), ui(new Ui::DetailNode) |
30 DetailNode::DetailNode(int id, QWidget *parent) : QDialog(parent), ui(new Ui::DetailNode) |
31 { |
31 { |
32 QSqlQuery query; |
32 QSqlQuery query; |
33 |
33 |
|
34 #ifdef DEBUG_MONITOR |
34 qDebug() << "DetailNode record:" << id; |
35 qDebug() << "DetailNode record:" << id; |
|
36 #endif |
35 ui->setupUi(this); |
37 ui->setupUi(this); |
36 this->recno = id; |
38 this->recno = id; |
37 setWindowFlags(Qt::Window | Qt::WindowTitleHint | Qt::CustomizeWindowHint); |
39 setWindowFlags(Qt::Window | Qt::WindowTitleHint | Qt::CustomizeWindowHint); |
38 setWindowTitle(tr("BMSapp - Details System")); |
40 setWindowTitle(tr("BMSapp - Details System")); |
39 |
41 |
46 |
48 |
47 void DetailNode::refreshTable() |
49 void DetailNode::refreshTable() |
48 { |
50 { |
49 QSqlQuery query; |
51 QSqlQuery query; |
50 |
52 |
51 qDebug() << "refreshTable node rec:" << this->recno; |
|
52 |
|
53 query.prepare("SELECT * FROM mon_nodes WHERE record = :recno"); |
53 query.prepare("SELECT * FROM mon_nodes WHERE record = :recno"); |
54 query.bindValue(":recno", this->recno); |
54 query.bindValue(":recno", this->recno); |
55 query.exec(); |
55 query.exec(); |
56 if (query.next()) { |
56 if (query.next()) { |
57 |
57 |
58 _node = query.value("node").toString(); |
58 _node = query.value("node").toString(); |
59 _group_id = query.value("group_id").toString(); |
59 _group_id = query.value("group_id").toString(); |
60 _uuid = query.value("uuid").toString(); |
60 _uuid = query.value("uuid").toString(); |
|
61 |
|
62 bool online = (query.value("online").toInt() != 0) ? true:false; |
61 |
63 |
62 ui->uuidEdit->setText(_uuid); |
64 ui->uuidEdit->setText(_uuid); |
63 ui->systemEdit->setText(_node); |
65 ui->systemEdit->setText(_node); |
64 ui->typeEdit->setText(_group_id); |
66 ui->typeEdit->setText(_group_id); |
65 ui->firstEdit->setText(query.value("firstseen").toDateTime().toString("dd MMM yyyy HH:mm:ss")); |
67 ui->firstEdit->setText(query.value("firstseen").toDateTime().toString("dd MMM yyyy HH:mm:ss")); |
66 ui->lastEdit->setText(query.value("lastseen").toDateTime().toString("dd MMM yyyy HH:mm:ss")); |
68 ui->lastEdit->setText(query.value("lastseen").toDateTime().toString("dd MMM yyyy HH:mm:ss")); |
67 |
69 |
68 if (query.value("online").toInt()) { |
70 if (online) { |
69 ui->statusEdit->setText(tr("Online")); |
71 ui->statusEdit->setText(tr("Online")); |
|
72 ui->statusEdit->setStyleSheet(""); |
70 ui->makerEdit->show(); |
73 ui->makerEdit->show(); |
71 ui->modelEdit->show(); |
74 ui->modelEdit->show(); |
72 ui->osEdit->show(); |
75 ui->osEdit->show(); |
73 ui->fwEdit->show(); |
76 ui->fwEdit->show(); |
74 ui->makerLabel->show(); |
77 ui->makerLabel->show(); |
208 |
210 |
209 if (rc == QMessageBox::No) |
211 if (rc == QMessageBox::No) |
210 return; |
212 return; |
211 |
213 |
212 QString msg = QString("{\"node\":\""+_node+"\",\"group_id\":\""+_group_id+"\",\"control\":\"reboot\"}"); |
214 QString msg = QString("{\"node\":\""+_node+"\",\"group_id\":\""+_group_id+"\",\"control\":\"reboot\"}"); |
|
215 #ifdef DEBUG_MONITOR |
213 qDebug() << msg; |
216 qDebug() << msg; |
|
217 #endif |
214 webSocket->sendTextMessage(msg); |
218 webSocket->sendTextMessage(msg); |
215 } |
219 } |
216 |
220 |
217 |
221 |
218 void DetailNode::control_rebirth() |
222 void DetailNode::control_rebirth() |
219 { |
223 { |
220 QString msg = QString("{\"node\":\""+_node+"\",\"group_id\":\""+_group_id+"\",\"control\":\"rebirth\"}"); |
224 QString msg = QString("{\"node\":\""+_node+"\",\"group_id\":\""+_group_id+"\",\"control\":\"rebirth\"}"); |
|
225 #ifdef DEBUG_MONITOR |
221 qDebug() << msg; |
226 qDebug() << msg; |
|
227 #endif |
222 webSocket->sendTextMessage(msg); |
228 webSocket->sendTextMessage(msg); |
223 } |
229 } |
224 |
230 |
225 |
231 |