Add update functionality

:P
This commit is contained in:
James 2018-08-04 01:24:42 +10:00
parent 800fa1ac22
commit 8f24384bd0
2 changed files with 13 additions and 12 deletions

View file

@ -17,7 +17,7 @@ use hyper::{self, Error as HyperError, Get, Post, StatusCode};
use url::form_urlencoded; use url::form_urlencoded;
use std::collections::HashMap; use std::collections::HashMap;
use std::net::{SocketAddr}; use std::net::SocketAddr;
use std::process::exit; use std::process::exit;
use std::sync::mpsc::channel; use std::sync::mpsc::channel;
use std::sync::Arc; use std::sync::Arc;

View file

@ -42,7 +42,7 @@
<div class="field is-grouped"> <div class="field is-grouped">
<p class="control"> <p class="control">
<a class="button is-link" v-on:click="exit"> <a class="button is-link" v-on:click="install">
Update Update
</a> </a>
</p> </p>
@ -175,8 +175,9 @@
})); }));
}, },
"install": function() { "install": function() {
this.select_packages = false;
this.is_installing = true; this.is_installing = true;
this.modify_install = false;
this.select_packages = false;
var results = {}; var results = {};
@ -261,24 +262,24 @@
app.install_location = e.install_path; app.install_location = e.install_path;
// Copy over installed packages // Copy over installed packages
for (var x = 0; x < config.length; x++) { for (var x = 0; x < app.config.packages.length; x++) {
config[x].default = false; app.config.packages[x].default = false;
config[x].installed = false; app.config.packages[x].installed = false;
} }
for (var i = 0; i < packages.length; i++) { for (var i = 0; i < packages.length; i++) {
// Find this config package // Find this config package
for (var x = 0; x < config.length; x++) { for (var x = 0; x < app.config.packages.length; x++) {
if (config[x].name === packages[i].name) { if (app.config.packages[x].name === packages[i].name) {
config[x].default = true; app.config.packages[x].default = true;
config[x].installed = true; app.config.packages[x].installed = true;
} }
} }
} }
} else { } else {
for (var x = 0; x < config.length; x++) { for (var x = 0; x < app.config.packages.length; x++) {
config[x].installed = false; app.config.packages[x].installed = false;
} }
ajax("/api/default-path", function(e) { ajax("/api/default-path", function(e) {