-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
591a773
commit 51dd51c
Showing
7 changed files
with
150 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
"""Report on who ingested AIPs and when and an indication about how | ||
long they took. | ||
""" | ||
|
||
from flask import render_template, request | ||
import pandas as pd | ||
import plotly.express as px | ||
|
||
|
||
from AIPscan.Data import data | ||
from AIPscan.Reporter import reporter | ||
|
||
|
||
@reporter.route("/ingest_log/", methods=["GET"]) | ||
def ingest_log(): | ||
"""Return the information needed to present an ingest gantt chart. | ||
""" | ||
storage_service_id = request.args.get("amss_id") | ||
ingests = data.agent_event_report(storage_service_id) | ||
pd_list = [] | ||
for ingest in ingests: | ||
try: | ||
pd_list.append( | ||
dict( | ||
User=ingest["user"], | ||
Start=ingest["ingest_date"], | ||
Finish=ingest["finish_date"], | ||
) | ||
) | ||
except KeyError: | ||
pass | ||
df = pd.DataFrame(pd_list) | ||
fig = px.timeline(df, x_start="Start", x_end="Finish", y="User") | ||
fig.update_yaxes(autorange="reversed") | ||
|
||
return render_template( | ||
"report_ingest_log.html", | ||
storage_service_name="Demo", | ||
number_of_transfers="12", | ||
plot=fig.to_html(full_html=False), | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<title>{{ storage_service_name }}: Ingest log</title> | ||
<link rel="shortcut icon" href="{{ url_for('static', filename='favicon.ico') }}"> | ||
<link rel="stylesheet" type="text/css" href="{{ url_for('static', filename='css/bootstrap.min.css') }}"> | ||
<link rel="stylesheet" type="text/css" href="{{ url_for('static', filename='css/custom.css') }}"> | ||
<script type="text/javascript" language="javascript" src="{{ url_for('static', filename='js/plotly-latest.min.js') }}"></script> | ||
|
||
</head> | ||
<body> | ||
|
||
<div class="container-fluid" style="margin: 20px 0;"> | ||
|
||
<div class="alert alert-secondary"> | ||
<a class="noprint" onClick="window.print();return false"><button type="button" class="btn btn-info" style="float:right;">Print</button></a> | ||
<strong>{{ storage_service_name }}: Ingest log</strong><br /> | ||
{{ number_of_transfers }} transfers total<br /> | ||
</div> | ||
|
||
<!-- Add plotly.express here --> | ||
|
||
{{ plot|safe }} | ||
|
||
</div> | ||
|
||
</div> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters