diff --git a/public/js/components/pages/cdb/Install.js b/public/js/components/pages/cdb/Install.js index b8608b45..ee9e0d3c 100644 --- a/public/js/components/pages/cdb/Install.js +++ b/public/js/components/pages/cdb/Install.js @@ -22,7 +22,7 @@ const DependencyInstallRow = { {{dep.name}} - @@ -47,7 +47,9 @@ export default { }, data: function() { return { - selected_packages: [], + busy: false, + missing_dep: false, + selected_package_map: {}, // modname -> packagename installed_mods: [], deps: [], breadcrumb: [START, ADMINISTRATION, MODS, CDB, CDB_DETAIL(this.author, this.name), { @@ -64,31 +66,59 @@ export default { }, methods: { fetch_dependencies: function() { + this.missing_dep = false; + this.busy = true; + + const selected_packages = []; + Object.keys(this.selected_package_map) + .forEach(modname => { + selected_packages.push(this.selected_package_map[modname]); + }); + return resolve_package({ package: `${this.author}/${this.name}`, installed_mods: this.installed_mods, - selected_packages: this.selected_packages + selected_packages: selected_packages }) - .then(deps => this.deps = deps); + .then(deps => this.deps = deps) + .then(() => { + this.busy = false; + this.deps.forEach(d => { + if (!d.installed && d.choices.length == 0) { + // not installed and no installation candidate + this.missing_dep = true; + } + }); + }); }, - install: function() { - return add({ - name: this.pkg.name, - author: this.pkg.author, - mod_type: this.pkg.type, + install_next: function() { + const next_dep = this.deps.find(d => !d.installed); + if (!next_dep) { + return; + } + const parts = next_dep.selected.split("/"); + + add({ + author: parts[0], + name: parts[1], + mod_type: "mod", source_type: "cdb" - }); + }) + .then(() => next_dep.installed = true) + .then(() => this.install_next()); }, - select_dep: function(dep) { - if (!this.installed_mods.find(m => m == dep)) { - this.installed_mods.push(dep); - } + select_dep: function(modname, dep) { + this.selected_package_map[modname] = dep; this.fetch_dependencies(); } }, template: /*html*/` - +
+ + Calculating dependency-tree... +
+
@@ -107,6 +137,16 @@ export default {
Modname
+
+
+
+
+ +
+
` }; \ No newline at end of file diff --git a/public/js/components/pages/cdb/Preview.js b/public/js/components/pages/cdb/Preview.js index 7f601a23..12712d84 100644 --- a/public/js/components/pages/cdb/Preview.js +++ b/public/js/components/pages/cdb/Preview.js @@ -9,7 +9,7 @@ export default { template: /*html*/`
- +
diff --git a/public/js/components/pages/mods/Mods.js b/public/js/components/pages/mods/Mods.js index d903527b..28e2af59 100644 --- a/public/js/components/pages/mods/Mods.js +++ b/public/js/components/pages/mods/Mods.js @@ -105,7 +105,7 @@ export default { - + Add from git