Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
adapt
ace
Commits
7dc5822e
Commit
7dc5822e
authored
Apr 28, 2017
by
Michael Ritter
Browse files
Link to the most recent session's event log
parent
472f9d70
Changes
2
Hide whitespace changes
Inline
Side-by-side
ace-am/src/main/java/edu/umiacs/ace/monitor/access/CollectionSummaryServlet.java
View file @
7dc5822e
...
@@ -30,19 +30,20 @@
...
@@ -30,19 +30,20 @@
// $Id$
// $Id$
package
edu.umiacs.ace.monitor.access
;
package
edu.umiacs.ace.monitor.access
;
import
edu.umiacs.ace.monitor.core.Collection
;
import
edu.umiacs.ace.monitor.core.MonitoredItem
;
import
edu.umiacs.ace.monitor.core.MonitoredItem
;
import
edu.umiacs.ace.util.EntityManagerServlet
;
import
edu.umiacs.ace.util.EntityManagerServlet
;
import
edu.umiacs.ace.monitor.core.Collection
;
import
org.apache.log4j.Logger
;
import
java.io.IOException
;
import
java.io.Writer
;
import
java.util.List
;
import
javax.persistence.EntityManager
;
import
javax.persistence.EntityManager
;
import
javax.persistence.Query
;
import
javax.persistence.Query
;
import
javax.servlet.RequestDispatcher
;
import
javax.servlet.RequestDispatcher
;
import
javax.servlet.ServletException
;
import
javax.servlet.ServletException
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
javax.servlet.http.HttpServletResponse
;
import
org.apache.log4j.Logger
;
import
java.io.IOException
;
import
java.io.Writer
;
import
java.util.List
;
/**
/**
* Show the current status of a collection, listing any non-active files
* Show the current status of a collection, listing any non-active files
...
@@ -60,6 +61,7 @@ public class CollectionSummaryServlet extends EntityManagerServlet {
...
@@ -60,6 +61,7 @@ public class CollectionSummaryServlet extends EntityManagerServlet {
public
static
final
String
PAGE_COLLECTION
=
"collection"
;
public
static
final
String
PAGE_COLLECTION
=
"collection"
;
public
static
final
String
PAGE_ITEMS
=
"items"
;
public
static
final
String
PAGE_ITEMS
=
"items"
;
public
static
final
String
PAGE_COUNT
=
"count"
;
public
static
final
String
PAGE_COUNT
=
"count"
;
public
static
final
String
PAGE_SESSION
=
"session"
;
/**
/**
* Processes requests for both HTTP <code>GET</code> and <code>POST</code> methods.
* Processes requests for both HTTP <code>GET</code> and <code>POST</code> methods.
...
@@ -122,6 +124,9 @@ public class CollectionSummaryServlet extends EntityManagerServlet {
...
@@ -122,6 +124,9 @@ public class CollectionSummaryServlet extends EntityManagerServlet {
return
;
return
;
}
}
// get latest session
Long
session
=
getRecentSession
(
c
,
em
);
CollectionSummaryBean
csb
=
new
CollectionSummaryBean
();
CollectionSummaryBean
csb
=
new
CollectionSummaryBean
();
csb
.
setCollection
(
c
);
csb
.
setCollection
(
c
);
csb
.
setTotalFiles
(
CollectionCountContext
.
getFileCount
(
c
));
csb
.
setTotalFiles
(
CollectionCountContext
.
getFileCount
(
c
));
...
@@ -135,6 +140,7 @@ public class CollectionSummaryServlet extends EntityManagerServlet {
...
@@ -135,6 +140,7 @@ public class CollectionSummaryServlet extends EntityManagerServlet {
csb
.
setRemoteMissing
(
CollectionCountContext
.
getRemoteMissing
(
c
));
csb
.
setRemoteMissing
(
CollectionCountContext
.
getRemoteMissing
(
c
));
csb
.
setRemoteCorrupt
(
CollectionCountContext
.
getRemoteCorrupt
(
c
));
csb
.
setRemoteCorrupt
(
CollectionCountContext
.
getRemoteCorrupt
(
c
));
request
.
setAttribute
(
PAGE_SESSION
,
session
);
request
.
setAttribute
(
PAGE_ITEMS
,
miList
);
request
.
setAttribute
(
PAGE_ITEMS
,
miList
);
request
.
setAttribute
(
PAGE_COLLECTION
,
csb
);
request
.
setAttribute
(
PAGE_COLLECTION
,
csb
);
request
.
setAttribute
(
PAGE_COUNT
,
count
);
request
.
setAttribute
(
PAGE_COUNT
,
count
);
...
@@ -148,4 +154,12 @@ public class CollectionSummaryServlet extends EntityManagerServlet {
...
@@ -148,4 +154,12 @@ public class CollectionSummaryServlet extends EntityManagerServlet {
dispatch
.
forward
(
request
,
response
);
dispatch
.
forward
(
request
,
response
);
}
}
private
Long
getRecentSession
(
Collection
c
,
EntityManager
em
)
{
String
query
=
"SELECT e.session FROM LogEvent e WHERE e.collection = :c ORDER BY e.id DESC"
;
Query
q
=
em
.
createQuery
(
query
);
q
.
setParameter
(
"c"
,
c
);
q
.
setMaxResults
(
1
);
return
(
Long
)
q
.
getSingleResult
();
}
}
}
ace-am/src/main/webapp/report.jsp
View file @
7dc5822e
...
@@ -94,6 +94,7 @@ on Libraries node in Projects view can be used to add the JSTL 1.1 library.
...
@@ -94,6 +94,7 @@ on Libraries node in Projects view can be used to add the JSTL 1.1 library.
<tr>
<tr>
<td
class=
"tblLinks"
><a
href=
"Report?collectionid=${collection.collection.id}&text=1&count=-1"
>
Download List
</a></td>
<td
class=
"tblLinks"
><a
href=
"Report?collectionid=${collection.collection.id}&text=1&count=-1"
>
Download List
</a></td>
<td
class=
"tblLinks"
><a
href=
"StartSync?collectionid=${collection.collection.id}&type=corrupt"
>
Audit Corrupt Files
</a></td>
<td
class=
"tblLinks"
><a
href=
"StartSync?collectionid=${collection.collection.id}&type=corrupt"
>
Audit Corrupt Files
</a></td>
<td
class=
"tblLinks"
><a
href=
"EventLog?sessionId=${session}"
>
Recent Events
</a></td>
</tr>
</tr>
</table>
</table>
...
@@ -203,19 +204,7 @@ on Libraries node in Projects view can be used to add the JSTL 1.1 library.
...
@@ -203,19 +204,7 @@ on Libraries node in Projects view can be used to add the JSTL 1.1 library.
<script
type=
"text/javascript"
>
<script
type=
"text/javascript"
>
$
(
"
#selectall
"
).
click
(
function
()
{
$
(
"
#selectall
"
).
click
(
function
()
{
$
(
"
input[name=removal]
"
).
prop
(
'
checked
'
,
$
(
this
).
prop
(
"
checked
"
));
$
(
"
input[name=removal]
"
).
prop
(
'
checked
'
,
$
(
this
).
prop
(
"
checked
"
));
/*
if ($("#selectall").is(":checked")) {
$("#removal").toggle(this.checked);
} else {
$("#removal").checked;
}
if($("#selectall").attr("checked")=="checked")
$('input[name="removal"]').attr('checked', 'checked');
else
$('input[name="removal"]').removeAttr('checked');
*/
});
});
</script>
</script>
</body>
</body>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment