提交 019be5c3 编写于 作者: F fjy

update jquery

上级 e6d4121c
......@@ -29,7 +29,7 @@
<style type="text/css">@import "css/demo_table.css";</style>
<script type="text/javascript" src="js/underscore-1.2.2.js"></script>
<script type="text/javascript" src="js/jquery-1.8.3.js"></script>
<script type="text/javascript" src="js/jquery-1.11.0.min.js"></script>
<script type="text/javascript" src="js/jquery.dataTables-1.8.2.js"></script>
<script type="text/javascript" src="js/druidTable-0.0.1.js"></script>
<script type="text/javascript" src="js/tablehelper-0.0.2.js"></script>
......
......@@ -263,7 +263,8 @@ public class DatabaseRuleManager
public List<Rule> getRules(final String dataSource)
{
return rules.get().get(dataSource);
List<Rule> retVal = rules.get().get(dataSource);
return retVal == null ? Lists.<Rule>newArrayList() : retVal;
}
public List<Rule> getRulesWithDefault(final String dataSource)
......
......@@ -84,8 +84,7 @@ public class DatasourcesResource
@Produces("application/json")
public Response getQueryableDataSources(
@QueryParam("full") String full,
@QueryParam("simple") String simple,
@QueryParam("gran") String gran
@QueryParam("simple") String simple
)
{
Response.ResponseBuilder builder = Response.status(Response.Status.OK);
......@@ -107,9 +106,6 @@ public class DatasourcesResource
)
)
).build();
} else if (gran != null) {
IndexGranularity granularity = IndexGranularity.fromString(gran);
// TODO
}
return builder.entity(
......@@ -131,6 +127,7 @@ public class DatasourcesResource
@DELETE
@Path("/{dataSourceName}")
@Produces("application/json")
public Response deleteDataSource(
@PathParam("dataSourceName") final String dataSourceName,
@QueryParam("kill") final String kill,
......@@ -138,10 +135,22 @@ public class DatasourcesResource
)
{
if (indexingServiceClient == null) {
return Response.status(Response.Status.OK).entity(ImmutableMap.of("error", "no indexing service found")).build();
return Response.ok().entity(ImmutableMap.of("error", "no indexing service found")).build();
}
if (kill != null && Boolean.valueOf(kill)) {
indexingServiceClient.killSegments(dataSourceName, new Interval(interval));
try {
indexingServiceClient.killSegments(dataSourceName, new Interval(interval));
}
catch (Exception e) {
return Response.status(Response.Status.NOT_FOUND)
.entity(
ImmutableMap.of(
"error",
"Exception occurred. Are you sure you have an indexing service?"
)
)
.build();
}
} else {
if (!databaseSegmentManager.removeDatasource(dataSourceName)) {
return Response.status(Response.Status.NOT_FOUND).build();
......
......@@ -21,13 +21,17 @@ package io.druid.server.http;
import com.google.inject.Inject;
import io.druid.db.DatabaseRuleManager;
import io.druid.server.coordinator.rules.Rule;
import javax.ws.rs.Consumes;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.Response;
import java.util.List;
/**
*/
......@@ -67,4 +71,18 @@ public class RulesResource
return Response.ok(databaseRuleManager.getRules(dataSourceName))
.build();
}
@POST
@Path("/{dataSourceName}")
@Consumes("application/json")
public Response setDatasourceRules(
@PathParam("dataSourceName") final String dataSourceName,
final List<Rule> rules
)
{
if (databaseRuleManager.overrideRule(dataSourceName, rules)) {
return Response.ok().build();
}
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).build();
}
}
......@@ -29,7 +29,7 @@
<style type="text/css">@import "css/demo_table.css";</style>
<script type="text/javascript" src="js/underscore-1.2.2.js"></script>
<script type="text/javascript" src="js/jquery-1.8.3.js"></script>
<script type="text/javascript" src="js/jquery-1.11.0.min.js"></script>
<script type="text/javascript" src="js/jquery.dataTables-1.8.2.js"></script>
<script type="text/javascript" src="js/druidTable-0.0.1.js"></script>
<script type="text/javascript" src="js/init-0.0.2.js"></script>
......
......@@ -30,9 +30,9 @@
<style type="text/css">@import "css/config.css";</style>
<script type="text/javascript" src="js/underscore-1.2.2.js"></script>
<script type="text/javascript" src="js/jquery-1.8.3.js"></script>
<script type="text/javascript" src="js/jquery-1.11.0.min.js"></script>
<script type="text/javascript" src="js/jquery-ui-1.9.2.js"></script>
<script type="text/javascript" src="js/config-0.0.1.js"></script>
<script type="text/javascript" src="js/config-0.0.2.js"></script>
</head>
<body>
<div class="container">
......
......@@ -30,7 +30,7 @@
<style type="text/css">@import "css/enable.css";</style>
<script type="text/javascript" src="js/underscore-1.2.2.js"></script>
<script type="text/javascript" src="js/jquery-1.8.3.js"></script>
<script type="text/javascript" src="js/jquery-1.11.0.min.js"></script>
<script type="text/javascript" src="js/jquery-ui-1.9.2.js"></script>
<script type="text/javascript" src="js/enable-0.0.1.js"></script>
</head>
......
......@@ -20,7 +20,7 @@ function domToConfig(configDiv) {
}
function getConfigs() {
$.getJSON("/coordinator/config", function(data) {
$.getJSON("/druid/coordinator/v1/config", function(data) {
$('#config_list').empty();
$.each(data, function (key, value) {
......@@ -72,10 +72,10 @@ $(document).ready(function() {
$.ajax({
type: 'POST',
url:'/coordinator/config',
url:'/druid/coordinator/v1/config',
data: JSON.stringify(configs),
contentType:"application/json; charset=utf-8",
dataType:"json",
dataType:"text",
error: function(xhr, status, error) {
$("#update_dialog").dialog("close");
$("#error_dialog").html(xhr.responseText);
......
......@@ -24,7 +24,7 @@ $(document).ready(function() {
url:'/druid/coordinator/v1/datasources/' + selected,
data: JSON.stringify(selected),
contentType:"application/json; charset=utf-8",
dataType:"json",
dataType:"text",
error: function(xhr, status, error) {
$("#enable_dialog").dialog("close");
$("#error_dialog").html(xhr.responseText);
......@@ -53,7 +53,7 @@ $(document).ready(function() {
url:'/druid/coordinator/v1/datasources/' + selected,
data: JSON.stringify(selected),
contentType:"application/json; charset=utf-8",
dataType:"json",
dataType:"text",
error: function(xhr, status, error) {
$("#disable_dialog").dialog("close");
$("#error_dialog").html(xhr.responseText);
......@@ -81,12 +81,11 @@ $(document).ready(function() {
$('#disabled_datasources').append($('<li>' + datasource + '</li>'));
});
$.each(db_datasources, function(index, datasource) {
$('#datasources').append($('<option></option>').attr("value", datasource).text(datasource));
$('#datasources').append($('<option></option>').val(datasource).text(datasource));
});
});
});
$("#enable").click(function() {
$("#enable_dialog").dialog("open");
});
......
......@@ -3,11 +3,12 @@
$(document).ready(function() {
var basePath = "/druid/coordinator/v1/";
var type = $('#select_type').attr('value') + '';
var view = $('#select_view').attr('value') + '';
var type = $('#select_type').val() + '';
var view = $('#select_view').val() + '';
function handleTable(dontDisplay)
{
console.log(type);
$.get(basePath + type + '?full', function(data) {
buildTable(data, $('#result_table'), dontDisplay);
......@@ -75,8 +76,9 @@ $(document).ready(function() {
}
$('#view_button').click(function() {
type = $('#select_type').attr('value') + '';
view = $('#select_view').attr('value') + '';
console.log("here");
type = $('#select_type').val() + '';
view = $('#select_view').val() + '';
resetViews();
......
......@@ -24,7 +24,7 @@ $(document).ready(function() {
type: 'DELETE',
url:'/druid/coordinator/v1/datasources/' + selected +'?kill=true&interval=' + interval,
contentType:"application/json; charset=utf-8",
dataType:"json",
dataType:"text",
error: function(xhr, status, error) {
$("#confirm_dialog").dialog("close");
$("#error_dialog").html(xhr.responseText);
......@@ -43,7 +43,7 @@ $(document).ready(function() {
$.getJSON("/druid/coordinator/v1/db/datasources?includeDisabled", function(data) {
$.each(data, function(index, datasource) {
$('#datasources').append($('<option></option>').attr("value", datasource).text(datasource));
$('#datasources').append($('<option></option>').val(datasource).text(datasource));
});
});
......
......@@ -243,7 +243,7 @@ $(document).ready(function() {
url:'/druid/coordinator/v1/rules/' + selected,
data: JSON.stringify(rules),
contentType:"application/json; charset=utf-8",
dataType:"json",
dataType:"text",
error: function(xhr, status, error) {
$("#update_dialog").dialog("close");
$("#error_dialog").html(xhr.responseText);
......@@ -266,9 +266,9 @@ $(document).ready(function() {
$.getJSON("/druid/coordinator/v1/db/datasources", function(data) {
$.each(data, function(index, datasource) {
$('#datasources').append($('<option></option>').attr("value", datasource).text(datasource));
$('#datasources').append($('<option></option>').val(datasource).text(datasource));
});
$('#datasources').append($('<option></option>').attr("value", defaultDatasource).text(defaultDatasource));
$('#datasources').append($('<option></option>').val(defaultDatasource).text(defaultDatasource));
});
$("#datasources").change(function(event) {
......@@ -276,7 +276,7 @@ $(document).ready(function() {
$("#rules").show();
});
$(".rule_dropdown_types").live("change", function(event) {
$(document).on("change", '.rule_dropdown_types', null, function(event) {
var newRule = {
"type" : $(event.target).val()
};
......@@ -284,11 +284,11 @@ $(document).ready(function() {
ruleBody.replaceWith(makeRuleBody(newRule));
});
$(".delete_rule").live("click", function(event) {
$(document).on("click", '.delete_rule', null, function(event) {
$(event.target).parent(".rule").remove();
});
$(".add_tier").live("click", function(event) {
$(document).on("click", '.add_tier', null, function(event) {
$(event.target).parent().append(makeTierLoad(null, 0));
});
......
......@@ -29,7 +29,7 @@
<style type="text/css">@import "css/jquery-ui-1.9.2.css";</style>
<script type="text/javascript" src="js/underscore-1.2.2.js"></script>
<script type="text/javascript" src="js/jquery-1.8.3.js"></script>
<script type="text/javascript" src="js/jquery-1.11.0.min.js"></script>
<script type="text/javascript" src="js/jquery-ui-1.9.2.js"></script>
<script type="text/javascript" src="js/kill-0.0.1.js"></script>
</head>
......
......@@ -30,9 +30,9 @@
<style type="text/css">@import "css/rules.css";</style>
<script type="text/javascript" src="js/underscore-1.2.2.js"></script>
<script type="text/javascript" src="js/jquery-1.8.3.js"></script>
<script type="text/javascript" src="js/jquery-1.11.0.min.js"></script>
<script type="text/javascript" src="js/jquery-ui-1.9.2.js"></script>
<script type="text/javascript" src="js/rules-0.0.1.js"></script>
<script type="text/javascript" src="js/rules-0.0.2.js"></script>
</head>
<body>
<div class="container">
......
......@@ -30,11 +30,11 @@
<style type="text/css">@import "css/index.css";</style>
<script type="text/javascript" src="js/underscore-1.2.2.js"></script>
<script type="text/javascript" src="js/jquery-1.8.3.js"></script>
<script type="text/javascript" src="js/jquery-1.11.0.min.js"></script>
<script type="text/javascript" src="js/jquery.dataTables-1.8.2.js"></script>
<script type="text/javascript" src="js/druidTable-0.0.1.js"></script>
<script type="text/javascript" src="js/tablehelper-0.0.2.js"></script>
<script type="text/javascript" src="js/handlers-0.0.1.js"></script>
<script type="text/javascript" src="js/handlers-0.0.2.js"></script>
</head>
<body>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册