Adds the whole package definition to the scope model for devs to use, adds a custom query string parameter when redirecting to the angular view after install (so devs know its a new install)

This commit is contained in:
Shannon
2019-01-16 23:53:10 +11:00
parent 70574b6564
commit 7bb3588889
6 changed files with 20 additions and 23 deletions

View File

@@ -130,7 +130,7 @@
}
function back() {
$location.path("packages/packages/created").search("create", null);
$location.path("packages/packages/created").search("create", null).search("packageId", null);
}
function createOrUpdatePackage(editPackageForm) {

View File

@@ -15,6 +15,10 @@
packageResource.getInstalledById(packageId).then(pck => {
vm.package = pck;
//set the $scope too, packages can then access this if they wanted from their own scope or parent scope
$scope.package = pck;
vm.loading = false;
//make sure the packageView is formatted as a virtual path
@@ -30,7 +34,7 @@
}
function back() {
$location.path("packages/packages/installed");
$location.path("packages/packages/installed").search("packageId", null);
}

View File

@@ -4,26 +4,26 @@
function PackagesOverviewController($scope, $location, $routeParams, localStorageService) {
//Hack!
// if there is a cookie value for packageInstallUri then we need to redirect there,
// if there is a local storage value for packageInstallData then we need to redirect there,
// the issue is that we still have webforms and we cannot go to a hash location and then window.reload
// because it will double load it.
// we will refresh and then navigate there.
let installPackageUri = localStorageService.get("packageInstallUri");
let packageInstallData = localStorageService.get("packageInstallData");
let packageUri = $routeParams.method;
if (installPackageUri) {
localStorageService.remove("packageInstallUri");
if (packageInstallData) {
localStorageService.remove("packageInstallData");
}
if (installPackageUri && installPackageUri !== "installed") {
if (packageInstallData && packageInstallData !== "installed" && packageInstallData.postInstallationPath) {
//navigate to the custom installer screen, if it is just "installed" it means there is no custom installer screen
$location.path(installPackageUri).search("");
$location.path(packageInstallData.postInstallationPath).search("packageId", packageInstallData.id);
}
else {
var vm = this;
packageUri = installPackageUri ? installPackageUri : packageUri; //use the path stored in storage over the one in the current path
packageUri = packageInstallData ? packageInstallData : packageUri; //use the path stored in storage over the one in the current path
vm.page = {};
vm.page.name = "Packages";

View File

@@ -184,14 +184,8 @@
installError)
.then(function (result) {
if (result.postInstallationPath) {
//Put the redirect Uri in a cookie so we can use after reloading
localStorageService.set("packageInstallUri", result.postInstallationPath);
}
else {
//set to a constant value so it knows to just go to the installed view
localStorageService.set("packageInstallUri", "installed");
}
//Put the package data in local storage so we can use after reloading
localStorageService.set("packageInstallData", result);
vm.installState.status = labels.installStateCompleted;
vm.installCompleted = true;

View File

@@ -36,7 +36,8 @@
}
function packageOptions(pck) {
$location.path("packages/packages/options/" + pck.id);
$location.path("packages/packages/options/" + pck.id)
.search("packageId", null); //ensure the installId flag is gone, it's only available on first install
}
function confirmUninstall(pck) {
@@ -56,7 +57,7 @@
vm.installState.progress = "100";
//set this flag so that on refresh it shows the installed packages list
localStorageService.set("packageInstallUri", "installed");
localStorageService.set("packageInstallData", "installed");
//reload on next digest (after cookie)
$timeout(function () {

View File

@@ -257,10 +257,8 @@
error)
.then(function (result) {
if (result.postInstallationPath) {
//Put the redirect Uri in a cookie so we can use after reloading
localStorageService.set("packageInstallUri", result.postInstallationPath);
}
//Put the package data in local storage so we can use after reloading
localStorageService.set("packageInstallData", result);
vm.installState.status = labels.installStateCompleted;
vm.installCompleted = true;