Skip to content

Commit

Permalink
pre-merge, add a simple tutorial notebook
Browse files Browse the repository at this point in the history
update sender method
rename templates, will restructure templates when developing sql
  • Loading branch information
litaotao committed Nov 9, 2015
1 parent a71af65 commit 11d19a0
Show file tree
Hide file tree
Showing 14 changed files with 148 additions and 194 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ A stand alone, light-weight web server for building, sharing graphs created in i


# Usage
![docs/usage-1.jpg](docs/usage-1.jpg)

[IPython-Dashboard-Usage.ipynb](http://nbviewer.ipython.org/github/litaotao/IPython-Dashboard/blob/v-0.1.2-visualiza-table/docs/IPython-Dashboard-Usage.ipynb)

-----

Expand Down
5 changes: 3 additions & 2 deletions dashboard/client/sender.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from dashboard import r_kv


def sender(obj, key, value="", meta={}):
def sender(obj, key, value="", meta={}, force=True):
"""Send an object to storage[redis]. key is the obj name,
value is the serialized object[a dict most of the time]
Expand All @@ -18,10 +18,11 @@ def sender(obj, key, value="", meta={}):
key: option, key to store in storage;
value: option, value to store in storage;
meta: option, meta info of the key-value in storage;
force: option, if true, will over-write the existing key if the key is used.
"""
suffix = '-meta'
# persistent key and value
if key in r_kv or key + suffix in r_kv:
if (key in r_kv or key + suffix in r_kv) and not force:
print 'Collision: key: {}, or {} exists in storage'.format(key, key + suffix)
return None

Expand Down
2 changes: 1 addition & 1 deletion dashboard/server/resources/home.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ class Home(Resource):
"""
def get(self):
# headers = {'Content-Type': 'text/html'}
return make_response(render_template('dashboard_list.html'))
return make_response(render_template('home.html'))
6 changes: 3 additions & 3 deletions dashboard/server/start.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@


parser = argparse.ArgumentParser(description='Start your IPython-Dashboard server ...')
parser.add_argument('-H', '--host', type=str, default='0.0.0.0', help='server host')
parser.add_argument('-p', '--port', type=int, default=9090, help='server port')
parser.add_argument('-d', '--debug', type=bool, default=True, help='server port')
parser.add_argument('-H', '--host', type=str, default='0.0.0.0', help='server host, default localhost')
parser.add_argument('-p', '--port', type=int, default=9090, help='server port, default 9090')
parser.add_argument('-d', '--debug', type=bool, default=True, help='server port, default true')

args = parser.parse_args()
print(args)
Expand Down
6 changes: 3 additions & 3 deletions dashboard/static/js/dash-0.1.2.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ var box_template = ' \
<td style="padding: 0px; width: 10%"> \
<ul class="nav navbar-nav" style="padding-left: 7%;"> \
<li class="dropdown"> \
<a href="#" class="dropdown-toggle" data-toggle="dropdown" style="padding: 2px 2px;"><span class="fa fa-fw fa-lg fa-cog"></span></a> \
<a href="#" class="dropdown-toggle" data-toggle="dropdown" style="padding: 2px 2px;"><span class="fa fa-fw fa-lg fa-cog" style="color: green"></span></a> \
<ul class="dropdown-menu" style="min-width: 30px;"> \
<button class="btn btn-primary edit-button" data-toggle="modal" data-target="#myModal"> \
<i class="fa fa-fw fa-sm fa-edit" style="color: black;" graph-id={0} onclick="editModal(this)"></i> \
Expand Down Expand Up @@ -60,7 +60,7 @@ var th_template = ' \
var setting_template = ' \
<ul class="nav navbar-nav"> \
<li class="dropdown"> \
<a href="#" class="dropdown-toggle" data-toggle="dropdown" style="padding: 2px 2px;"><span class="fa fa-fw fa-lg fa-cog"></span></a> \
<a href="#" class="dropdown-toggle" data-toggle="dropdown" style="padding: 2px 2px;"><span class="fa fa-fw fa-lg fa-cog" style="color: green"></span></a> \
<ul class="dropdown-menu" style="min-width: 20px;"> \
<li><a href="#" ><span class="fa fa-fw fa-sm fa-group"></span></a></li> \
<li class="divider" style="margin: auto;"></li> \
Expand Down Expand Up @@ -192,7 +192,7 @@ function getValue(){
modal.key = key;
modal.type = "table"; // default graph type
store.set("modal", modal);
drawChartModal("table");
drawChartIntoModal("table");
})

// change the btn-chart, table button default as clicked
Expand Down
File renamed without changes.
1 change: 0 additions & 1 deletion dashboard/tests/testCreateData.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ def test_create_dataframe():
key = 'inspections-{}'.format(piece)
value = data[piece * piece_lenth : piece * piece_lenth + piece_lenth]
r_kv.set(key, value.to_json())
# import ipdb; ipdb.set_trace()
#
url_3 = 'https://github.com/litaotao/IPython-Dashboard/raw/v-0.1.2-visualiza-table/docs/people_number_by_province_lateset_10_years.csv'
if os.path.isdir(TMP_DIR) and 'people_number_by_province_lateset_10_years.csv' in os.listdir(TMP_DIR):
Expand Down

0 comments on commit 11d19a0

Please sign in to comment.