Skip to content

Commit

Permalink
more explore.jsx to explore/
Browse files Browse the repository at this point in the history
  • Loading branch information
alanna scott committed Jul 8, 2016
1 parent 51805b1 commit d3fda53
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 43 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,25 @@
// js
var $ = window.$ = require('jquery');
var jQuery = window.jQuery = $;
var px = require('./modules/caravel.js');
var showModal = require('./modules/utils.js').showModal;
var px = require('./../modules/caravel.js');
var showModal = require('./../modules/utils.js').showModal;

import React from 'react';
import ReactDOM from 'react-dom';
import QueryAndSaveBtns from './explore/components/QueryAndSaveBtns.jsx';
import QueryAndSaveBtns from './components/QueryAndSaveBtns.jsx';

require('jquery-ui');
$.widget.bridge('uitooltip', $.ui.tooltip); // Shutting down jq-ui tooltips
require('bootstrap');

require('./caravel-select2.js');
require('./../caravel-select2.js');

require('../node_modules/bootstrap-toggle/js/bootstrap-toggle.min.js');
require('../../node_modules/bootstrap-toggle/js/bootstrap-toggle.min.js');

// css
require('../vendor/pygments.css');
require('../stylesheets/explore.css');
require('../node_modules/bootstrap-toggle/css/bootstrap-toggle.min.css');
require('../../vendor/pygments.css');
require('../../stylesheets/explore.css');
require('../../node_modules/bootstrap-toggle/css/bootstrap-toggle.min.css');

var slice;

Expand Down Expand Up @@ -427,45 +427,51 @@ function initExploreView() {
$("#save_as_new").prop("checked", true);
setButtonsState();
});
$('#btn_modal_save').click(function () {
var action = $('input[name=rdo_save]:checked').val();
if (action === 'saveas') {
var slice_name = $('input[name=new_slice_name]').val();
if (slice_name === '') {
showModal({
title: "Error",
body: "You must pick a name for the new slice"
});
return;
}
document.getElementById("slice_name").value = slice_name;
}
var add_to_dash = $('input[name=add_to_dash]:checked').val();
if (add_to_dash === 'existing' && $('#save_to_dashboard_id').val() === '') {
showModal({
title: "Error",
body: "You must pick an existing dashboard"
});
return;
} else if (add_to_dash === 'new' && $('input[name=new_dashboard_name]').val() === '') {
showModal({
title: "Error",
body: "Please enter a name for the new dashboard"
});
return;
}
$('#action').val(action);
prepForm();
$("#query").submit();
});
$('#btn_modal_save_goto_dash').click(function () {
document.getElementById("goto_dash").value = 'true';
$('#btn_modal_save').click();

$('#btn_modal_save').on('click', () => saveSlice());

$('#btn_modal_save_goto_dash').click(() => {
document.getElementById('goto_dash').value = 'true';
saveSlice();
});
}
prepSaveDialog();
}

function saveSlice() {
console.log('saveSlice')

var action = $('input[name=rdo_save]:checked').val();
if (action === 'saveas') {
var slice_name = $('input[name=new_slice_name]').val();
if (slice_name === '') {
showModal({
title: "Error",
body: "You must pick a name for the new slice"
});
return;
}
document.getElementById("slice_name").value = slice_name;
}
var add_to_dash = $('input[name=add_to_dash]:checked').val();
if (add_to_dash === 'existing' && $('#save_to_dashboard_id').val() === '') {
showModal({
title: "Error",
body: "You must pick an existing dashboard"
});
return;
} else if (add_to_dash === 'new' && $('input[name=new_dashboard_name]').val() === '') {
showModal({
title: "Error",
body: "Please enter a name for the new dashboard"
});
return;
}
$('#action').val(action);
prepForm();
$("#query").submit();
}

$(document).ready(function () {
initExploreView();

Expand Down
2 changes: 1 addition & 1 deletion caravel/assets/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ var config = {
entry: {
'css-theme': APP_DIR + '/javascripts/css-theme.js',
dashboard: APP_DIR + '/javascripts/dashboard.jsx',
explore: APP_DIR + '/javascripts/explore.jsx',
explore: APP_DIR + '/javascripts/explore/explore.jsx',
welcome: APP_DIR + '/javascripts/welcome.js',
sql: APP_DIR + '/javascripts/sql.js',
standalone: APP_DIR + '/javascripts/standalone.js',
Expand Down

0 comments on commit d3fda53

Please sign in to comment.