Commit 62bd592c authored by Piotr Gawron's avatar Piotr Gawron
Browse files

api call that provides overlay type list

parent 8709e869
......@@ -258,6 +258,15 @@ ServerConnector.getOverlaysUrl = function(projectId, token) {
});
};
ServerConnector.getOverlayTypesUrl = function(params) {
return this.getApiUrl({type:"overlay",
method: "getOverlayTypes",
params: {
token: params.token,
},
});
};
ServerConnector.getCommentsUrl = function(params) {
var elementId = params.elementId;
var elementType = params.elementType;
......@@ -1069,7 +1078,25 @@ ServerConnector.getSuggestedQueryList = function(projectId) {
}).then(function(token) {
return self.sendPostRequest(self.getSuggestedQueryListUrl(),{projectId:projectId,token:token});
}).then(function(content) {
resolve(JSON.parse(content));
resolve(JSON.parse(content));
}).catch(function(exception){
reject(exception);
});
});
};
ServerConnector.getOverlayTypes = function() {
var self = this;
return new Promise(function(resolve, reject) {
return self.getToken().then(function(token) {
return self.readFile(self.getOverlayTypesUrl({token:token}));
}).then(function(content) {
var obj = JSON.parse(content);
var result = [];
for (var i=0;i<obj.length;i++) {
result.push(obj[i].name);
}
resolve(result);
}).catch(function(exception){
reject(exception);
});
......
......@@ -205,7 +205,12 @@ OverlayPanel.prototype.refresh = function() {
var self = this;
var user = null;
return ServerConnector.getLoggedUser().then(function(loggedUser) {
var overlayTypes = [];
return ServerConnector.getOverlayTypes().then(function(types) {
overlayTypes = types;
return ServerConnector.getLoggedUser();
}).then(function(loggedUser) {
user = loggedUser;
return ServerConnector.getOverlays();
}).then(function(customOverlays) {
......@@ -258,6 +263,7 @@ OverlayPanel.prototype.refresh = function() {
body.appendChild(self.createOverlayRow(overlay, selectedOverlay[overlay.getId()]));
}
}
return null;
});
};
......
[
{
"name": "GENERIC"
},
{
"name": "GENETIC_VARIANT"
}
]
\ No newline at end of file
......@@ -33,6 +33,12 @@ public class OverlayController extends BaseController {
return overlayController.getOverlayList(token, projectId);
}
@RequestMapping(value = "/getOverlayTypes", method = { RequestMethod.GET }, produces = { MediaType.APPLICATION_JSON_VALUE })
public List<Map<String,Object>> getOverlayTypes(@RequestParam(value = "token") String token)
throws SecurityException, QueryException {
return overlayController.getOverlayTypes(token);
}
@RequestMapping(value = "/getOverlayById", method = { RequestMethod.GET }, produces = { MediaType.APPLICATION_JSON_VALUE })
public LayoutView getOverlayById(@RequestParam(value = "token") String token, @RequestParam(value = "projectId") String projectId,
@RequestParam(value = "overlayId") String overlayId) throws SecurityException, QueryException {
......
......@@ -261,4 +261,14 @@ public class OverlayRestImpl extends BaseRestImpl {
}
public List<Map<String, Object>> getOverlayTypes(String token) {
List<Map<String, Object>> result = new ArrayList<>();
for (ColorSchemaType type : ColorSchemaType.values()) {
Map<String, Object> map = new HashMap<>();
map.put("name", type.name());
result.add(map);
}
return result;
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment