Browse Source

native dropdown

all-modes
pbca26 7 years ago
parent
commit
35985e8987
  1. 22
      gui/startup/index.html
  2. 1
      main.js
  3. 91
      routes/shepherd.js

22
gui/startup/index.html

@ -30,15 +30,29 @@
<div id="agamaModeStatus">Choose Agama mode</div>
<button
id="nativeOnlyBtn"
onClick="closeMainWindow()"
class="btn btn-primary margin-right-20 btn-mode">
<img src="../EasyDEX-GUI/assets/mainWindow/img/fa-cube.png"> Native only
onClick="closeMainWindow(true)"
class="btn btn-primary btn-mode btn-native">
<img src="../EasyDEX-GUI/assets/mainWindow/img/fa-cube.png"> KMD native
</button>
<div
id="nativeOnlyBtnCarret"
class="btn btn-primary btn-caret margin-right-20"
onClick="toggleDropdown()">
<img src="../EasyDEX-GUI/assets/mainWindow/img/fa-caret-down.png">
</div>
<ul class="dropdown-menu hide">
<li onClick="closeMainWindow()">
<a>KMD + REVS + JUMBLR</a>
</li>
<li onClick="closeMainWindow(null, true)">
<a>Custom</a>
</li>
</ul>
<button
id="normalStartBtn"
onClick="normalStart()"
class="btn btn-primary btn-mode">
<img src="../EasyDEX-GUI/assets/mainWindow/img/fa-cubes.png"> Normal start
<img src="../EasyDEX-GUI/assets/mainWindow/img/fa-cubes.png"> All modes
</button>
<div class="margin-top-20">
<button

1
main.js

@ -210,6 +210,7 @@ function createLoadingWindow() {
loadingWindow.appConfig = appConfig;
loadingWindow.forseCloseApp = forseCloseApp;
loadingWindow.createAppSettingsWindow = createAppSettingsWindow;
loadingWindow.startKMDNative = shepherd.startKMDNative;
// load our index.html (i.e. easyDEX GUI)
loadingWindow.loadURL(`http://${appConfig.host}:${appConfig.agamaPort}/gui/startup`);

91
routes/shepherd.js

@ -98,6 +98,92 @@ shepherd.defaultAppConfig = Object.assign({}, shepherd.appConfig);
shepherd.coindInstanceRegistry = coindInstanceRegistry;
shepherd.startKMDNative = function(selection) {
if (selection === 'KMD') {
const herdData = {
'ac_name': 'komodod',
'ac_options': [
'-daemon=0',
'-addnode=78.47.196.146',
]
};
const options = {
url: `http://127.0.0.1:${shepherd.appConfig.agamaPort}/shepherd/herd`,
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({
'herd': 'komodod',
'options': herdData,
})
};
request(options, function(error, response, body) {
if (response &&
response.statusCode &&
response.statusCode === 200) {
//resolve(body);
} else {
//resolve(body);
}
});
} else {
const herdData = [{
'ac_name': 'komodod',
'ac_options': [
'-daemon=0',
'-addnode=78.47.196.146',
]
}, {
'ac_name': 'REVS',
'ac_options': [
'-daemon=0',
'-server',
`-ac_name=REVS`,
'-addnode=78.47.196.146',
'-ac_supply=1300000'
]
}, {
'ac_name': 'JUMBLR',
'ac_options': [
'-daemon=0',
'-server',
`-ac_name=JUMBLR`,
'-addnode=78.47.196.146',
'-ac_supply=999999'
]
}];
for (let i = 0; i < herdData.length; i++) {
setTimeout(() => {
const options = {
url: `http://127.0.0.1:${shepherd.appConfig.agamaPort}/shepherd/herd`,
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({
'herd': 'komodod',
'options': herdData[i],
})
};
request(options, function(error, response, body) {
if (response &&
response.statusCode &&
response.statusCode === 200) {
//resolve(body);
} else {
//resolve(body);
}
});
}, 100);
}
}
};
/*
* Combined native dashboard update same as in gui
* type: GET
@ -1520,8 +1606,6 @@ shepherd.getConf = function(chain) {
* params: payload
*/
shepherd.post('/cli', function(req, res, next) {
console.log('cli payload ->');
console.log(req.body.payload);
if (!req.body.payload) {
const errorObj = {
msg: 'error',
@ -2202,7 +2286,6 @@ shepherd.post('/debuglog', function(req, res) {
_location = `${komodoDir}/${_ac}`;
}
console.log('komodo dir ' + komodoDir);
shepherd.readDebugLog(`${_location}/debug.log`, _lastNLines)
.then(function(result) {
const _obj = {
@ -2644,7 +2727,7 @@ function herder(flock, data) {
let kmdDebugLogLocation = (data.ac_name !== 'komodod' ? komodoDir + '/' + data.ac_name : komodoDir) + '/debug.log';
console.log('komodod flock selected...');
console.log(`selected data: ${data}`);
console.log('selected data: ' + JSON.stringify(data, null, '\t'));
shepherd.writeLog('komodod flock selected...');
shepherd.writeLog(`selected data: ${data}`);

Loading…
Cancel
Save