Gets package uninstall working, fixes other UI issues with packages

This commit is contained in:
Shannon
2019-01-15 22:59:13 +11:00
parent 44ab0991ce
commit a5ff29ccc7
9 changed files with 67 additions and 244 deletions

View File

@@ -1,7 +1,7 @@
(function () {
"use strict";
function PackagesOverviewController($scope, $route, $location, navigationService, $timeout, localStorageService) {
function PackagesOverviewController($scope, $location, localStorageService) {
//Hack!
// if there is a cookie value for packageInstallUri then we need to redirect there,
@@ -9,12 +9,13 @@
// because it will double load it.
// we will refresh and then navigate there.
var installPackageUri = localStorageService.get("packageInstallUri");
const packageUri = $location.search().subview;
let installPackageUri = localStorageService.get("packageInstallUri");
let packageUri = $location.search().subview;
if (installPackageUri) {
localStorageService.remove("packageInstallUri");
}
if (installPackageUri && installPackageUri !== "installed") {
//navigate to the custom installer screen, if it is just "installed", then we'll
//show the installed view
@@ -23,6 +24,8 @@
else {
var vm = this;
packageUri = installPackageUri ? installPackageUri : packageUri; //use the path stored in storage over the one in the current path
vm.page = {};
vm.page.name = "Packages";
vm.page.navigation = [
@@ -30,7 +33,7 @@
"name": "Packages",
"icon": "icon-cloud",
"view": "views/packages/views/repo.html",
"active": !packageUri || installPackageUri === "navigation" || packageUri === "navigation",
"active": !packageUri || packageUri === "navigation",
"alias": "umbPackages",
"action": function() {
$location.search("subview", "navigation");
@@ -40,7 +43,7 @@
"name": "Installed",
"icon": "icon-box",
"view": "views/packages/views/installed.html",
"active": installPackageUri === "installed" || packageUri === "installed",
"active": packageUri === "installed",
"alias": "umbInstalled",
"action": function() {
$location.search("subview", "installed");
@@ -50,7 +53,7 @@
"name": "Install local",
"icon": "icon-add",
"view": "views/packages/views/install-local.html",
"active": installPackageUri === "local" || packageUri === "local",
"active": packageUri === "local",
"alias": "umbInstallLocal",
"action": function() {
$location.search("subview", "local");

View File

@@ -1,28 +1,24 @@
<div data-element="editor-packages" ng-controller="Umbraco.Editors.Packages.OverviewController as vm" class="clearfix">
<form name="packagesForm" ng-submit="save()" novalidate val-form-manager>
<umb-editor-view footer="false">
<umb-editor-view footer="false">
<umb-editor-header
name="vm.page.name"
name-locked="true"
hide-icon="true"
hide-description="true"
navigation="vm.page.navigation"
hide-alias="true">
</umb-editor-header>
<umb-editor-header
name="vm.page.name"
name-locked="true"
hide-icon="true"
hide-description="true"
navigation="vm.page.navigation"
hide-alias="true">
</umb-editor-header>
<umb-editor-container>
<umb-editor-container>
<umb-editor-sub-views
sub-views="vm.page.navigation" model="vm.page">
</umb-editor-sub-views>
<umb-editor-sub-views
sub-views="vm.page.navigation" model="vm.page">
</umb-editor-sub-views>
</umb-editor-container>
</umb-editor-container>
</umb-editor-view>
</form>
</umb-editor-view>
</div>

View File

@@ -1,7 +1,7 @@
(function () {
"use strict";
function PackagesInstallLocalController($scope, $route, $location, Upload, umbRequestHelper, packageResource, localStorageService, $timeout, $window, localizationService, $q) {
function PackagesInstallLocalController($scope, Upload, umbRequestHelper, packageResource, localStorageService, $timeout, $window, localizationService, $q) {
var vm = this;
vm.state = "upload";

View File

@@ -13,6 +13,8 @@
};
vm.package = {};
var labels = {};
function init() {
packageResource.getInstalled()
.then(function (packs) {
@@ -20,6 +22,16 @@
});
vm.installState.status = "";
vm.state = "list";
var labelKeys = [
"packager_installStateUninstalling",
"packager_installStateComplete",
];
localizationService.localizeMany(labelKeys).then(function (values) {
labels.installStateUninstalling = values[0];
labels.installStateComplete = values[1];
});
}
function confirmUninstall(pck) {
@@ -28,14 +40,14 @@
}
function uninstallPackage(installedPackage) {
vm.installState.status = localizationService.localize("packager_installStateUninstalling");
vm.installState.status = labels.installStateUninstalling;
vm.installState.progress = "0";
packageResource.uninstall(installedPackage.id)
.then(function () {
if (installedPackage.files.length > 0) {
vm.installState.status = localizationService.localize("packager_installStateComplete");
vm.installState.status = labels.installStateComplete;
vm.installState.progress = "100";
//set this flag so that on refresh it shows the installed packages list