mirror of
https://github.com/ail-project/ail-framework.git
synced 2024-11-27 00:07:16 +00:00
Added support of pasteName in search + added header in search.html + supressed mixed indent and trailing in Flask.py
This commit is contained in:
parent
c10f28d9df
commit
24072ece36
2 changed files with 44 additions and 35 deletions
|
@ -237,7 +237,7 @@ def progressionCharts():
|
||||||
num_day = int(request.args.get('days'))
|
num_day = int(request.args.get('days'))
|
||||||
bar_values = []
|
bar_values = []
|
||||||
|
|
||||||
date_range = get_date_range(num_day)
|
date_range = get_date_range(num_day)
|
||||||
# Retreive all data from the last num_day
|
# Retreive all data from the last num_day
|
||||||
for date in date_range:
|
for date in date_range:
|
||||||
curr_value = r_serv_charts.hget(attribute_name, date)
|
curr_value = r_serv_charts.hget(attribute_name, date)
|
||||||
|
@ -270,7 +270,7 @@ def modulesCharts():
|
||||||
num_day = int(request.args.get('days'))
|
num_day = int(request.args.get('days'))
|
||||||
bar_values = []
|
bar_values = []
|
||||||
|
|
||||||
date_range = get_date_range(num_day)
|
date_range = get_date_range(num_day)
|
||||||
# Retreive all data from the last num_day
|
# Retreive all data from the last num_day
|
||||||
for date in date_range:
|
for date in date_range:
|
||||||
curr_value = r_serv_charts.hget(date, module_name+'-'+keyword_name)
|
curr_value = r_serv_charts.hget(date, module_name+'-'+keyword_name)
|
||||||
|
@ -295,7 +295,7 @@ def providersChart():
|
||||||
num_day = int(request.args.get('days'))
|
num_day = int(request.args.get('days'))
|
||||||
bar_values = []
|
bar_values = []
|
||||||
|
|
||||||
date_range = get_date_range(num_day)
|
date_range = get_date_range(num_day)
|
||||||
# Retreive all data from the last num_day
|
# Retreive all data from the last num_day
|
||||||
for date in date_range:
|
for date in date_range:
|
||||||
curr_value_size = r_serv_charts.hget(keyword_name+'_'+'size', date)
|
curr_value_size = r_serv_charts.hget(keyword_name+'_'+'size', date)
|
||||||
|
@ -351,7 +351,21 @@ def search():
|
||||||
c = [] #preview of the paste content
|
c = [] #preview of the paste content
|
||||||
paste_date = []
|
paste_date = []
|
||||||
paste_size = []
|
paste_size = []
|
||||||
# Search
|
# Search filename
|
||||||
|
from os import walk
|
||||||
|
for (dirpath, dirnames, filenames) in walk(os.path.join(os.environ['AIL_HOME'], 'PASTES/')):
|
||||||
|
if q[0] in filenames:
|
||||||
|
r.append(dirpath+'/'+q[0])
|
||||||
|
paste = Paste.Paste(dirpath+'/'+q[0])
|
||||||
|
content = paste.get_p_content().decode('utf8', 'ignore')
|
||||||
|
content_range = max_preview_char if len(content)>max_preview_char else len(content)-1
|
||||||
|
c.append(content[0:content_range])
|
||||||
|
curr_date = str(paste._get_p_date())
|
||||||
|
curr_date = curr_date[0:4]+'/'+curr_date[4:6]+'/'+curr_date[6:]
|
||||||
|
paste_date.append(curr_date)
|
||||||
|
paste_size.append(paste._get_p_size())
|
||||||
|
|
||||||
|
# Search full line
|
||||||
from whoosh import index
|
from whoosh import index
|
||||||
from whoosh.fields import Schema, TEXT, ID
|
from whoosh.fields import Schema, TEXT, ID
|
||||||
schema = Schema(title=TEXT(stored=True), path=ID(stored=True), content=TEXT)
|
schema = Schema(title=TEXT(stored=True), path=ID(stored=True), content=TEXT)
|
||||||
|
|
|
@ -42,12 +42,7 @@
|
||||||
|
|
||||||
<div id="wrapper">
|
<div id="wrapper">
|
||||||
<nav class="navbar navbar-default navbar-static-top" role="navigation" style="margin-bottom: 0">
|
<nav class="navbar navbar-default navbar-static-top" role="navigation" style="margin-bottom: 0">
|
||||||
<div class="navbar-header">
|
{% include 'header.html' %}
|
||||||
<ul class="nav navbar-nav">
|
|
||||||
<li class="active"><a href="{{ url_for('index') }}"><i class="fa fa-dashboard fa-fw"></i> Dashboard</a></li>
|
|
||||||
<li><a href="{{ url_for('trending') }}"><i class="glyphicon glyphicon-stats"></i> Trending charts</a></li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
<!-- /.navbar-top-links -->
|
<!-- /.navbar-top-links -->
|
||||||
<div class="navbar-default sidebar" role="navigation">
|
<div class="navbar-default sidebar" role="navigation">
|
||||||
<div class="sidebar-collapse">
|
<div class="sidebar-collapse">
|
||||||
|
|
Loading…
Reference in a new issue