diff --git a/dashboard-ui/autoorganizelog.html b/dashboard-ui/autoorganizelog.html
index 7f5df1d991..98fb245924 100644
--- a/dashboard-ui/autoorganizelog.html
+++ b/dashboard-ui/autoorganizelog.html
@@ -19,8 +19,8 @@
-
-
+
diff --git a/dashboard-ui/scripts/autoorganizelog.js b/dashboard-ui/scripts/autoorganizelog.js
index 5430a1ceca..62b739988a 100644
--- a/dashboard-ui/scripts/autoorganizelog.js
+++ b/dashboard-ui/scripts/autoorganizelog.js
@@ -333,11 +333,14 @@
$('.btnOrganize', page).taskButton({
mode: 'on',
progressElem: $('.organizeProgress', page),
+ panel: $('.organizeTaskPanel', page),
taskKey: 'AutoOrganize'
});
}).on('pagehide', "#libraryFileOrganizerLogPage", function () {
+ var page = this;
+
currentResult = null;
// off here
diff --git a/dashboard-ui/scripts/medialibrarypage.js b/dashboard-ui/scripts/medialibrarypage.js
index 576c523527..a04de08157 100644
--- a/dashboard-ui/scripts/medialibrarypage.js
+++ b/dashboard-ui/scripts/medialibrarypage.js
@@ -394,104 +394,4 @@ var WizardLibraryPage = {
});
-})(jQuery, document, window);
-
-$.fn.taskButton = function (options) {
-
- function pollTasks(button) {
-
- ApiClient.getScheduledTasks().done(function (tasks) {
-
- updateTasks(button, tasks);
- });
-
- }
-
- function updateTasks(button, tasks) {
-
- var task = tasks.filter(function (t) {
-
- return t.Key == options.taskKey;
-
- })[0];
-
- button.buttonEnabled(task.State == 'Idle').attr('data-taskid', task.Id);
-
- var progress = (task.CurrentProgressPercentage || 0).toFixed(1);
-
- if (options.progressElem) {
- var progressElem = options.progressElem.val(progress);
-
- if (task.State == 'Running') {
- progressElem.show();
- } else {
- progressElem.hide();
- }
- }
-
- if (options.lastResultElem) {
- var lastResult = task.LastExecutionResult ? task.LastExecutionResult.Status : '';
-
- if (lastResult == "Failed") {
- options.lastResultElem.html('
' + Globalize.translate('LabelFailed') + '');
- }
- else if (lastResult == "Cancelled") {
- options.lastResultElem.html('
' + Globalize.translate('LabelCancelled') + '');
- }
- else if (lastResult == "Aborted") {
- options.lastResultElem.html('
' + Globalize.translate('LabelAbortedByServerShutdown') + '');
- } else {
- options.lastResultElem.html(lastResult);
- }
- }
- }
-
- var self = this;
-
- if (options.mode == 'off') {
-
- if (ApiClient.isWebSocketOpen()) {
- ApiClient.sendWebSocketMessage("ScheduledTasksInfoStop");
- }
-
- $(ApiClient).off(".taskbutton");
-
- } else {
-
- this.on('click', function () {
-
- var button = this;
- var id = button.getAttribute('data-taskid');
-
- ApiClient.startScheduledTask(id).done(function () {
-
- pollTasks(self);
- });
-
- });
-
- pollTasks(self);
-
- if (ApiClient.isWebSocketOpen()) {
- ApiClient.sendWebSocketMessage("ScheduledTasksInfoStart", "1000,1000");
- }
-
- $(ApiClient).on("websocketmessage.taskbutton", function (e, msg) {
-
- if (msg.MessageType == "ScheduledTasksInfo") {
-
- var tasks = msg.Data;
-
- updateTasks(self, tasks);
- }
-
- }).on('websocketopen.taskbutton', function () {
-
- if (ApiClient.isWebSocketOpen()) {
- ApiClient.sendWebSocketMessage("ScheduledTasksInfoStart", "1000,1000");
- }
- });
- }
-
- return this;
-};
\ No newline at end of file
+})(jQuery, document, window);
\ No newline at end of file
diff --git a/dashboard-ui/scripts/taskbutton.js b/dashboard-ui/scripts/taskbutton.js
new file mode 100644
index 0000000000..4e577abaa4
--- /dev/null
+++ b/dashboard-ui/scripts/taskbutton.js
@@ -0,0 +1,120 @@
+
+$.fn.taskButton = function (options) {
+
+ function pollTasks(button) {
+
+ ApiClient.getScheduledTasks({
+
+ IsEnabled: true
+
+ }).done(function (tasks) {
+
+ updateTasks(button, tasks);
+ });
+
+ }
+
+ function updateTasks(button, tasks) {
+
+ var task = tasks.filter(function (t) {
+
+ return t.Key == options.taskKey;
+
+ })[0];
+
+ if (options.panel) {
+ if (task) {
+ $(options.panel).show();
+ } else {
+ $(options.panel).hide();
+ }
+ }
+
+ if (!task) {
+ return;
+ }
+
+ button.buttonEnabled(task.State == 'Idle').attr('data-taskid', task.Id);
+
+ var progress = (task.CurrentProgressPercentage || 0).toFixed(1);
+
+ if (options.progressElem) {
+ var progressElem = options.progressElem.val(progress);
+
+ if (task.State == 'Running') {
+ progressElem.show();
+ } else {
+ progressElem.hide();
+ }
+ }
+
+ if (options.lastResultElem) {
+ var lastResult = task.LastExecutionResult ? task.LastExecutionResult.Status : '';
+
+ if (lastResult == "Failed") {
+ options.lastResultElem.html('
' + Globalize.translate('LabelFailed') + '');
+ }
+ else if (lastResult == "Cancelled") {
+ options.lastResultElem.html('
' + Globalize.translate('LabelCancelled') + '');
+ }
+ else if (lastResult == "Aborted") {
+ options.lastResultElem.html('
' + Globalize.translate('LabelAbortedByServerShutdown') + '');
+ } else {
+ options.lastResultElem.html(lastResult);
+ }
+ }
+ }
+
+ var self = this;
+
+ if (options.panel) {
+ $(options.panel).hide();
+ }
+
+ if (options.mode == 'off') {
+
+ if (ApiClient.isWebSocketOpen()) {
+ ApiClient.sendWebSocketMessage("ScheduledTasksInfoStop");
+ }
+
+ $(ApiClient).off(".taskbutton");
+
+ } else {
+
+ this.on('click', function () {
+
+ var button = this;
+ var id = button.getAttribute('data-taskid');
+
+ ApiClient.startScheduledTask(id).done(function () {
+
+ pollTasks(self);
+ });
+
+ });
+
+ pollTasks(self);
+
+ if (ApiClient.isWebSocketOpen()) {
+ ApiClient.sendWebSocketMessage("ScheduledTasksInfoStart", "1000,1000");
+ }
+
+ $(ApiClient).on("websocketmessage.taskbutton", function (e, msg) {
+
+ if (msg.MessageType == "ScheduledTasksInfo") {
+
+ var tasks = msg.Data;
+
+ updateTasks(self, tasks);
+ }
+
+ }).on('websocketopen.taskbutton', function () {
+
+ if (ApiClient.isWebSocketOpen()) {
+ ApiClient.sendWebSocketMessage("ScheduledTasksInfoStart", "1000,1000");
+ }
+ });
+ }
+
+ return this;
+};
\ No newline at end of file
diff --git a/dashboard-ui/syncactivity.html b/dashboard-ui/syncactivity.html
index 021768ae0a..d2d7da7516 100644
--- a/dashboard-ui/syncactivity.html
+++ b/dashboard-ui/syncactivity.html
@@ -14,7 +14,7 @@
${TabSettings}
-