Added a new dashboard to rebuild xml structures for content, members, media. I haven't put it in the release dashboard config for now. Also added methods to the examine controller to check the index integrity which we can use for th 7.3 task.

This commit is contained in:
Shannon
2014-10-23 18:52:11 +10:00
parent 44a39e7ca6
commit b4be203b2a
12 changed files with 252 additions and 27 deletions

View File

@@ -0,0 +1,62 @@
function xmlDataIntegrityReportController($scope, umbRequestHelper, $log, $http, $q, $timeout) {
function check(item) {
var action = item.check;
umbRequestHelper.resourcePromise(
$http.get(umbRequestHelper.getApiUrl("xmlDataIntegrityBaseUrl", action)),
'Failed to retrieve data integrity status')
.then(function(result) {
item.checking = false;
item.invalid = result === "false";
});
}
$scope.fix = function(item) {
var action = item.fix;
if (item.fix) {
if (confirm("This will cause all xml structures for this type to be rebuilt. " +
"Depending on how much content there is in your site this could take a while. " +
"It is not recommended to rebuild xml structures if they are not out of sync, during times of high website traffic " +
"or when editors are editing content.")) {
item.fixing = true;
umbRequestHelper.resourcePromise(
$http.post(umbRequestHelper.getApiUrl("xmlDataIntegrityBaseUrl", action)),
'Failed to retrieve data integrity status')
.then(function (result) {
item.fixing = false;
item.invalid = result === "false";
});
}
}
}
$scope.items = {
"contentXml": {
label: "Content in the cmsContentXml table",
checking: true,
fixing: false,
fix: "FixContentXmlTable",
check: "CheckContentXmlTable"
},
"mediaXml": {
label: "Media in the cmsContentXml table",
checking: true,
fixing: false,
fix: "FixMediaXmlTable",
check: "CheckMediaXmlTable"
},
"memberXml": {
label: "Members in the cmsContentXml table",
checking: true,
fixing: false,
fix: "FixMembersXmlTable",
check: "CheckMembersXmlTable"
}
};
for (var i in $scope.items) {
check($scope.items[i]);
}
}
angular.module("umbraco").controller("Umbraco.Dashboard.XmlDataIntegrityReportController", xmlDataIntegrityReportController);

View File

@@ -0,0 +1,31 @@
<div id="examineManagement" ng-controller="Umbraco.Dashboard.XmlDataIntegrityReportController">
<h3>Xml Cache Data integrity</h3>
<div ng-show="loading">
Loading...
</div>
<p>
This checks the data integrity for the xml structures for content, media and members that are stored in the cmsContentXml table.
This does not check the data integrity of the xml cache file, only the xml structures stored in the database used to create the xml cache file.
</p>
<div ng-repeat="(key, value) in items" class="umb-pane">
<span class="">{{value.label}}&nbsp;...</span>
<span ng-if="value.checking" class="text-info">Checking...</span>
<span ng-if="!value.checking && !value.invalid" class="text-success"><strong>Ok</strong></span>
<span ng-if="!value.checking && value.invalid" class="text-error"><strong>Error</strong></span>
<div ng-show="value.fix && !value.fixing">
<button type="button" ng-click="fix(value)" class="btn btn-warning">
<span ng-if="value.invalid">Fix</span>
<span ng-if="!value.invalid">Rebuild</span>
</button>
</div>
<div class="umb-loader-wrapper" ng-show="value.fixing">
<div class="umb-loader"></div>
</div>
</div>
</div>