dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #21597
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 10255: Improved user feedback during metadata and data value import
------------------------------------------------------------
revno: 10255
committer: Lars Helge Øverland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2013-03-15 16:34:40 +0100
message:
Improved user feedback during metadata and data value import
removed:
dhis-2/dhis-web/dhis-web-importexport/src/main/java/org/hisp/dhis/importexport/action/dxf2/MetaDataImportFormAction.java
modified:
dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/commons.js
dhis-2/dhis-web/dhis-web-importexport/src/main/java/org/hisp/dhis/importexport/action/datavalue/ImportDataValueAction.java
dhis-2/dhis-web/dhis-web-importexport/src/main/java/org/hisp/dhis/importexport/action/dxf2/MetaDataImportAction.java
dhis-2/dhis-web/dhis-web-importexport/src/main/resources/META-INF/dhis/beans.xml
dhis-2/dhis-web/dhis-web-importexport/src/main/resources/struts.xml
dhis-2/dhis-web/dhis-web-importexport/src/main/webapp/dhis-web-importexport/dxf2MetaDataImport.vm
dhis-2/dhis-web/dhis-web-importexport/src/main/webapp/dhis-web-importexport/importDataValue.vm
dhis-2/dhis-web/dhis-web-importexport/src/main/webapp/dhis-web-importexport/javascript/importDataValue.js
dhis-2/dhis-web/dhis-web-importexport/src/main/webapp/dhis-web-importexport/javascript/importMetaData.js
dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/datamart/action/StartExportAction.java
--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk
Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/commons.js'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/commons.js 2013-03-15 13:49:43 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/commons.js 2013-03-15 15:34:40 +0000
@@ -1780,36 +1780,39 @@
$.getJSON( '../dhis-web-commons-ajax-json/getNotifications.action?category=' + category + param, function( notifications )
{
- var html = '';
- var isComplete = false;
+ var html = '',
+ isComplete = false;
- $.each( notifications, function( i, notification )
+ if ( isDefined( notifications ) && notifications.length )
{
- var first = i == 0;
- var loaderHtml = '';
-
- if ( notification.completed == "true" )
- {
- isComplete = true;
+ $.each( notifications, function( i, notification )
+ {
+ var first = i == 0,
+ loaderHtml = '';
+
+ if ( notification.completed == "true" )
+ {
+ isComplete = true;
+ }
+
+ if ( first )
+ {
+ $( '#' + tableId ).prop( 'lastUid', notification.uid );
+ loaderHtml = _loading_bar_html;
+ $( '#loaderSpan' ).replaceWith ( '' ); // Hide previous loader bar
+ }
+
+ html += '<tr><td>' + notification.time + '</td><td>' + notification.message + ' ';
+ html += notification.completed == 'true' ? '<img src="../images/completed.png">' : loaderHtml;
+ html += '</td></tr>';
+ } );
+
+ $( '#' + tableId ).show().prepend( html );
+
+ if ( isComplete && completedCallback && completedCallback.call )
+ {
+ completedCallback();
}
-
- if ( first )
- {
- $( '#' + tableId ).prop( 'lastUid', notification.uid );
- loaderHtml = _loading_bar_html;
- $( '#loaderSpan' ).replaceWith ( '' ); // Hide previous loader bar
- }
-
- html += '<tr><td>' + notification.time + '</td><td>' + notification.message + ' ';
- html += notification.completed == "true" ? '<img src="../images/completed.png">' : loaderHtml;
- html += '</td></tr>';
- } );
-
- $( '#' + tableId ).prepend( html );
-
- if ( isComplete && completedCallback && completedCallback.call )
- {
- completedCallback();
}
} );
}
=== modified file 'dhis-2/dhis-web/dhis-web-importexport/src/main/java/org/hisp/dhis/importexport/action/datavalue/ImportDataValueAction.java'
--- dhis-2/dhis-web/dhis-web-importexport/src/main/java/org/hisp/dhis/importexport/action/datavalue/ImportDataValueAction.java 2012-07-04 20:16:23 +0000
+++ dhis-2/dhis-web/dhis-web-importexport/src/main/java/org/hisp/dhis/importexport/action/datavalue/ImportDataValueAction.java 2013-03-15 15:34:40 +0000
@@ -45,6 +45,7 @@
import org.hisp.dhis.importexport.action.util.ImportDataValueTask;
import org.hisp.dhis.scheduling.TaskCategory;
import org.hisp.dhis.scheduling.TaskId;
+import org.hisp.dhis.system.notification.Notifier;
import org.hisp.dhis.system.scheduling.Scheduler;
import org.hisp.dhis.system.util.StreamUtils;
import org.hisp.dhis.user.CurrentUserService;
@@ -69,6 +70,9 @@
@Autowired
private Scheduler scheduler;
+ @Autowired
+ private Notifier notifier;
+
// -------------------------------------------------------------------------
// Input
// -------------------------------------------------------------------------
@@ -137,6 +141,10 @@
strategy = strategy != null ? strategy : ImportStrategy.NEW_AND_UPDATES;
dataElementIdScheme = dataElementIdScheme != null ? dataElementIdScheme : IdentifiableProperty.UID;
orgUnitIdScheme = orgUnitIdScheme != null ? orgUnitIdScheme : IdentifiableProperty.UID;
+
+ TaskId taskId = new TaskId( TaskCategory.DATAVALUE_IMPORT, currentUserService.getCurrentUser() );
+
+ notifier.clear( taskId, TaskCategory.DATAVALUE_IMPORT );
InputStream in = new FileInputStream( upload );
@@ -144,8 +152,6 @@
Reader reader = FORMAT_CSV.equals( importFormat ) ? new BufferedReader( new InputStreamReader( in ) ) : null;
- TaskId taskId = new TaskId( TaskCategory.DATAVALUE_IMPORT, currentUserService.getCurrentUser() );
-
ImportOptions options = new ImportOptions( dataElementIdScheme, orgUnitIdScheme, dryRun, strategy, skipExistingCheck );
log.info( options );
=== modified file 'dhis-2/dhis-web/dhis-web-importexport/src/main/java/org/hisp/dhis/importexport/action/dxf2/MetaDataImportAction.java'
--- dhis-2/dhis-web/dhis-web-importexport/src/main/java/org/hisp/dhis/importexport/action/dxf2/MetaDataImportAction.java 2013-03-14 18:14:45 +0000
+++ dhis-2/dhis-web/dhis-web-importexport/src/main/java/org/hisp/dhis/importexport/action/dxf2/MetaDataImportAction.java 2013-03-15 15:34:40 +0000
@@ -37,6 +37,7 @@
import org.hisp.dhis.importexport.action.util.ImportMetaDataTask;
import org.hisp.dhis.scheduling.TaskCategory;
import org.hisp.dhis.scheduling.TaskId;
+import org.hisp.dhis.system.notification.Notifier;
import org.hisp.dhis.system.scheduling.Scheduler;
import org.hisp.dhis.system.util.StreamUtils;
import org.hisp.dhis.user.CurrentUserService;
@@ -62,6 +63,9 @@
@Autowired
private Scheduler scheduler;
+
+ @Autowired
+ private Notifier notifier;
// -------------------------------------------------------------------------
// Input
@@ -97,11 +101,13 @@
{
strategy = strategy != null ? strategy : ImportStrategy.NEW_AND_UPDATES;
+ TaskId taskId = new TaskId( TaskCategory.METADATA_IMPORT, currentUserService.getCurrentUser() );
+
+ notifier.clear( taskId, TaskCategory.METADATA_IMPORT );
+
InputStream in = new FileInputStream( upload );
in = StreamUtils.wrapAndCheckCompressionFormat( in );
- TaskId taskId = new TaskId( TaskCategory.METADATA_IMPORT, currentUserService.getCurrentUser() );
-
ImportOptions importOptions = new ImportOptions();
importOptions.setStrategy( strategy.toString() );
importOptions.setDryRun( dryRun );
=== removed file 'dhis-2/dhis-web/dhis-web-importexport/src/main/java/org/hisp/dhis/importexport/action/dxf2/MetaDataImportFormAction.java'
--- dhis-2/dhis-web/dhis-web-importexport/src/main/java/org/hisp/dhis/importexport/action/dxf2/MetaDataImportFormAction.java 2012-07-04 20:16:23 +0000
+++ dhis-2/dhis-web/dhis-web-importexport/src/main/java/org/hisp/dhis/importexport/action/dxf2/MetaDataImportFormAction.java 1970-01-01 00:00:00 +0000
@@ -1,54 +0,0 @@
-package org.hisp.dhis.importexport.action.dxf2;
-
-/*
- * Copyright (c) 2004-2012, University of Oslo
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- * * Neither the name of the HISP project nor the names of its contributors may
- * be used to endorse or promote products derived from this software without
- * specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
- * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-import com.opensymphony.xwork2.Action;
-
-/**
- * @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
- */
-public class MetaDataImportFormAction
- implements Action
-{
- private boolean running;
-
- public boolean isRunning()
- {
- return running;
- }
- public void setRunning( boolean running )
- {
- this.running = running;
- }
-
- @Override
- public String execute() throws Exception
- {
- return SUCCESS;
- }
-}
=== modified file 'dhis-2/dhis-web/dhis-web-importexport/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-web/dhis-web-importexport/src/main/resources/META-INF/dhis/beans.xml 2012-12-14 13:46:47 +0000
+++ dhis-2/dhis-web/dhis-web-importexport/src/main/resources/META-INF/dhis/beans.xml 2013-03-15 15:34:40 +0000
@@ -200,10 +200,11 @@
<!-- DXF2 MetaData import/export -->
- <bean id="org.hisp.dhis.importexport.action.dxf2.MetaDataImportFormAction"
- class="org.hisp.dhis.importexport.action.dxf2.MetaDataImportFormAction" scope="prototype" />
<bean id="org.hisp.dhis.importexport.action.dxf2.MetaDataExportFormAction"
- class="org.hisp.dhis.importexport.action.dxf2.MetaDataExportFormAction" scope="prototype" />
+ class="org.hisp.dhis.importexport.action.dxf2.MetaDataExportFormAction" />
+
+ <bean id="org.hisp.dhis.importexport.action.dxf2.MetaDataImportAction"
+ class="org.hisp.dhis.importexport.action.dxf2.MetaDataImportAction" />
<bean id="org.hisp.dhis.importexport.action.dxf2.GetImportSummaryAction"
class="org.hisp.dhis.importexport.action.dxf2.GetImportSummaryAction" scope="prototype">
=== modified file 'dhis-2/dhis-web/dhis-web-importexport/src/main/resources/struts.xml'
--- dhis-2/dhis-web/dhis-web-importexport/src/main/resources/struts.xml 2012-10-31 06:45:06 +0000
+++ dhis-2/dhis-web/dhis-web-importexport/src/main/resources/struts.xml 2013-03-15 15:34:40 +0000
@@ -25,7 +25,7 @@
</action>
<action name="importDataValue" class="org.hisp.dhis.importexport.action.datavalue.ImportDataValueAction">
- <result name="success" type="redirect">displayImportDataValueForm.action?running=true&importFormat=${importFormat}</result>
+ <result name="success" type="redirect">displayImportDataValueForm.action?importFormat=${importFormat}</result>
<interceptor-ref name="fileUploadStack" />
<param name="requiredAuthorities">F_IMPORT_DATA</param>
</action>
@@ -254,7 +254,7 @@
<!-- DXF2 MetaData import/export -->
- <action name="dxf2MetaDataImport" class="org.hisp.dhis.importexport.action.dxf2.MetaDataImportFormAction">
+ <action name="dxf2MetaDataImport" class="org.hisp.dhis.importexport.action.NoAction">
<result name="success" type="velocity">/main.vm</result>
<param name="menu">/dhis-web-importexport/mainMenu.vm</param>
<param name="page">/dhis-web-importexport/dxf2MetaDataImport.vm</param>
@@ -269,7 +269,7 @@
</action>
<action name="importMetaData" class="org.hisp.dhis.importexport.action.dxf2.MetaDataImportAction">
- <result name="success" type="redirect">dxf2MetaDataImport.action?running=true</result>
+ <result name="success" type="redirect">dxf2MetaDataImport.action</result>
<interceptor-ref name="fileUploadStack" />
</action>
=== modified file 'dhis-2/dhis-web/dhis-web-importexport/src/main/webapp/dhis-web-importexport/dxf2MetaDataImport.vm'
--- dhis-2/dhis-web/dhis-web-importexport/src/main/webapp/dhis-web-importexport/dxf2MetaDataImport.vm 2013-03-14 18:14:45 +0000
+++ dhis-2/dhis-web/dhis-web-importexport/src/main/webapp/dhis-web-importexport/dxf2MetaDataImport.vm 2013-03-15 15:34:40 +0000
@@ -33,22 +33,11 @@
</form>
</div>
-#if( $running )
-
<div id="notificationDiv">
-<table id="notificationTable" class="notificationTable" style="width:422px">
+<table id="notificationTable" class="notificationTable" style="display:none">
<col width="120">
<col width="380">
</table>
</div>
-<script type="text/javascript">
-$( document ).ready( function() {
- $( "#notificationTable" ).empty();
- pingNotificationsTimeout();
-} );
-</script>
-
-#end
-
<div id="importSummaryDiv" class="page formSection" style="display:none; width:400px; padding-bottom:20px;"></div>
\ No newline at end of file
=== modified file 'dhis-2/dhis-web/dhis-web-importexport/src/main/webapp/dhis-web-importexport/importDataValue.vm'
--- dhis-2/dhis-web/dhis-web-importexport/src/main/webapp/dhis-web-importexport/importDataValue.vm 2012-05-07 14:57:43 +0000
+++ dhis-2/dhis-web/dhis-web-importexport/src/main/webapp/dhis-web-importexport/importDataValue.vm 2013-03-15 15:34:40 +0000
@@ -60,22 +60,11 @@
</form>
</div>
-#if( $running )
-
<div id="notificationDiv">
-<table id="notificationTable" class="notificationTable" style="width:422px">
+<table id="notificationTable" class="notificationTable" style="display:none">
<col width="120">
<col width="380">
</table>
</div>
-<script type="text/javascript">
-$( document ).ready( function() {
- $( "#notificationTable" ).empty();
- pingNotificationsTimeout();
-} );
-</script>
-
-#end
-
-<div id="importSummaryDiv" class="page formSection" style="display:none; width:400px; padding-bottom:20px;"></div>
\ No newline at end of file
+<div id="importSummaryDiv" class="page formSection" style="display:none; width:400px; padding-bottom:20px;"></div>
=== modified file 'dhis-2/dhis-web/dhis-web-importexport/src/main/webapp/dhis-web-importexport/javascript/importDataValue.js'
--- dhis-2/dhis-web/dhis-web-importexport/src/main/webapp/dhis-web-importexport/javascript/importDataValue.js 2012-05-07 14:57:43 +0000
+++ dhis-2/dhis-web/dhis-web-importexport/src/main/webapp/dhis-web-importexport/javascript/importDataValue.js 2013-03-15 15:34:40 +0000
@@ -1,4 +1,8 @@
+$( document ).ready( function() {
+ pingNotificationsTimeout();
+} );
+
var pingTimeout = null;
function importDataValue()
@@ -8,25 +12,19 @@
setHeaderDelayMessage( "Please select a file to upload" );
return false;
}
-
+
+ $( "#notificationTable" ).empty();
$( "#importForm" ).submit();
}
-function toggleOptions()
-{
- $( ".moreOptions" ).toggle();
- $.toggleCss( "inputCriteria", "height", "144px", "230px" );
-}
-
function pingNotificationsTimeout()
{
pingNotifications( 'DATAVALUE_IMPORT', 'notificationTable', displaySummaryLink );
- pingTimeout = setTimeout( "pingNotificationsTimeout()", 1500 );
+ pingTimeout = setTimeout( "pingNotificationsTimeout()", 2500 );
}
function displaySummaryLink()
{
- window.clearTimeout( pingTimeout );
var html = '<tr><td></td><td><a href="javascript:displaySummary()">Display import summary</a></td></tr>';
$( '#notificationTable' ).prepend( html );
}
@@ -35,4 +33,10 @@
{
$( '#notificationDiv' ).hide();
$( '#importSummaryDiv' ).show( 'fast' ).load( 'getDataValueImportSummary.action' );
-}
\ No newline at end of file
+}
+
+function toggleOptions()
+{
+ $( ".moreOptions" ).toggle();
+ $.toggleCss( "inputCriteria", "height", "144px", "230px" );
+}
=== modified file 'dhis-2/dhis-web/dhis-web-importexport/src/main/webapp/dhis-web-importexport/javascript/importMetaData.js'
--- dhis-2/dhis-web/dhis-web-importexport/src/main/webapp/dhis-web-importexport/javascript/importMetaData.js 2013-03-15 13:13:18 +0000
+++ dhis-2/dhis-web/dhis-web-importexport/src/main/webapp/dhis-web-importexport/javascript/importMetaData.js 2013-03-15 15:34:40 +0000
@@ -1,4 +1,8 @@
+$( document ).ready( function() {
+ pingNotificationsTimeout();
+} );
+
var pingTimeout = null;
function importMetaData()
@@ -9,18 +13,18 @@
return false;
}
+ $( "#notificationTable" ).empty();
$( "#importForm" ).submit();
}
function pingNotificationsTimeout()
{
pingNotifications( 'METADATA_IMPORT', 'notificationTable', displaySummaryLink );
- pingTimeout = setTimeout( "pingNotificationsTimeout()", 2000 );
+ pingTimeout = setTimeout( "pingNotificationsTimeout()", 2500 );
}
function displaySummaryLink()
{
- window.clearTimeout( pingTimeout );
var html = '<tr><td></td><td><a href="javascript:displaySummary()">Display import summary</a></td></tr>';
$( '#notificationTable' ).prepend( html );
}
@@ -29,4 +33,4 @@
{
$( '#notificationDiv' ).hide();
$( '#importSummaryDiv' ).show( 'fast' ).load( 'getMetaDataImportSummary.action' );
-}
\ No newline at end of file
+}
=== modified file 'dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/datamart/action/StartExportAction.java'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/datamart/action/StartExportAction.java 2013-03-05 19:00:51 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/datamart/action/StartExportAction.java 2013-03-15 15:34:40 +0000
@@ -41,9 +41,11 @@
import org.hisp.dhis.scheduling.ScheduledTasks;
import org.hisp.dhis.scheduling.TaskCategory;
import org.hisp.dhis.scheduling.TaskId;
+import org.hisp.dhis.system.notification.Notifier;
import org.hisp.dhis.system.scheduling.Scheduler;
import org.hisp.dhis.system.util.DateUtils;
import org.hisp.dhis.user.CurrentUserService;
+import org.springframework.beans.factory.annotation.Autowired;
import com.opensymphony.xwork2.Action;
@@ -84,6 +86,9 @@
{
this.dataMartTask = dataMartTask;
}
+
+ @Autowired
+ private Notifier notifier;
// -------------------------------------------------------------------------
// Input
@@ -132,10 +137,12 @@
public String execute()
throws Exception
{
+ TaskId taskId = new TaskId( TaskCategory.DATAMART, currentUserService.getCurrentUser() );
+
+ notifier.clear( taskId, TaskCategory.DATAMART );
+
ScheduledTasks tasks = new ScheduledTasks();
- TaskId taskId = new TaskId( TaskCategory.DATAMART, currentUserService.getCurrentUser() );
-
// ---------------------------------------------------------------------
// Analytics
// ---------------------------------------------------------------------