v8: Update NuCache dashboard (#4435)

This commit is contained in:
Bjarne Fyrstenborg
2019-02-14 16:36:44 +01:00
committed by Sebastiaan Janssen
parent 822d6cb4c0
commit fef604d551
9 changed files with 146 additions and 80 deletions

View File

@@ -1,57 +1,112 @@
function nuCacheController($scope, umbRequestHelper, $log, $http, $q, $timeout) {
function nuCacheController($scope, $http, umbRequestHelper, localizationService, overlayService) {
$scope.reload = function () {
if ($scope.working) return;
if (confirm("Trigger a in-memory and local file cache reload on all servers.")) {
$scope.working = true;
umbRequestHelper.resourcePromise(
$http.post(umbRequestHelper.getApiUrl("nuCacheStatusBaseUrl", "ReloadCache")),
'Failed to trigger a cache reload')
.then(function (result) {
$scope.working = false;
});
}
};
var vm = this;
$scope.collect = function () {
if ($scope.working) return;
$scope.working = true;
vm.collect = collect;
vm.reload = reload;
vm.verify = verify;
vm.rebuild = rebuild;
function reload(event) {
if (vm.working) return;
const dialog = {
view: "views/dashboard/settings/overlays/nucache.reload.html",
submitButtonLabelKey: "general_ok",
submit: function (model) {
performReload();
overlayService.close();
},
close: function () {
overlayService.close();
}
};
localizationService.localize("general_reload").then(value => {
dialog.title = value;
overlayService.open(dialog);
});
event.preventDefault()
event.stopPropagation();
}
function collect() {
if (vm.working) return;
vm.working = true;
umbRequestHelper.resourcePromise(
$http.get(umbRequestHelper.getApiUrl("nuCacheStatusBaseUrl", "Collect")),
'Failed to verify the cache.')
.then(function (result) {
$scope.working = false;
$scope.status = result;
vm.working = false;
vm.status = result;
});
};
}
$scope.verify = function () {
if ($scope.working) return;
$scope.working = true;
function verify() {
if (vm.working) return;
vm.working = true;
umbRequestHelper.resourcePromise(
$http.get(umbRequestHelper.getApiUrl("nuCacheStatusBaseUrl", "GetStatus")),
'Failed to verify the cache.')
.then(function (result) {
$scope.working = false;
$scope.status = result;
vm.working = false;
vm.status = result;
});
};
}
$scope.rebuild = function () {
if ($scope.working) return;
if (confirm("Rebuild cmsContentNu table content. Expensive.")) {
$scope.working = true;
umbRequestHelper.resourcePromise(
$http.post(umbRequestHelper.getApiUrl("nuCacheStatusBaseUrl", "RebuildDbCache")),
'Failed to rebuild the cache.')
.then(function (result) {
$scope.working = false;
$scope.status = result;
});
}
};
function rebuild(event) {
if (vm.working) return;
$scope.working = false;
$scope.verify();
const dialog = {
view: "views/dashboard/settings/overlays/nucache.rebuild.html",
submitButtonLabelKey: "general_ok",
submit: function (model) {
performRebuild();
overlayService.close();
},
close: function () {
overlayService.close();
}
};
localizationService.localize("general_rebuild").then(value => {
dialog.title = value;
overlayService.open(dialog);
});
event.preventDefault()
event.stopPropagation();
}
function performReload() {
vm.working = true;
umbRequestHelper.resourcePromise(
$http.post(umbRequestHelper.getApiUrl("nuCacheStatusBaseUrl", "ReloadCache")),
'Failed to trigger a cache reload')
.then(function (result) {
vm.working = false;
});
}
function performRebuild() {
vm.working = true;
umbRequestHelper.resourcePromise(
$http.post(umbRequestHelper.getApiUrl("nuCacheStatusBaseUrl", "RebuildDbCache")),
'Failed to rebuild the cache.')
.then(function (result) {
vm.working = false;
vm.status = result;
});
}
function init() {
vm.working = false;
verify();
}
init();
}
angular.module("umbraco").controller("Umbraco.Dashboard.NuCacheController", nuCacheController);
angular.module("umbraco").controller("Umbraco.Dashboard.NuCacheController", nuCacheController);

View File

@@ -1,54 +1,44 @@
<div id="nuCache" ng-controller="Umbraco.Dashboard.NuCacheController">
<div id="nuCache" style="position: relative;" ng-controller="Umbraco.Dashboard.NuCacheController as vm">
<div ng-show="loading">
Loading...
<div ng-show="vm.loading || vm.working" style="background: rgba(255, 255, 255, 0.60); position: absolute; left: 0; right: 0; top: 0; bottom: 0;">
<umb-load-indicator></umb-load-indicator>
</div>
<p>You are running the brand new NuCache!</p>
<p style="min-height: 120px; background: #f8f8f8; padding: 4px;">
<!-- ng-if or ng-show? -->
<span ng-if="working">NuCache is working.</span>
<span ng-if="!working">NuCache says: {{status}}</span>
<p style="min-height: 120px; background: #f8f8f8; padding: 10px;">
<span ng-show="vm.working">NuCache is working.</span>
<span ng-show="!vm.working">NuCache says: {{vm.status}}</span>
</p>
<p>
This lets you refresh the status, or collect snapshots (after running a CLR GC).
</p>
<p>This lets you refresh the status, or collect snapshots (after running a CLR GC).</p>
<div>
<button type="button" ng-click="verify()" class="btn btn-warning">
<span>Refresh</span>
</button>
<button type="button" ng-click="collect()" class="btn btn-warning">
<span>Collect</span>
</button>
<button type="button" ng-click="vm.verify()" class="btn btn-warning">Refresh</button>
<button type="button" ng-click="vm.collect()" class="btn btn-warning">Collect</button>
</div>
<p></p>
<br>
<p>
This lets you rebuild the database cache (status above), ie the content of the cmsContentNu table.
Rebuilding can be expensive.
</p>
<div>
<button type="button" ng-click="rebuild()" class="btn btn-warning">
<span>Rebuild</span>
</button>
<button type="button" ng-click="vm.rebuild()" class="btn btn-warning">Rebuild</button>
</div>
<p></p>
<br>
<p>
This lets you reload the in-memory and local file cache by entirely reloading it from
the data in the cmsContentNu table, but it does not rebuild that table. This is relatively
fast. Triggers the reload on all servers in an LB environment.
</p>
<div>
<button type="button" ng-click="reload()" class="btn btn-warning">
<span>Reload</span>
</button>
<button type="button" ng-click="vm.reload($event)" class="btn btn-warning">Reload</button>
</div>
<div class="umb-loader-wrapper" ng-show="working">
<div class="umb-loader"></div>
</div>
</div>
</div>

View File

@@ -0,0 +1,7 @@
<div>
<div class="umb-alert umb-alert--warning mb2">
Rebuild content in cmsContentNu database table. Expensive.
</div>
</div>

View File

@@ -0,0 +1,7 @@
<div>
<div class="umb-alert umb-alert--warning mb2">
Trigger a in-memory and local file cache reload on all servers.
</div>
</div>

View File

@@ -1,15 +1,16 @@
function publishedStatusController($scope, umbRequestHelper, $log, $http, $q, $timeout) {
function publishedStatusController($scope, $http, umbRequestHelper) {
var vm = this;
// note: must defined base url in BackOfficeController
umbRequestHelper.resourcePromise(
$http.get(umbRequestHelper.getApiUrl('publishedStatusBaseUrl', 'GetPublishedStatusUrl')),
'Failed to get published status url')
.then(function (result) {
//result = 'views/dashboard/developer/nucache.html'
$scope.includeUrl = result;
vm.includeUrl = result;
});
}
angular.module("umbraco").controller("Umbraco.Dashboard.PublishedStatusController", publishedStatusController);
angular.module("umbraco").controller("Umbraco.Dashboard.PublishedStatusController", publishedStatusController);

View File

@@ -1,11 +1,11 @@
<div id="published" ng-controller="Umbraco.Dashboard.PublishedStatusController">
<div id="published" ng-controller="Umbraco.Dashboard.PublishedStatusController as vm">
<umb-box>
<umb-box-content>
<h3 class="bold">Published Status</h3>
<div ng-show="loading">
Loading...
</div>
<div ng-include="includeUrl"></div>
<umb-load-indicator ng-show="vm.loading"></umb-load-indicator>
<div ng-include="vm.includeUrl"></div>
</umb-box-content>
</umb-box>
</div>
</div>

View File

@@ -616,9 +616,11 @@
<key alias="pleasewait">Et øjeblik...</key>
<key alias="previous">Forrige</key>
<key alias="properties">Egenskaber</key>
<key alias="rebuild">Genopbyg</key>
<key alias="reciept">E-mail der skal modtage indhold af formular</key>
<key alias="recycleBin">Papirkurv</key>
<key alias="recycleBinEmpty">Din papirkurv er tom</key>
<key alias="reload">Genindlæs</key>
<key alias="remaining">Mangler</key>
<key alias="remove">Fjern</key>
<key alias="rename">Omdøb</key>

View File

@@ -646,9 +646,11 @@
<key alias="pleasewait">One moment please...</key>
<key alias="previous">Previous</key>
<key alias="properties">Properties</key>
<key alias="rebuild">Rebuild</key>
<key alias="reciept">Email to receive form data</key>
<key alias="recycleBin">Recycle Bin</key>
<key alias="recycleBinEmpty">Your recycle bin is empty</key>
<key alias="reload">Reload</key>
<key alias="remaining">Remaining</key>
<key alias="remove">Remove</key>
<key alias="rename">Rename</key>

View File

@@ -649,9 +649,11 @@
<key alias="pleasewait">One moment please...</key>
<key alias="previous">Previous</key>
<key alias="properties">Properties</key>
<key alias="rebuild">Rebuild</key>
<key alias="reciept">Email to receive form data</key>
<key alias="recycleBin">Recycle Bin</key>
<key alias="recycleBinEmpty">Your recycle bin is empty</key>
<key alias="reload">Reload</key>
<key alias="remaining">Remaining</key>
<key alias="remove">Remove</key>
<key alias="rename">Rename</key>