annotate query_builder/ismi.html @ 26:22be4ea663a7

Trying to work out having json request from neo4j display properly in drop down selectize box
author arussell
date Tue, 01 Dec 2015 02:07:13 -0500
parents
children ed8b4e3f2a73
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
26
22be4ea663a7 Trying to work out having json request from neo4j display properly in drop down selectize box
arussell
parents:
diff changeset
1 <!DOCTYPE html>
22be4ea663a7 Trying to work out having json request from neo4j display properly in drop down selectize box
arussell
parents:
diff changeset
2 <html>
22be4ea663a7 Trying to work out having json request from neo4j display properly in drop down selectize box
arussell
parents:
diff changeset
3 <head>
22be4ea663a7 Trying to work out having json request from neo4j display properly in drop down selectize box
arussell
parents:
diff changeset
4 <meta http-equiv="Content-Type" content="text/html" charset="UTF-8">
22be4ea663a7 Trying to work out having json request from neo4j display properly in drop down selectize box
arussell
parents:
diff changeset
5 <title>Query Builder</title>
22be4ea663a7 Trying to work out having json request from neo4j display properly in drop down selectize box
arussell
parents:
diff changeset
6 <link rel="stylesheet" href="bootstrap/css/bootstrap.min.css">
22be4ea663a7 Trying to work out having json request from neo4j display properly in drop down selectize box
arussell
parents:
diff changeset
7 <link rel="stylesheet" href="bootstrap/bootstrap-slider/css/bootstrap-slider.css">
22be4ea663a7 Trying to work out having json request from neo4j display properly in drop down selectize box
arussell
parents:
diff changeset
8 <link rel="stylesheet" href="selectize/dist/css/selectize.default.css">
22be4ea663a7 Trying to work out having json request from neo4j display properly in drop down selectize box
arussell
parents:
diff changeset
9 <link rel="stylesheet" href="bootstrap-select/dist/css/bootstrap-select.min.css">
22be4ea663a7 Trying to work out having json request from neo4j display properly in drop down selectize box
arussell
parents:
diff changeset
10 <link rel="stylesheet" href="selectize/dist/css/selectize.bootstrap3.css">
22be4ea663a7 Trying to work out having json request from neo4j display properly in drop down selectize box
arussell
parents:
diff changeset
11 <link rel="stylesheet" href="css/query-builder.default.min.css">
22be4ea663a7 Trying to work out having json request from neo4j display properly in drop down selectize box
arussell
parents:
diff changeset
12
22be4ea663a7 Trying to work out having json request from neo4j display properly in drop down selectize box
arussell
parents:
diff changeset
13
22be4ea663a7 Trying to work out having json request from neo4j display properly in drop down selectize box
arussell
parents:
diff changeset
14 </head>
22be4ea663a7 Trying to work out having json request from neo4j display properly in drop down selectize box
arussell
parents:
diff changeset
15 <body style="background:none;">
22be4ea663a7 Trying to work out having json request from neo4j display properly in drop down selectize box
arussell
parents:
diff changeset
16 <div role="navigation" class="navbar navbar-default navbar-static-top">
22be4ea663a7 Trying to work out having json request from neo4j display properly in drop down selectize box
arussell
parents:
diff changeset
17 <div class="container">
22be4ea663a7 Trying to work out having json request from neo4j display properly in drop down selectize box
arussell
parents:
diff changeset
18 <div class="row">
22be4ea663a7 Trying to work out having json request from neo4j display properly in drop down selectize box
arussell
parents:
diff changeset
19 <div class="col-sm-6 col-md-6">
22be4ea663a7 Trying to work out having json request from neo4j display properly in drop down selectize box
arussell
parents:
diff changeset
20 <ul class="nav navbar-nav">
22be4ea663a7 Trying to work out having json request from neo4j display properly in drop down selectize box
arussell
parents:
diff changeset
21 </ul>
22be4ea663a7 Trying to work out having json request from neo4j display properly in drop down selectize box
arussell
parents:
diff changeset
22 </div>
22be4ea663a7 Trying to work out having json request from neo4j display properly in drop down selectize box
arussell
parents:
diff changeset
23 <div class="navbar-header col-sm-6 col-md-6">
22be4ea663a7 Trying to work out having json request from neo4j display properly in drop down selectize box
arussell
parents:
diff changeset
24 <div class="logo-well">
22be4ea663a7 Trying to work out having json request from neo4j display properly in drop down selectize box
arussell
parents:
diff changeset
25 <a href="//neo4j.com/developer-resources">
22be4ea663a7 Trying to work out having json request from neo4j display properly in drop down selectize box
arussell
parents:
diff changeset
26 <img src="//neo4j-contrib.github.io/developer-resources/language-guides/assets/img/logo-white.svg" alt="Neo4j World's Leading Graph Database" id="logo">
22be4ea663a7 Trying to work out having json request from neo4j display properly in drop down selectize box
arussell
parents:
diff changeset
27 </a>
22be4ea663a7 Trying to work out having json request from neo4j display properly in drop down selectize box
arussell
parents:
diff changeset
28 </div>
22be4ea663a7 Trying to work out having json request from neo4j display properly in drop down selectize box
arussell
parents:
diff changeset
29 <div class="navbar-brand">
22be4ea663a7 Trying to work out having json request from neo4j display properly in drop down selectize box
arussell
parents:
diff changeset
30 <div class="brand">ISMI Query Builder</div>
22be4ea663a7 Trying to work out having json request from neo4j display properly in drop down selectize box
arussell
parents:
diff changeset
31 </div>
22be4ea663a7 Trying to work out having json request from neo4j display properly in drop down selectize box
arussell
parents:
diff changeset
32 </div>
22be4ea663a7 Trying to work out having json request from neo4j display properly in drop down selectize box
arussell
parents:
diff changeset
33 </div>
22be4ea663a7 Trying to work out having json request from neo4j display properly in drop down selectize box
arussell
parents:
diff changeset
34 </div>
22be4ea663a7 Trying to work out having json request from neo4j display properly in drop down selectize box
arussell
parents:
diff changeset
35 </div>
22be4ea663a7 Trying to work out having json request from neo4j display properly in drop down selectize box
arussell
parents:
diff changeset
36 <div class="container">
22be4ea663a7 Trying to work out having json request from neo4j display properly in drop down selectize box
arussell
parents:
diff changeset
37 <div class="row" style="width: 95%">
22be4ea663a7 Trying to work out having json request from neo4j display properly in drop down selectize box
arussell
parents:
diff changeset
38 <div class="col-md-12">
22be4ea663a7 Trying to work out having json request from neo4j display properly in drop down selectize box
arussell
parents:
diff changeset
39 <div class="panel panel-default">
22be4ea663a7 Trying to work out having json request from neo4j display properly in drop down selectize box
arussell
parents:
diff changeset
40 <div class="panel-heading" id="title">Query Builder</div>
22be4ea663a7 Trying to work out having json request from neo4j display properly in drop down selectize box
arussell
parents:
diff changeset
41
22be4ea663a7 Trying to work out having json request from neo4j display properly in drop down selectize box
arussell
parents:
diff changeset
42
22be4ea663a7 Trying to work out having json request from neo4j display properly in drop down selectize box
arussell
parents:
diff changeset
43
22be4ea663a7 Trying to work out having json request from neo4j display properly in drop down selectize box
arussell
parents:
diff changeset
44
22be4ea663a7 Trying to work out having json request from neo4j display properly in drop down selectize box
arussell
parents:
diff changeset
45 <div class="sandbox">
22be4ea663a7 Trying to work out having json request from neo4j display properly in drop down selectize box
arussell
parents:
diff changeset
46 <label for="select-codex">Codex:</label>
22be4ea663a7 Trying to work out having json request from neo4j display properly in drop down selectize box
arussell
parents:
diff changeset
47 <select id="select-codex" class="codices selectized" placeholder="Choose a codex" tabindex="-1" style="display: none;"></select>
22be4ea663a7 Trying to work out having json request from neo4j display properly in drop down selectize box
arussell
parents:
diff changeset
48 </div>
22be4ea663a7 Trying to work out having json request from neo4j display properly in drop down selectize box
arussell
parents:
diff changeset
49
22be4ea663a7 Trying to work out having json request from neo4j display properly in drop down selectize box
arussell
parents:
diff changeset
50
22be4ea663a7 Trying to work out having json request from neo4j display properly in drop down selectize box
arussell
parents:
diff changeset
51
22be4ea663a7 Trying to work out having json request from neo4j display properly in drop down selectize box
arussell
parents:
diff changeset
52
22be4ea663a7 Trying to work out having json request from neo4j display properly in drop down selectize box
arussell
parents:
diff changeset
53
22be4ea663a7 Trying to work out having json request from neo4j display properly in drop down selectize box
arussell
parents:
diff changeset
54
22be4ea663a7 Trying to work out having json request from neo4j display properly in drop down selectize box
arussell
parents:
diff changeset
55
22be4ea663a7 Trying to work out having json request from neo4j display properly in drop down selectize box
arussell
parents:
diff changeset
56 </div>
22be4ea663a7 Trying to work out having json request from neo4j display properly in drop down selectize box
arussell
parents:
diff changeset
57 </div>
22be4ea663a7 Trying to work out having json request from neo4j display properly in drop down selectize box
arussell
parents:
diff changeset
58 </div>
22be4ea663a7 Trying to work out having json request from neo4j display properly in drop down selectize box
arussell
parents:
diff changeset
59 </div>
22be4ea663a7 Trying to work out having json request from neo4j display properly in drop down selectize box
arussell
parents:
diff changeset
60
22be4ea663a7 Trying to work out having json request from neo4j display properly in drop down selectize box
arussell
parents:
diff changeset
61
22be4ea663a7 Trying to work out having json request from neo4j display properly in drop down selectize box
arussell
parents:
diff changeset
62
22be4ea663a7 Trying to work out having json request from neo4j display properly in drop down selectize box
arussell
parents:
diff changeset
63 <script type="text/javascript" src="js/jquery-1.11.3.js"></script>
22be4ea663a7 Trying to work out having json request from neo4j display properly in drop down selectize box
arussell
parents:
diff changeset
64 <script type="text/javascript" src="js/d3.min.js"></script>
22be4ea663a7 Trying to work out having json request from neo4j display properly in drop down selectize box
arussell
parents:
diff changeset
65 <script type="text/javascript" src="moment/min/moment.min.js"></script>
22be4ea663a7 Trying to work out having json request from neo4j display properly in drop down selectize box
arussell
parents:
diff changeset
66 <script type="text/javascript" src="bootstrap/bootstrap-datepicker/js/bootstrap-datepicker.js"></script>
22be4ea663a7 Trying to work out having json request from neo4j display properly in drop down selectize box
arussell
parents:
diff changeset
67 <script type="text/javascript" src="bootstrap/bootstrap-slider/js/bootstrap-slider.js"></script>
22be4ea663a7 Trying to work out having json request from neo4j display properly in drop down selectize box
arussell
parents:
diff changeset
68 <script type="text/javascript" src="selectize/dist/js/standalone/selectize.min.js"></script>
22be4ea663a7 Trying to work out having json request from neo4j display properly in drop down selectize box
arussell
parents:
diff changeset
69 <script type="text/javascript" src="bootstrap-select/dist/js/bootstrap-select.min.js"></script>
22be4ea663a7 Trying to work out having json request from neo4j display properly in drop down selectize box
arussell
parents:
diff changeset
70 <script type="text/javascript" src="js/query-builder.standalone.min.js"></script>
22be4ea663a7 Trying to work out having json request from neo4j display properly in drop down selectize box
arussell
parents:
diff changeset
71
22be4ea663a7 Trying to work out having json request from neo4j display properly in drop down selectize box
arussell
parents:
diff changeset
72 <script>
22be4ea663a7 Trying to work out having json request from neo4j display properly in drop down selectize box
arussell
parents:
diff changeset
73 var refreshDropdown = function(query, callback) {
22be4ea663a7 Trying to work out having json request from neo4j display properly in drop down selectize box
arussell
parents:
diff changeset
74 $.getJSON('url/suppliers', function (results) {
22be4ea663a7 Trying to work out having json request from neo4j display properly in drop down selectize box
arussell
parents:
diff changeset
75 if (results) {
22be4ea663a7 Trying to work out having json request from neo4j display properly in drop down selectize box
arussell
parents:
diff changeset
76 var selectOptions = [];
22be4ea663a7 Trying to work out having json request from neo4j display properly in drop down selectize box
arussell
parents:
diff changeset
77 for (var index = 0, length = results.length; index < length; index++) {
22be4ea663a7 Trying to work out having json request from neo4j display properly in drop down selectize box
arussell
parents:
diff changeset
78 var item = results[index];
22be4ea663a7 Trying to work out having json request from neo4j display properly in drop down selectize box
arussell
parents:
diff changeset
79 selectOptions.push({
22be4ea663a7 Trying to work out having json request from neo4j display properly in drop down selectize box
arussell
parents:
diff changeset
80 text: item.Option,
22be4ea663a7 Trying to work out having json request from neo4j display properly in drop down selectize box
arussell
parents:
diff changeset
81 value: item.Id.toString()
22be4ea663a7 Trying to work out having json request from neo4j display properly in drop down selectize box
arussell
parents:
diff changeset
82 });
22be4ea663a7 Trying to work out having json request from neo4j display properly in drop down selectize box
arussell
parents:
diff changeset
83 }
22be4ea663a7 Trying to work out having json request from neo4j display properly in drop down selectize box
arussell
parents:
diff changeset
84
22be4ea663a7 Trying to work out having json request from neo4j display properly in drop down selectize box
arussell
parents:
diff changeset
85 var selectize = $("#Supplier")[0].selectize;
22be4ea663a7 Trying to work out having json request from neo4j display properly in drop down selectize box
arussell
parents:
diff changeset
86 selectize.clear();
22be4ea663a7 Trying to work out having json request from neo4j display properly in drop down selectize box
arussell
parents:
diff changeset
87 selectize.clearOptions();
22be4ea663a7 Trying to work out having json request from neo4j display properly in drop down selectize box
arussell
parents:
diff changeset
88 selectize.load(function (callback) {
22be4ea663a7 Trying to work out having json request from neo4j display properly in drop down selectize box
arussell
parents:
diff changeset
89 callback(selectOptions);
22be4ea663a7 Trying to work out having json request from neo4j display properly in drop down selectize box
arussell
parents:
diff changeset
90 });
22be4ea663a7 Trying to work out having json request from neo4j display properly in drop down selectize box
arussell
parents:
diff changeset
91 }
22be4ea663a7 Trying to work out having json request from neo4j display properly in drop down selectize box
arussell
parents:
diff changeset
92 })
22be4ea663a7 Trying to work out having json request from neo4j display properly in drop down selectize box
arussell
parents:
diff changeset
93 };
22be4ea663a7 Trying to work out having json request from neo4j display properly in drop down selectize box
arussell
parents:
diff changeset
94
22be4ea663a7 Trying to work out having json request from neo4j display properly in drop down selectize box
arussell
parents:
diff changeset
95 $('#select-codex').selectize({
22be4ea663a7 Trying to work out having json request from neo4j display properly in drop down selectize box
arussell
parents:
diff changeset
96 valueField: 'title',
22be4ea663a7 Trying to work out having json request from neo4j display properly in drop down selectize box
arussell
parents:
diff changeset
97 labelField: 'title',
22be4ea663a7 Trying to work out having json request from neo4j display properly in drop down selectize box
arussell
parents:
diff changeset
98 searchField: 'title',
22be4ea663a7 Trying to work out having json request from neo4j display properly in drop down selectize box
arussell
parents:
diff changeset
99 options: [],
22be4ea663a7 Trying to work out having json request from neo4j display properly in drop down selectize box
arussell
parents:
diff changeset
100 create: false,
22be4ea663a7 Trying to work out having json request from neo4j display properly in drop down selectize box
arussell
parents:
diff changeset
101 render: {
22be4ea663a7 Trying to work out having json request from neo4j display properly in drop down selectize box
arussell
parents:
diff changeset
102 option: function(item, escape) {
22be4ea663a7 Trying to work out having json request from neo4j display properly in drop down selectize box
arussell
parents:
diff changeset
103 console.log(item[0].data.label);
22be4ea663a7 Trying to work out having json request from neo4j display properly in drop down selectize box
arussell
parents:
diff changeset
104 return '<div>' +
22be4ea663a7 Trying to work out having json request from neo4j display properly in drop down selectize box
arussell
parents:
diff changeset
105 '<span class="codex">' + escape(item.label) + '</span>' +
22be4ea663a7 Trying to work out having json request from neo4j display properly in drop down selectize box
arussell
parents:
diff changeset
106 '</div>';
22be4ea663a7 Trying to work out having json request from neo4j display properly in drop down selectize box
arussell
parents:
diff changeset
107 }
22be4ea663a7 Trying to work out having json request from neo4j display properly in drop down selectize box
arussell
parents:
diff changeset
108 },
22be4ea663a7 Trying to work out having json request from neo4j display properly in drop down selectize box
arussell
parents:
diff changeset
109 load: function(query, callback) {
22be4ea663a7 Trying to work out having json request from neo4j display properly in drop down selectize box
arussell
parents:
diff changeset
110 //if (!query.length) return callback();
22be4ea663a7 Trying to work out having json request from neo4j display properly in drop down selectize box
arussell
parents:
diff changeset
111 $.ajax({
22be4ea663a7 Trying to work out having json request from neo4j display properly in drop down selectize box
arussell
parents:
diff changeset
112 type: "POST",
22be4ea663a7 Trying to work out having json request from neo4j display properly in drop down selectize box
arussell
parents:
diff changeset
113 url: "https://ismi-dev.mpiwg-berlin.mpg.de/neo4j-ismi/db/data/cypher",
22be4ea663a7 Trying to work out having json request from neo4j display properly in drop down selectize box
arussell
parents:
diff changeset
114 accepts: "application/json",
22be4ea663a7 Trying to work out having json request from neo4j display properly in drop down selectize box
arussell
parents:
diff changeset
115 dataType: "json",
22be4ea663a7 Trying to work out having json request from neo4j display properly in drop down selectize box
arussell
parents:
diff changeset
116 data: {
22be4ea663a7 Trying to work out having json request from neo4j display properly in drop down selectize box
arussell
parents:
diff changeset
117 "query": "match (codex:CODEX) return codex limit 25",
22be4ea663a7 Trying to work out having json request from neo4j display properly in drop down selectize box
arussell
parents:
diff changeset
118 "params": {}
22be4ea663a7 Trying to work out having json request from neo4j display properly in drop down selectize box
arussell
parents:
diff changeset
119 },
22be4ea663a7 Trying to work out having json request from neo4j display properly in drop down selectize box
arussell
parents:
diff changeset
120 beforeSend: function (xhr) {
22be4ea663a7 Trying to work out having json request from neo4j display properly in drop down selectize box
arussell
parents:
diff changeset
121 xhr.setRequestHeader ("Authorization", "Basic " + btoa('neo4j' + ":" + 'neo5j'));
22be4ea663a7 Trying to work out having json request from neo4j display properly in drop down selectize box
arussell
parents:
diff changeset
122 },
22be4ea663a7 Trying to work out having json request from neo4j display properly in drop down selectize box
arussell
parents:
diff changeset
123 success: function (res, textStatus, jqXHR) {
22be4ea663a7 Trying to work out having json request from neo4j display properly in drop down selectize box
arussell
parents:
diff changeset
124 console.log("success");
22be4ea663a7 Trying to work out having json request from neo4j display properly in drop down selectize box
arussell
parents:
diff changeset
125 optionArray=[];
22be4ea663a7 Trying to work out having json request from neo4j display properly in drop down selectize box
arussell
parents:
diff changeset
126 res.data.forEach(function(arr) {
22be4ea663a7 Trying to work out having json request from neo4j display properly in drop down selectize box
arussell
parents:
diff changeset
127 optionArray.push(arr[0].data);
22be4ea663a7 Trying to work out having json request from neo4j display properly in drop down selectize box
arussell
parents:
diff changeset
128 });
22be4ea663a7 Trying to work out having json request from neo4j display properly in drop down selectize box
arussell
parents:
diff changeset
129 console.log(optionArray);
22be4ea663a7 Trying to work out having json request from neo4j display properly in drop down selectize box
arussell
parents:
diff changeset
130 callback(optionArray);
22be4ea663a7 Trying to work out having json request from neo4j display properly in drop down selectize box
arussell
parents:
diff changeset
131 },
22be4ea663a7 Trying to work out having json request from neo4j display properly in drop down selectize box
arussell
parents:
diff changeset
132 error: function (jqXHR, textStatus, errorThrown) {
22be4ea663a7 Trying to work out having json request from neo4j display properly in drop down selectize box
arussell
parents:
diff changeset
133 console.log("error");
22be4ea663a7 Trying to work out having json request from neo4j display properly in drop down selectize box
arussell
parents:
diff changeset
134 callback();
22be4ea663a7 Trying to work out having json request from neo4j display properly in drop down selectize box
arussell
parents:
diff changeset
135 }
22be4ea663a7 Trying to work out having json request from neo4j display properly in drop down selectize box
arussell
parents:
diff changeset
136 });
22be4ea663a7 Trying to work out having json request from neo4j display properly in drop down selectize box
arussell
parents:
diff changeset
137
22be4ea663a7 Trying to work out having json request from neo4j display properly in drop down selectize box
arussell
parents:
diff changeset
138 }
22be4ea663a7 Trying to work out having json request from neo4j display properly in drop down selectize box
arussell
parents:
diff changeset
139 });
22be4ea663a7 Trying to work out having json request from neo4j display properly in drop down selectize box
arussell
parents:
diff changeset
140
22be4ea663a7 Trying to work out having json request from neo4j display properly in drop down selectize box
arussell
parents:
diff changeset
141
22be4ea663a7 Trying to work out having json request from neo4j display properly in drop down selectize box
arussell
parents:
diff changeset
142
22be4ea663a7 Trying to work out having json request from neo4j display properly in drop down selectize box
arussell
parents:
diff changeset
143
22be4ea663a7 Trying to work out having json request from neo4j display properly in drop down selectize box
arussell
parents:
diff changeset
144 </script>
22be4ea663a7 Trying to work out having json request from neo4j display properly in drop down selectize box
arussell
parents:
diff changeset
145
22be4ea663a7 Trying to work out having json request from neo4j display properly in drop down selectize box
arussell
parents:
diff changeset
146 </body>
22be4ea663a7 Trying to work out having json request from neo4j display properly in drop down selectize box
arussell
parents:
diff changeset
147 </html>