add search stub, hide behind feature flag
This commit is contained in:
parent
fb782ffbaf
commit
1d91e94321
@ -14,6 +14,7 @@ type Config struct {
|
|||||||
Port int `json:"port"`
|
Port int `json:"port"`
|
||||||
EnablePrometheus bool `json:"enableprometheus"`
|
EnablePrometheus bool `json:"enableprometheus"`
|
||||||
EnableRendering bool `json:"enablerendering"`
|
EnableRendering bool `json:"enablerendering"`
|
||||||
|
EnableSearch bool `json:"enablesearch"`
|
||||||
EnableInitialRendering bool `json:"enableinitialrendering"`
|
EnableInitialRendering bool `json:"enableinitialrendering"`
|
||||||
EnableTransparency bool `json:"enabletransparency"`
|
EnableTransparency bool `json:"enabletransparency"`
|
||||||
Webdev bool `json:"webdev"`
|
Webdev bool `json:"webdev"`
|
||||||
@ -135,9 +136,9 @@ func ParseConfig(filename string) (*Config, error) {
|
|||||||
Travelnet: true,
|
Travelnet: true,
|
||||||
MapserverPlayer: true,
|
MapserverPlayer: true,
|
||||||
MapserverPOI: true,
|
MapserverPOI: true,
|
||||||
MapserverLabel: true,
|
MapserverLabel: false,
|
||||||
MapserverTrainline: true,
|
MapserverTrainline: true,
|
||||||
MapserverBorder: true,
|
MapserverBorder: false,
|
||||||
TileServerLegacy: true,
|
TileServerLegacy: true,
|
||||||
Mission: true,
|
Mission: true,
|
||||||
Jumpdrive: true,
|
Jumpdrive: true,
|
||||||
@ -164,6 +165,7 @@ func ParseConfig(filename string) (*Config, error) {
|
|||||||
Port: 8080,
|
Port: 8080,
|
||||||
EnableRendering: true,
|
EnableRendering: true,
|
||||||
EnablePrometheus: true,
|
EnablePrometheus: true,
|
||||||
|
EnableSearch: false,
|
||||||
EnableInitialRendering: true,
|
EnableInitialRendering: true,
|
||||||
EnableTransparency: false,
|
EnableTransparency: false,
|
||||||
Webdev: false,
|
Webdev: false,
|
||||||
|
7
server/static/css/bootstrap.min.css
vendored
Normal file
7
server/static/css/bootstrap.min.css
vendored
Normal file
File diff suppressed because one or more lines are too long
@ -15,3 +15,12 @@ body {
|
|||||||
background: #fff;
|
background: #fff;
|
||||||
padding: 5px;
|
padding: 5px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#search-menu {
|
||||||
|
position: absolute;
|
||||||
|
top: 20%;
|
||||||
|
bottom: 20%;
|
||||||
|
left: 20%;
|
||||||
|
right: 20%;
|
||||||
|
z-index: 99999;
|
||||||
|
}
|
||||||
|
@ -9,6 +9,7 @@
|
|||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div id="image-map"></div>
|
<div id="image-map"></div>
|
||||||
|
<div id="search-content"></div>
|
||||||
<script src="js/bundle.js"></script>
|
<script src="js/bundle.js"></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
22
server/static/js/SearchControl.js
Normal file
22
server/static/js/SearchControl.js
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
/* exported SearchControl */
|
||||||
|
|
||||||
|
var SearchControl = L.Control.extend({
|
||||||
|
initialize: function(wsChannel, opts) {
|
||||||
|
L.Control.prototype.initialize.call(this, opts);
|
||||||
|
},
|
||||||
|
|
||||||
|
onAdd: function() {
|
||||||
|
var div = L.DomUtil.create('div', 'leaflet-bar leaflet-custom-display');
|
||||||
|
|
||||||
|
var View = {
|
||||||
|
view: function(){
|
||||||
|
return m("input[type=text]", { placeholder: "Search", class: "form-control" });
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
m.mount(div, SearchInput);
|
||||||
|
m.mount(document.getElementById("search-content"), SearchMenu);
|
||||||
|
|
||||||
|
return div;
|
||||||
|
}
|
||||||
|
});
|
@ -34,11 +34,17 @@ api.getConfig().then(function(cfg){
|
|||||||
//All overlays
|
//All overlays
|
||||||
Overlaysetup(cfg, map, overlays, wsChannel, layerMgr);
|
Overlaysetup(cfg, map, overlays, wsChannel, layerMgr);
|
||||||
|
|
||||||
L.control.layers(layers, overlays).addTo(map);
|
|
||||||
|
|
||||||
new CoordinatesDisplay({ position: 'bottomleft' }).addTo(map);
|
new CoordinatesDisplay({ position: 'bottomleft' }).addTo(map);
|
||||||
new WorldInfoDisplay(wsChannel, { position: 'bottomright' }).addTo(map);
|
new WorldInfoDisplay(wsChannel, { position: 'bottomright' }).addTo(map);
|
||||||
|
|
||||||
|
if (cfg.enablesearch){
|
||||||
|
new SearchControl(wsChannel, { position: 'topright' }).addTo(map);
|
||||||
|
}
|
||||||
|
|
||||||
|
//layer control
|
||||||
|
L.control.layers(layers, overlays, { position: "topright" }).addTo(map);
|
||||||
|
|
||||||
Hashroute.setup(map, layerMgr);
|
Hashroute.setup(map, layerMgr);
|
||||||
|
|
||||||
}).catch(function(e){
|
}).catch(function(e){
|
||||||
|
10
server/static/js/search/SearchInput.js
Normal file
10
server/static/js/search/SearchInput.js
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
|
||||||
|
var SearchInput = {
|
||||||
|
view: function(){
|
||||||
|
function handleInput(e){
|
||||||
|
SearchStore.search = e.target.value;
|
||||||
|
}
|
||||||
|
|
||||||
|
return m("input[type=text]", { placeholder: "Search", class: "form-control", oninput: handleInput });
|
||||||
|
}
|
||||||
|
}
|
16
server/static/js/search/SearchMenu.js
Normal file
16
server/static/js/search/SearchMenu.js
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
|
||||||
|
|
||||||
|
var SearchMenu = {
|
||||||
|
view: function(){
|
||||||
|
var style = {};
|
||||||
|
|
||||||
|
if (!SearchStore.search) {
|
||||||
|
style.display = "none";
|
||||||
|
}
|
||||||
|
|
||||||
|
return m("div", { class: "card", id: "search-menu", style: style }, [
|
||||||
|
m("div", { class: "card-header" }, "Search"),
|
||||||
|
m("div", { class: "card-body" })
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
4
server/static/js/search/SearchStore.js
Normal file
4
server/static/js/search/SearchStore.js
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
|
||||||
|
var SearchStore = {
|
||||||
|
search: ""
|
||||||
|
};
|
@ -9,8 +9,12 @@
|
|||||||
"/js/SimpleCRS.js",
|
"/js/SimpleCRS.js",
|
||||||
"/js/WebSocketChannel.js",
|
"/js/WebSocketChannel.js",
|
||||||
"/js/RealtimeTileLayer.js",
|
"/js/RealtimeTileLayer.js",
|
||||||
|
"/js/SearchControl.js",
|
||||||
"/js/CoordinatesDisplay.js",
|
"/js/CoordinatesDisplay.js",
|
||||||
"/js/WorldInfoDisplay.js",
|
"/js/WorldInfoDisplay.js",
|
||||||
|
"/js/search/SearchStore.js",
|
||||||
|
"/js/search/SearchMenu.js",
|
||||||
|
"/js/search/SearchInput.js",
|
||||||
"/js/overlays/AbstractIconOverlay.js",
|
"/js/overlays/AbstractIconOverlay.js",
|
||||||
"/js/overlays/AbstractGeoJsonOverlay.js",
|
"/js/overlays/AbstractGeoJsonOverlay.js",
|
||||||
"/js/overlays/TravelnetOverlay.js",
|
"/js/overlays/TravelnetOverlay.js",
|
||||||
@ -36,6 +40,7 @@
|
|||||||
"/js/main.js"
|
"/js/main.js"
|
||||||
],
|
],
|
||||||
"styles": [
|
"styles": [
|
||||||
|
"/css/bootstrap.min.css",
|
||||||
"/css/leaflet.css",
|
"/css/leaflet.css",
|
||||||
"/css/custom.css"
|
"/css/custom.css"
|
||||||
]
|
]
|
||||||
|
@ -13,6 +13,7 @@ type PublicConfig struct {
|
|||||||
Layers []*layer.Layer `json:"layers"`
|
Layers []*layer.Layer `json:"layers"`
|
||||||
MapObjects *app.MapObjectConfig `json:"mapobjects"`
|
MapObjects *app.MapObjectConfig `json:"mapobjects"`
|
||||||
DefaultOverlays []string `json:"defaultoverlays"`
|
DefaultOverlays []string `json:"defaultoverlays"`
|
||||||
|
EnableSearch bool `json:"enablesearch"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type ConfigHandler struct {
|
type ConfigHandler struct {
|
||||||
@ -27,6 +28,7 @@ func (h *ConfigHandler) ServeHTTP(resp http.ResponseWriter, req *http.Request) {
|
|||||||
webcfg.MapObjects = h.ctx.Config.MapObjects
|
webcfg.MapObjects = h.ctx.Config.MapObjects
|
||||||
webcfg.Version = app.Version
|
webcfg.Version = app.Version
|
||||||
webcfg.DefaultOverlays = h.ctx.Config.DefaultOverlays
|
webcfg.DefaultOverlays = h.ctx.Config.DefaultOverlays
|
||||||
|
webcfg.EnableSearch = h.ctx.Config.EnableSearch
|
||||||
|
|
||||||
json.NewEncoder(resp).Encode(webcfg)
|
json.NewEncoder(resp).Encode(webcfg)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user