1/* 2 Bacula(R) - The Network Backup Solution 3 4 Copyright (C) 2000-2020 Kern Sibbald 5 6 The original author of Bacula is Kern Sibbald, with contributions 7 from many others, a complete list can be found in the file AUTHORS. 8 9 You may use this file and others of this release according to the 10 license defined in the LICENSE file, which includes the Affero General 11 Public License, v3.0 ("AGPLv3") and some additional permissions and 12 terms pursuant to its AGPLv3 Section 7. 13 14 This notice must be preserved when any source code is 15 conveyed and/or propagated. 16 17 Bacula(R) is a registered trademark of Kern Sibbald. 18*/ 19 20import QtQuick 2.10 21import QtQuick.Window 2.10 22import QtQuick.Layouts 1.3 23import QtQuick.Controls 2.3 24import QtQuick.Controls.Material 2.1 25import QtQuick.Dialogs 1.2 26import io.qt.bmob.traycontroller 1.0 27 28 29Page { 30 anchors.fill: parent 31 32 property alias model: resList.model 33 property alias panelVisible: resDetailsPanel.visible 34 property alias resType: resDetailsPanel.resType 35 36 ListView { 37 id: resList 38 anchors.left: parent.left 39 anchors.right: parent.right 40 anchors.top: parent.top 41 anchors.bottom: resDetailsPanel.visible? resDetailsPanel.top : monitorName.top 42 boundsBehavior: Flickable.StopAtBounds 43 clip: true 44 45 delegate: ResourceListItem { 46 name: model.modelData.resourceName 47 address: model.modelData.resourceAddress 48 port: model.modelData.resourcePort 49 deletable: model.modelData.deletableResource 50 51 delButton.onClicked: { 52 confirmDialog.text = "Delete resource <b>" 53 + model.modelData.resourceName + "</b> ?" 54 confirmDialog.res = model.modelData 55 confirmDialog.open() 56 } 57 58 clickArea.onClicked: { 59 resDetailsPanel.resModel = model.modelData 60 resDetailsPanel.visible = true 61 } 62 } 63 } 64 65 ResourcePanel { 66 id: resDetailsPanel 67 68 onVisibleChanged: { 69 if (!visible) { 70 controller.fetchClients() 71 controller.fetchDirectors() 72 controller.fetchStorages() 73 } 74 } 75 } 76 77 TextField { 78 id: monitorName 79 height: childrenRect.height 80 width: parent.width 81 anchors.bottom: parent.bottom 82 placeholderText: qsTr("Monitor name") 83 text: controller.getMonitorName() 84 visible: !resDetailsPanel.visible 85 } 86 87 Button { 88 id: saveMonitorBtn 89 text: "Save" 90 onClicked: controller.setMonitorName(monitorName.text) 91 92 anchors.right: parent.right 93 anchors.rightMargin: 16 94 anchors.verticalCenter: monitorName.verticalCenter 95 visible: !resDetailsPanel.visible 96 97 contentItem: Text { 98 text: saveMonitorBtn.text 99 font: saveMonitorBtn.font 100 color: saveMonitorBtn.down ? "#ef9a9a" : "#d32f2f" 101 } 102 103 background: Rectangle { 104 color: "white" 105 } 106 } 107 108 onVisibleChanged: { 109 if (visible) { 110 monitorName.text = controller.getMonitorName() 111 } 112 } 113} 114 115 116