added installController with logic for server/container installation
This commit is contained in:
parent
03a0e2084a
commit
acca85b99a
19 changed files with 519 additions and 151 deletions
|
|
@ -121,6 +121,9 @@ void AmneziaApplication::init()
|
||||||
m_pageController.reset(new PageController(m_serversModel));
|
m_pageController.reset(new PageController(m_serversModel));
|
||||||
m_engine->rootContext()->setContextProperty("PageController", m_pageController.get());
|
m_engine->rootContext()->setContextProperty("PageController", m_pageController.get());
|
||||||
|
|
||||||
|
m_installController.reset(new InstallController(m_serversModel, m_containersModel, m_settings));
|
||||||
|
m_engine->rootContext()->setContextProperty("InstallController", m_installController.get());
|
||||||
|
|
||||||
//
|
//
|
||||||
m_uiLogic->registerPagesLogic();
|
m_uiLogic->registerPagesLogic();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -227,5 +227,6 @@
|
||||||
<file>images/connectionOff.svg</file>
|
<file>images/connectionOff.svg</file>
|
||||||
<file>images/connectionOn.svg</file>
|
<file>images/connectionOn.svg</file>
|
||||||
<file>images/controls/download.svg</file>
|
<file>images/controls/download.svg</file>
|
||||||
|
<file>ui/qml/Controls2/ProgressBarType.qml</file>
|
||||||
</qresource>
|
</qresource>
|
||||||
</RCC>
|
</RCC>
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,7 @@ bool ConnectionController::openVpnConnection()
|
||||||
DockerContainer container = m_containersModel->getDefaultContainer();
|
DockerContainer container = m_containersModel->getDefaultContainer();
|
||||||
QModelIndex containerModelIndex = m_containersModel->index(container);
|
QModelIndex containerModelIndex = m_containersModel->index(container);
|
||||||
const QJsonObject &containerConfig = qvariant_cast<QJsonObject>(m_containersModel->data(containerModelIndex,
|
const QJsonObject &containerConfig = qvariant_cast<QJsonObject>(m_containersModel->data(containerModelIndex,
|
||||||
ContainersModel::ContainersModelRoles::ConfigRole));
|
ContainersModel::Roles::ConfigRole));
|
||||||
|
|
||||||
//todo error handling
|
//todo error handling
|
||||||
qApp->processEvents();
|
qApp->processEvents();
|
||||||
|
|
|
||||||
82
client/ui/controllers/installController.cpp
Normal file
82
client/ui/controllers/installController.cpp
Normal file
|
|
@ -0,0 +1,82 @@
|
||||||
|
#include "installController.h"
|
||||||
|
|
||||||
|
#include <QJsonObject>
|
||||||
|
|
||||||
|
#include "core/servercontroller.h"
|
||||||
|
|
||||||
|
InstallController::InstallController(const QSharedPointer<ServersModel> &serversModel,
|
||||||
|
const QSharedPointer<ContainersModel> &containersModel,
|
||||||
|
const std::shared_ptr<Settings> &settings,
|
||||||
|
QObject *parent) : QObject(parent), m_serversModel(serversModel), m_containersModel(containersModel), m_settings(settings)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
ErrorCode InstallController::install(DockerContainer container, int port, TransportProto transportProto)
|
||||||
|
{
|
||||||
|
Proto mainProto = ContainerProps::defaultProtocol(container);
|
||||||
|
|
||||||
|
QJsonObject containerConfig {
|
||||||
|
{ config_key::port, QString::number(port) },
|
||||||
|
{ config_key::transport_proto, ProtocolProps::transportProtoToString(transportProto, mainProto) }
|
||||||
|
};
|
||||||
|
QJsonObject config {
|
||||||
|
{ config_key::container, ContainerProps::containerToString(container) },
|
||||||
|
{ ProtocolProps::protoToString(mainProto), containerConfig }
|
||||||
|
};
|
||||||
|
|
||||||
|
if (m_shouldCreateServer) {
|
||||||
|
return installServer(container, config);
|
||||||
|
} else {
|
||||||
|
return installContainer(container, config);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ErrorCode InstallController::installServer(DockerContainer container, QJsonObject& config)
|
||||||
|
{
|
||||||
|
//todo check if container already installed
|
||||||
|
ServerController serverController(m_settings);
|
||||||
|
ErrorCode errorCode = serverController.setupContainer(m_currentlyInstalledServerCredentials, container, config);
|
||||||
|
if (errorCode == ErrorCode::NoError) {
|
||||||
|
QJsonObject server;
|
||||||
|
server.insert(config_key::hostName, m_currentlyInstalledServerCredentials.hostName);
|
||||||
|
server.insert(config_key::userName, m_currentlyInstalledServerCredentials.userName);
|
||||||
|
server.insert(config_key::password, m_currentlyInstalledServerCredentials.password);
|
||||||
|
server.insert(config_key::port, m_currentlyInstalledServerCredentials.port);
|
||||||
|
server.insert(config_key::description, m_settings->nextAvailableServerName());
|
||||||
|
|
||||||
|
server.insert(config_key::containers, QJsonArray{ config });
|
||||||
|
server.insert(config_key::defaultContainer, ContainerProps::containerToString(container));
|
||||||
|
|
||||||
|
m_settings->addServer(server);
|
||||||
|
m_settings->setDefaultServer(m_settings->serversCount() - 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
return errorCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
ErrorCode InstallController::installContainer(DockerContainer container, QJsonObject& config)
|
||||||
|
{
|
||||||
|
//todo check if container already installed
|
||||||
|
ServerCredentials serverCredentials = m_serversModel->getCurrentlyProcessedServerCredentials();
|
||||||
|
|
||||||
|
ServerController serverController(m_settings);
|
||||||
|
ErrorCode errorCode = serverController.setupContainer(serverCredentials, container, config);
|
||||||
|
if (errorCode == ErrorCode::NoError) {
|
||||||
|
m_containersModel->setData(m_containersModel->index(container), config, ContainersModel::Roles::ConfigRole);
|
||||||
|
emit installContainerFinished();
|
||||||
|
}
|
||||||
|
|
||||||
|
//todo error processing
|
||||||
|
return errorCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
void InstallController::setCurrentlyInstalledServerCredentials(const QString &hostName, const QString &userName, const QString &password, const int &port)
|
||||||
|
{
|
||||||
|
m_currentlyInstalledServerCredentials = { hostName, userName, password, port };
|
||||||
|
}
|
||||||
|
|
||||||
|
void InstallController::setShouldCreateServer(bool shouldCreateServer)
|
||||||
|
{
|
||||||
|
m_shouldCreateServer = shouldCreateServer;
|
||||||
|
}
|
||||||
40
client/ui/controllers/installController.h
Normal file
40
client/ui/controllers/installController.h
Normal file
|
|
@ -0,0 +1,40 @@
|
||||||
|
#ifndef INSTALLCONTROLLER_H
|
||||||
|
#define INSTALLCONTROLLER_H
|
||||||
|
|
||||||
|
#include <QObject>
|
||||||
|
|
||||||
|
#include "core/defs.h"
|
||||||
|
#include "containers/containers_defs.h"
|
||||||
|
#include "ui/models/servers_model.h"
|
||||||
|
#include "ui/models/containers_model.h"
|
||||||
|
|
||||||
|
class InstallController : public QObject
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
explicit InstallController(const QSharedPointer<ServersModel> &serversModel,
|
||||||
|
const QSharedPointer<ContainersModel> &containersModel,
|
||||||
|
const std::shared_ptr<Settings> &settings,
|
||||||
|
QObject *parent = nullptr);
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
ErrorCode install(DockerContainer container, int port, TransportProto transportProto);
|
||||||
|
void setCurrentlyInstalledServerCredentials(const QString &hostName, const QString &userName, const QString &password, const int &port);
|
||||||
|
void setShouldCreateServer(bool shouldCreateServer);
|
||||||
|
|
||||||
|
signals:
|
||||||
|
void installContainerFinished();
|
||||||
|
private:
|
||||||
|
ErrorCode installServer(DockerContainer container, QJsonObject& config);
|
||||||
|
ErrorCode installContainer(DockerContainer container, QJsonObject& config);
|
||||||
|
|
||||||
|
QSharedPointer<ServersModel> m_serversModel;
|
||||||
|
QSharedPointer<ContainersModel> m_containersModel;
|
||||||
|
std::shared_ptr<Settings> m_settings;
|
||||||
|
|
||||||
|
ServerCredentials m_currentlyInstalledServerCredentials;
|
||||||
|
|
||||||
|
bool m_shouldCreateServer;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // INSTALLCONTROLLER_H
|
||||||
|
|
@ -2,7 +2,6 @@
|
||||||
|
|
||||||
ContainersModel::ContainersModel(std::shared_ptr<Settings> settings, QObject *parent) : m_settings(settings), QAbstractListModel(parent)
|
ContainersModel::ContainersModel(std::shared_ptr<Settings> settings, QObject *parent) : m_settings(settings), QAbstractListModel(parent)
|
||||||
{
|
{
|
||||||
setSelectedServerIndex(m_settings->defaultServerIndex());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int ContainersModel::rowCount(const QModelIndex &parent) const
|
int ContainersModel::rowCount(const QModelIndex &parent) const
|
||||||
|
|
@ -17,9 +16,23 @@ bool ContainersModel::setData(const QModelIndex &index, const QVariant &value, i
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (role == IsDefaultRole) {
|
|
||||||
DockerContainer container = ContainerProps::allContainers().at(index.row());
|
DockerContainer container = ContainerProps::allContainers().at(index.row());
|
||||||
m_settings->setDefaultContainer(m_selectedServerIndex, container);
|
|
||||||
|
switch (role) {
|
||||||
|
case NameRole:
|
||||||
|
// return ContainerProps::containerHumanNames().value(container);
|
||||||
|
case DescRole:
|
||||||
|
// return ContainerProps::containerDescriptions().value(container);
|
||||||
|
case ConfigRole:
|
||||||
|
m_settings->setContainerConfig(m_currentlyProcessedServerIndex, container, value.toJsonObject());
|
||||||
|
case ServiceTypeRole:
|
||||||
|
// return ContainerProps::containerService(container);
|
||||||
|
case DockerContainerRole:
|
||||||
|
// return container;
|
||||||
|
case IsInstalledRole:
|
||||||
|
// return m_settings->containers(m_currentlyProcessedServerIndex).contains(container);
|
||||||
|
case IsDefaultRole:
|
||||||
|
m_settings->setDefaultContainer(m_currentlyProcessedServerIndex, container);
|
||||||
}
|
}
|
||||||
|
|
||||||
emit dataChanged(index, index);
|
emit dataChanged(index, index);
|
||||||
|
|
@ -41,40 +54,42 @@ QVariant ContainersModel::data(const QModelIndex &index, int role) const
|
||||||
case DescRole:
|
case DescRole:
|
||||||
return ContainerProps::containerDescriptions().value(container);
|
return ContainerProps::containerDescriptions().value(container);
|
||||||
case ConfigRole:
|
case ConfigRole:
|
||||||
return m_settings->containerConfig(m_selectedServerIndex, container);
|
return m_settings->containerConfig(m_currentlyProcessedServerIndex, container);
|
||||||
case ServiceTypeRole:
|
case ServiceTypeRole:
|
||||||
return ContainerProps::containerService(container);
|
return ContainerProps::containerService(container);
|
||||||
|
case DockerContainerRole:
|
||||||
|
return container;
|
||||||
case IsInstalledRole:
|
case IsInstalledRole:
|
||||||
return m_settings->containers(m_selectedServerIndex).contains(container);
|
return m_settings->containers(m_currentlyProcessedServerIndex).contains(container);
|
||||||
|
case IsCurrentlyInstalled:
|
||||||
|
return container == static_cast<DockerContainer>(m_currentlyInstalledContainerIndex);
|
||||||
case IsDefaultRole:
|
case IsDefaultRole:
|
||||||
return container == m_settings->defaultContainer(m_selectedServerIndex);
|
return container == m_settings->defaultContainer(m_currentlyProcessedServerIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
return QVariant();
|
return QVariant();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ContainersModel::setSelectedServerIndex(int index)
|
void ContainersModel::setCurrentlyProcessedServerIndex(int index)
|
||||||
{
|
{
|
||||||
beginResetModel();
|
beginResetModel();
|
||||||
m_selectedServerIndex = index;
|
m_currentlyProcessedServerIndex = index;
|
||||||
endResetModel();
|
endResetModel();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ContainersModel::setCurrentlyInstalledContainerIndex(int index)
|
void ContainersModel::setCurrentlyInstalledContainerIndex(int index)
|
||||||
{
|
{
|
||||||
// beginResetModel();
|
m_currentlyInstalledContainerIndex = index;
|
||||||
m_currentlyInstalledContainerIndex = createIndex(index, 0);
|
|
||||||
// endResetModel();
|
|
||||||
}
|
|
||||||
|
|
||||||
QString ContainersModel::getCurrentlyInstalledContainerName()
|
|
||||||
{
|
|
||||||
return data(m_currentlyInstalledContainerIndex, NameRole).toString();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
DockerContainer ContainersModel::getDefaultContainer()
|
DockerContainer ContainersModel::getDefaultContainer()
|
||||||
{
|
{
|
||||||
return m_settings->defaultContainer(m_selectedServerIndex);
|
return m_settings->defaultContainer(m_currentlyProcessedServerIndex);
|
||||||
|
}
|
||||||
|
|
||||||
|
int ContainersModel::getCurrentlyInstalledContainerIndex()
|
||||||
|
{
|
||||||
|
return m_currentlyInstalledContainerIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
QHash<int, QByteArray> ContainersModel::roleNames() const {
|
QHash<int, QByteArray> ContainersModel::roleNames() const {
|
||||||
|
|
@ -82,7 +97,9 @@ QHash<int, QByteArray> ContainersModel::roleNames() const {
|
||||||
roles[NameRole] = "name";
|
roles[NameRole] = "name";
|
||||||
roles[DescRole] = "description";
|
roles[DescRole] = "description";
|
||||||
roles[ServiceTypeRole] = "serviceType";
|
roles[ServiceTypeRole] = "serviceType";
|
||||||
|
roles[DockerContainerRole] = "dockerContainer";
|
||||||
roles[IsInstalledRole] = "isInstalled";
|
roles[IsInstalledRole] = "isInstalled";
|
||||||
|
roles[IsCurrentlyInstalled] = "isCurrentlyInstalled";
|
||||||
roles[IsDefaultRole] = "isDefault";
|
roles[IsDefaultRole] = "isDefault";
|
||||||
return roles;
|
return roles;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -15,12 +15,14 @@ class ContainersModel : public QAbstractListModel
|
||||||
public:
|
public:
|
||||||
ContainersModel(std::shared_ptr<Settings> settings, QObject *parent = nullptr);
|
ContainersModel(std::shared_ptr<Settings> settings, QObject *parent = nullptr);
|
||||||
public:
|
public:
|
||||||
enum ContainersModelRoles {
|
enum Roles {
|
||||||
NameRole = Qt::UserRole + 1,
|
NameRole = Qt::UserRole + 1,
|
||||||
DescRole,
|
DescRole,
|
||||||
ServiceTypeRole,
|
ServiceTypeRole,
|
||||||
ConfigRole,
|
ConfigRole,
|
||||||
|
DockerContainerRole,
|
||||||
IsInstalledRole,
|
IsInstalledRole,
|
||||||
|
IsCurrentlyInstalled,
|
||||||
IsDefaultRole
|
IsDefaultRole
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -28,20 +30,20 @@ public:
|
||||||
|
|
||||||
bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole) override;
|
bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole) override;
|
||||||
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
|
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
|
||||||
Q_INVOKABLE void setSelectedServerIndex(int index);
|
|
||||||
Q_INVOKABLE void setCurrentlyInstalledContainerIndex(int index);
|
|
||||||
|
|
||||||
Q_INVOKABLE QString getCurrentlyInstalledContainerName();
|
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
DockerContainer getDefaultContainer();
|
DockerContainer getDefaultContainer();
|
||||||
|
|
||||||
|
void setCurrentlyProcessedServerIndex(int index);
|
||||||
|
void setCurrentlyInstalledContainerIndex(int index);
|
||||||
|
int getCurrentlyInstalledContainerIndex();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
QHash<int, QByteArray> roleNames() const override;
|
QHash<int, QByteArray> roleNames() const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int m_selectedServerIndex;
|
int m_currentlyProcessedServerIndex;
|
||||||
QModelIndex m_currentlyInstalledContainerIndex;
|
int m_currentlyInstalledContainerIndex;
|
||||||
std::shared_ptr<Settings> m_settings;
|
std::shared_ptr<Settings> m_settings;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -38,14 +38,14 @@ QVariant ServersModel::data(const QModelIndex &index, int role) const
|
||||||
const QJsonObject server = servers.at(index.row()).toObject();
|
const QJsonObject server = servers.at(index.row()).toObject();
|
||||||
|
|
||||||
switch (role) {
|
switch (role) {
|
||||||
case DescRole: {
|
case NameRole: {
|
||||||
auto description = server.value(config_key::description).toString();
|
auto description = server.value(config_key::description).toString();
|
||||||
if (description.isEmpty()) {
|
if (description.isEmpty()) {
|
||||||
return server.value(config_key::hostName).toString();
|
return server.value(config_key::hostName).toString();
|
||||||
}
|
}
|
||||||
return description;
|
return description;
|
||||||
}
|
}
|
||||||
case AddressRole:
|
case HostNameRole:
|
||||||
return server.value(config_key::hostName).toString();
|
return server.value(config_key::hostName).toString();
|
||||||
case CredentialsRole:
|
case CredentialsRole:
|
||||||
return QVariant::fromValue(m_settings->serverCredentials(index.row()));
|
return QVariant::fromValue(m_settings->serverCredentials(index.row()));
|
||||||
|
|
@ -74,10 +74,21 @@ const int ServersModel::getServersCount()
|
||||||
return m_settings->serversCount();
|
return m_settings->serversCount();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ServersModel::setCurrentlyProcessedServerIndex(int index)
|
||||||
|
{
|
||||||
|
m_currenlyProcessedServerIndex = index;
|
||||||
|
}
|
||||||
|
|
||||||
|
ServerCredentials ServersModel::getCurrentlyProcessedServerCredentials()
|
||||||
|
{
|
||||||
|
return qvariant_cast<ServerCredentials>(data(index(m_currenlyProcessedServerIndex), CredentialsRole));
|
||||||
|
}
|
||||||
|
|
||||||
QHash<int, QByteArray> ServersModel::roleNames() const {
|
QHash<int, QByteArray> ServersModel::roleNames() const {
|
||||||
QHash<int, QByteArray> roles;
|
QHash<int, QByteArray> roles;
|
||||||
roles[DescRole] = "desc";
|
roles[NameRole] = "name";
|
||||||
roles[AddressRole] = "address";
|
roles[HostNameRole] = "hostName";
|
||||||
roles[IsDefaultRole] = "is_default";
|
roles[CredentialsRole] = "credentials";
|
||||||
|
roles[IsDefaultRole] = "isDefault";
|
||||||
return roles;
|
return roles;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -16,8 +16,8 @@ class ServersModel : public QAbstractListModel
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
enum ServersModelRoles {
|
enum ServersModelRoles {
|
||||||
DescRole = Qt::UserRole + 1,
|
NameRole = Qt::UserRole + 1,
|
||||||
AddressRole,
|
HostNameRole,
|
||||||
CredentialsRole,
|
CredentialsRole,
|
||||||
IsDefaultRole
|
IsDefaultRole
|
||||||
};
|
};
|
||||||
|
|
@ -34,11 +34,16 @@ public slots:
|
||||||
const int getDefaultServerIndex();
|
const int getDefaultServerIndex();
|
||||||
const int getServersCount();
|
const int getServersCount();
|
||||||
|
|
||||||
|
void setCurrentlyProcessedServerIndex(int index);
|
||||||
|
ServerCredentials getCurrentlyProcessedServerCredentials();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
QHash<int, QByteArray> roleNames() const override;
|
QHash<int, QByteArray> roleNames() const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::shared_ptr<Settings> m_settings;
|
std::shared_ptr<Settings> m_settings;
|
||||||
|
|
||||||
|
int m_currenlyProcessedServerIndex;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // SERVERSMODEL_H
|
#endif // SERVERSMODEL_H
|
||||||
|
|
|
||||||
|
|
@ -65,6 +65,8 @@ Button {
|
||||||
}
|
}
|
||||||
case ConnectionState.Preparing: {
|
case ConnectionState.Preparing: {
|
||||||
console.log("Preparing")
|
console.log("Preparing")
|
||||||
|
connectionProccess.running = true
|
||||||
|
root.text = "Подключение..."
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
case ConnectionState.Connecting: {
|
case ConnectionState.Connecting: {
|
||||||
|
|
|
||||||
|
|
@ -8,40 +8,38 @@ Item {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
property string text
|
property string text
|
||||||
|
property string textColor: "#d7d8db"
|
||||||
|
|
||||||
property string descriptionText
|
property string descriptionText
|
||||||
|
|
||||||
property string headerText
|
property string headerText
|
||||||
property string headerBackButtonImage
|
property string headerBackButtonImage
|
||||||
|
|
||||||
property var onClickedFunc
|
property var onRootButtonClicked
|
||||||
property string buttonImage: "qrc:/images/controls/chevron-down.svg"
|
property string rootButtonImage: "qrc:/images/controls/chevron-down.svg"
|
||||||
property string buttonImageColor: "#494B50"
|
property string rootButtonImageColor: "#494B50"
|
||||||
|
property string rootButtonDefaultColor: "#1C1D21"
|
||||||
|
property int rootButtonMaximumWidth
|
||||||
|
|
||||||
property int buttonMaximumWidth
|
property string rootButtonBorderColor: "#494B50"
|
||||||
|
property int rootButtonBorderWidth: 1
|
||||||
property string defaultColor: "#1C1D21"
|
|
||||||
|
|
||||||
property string textColor: "#d7d8db"
|
|
||||||
|
|
||||||
property string borderColor: "#494B50"
|
|
||||||
property int borderWidth: 1
|
|
||||||
|
|
||||||
property Component menuDelegate
|
property Component menuDelegate
|
||||||
property variant menuModel
|
property variant menuModel
|
||||||
|
|
||||||
property alias menuVisible: menu.visible
|
property alias menuVisible: menu.visible
|
||||||
|
|
||||||
implicitWidth: buttonContent.implicitWidth
|
implicitWidth: rootButtonContent.implicitWidth
|
||||||
implicitHeight: buttonContent.implicitHeight
|
implicitHeight: rootButtonContent.implicitHeight
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
id: buttonBackground
|
id: rootButtonBackground
|
||||||
anchors.fill: buttonContent
|
anchors.fill: rootButtonContent
|
||||||
|
|
||||||
radius: 16
|
radius: 16
|
||||||
color: defaultColor
|
color: rootButtonDefaultColor
|
||||||
border.color: borderColor
|
border.color: rootButtonBorderColor
|
||||||
border.width: borderWidth
|
border.width: rootButtonBorderWidth
|
||||||
|
|
||||||
Behavior on border.width {
|
Behavior on border.width {
|
||||||
PropertyAnimation { duration: 200 }
|
PropertyAnimation { duration: 200 }
|
||||||
|
|
@ -49,7 +47,7 @@ Item {
|
||||||
}
|
}
|
||||||
|
|
||||||
RowLayout {
|
RowLayout {
|
||||||
id: buttonContent
|
id: rootButtonContent
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
|
||||||
spacing: 0
|
spacing: 0
|
||||||
|
|
@ -71,7 +69,7 @@ Item {
|
||||||
horizontalAlignment: Text.AlignHCenter
|
horizontalAlignment: Text.AlignHCenter
|
||||||
verticalAlignment: Text.AlignVCenter
|
verticalAlignment: Text.AlignVCenter
|
||||||
|
|
||||||
Layout.maximumWidth: buttonMaximumWidth ? buttonMaximumWidth : implicitWidth
|
Layout.maximumWidth: rootButtonMaximumWidth ? rootButtonMaximumWidth : implicitWidth
|
||||||
|
|
||||||
color: root.textColor
|
color: root.textColor
|
||||||
text: root.text
|
text: root.text
|
||||||
|
|
@ -81,40 +79,38 @@ Item {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//todo change to image type
|
||||||
ImageButtonType {
|
ImageButtonType {
|
||||||
id: button
|
|
||||||
|
|
||||||
Layout.leftMargin: 4
|
Layout.leftMargin: 4
|
||||||
Layout.rightMargin: 16
|
Layout.rightMargin: 16
|
||||||
|
|
||||||
hoverEnabled: false
|
hoverEnabled: false
|
||||||
image: buttonImage
|
image: rootButtonImage
|
||||||
imageColor: buttonImageColor
|
imageColor: rootButtonImageColor
|
||||||
onClicked: {
|
|
||||||
if (onClickedFunc && typeof onClickedFunc === "function") {
|
|
||||||
onClickedFunc()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
MouseArea {
|
MouseArea {
|
||||||
anchors.fill: buttonContent
|
anchors.fill: rootButtonContent
|
||||||
cursorShape: Qt.PointingHandCursor
|
cursorShape: Qt.PointingHandCursor
|
||||||
hoverEnabled: true
|
hoverEnabled: true
|
||||||
|
|
||||||
onEntered: {
|
onEntered: {
|
||||||
buttonBackground.border.width = borderWidth
|
rootButtonBackground.border.width = rootButtonBorderWidth
|
||||||
}
|
}
|
||||||
|
|
||||||
onExited: {
|
onExited: {
|
||||||
buttonBackground.border.width = 0
|
rootButtonBackground.border.width = 0
|
||||||
}
|
}
|
||||||
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
|
if (onRootButtonClicked && typeof onRootButtonClicked === "function") {
|
||||||
|
onRootButtonClicked()
|
||||||
|
} else {
|
||||||
menu.visible = true
|
menu.visible = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Drawer {
|
Drawer {
|
||||||
id: menu
|
id: menu
|
||||||
|
|
@ -132,7 +128,7 @@ Item {
|
||||||
radius: 16
|
radius: 16
|
||||||
color: "#1C1D21"
|
color: "#1C1D21"
|
||||||
|
|
||||||
border.color: borderColor
|
border.color: "#494B50"
|
||||||
border.width: 1
|
border.width: 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -59,8 +59,8 @@ Item {
|
||||||
visible: image ? true : false
|
visible: image ? true : false
|
||||||
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
if (actionButtonImage && typeof actionButtonImage === "function") {
|
if (actionButtonFunction && typeof actionButtonFunction === "function") {
|
||||||
actionButtonImage()
|
actionButtonFunction()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
19
client/ui/qml/Controls2/ProgressBarType.qml
Normal file
19
client/ui/qml/Controls2/ProgressBarType.qml
Normal file
|
|
@ -0,0 +1,19 @@
|
||||||
|
import QtQuick
|
||||||
|
import QtQuick.Controls
|
||||||
|
import QtQuick.Layouts
|
||||||
|
|
||||||
|
ProgressBar {
|
||||||
|
id: root
|
||||||
|
|
||||||
|
implicitHeight: 4
|
||||||
|
|
||||||
|
background: Rectangle {
|
||||||
|
color: "#412102"
|
||||||
|
}
|
||||||
|
|
||||||
|
contentItem: Rectangle {
|
||||||
|
width: root.visualPosition * root.width
|
||||||
|
height: root.height
|
||||||
|
color: "#FBB26A"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -20,8 +20,10 @@ Item {
|
||||||
|
|
||||||
property string borderColor: "#2C2D30"
|
property string borderColor: "#2C2D30"
|
||||||
|
|
||||||
property string currentServerName: serversMenuContent.currentItem.delegateData.desc
|
property string currentServerName: serversMenuContent.currentItem.delegateData.name
|
||||||
property string currentServerDescription: serversMenuContent.currentItem.delegateData.address
|
property string currentServerHostName: serversMenuContent.currentItem.delegateData.hostName
|
||||||
|
|
||||||
|
property string currentContainerName
|
||||||
|
|
||||||
ConnectButton {
|
ConnectButton {
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
|
|
@ -72,7 +74,7 @@ Item {
|
||||||
Layout.bottomMargin: 44
|
Layout.bottomMargin: 44
|
||||||
Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter
|
Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter
|
||||||
|
|
||||||
text: currentServerDescription
|
text: currentContainerName + " | " + currentServerHostName
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -127,7 +129,7 @@ Item {
|
||||||
Layout.bottomMargin: 24
|
Layout.bottomMargin: 24
|
||||||
Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter
|
Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter
|
||||||
|
|
||||||
text: currentServerDescription
|
text: currentServerHostName
|
||||||
}
|
}
|
||||||
|
|
||||||
RowLayout {
|
RowLayout {
|
||||||
|
|
@ -150,16 +152,21 @@ Item {
|
||||||
|
|
||||||
implicitHeight: 40
|
implicitHeight: 40
|
||||||
|
|
||||||
borderWidth: 0
|
rootButtonBorderWidth: 0
|
||||||
buttonImageColor: "#0E0E11"
|
rootButtonImageColor: "#0E0E11"
|
||||||
buttonMaximumWidth: 150 //todo make it dynamic
|
rootButtonMaximumWidth: 150 //todo make it dynamic
|
||||||
|
rootButtonDefaultColor: "#D7D8DB"
|
||||||
defaultColor: "#D7D8DB"
|
|
||||||
|
|
||||||
textColor: "#0E0E11"
|
textColor: "#0E0E11"
|
||||||
headerText: "Протокол подключения"
|
headerText: "Протокол подключения"
|
||||||
headerBackButtonImage: "qrc:/images/controls/arrow-left.svg"
|
headerBackButtonImage: "qrc:/images/controls/arrow-left.svg"
|
||||||
|
|
||||||
|
onRootButtonClicked: function() {
|
||||||
|
ServersModel.setCurrentlyProcessedServerIndex(serversMenuContent.currentIndex)
|
||||||
|
ContainersModel.setCurrentlyProcessedServerIndex(serversMenuContent.currentIndex)
|
||||||
|
containersDropDown.menuVisible = true
|
||||||
|
}
|
||||||
|
|
||||||
menuModel: proxyContainersModel
|
menuModel: proxyContainersModel
|
||||||
|
|
||||||
ButtonGroup {
|
ButtonGroup {
|
||||||
|
|
@ -265,9 +272,11 @@ Item {
|
||||||
modelData.isDefault = true
|
modelData.isDefault = true
|
||||||
|
|
||||||
containersDropDown.text = containerRadioButtonText.text
|
containersDropDown.text = containerRadioButtonText.text
|
||||||
|
root.currentContainerName = containerRadioButtonText.text
|
||||||
containersDropDown.menuVisible = false
|
containersDropDown.menuVisible = false
|
||||||
} else {
|
} else {
|
||||||
ContainersModel.setCurrentlyInstalledContainerIndex(proxyContainersModel.mapToSource(delegateIndex))
|
ContainersModel.setCurrentlyInstalledContainerIndex(proxyContainersModel.mapToSource(delegateIndex))
|
||||||
|
InstallController.setShouldCreateServer(false)
|
||||||
PageController.goToPage(PageEnum.PageSetupWizardProtocolSettings)
|
PageController.goToPage(PageEnum.PageSetupWizardProtocolSettings)
|
||||||
containersDropDown.menuVisible = false
|
containersDropDown.menuVisible = false
|
||||||
menu.visible = false
|
menu.visible = false
|
||||||
|
|
@ -307,6 +316,10 @@ Item {
|
||||||
actionButtonImage: "qrc:/images/controls/plus.svg"
|
actionButtonImage: "qrc:/images/controls/plus.svg"
|
||||||
|
|
||||||
headerText: "Серверы"
|
headerText: "Серверы"
|
||||||
|
|
||||||
|
actionButtonFunction: function() {
|
||||||
|
PageController.goToPage(PageEnum.PageSetupWizardStart)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -378,7 +391,7 @@ Item {
|
||||||
Text {
|
Text {
|
||||||
id: serverRadioButtonText
|
id: serverRadioButtonText
|
||||||
|
|
||||||
text: desc
|
text: name
|
||||||
color: "#D7D8DB"
|
color: "#D7D8DB"
|
||||||
font.pixelSize: 16
|
font.pixelSize: 16
|
||||||
font.weight: 400
|
font.weight: 400
|
||||||
|
|
@ -402,11 +415,11 @@ Item {
|
||||||
}
|
}
|
||||||
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
root.currentServerName = desc
|
serversMenuContent.currentIndex = index
|
||||||
root.currentServerDescription = address
|
root.currentServerName = name
|
||||||
|
root.currentServerHostName = hostName
|
||||||
|
|
||||||
ServersModel.setDefaultServerIndex(index)
|
ServersModel.setDefaultServerIndex(index)
|
||||||
ContainersModel.setSelectedServerIndex(index)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
MouseArea {
|
MouseArea {
|
||||||
|
|
|
||||||
|
|
@ -38,18 +38,25 @@ Item {
|
||||||
}
|
}
|
||||||
|
|
||||||
TextFieldWithHeaderType {
|
TextFieldWithHeaderType {
|
||||||
|
id: hostname
|
||||||
|
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
headerText: "Server IP adress [:port]"
|
headerText: "Server IP adress [:port]"
|
||||||
}
|
}
|
||||||
|
|
||||||
TextFieldWithHeaderType {
|
TextFieldWithHeaderType {
|
||||||
|
id: username
|
||||||
|
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
headerText: "Login to connect via SSH"
|
headerText: "Login to connect via SSH"
|
||||||
}
|
}
|
||||||
|
|
||||||
TextFieldWithHeaderType {
|
TextFieldWithHeaderType {
|
||||||
|
id: secretData
|
||||||
|
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
headerText: "Password / Private key"
|
headerText: "Password / Private key"
|
||||||
|
textField.echoMode: TextInput.Password
|
||||||
}
|
}
|
||||||
|
|
||||||
BasicButtonType {
|
BasicButtonType {
|
||||||
|
|
@ -77,6 +84,9 @@ Item {
|
||||||
text: qsTr("Выбрать протокол для установки")
|
text: qsTr("Выбрать протокол для установки")
|
||||||
|
|
||||||
onClicked: function() {
|
onClicked: function() {
|
||||||
|
InstallController.setShouldCreateServer(true)
|
||||||
|
InstallController.setCurrentlyInstalledServerCredentials(hostname.textField.text, username.textField.text, secretData.textField.text)
|
||||||
|
|
||||||
PageController.goToPage(PageEnum.PageSetupWizardProtocols)
|
PageController.goToPage(PageEnum.PageSetupWizardProtocols)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,8 @@ import QtQuick
|
||||||
import QtQuick.Controls
|
import QtQuick.Controls
|
||||||
import QtQuick.Layouts
|
import QtQuick.Layouts
|
||||||
|
|
||||||
|
import SortFilterProxyModel 0.2
|
||||||
|
|
||||||
import PageEnum 1.0
|
import PageEnum 1.0
|
||||||
|
|
||||||
import "./"
|
import "./"
|
||||||
|
|
@ -12,32 +14,111 @@ import "../Config"
|
||||||
Item {
|
Item {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
|
property real progressBarValue: 0
|
||||||
|
|
||||||
|
SortFilterProxyModel {
|
||||||
|
id: proxyContainersModel
|
||||||
|
sourceModel: ContainersModel
|
||||||
|
filters: [
|
||||||
|
ValueFilter {
|
||||||
|
roleName: "isCurrentlyInstalled"
|
||||||
|
value: true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
FlickableType {
|
FlickableType {
|
||||||
id: fl
|
id: fl
|
||||||
anchors.top: root.top
|
anchors.fill: parent
|
||||||
anchors.bottom: root.bottom
|
|
||||||
contentHeight: content.height
|
contentHeight: content.height
|
||||||
|
|
||||||
ColumnLayout {
|
Column {
|
||||||
id: content
|
id: content
|
||||||
|
|
||||||
anchors.top: parent.top
|
anchors.top: parent.top
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
anchors.rightMargin: 16
|
|
||||||
anchors.leftMargin: 16
|
|
||||||
|
|
||||||
spacing: 16
|
spacing: 16
|
||||||
|
|
||||||
|
ListView {
|
||||||
|
// todo change id naming
|
||||||
|
id: container
|
||||||
|
width: parent.width
|
||||||
|
height: container.contentItem.height
|
||||||
|
currentIndex: -1
|
||||||
|
clip: true
|
||||||
|
interactive: false
|
||||||
|
model: proxyContainersModel
|
||||||
|
|
||||||
|
delegate: Item {
|
||||||
|
implicitWidth: container.width
|
||||||
|
implicitHeight: delegateContent.implicitHeight
|
||||||
|
|
||||||
|
ColumnLayout {
|
||||||
|
id: delegateContent
|
||||||
|
|
||||||
|
anchors.fill: parent
|
||||||
|
anchors.rightMargin: 16
|
||||||
|
anchors.leftMargin: 16
|
||||||
|
|
||||||
HeaderType {
|
HeaderType {
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.topMargin: 20
|
Layout.topMargin: 20
|
||||||
|
|
||||||
//TODO remove later
|
|
||||||
backButtonImage: "qrc:/images/controls/arrow-left.svg"
|
|
||||||
|
|
||||||
headerText: "Установка"
|
headerText: "Установка"
|
||||||
descriptionText: ContainersModel.getCurrentlyInstalledContainerName()
|
descriptionText: name
|
||||||
|
}
|
||||||
|
|
||||||
|
ProgressBarType {
|
||||||
|
id: progressBar
|
||||||
|
|
||||||
|
Layout.fillWidth: true
|
||||||
|
Layout.topMargin: 32
|
||||||
|
|
||||||
|
value: progressBarValue
|
||||||
|
|
||||||
|
Timer {
|
||||||
|
id: timer
|
||||||
|
|
||||||
|
interval: 300
|
||||||
|
repeat: true
|
||||||
|
running: true
|
||||||
|
onTriggered: {
|
||||||
|
progressBarValue += 0.001
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ParagraphTextType {
|
||||||
|
Layout.fillWidth: true
|
||||||
|
Layout.topMargin: 8
|
||||||
|
|
||||||
|
text: "Обычно это занимает не больше 5 минут"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Timer {
|
||||||
|
id: closePageTimer
|
||||||
|
|
||||||
|
interval: 1000
|
||||||
|
repeat: false
|
||||||
|
running: false
|
||||||
|
onTriggered: {
|
||||||
|
// todo go to root installing page
|
||||||
|
PageController.goToPage(PageEnum.PageHome)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Connections {
|
||||||
|
target: InstallController
|
||||||
|
|
||||||
|
function onInstallContainerFinished() {
|
||||||
|
progressBarValue = 1
|
||||||
|
closePageTimer.start()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,11 @@ import QtQuick
|
||||||
import QtQuick.Controls
|
import QtQuick.Controls
|
||||||
import QtQuick.Layouts
|
import QtQuick.Layouts
|
||||||
|
|
||||||
|
import SortFilterProxyModel 0.2
|
||||||
|
|
||||||
import PageEnum 1.0
|
import PageEnum 1.0
|
||||||
|
import ContainerProps 1.0
|
||||||
|
import ProtocolProps 1.0
|
||||||
|
|
||||||
import "./"
|
import "./"
|
||||||
import "../Controls2"
|
import "../Controls2"
|
||||||
|
|
@ -12,83 +16,169 @@ import "../Config"
|
||||||
Item {
|
Item {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
|
SortFilterProxyModel {
|
||||||
|
id: proxyContainersModel
|
||||||
|
sourceModel: ContainersModel
|
||||||
|
filters: [
|
||||||
|
ValueFilter {
|
||||||
|
roleName: "isCurrentlyInstalled"
|
||||||
|
value: true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
FlickableType {
|
FlickableType {
|
||||||
id: fl
|
id: fl
|
||||||
anchors.top: root.top
|
anchors.fill: parent
|
||||||
anchors.bottom: root.bottom
|
|
||||||
contentHeight: content.height
|
contentHeight: content.height
|
||||||
|
|
||||||
ColumnLayout {
|
Column {
|
||||||
id: content
|
id: content
|
||||||
|
|
||||||
anchors.top: parent.top
|
anchors.top: parent.top
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
anchors.rightMargin: 16
|
|
||||||
anchors.leftMargin: 16
|
|
||||||
|
|
||||||
spacing: 16
|
spacing: 16
|
||||||
|
|
||||||
|
ListView {
|
||||||
|
// todo change id naming
|
||||||
|
id: containers
|
||||||
|
width: parent.width
|
||||||
|
height: containers.contentItem.height
|
||||||
|
currentIndex: -1
|
||||||
|
clip: true
|
||||||
|
interactive: false
|
||||||
|
model: proxyContainersModel
|
||||||
|
|
||||||
|
delegate: Item {
|
||||||
|
implicitWidth: containers.width
|
||||||
|
implicitHeight: delegateContent.implicitHeight
|
||||||
|
|
||||||
|
ColumnLayout {
|
||||||
|
id: delegateContent
|
||||||
|
|
||||||
|
anchors.fill: parent
|
||||||
|
anchors.rightMargin: 16
|
||||||
|
anchors.leftMargin: 16
|
||||||
|
|
||||||
HeaderType {
|
HeaderType {
|
||||||
|
id: header
|
||||||
|
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.topMargin: 20
|
Layout.topMargin: 20
|
||||||
|
|
||||||
backButtonImage: "qrc:/images/controls/arrow-left.svg"
|
backButtonImage: "qrc:/images/controls/arrow-left.svg"
|
||||||
|
|
||||||
headerText: "Установка " + ContainersModel.getCurrentlyInstalledContainerName()
|
headerText: "Установка " + name
|
||||||
descriptionText: "Эти настройки можно будет изменить позже"
|
descriptionText: "Эти настройки можно будет изменить позже"
|
||||||
}
|
}
|
||||||
|
|
||||||
ParagraphTextType {
|
ParagraphTextType {
|
||||||
|
id: transportProtoHeader
|
||||||
|
|
||||||
Layout.topMargin: 16
|
Layout.topMargin: 16
|
||||||
|
|
||||||
text: "Network protocol"
|
text: "Network protocol"
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO move to separete control
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
implicitWidth: buttonGroup.implicitWidth
|
id: transportProtoBackground
|
||||||
implicitHeight: buttonGroup.implicitHeight
|
|
||||||
|
implicitWidth: transportProtoButtonGroup.implicitWidth
|
||||||
|
implicitHeight: transportProtoButtonGroup.implicitHeight
|
||||||
|
|
||||||
color: "#1C1D21"
|
color: "#1C1D21"
|
||||||
radius: 16
|
radius: 16
|
||||||
|
|
||||||
RowLayout {
|
RowLayout {
|
||||||
id: buttonGroup
|
id: transportProtoButtonGroup
|
||||||
|
|
||||||
|
property int currentIndex
|
||||||
spacing: 0
|
spacing: 0
|
||||||
|
|
||||||
HorizontalRadioButton {
|
HorizontalRadioButton {
|
||||||
|
checked: transportProtoButtonGroup.currentIndex === 0
|
||||||
|
|
||||||
implicitWidth: (root.width - 32) / 2
|
implicitWidth: (root.width - 32) / 2
|
||||||
text: "UDP"
|
text: "UDP"
|
||||||
|
|
||||||
|
hoverEnabled: !transportProtoButtonMouseArea.enabled
|
||||||
|
|
||||||
|
onClicked: {
|
||||||
|
transportProtoButtonGroup.currentIndex = 0
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
HorizontalRadioButton {
|
HorizontalRadioButton {
|
||||||
|
checked: transportProtoButtonGroup.currentIndex === 1
|
||||||
|
|
||||||
implicitWidth: (root.width - 32) / 2
|
implicitWidth: (root.width - 32) / 2
|
||||||
text: "TCP"
|
text: "TCP"
|
||||||
|
|
||||||
|
hoverEnabled: !transportProtoButtonMouseArea.enabled
|
||||||
|
|
||||||
|
onClicked: {
|
||||||
|
transportProtoButtonGroup.currentIndex = 1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
MouseArea {
|
||||||
|
id: transportProtoButtonMouseArea
|
||||||
|
|
||||||
|
anchors.fill: parent
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
TextFieldWithHeaderType {
|
TextFieldWithHeaderType {
|
||||||
|
id: port
|
||||||
|
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
headerText: "Port"
|
headerText: "Port"
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
Rectangle {
|
||||||
|
// todo make it dynamic
|
||||||
|
implicitHeight: root.height - port.implicitHeight -
|
||||||
|
transportProtoBackground.implicitHeight - transportProtoHeader.implicitHeight -
|
||||||
|
header.implicitHeight - installButton.implicitHeight - 100
|
||||||
|
|
||||||
|
color: "transparent"
|
||||||
}
|
}
|
||||||
|
|
||||||
BasicButtonType {
|
BasicButtonType {
|
||||||
anchors.bottom: parent.bottom
|
id: installButton
|
||||||
anchors.left: parent.left
|
|
||||||
anchors.right: parent.right
|
Layout.fillWidth: true
|
||||||
anchors.rightMargin: 16
|
Layout.bottomMargin: 32
|
||||||
anchors.leftMargin: 16
|
|
||||||
anchors.bottomMargin: 32
|
|
||||||
|
|
||||||
text: qsTr("Установить")
|
text: qsTr("Установить")
|
||||||
|
|
||||||
onClicked: function() {
|
onClicked: function() {
|
||||||
PageController.goToPage(PageEnum.PageSetupWizardInstalling)
|
PageController.goToPage(PageEnum.PageSetupWizardInstalling);
|
||||||
|
|
||||||
|
InstallController.install(dockerContainer, port.textFieldText, transportProtoButtonGroup.currentIndex)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Component.onCompleted: {
|
||||||
|
//todo move to protocols model?
|
||||||
|
var defaultContainerProto = ContainerProps.defaultProtocol(dockerContainer)
|
||||||
|
|
||||||
|
if (ProtocolProps.defaultPort(defaultContainerProto) < 0) {
|
||||||
|
port.visible = false
|
||||||
|
} else {
|
||||||
|
port.textFieldText = ProtocolProps.defaultPort(defaultContainerProto)
|
||||||
|
}
|
||||||
|
transportProtoButtonGroup.currentIndex = ProtocolProps.defaultTransportProto(defaultContainerProto)
|
||||||
|
|
||||||
|
port.enabled = ProtocolProps.defaultPortChangeable(defaultContainerProto)
|
||||||
|
transportProtoButtonMouseArea.enabled = !ProtocolProps.defaultTransportProtoChangeable(defaultContainerProto)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -18,10 +18,6 @@ Item {
|
||||||
id: proxyContainersModel
|
id: proxyContainersModel
|
||||||
sourceModel: ContainersModel
|
sourceModel: ContainersModel
|
||||||
filters: [
|
filters: [
|
||||||
ValueFilter {
|
|
||||||
roleName: "is_installed_role"
|
|
||||||
value: false
|
|
||||||
},
|
|
||||||
ValueFilter {
|
ValueFilter {
|
||||||
roleName: "service_type_role"
|
roleName: "service_type_role"
|
||||||
value: ProtocolEnum.Vpn
|
value: ProtocolEnum.Vpn
|
||||||
|
|
|
||||||
|
|
@ -96,7 +96,7 @@ Item {
|
||||||
radius: 16
|
radius: 16
|
||||||
color: "#1C1D21"
|
color: "#1C1D21"
|
||||||
|
|
||||||
border.color: borderColor
|
border.color: "#2C2D30"
|
||||||
border.width: 1
|
border.width: 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue