liftinstall/static/index.html

209 lines
8.4 KiB
HTML
Raw Normal View History

2018-01-26 12:29:28 +00:00
<!doctype html>
2018-01-27 04:02:49 +00:00
<html lang="en" xmlns:v-bind="http://www.w3.org/1999/xhtml" xmlns:v-on="http://www.w3.org/1999/xhtml">
2018-01-26 12:29:28 +00:00
<head>
<meta charset="UTF-8">
<meta name="viewport"
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>yuzu Installer</title>
<link rel="stylesheet" href="/css/bulma.css" type="text/css">
<link rel="stylesheet" href="/css/main.css" type="text/css">
</head>
<body>
2018-01-27 03:27:41 +00:00
<div id="app">
<nav class="navbar is-dark" role="navigation" aria-label="main navigation">
<div class="navbar-brand">
2018-01-26 12:29:28 +00:00
<span class="navbar-item">
2018-01-27 03:27:41 +00:00
<img src="/img/logo.png" v-bind:alt="config.general.name">
2018-01-26 12:29:28 +00:00
</span>
2018-01-27 03:27:41 +00:00
</div>
</nav>
2018-01-26 12:29:28 +00:00
2018-01-27 03:27:41 +00:00
<!-- Main content -->
<section class="section">
<div class="container">
<div class="columns">
<div class="column is-one-third">
<h1 class="title">
Welcome to the {{ config.general.name }} installer!
</h1>
<h2 class="subtitle">
We will have you up and running in just a few moments.
</h2>
</div>
2018-01-26 12:29:28 +00:00
<div class="column" v-if="has_error">
<h4 class="subtitle">An error occurred:</h4>
2018-05-03 03:30:58 +00:00
<code>{{ error }}</code>
<a class="button is-primary is-pulled-right" v-on:click="back_to_packages">Back</a>
</div>
<div class="column" v-else-if="modify_install">
<h4 class="subtitle">Choose an option:</h4>
<a class="button is-primary is-pulled-right" v-on:click="exit">Update</a>
<a class="button is-primary is-pulled-right" v-on:click="exit">Modify</a>
<a class="button is-primary is-pulled-right" v-on:click="exit">Uninstall</a>
</div>
<div class="column" v-else-if="select_packages">
2018-01-27 03:27:41 +00:00
<h4 class="subtitle">Select your preferred settings:</h4>
2018-01-26 12:29:28 +00:00
2018-01-27 03:27:41 +00:00
<!-- Build options -->
<div class="tile is-ancestor">
<div class="tile is-parent" v-for="package in config.packages" :index="package.name">
<div class="tile is-child">
<div class="box">
<label class="checkbox">
2018-01-29 10:57:06 +00:00
<input type="checkbox" v-model="package.default" />
2018-01-27 03:27:41 +00:00
{{ package.name }}
</label>
<p>
{{ package.description }}
</p>
</div>
2018-01-26 12:29:28 +00:00
</div>
</div>
</div>
2018-01-27 03:27:41 +00:00
2018-01-27 04:02:49 +00:00
<div class="subtitle is-6">Install Location</div>
<div class="field has-addons">
<div class="control is-expanded">
<input class="input" type="text" v-model="install_location"
2018-01-27 04:14:56 +00:00
placeholder="Enter a install path here">
2018-01-27 04:02:49 +00:00
</div>
2018-01-27 03:27:41 +00:00
<div class="control">
2018-01-27 04:02:49 +00:00
<a class="button is-info" v-on:click="select_file">
Select
</a>
2018-01-26 12:29:28 +00:00
</div>
</div>
2018-01-27 04:31:43 +00:00
<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 />
<div v-html="progress_message"></div>
2018-01-27 04:31:43 +00:00
<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>
2018-01-26 12:29:28 +00:00
</div>
</div>
</div>
2018-01-27 03:27:41 +00:00
</section>
</div>
<script src="/api/config"></script>
2018-01-27 04:02:49 +00:00
<script src="/js/helpers.js"></script>
2018-01-27 03:27:41 +00:00
<script src="/js/vue.js"></script>
<script>
var app = new Vue({
el: '#app',
data: {
2018-01-27 04:02:49 +00:00
config : config,
2018-01-27 04:31:43 +00:00
install_location : "",
modify_install : false,
2018-01-27 04:31:43 +00:00
select_packages : true,
is_installing : false,
is_finished : false,
progress : 0,
progress_message : "",
has_error : false,
error : "",
metadata : {
database : [],
install_path : "",
preexisting_install : false
}
2018-01-27 04:02:49 +00:00
},
methods: {
"select_file": function() {
ajax("/api/file-select", function(e) {
if (e.path != null) {
app.install_location = e.path;
}
});
2018-01-27 04:31:43 +00:00
},
"install": function() {
this.select_packages = false;
this.is_installing = true;
2018-01-29 10:57:06 +00:00
var results = {};
console.log("Packages: " + this.config.packages);
2018-01-29 10:57:06 +00:00
for (var package_index = 0; package_index < this.config.packages.length; package_index++) {
var current_package = this.config.packages[package_index];
if (current_package.default != null) {
results[current_package.name] = current_package.default;
2018-01-27 04:31:43 +00:00
}
2018-01-29 10:57:06 +00:00
}
console.log("Results: " + results);
2018-01-29 10:57:06 +00:00
results["path"] = this.install_location;
stream_ajax("/api/start-install", function(line) {
if (line.hasOwnProperty("Status")) {
app.progress_message = line.Status[0];
app.progress = line.Status[1] * 100;
}
if (line.hasOwnProperty("Error")) {
app.is_installing = false;
app.has_error = true;
app.error = line.Error;
}
}, function(e) {
app.is_installing = false;
app.is_finished = true;
2018-01-29 10:57:06 +00:00
}, undefined, results);
2018-01-27 04:31:43 +00:00
},
"back_to_packages": function() {
app.select_packages = true;
app.has_error = false;
app.is_installing = false;
app.is_finished = false;
},
2018-01-27 04:31:43 +00:00
"exit": function() {
ajax("/api/exit", function() {});
2018-01-27 04:02:49 +00:00
}
2018-01-27 03:27:41 +00:00
}
});
2018-01-27 04:14:56 +00:00
ajax("/api/installation-status", function(e) {
app.metadata = e;
if (e.preexisting_install) {
app.modify_install = true;
app.select_packages = false;
app.install_location = e.install_path;
} else {
ajax("/api/default-path", function(e) {
if (e.path != null) {
app.install_location = e.path;
}
});
2018-01-27 04:14:56 +00:00
}
});
2018-01-27 03:27:41 +00:00
</script>
2018-01-26 12:29:28 +00:00
</body>
</html>