Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dashboard #477

Open
wants to merge 48 commits into
base: user-dashboard
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
0e4988e
Update content.js
sayamkanwar Nov 23, 2018
ebac6b1
Update views.py
sayamkanwar Nov 23, 2018
d10486c
Update urls.py
sayamkanwar Nov 23, 2018
5ffc512
Create dashboard.js
sayamkanwar Nov 23, 2018
2cd218c
Create dash_style.css
sayamkanwar Nov 23, 2018
c7dfbce
Update index.html
sayamkanwar Nov 23, 2018
288a67c
Update login.js
sayamkanwar Nov 23, 2018
feaa07b
Update topBar.js
sayamkanwar Nov 23, 2018
27f3823
Create dashbutton.js
sayamkanwar Nov 23, 2018
0bf3a0c
Update index.js
sayamkanwar Nov 23, 2018
c48605f
Update test_db.py
sayamkanwar Nov 23, 2018
80194bc
Update test.py
sayamkanwar Nov 23, 2018
63d934d
Update test.py
sayamkanwar Nov 23, 2018
f8499c1
Update test.py
sayamkanwar Nov 23, 2018
37df28c
Update test.py
sayamkanwar Nov 23, 2018
8706c6c
Update urls.py
sayamkanwar Nov 23, 2018
6c28f76
Update views.py
sayamkanwar Nov 23, 2018
c81f450
Update views.py
sayamkanwar Nov 23, 2018
41c6afd
Update test_db.py
sayamkanwar Nov 23, 2018
0a5a94e
Update content.js
sayamkanwar Nov 24, 2018
216807a
Update content.js
sayamkanwar Nov 24, 2018
46b1e09
Update topBar.js
sayamkanwar Nov 24, 2018
422e886
Create card.js
sayamkanwar Nov 24, 2018
5b9405a
Update dashboard.js
sayamkanwar Nov 24, 2018
28e6c66
Update views.py
sayamkanwar Nov 24, 2018
08b4090
Update urls.py
sayamkanwar Nov 24, 2018
640a9d3
Update views.py
sayamkanwar Nov 24, 2018
10d1bfa
Update views.py
sayamkanwar Nov 24, 2018
7a88df1
Update index.html
sayamkanwar Nov 24, 2018
8aaeda7
Update searchbar_style.css
sayamkanwar Nov 24, 2018
b239062
Update content.js
sayamkanwar Nov 25, 2018
815402a
Update views.py
sayamkanwar Nov 26, 2018
ef40924
Update content.js
sayamkanwar Nov 26, 2018
dc03332
Update topBar.js
sayamkanwar Nov 26, 2018
2da10bb
Update card.js
sayamkanwar Nov 26, 2018
74d8b3a
Update dash_style.css
sayamkanwar Nov 26, 2018
0387266
Update login_style.css
sayamkanwar Nov 26, 2018
3de7f30
Update login.js
sayamkanwar Nov 26, 2018
9df8d9d
Update dashbutton.js
sayamkanwar Nov 26, 2018
b7eea2d
Update urls.py
sayamkanwar Dec 12, 2018
1c904d0
Update test_db.py
sayamkanwar Dec 12, 2018
86409fc
Update views.py
sayamkanwar Dec 12, 2018
feb8591
Update views.py
sayamkanwar Dec 12, 2018
1c17d4b
Update test_db.py
sayamkanwar Dec 12, 2018
91790c3
Update dashboard.js
sayamkanwar Dec 12, 2018
3f4c6f4
Update test_db.py
sayamkanwar Dec 12, 2018
6a61d2e
Update views.py
sayamkanwar Dec 12, 2018
e123929
Update test_db.py
sayamkanwar Dec 12, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
21 changes: 21 additions & 0 deletions ide/static/css/dash_style.css
@@ -0,0 +1,21 @@
.overlay {
opacity: 0;
z-index: -2;
height: 290px;
width: 240px;
background: rgb(34,47,62,0.9);
border-radius: 20px;
position: relative;
top: -310px;
transition: all .4s ease;
}

.card {
transition: all .4s ease;
}

.card:hover + .overlay, .overlay:hover {
opacity: 1;
z-index: 1;
transition: all .4s ease;
}
39 changes: 38 additions & 1 deletion ide/static/css/login_style.css
Expand Up @@ -15,6 +15,36 @@
cursor: pointer;
}

#sidebar-logout-button {
background: rgb(205, 207, 210);
color: rgb(69, 80, 97);
text-align: center;
border-radius: 5px;
width: 110px;
margin: 0.2em;
transition: 0.2s;
position: relative;
}

#sidebar-logout-button:hover {
cursor: pointer;
}

#sidebar-dash-button {
background: rgb(205, 207, 210);
color: rgb(69, 80, 97);
text-align: center;
border-radius: 5px;
width: 130px;
margin: 0.2em;
transition: 0.2s;
position: relative;
}

#sidebar-dash-button:hover {
cursor: pointer;
}

#sidebar-login-button span {
position: absolute;
left: 9px;
Expand Down Expand Up @@ -67,6 +97,13 @@
}
}

.long-buttons {
display: flex;
flex: 1;
flex-direction: row;
margin-top: -0.5em;
}

.login-panel {
position: relative;
width: 350px;
Expand Down Expand Up @@ -265,4 +302,4 @@
position: absolute;
top: 0px;
right: 10px;
}
}
4 changes: 4 additions & 0 deletions ide/static/css/searchbar_style.css
@@ -1,3 +1,7 @@
body {
background: #F3F5F7;
}

.insert-layer-title {
position: relative;
}
Expand Down
79 changes: 79 additions & 0 deletions ide/static/js/card.js
@@ -0,0 +1,79 @@
import React from 'react';
import '../css/dash_style.css';

class Card extends React.Component {
render() {
return(
<div style={{display: 'inline-block'}}>
<div className="card" style={{
background: '#fff',
height: 290,
width: 240,
borderRadius: 20,
display: 'inline-block',
margin: 20,
boxShadow: '0 2px 6px rgba(112,112,112,0.2)'
}}>
<img style={{marginTop: '4.5em'}} src="static/img/thumb.png" height="60%;" />
</div>
<div className="overlay">
<br />
<div className="social" style={{marginTop: '5em'}}>
<div style={{
margin: 10,
display: 'inline-block',
color: '#fff',
fontFamily: '"Proxima Nova",sans-serif',
width: 10,
height: 10,
border: '3px solid #fff',
padding: 20,
borderRadius: '50%'
}}>
<a href={"/load?id=" + this.props.ModelID} style={{textDecoration: 'none', color: '#fff'}}>
<p style={{marginTop: '-8px', marginLeft: '-6px'}}>
<span className="glyphicon glyphicon-pencil" aria-hidden="true"></span>
</p>
</a>
</div>
<div style={{margin: 10,
display: 'inline-block',
color: '#fff',
fontFamily: '"Proxima Nova",sans-serif',
width: 10,
height: 10,
border: '3px solid #fff',
padding: 20,
borderRadius: '50%'
}}>
<a onClick={
() => this.props.ModelFunction(this.props.ModelID)
} style={{
textDecoration: 'none',
color: '#fff',
cursor: 'pointer'
}}>
<p style={{
marginTop: '-8px',
marginLeft: '-7px'
}}>
<span className="glyphicon glyphicon-trash" aria-hidden="true"></span>
</p>
</a>
</div>
</div>
</div>
<h3 style={{marginTop: '-12em'}}>{this.props.ModelName}</h3>
</div>
);
}
}

Card.propTypes = {
ModelName: React.PropTypes.string,
ModelID: React.PropTypes.number,
ModelFunction: React.PropTypes.func
};


export default Card;
50 changes: 46 additions & 4 deletions ide/static/js/content.js
Expand Up @@ -85,6 +85,7 @@ class Content extends React.Component {
this.openModal = this.openModal.bind(this);
this.closeModal = this.closeModal.bind(this);
this.saveDb = this.saveDb.bind(this);
this.saveModel = this.saveModel.bind(this);
this.loadDb = this.loadDb.bind(this);
this.infoModal = this.infoModal.bind(this);
this.faqModal = this.faqModal.bind(this);
Expand Down Expand Up @@ -979,6 +980,34 @@ class Content extends React.Component {
layer.info.phase = 0;
this.setState({ net });
}
saveModel(){
let modelData = this.state.net;
this.setState({ load: true });
$.ajax({
url: '/saveModel',
dataType: 'json',
type: 'POST',
data: {
net: JSON.stringify(modelData),
net_name: this.state.net_name,
user_id: this.getUserId(),
nextLayerId: this.state.nextLayerId
},
success : function (response) {
if (response.result == 'success') {
this.modalContent = "Successfully Saved!";
this.openModal();
}
else if (response.result == 'error') {
this.addError(response.error);
}
this.setState({ load: false });
}.bind(this),
error() {
this.setState({ load: false });
}
});
}
saveDb(){
let netData = this.state.net;
this.setState({ load: true });
Expand Down Expand Up @@ -1055,7 +1084,7 @@ class Content extends React.Component {
// Note: this needs to be improved when handling conflict resolution to avoid
// inconsistent states of model
let nextLayerId = this.state.nextLayerId;

let is_shared = false;
this.setState({ load: true });

this.dismissAllErrors();
Expand All @@ -1072,6 +1101,13 @@ class Content extends React.Component {
// while loading a model ensure paramete intialisation
// for UI show/hide is not executed, it leads to inconsistent
// data which cannot be used further
if (response.public_sharing == false) {
is_shared = false;
}
else {
is_shared = true;
}
console.log(response);
nextLayerId = response.next_layer_id;
this.initialiseImportedNet(response.net,response.net_name);
if (Object.keys(response.net).length){
Expand All @@ -1083,15 +1119,18 @@ class Content extends React.Component {
}
this.setState({
load: false,
isShared: true,
isShared: is_shared,
nextLayerId: parseInt(nextLayerId)
}, function() {
console.log("Shared value: " + this.state.isShared);
});
}.bind(this),
error() {
this.setState({ load: false });
}
});
}

infoModal() {
this.modalHeader = "About"
this.modalContent = `Fabrik is an online collaborative platform to build and visualize deep\
Expand All @@ -1113,7 +1152,7 @@ class Content extends React.Component {
<a target="_blank" href="https://github.com/Cloud-CV/Fabrik/blob/master/docs/source/tested_models.md"> here</a>.
<br />
<b>Q:</b> What do the Train/Test buttons mean?<br />
<b>A:</b> They are two different modes of your model:
<b>A:</b> They are two different modes of your model:
Train and Test - respectively for training your model with data and testing how and if it works.<br />
<b>Q:</b> What does the import fuction do?<br />
<b>A:</b> It allows you to import your previously created models in Caffe (.protoxt files),
Expand All @@ -1127,7 +1166,7 @@ class Content extends React.Component {
<b>A:</b> Please see the instructions listed
<a target="_blank" href="https://github.com/Cloud-CV/Fabrik/blob/master/README.md"> here</a>
<br /><br />

<b>If you have anymore questions, please visit Fabrik's Github page available
<a target="_blank" href="https://github.com/Cloud-CV/Fabrik"> here</a> for more information.</b>
</p>);
Expand Down Expand Up @@ -1282,6 +1321,7 @@ class Content extends React.Component {
this.addNewLayer(layer);
}
}

render() {
let loader = null;
if (this.state.load) {
Expand All @@ -1299,9 +1339,11 @@ class Content extends React.Component {
<div id="sidebar-scroll" className="col-md-12">
<h5 className="sidebar-heading">ACTIONS</h5>
<TopBar
isShared={this.state.isShared}
exportNet={this.exportNet}
importNet={this.importNet}
saveDb={this.saveDb}
saveModel={this.saveModel}
zooModal={this.zooModal}
textboxModal={this.textboxModal}
urlModal={this.urlModal}
Expand Down