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

added a button to generate permalink to queries entered in admin UI. #5720

Merged
merged 1 commit into from
Apr 28, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ There were some important breaking changes in this release. Here's a list of the
- [#2715](https://github.com/influxdata/influxdb/issues/2715): Support using field regex comparisons in the WHERE clause
- [#5994](https://github.com/influxdata/influxdb/issues/5994): Single server
- [#5737](https://github.com/influxdata/influxdb/pull/5737): Admin UI: Display results of multiple queries, not just the first query. Thanks @Vidhuran!
- [#5720](https://github.com/influxdata/influxdb/pull/5720): Admin UI: New button to generate permalink to queries

### Bugfixes

Expand Down
19 changes: 19 additions & 0 deletions services/admin/assets/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ <h3 class="panel-title">Connection Settings</h3>
<div class="row">
<div class="col-sm-12" id="content">
<div class="dropdown text-right" id="template-container">
<button class="btn btn-default disabled" id="generate-query-url" data-toggle="modal" data-target="#queryURLModal">Generate Query URL</button>
<button class="btn btn-default dropdown-toggle" id="dropdown-templates" data-toggle="dropdown">Query Templates <span class="caret"></span> </button>
<ul class="dropdown-menu pull-right" id="action-template">
<li><label data-query="SHOW DATABASES">Show Databases</label></li>
Expand Down Expand Up @@ -194,6 +195,24 @@ <h4 class="modal-title" id="myModalLabel">Write Data to InfluxDB</h4>
</div>
</div>

<!-- Modal -->
<div class="modal fade" id="queryURLModal" tabindex="-1" role="dialog" aria-labelledby="queryURLModalLabel">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-title" id="queryURLModalLabel">URL for the Query</h4>
</div>
<div class="modal-body">
<textarea class="form-control" id="query-url"></textarea>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>

<script src="js/vendor/react-0.13.3.min.js"></script>
<script src="js/vendor/jquery-2.1.4.min.js"></script>
<script src="js/vendor/bootstrap-3.3.5.min.js"></script>
Expand Down
30 changes: 30 additions & 0 deletions services/admin/assets/js/admin.js
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,13 @@ var handleRequestError = function(e) {
var handleKeypress = function(e) {
var queryElement = document.getElementById('query');

// Enable/Disable the generate permalink button
if(queryElement.value == "" && !$("#generate-query-url").hasClass("disabled")) {
$("#generate-query-url").addClass("disabled");
} else {
$("#generate-query-url").removeClass("disabled");
}

// key press == enter
if (e.keyCode == 13) {
e.preventDefault();
Expand Down Expand Up @@ -424,6 +431,17 @@ var updateDatabaseList = function() {
}
}

var generateQueryURL = function() {
var q = document.getElementById('query').value;

var query = connectionString() + "/query?";
var queryParams = {q: q, db: currentlySelectedDatabase};
query += $.param(queryParams);

var textarea = $("#query-url");
textarea.val(query);
}

// when the page is ready, start everything up
$(document).ready(function () {
loadSettings();
Expand Down Expand Up @@ -476,6 +494,18 @@ $(document).ready(function () {

});

// Enable auto select of the text in modal
$('#queryURLModal').on('shown.bs.modal', function () {
var textarea = $("#query-url");
textarea.focus();
textarea.select();
});

//bind to the generate permalink button
$("#generate-query-url").click(function (e) {
generateQueryURL();
});

// handle submit actions on the query bar
var form = document.getElementById('query-form');
form.addEventListener("submit", handleSubmit);
Expand Down
2 changes: 1 addition & 1 deletion services/admin/statik/statik.go

Large diffs are not rendered by default.