dashboard: show postinstall message for admin notes unless set

This commit is contained in:
Johannes Zellner
2024-06-24 19:59:02 +02:00
parent 78aee78d9c
commit 1d9ad35019
+11 -3
View File
@@ -148,26 +148,34 @@ angular.module('Application').controller('AppController', ['$scope', '$location'
placeholder: 'Add admin notes here...',
edit: function () {
$scope.info.notes.content = $scope.app.notes;
$scope.info.notes.content = $scope.app.notes || $scope.app.manifest.postInstallMessage;
$scope.info.notes.editing = true;
setTimeout(function () { document.getElementById('adminNotesTextarea').focus(); }, 1);
},
dismiss: function () {
$scope.info.notes.content = $scope.app.notes;
$scope.info.notes.content = $scope.app.notes || $scope.app.manifest.postInstallMessage;
$scope.info.notes.editing = false;
},
submit: function () {
$scope.info.notes.busySave = true;
// skip saving if unchanged from postInstall
if ($scope.info.notes.content === $scope.app.manifest.postInstallMessage) {
$scope.info.notes.busySave = false;
$scope.info.notes.editing = false;
return;
}
Client.configureApp($scope.app.id, 'notes', { notes: $scope.info.notes.content }, function (error) {
if (error) return console.error('Failed to save notes.', error);
refreshApp($scope.app.id, function (error) {
if (error) return Client.error(error);
$scope.info.notes.content = $scope.app.notes || $scope.app.manifest.postInstallMessage;
$scope.info.notes.busySave = false;
$scope.info.notes.editing = false;
});
@@ -177,7 +185,7 @@ angular.module('Application').controller('AppController', ['$scope', '$location'
show: function () {
$scope.info.hasOldChecklist = !!Object.keys($scope.app.checklist).find((k) => { return $scope.app.checklist[k].acknowledged; });
$scope.info.notes.content = $scope.app.notes;
$scope.info.notes.content = $scope.app.notes || $scope.app.manifest.postInstallMessage;
$scope.info.notes.editing = false;
$scope.info.notes.busy = false;
},