diff --git a/grails-app/init/bie/index/BootStrap.groovy b/grails-app/init/bie/index/BootStrap.groovy
index da4282e..76cb3ec 100644
--- a/grails-app/init/bie/index/BootStrap.groovy
+++ b/grails-app/init/bie/index/BootStrap.groovy
@@ -25,7 +25,7 @@ class BootStrap {
threadPoolTaskScheduler.scheduleAtFixedRate(new Runnable() {
@Override
void run() {
- importService.importAll(importService.importWeeklySequence)
+ importService.importAll(importService.importWeeklySequence, false)
}
}, weeklyStart, 7*24*60*60*1000)
@@ -37,7 +37,7 @@ class BootStrap {
threadPoolTaskScheduler.scheduleAtFixedRate(new Runnable() {
@Override
void run() {
- importService.importAll(importService.importDailySequence)
+ importService.importAll(importService.importDailySequence, false)
}
}, dailyStart, 24*60*60*1000)
}
diff --git a/grails-app/views/admin/_status.gsp b/grails-app/views/admin/_status.gsp
new file mode 100644
index 0000000..565a372
--- /dev/null
+++ b/grails-app/views/admin/_status.gsp
@@ -0,0 +1,181 @@
+
+
+
+
+
+
+
+
+ ">
+
+
+
+
+
+ ">
+
+
+
+ ">
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ var socket = null;
+ var client = null;
+ var jobID = null;
+
+ function toggleStatus() {
+ $('#job-status').toggleClass('hide');
+ showJob();
+ }
+
+ function showJob() {
+ if (jobID == null) {
+ $('#job-status-report').html('');
+ return;
+ }
+ var url = '/' + jobID + '/panel.html';
+ $.get(url, function(data) {
+ $('#job-status-report').html(data)
+ })
+ }
+
+ function cancelJob() {
+ if (jobID == null) {
+ return;
+ }
+ var url = '/' + jobID + '/cancel.json';
+ $.get(url, function(data) {
+ showJob();
+ })
+ }
+
+ function reconnectLog() {
+ $('#progress1').addClass('hide');
+ $('#progress2').addClass('hide');
+ $('.import-info').removeClass('hide');
+ $("#import-info-log").append('...');
+ connectLog();
+ }
+
+ function connectLog() {
+ if (client != null) {
+ client.disconnect();
+ client = null;
+ }
+ if (socket != null) {
+ socket.close()
+ socket = null
+ }
+ socket = new SockJS("${createLink(uri: '/stomp')}");
+ client = Stomp.over(socket);
+ client.connect({}, function() {
+
+ client.subscribe("/topic/import-feedback", function(message) {
+ var msg = $.trim(message.body);
+ $("#import-info-log").append('' + msg+ '');
+ });
+ client.subscribe("/topic/import-progress", function(message) {
+ var msg = $.trim(message.body);
+ if ($.isNumeric(msg)) {
+ // update progress bar
+ $('#progress1 div.progress-bar').css('width', msg + '%').attr('aria-valuenow', msg);
+ $('#progress1 div.progress-bar span.percent').html(msg);
+ $('#progress1').removeClass('hide');
+ }
+ });
+ client.subscribe("/topic/import-progress2", function(message) {
+ var msg = $.trim(message.body);
+ if ($.isNumeric(msg)) {
+ // update progress bar
+ $('#progress2 div.progress-bar').css('width', msg + '%').attr('aria-valuenow', msg);
+ $('#progress2 div.progress-bar span.percent').html(msg);
+ $('#progress2').removeClass('hide');
+ }
+ });
+
+
+ client.subscribe("/topic/import-control", function(message) {
+ var status = $("#import-info-status");
+ status.removeClass('alert-info alert-success alert-warning alert-danger')
+ if (message.body == 'STARTED') {
+ status.addClass('alert-info');
+ $('#import-info-message').html('')
+ } else if (message.body == 'FINISHED') {
+ status.addClass('alert-success');
+ $('#import-info-message').html('')
+ $('.import-button').prop('disabled', false);
+ } else if (message.body == 'ERROR') {
+ $('#import-info-message').html('')
+ status.addClass('alert-danger');
+ $('.import-button').prop('disabled', false);
+ }
+ });
+
+ });
+ }
+
+ function loadInfo(link){
+ jobID = null
+ $("#import-info-log").empty();
+ $("#import-info-status").removeClass('alert-info alert-success alert-warning alert-danger');
+ $("#import-info-status").addClass('alert-warning');
+ $('#import-info-message').html('');
+ $('#progress1').addClass('hide');
+ $('#progress2').addClass('hide');
+ $('.import-button').prop('disabled', true);
+ $('.import-info').removeClass('hide');
+ $.get(link, function( data ) {
+ jobID = data.id
+ $('#job-status').addClass('hide');
+ if(!data.success) {
+ $('#import-info-message').html(data.message);
+ $('.import-button').prop('disabled', false);
+ }
+ showJob();
+ });
+ }
+
+ $(function() {
+ connectLog();
+ });
+
diff --git a/grails-app/views/admin/index.gsp b/grails-app/views/admin/index.gsp
index 637cdb7..ac9caeb 100644
--- a/grails-app/views/admin/index.gsp
+++ b/grails-app/views/admin/index.gsp
@@ -49,7 +49,7 @@
-
+