2023-07-11 15:10:26 +00:00
|
|
|
import QtQuick 2.13
|
|
|
|
import QtQuick.Layouts 1.13
|
|
|
|
|
|
|
|
import StatusQ.Controls 0.1
|
|
|
|
|
|
|
|
import utils 1.0
|
|
|
|
|
|
|
|
import "../../views"
|
|
|
|
|
|
|
|
ColumnLayout {
|
|
|
|
id: root
|
|
|
|
|
|
|
|
property var networksModule
|
|
|
|
property var combinedNetwork
|
2024-02-12 13:13:36 +00:00
|
|
|
property var networkRPCChanged
|
2024-05-13 10:06:05 +00:00
|
|
|
property bool areTestNetworksEnabled: false
|
2023-07-11 15:10:26 +00:00
|
|
|
|
2023-09-04 15:36:28 +00:00
|
|
|
signal evaluateRpcEndPoint(string url, bool isMainUrl)
|
2024-05-13 10:06:05 +00:00
|
|
|
signal updateNetworkValues(int chainId, bool testNetwork, string newMainRpcInput, string newFailoverRpcUrl, bool revertToDefault)
|
|
|
|
|
|
|
|
onVisibleChanged: {
|
|
|
|
if (visible)
|
|
|
|
editPreviwTabBar.currentIndex = root.areTestNetworksEnabled ? 1 : 0
|
|
|
|
}
|
2023-07-11 15:10:26 +00:00
|
|
|
|
|
|
|
StatusTabBar {
|
|
|
|
id: editPreviwTabBar
|
2023-10-02 14:22:23 +00:00
|
|
|
objectName: "editPreviwTabBar"
|
2023-07-11 15:10:26 +00:00
|
|
|
StatusTabButton {
|
2023-09-22 09:58:02 +00:00
|
|
|
leftPadding: 0
|
2023-07-11 15:10:26 +00:00
|
|
|
text: qsTr("Live Network")
|
2023-10-02 12:45:27 +00:00
|
|
|
objectName: "editNetworkLiveButton"
|
2023-07-11 15:10:26 +00:00
|
|
|
width: implicitWidth
|
|
|
|
}
|
|
|
|
StatusTabButton {
|
|
|
|
text: qsTr("Test Network")
|
2023-10-02 12:45:27 +00:00
|
|
|
objectName: "editNetworkTestButton"
|
2023-07-11 15:10:26 +00:00
|
|
|
width: implicitWidth
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-08-07 18:47:16 +00:00
|
|
|
Loader {
|
2023-10-03 08:28:19 +00:00
|
|
|
objectName: "editNetworkLoader"
|
2023-07-11 15:10:26 +00:00
|
|
|
Layout.fillWidth: true
|
2023-08-07 18:47:16 +00:00
|
|
|
active: root.visible
|
|
|
|
sourceComponent: editPreviwTabBar.currentIndex === 0 ? editLiveNetwork: editTestNetwork
|
|
|
|
}
|
2023-07-11 15:10:26 +00:00
|
|
|
|
2023-08-07 18:47:16 +00:00
|
|
|
Component {
|
|
|
|
id: editLiveNetwork
|
2023-07-11 15:10:26 +00:00
|
|
|
EditNetworkForm {
|
|
|
|
network: !!root.combinedNetwork ? root.combinedNetwork.prod: null
|
|
|
|
networksModule: root.networksModule
|
2024-02-12 13:13:36 +00:00
|
|
|
networkRPCChanged: root.networkRPCChanged
|
2023-09-04 15:36:28 +00:00
|
|
|
onEvaluateRpcEndPoint: root.evaluateRpcEndPoint(url, isMainUrl)
|
2024-05-13 10:06:05 +00:00
|
|
|
onUpdateNetworkValues: root.updateNetworkValues(chainId, false, newMainRpcInput, newFailoverRpcUrl, revertToDefault)
|
2023-07-11 15:10:26 +00:00
|
|
|
}
|
2023-08-07 18:47:16 +00:00
|
|
|
}
|
2023-07-11 15:10:26 +00:00
|
|
|
|
2023-08-07 18:47:16 +00:00
|
|
|
Component {
|
|
|
|
id: editTestNetwork
|
2023-07-11 15:10:26 +00:00
|
|
|
EditNetworkForm {
|
|
|
|
network: !!root.combinedNetwork ? root.combinedNetwork.test: null
|
|
|
|
networksModule: root.networksModule
|
2024-02-12 13:13:36 +00:00
|
|
|
networkRPCChanged: root.networkRPCChanged
|
2023-09-04 15:36:28 +00:00
|
|
|
onEvaluateRpcEndPoint: root.evaluateRpcEndPoint(url, isMainUrl)
|
2024-05-13 10:06:05 +00:00
|
|
|
onUpdateNetworkValues: root.updateNetworkValues(chainId, true, newMainRpcInput, newFailoverRpcUrl, revertToDefault)
|
2023-07-11 15:10:26 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|