Repository navigation
Expand file tree
/
Copy pathnavigation.js
More file actions
74 lines (66 loc) · 3.17 KB
/
Copy pathnavigation.js
File metadata and controls
74 lines (66 loc) · 3.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
window.onload = function () {
navigation(document.getElementById("navigation"));
}
async function navigation(selector) {
html =
'<div class="sidebar">' +
'<div class="top-row ps-3 navbar navbar-dark" style="height:180px;width:170px;justify-content:left">' +
'<a class="navbar-brand" style="color:black" href="http://www.couchbase.com" target="_blank"> Couchbase</a>' +
'<img src="favicon.ico"/>' +
'</div>' +
'<div class="@NavMenuCssClass nav-scrollable" @onclick="ToggleNavMenu">' +
'<nav class="flex-column">' +
'<div class="nav-item px-3">' +
'<a class="nav-link" style="color:black;" HREF="#" ' +
'onClick="parent.right.location=\'welcome.html\'">Welcome</a>' +
'</div>';
let connected = await fetch(
'api/hotels/byid/hotel_10180/', {headers: {"Content-Type": "application/json"}, method: "GET"})
.then(response => response.json())
.then((json) => {
return json.context === undefined ? false : (json.context.length == 0 || json.context[0] !== 'Not Connected');
}
);
if (connected) {
html = html +
'<div class="nav-item px-3">' +
'<a class="nav-link" style="color:black;" HREF="#" ' +
'onClick="parent.right.location=\'keyvalue.html\'">Key Value</a>' +
'</div>' +
'<div class="nav-item px-3">' +
'<a class="nav-link" style="color:black;" HREF="#" ' +
'onClick="parent.right.location=\'query.html\'">Query</a>' +
'</div>';
let hasFtsIndex = await fetch(
'api/hotels/pool/California/', {headers: {"Content-Type": "application/json"}, method: "GET"})
.then(response => response.json())
.then((json) => {
return json.context === undefined ? false : (json.context.length == 0 || json.context[0] !== 'Not Connected');
}
);
if (hasFtsIndex) {
html = html + ('<div class="nav-item px-3">' +
'<a class="nav-link" style="color:black;" HREF="#" ' +
'onClick="parent.right.location=\'fts.html\'">Full Text</a>' +
'</div>');
} else {
html = html +
'<div class="nav-item px-3">' +
'<a class="nav-link" style="color:black;" href="https://github.com/couchbase-examples/starter-kit-java#getting-started" target="_blank">' +
'<span class="oi oi-plus" aria-hidden="true"></span>No FTS Index<br>See instructions here' +
'</a>' +
'</div>';
}
} else {
html = html +
'<div class="nav-item px-3">' +
'<a class="nav-link" style="color:black;" href="https://github.com/couchbase-examples/starter-kit-java#getting-started" target="_blank">' +
'<span class="oi oi-plus" aria-hidden="true"></span>Not Connected<br>See instructions here' +
'</a>' +
'</div>';
}
html = html + '</nav>' + // class=flex-column
'</div>' + // class=@NavMenuCssClass
'</div>'; // sidebar
$(selector).html(html);
}