diff --git a/src/main/webapp/appadmin/resendBulkImportID.jsp b/src/main/webapp/appadmin/resendBulkImportID.jsp index 4a372ebca0..cd4762b607 100644 --- a/src/main/webapp/appadmin/resendBulkImportID.jsp +++ b/src/main/webapp/appadmin/resendBulkImportID.jsp @@ -25,12 +25,17 @@ JSONObject res = new JSONObject(); //String queryEncounterId = null; String importIdTask = request.getParameter("importIdTask"); -List locationIDs = new ArrayList(); +List locationIDs = new ArrayList(); +String ownerFilter = ""; if(request.getParameterValues("locationID")!=null) { String[] vals=request.getParameterValues("locationID"); locationIDs = Arrays.asList(vals); } +if(request.getParameter("owner")!=null) { + ownerFilter=request.getParameter("owner"); +} + try { res.put("success","false"); @@ -55,6 +60,9 @@ try { //matchingSetFilter = { locationIds: locationIds } if(locationIDs!=null && locationIDs.size()>0)mf.put("locationIds",locationIDs); //mf.put("projectId", project.getId()); + if (!ownerFilter.isEmpty()) { + mf.put("owner", ownerFilter); + } taskParameters.put("matchingSetFilter", mf); diff --git a/src/main/webapp/import.jsp b/src/main/webapp/import.jsp index 0ea4e1c887..f5cfec2c2f 100644 --- a/src/main/webapp/import.jsp +++ b/src/main/webapp/import.jsp @@ -280,6 +280,62 @@ a.button:hover { background-color: #DDA; text-decoration: none; } + +.ia-match-filter-dialog .option-cols { + -webkit-column-count: 1; + -moz-column-count: 1; + column-count: 1; +} +.ia-match-filter-dialog .option-cols input { + vertical-align: top; +} +.ia-match-filter-dialog .option-cols .item { + padding: 1px 4px; + border-radius: 5px; +} +.ia-match-filter-dialog .option-cols .item:hover { + background-color: #AAA; +} +.ia-match-filter-dialog .option-cols .item label { + font-size: 0.9em; + width: 90%; + margin-left: 5px; + line-height: 1.0em; +} +.ia-match-filter-dialog .option-cols .item-checked label { + font-weight: bold; +} +.ia-match-filter-dialog ul { + list-style-type: none; +} +.ia-match-filter-dialog .item-count { + font-size: 0.8em; + color: #777; + margin-left: 9px; +} +.ia-match-filter-section { + margin-top: 10px; + border-top: solid 3px #999; +} +.ia-match-filter-title { + margin: 20px 0 5px 0; + padding: 1px 0 1px 20px; + background-color: #b491c8; + color: #555; + font-weight: bold; +} +.ia-match-filter-dialog { + display: none; + z-index: 3000; + position: fixed; + top: 10%; + width: 80%; + padding: 15px; + border: solid 5px #888; + background-color: #fff; +} + + @@ -302,6 +358,8 @@ String context = ServletUtilities.getContext(request); Shepherd myShepherd = new Shepherd(context); myShepherd.setAction("import.jsp"); myShepherd.beginDBTransaction(); +String langCode = ServletUtilities.getLanguageCode(request); +Properties encprops = ShepherdProperties.getOrgProperties("encounter.properties", langCode, context, request, myShepherd); //should the user see the detect and/or detect+ID buttons? boolean allowIA=false; @@ -437,7 +495,7 @@ try{ int numMatchAgainst=0; boolean foundChildren = false; int numMatchTasks=0; - + HashMap jarrs = new HashMap(); if (Util.collectionSize(itask.getEncounters()) > 0) { for (Encounter enc : itask.getEncounters()) { @@ -802,6 +860,11 @@ try{ }; for (let [encId, maIds] of js_jarrs) { data.bulkImport[encId] = maIds; } // convert js_jarrs map into js object if (!skipIdent && locationIds && (locationIds.indexOf('') < 0)) data.taskParameters.matchingSetFilter = { locationIds: locationIds }; + + if ($('#match-filter-owner-me').is(':checked')){ + if(!data.taskParameters.matchingSetFilter) data.taskParameters.matchingSetFilter = {}; + data.taskParameters.matchingSetFilter["owner"] = ["me"] + } console.log('sendToIA() SENDING: locationIds=%o data=%o', locationIds, data); $.ajax({ @@ -826,6 +889,7 @@ try{ $('#ia-send-div').hide().after('
sending... please wait
'); //var locationIds = $('#id-locationids').val(); var locationIds = ''; + var owner = ''; $("#id-locationids option:selected").each(function(){ locationIds+='&locationID='+this.value; }); @@ -833,9 +897,12 @@ try{ //if (locationIds && (locationIds.indexOf('') < 0)) data.taskParameters.matchingSetFilter = { locationIds: locationIds }; console.log('resendToID() SENDING: locationIds=%o', locationIds); + if ($('#match-filter-owner-me').is(':checked')){ + owner = "&owner=" + encodeURIComponent(JSON.stringify(["me"])); + } $.ajax({ - url: wildbookGlobals.baseUrl + '/appadmin/resendBulkImportID.jsp?importIdTask=<%=taskId%>'+locationIds, + url: wildbookGlobals.baseUrl + '/appadmin/resendBulkImportID.jsp?importIdTask=<%=taskId%>'+locationIds + owner, dataType: 'json', type: 'GET', contentType: 'application/javascript', @@ -850,6 +917,20 @@ try{ }); } + + function shouldselectAllOptions(shouldselect){ + $("#id-locationids option").each(function(index,option){ + if(option.value){ + option.selected = shouldselect; + } + + }); + } + + function showModal(){ + + $('.ia-match-filter-dialog').show() + }

@@ -875,7 +956,7 @@ try{ %> - + <% @@ -889,9 +970,8 @@ try{ if (allowReID) { %> -
- Send to identification matching against location(s): - <%=LocationID.getHTMLSelector(true, locationIds, null, "id-locationids", "locationID", "") %> + <% @@ -910,6 +990,112 @@ try{
+
+

<%=encprops.getProperty("matchFilterHeader")%>

+ <% + + String queueStatementID2=""; + int wbiaIDQueueSize2 = WbiaQueueUtil.getSizeDetectionJobQueue(false); + if(wbiaIDQueueSize2==0){ + queueStatementID2 = "The machine learning queue is empty and ready for work."; + } + else if(Prometheus.getValue("wildbook_wbia_turnaroundtime_detection")!=null){ + String val=Prometheus.getValue("wildbook_wbia_turnaroundtime_detection"); + try{ + Double d = Double.parseDouble(val); + d=d/60.0; + queueStatementID2 = "There are currently "+wbiaIDQueueSize2+" ID jobs in the small batch queue. Time to completion is averaging "+(int)Math.round(d)+" minutes based on recent matches. Your time may be faster or slower."; + } + catch(Exception de){de.printStackTrace();} + } + if(!queueStatementID2.equals("")){ + %> +

<%=queueStatementID2 %>

+ <% + } + %> +
+ <%=encprops.getProperty("locationID")%>   +
+
+
+
+ +
+ " + onClick="shouldselectAllOptions(true)" /> + " + onClick="shouldselectAllOptions(false)" /> +
+
+ + <%=LocationID.getHTMLSelector(true, locationIds, null, "id-locationids", "locationID", "") %> + + +
+ +
+ + + + + +
+ + +
<%=encprops.getProperty("matchFilterOwnership")%>
+
+ + +
+ +
+ <% if(allowIA) {%> + " onClick="sendToIA(false)" /> + <%} + if (allowReID){ + %> + " onClick="resendToID()" /> + + <% }%> + " + onClick="$('.ia-match-filter-dialog').hide()" /> +
+ + + +
+ + + + <% } %> @@ -932,6 +1118,7 @@ finally{ } %> +