removed the display of servers without containers on PageShare (#609)

* removed the display of servers without containers on PageShare

* removed unused isAnyContainerInstalled() from containers model

* added tab navigation to the share connection drawer

* fixed display of default server without containers on PageShare
This commit is contained in:
Nethius 2024-02-29 17:22:17 +07:00 committed by GitHub
parent e648054c7a
commit cd055cff62
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
13 changed files with 73 additions and 49 deletions

View file

@ -38,6 +38,14 @@ DrawerType2 {
expandedContent: Item {
implicitHeight: root.expandedHeight
Connections {
target: root
function onOpened() {
header.forceActiveFocus()
}
}
Header2Type {
id: header
anchors.top: parent.top
@ -48,6 +56,8 @@ DrawerType2 {
anchors.rightMargin: 16
headerText: root.headerText
KeyNavigation.tab: shareButton
}
FlickableType {
@ -68,12 +78,15 @@ DrawerType2 {
visible: root.contentVisible
BasicButtonType {
id: shareButton
Layout.fillWidth: true
Layout.topMargin: 16
text: qsTr("Share")
imageSource: "qrc:/images/controls/share-2.svg"
KeyNavigation.tab: copyConfigTextButton
clickedFunc: function() {
var fileName = ""
if (GC.isMobile()) {
@ -107,6 +120,8 @@ DrawerType2 {
text: qsTr("Copy")
imageSource: "qrc:/images/controls/copy.svg"
KeyNavigation.tab: copyNativeConfigStringButton.visible ? copyNativeConfigStringButton : showSettingsButton
}
BasicButtonType {
@ -125,9 +140,13 @@ DrawerType2 {
text: qsTr("Copy config string")
imageSource: "qrc:/images/controls/copy.svg"
KeyNavigation.tab: showSettingsButton
}
BasicButtonType {
id: showSettingsButton
Layout.fillWidth: true
Layout.topMargin: 24
@ -143,6 +162,8 @@ DrawerType2 {
clickedFunc: function() {
configContentDrawer.open()
}
KeyNavigation.tab: header
}
DrawerType2 {

View file

@ -33,22 +33,23 @@ Button {
hoverEnabled: true
background: Rectangle {
id: background_border
id: focusBorder
color: "transparent"
border.color: root.activeFocus ? root.borderFocusedColor : "transparent"
border.width: root.activeFocus ? root.borderFocusedWidth : "transparent"
anchors.fill: parent
radius: 16
Rectangle {
id: background
anchors.fill: background_border
anchors.margins: root.activeFocus ? 2: 0
anchors.fill: focusBorder
anchors.margins: root.activeFocus ? 2 : 0
radius: 16
radius: root.activeFocus ? 14 : 16
color: {
if (root.enabled) {
if (root.pressed) {
@ -59,8 +60,8 @@ Button {
return disabledColor
}
}
border.color: root.activeFocus ? "transparent" : borderColor
border.width: root.activeFocus ? 0 : borderWidth
border.color: borderColor
border.width: borderWidth
Behavior on color {
PropertyAnimation { duration: 200 }
@ -95,13 +96,13 @@ Button {
}
MouseArea {
anchors.fill: background_border
anchors.fill: focusBorder
enabled: false
cursorShape: Qt.PointingHandCursor
}
contentItem: Item {
anchors.fill: background_border
anchors.fill: focusBorder
implicitWidth: content.implicitWidth
implicitHeight: content.implicitHeight

View file

@ -162,7 +162,7 @@ PageType {
}
}
expandedContent: Item {
expandedContent: Item {
id: serverMenuContainer
implicitHeight: root.height * 0.9

View file

@ -187,9 +187,8 @@ PageType {
visible: {
if (PageController.isTriggeredByConnectButton()) {
PageController.setTriggeredBtConnectButton(false)
return ContainersModel.isAnyContainerInstalled()
PageController.setTriggeredByConnectButton(false)
return false
}
return true

View file

@ -308,6 +308,10 @@ PageType {
ValueFilter {
roleName: "hasWriteAccess"
value: true
},
ValueFilter {
roleName: "hasInstalledContainers"
value: true
}
]
}
@ -324,8 +328,12 @@ PageType {
}
Component.onCompleted: {
serverSelectorListView.currentIndex = ServersModel.isDefaultServerHasWriteAccess() ?
proxyServersModel.mapFromSource(ServersModel.defaultIndex) : 0
if (ServersModel.isDefaultServerHasWriteAccess() && ServersModel.getDefaultServerData("hasInstalledContainers")) {
serverSelectorListView.currentIndex = proxyServersModel.mapFromSource(ServersModel.defaultIndex)
} else {
serverSelectorListView.currentIndex = 0
}
serverSelectorListView.triggerCurrentItem()
}
@ -480,6 +488,7 @@ PageType {
Layout.fillWidth: true
Layout.topMargin: 40
Layout.bottomMargin: 32
enabled: shareButtonEnabled
visible: accessTypeSelector.currentIndex === 0

View file

@ -60,8 +60,8 @@ PageType {
} else {
tabBarStackView.push(pagePath, { "objectName" : pagePath }, StackView.Immediate)
}
tabBar.isServerInfoShow = page === PageEnum.PageSettingsServerInfo || PageEnum.PageSettingsSplitTunneling || tabBar.isServerInfoShow
tabBar.isServerInfoShow = (page === PageEnum.PageSettingsServerInfo) || (page === PageEnum.PageSettingsSplitTunneling) || tabBar.isServerInfoShow
}
function onGoToStartPage() {
@ -122,7 +122,7 @@ PageType {
}
function onNoInstalledContainers() {
PageController.setTriggeredBtConnectButton(true)
PageController.setTriggeredByConnectButton(true)
ServersModel.processedIndex = ServersModel.getDefaultServerIndex()
InstallController.setShouldCreateServer(false)