Added ethoFS User Switch Feature

This commit is contained in:
Dev-JamesR
2019-10-16 22:36:08 -07:00
parent 6eb6cf2674
commit d9dbd39e66
2 changed files with 599 additions and 565 deletions

View File

@@ -1,6 +1,7 @@
<head> <head>
<!-- Google Fonts --> <!-- Google Fonts -->
<link href="https://fonts.googleapis.com/css?family=Roboto:400,700&subset=latin,cyrillic-ext" rel="stylesheet" type="text/css"> <link href="https://fonts.googleapis.com/css?family=Roboto:400,700&subset=latin,cyrillic-ext" rel="stylesheet"
type="text/css">
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet" type="text/css"> <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet" type="text/css">
<!-- Bootstrap Core Css --> <!-- Bootstrap Core Css -->
<!--<link href="assets/dashboard/plugins/bootstrap/css/bootstrap.css" rel="stylesheet">--> <!--<link href="assets/dashboard/plugins/bootstrap/css/bootstrap.css" rel="stylesheet">-->
@@ -12,7 +13,8 @@
<link href="assets/dashboard/plugins/morrisjs/morris.css" rel="stylesheet" />--> <link href="assets/dashboard/plugins/morrisjs/morris.css" rel="stylesheet" />-->
<!-- Custom Css --> <!-- Custom Css -->
<link href="assets/dashboard/css/style.css" rel="stylesheet"> <link href="assets/dashboard/css/style.css" rel="stylesheet">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/material-design-iconic-font/2.2.0/css/material-design-iconic-font.min.css"> <link rel="stylesheet"
href="https://cdnjs.cloudflare.com/ajax/libs/material-design-iconic-font/2.2.0/css/material-design-iconic-font.min.css">
<!-- AdminBSB Themes. You can choose a theme from css/themes instead of get all themes --> <!-- AdminBSB Themes. You can choose a theme from css/themes instead of get all themes -->
<link href="assets/dashboard/css/themes/all-themes.css" rel="stylesheet" /> <link href="assets/dashboard/css/themes/all-themes.css" rel="stylesheet" />
<script src="https://medium-widget.pixelpoint.io/widget.js"></script> <script src="https://medium-widget.pixelpoint.io/widget.js"></script>
@@ -128,15 +130,22 @@
</div> </div>
<center> <center>
<button type="button" class="btn bg-indigo waves-effect" id="main-upload-button"> <button type="button" class="btn bg-indigo waves-effect" id="main-upload-button"
style="margin: 10px; display:inline-block;">
<i class="material-icons">cloud_upload</i> <i class="material-icons">cloud_upload</i>
<span>Upload to ethoFS</span> <span>Upload to ethoFS</span>
</button> </button>
<button type="button" class="btn bg-indigo waves-effect" id="main-login-button"> <button type="button" class="btn bg-indigo waves-effect" id="main-login-button"
style="margin: 10px; display:inline-block;">
<i class="material-icons">fingerprint</i> <i class="material-icons">fingerprint</i>
<span>Login To ethoFS</span> <span id="ethofs-login-button-text">Login To ethoFS</span>
</button> </button>
</center> </center>
</div>
<h1></h1> <h1></h1>
<br> <br>
</div> </div>
@@ -195,7 +204,8 @@
</tr> </tr>
<tr style="border-color:#000;"> <tr style="border-color:#000;">
<td data-th="Private Key"> <td data-th="Private Key">
<input type="text" id="privatekey" name="privatekey" placeholder="Enter Private Key" style="color:White;"> <input type="text" id="privatekey" name="privatekey" placeholder="Enter Private Key"
style="color:White;">
</td> </td>
</tr> </tr>
</table> </table>
@@ -235,7 +245,8 @@
</div> </div>
</div> </div>
<div class="modal-footer" style="background-color: #840032;"> <div class="modal-footer" style="background-color: #840032;">
<button type="button" class="btn btn-link waves-effect" data-dismiss="modal" id="ethofs-registration-button">REGISTER</button> <button type="button" class="btn btn-link waves-effect" data-dismiss="modal"
id="ethofs-registration-button">REGISTER</button>
</div> </div>
</div> </div>
</div> </div>
@@ -306,7 +317,8 @@
box to upload. box to upload.
</p> </p>
</center> </center>
<input type="file" id="fileUploadButton" webkitdirectory="true" mozdirectory="true" msdirectory="true" odirectory="true" directory="true" multiple="true"> <input type="file" id="fileUploadButton" webkitdirectory="true" mozdirectory="true" msdirectory="true"
odirectory="true" directory="true" multiple="true">
</div> </div>
<div id="progress-container"> <div id="progress-container">
<div id="progress-bar"></div> <div id="progress-bar"></div>
@@ -347,7 +359,8 @@
</tr> </tr>
<tr style="border-color:#000;"> <tr style="border-color:#000;">
<td data-th="Contract Name"> <td data-th="Contract Name">
<input type="text" id="newcontractname" name="newcontractname" placeholder="Enter Contract Name" style="color:white;"> <input type="text" id="newcontractname" name="newcontractname" placeholder="Enter Contract Name"
style="color:white;">
</td> </td>
</tr> </tr>
<tr> <tr>
@@ -404,7 +417,8 @@
<div class="modal-content" style="background-color: #840032;"> <div class="modal-content" style="background-color: #840032;">
<div class="modal-header"> <div class="modal-header">
<h4 class="modal-title" id="defaultModalLabel" style="color:white;"> <h4 class="modal-title" id="defaultModalLabel" style="color:white;">
<button type="button" class="close" data-dismiss="modal" aria-label="Close" style="color:#ffffff;" id="tracker-close-button"> <button type="button" class="close" data-dismiss="modal" aria-label="Close" style="color:#ffffff;"
id="tracker-close-button">
<span aria-hidden="true">&times;</span> <span aria-hidden="true">&times;</span>
</button> </button>
<br> <br>
@@ -423,24 +437,29 @@
<h3 style="padding-left:10px;">Message Log:</h3> <h3 style="padding-left:10px;">Message Log:</h3>
<span class="upload-message" style="color: #3CB371; font-size: 24px; padding: 10px"></span> <span class="upload-message" style="color: #3CB371; font-size: 24px; padding: 10px"></span>
</div> </div>
<div class="summary" style="text-align: center !important; padding: 10px; width:100%; background: #000000;"> <div class="summary"
style="text-align: center !important; padding: 10px; width:100%; background: #000000;">
<div id="myBar">0%</div> <div id="myBar">0%</div>
</div> </div>
</div> </div>
</main> </main>
</div> </div>
<div class="modal-footer" style="background-color: #840032; border-bottom-right-radius: 0px; border-bottom-left-radius: 0px; border-color:#000"> <div class="modal-footer"
<button type="button" class="btn btn-primary" id="upload-check-button" onclick="event.stopPropagation();">Close</button> style="background-color: #840032; border-bottom-right-radius: 0px; border-bottom-left-radius: 0px; border-color:#000">
<button type="button" class="btn btn-primary" id="upload-check-button"
onclick="event.stopPropagation();">Close</button>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<div class="modal fade" id="analyzeDataModal" tabindex="-1" role="dialog" aria-labelledby="staticModalLabel" aria-hidden="true" data-backdrop="static"> <div class="modal fade" id="analyzeDataModal" tabindex="-1" role="dialog" aria-labelledby="staticModalLabel"
aria-hidden="true" data-backdrop="static">
<div class="modal-dialog" role="document"> <div class="modal-dialog" role="document">
<div class="modal-content" style="background-color: #840032;"> <div class="modal-content" style="background-color: #840032;">
<div class="modal-header"> <div class="modal-header">
<h4 class="modal-title" id="defaultModalLabel" style="color:white;"> <h4 class="modal-title" id="defaultModalLabel" style="color:white;">
<button type="button" class="close" data-dismiss="modal" id="analyze-close-button" aria-label="Close" style="color:#ffffff;"> <button type="button" class="close" data-dismiss="modal" id="analyze-close-button" aria-label="Close"
style="color:#ffffff;">
<span aria-hidden="true">&times;</span> <span aria-hidden="true">&times;</span>
</button> </button>
<br> <br>
@@ -460,14 +479,17 @@
<h4 style="padding-left:10px;">Message Log:</h4> <h4 style="padding-left:10px;">Message Log:</h4>
<pre class="analyze-message" style="color: #3CB371; font-size: 24px;"></pre> <pre class="analyze-message" style="color: #3CB371; font-size: 24px;"></pre>
</div> </div>
<div class="summary" style="text-align: center !important; padding: 10px; width:100%; background: #000000;"> <div class="summary"
style="text-align: center !important; padding: 10px; width:100%; background: #000000;">
<div id="myAnalyzeBar">0%</div> <div id="myAnalyzeBar">0%</div>
</div> </div>
</div> </div>
<div class="modal-footer" style="background-color: #840032; border-bottom-right-radius: 0px; border-bottom-left-radius: 0px; border-color:#000"> <div class="modal-footer"
<button type="button" class="btn btn-primary" id="upload-check-button" onclick="event.stopPropagation();">Close</button> style="background-color: #840032; border-bottom-right-radius: 0px; border-bottom-left-radius: 0px; border-color:#000">
<button type="button" class="btn btn-primary" id="upload-check-button"
onclick="event.stopPropagation();">Close</button>
</div> </div>
</main> </main>
</div> </div>
@@ -477,7 +499,8 @@
<!-- end analyze data modal --> <!-- end analyze data modal -->
<!-- begin mined block checking modal --> <!-- begin mined block checking modal -->
<div class="modal fade" id="minedBlockTrackerModal" tabindex="-1" role="dialog" aria-labelledby="staticModalLabel" aria-hidden="true" data-backdrop="static"> <div class="modal fade" id="minedBlockTrackerModal" tabindex="-1" role="dialog" aria-labelledby="staticModalLabel"
aria-hidden="true" data-backdrop="static">
<div class="modal-dialog" role="document"> <div class="modal-dialog" role="document">
<div class="modal-content" style="background-color: #840032;"> <div class="modal-content" style="background-color: #840032;">
<div class="modal-header"> <div class="modal-header">
@@ -495,7 +518,8 @@
<main> <main>
<div class="box node" style="width:100%; background: #000000; background-color: #000;"> <div class="box node" style="width:100%; background: #000000; background-color: #000;">
<h3 style="padding: 20px;">Ether-1 Transaction Status: <h3 style="padding: 20px;">Ether-1 Transaction Status:
<span id="mining-status-message" style="color: #3CB371; font-size: 24px; text-align: center !important;">In <span id="mining-status-message"
style="color: #3CB371; font-size: 24px; text-align: center !important;">In
Progress</span> Progress</span>
</h3> </h3>
<div> <div>
@@ -504,7 +528,8 @@
<span class="mining-message" id="mining-message" style="color: #3CB371; font-size: 24px;"></span> <span class="mining-message" id="mining-message" style="color: #3CB371; font-size: 24px;"></span>
</center> </center>
</div> </div>
<div class="summary" style="text-align: center !important; padding: 20px; width:100%; background: #000000;"> <div class="summary"
style="text-align: center !important; padding: 20px; width:100%; background: #000000;">
<h3 style="font-size: 24px;">Current Ether-1 Block Height: <h3 style="font-size: 24px;">Current Ether-1 Block Height:
&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp
<span id="block-height" style="color: #3CB371; font-size: 24px;">0</span> <span id="block-height" style="color: #3CB371; font-size: 24px;">0</span>
@@ -519,7 +544,8 @@
<!-- end mined block checking modal --> <!-- end mined block checking modal -->
<!-- begin preparing upload modal --> <!-- begin preparing upload modal -->
<div class="modal fade" id="preparingUploadModal" tabindex="-1" role="dialog" aria-labelledby="staticModalLabel" aria-hidden="true" data-backdrop="static"> <div class="modal fade" id="preparingUploadModal" tabindex="-1" role="dialog" aria-labelledby="staticModalLabel"
aria-hidden="true" data-backdrop="static">
<div class="modal-dialog" role="document"> <div class="modal-dialog" role="document">
<div class="modal-content" style="background-color: #840032;"> <div class="modal-content" style="background-color: #840032;">
<div class="modal-header"> <div class="modal-header">
@@ -665,30 +691,32 @@
</div> </div>
</main> </main>
</div> </div>
<div class="modal-footer" style="background-color: #840032; border-bottom-right-radius: 0px; border-bottom-left-radius: 0px; border-color:#000"> <div class="modal-footer"
style="background-color: #840032; border-bottom-right-radius: 0px; border-bottom-left-radius: 0px; border-color:#000">
<div class="row clearfix"> <div class="row clearfix">
<button class="btn btn-primary" id="contract-extension-button" type="button">Extend Hosting Contract</button> <button class="btn btn-primary" id="contract-extension-button" type="button">Extend Hosting
Contract</button>
<button type="button" class="btn btn-primary" id="reset-table-button">Close</button> <button type="button" class="btn btn-primary" id="reset-table-button">Close</button>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<!-- END MODAL --> <!-- END MODAL -->
</section> </section>
<script> <script>
if (typeof module === 'object') { if (typeof module === 'object') {
window.module = module; window.module = module;
module = undefined; module = undefined;
} }
</script> </script>
<script src="assets/dashboard/js/admin.js"></script> <script src="assets/dashboard/js/admin.js"></script>
<script src="assets/dashboard/js/bundle.js"></script> <script src="assets/dashboard/js/bundle.js"></script>
<script src="assets/dashboard/js/demo.js"></script> <script src="assets/dashboard/js/demo.js"></script>
<script src="assets/dashboard/js/medium.js"></script> <script src="assets/dashboard/js/medium.js"></script>
<script> <script>
MediumWidget.Init({ MediumWidget.Init({
renderTo: '#medium-widget', renderTo: '#medium-widget',
params: { params: {
@@ -700,10 +728,10 @@
"ratio": "landscape" "ratio": "landscape"
} }
}) })
</script> </script>
<script> <script>
if (window.module) if (window.module)
module = window.module; module = window.module;
</script> </script>
</div> </div>

View File

@@ -40,6 +40,7 @@ let messageFlag = 0;
let messageString = ""; let messageString = "";
let healthMessage = ""; let healthMessage = "";
let averageAvailableStorageTotal = 0; let averageAvailableStorageTotal = 0;
var switchFlag = null;
/*SET CONTRACTS UP HERE*/ /*SET CONTRACTS UP HERE*/
var GlobalChannelString = "ethoFSPinningChannel_alpha11"; var GlobalChannelString = "ethoFSPinningChannel_alpha11";
@@ -111,13 +112,17 @@ class Uploads {
statsRow.style.display = "block"; statsRow.style.display = "block";
var uploadButton = document.getElementById("main-upload-button"); var uploadButton = document.getElementById("main-upload-button");
uploadButton.style.display = "block"; uploadButton.style.display = "block";
var loginButton = document.getElementById("main-login-button"); document.getElementById("ethofs-login-button-text").innerHTML = "Switch User";
loginButton.style.display = "none"; switchFlag = "SWITCH";
//var loginButton = document.getElementById("main-login-button");
//loginButton.style.display = "none";
} }
checkLogin() { checkLogin() {
if (GlobalPrivateKey == null || GlobalPrivateKey == "SWITCH") {
if (GlobalPrivateKey == null) { if (GlobalPrivateKey == null) {
EthoUploads.beforeLoginState(); EthoUploads.beforeLoginState();
}
web3 = new Web3() web3 = new Web3()
web3.setProvider(new Web3.providers.WebsocketProvider("ws://localhost:8546")); web3.setProvider(new Web3.providers.WebsocketProvider("ws://localhost:8546"));
$('#ethofsLoginModal').iziModal(); $('#ethofsLoginModal').iziModal();
@@ -1421,6 +1426,7 @@ $(document).on("render_uploads", function () {
}); });
$(document).on("click", "#main-login-button", function (event) { $(document).on("click", "#main-login-button", function (event) {
GlobalPrivateKey = switchFlag;
EthoUploads.checkLogin(); EthoUploads.checkLogin();
}); });