Skip to content
This repository has been archived by the owner on Jan 7, 2025. It is now read-only.

Commit

Permalink
Merge pull request #790 from jmancewicz/ng-models-page
Browse files Browse the repository at this point in the history
Home page - update UI and sort by network outputs
  • Loading branch information
lukeyeager committed Jun 2, 2016
2 parents 20f34ec + c91f774 commit dab8426
Show file tree
Hide file tree
Showing 20 changed files with 1,063 additions and 1,117 deletions.
5 changes: 0 additions & 5 deletions digits/model/images/classification/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -542,11 +542,6 @@ def test_index_json(self):
break
assert found, 'model not found in list'

def test_models_page(self):
rv = self.app.get('/models', follow_redirects=True)
assert rv.status_code == 200, 'page load failed with %s' % rv.status_code
assert 'Models' in rv.data, 'unexpected page format'

def test_model_json(self):
rv = self.app.get('/models/%s.json' % self.model_id)
assert rv.status_code == 200, 'page load failed with %s' % rv.status_code
Expand Down
5 changes: 0 additions & 5 deletions digits/model/images/generic/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -518,11 +518,6 @@ def test_index_json(self):
break
assert found, 'model not found in list'

def test_models_page(self):
rv = self.app.get('/models', follow_redirects=True)
assert rv.status_code == 200, 'page load failed with %s' % rv.status_code
assert 'Models' in rv.data, 'unexpected page format'

def test_model_json(self):
rv = self.app.get('/models/%s.json' % self.model_id)
assert rv.status_code == 200, 'page load failed with %s' % rv.status_code
Expand Down
55 changes: 0 additions & 55 deletions digits/model/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,61 +20,6 @@

blueprint = flask.Blueprint(__name__, __name__)

@blueprint.route('', methods=['GET'])
def index():
column_attrs = list(get_column_attrs())
raw_jobs = [j for j in scheduler.jobs.values() if isinstance(j, ModelJob)]

column_types = [
ColumnType('latest', False, lambda outs: outs[-1]),
ColumnType('max', True, lambda outs: max(outs)),
ColumnType('min', True, lambda outs: min(outs))
]

jobs = []
for rjob in raw_jobs:
train_outs = rjob.train_task().train_outputs
val_outs = rjob.train_task().val_outputs
history = rjob.status_history

# update column attribute set
keys = set(train_outs.keys() + val_outs.keys())

# build job dict
job_info = JobBasicInfo(
rjob.name(),
rjob.id(),
rjob.status,
time_filters.print_time_diff_nosuffixes(history[-1][1] - history[0][1]),
rjob.train_task().framework_id
)

# build a dictionary of each attribute of a job. If an attribute is
# present, add all different column types.
job_attrs = {}
for cattr in column_attrs:
if cattr in train_outs:
out_list = train_outs[cattr].data
elif cattr in val_outs:
out_list = val_outs[cattr].data
else:
continue

job_attrs[cattr] = {ctype.name: ctype.find_from_list(out_list)
for ctype in column_types}

job = (job_info, job_attrs)
jobs.append(job)

attrs_and_labels = []
for cattr in column_attrs:
for ctype in column_types:
attrs_and_labels.append((cattr, ctype, ctype.label(cattr)))

return flask.render_template('models/index.html',
jobs=jobs,
attrs_and_labels=attrs_and_labels)

@blueprint.route('/<job_id>.json', methods=['GET'])
@blueprint.route('/<job_id>', methods=['GET'])
def show(job_id):
Expand Down
10 changes: 0 additions & 10 deletions digits/scheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,21 +180,11 @@ def add_job(self, job):
from digits.webapp import app, socketio
with app.app_context():
# send message to job_management room that the job is added
html = flask.render_template('job_row.html', job = job)

# Convert the html into a list for the jQuery
# DataTable.row.add() method. This regex removes the <tr>
# and <td> tags, and splits the string into one element
# for each cell.
html = re.sub('<tr[^<]*>[\s\n\r]*<td[^<]*>[\s\n\r]*', '', html)
html = re.sub('[\s\n\r]*</td>[\s\n\r]*</tr>', '', html)
html = re.split('</td>[\s\n\r]*<td[^<]*>', html)

socketio.emit('job update',
{
'update': 'added',
'job_id': job.id(),
'html': html
},
namespace='/jobs',
room='job_management',
Expand Down
1 change: 0 additions & 1 deletion digits/static/css/dataTables.bootstrap.min.css

This file was deleted.

35 changes: 21 additions & 14 deletions digits/static/css/table_selection.css
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
table.selectable tr
.table.selectable tr
{
-khtml-user-select: none;
-moz-user-select: none;
Expand All @@ -7,23 +7,30 @@ table.selectable tr
-webkit-touch-callout: none;
-webkit-user-select: none;
}
table.selectable tbody tr.selected td
.table.selectable tbody tr.selected td
{
background-color:#B0BED9
}
table.selectable.stripe tbody tr.odd,table.selectable.display tbody tr.odd td
{
background-color:#f9f9f9
.table {
width: 100%;
border: 0;
table-layout:fixed;
word-wrap:break-word;
border-collapse:collapse;
}
table.selectable.stripe tbody tr.odd.selected,table.selectable.display tbody tr.odd.selected td
{
background-color:#acbad4
.table>tbody>tr>td,.table>thead>tr>th {
padding: 2px;
border-collapse: collapse;
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
}
table.selectable.hover tbody tr:hover,table.selectable.display tbody tr:hover td
{
background-color:#f6f6f6
.table>thead>tr>th {
cursor: pointer;
}
table.selectable.hover tbody tr:hover.selected,table.selectable.display tbody tr:hover.selected td
{
background-color:#aab7d1
.table-striped>tbody>tr:nth-child(odd)>td, .table-striped>tbody>tr:nth-child(odd)>th {
background-color: #f9f9f9;
}
.table-striped>tbody>tr:nth-child(even)>td, .table-striped>tbody>tr:nth-child(even)>th {
background-color: #ffffff;
}
8 changes: 0 additions & 8 deletions digits/static/js/dataTables.bootstrap.min.js

This file was deleted.

Loading

0 comments on commit dab8426

Please sign in to comment.