Skip to content

Commit

Permalink
Getting back button working for CCA wizard. Addresses #584
Browse files Browse the repository at this point in the history
  • Loading branch information
alexsielicki committed Feb 27, 2016
1 parent b7844db commit c278d5e
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 23 deletions.
4 changes: 2 additions & 2 deletions web-server/css/slycat.css
Original file line number Diff line number Diff line change
Expand Up @@ -204,8 +204,8 @@ slycat-navbar .alert pre
.bootstrap-styles #slycat-wizard .nav-pills > li.active > a,
.bootstrap-styles #slycat-wizard .nav-pills > li.active > a:hover
{
color: white;
background-color: #337AB7;
color: black;
background-color: #d7d7d7;
}
.bootstrap-styles #slycat-wizard .modal-footer button i
{
Expand Down
48 changes: 38 additions & 10 deletions web-server/plugins/slycat-cca/js/new-ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,17 @@ define(["slycat-server-root", "slycat-web-client", "slycat-dialog", "knockout",
component.cca_type = ko.observable("local"); // local is selected by default...
component.row_count = ko.observable(null);

component.cca_type.subscribe(function(newValue) {
if(newValue == 'local')
{
$(".modal-dialog").removeClass("modal-lg");
}
else
{
$(".modal-dialog").addClass("modal-lg");
}
});

component.create_model = function() {
client.post_project_models({
pid: component.project._id(),
Expand Down Expand Up @@ -45,11 +56,8 @@ define(["slycat-server-root", "slycat-web-client", "slycat-dialog", "knockout",
var type = component.cca_type();

if (type === "local") {
$(".cca-tab-local").css("display", "block");
component.tab(1);
} else if (type === "remote") {
$(".modal-dialog").addClass("modal-lg");
$(".cca-tab-remote").css("display", "block");
component.tab(2);
}
};
Expand Down Expand Up @@ -134,6 +142,9 @@ define(["slycat-server-root", "slycat-web-client", "slycat-dialog", "knockout",
success: function(sid) {
component.remote.sid(sid);
component.tab(3);
component.remote.enable(true);
component.remote.status_type(null);
component.remote.status(null);
},
error: function(request, status, reason_phrase) {
component.remote.enable(true);
Expand Down Expand Up @@ -219,12 +230,7 @@ define(["slycat-server-root", "slycat-web-client", "slycat-dialog", "knockout",
value: component.scale_inputs(),
input: true,
success: function() {
client.post_model_finish({
mid: component.model._id(),
success: function() {
component.tab(5);
}
});
component.tab(5);
}
});
}
Expand All @@ -243,12 +249,34 @@ define(["slycat-server-root", "slycat-web-client", "slycat-dialog", "knockout",
marking: component.model.marking(),
success: function()
{
component.tab(6);
client.post_model_finish({
mid: component.model._id(),
success: function() {
component.tab(6);
}
});
},
error: dialog.ajax_error("Error updating model."),
});
};

component.back = function() {
var target = component.tab();
// Skip Upload Table tab if we're on the Choose Host tab.
if(component.tab() == 2)
{
target--;
}
// Skip remote ui tabs if we are local
if(component.cca_type() == 'local' && component.tab() == 4)
{
target--;
target--;
}
target--;
component.tab(target);
};

return component;
}

Expand Down
23 changes: 12 additions & 11 deletions web-server/plugins/slycat-cca/new-ui.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ <h3 class="modal-title">New CCA Model</h3>
</div>
<div class="modal-body">
<ul class="nav nav-pills">
<li data-bind="css:{active:tab() == 0}"><a>Locate Data</a></li>
<li data-bind="css:{active:tab() == 1}" class="cca-tab-local" style="display: none;"><a>Upload Table</a></li>
<li data-bind="css:{active:tab() == 2}" class="cca-tab-remote" style="display: none;"><a>Choose Host</a></li>
<li data-bind="css:{active:tab() == 3}" class="cca-tab-remote" style="display: none;"><a>Select Table</a></li>
<li data-bind="css:{active:tab() == 0}" class="btn-secondary"><a>Locate Data</a></li>
<li data-bind="css:{active:tab() == 1}, visible: cca_type() == 'local'"><a>Upload Table</a></li>
<li data-bind="css:{active:tab() == 2}, visible: cca_type() == 'remote'"><a>Choose Host</a></li>
<li data-bind="css:{active:tab() == 3}, visible: cca_type() == 'remote'"><a>Select Table</a></li>
<li data-bind="css:{active:tab() == 4}"><a>Select Columns</a></li>
<li data-bind="css:{active:tab() == 5}"><a>Name Model</a></li>
<li data-bind="css:{active:tab() == 6}"><a>Results</a></li>
Expand Down Expand Up @@ -77,11 +77,12 @@ <h3 class="modal-title">New CCA Model</h3>
</div>
</div>
<div class="modal-footer">
<button class="btn btn-default" data-bind="visible:tab() == 0,click:select_type">Continue</button>
<button class="btn btn-default local-browser-continue browser-continue" data-bind="visible:tab() == 1,click:upload_table"><i class="fa fa-spinner fa-pulse"></i> Continue</button>
<button class="btn btn-default" data-bind="visible:tab() == 2,click:connect,enable:remote.enable">Continue</button>
<button class="btn btn-default remote-browser-continue browser-continue" data-bind="visible:tab() == 3,click:load_table"><i class="fa fa-spinner fa-pulse"></i> Continue</button>
<button class="btn btn-default" data-bind="visible:tab() == 4,click:finish">Continue</button>
<button class="btn btn-default" data-bind="visible:tab() == 5,click:name_model">Finish</button>
<button class="btn btn-default" data-bind="visible:tab() == 6,click:go_to_model">Go To Model</button>
<button class="btn btn-default pull-left" data-bind="visible: [0,6].indexOf(tab()) == -1, click: back">Back</button>
<button class="btn btn-primary" data-bind="visible:tab() == 0,click:select_type">Continue</button>
<button class="btn btn-primary local-browser-continue browser-continue" data-bind="visible:tab() == 1,click:upload_table"><i class="fa fa-spinner fa-pulse"></i> Continue</button>
<button class="btn btn-primary" data-bind="visible:tab() == 2,click:connect,enable:remote.enable">Continue</button>
<button class="btn btn-primary remote-browser-continue browser-continue" data-bind="visible:tab() == 3,click:load_table"><i class="fa fa-spinner fa-pulse"></i> Continue</button>
<button class="btn btn-primary" data-bind="visible:tab() == 4,click:finish">Continue</button>
<button class="btn btn-primary" data-bind="visible:tab() == 5,click:name_model">Finish</button>
<button class="btn btn-primary" data-bind="visible:tab() == 6,click:go_to_model">Go To Model</button>
</div>

0 comments on commit c278d5e

Please sign in to comment.