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
|
@ -2,7 +2,11 @@ import QtQuick
|
|||
import QtQuick.Controls
|
||||
import QtQuick.Layouts
|
||||
|
||||
import SortFilterProxyModel 0.2
|
||||
|
||||
import PageEnum 1.0
|
||||
import ContainerProps 1.0
|
||||
import ProtocolProps 1.0
|
||||
|
||||
import "./"
|
||||
import "../Controls2"
|
||||
|
@ -12,83 +16,169 @@ import "../Config"
|
|||
Item {
|
||||
id: root
|
||||
|
||||
SortFilterProxyModel {
|
||||
id: proxyContainersModel
|
||||
sourceModel: ContainersModel
|
||||
filters: [
|
||||
ValueFilter {
|
||||
roleName: "isCurrentlyInstalled"
|
||||
value: true
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
FlickableType {
|
||||
id: fl
|
||||
anchors.top: root.top
|
||||
anchors.bottom: root.bottom
|
||||
anchors.fill: parent
|
||||
contentHeight: content.height
|
||||
|
||||
ColumnLayout {
|
||||
Column {
|
||||
id: content
|
||||
|
||||
anchors.top: parent.top
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
anchors.rightMargin: 16
|
||||
anchors.leftMargin: 16
|
||||
|
||||
spacing: 16
|
||||
|
||||
HeaderType {
|
||||
Layout.fillWidth: true
|
||||
Layout.topMargin: 20
|
||||
ListView {
|
||||
// todo change id naming
|
||||
id: containers
|
||||
width: parent.width
|
||||
height: containers.contentItem.height
|
||||
currentIndex: -1
|
||||
clip: true
|
||||
interactive: false
|
||||
model: proxyContainersModel
|
||||
|
||||
backButtonImage: "qrc:/images/controls/arrow-left.svg"
|
||||
delegate: Item {
|
||||
implicitWidth: containers.width
|
||||
implicitHeight: delegateContent.implicitHeight
|
||||
|
||||
headerText: "Установка " + ContainersModel.getCurrentlyInstalledContainerName()
|
||||
descriptionText: "Эти настройки можно будет изменить позже"
|
||||
}
|
||||
ColumnLayout {
|
||||
id: delegateContent
|
||||
|
||||
ParagraphTextType {
|
||||
Layout.topMargin: 16
|
||||
anchors.fill: parent
|
||||
anchors.rightMargin: 16
|
||||
anchors.leftMargin: 16
|
||||
|
||||
text: "Network protocol"
|
||||
}
|
||||
HeaderType {
|
||||
id: header
|
||||
|
||||
//TODO move to separete control
|
||||
Rectangle {
|
||||
implicitWidth: buttonGroup.implicitWidth
|
||||
implicitHeight: buttonGroup.implicitHeight
|
||||
Layout.fillWidth: true
|
||||
Layout.topMargin: 20
|
||||
|
||||
color: "#1C1D21"
|
||||
radius: 16
|
||||
backButtonImage: "qrc:/images/controls/arrow-left.svg"
|
||||
|
||||
RowLayout {
|
||||
id: buttonGroup
|
||||
headerText: "Установка " + name
|
||||
descriptionText: "Эти настройки можно будет изменить позже"
|
||||
}
|
||||
|
||||
spacing: 0
|
||||
ParagraphTextType {
|
||||
id: transportProtoHeader
|
||||
|
||||
HorizontalRadioButton {
|
||||
implicitWidth: (root.width - 32) / 2
|
||||
text: "UDP"
|
||||
}
|
||||
Layout.topMargin: 16
|
||||
|
||||
HorizontalRadioButton {
|
||||
implicitWidth: (root.width - 32) / 2
|
||||
text: "TCP"
|
||||
text: "Network protocol"
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
id: transportProtoBackground
|
||||
|
||||
implicitWidth: transportProtoButtonGroup.implicitWidth
|
||||
implicitHeight: transportProtoButtonGroup.implicitHeight
|
||||
|
||||
color: "#1C1D21"
|
||||
radius: 16
|
||||
|
||||
RowLayout {
|
||||
id: transportProtoButtonGroup
|
||||
|
||||
property int currentIndex
|
||||
spacing: 0
|
||||
|
||||
HorizontalRadioButton {
|
||||
checked: transportProtoButtonGroup.currentIndex === 0
|
||||
|
||||
implicitWidth: (root.width - 32) / 2
|
||||
text: "UDP"
|
||||
|
||||
hoverEnabled: !transportProtoButtonMouseArea.enabled
|
||||
|
||||
onClicked: {
|
||||
transportProtoButtonGroup.currentIndex = 0
|
||||
}
|
||||
}
|
||||
|
||||
HorizontalRadioButton {
|
||||
checked: transportProtoButtonGroup.currentIndex === 1
|
||||
|
||||
implicitWidth: (root.width - 32) / 2
|
||||
text: "TCP"
|
||||
|
||||
hoverEnabled: !transportProtoButtonMouseArea.enabled
|
||||
|
||||
onClicked: {
|
||||
transportProtoButtonGroup.currentIndex = 1
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
id: transportProtoButtonMouseArea
|
||||
|
||||
anchors.fill: parent
|
||||
}
|
||||
}
|
||||
|
||||
TextFieldWithHeaderType {
|
||||
id: port
|
||||
|
||||
Layout.fillWidth: true
|
||||
headerText: "Port"
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
// todo make it dynamic
|
||||
implicitHeight: root.height - port.implicitHeight -
|
||||
transportProtoBackground.implicitHeight - transportProtoHeader.implicitHeight -
|
||||
header.implicitHeight - installButton.implicitHeight - 100
|
||||
|
||||
color: "transparent"
|
||||
}
|
||||
|
||||
BasicButtonType {
|
||||
id: installButton
|
||||
|
||||
Layout.fillWidth: true
|
||||
Layout.bottomMargin: 32
|
||||
|
||||
text: qsTr("Установить")
|
||||
|
||||
onClicked: function() {
|
||||
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)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
TextFieldWithHeaderType {
|
||||
Layout.fillWidth: true
|
||||
headerText: "Port"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
BasicButtonType {
|
||||
anchors.bottom: parent.bottom
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
anchors.rightMargin: 16
|
||||
anchors.leftMargin: 16
|
||||
anchors.bottomMargin: 32
|
||||
|
||||
text: qsTr("Установить")
|
||||
|
||||
onClicked: function() {
|
||||
PageController.goToPage(PageEnum.PageSetupWizardInstalling)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue