Skip to content
This repository has been archived by the owner on Oct 30, 2018. It is now read-only.

Commit

Permalink
fix transitioning logic
Browse files Browse the repository at this point in the history
  • Loading branch information
aleitner committed Oct 3, 2016
1 parent 234220a commit 558cfdf
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 14 deletions.
16 changes: 6 additions & 10 deletions app/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,6 @@ var main = new Vue({
data: {
userdata: userdata._parsed,
current: 0,
transitioning: false,
freespace: {size: 0, unit: 'B'},
balance: {
sjcx: 0,
Expand Down Expand Up @@ -156,8 +155,6 @@ var main = new Vue({
self.userdata.tabs[self.current].active = false;
}

self.transitioning = false;

if (index === -1) {
this.current = 0;

Expand Down Expand Up @@ -225,10 +222,9 @@ var main = new Vue({
return window.alert(err.message);
}

this.transitioning = true;
tab.transitioning = true;
tab.telemetry = { enabled: appSettings.reportTelemetry };


var storageAdapter = storj.EmbeddedStorageAdapter(tab.storage.path);
var logger = new Logger(Number(appSettings.logLevel));
var reporter = new TelemetryReporter(
Expand Down Expand Up @@ -262,7 +258,7 @@ var main = new Vue({

if (err) {
logger.error(err.message);
self.transitioning = false;
tab.transitioning = false;
return window.alert(err.message);
}

Expand Down Expand Up @@ -308,12 +304,12 @@ var main = new Vue({

userdata.saveConfig(function(err) {
if (err) {
self.transitioning = false;
tab.transitioning = false;
return window.alert(err.message);
}

farmer.join(function(err) {
self.transitioning = false;
tab.transitioning = false;

if (self.userdata.appSettings.reportTelemetry) {
self.startReportingTelemetry(tab);
Expand Down Expand Up @@ -377,10 +373,10 @@ var main = new Vue({
}

tab.wasRunning = false;
self.transitioning = true;
tab.transitioning = true;

tab.farmer().leave(function() {
self.transitioning = false;
tab.transitioning = false;
tab.farmer = null;
});
}
Expand Down
1 change: 1 addition & 0 deletions app/lib/tab.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ function Tab(options) {
endPort: options.tunnels.endPort || 0
};

this.transitioning = false;
this.id = options.id || this.createID();
this.shortId = this.id.substr(0, 6);
this.active = typeof options.active === 'undefined' ? false : options.active;
Expand Down
2 changes: 1 addition & 1 deletion app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"request": "^2.63.0",
"semver": "^5.1.0",
"storj-lib": "^4.0.0",
"storj-telemetry-reporter": "Storj/telemetry-reporter",
"storj-telemetry-reporter": "^2.0.0",
"untildify": "^2.1.0",
"vue": "^1.0.10",
"winreg": "0.0.15"
Expand Down
6 changes: 3 additions & 3 deletions app/storjshare.html
Original file line number Diff line number Diff line change
Expand Up @@ -183,13 +183,13 @@ <h4 class="modal-title">Counting Shards</h4>
<section class="action">
<div class="row">
<div class="col-xs-12">
<button v-if="!userdata.tabs[current].farmer && !transitioning" class="btn btn-block start" data-style="expand-left" v-on:click="startFarming">
<button v-if="!userdata.tabs[current].farmer && !userdata.tabs[current].transitioning" class="btn btn-block start" data-style="expand-left" v-on:click="startFarming">
<span class="start-label">START</span>
</button>
<button v-if="transitioning" class="btn btn-block transitioning" data-style="expand-left" disabled>
<button v-if="userdata.tabs[current].transitioning" class="btn btn-block transitioning" data-style="expand-left" disabled>
<span class="start-label">PREPARING...</span>
</button>
<button v-if="userdata.tabs[current].farmer && !transitioning" class="btn btn-block stop" data-style="expand-left" v-on:click="stopFarming">
<button v-if="userdata.tabs[current].farmer && !userdata.tabs[current].transitioning" class="btn btn-block stop" data-style="expand-left" v-on:click="stopFarming">
<i class="fa fa-check"></i>
<span class="start-label">STORJ SHARE IS RUNNING</span>
</button>
Expand Down

0 comments on commit 558cfdf

Please sign in to comment.