separated ajax and api calls
This commit is contained in:
parent
4335f420df
commit
67ec5bc368
|
@ -17,7 +17,7 @@ import eu.dnetlib.is.resource.model.ResourceType;
|
||||||
import eu.dnetlib.is.resource.repository.ResourceTypeRepository;
|
import eu.dnetlib.is.resource.repository.ResourceTypeRepository;
|
||||||
import eu.dnetlib.is.vocabulary.model.Vocabulary;
|
import eu.dnetlib.is.vocabulary.model.Vocabulary;
|
||||||
import eu.dnetlib.is.vocabulary.repository.VocabularyRepository;
|
import eu.dnetlib.is.vocabulary.repository.VocabularyRepository;
|
||||||
import eu.dnetlib.is.wfs.WfHistoryRestController;
|
import eu.dnetlib.is.wfs.WfHistoryAjaxController;
|
||||||
|
|
||||||
@Controller
|
@Controller
|
||||||
public class MainController {
|
public class MainController {
|
||||||
|
@ -76,7 +76,7 @@ public class MainController {
|
||||||
public void wfHistory(final ModelMap map,
|
public void wfHistory(final ModelMap map,
|
||||||
@RequestParam(required = false, defaultValue = "-1") final Long from,
|
@RequestParam(required = false, defaultValue = "-1") final Long from,
|
||||||
@RequestParam(required = false, defaultValue = "-1") final Long to) {
|
@RequestParam(required = false, defaultValue = "-1") final Long to) {
|
||||||
map.put("maxNumberOfRecentWfs", WfHistoryRestController.MAX_NUMBER_OF_RECENT_WFS);
|
map.put("maxNumberOfRecentWfs", WfHistoryAjaxController.MAX_NUMBER_OF_RECENT_WFS);
|
||||||
map.put("fromDate", from);
|
map.put("fromDate", from);
|
||||||
map.put("toDate", to);
|
map.put("toDate", to);
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,21 @@
|
||||||
|
package eu.dnetlib.is.context;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
|
||||||
|
import eu.dnetlib.common.controller.AbstractDnetController;
|
||||||
|
import eu.dnetlib.is.context.model.Context;
|
||||||
|
|
||||||
|
public class AbstractContextController extends AbstractDnetController {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
protected ContextService contextService;
|
||||||
|
|
||||||
|
@GetMapping("/")
|
||||||
|
public List<Context> listContexts() {
|
||||||
|
return contextService.listContexts();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -1,43 +1,24 @@
|
||||||
package eu.dnetlib.is.context;
|
package eu.dnetlib.is.context;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
import com.fasterxml.jackson.databind.node.ObjectNode;
|
|
||||||
|
|
||||||
import eu.dnetlib.common.controller.AbstractDnetController;
|
|
||||||
import eu.dnetlib.is.context.model.Category;
|
import eu.dnetlib.is.context.model.Category;
|
||||||
import eu.dnetlib.is.context.model.Context;
|
import eu.dnetlib.is.context.model.Context;
|
||||||
import eu.dnetlib.is.context.model.CtxChildInfo;
|
import eu.dnetlib.is.context.model.CtxChildInfo;
|
||||||
import eu.dnetlib.is.util.InformationServiceException;
|
import eu.dnetlib.is.util.InformationServiceException;
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/api/contexts")
|
@RequestMapping("/ajax/contexts")
|
||||||
public class ContextRestController extends AbstractDnetController {
|
public class ContextAjaxController extends AbstractContextController {
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private ContextService contextService;
|
|
||||||
|
|
||||||
@GetMapping("/")
|
|
||||||
public List<Context> listContexts() {
|
|
||||||
return contextService.listContexts();
|
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping("/{ctxId}")
|
@GetMapping("/{ctxId}")
|
||||||
public Context getContext(@PathVariable final String ctxId) throws InformationServiceException {
|
public Context getContext(@PathVariable final String ctxId) throws InformationServiceException {
|
||||||
return contextService.getContext(ctxId);
|
return contextService.getContext(ctxId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/{ctxId}/full")
|
|
||||||
public ObjectNode getContextFull(@PathVariable final String ctxId) throws InformationServiceException {
|
|
||||||
return contextService.getContextFull(ctxId);
|
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping("/{parent}/categories")
|
@GetMapping("/{parent}/categories")
|
||||||
public Iterable<Category> listCategories(@PathVariable final String parent) {
|
public Iterable<Category> listCategories(@PathVariable final String parent) {
|
||||||
return contextService.listCategories(parent);
|
return contextService.listCategories(parent);
|
|
@ -0,0 +1,21 @@
|
||||||
|
package eu.dnetlib.is.context;
|
||||||
|
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.databind.node.ObjectNode;
|
||||||
|
|
||||||
|
import eu.dnetlib.is.util.InformationServiceException;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/api/contexts")
|
||||||
|
public class ContextApiController extends AbstractContextController {
|
||||||
|
|
||||||
|
@GetMapping("/{ctxId}")
|
||||||
|
public ObjectNode getContextFull(@PathVariable final String ctxId) throws InformationServiceException {
|
||||||
|
return contextService.getContextFull(ctxId);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -33,8 +33,8 @@ import org.springframework.web.bind.annotation.RestController;
|
||||||
import eu.dnetlib.common.controller.AbstractDnetController;
|
import eu.dnetlib.common.controller.AbstractDnetController;
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/api/info")
|
@RequestMapping("/ajax/info")
|
||||||
public class InfoRestController extends AbstractDnetController {
|
public class InfoAjaxController extends AbstractDnetController {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private ConfigurableEnvironment configurableEnvironment;
|
private ConfigurableEnvironment configurableEnvironment;
|
||||||
|
@ -44,7 +44,7 @@ public class InfoRestController extends AbstractDnetController {
|
||||||
|
|
||||||
private final RuntimeMXBean mxbean = ManagementFactory.getRuntimeMXBean();
|
private final RuntimeMXBean mxbean = ManagementFactory.getRuntimeMXBean();
|
||||||
|
|
||||||
private static final Log log = LogFactory.getLog(InfoRestController.class);
|
private static final Log log = LogFactory.getLog(InfoAjaxController.class);
|
||||||
|
|
||||||
@GetMapping("/")
|
@GetMapping("/")
|
||||||
public List<InfoSection<?>> info() throws Exception {
|
public List<InfoSection<?>> info() throws Exception {
|
|
@ -0,0 +1,53 @@
|
||||||
|
package eu.dnetlib.is.resources;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.nio.charset.StandardCharsets;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
|
import org.apache.commons.io.IOUtils;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.http.MediaType;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
|
|
||||||
|
import eu.dnetlib.common.controller.AbstractDnetController;
|
||||||
|
import eu.dnetlib.is.resource.model.SimpleResource;
|
||||||
|
import eu.dnetlib.is.util.InformationServiceException;
|
||||||
|
import eu.dnetlib.is.util.XmlIndenter;
|
||||||
|
|
||||||
|
public class AbstractResourceController extends AbstractDnetController {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
protected SimpleResourceService service;
|
||||||
|
|
||||||
|
@GetMapping("/")
|
||||||
|
public List<SimpleResource> listResources(@RequestParam final String type) {
|
||||||
|
return service.listResources(type);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/{id}/metadata")
|
||||||
|
public SimpleResource getMetadata(@PathVariable final String id) throws InformationServiceException {
|
||||||
|
return service.getMetadata(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/{id}/content")
|
||||||
|
public void getContent(@PathVariable final String id, final HttpServletResponse res) throws InformationServiceException {
|
||||||
|
final String ctype = service.getContentType(id);
|
||||||
|
|
||||||
|
res.setCharacterEncoding(StandardCharsets.UTF_8.name());
|
||||||
|
res.setContentType(ctype);
|
||||||
|
|
||||||
|
final String content =
|
||||||
|
ctype.equals(MediaType.APPLICATION_XML_VALUE) ? XmlIndenter.indent(service.getContent(id)) : service.getContent(id);
|
||||||
|
|
||||||
|
try {
|
||||||
|
IOUtils.write(content, res.getOutputStream(), StandardCharsets.UTF_8.name());
|
||||||
|
} catch (final IOException e) {
|
||||||
|
throw new InformationServiceException("Error retrieving content", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -2,16 +2,12 @@ package eu.dnetlib.is.resources;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
|
||||||
|
|
||||||
import org.apache.commons.io.IOUtils;
|
import org.apache.commons.io.IOUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.http.MediaType;
|
import org.springframework.http.MediaType;
|
||||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
@ -19,22 +15,12 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
import eu.dnetlib.common.controller.AbstractDnetController;
|
|
||||||
import eu.dnetlib.is.resource.model.SimpleResource;
|
import eu.dnetlib.is.resource.model.SimpleResource;
|
||||||
import eu.dnetlib.is.util.InformationServiceException;
|
import eu.dnetlib.is.util.InformationServiceException;
|
||||||
import eu.dnetlib.is.util.XmlIndenter;
|
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/api/resources")
|
@RequestMapping("/ajax/resources")
|
||||||
public class ResourcesRestController extends AbstractDnetController {
|
public class ResourceAjaxController extends AbstractResourceController {
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private SimpleResourceService service;
|
|
||||||
|
|
||||||
@GetMapping("/")
|
|
||||||
public List<SimpleResource> listResources(@RequestParam final String type) {
|
|
||||||
return service.listResources(type);
|
|
||||||
}
|
|
||||||
|
|
||||||
@PostMapping("/")
|
@PostMapping("/")
|
||||||
public SimpleResource newResource(@RequestParam final String name,
|
public SimpleResource newResource(@RequestParam final String name,
|
||||||
|
@ -51,28 +37,6 @@ public class ResourcesRestController extends AbstractDnetController {
|
||||||
service.deleteResource(id);
|
service.deleteResource(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/{id}/metadata")
|
|
||||||
public SimpleResource getMetadata(@PathVariable final String id) throws InformationServiceException {
|
|
||||||
return service.getMetadata(id);
|
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping("/{id}/content")
|
|
||||||
public void getContent(@PathVariable final String id, final HttpServletResponse res) throws InformationServiceException {
|
|
||||||
final String ctype = service.getContentType(id);
|
|
||||||
|
|
||||||
res.setCharacterEncoding(StandardCharsets.UTF_8.name());
|
|
||||||
res.setContentType(ctype);
|
|
||||||
|
|
||||||
final String content =
|
|
||||||
ctype.equals(MediaType.APPLICATION_XML_VALUE) ? XmlIndenter.indent(service.getContent(id)) : service.getContent(id);
|
|
||||||
|
|
||||||
try {
|
|
||||||
IOUtils.write(content, res.getOutputStream(), StandardCharsets.UTF_8.name());
|
|
||||||
} catch (final IOException e) {
|
|
||||||
throw new InformationServiceException("Error retrieving content", e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@PostMapping("/{id}/metadata")
|
@PostMapping("/{id}/metadata")
|
||||||
public void saveMetadata(@PathVariable final String id, @RequestBody final SimpleResource r) throws InformationServiceException {
|
public void saveMetadata(@PathVariable final String id, @RequestBody final SimpleResource r) throws InformationServiceException {
|
||||||
service.saveMetadata(id, r);
|
service.saveMetadata(id, r);
|
|
@ -0,0 +1,10 @@
|
||||||
|
package eu.dnetlib.is.resources;
|
||||||
|
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/api/resources")
|
||||||
|
public class ResourceApiController extends AbstractResourceController {
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,27 @@
|
||||||
|
package eu.dnetlib.is.vocabulary;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
|
|
||||||
|
import eu.dnetlib.common.controller.AbstractDnetController;
|
||||||
|
import eu.dnetlib.is.vocabulary.model.Vocabulary;
|
||||||
|
import eu.dnetlib.is.vocabulary.model.VocabularyTerm;
|
||||||
|
|
||||||
|
public class AbstractVocabularyController extends AbstractDnetController {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
protected VocabularyService vocabularyService;
|
||||||
|
|
||||||
|
@GetMapping("/")
|
||||||
|
public List<Vocabulary> listVocs() {
|
||||||
|
return vocabularyService.listVocs();
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/{vocabulary}/terms")
|
||||||
|
public Iterable<VocabularyTerm> listTerms(@PathVariable final String vocabulary) {
|
||||||
|
return vocabularyService.listTerms(vocabulary);
|
||||||
|
}
|
||||||
|
}
|
|
@ -2,7 +2,6 @@ package eu.dnetlib.is.vocabulary;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
|
@ -11,22 +10,13 @@ import org.springframework.web.bind.annotation.RequestBody;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
import eu.dnetlib.common.controller.AbstractDnetController;
|
|
||||||
import eu.dnetlib.is.util.InformationServiceException;
|
import eu.dnetlib.is.util.InformationServiceException;
|
||||||
import eu.dnetlib.is.vocabulary.model.Vocabulary;
|
import eu.dnetlib.is.vocabulary.model.Vocabulary;
|
||||||
import eu.dnetlib.is.vocabulary.model.VocabularyTerm;
|
import eu.dnetlib.is.vocabulary.model.VocabularyTerm;
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/api/vocs")
|
@RequestMapping("/ajax/vocs")
|
||||||
public class VocabularyRestController extends AbstractDnetController {
|
public class VocabularyAjaxController extends AbstractVocabularyController {
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private VocabularyService vocabularyService;
|
|
||||||
|
|
||||||
@GetMapping("/")
|
|
||||||
public List<Vocabulary> listVocs() {
|
|
||||||
return vocabularyService.listVocs();
|
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping("/{vocabulary}")
|
@GetMapping("/{vocabulary}")
|
||||||
public Vocabulary getVoc(@PathVariable final String vocabulary) throws InformationServiceException {
|
public Vocabulary getVoc(@PathVariable final String vocabulary) throws InformationServiceException {
|
||||||
|
@ -45,11 +35,6 @@ public class VocabularyRestController extends AbstractDnetController {
|
||||||
return vocabularyService.listVocs();
|
return vocabularyService.listVocs();
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/{vocabulary}/terms")
|
|
||||||
public Iterable<VocabularyTerm> listTerms(@PathVariable final String vocabulary) {
|
|
||||||
return vocabularyService.listTerms(vocabulary);
|
|
||||||
}
|
|
||||||
|
|
||||||
@PostMapping("/{vocabulary}/terms")
|
@PostMapping("/{vocabulary}/terms")
|
||||||
public Iterable<VocabularyTerm> saveTerm(@PathVariable final String vocabulary, @RequestBody final VocabularyTerm term) {
|
public Iterable<VocabularyTerm> saveTerm(@PathVariable final String vocabulary, @RequestBody final VocabularyTerm term) {
|
||||||
vocabularyService.saveTerms(vocabulary, term);
|
vocabularyService.saveTerms(vocabulary, term);
|
|
@ -0,0 +1,10 @@
|
||||||
|
package eu.dnetlib.is.vocabulary;
|
||||||
|
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/api/vocs")
|
||||||
|
public class VocabularyApiController extends AbstractVocabularyController {
|
||||||
|
|
||||||
|
}
|
|
@ -16,8 +16,8 @@ import eu.dnetlib.is.wf.model.WfProcessExecution;
|
||||||
import eu.dnetlib.is.wf.repository.WfProcessExecutionRepository;
|
import eu.dnetlib.is.wf.repository.WfProcessExecutionRepository;
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/api/wfs")
|
@RequestMapping("/ajax/wfs")
|
||||||
public class WfHistoryRestController {
|
public class WfHistoryAjaxController {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private WfProcessExecutionRepository wfProcessExecutionRepository;
|
private WfProcessExecutionRepository wfProcessExecutionRepository;
|
|
@ -6,7 +6,7 @@ app.controller('contextController', function($scope, $http, $location) {
|
||||||
$scope.parameters = [];
|
$scope.parameters = [];
|
||||||
|
|
||||||
$scope.reload = function() {
|
$scope.reload = function() {
|
||||||
$scope.url = './api/contexts/' + encodeURIComponent($scope.ctxId) + '/categories';
|
$scope.url = './ajax/contexts/' + encodeURIComponent($scope.ctxId) + '/categories';
|
||||||
|
|
||||||
$http.get($scope.url + '?' + $.now()).then(function successCallback(res) {
|
$http.get($scope.url + '?' + $.now()).then(function successCallback(res) {
|
||||||
$scope.categories = res.data;
|
$scope.categories = res.data;
|
||||||
|
@ -17,7 +17,7 @@ app.controller('contextController', function($scope, $http, $location) {
|
||||||
|
|
||||||
$scope.loadContextParameters = function() {
|
$scope.loadContextParameters = function() {
|
||||||
$scope.parameters = [];
|
$scope.parameters = [];
|
||||||
$http.get('./api/contexts/' + encodeURIComponent($scope.ctxId) + '?' + $.now()).then(function successCallback(res) {
|
$http.get('./ajax/contexts/' + encodeURIComponent($scope.ctxId) + '?' + $.now()).then(function successCallback(res) {
|
||||||
$scope.parameters = res.data.parameters;
|
$scope.parameters = res.data.parameters;
|
||||||
}, function errorCallback(res) {
|
}, function errorCallback(res) {
|
||||||
alert('ERROR: ' + res.data.message);
|
alert('ERROR: ' + res.data.message);
|
||||||
|
@ -27,7 +27,7 @@ app.controller('contextController', function($scope, $http, $location) {
|
||||||
|
|
||||||
|
|
||||||
$scope.populateNode = function(level, node) {
|
$scope.populateNode = function(level, node) {
|
||||||
$scope.url = './api/contexts/'
|
$scope.url = './ajax/contexts/'
|
||||||
+ encodeURIComponent(level)
|
+ encodeURIComponent(level)
|
||||||
+ '/'
|
+ '/'
|
||||||
+ encodeURIComponent(node.id)
|
+ encodeURIComponent(node.id)
|
||||||
|
|
|
@ -6,7 +6,7 @@ app.controller('contextsController', function($scope, $http) {
|
||||||
$scope.mode = '';
|
$scope.mode = '';
|
||||||
|
|
||||||
$scope.reload = function() {
|
$scope.reload = function() {
|
||||||
$http.get('./api/contexts/?' + $.now()).then(function successCallback(res) {
|
$http.get('./ajax/contexts/?' + $.now()).then(function successCallback(res) {
|
||||||
$scope.contexts = res.data;
|
$scope.contexts = res.data;
|
||||||
}, function errorCallback(res) {
|
}, function errorCallback(res) {
|
||||||
alert('ERROR: ' + res.data.message);
|
alert('ERROR: ' + res.data.message);
|
||||||
|
@ -43,7 +43,7 @@ app.controller('contextsController', function($scope, $http) {
|
||||||
}
|
}
|
||||||
|
|
||||||
$http.defaults.headers.post["Content-Type"] = "application/json;charset=UTF-8";
|
$http.defaults.headers.post["Content-Type"] = "application/json;charset=UTF-8";
|
||||||
$http.post('./api/contexts/?' + $.now(), ctx).then(function successCallback(res) {
|
$http.post('./ajax/contexts/?' + $.now(), ctx).then(function successCallback(res) {
|
||||||
$scope.contexts = res.data;
|
$scope.contexts = res.data;
|
||||||
alert("Context saved");
|
alert("Context saved");
|
||||||
}, function errorCallback(res) {
|
}, function errorCallback(res) {
|
||||||
|
@ -53,7 +53,7 @@ app.controller('contextsController', function($scope, $http) {
|
||||||
|
|
||||||
$scope.deleteContext = function(id) {
|
$scope.deleteContext = function(id) {
|
||||||
if (confirm("Are you sure ?")) {
|
if (confirm("Are you sure ?")) {
|
||||||
$http.delete('./api/contexts/' + encodeURIComponent(id) + '?' + $.now()).then(function successCallback(res) {
|
$http.delete('./ajax/contexts/' + encodeURIComponent(id) + '?' + $.now()).then(function successCallback(res) {
|
||||||
$scope.contexts = res.data;
|
$scope.contexts = res.data;
|
||||||
alert("Context deleted");
|
alert("Context deleted");
|
||||||
}, function errorCallback(res) {
|
}, function errorCallback(res) {
|
||||||
|
|
|
@ -7,7 +7,7 @@ app.controller('resourcesController', function($scope, $http) {
|
||||||
$scope.type = typeId();
|
$scope.type = typeId();
|
||||||
|
|
||||||
$scope.reload = function() {
|
$scope.reload = function() {
|
||||||
$http.get('./api/resources/?type=' + $scope.type + '&' + $.now()).then(function successCallback(res) {
|
$http.get('./ajax/resources/?type=' + $scope.type + '&' + $.now()).then(function successCallback(res) {
|
||||||
$scope.resources = res.data;
|
$scope.resources = res.data;
|
||||||
}, function errorCallback(res) {
|
}, function errorCallback(res) {
|
||||||
alert('ERROR: ' + res.data.message);
|
alert('ERROR: ' + res.data.message);
|
||||||
|
@ -29,7 +29,7 @@ app.controller('resourcesController', function($scope, $http) {
|
||||||
$scope.prepareEditContent = function(r) {
|
$scope.prepareEditContent = function(r) {
|
||||||
$scope.tmpRes = angular.copy(r);
|
$scope.tmpRes = angular.copy(r);
|
||||||
$scope.tmpContent = "loading...";
|
$scope.tmpContent = "loading...";
|
||||||
$http.get('./api/resources/' + r.id + '/content?' + $.now()).then(function successCallback(res) {
|
$http.get('./ajax/resources/' + r.id + '/content?' + $.now()).then(function successCallback(res) {
|
||||||
if (res.data instanceof Object) {
|
if (res.data instanceof Object) {
|
||||||
$scope.tmpContent = JSON.stringify(res.data, null, "\t");
|
$scope.tmpContent = JSON.stringify(res.data, null, "\t");
|
||||||
} else {
|
} else {
|
||||||
|
@ -42,7 +42,7 @@ app.controller('resourcesController', function($scope, $http) {
|
||||||
|
|
||||||
$scope.createNewResource = function(r) {
|
$scope.createNewResource = function(r) {
|
||||||
$http.defaults.headers.post["Content-Type"] = "application/x-www-form-urlencoded; charset=UTF-8";
|
$http.defaults.headers.post["Content-Type"] = "application/x-www-form-urlencoded; charset=UTF-8";
|
||||||
$http.post('./api/resources/?' + $.now(), $.param({
|
$http.post('./ajax/resources/?' + $.now(), $.param({
|
||||||
'name' : r.name,
|
'name' : r.name,
|
||||||
'type' : $scope.type,
|
'type' : $scope.type,
|
||||||
'description' : r.description,
|
'description' : r.description,
|
||||||
|
@ -57,7 +57,7 @@ app.controller('resourcesController', function($scope, $http) {
|
||||||
|
|
||||||
$scope.saveMetadata = function(id, md) {
|
$scope.saveMetadata = function(id, md) {
|
||||||
$http.defaults.headers.post["Content-Type"] = "application/json;charset=UTF-8";
|
$http.defaults.headers.post["Content-Type"] = "application/json;charset=UTF-8";
|
||||||
$http.post('./api/resources/' + id + '/metadata?' + $.now(), md).then(function successCallback(res) {
|
$http.post('./ajax/resources/' + id + '/metadata?' + $.now(), md).then(function successCallback(res) {
|
||||||
alert("Resource saved");
|
alert("Resource saved");
|
||||||
$scope.reload();
|
$scope.reload();
|
||||||
}, function errorCallback(res) {
|
}, function errorCallback(res) {
|
||||||
|
@ -67,7 +67,7 @@ app.controller('resourcesController', function($scope, $http) {
|
||||||
|
|
||||||
$scope.saveContent = function(id, content) {
|
$scope.saveContent = function(id, content) {
|
||||||
$http.defaults.headers.post["Content-Type"] = "application/x-www-form-urlencoded; charset=UTF-8";
|
$http.defaults.headers.post["Content-Type"] = "application/x-www-form-urlencoded; charset=UTF-8";
|
||||||
$http.post('./api/resources/' + id + '/content?' + $.now(), $.param({
|
$http.post('./ajax/resources/' + id + '/content?' + $.now(), $.param({
|
||||||
'content' : content
|
'content' : content
|
||||||
})).then(function successCallback(res) {
|
})).then(function successCallback(res) {
|
||||||
alert("Resource saved");
|
alert("Resource saved");
|
||||||
|
@ -78,7 +78,7 @@ app.controller('resourcesController', function($scope, $http) {
|
||||||
|
|
||||||
$scope.deleteResource = function(r) {
|
$scope.deleteResource = function(r) {
|
||||||
if (confirm("Are you sure ?")) {
|
if (confirm("Are you sure ?")) {
|
||||||
$http.delete('./api/resources/' + encodeURIComponent(r.id) + '?' + $.now()).then(function successCallback(res) {
|
$http.delete('./ajax/resources/' + encodeURIComponent(r.id) + '?' + $.now()).then(function successCallback(res) {
|
||||||
alert("Resource deleted");
|
alert("Resource deleted");
|
||||||
$scope.reload();
|
$scope.reload();
|
||||||
}, function errorCallback(res) {
|
}, function errorCallback(res) {
|
||||||
|
|
|
@ -6,7 +6,7 @@ app.controller('vocabulariesController', function($scope, $http) {
|
||||||
$scope.mode = '';
|
$scope.mode = '';
|
||||||
|
|
||||||
$scope.reload = function() {
|
$scope.reload = function() {
|
||||||
$http.get('./api/vocs/?' + $.now()).then(function successCallback(res) {
|
$http.get('./ajax/vocs/?' + $.now()).then(function successCallback(res) {
|
||||||
$scope.vocabularies = res.data;
|
$scope.vocabularies = res.data;
|
||||||
}, function errorCallback(res) {
|
}, function errorCallback(res) {
|
||||||
alert('ERROR: ' + res.data.message);
|
alert('ERROR: ' + res.data.message);
|
||||||
|
@ -42,7 +42,7 @@ app.controller('vocabulariesController', function($scope, $http) {
|
||||||
}
|
}
|
||||||
|
|
||||||
$http.defaults.headers.post["Content-Type"] = "application/json;charset=UTF-8";
|
$http.defaults.headers.post["Content-Type"] = "application/json;charset=UTF-8";
|
||||||
$http.post('./api/vocs/?' + $.now(), voc).then(function successCallback(res) {
|
$http.post('./ajax/vocs/?' + $.now(), voc).then(function successCallback(res) {
|
||||||
$scope.vocabularies = res.data;
|
$scope.vocabularies = res.data;
|
||||||
alert("Vocabulary saved");
|
alert("Vocabulary saved");
|
||||||
}, function errorCallback(res) {
|
}, function errorCallback(res) {
|
||||||
|
@ -52,7 +52,7 @@ app.controller('vocabulariesController', function($scope, $http) {
|
||||||
|
|
||||||
$scope.deleteVocabulary = function(id) {
|
$scope.deleteVocabulary = function(id) {
|
||||||
if (confirm("Are you sure ?")) {
|
if (confirm("Are you sure ?")) {
|
||||||
$http.delete('./api/vocs/' + encodeURIComponent(id) + '?' + $.now()).then(function successCallback(res) {
|
$http.delete('./ajax/vocs/' + encodeURIComponent(id) + '?' + $.now()).then(function successCallback(res) {
|
||||||
$scope.vocabularies = res.data;
|
$scope.vocabularies = res.data;
|
||||||
alert("Vocabulary deleted");
|
alert("Vocabulary deleted");
|
||||||
}, function errorCallback(res) {
|
}, function errorCallback(res) {
|
||||||
|
|
|
@ -8,7 +8,7 @@ app.controller('vocabularyController', function($scope, $http, $location) {
|
||||||
$scope.mode = '';
|
$scope.mode = '';
|
||||||
$scope.currTerm = [];
|
$scope.currTerm = [];
|
||||||
|
|
||||||
$scope.baseUrl = './api/vocs/' + encodeURIComponent($scope.vocId) + '/terms';
|
$scope.baseUrl = './ajax/vocs/' + encodeURIComponent($scope.vocId) + '/terms';
|
||||||
|
|
||||||
$scope.reload = function() {
|
$scope.reload = function() {
|
||||||
$http.get($scope.baseUrl + '?' + $.now()).then(function successCallback(res) {
|
$http.get($scope.baseUrl + '?' + $.now()).then(function successCallback(res) {
|
||||||
|
|
|
@ -14,7 +14,7 @@ app.controller('wfHistoryController', function($scope, $http) {
|
||||||
$scope.sortReverse = false;
|
$scope.sortReverse = false;
|
||||||
|
|
||||||
$scope.reload = function() {
|
$scope.reload = function() {
|
||||||
var url = './api/wfs/?' + $.now();
|
var url = './ajax/wfs/?' + $.now();
|
||||||
if ($scope.fromDate > 0) { url += "&from=" + $scope.fromDate; }
|
if ($scope.fromDate > 0) { url += "&from=" + $scope.fromDate; }
|
||||||
if ($scope.toDate > 0) { url += "&to=" + $scope.toDate; }
|
if ($scope.toDate > 0) { url += "&to=" + $scope.toDate; }
|
||||||
|
|
||||||
|
|
|
@ -58,7 +58,7 @@
|
||||||
app.controller('infoController', function($scope, $http) {
|
app.controller('infoController', function($scope, $http) {
|
||||||
$scope.info = [];
|
$scope.info = [];
|
||||||
|
|
||||||
$http.get('./api/info/?' + $.now()).then(function successCallback(res) {
|
$http.get('./ajax/info/?' + $.now()).then(function successCallback(res) {
|
||||||
angular.forEach(res.data, function(section) {
|
angular.forEach(res.data, function(section) {
|
||||||
if (section.name != 'Modules') {
|
if (section.name != 'Modules') {
|
||||||
angular.forEach(section.data, function(r) {
|
angular.forEach(section.data, function(r) {
|
||||||
|
|
|
@ -38,7 +38,7 @@
|
||||||
</p>
|
</p>
|
||||||
<button type="button" class="btn btn-sm btn-primary" data-toggle="modal" data-target="#editMetadataModal" ng-click="prepareEditMetadata(r)">edit metadata</button>
|
<button type="button" class="btn btn-sm btn-primary" data-toggle="modal" data-target="#editMetadataModal" ng-click="prepareEditMetadata(r)">edit metadata</button>
|
||||||
<button type="button" class="btn btn-sm btn-primary" data-toggle="modal" data-target="#editContentModal" ng-click="prepareEditContent(r)">edit content</button>
|
<button type="button" class="btn btn-sm btn-primary" data-toggle="modal" data-target="#editContentModal" ng-click="prepareEditContent(r)">edit content</button>
|
||||||
<a href="./api/resources/{{r.id}}/content" class="btn btn-sm btn-success" target="_blank">raw content</a>
|
<a href="./ajax/resources/{{r.id}}/content" class="btn btn-sm btn-success" target="_blank">raw content</a>
|
||||||
<button type="button" class="btn btn-sm btn-danger" ng-click="deleteResource(r)">delete</button>
|
<button type="button" class="btn btn-sm btn-danger" ng-click="deleteResource(r)">delete</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in New Issue