Renter changes
This commit is contained in:
@@ -12,9 +12,16 @@
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
label {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
border: 0;
|
||||
}
|
||||
|
||||
h3 {
|
||||
margin-bottom: 2px;
|
||||
padding: 0;
|
||||
border: 0;
|
||||
}
|
||||
|
||||
p {
|
||||
@@ -35,6 +42,24 @@
|
||||
width: 98%;
|
||||
}
|
||||
|
||||
div.popup {
|
||||
position: fixed;
|
||||
color: whitesmoke;
|
||||
background-color: rgb(0, 0, 0); /* Fallback color */
|
||||
background-color: rgba(0, 0, 0, 0.7);
|
||||
margin: 0 auto;
|
||||
padding-top: 0;
|
||||
top: 0;
|
||||
left: 25%;
|
||||
width: 50%;
|
||||
padding-right: 15px;
|
||||
padding-bottom: 30px;
|
||||
padding-left: 15px;
|
||||
border: 1px solid #112311;
|
||||
z-index: 100;
|
||||
display: table;
|
||||
}
|
||||
|
||||
table {
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
@@ -67,95 +92,151 @@
|
||||
</head>
|
||||
<body id="CSiaDriveDlg">
|
||||
<div id="ID_DisabledOverlay" class="disabled_overlay" style="top: 0;left: 0;"></div>
|
||||
<div id="ID_Body">
|
||||
<div class="fill">
|
||||
<h3>Sia Information</h3>
|
||||
<div style="float: right;">
|
||||
<table>
|
||||
<tr>
|
||||
<td style="text-align: right">Client Version:</td>
|
||||
<td id="ID_ClientVersion"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="text-align: right">Server Version:</td>
|
||||
<td id="ID_ServerVersion"></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<div>
|
||||
<table>
|
||||
<tr>
|
||||
<td style="text-align: right">Available:</td>
|
||||
<td id="ID_WalletConfirmedBalance"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="text-align: right">Pending:</td>
|
||||
<td id="ID_WalletBalanceUnconfirmed"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="text-align: right">Total:</td>
|
||||
<td id="ID_WalletTotalBalance"></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="main_window">
|
||||
|
||||
</div>
|
||||
|
||||
<div id="exit_window" style="display: none;">
|
||||
<button style="width: 100px" id="ExitYes">Yes</button> <button style="width: 100px" id="ExitNo">No</button>
|
||||
</div>
|
||||
|
||||
<div id="create_wallet" style="display: none" class="fill">
|
||||
<h3>Create New Wallet</h3>
|
||||
<p>Click 'Create' to create a new Sia wallet or exit the application if this is not what you want to do.</p>
|
||||
<button id="CreateWalletButton">Create</button>
|
||||
</div>
|
||||
|
||||
<div id="unlock_wallet" style="display: none" class="fill">
|
||||
<h3>Unlock Wallet</h3>
|
||||
<p>Enter wallet password and click 'Unlock' to continue.</p>
|
||||
<input type="password" id="ID_WalletUnlockPwd" style="width: inherit"/><br/><br/>
|
||||
<button id="UnlockWalletButton">Unlock</button>
|
||||
</div>
|
||||
|
||||
<div id="disp_wallet_seed" style="display: none" class="fill">
|
||||
<h3>Wallet Created</h3>
|
||||
<p>Please save the following seed. You will need this to unlock and/or restore your wallet. Click 'Done' once you've backed-up your seed.</p>
|
||||
<textarea rows=4 cols=60 style="width: 100%" id="WalletCreatedSeed"></textarea><br/><br/>
|
||||
<button id="ConfirmSeedButton">Done</button>
|
||||
</div>
|
||||
|
||||
<div id="tab_view" style="display: none" class="fill">
|
||||
<h3>Receive Address</h3>
|
||||
<label id="ID_WalletReceiveAddress"></label><br/><br/>
|
||||
<table class="fill">
|
||||
<div id="ID_Body">
|
||||
<div class="fill">
|
||||
<h3>Sia Information</h3>
|
||||
<div style="float: right;">
|
||||
<table>
|
||||
<tr>
|
||||
<td style="text-align: center; vertical-align: top">
|
||||
<select id="ID_MountDrives"></select>
|
||||
<input id="MountButton" type="button" value="Mount"/>
|
||||
<input id="wallet_btn" type="button" value="Wallet" />
|
||||
<input id="host_btn" type="button" value="Host" />
|
||||
</td>
|
||||
<td style="text-align: right">Client Version:</td>
|
||||
<td id="ID_ClientVersion"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="text-align: right">Server Version:</td>
|
||||
<td id="ID_ServerVersion"></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div class="footer">
|
||||
<table class="fill">
|
||||
<div>
|
||||
<table>
|
||||
<tr>
|
||||
<td style="width: 70px;text-align: left"><b>Height:</b></td>
|
||||
<td id="ID_BlockHeight">...</td>
|
||||
<td style="text-align: right; vertical-align: bottom">
|
||||
<button style="width: 100px" id="ButtonOK">OK</button>
|
||||
<button style="width: 100px" id="ButtonCancel">Exit</button>
|
||||
</td>
|
||||
<td style="text-align: right">Available:</td>
|
||||
<td id="ID_WalletConfirmedBalance"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="text-align: right">Pending:</td>
|
||||
<td id="ID_WalletBalanceUnconfirmed"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="text-align: right">Total:</td>
|
||||
<td id="ID_WalletTotalBalance"></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<script src="res:/JS/#136" type="text/javascript"></script>
|
||||
|
||||
<div id="main_window">
|
||||
|
||||
</div>
|
||||
|
||||
<div id="exit_window" style="display: none;">
|
||||
<button style="width: 100px" id="ExitYes">Yes</button> <button style="width: 100px" id="ExitNo">No</button>
|
||||
</div>
|
||||
|
||||
<div id="create_wallet" style="display: none" class="fill">
|
||||
<h3>Create New Wallet</h3>
|
||||
<p>Click 'Create' to create a new Sia wallet or exit the application if this is not what you want to do.</p>
|
||||
<button id="CreateWalletButton">Create</button>
|
||||
</div>
|
||||
|
||||
<div id="unlock_wallet" style="display: none" class="fill">
|
||||
<h3>Unlock Wallet</h3>
|
||||
<p>Enter wallet password and click 'Unlock' to continue.</p>
|
||||
<input type="password" id="ID_WalletUnlockPwd" style="width: inherit"/><br/><br/>
|
||||
<button id="UnlockWalletButton">Unlock</button>
|
||||
</div>
|
||||
|
||||
<div id="disp_wallet_seed" style="display: none" class="fill">
|
||||
<h3>Wallet Created</h3>
|
||||
<p>Please save the following seed. You will need this to unlock and/or restore your wallet. Click 'Done' once you've backed-up your seed.</p>
|
||||
<textarea rows=4 cols=60 style="width: 100%" id="WalletCreatedSeed"></textarea><br/><br/>
|
||||
<button id="ConfirmSeedButton">Done</button>
|
||||
</div>
|
||||
|
||||
<div id="ID_Tab_Renter" style="display: none">
|
||||
<h3>Renter Settings <a href="javascript:void(0)" id="ID_Renter_Edit">edit</a></h3>
|
||||
<table>
|
||||
<tr>
|
||||
<td style="text-align: right">Funding:</td>
|
||||
<td id="ID_Renter_AllocatedFunds"></td>
|
||||
<td colspan="50%"></td>
|
||||
<td style="text-align: right">Hosts:</td>
|
||||
<td id="ID_Renter_HostCount"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="text-align: right">Total Space:</td>
|
||||
<td id="ID_Renter_EstimatedSpace"></td>
|
||||
<td colspan="50%"></td>
|
||||
<td style="text-align: right">Price (per GB):</td>
|
||||
<td id="ID_Renter_EstimatedCost"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="text-align: right">Available Space:</td>
|
||||
<td id="ID_Renter_AvailablSpace"></td>
|
||||
<td colspan="50%"></td>
|
||||
<td style="text-align: right">Download (per GB):</td>
|
||||
<td id="ID_Renter_EstimatedDownlodCost"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="text-align: right">Used Space:</td>
|
||||
<td id="ID_Renter_UsedSpace"></td>
|
||||
<td colspan="50%"></td>
|
||||
<td style="text-align: right">Upload (per GB):</td>
|
||||
<td id="ID_Renter_EstimatedUploadCost"></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div id="ID_TabWindow" style="display: none" class="fill">
|
||||
<h3>Receive Address</h3>
|
||||
<label id="ID_WalletReceiveAddress"></label>
|
||||
<div id="ID_ActiveTab"></div>
|
||||
</div>
|
||||
|
||||
<div class="fill">
|
||||
<h3>Mounting</h3>
|
||||
<p>Choose an available drive letter and click 'Mount'</p>
|
||||
<table>
|
||||
<tr>
|
||||
<td style="text-align: left; vertical-align: top">
|
||||
<select id="ID_MountDrives"></select>
|
||||
<input id="ID_MountButton" type="button" value="Mount" />
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div class="footer">
|
||||
<table class="fill">
|
||||
<tr>
|
||||
<td style="width: 70px;text-align: left"><b>Height:</b></td>
|
||||
<td id="ID_BlockHeight">...</td>
|
||||
<td style="text-align: right; vertical-align: bottom">
|
||||
<button style="width: 100px" id="ButtonOK">OK</button>
|
||||
<button style="width: 100px" id="ButtonCancel">Exit</button>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="popup" style="display: none" id="ID_Edit_Renter_Popup">
|
||||
<h3>Configure Renter Settings</h3>
|
||||
<table>
|
||||
<tr>
|
||||
<td>Funding:</td>
|
||||
<td><input type="number" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Hosts:</td>
|
||||
<td><input type="number" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><button type="button" onclick="closePopUp();">OK</button></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<script src="res:/JS/#136" type="text/javascript"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
Binary file not shown.
@@ -78,12 +78,13 @@ END_MESSAGE_MAP()
|
||||
// CSiaDriveDlg dialog
|
||||
|
||||
BEGIN_DHTML_EVENT_MAP(CSiaDriveDlg)
|
||||
DHTML_EVENT_ONCLICK(_T("ID_Renter_Edit"), OnButtonRenterEdit)
|
||||
DHTML_EVENT_ONCLICK(_T("ButtonOK"), OnButtonOK)
|
||||
DHTML_EVENT_ONCLICK(_T("ButtonCancel"), OnButtonCancel)
|
||||
DHTML_EVENT_ONCLICK(_T("CreateWalletButton"), OnButtonCreateWallet)
|
||||
DHTML_EVENT_ONCLICK(_T("ConfirmSeedButton"), OnButtonConfirmSeed)
|
||||
DHTML_EVENT_ONCLICK(_T("UnlockWalletButton"), OnButtonUnlockWallet)
|
||||
DHTML_EVENT_ONCLICK(_T("MountButton"), OnButtonMount)
|
||||
DHTML_EVENT_ONCLICK(_T("ID_MountButton"), OnButtonMount)
|
||||
END_DHTML_EVENT_MAP()
|
||||
|
||||
|
||||
@@ -242,13 +243,12 @@ BOOL CSiaDriveDlg::CallClientScript(LPCTSTR pStrFuncName, const String& data, CC
|
||||
|
||||
BOOL CSiaDriveDlg::CallClientScript(LPCTSTR pStrFuncName, const json& json, CComVariant* pOutVarRes)
|
||||
{
|
||||
String data = CA2W(json.dump().c_str());
|
||||
String data = CA2W(json.dump().c_str()).m_psz;
|
||||
return CallClientScript(pStrFuncName, data, pOutVarRes);
|
||||
}
|
||||
|
||||
BOOL CSiaDriveDlg::CallClientScript(LPCTSTR pStrFuncName, CComVariant* pOutVarRes)
|
||||
{
|
||||
|
||||
BOOL bRes = FALSE;
|
||||
CComVariant vaResult;
|
||||
CComPtr<IHTMLDocument2> pIDoc2;
|
||||
@@ -347,6 +347,17 @@ HRESULT CSiaDriveDlg::OnButtonMount(IHTMLElement* /*pElement*/)
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CSiaDriveDlg::OnButtonRenterEdit(IHTMLElement* /*pElement*/)
|
||||
{
|
||||
DisplayPopUp(L"ID_Edit_Renter_Popup");
|
||||
return S_FALSE;
|
||||
}
|
||||
|
||||
void CSiaDriveDlg::DisplayPopUp(const String& name)
|
||||
{
|
||||
CallClientScript(L"displayPopUp", name, nullptr);
|
||||
}
|
||||
|
||||
bool IsRefreshKeyMessage(const MSG *message)
|
||||
{
|
||||
return message
|
||||
@@ -599,6 +610,11 @@ void CSiaDriveDlg::DisplayCreateWallet()
|
||||
SetMainWindow(L"create_wallet");
|
||||
}
|
||||
|
||||
void CSiaDriveDlg::DisplayRenterTab()
|
||||
{
|
||||
SetTabWindow(L"ID_Tab_Renter");
|
||||
}
|
||||
|
||||
void CSiaDriveDlg::ConfigureWallet()
|
||||
{
|
||||
if (_siaApi.GetWallet()->GetCreated())
|
||||
@@ -611,13 +627,13 @@ void CSiaDriveDlg::ConfigureWallet()
|
||||
else
|
||||
{
|
||||
CallClientScript(L"setAvailableDrives", json(GetAvailableDrives()), nullptr);
|
||||
SetMainWindow(L"tab_view");
|
||||
SetMainWindow(L"ID_TabWindow");
|
||||
|
||||
switch (_siaConfig.GetUI_Main_TabIndex())
|
||||
{
|
||||
case WALLET_TAB:
|
||||
case RENTER_TAB:
|
||||
{
|
||||
//DisplayWalletTab();
|
||||
DisplayRenterTab();
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -645,10 +661,10 @@ void CSiaDriveDlg::DisplayUnlockWallet()
|
||||
SetFocusToElement(L"ID_WalletUnlockPwd");
|
||||
}
|
||||
|
||||
void CSiaDriveDlg::SetMainWindow(const String& name)
|
||||
void CSiaDriveDlg::SetChildWindow(const String& parentName, const String& name)
|
||||
{
|
||||
CComPtr<IHTMLDOMNode> mainNode;
|
||||
if (SUCCEEDED(GetDomNodeById(L"main_window", mainNode)))
|
||||
if (SUCCEEDED(GetDomNodeById(parentName, mainNode)))
|
||||
{
|
||||
CComPtr<IHTMLDOMNode> child;
|
||||
if (SUCCEEDED(mainNode->get_firstChild(&child)))
|
||||
@@ -700,6 +716,16 @@ void CSiaDriveDlg::SetMainWindow(const String& name)
|
||||
}
|
||||
}
|
||||
|
||||
void CSiaDriveDlg::SetMainWindow(const String& name)
|
||||
{
|
||||
SetChildWindow(L"main_window", name);
|
||||
}
|
||||
|
||||
void CSiaDriveDlg::SetTabWindow(const String& name)
|
||||
{
|
||||
SetChildWindow(L"ID_ActiveTab", name);
|
||||
}
|
||||
|
||||
HRESULT CSiaDriveDlg::OnButtonCreateWallet(IHTMLElement* pElement)
|
||||
{
|
||||
if (!_seedCreation)
|
||||
|
@@ -29,6 +29,7 @@ public:
|
||||
HRESULT OnButtonConfirmSeed(IHTMLElement* pElement);
|
||||
HRESULT OnButtonUnlockWallet(IHTMLElement* pElement);
|
||||
HRESULT OnButtonMount(IHTMLElement* pElement);
|
||||
HRESULT OnButtonRenterEdit(IHTMLElement* pElement);
|
||||
|
||||
// Implementation
|
||||
protected:
|
||||
@@ -47,7 +48,9 @@ protected:
|
||||
virtual BOOL PreTranslateMessage(MSG* pMsg) override;
|
||||
|
||||
private:
|
||||
void DisplayPopUp(const String& name);
|
||||
void DisplayCreateWallet();
|
||||
void DisplayRenterTab();
|
||||
void DisplaySeedCreated(const String& seed);
|
||||
bool UpdateSiaInfo();
|
||||
void DisplayUnlockWallet();
|
||||
@@ -55,7 +58,9 @@ private:
|
||||
void RemoveCreateWalletItems();
|
||||
void RemoveDomNodeById(const String& id);
|
||||
void SetMainWindow(const String& name);
|
||||
void SetTabWindow(const String& name);
|
||||
bool UpdateUi(const bool& refresh = true);
|
||||
void SetChildWindow(const String& parentName, const String& name);
|
||||
HRESULT GetDomNodeAndElementById(const String& id, CComPtr<IHTMLDOMNode>& node, CComPtr<IHTMLElement>& elem);
|
||||
HRESULT GetDomNodeById(const String& id, CComPtr<IHTMLDOMNode>& node);
|
||||
BOOL CallClientScript(LPCTSTR pStrFuncName, const json& json, CComVariant* pOutVarRes);
|
||||
@@ -88,5 +93,5 @@ private:
|
||||
bool _seedCreation = false;
|
||||
static const UINT IDT_UPDATE = 1;
|
||||
static const UINT IDT_UI_ACTION_QUEUE = 2;
|
||||
static const std::uint8_t WALLET_TAB = 0;
|
||||
static const std::uint8_t RENTER_TAB = 0;
|
||||
};
|
||||
|
@@ -1,4 +1,4 @@
|
||||
|
||||
var popup;
|
||||
|
||||
function setValue(elementName, data) {
|
||||
var elem = document.getElementById(elementName);
|
||||
@@ -76,3 +76,25 @@ function setAvailableDrives(driveList) {
|
||||
}
|
||||
}
|
||||
|
||||
function displayPopUp(id) {
|
||||
var elem = document.getElementById(id);
|
||||
if (elem) {
|
||||
var elem2 = document.getElementById("ID_DisabledOverlay");
|
||||
elem2.style.display = "block";
|
||||
elem.style.display = "block";
|
||||
|
||||
popup = id;
|
||||
}
|
||||
}
|
||||
|
||||
function closePopUp() {
|
||||
var elem = document.getElementById(popup);
|
||||
if (elem) {
|
||||
elem.style.display = "none";
|
||||
|
||||
elem = document.getElementById("ID_DisabledOverlay");
|
||||
elem.style.display = "none";
|
||||
|
||||
popup = "";
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user