diff --git a/src/config.rs b/src/config.rs index 629fa4d..fc4ff22 100644 --- a/src/config.rs +++ b/src/config.rs @@ -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)] diff --git a/src/rest.rs b/src/rest.rs index fb74edf..aaa95ad 100644 --- a/src/rest.rs +++ b/src/rest.rs @@ -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 } } diff --git a/static/index.html b/static/index.html index fc036f5..e14c60d 100644 --- a/static/index.html +++ b/static/index.html @@ -33,7 +33,7 @@ -
+

Select your preferred settings:

@@ -66,7 +66,28 @@
- Install! + Install! + + +
+

Installing...

+
+
+ + + {{ progress }}% + +
+ +
+

Thanks for installing {{ config.general.name }}!

+ + Exit +
+ +
+

Oh no!

+
A error occured during installation. Please retry!
@@ -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() {}); } } });