Stub out installing + exit pages

This commit is contained in:
James 2018-01-27 15:31:43 +11:00
parent 88cbb91dc6
commit dffd498c3d
3 changed files with 49 additions and 4 deletions

View file

@ -18,7 +18,8 @@ pub struct PackageDescription {
/// Describes the application itself.
#[derive(Deserialize, Serialize, Clone)]
pub struct GeneralConfig {
pub name : String
pub name : String,
pub installing_message : String
}
#[derive(Deserialize, Serialize, Clone)]

View file

@ -14,6 +14,7 @@ use std::error::Error;
use std::net::{SocketAddr, IpAddr, Ipv4Addr};
use std::thread::{self, JoinHandle};
use std::str::FromStr;
use std::process::exit;
use assets;
@ -114,6 +115,9 @@ impl WebServer {
Some(serde_json::to_string(&response).unwrap())
},
"exit" => {
exit(0);
},
_ => None
}
}

View file

@ -33,7 +33,7 @@
</h2>
</div>
<div class="column">
<div class="column" v-if="select_packages">
<h4 class="subtitle">Select your preferred settings:</h4>
<!-- Build options -->
@ -66,7 +66,28 @@
</div>
</div>
<a class="button is-primary">Install!</a>
<a class="button is-primary is-pulled-right" v-on:click="install">Install!</a>
</div>
<div class="column" v-else-if="is_installing">
<h4 class="subtitle">Installing...</h4>
<div v-html="config.general.installing_message"></div>
<br />
<progress class="progress is-info is-medium" v-bind:value="progress" max="100">
{{ progress }}%
</progress>
</div>
<div class="column" v-else-if="is_finished">
<h4 class="subtitle">Thanks for installing {{ config.general.name }}!</h4>
<a class="button is-primary is-pulled-right" v-on:click="exit">Exit</a>
</div>
<div class="column" v-else>
<h4 class="subtitle">Oh no!</h4>
<div>A error occured during installation. Please retry!</div>
</div>
</div>
</div>
@ -81,7 +102,11 @@
el: '#app',
data: {
config : config,
install_location : ""
install_location : "",
select_packages : true,
is_installing : false,
is_finished : false,
progress : 0
},
methods: {
"select_file": function() {
@ -90,6 +115,21 @@
app.install_location = e.path;
}
});
},
"install": function() {
this.select_packages = false;
this.is_installing = true;
setInterval(function() {
app.progress += 5;
if (app.progress >= 100) {
app.is_installing = false;
app.is_finished = true;
}
}, 100);
},
"exit": function() {
ajax("/api/exit", function() {});
}
}
});