Initial commit
This commit is contained in:
commit
b7d90b9afe
16245 files changed
+3396666
No files matched your search
@@ -0,0 +1,32 @@
|
||||
#
|
||||
# $Id$
|
||||
# $HeadURL$
|
||||
# $Author$
|
||||
# Created by Astrid Mueller, SLSE, 2016-02-29
|
||||
#
|
||||
|
||||
SET(smo_system_monitor_gui_SRCS
|
||||
smo_system_monitor_gui_plugin.cpp
|
||||
smo_system_monitor_gui_plugin.h
|
||||
smo_system_monitor_dialog.cpp
|
||||
smo_system_monitor_dialog.h
|
||||
)
|
||||
|
||||
NGL_WRAP_UI(smo_system_monitor_gui_SRCS
|
||||
smo_system_monitor_dialog.ui
|
||||
)
|
||||
|
||||
NGL_ADD_LIBRARY(WS SmoSystemMonitorGuiPlugin MODULE ${smo_system_monitor_gui_SRCS})
|
||||
NGL_TARGET_LINK_LIBRARIES(SmoSystemMonitorGuiPlugin
|
||||
LtsSession
|
||||
LtsUtilsSettings
|
||||
Qt5::WebEngineWidgets
|
||||
Qt5::Widgets
|
||||
SmoCommon
|
||||
SmoSystemMonitorGuiPluginInterface
|
||||
svcSmoDummy
|
||||
)
|
||||
|
||||
NGL_INSTALL_TARGET(SmoSystemMonitorGuiPlugin)
|
||||
|
||||
|
||||
@@ -0,0 +1,65 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* System Monitor Dialog
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Astrid Mueller, SGAS, 2017-06-30
|
||||
*/
|
||||
|
||||
#include "smo_system_monitor_dialog.h"
|
||||
#include "ui_smo_system_monitor_dialog.h"
|
||||
#include <QWebEngineView>
|
||||
#include <LtsUtilsSettings/settings.h>
|
||||
|
||||
namespace ServiceMonitor
|
||||
{
|
||||
SystemMonitorDialog::SystemMonitorDialog(bool systemMonitor)
|
||||
: LtsWidgets::LtsDialog(nullptr, LtsWidgets::ButtonCombination::SeamlessDialog, false)
|
||||
, m_ui(new Ui::SystemMonitorDialog)
|
||||
, m_systemMonitor(systemMonitor)
|
||||
{
|
||||
m_ui->setupUi(this);
|
||||
}
|
||||
|
||||
bool SystemMonitorDialog::init()
|
||||
{
|
||||
LtsUtils::ProjectSettings *ps = LtsUtils::ProjectSettings::getInstance();
|
||||
QString webPage;
|
||||
if (m_systemMonitor)
|
||||
{
|
||||
// Get Nagios Path from Settings
|
||||
webPage = ps->value(QStringLiteral("smo"),
|
||||
QStringLiteral("nagios"),
|
||||
QString()).toString();
|
||||
}
|
||||
else
|
||||
{
|
||||
// Get SPS Path from Settings
|
||||
webPage = ps->value(QStringLiteral("smo"),
|
||||
QStringLiteral("sps"),
|
||||
QString()).toString();
|
||||
}
|
||||
if (webPage.isEmpty())
|
||||
return false;
|
||||
m_ui->wevSystemMonitor->load(QUrl(webPage));
|
||||
return true;
|
||||
}
|
||||
|
||||
SystemMonitorDialog::~SystemMonitorDialog()
|
||||
{
|
||||
m_ui->wevSystemMonitor->setParent(nullptr);
|
||||
m_ui->wevSystemMonitor->hide();
|
||||
m_ui->wevSystemMonitor->deleteLater();
|
||||
delete m_ui;
|
||||
}
|
||||
|
||||
void SystemMonitorDialog::retranslate()
|
||||
{
|
||||
if (m_systemMonitor)
|
||||
translate(m_ui, tr("System Monitor"));
|
||||
else
|
||||
translate(m_ui, tr("SPS Monitor"));
|
||||
}
|
||||
|
||||
} // namespace ServiceMonitor
|
||||
@@ -0,0 +1,40 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* System Monitor Add Dialog
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Astrid Mueller, SGAS, 2017-06-30
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <LtsWidgets/lts_dialog.h>
|
||||
#include <LtsSession/lts_session.h>
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
class SystemMonitorDialog;
|
||||
}
|
||||
|
||||
namespace ServiceMonitor
|
||||
{
|
||||
class SystemMonitorDialog : public LtsWidgets::LtsDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
|
||||
explicit SystemMonitorDialog(bool systemMonitor);
|
||||
bool init();
|
||||
~SystemMonitorDialog();
|
||||
|
||||
|
||||
private:
|
||||
void retranslate() override;
|
||||
|
||||
Ui::SystemMonitorDialog *m_ui;
|
||||
bool m_systemMonitor;
|
||||
};
|
||||
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>SystemMonitorDialog</class>
|
||||
<widget class="QWidget" name="SystemMonitorDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>400</width>
|
||||
<height>300</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QWebEngineView" name="wevSystemMonitor">
|
||||
<property name="url">
|
||||
<url>
|
||||
<string>about:blank</string>
|
||||
</url>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>QWebEngineView</class>
|
||||
<extends>QWidget</extends>
|
||||
<header location="global">QtWebEngineWidgets/QWebEngineView</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
+81
@@ -0,0 +1,81 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* GUI Plugin for SystemMonitor
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Astrid Mueller, SGAS, 2017-07-06
|
||||
*/
|
||||
|
||||
#include "smo_system_monitor_gui_plugin.h"
|
||||
#include "smo_system_monitor_dialog.h"
|
||||
|
||||
#include <LtsSession/lts_session.h>
|
||||
#include <LtsUtilsSettings/settings.h>
|
||||
#include <ServiceMonitor/smo_operator_rights.h>
|
||||
#include <Common/logger.h>
|
||||
|
||||
namespace ServiceMonitor
|
||||
{
|
||||
|
||||
std::shared_ptr<GuiPluginBase::Interface> GuiPlugin::createGuiInterface(LtsSession::LtsSession *session)
|
||||
{
|
||||
return std::make_shared<InterfaceImpl>(session);
|
||||
}
|
||||
|
||||
|
||||
InterfaceImpl::InterfaceImpl(LtsSession::LtsSession *session)
|
||||
: GuiPluginBase::Interface(session, getLogger("SystemMonitorInterface"))
|
||||
{}
|
||||
|
||||
QVector<LtsWidgets::PluginData> InterfaceImpl::getActions()
|
||||
{
|
||||
QVector<LtsWidgets::PluginData> ret;
|
||||
LtsUtils::ProjectSettings *ps = LtsUtils::ProjectSettings::getInstance();
|
||||
|
||||
if (getFlags().testFlag(LtsAppDescriptor::PluginInfo::Flag::MAIN))
|
||||
{
|
||||
LtsWidgets::PluginData plData;
|
||||
if (ps->value(QStringLiteral("smo"), QStringLiteral("enableSps")).toBool())
|
||||
{
|
||||
NOTICE_LOG(m_logger) << "Enable SPS";
|
||||
plData.layoutArea = LtsWidgets::LayoutArea::eMainTab;
|
||||
plData.createInstant = LtsWidgets::CreateInstantType::CreateInstantAndDiscardAction;
|
||||
plData.menuGroup = menuGroup();
|
||||
plData.menuText = tr("SPS Monitor");
|
||||
plData.identifier = QLatin1String("smoSpsMonitor");
|
||||
plData.operatorRight = OperatorRights::SystemMonitorSPS;
|
||||
plData.exercisePart = LtsWidgets::ExercisePart::eSpecial;
|
||||
plData.createWidgetFunc = [this](QWidget *)
|
||||
{
|
||||
return onShowSystemMonitor(false);
|
||||
};
|
||||
ret.append(plData);
|
||||
}
|
||||
plData.layoutArea = LtsWidgets::LayoutArea::eMainTab;
|
||||
plData.createInstant = LtsWidgets::CreateInstantType::CreateInstantAndDiscardAction;
|
||||
plData.menuGroup = menuGroup();
|
||||
plData.menuText = tr("System Monitor");
|
||||
plData.identifier = QLatin1String("smoSystemMonitor");
|
||||
plData.operatorRight = OperatorRights::SystemMonitorNagios;
|
||||
plData.exercisePart = LtsWidgets::ExercisePart::eSpecial;
|
||||
plData.createWidgetFunc = [this](QWidget *)
|
||||
{
|
||||
return onShowSystemMonitor(true);
|
||||
};
|
||||
ret.append(plData);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
LtsWidgets::LtsDialog *InterfaceImpl::onShowSystemMonitor(bool isSystemMonitor)
|
||||
{
|
||||
SystemMonitorDialog *dlg = new SystemMonitorDialog(isSystemMonitor);
|
||||
if (dlg->init())
|
||||
return dlg;
|
||||
else
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
}
|
||||
// namespace ServiceMonitor
|
||||
+53
@@ -0,0 +1,53 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* Gui Plugin for SystemMonitor
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Astrid Mueller, SGAS, 2017-07-06
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <PluginInterfaces/gui_plugin_interface.h>
|
||||
#include <Common/ProjectConfig/project_defines.h>
|
||||
#include <Plugins/ServiceMonitor/smo_system_monitor_gui_plugin_interface.h>
|
||||
|
||||
namespace ServiceMonitor
|
||||
{
|
||||
|
||||
class GuiPlugin final : public QObject, public GuiPluginBase::Plugin
|
||||
{
|
||||
Q_PLUGIN_METADATA(IID "gui:3:smo.systemmonitor")
|
||||
Q_INTERFACES(GuiPluginBase::Plugin)
|
||||
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit GuiPlugin() = default;
|
||||
~GuiPlugin() = default;
|
||||
|
||||
QString pluginName() override { return QStringLiteral("ServiceMonitorSystemMonitorGui"); }
|
||||
std::shared_ptr<GuiPluginBase::Interface> createGuiInterface(LtsSession::LtsSession *session) override;
|
||||
bool availableInPartition(IDL::PartitionType partition) const override
|
||||
{
|
||||
return (partition == IDL::PartitionType::Global ||
|
||||
partition == IDL::PartitionType::Exercise);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
class InterfaceImpl final : public QObject, public GuiPluginBase::Interface
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit InterfaceImpl(LtsSession::LtsSession *session);
|
||||
|
||||
QVector<LtsWidgets::PluginData> getActions() override;
|
||||
QString menuGroup() const override { return tr("System Monitor"); }
|
||||
|
||||
private:
|
||||
LtsWidgets::LtsDialog *onShowSystemMonitor(bool isSystemMonitor);
|
||||
};
|
||||
|
||||
} // namespace ServiceMonitor
|
||||
Reference in new issue
Block a user