Browse Source

ui changes

cl-refactor
yann300 10 years ago
parent
commit
e901a081a7
  1. 120
      mix/qml/DeployContractStep.qml
  2. 6
      mix/qml/js/NetworkDeployment.js
  3. 5
      mix/qml/js/TransactionHelper.js

120
mix/qml/DeployContractStep.qml

@ -366,92 +366,78 @@ Rectangle {
} }
} }
RowLayout Rectangle
{ {
id: deployedRow border.color: "#cccccc"
border.width: 2
Layout.fillWidth: true Layout.fillWidth: true
Rectangle Layout.preferredHeight: parent.height + 25
color: "transparent"
ScrollView
{ {
width: labelWidth anchors.fill: parent
Label ColumnLayout
{
id: labelAddresses
text: qsTr("Deployed Contracts")
anchors.right: parent.right
anchors.verticalCenter: parent.verticalCenter
}
}
ColumnLayout
{
anchors.top: parent.top
anchors.topMargin: 1
ListModel
{ {
id: deployedAddrModel RowLayout
}
Repeater
{
id: deployedAddresses
model: deployedAddrModel
function refresh()
{ {
deployedAddrModel.clear() id: deployedRow
deployedRow.visible = Object.keys(projectModel.deploymentAddresses).length > 0 Layout.fillWidth: true
for (var k in projectModel.deploymentAddresses) Rectangle
{ {
if (k.indexOf("-") !== -1) // this is an contract instance. ctr without - are the last deployed (to support old project) width: labelWidth
deployedAddrModel.append({ id: k, value: projectModel.deploymentAddresses[k]}) Label
{
id: labelAddresses
text: qsTr("Deployed Contracts")
anchors.right: parent.right
anchors.verticalCenter: parent.verticalCenter
}
}
ColumnLayout
{
anchors.top: parent.top
anchors.topMargin: 1
width: parent.width
id: deployedAddresses
function refresh()
{
textAddresses.text = ""
deployedRow.visible = Object.keys(projectModel.deploymentAddresses).length > 0
textAddresses.text = JSON.stringify(projectModel.deploymentAddresses, null, ' ')
}
TextArea
{
anchors.fill: parent
id: textAddresses
}
} }
} }
Rectangle RowLayout
{ {
Layout.preferredHeight: 20 id: verificationRow
Layout.preferredWidth: 235 Layout.fillWidth: true
color: "transparent" visible: Object.keys(projectModel.deploymentAddresses).length > 0
Label Rectangle
{ {
id: labelContract width: labelWidth
width: 112 Label
elide: Text.ElideRight {
text: index > -1 ? deployedAddrModel.get(index).id : "" text: qsTr("Verifications")
anchors.right: parent.right
anchors.verticalCenter: parent.verticalCenter
}
} }
TextField TextArea
{ {
width: 123 id: verificationLabel
anchors.verticalCenter: parent.verticalCenter
anchors.left: labelContract.right
text: index > - 1 ? deployedAddrModel.get(index).value : ""
} }
} }
} }
} }
}
RowLayout
{
id: verificationRow
Layout.fillWidth: true
visible: Object.keys(projectModel.deploymentAddresses).length > 0
Rectangle
{
width: labelWidth
Label
{
text: qsTr("Verifications")
anchors.right: parent.right
anchors.verticalCenter: parent.verticalCenter
}
}
Label
{
id: verificationLabel
maximumLineCount: 20
}
} }
} }

6
mix/qml/js/NetworkDeployment.js

@ -296,7 +296,7 @@ function packageDapp(addresses)
deploymentDialog.packageStep.packageBase64 = packageRet[1]; deploymentDialog.packageStep.packageBase64 = packageRet[1];
deploymentDialog.packageStep.localPackageUrl = packageRet[2] + "?hash=" + packageRet[0]; deploymentDialog.packageStep.localPackageUrl = packageRet[2] + "?hash=" + packageRet[0];
deploymentDialog.packageStep.lastDeployDate = date deploymentDialog.packageStep.lastDeployDate = date
deploymentComplete() deploymentStepChanged(qsTr("Dapp is Packaged"))
} }
function registerDapp(url, callback) function registerDapp(url, callback)
@ -305,7 +305,7 @@ function registerDapp(url, callback)
checkEthPath(url, false, function (success) { checkEthPath(url, false, function (success) {
if (!success) if (!success)
return; return;
deploymentComplete(); deploymentStepChanged(qsTr("Dapp has been registered. Please wait for verifications."));
if (callback) if (callback)
callback() callback()
}); });
@ -549,7 +549,7 @@ function registerToUrlHint(url, callback)
rpcCall(requests, function (httpRequest, response) { rpcCall(requests, function (httpRequest, response) {
projectModel.registerUrlTrHash = JSON.parse(response)[0].result projectModel.registerUrlTrHash = JSON.parse(response)[0].result
deploymentComplete(); deploymentStepChanged(qsTr("Dapp resources has been registered. Please wait for verifications."));
if (callback) if (callback)
callback() callback()
}); });

5
mix/qml/js/TransactionHelper.js

@ -19,8 +19,7 @@ function defaultTransaction()
function rpcCall(requests, callBack, error) function rpcCall(requests, callBack, error)
{ {
//var jsonRpcUrl = "http://localhost:8545"; var jsonRpcUrl = "http://localhost:8545";
var jsonRpcUrl = "http://10.10.42.111:8545"
var rpcRequest = JSON.stringify(requests); var rpcRequest = JSON.stringify(requests);
console.log(rpcRequest); console.log(rpcRequest);
var httpRequest = new XMLHttpRequest(); var httpRequest = new XMLHttpRequest();
@ -29,8 +28,6 @@ function rpcCall(requests, callBack, error)
httpRequest.setRequestHeader("Content-length", rpcRequest.length); httpRequest.setRequestHeader("Content-length", rpcRequest.length);
httpRequest.setRequestHeader("Connection", "close"); httpRequest.setRequestHeader("Connection", "close");
httpRequest.onreadystatechange = function() { httpRequest.onreadystatechange = function() {
console.log(httpRequest.readyState)
console.log(httpRequest.responseText)
if (httpRequest.readyState === XMLHttpRequest.DONE) { if (httpRequest.readyState === XMLHttpRequest.DONE) {
if (httpRequest.status !== 200 || httpRequest.responseText === "") if (httpRequest.status !== 200 || httpRequest.responseText === "")
{ {

Loading…
Cancel
Save