no message
This commit is contained in:
parent
9b62f914b6
commit
65dc958331
|
@ -17,6 +17,7 @@ import eu.eudat.models.dmp.DataManagementPlanCriteriaRequest;
|
|||
import eu.eudat.models.dmp.DataManagementPlanTableRequest;
|
||||
import eu.eudat.models.helpers.DataTableData;
|
||||
import eu.eudat.models.helpers.responses.*;
|
||||
import eu.eudat.models.listingmodels.DataManagementPlanListingModel;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
|
@ -70,15 +71,15 @@ public class DMPs {
|
|||
|
||||
|
||||
@RequestMapping(method = RequestMethod.POST, value = { "/dmps/getPaged" }, consumes = "application/json", produces="application/json")
|
||||
public @ResponseBody ResponseItem<DataTableData<DataManagementPlan>> getPaged(@RequestBody DataManagementPlanTableRequest dataManagementPlanTableRequest) {
|
||||
public @ResponseBody ResponseItem<DataTableData<DataManagementPlanListingModel>> getPaged(@RequestBody DataManagementPlanTableRequest dataManagementPlanTableRequest) {
|
||||
try {
|
||||
DataTableData<eu.eudat.models.dmp.DataManagementPlan> dataTable = new DataManagementPlanManager().getPaged(dMPDao, dataManagementPlanTableRequest);
|
||||
DataTableData<DataManagementPlanListingModel> dataTable = new DataManagementPlanManager().getPaged(dMPDao, dataManagementPlanTableRequest);
|
||||
|
||||
return new ResponseItem<DataTableData<DataManagementPlan>>().status(HttpStatus.OK).payload(dataTable);
|
||||
return new ResponseItem<DataTableData<DataManagementPlanListingModel>>().status(HttpStatus.OK).payload(dataTable);
|
||||
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
return new ResponseItem<DataTableData<DataManagementPlan>>().status(HttpStatus.BAD_REQUEST).message(ex.getMessage());
|
||||
return new ResponseItem<DataTableData<DataManagementPlanListingModel>>().status(HttpStatus.BAD_REQUEST).message(ex.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -7,6 +7,9 @@ import java.util.UUID;
|
|||
import javax.transaction.Transactional;
|
||||
|
||||
import eu.eudat.entities.Organisation;
|
||||
import eu.eudat.models.external.OrganisationsExternalSourcesModel;
|
||||
import eu.eudat.models.external.ProjectsExternalSourcesModel;
|
||||
import eu.eudat.models.helpers.responses.ResponseItem;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
|
@ -58,16 +61,19 @@ public class Organisations {
|
|||
|
||||
|
||||
@RequestMapping(method = RequestMethod.GET, value = { "/external/organisations" }, produces="application/json")
|
||||
public @ResponseBody ResponseEntity<List<Map<String,String>>> listExternalOrganisations(@RequestParam(value="query", required=false) String query ){
|
||||
public @ResponseBody ResponseItem<OrganisationsExternalSourcesModel> listExternalOrganisations(@RequestParam(value="query", required=false) String query ){
|
||||
try {
|
||||
List<Map<String,String>> remoteRepos = remoteFetcher.getOrganisations(query);
|
||||
return ResponseEntity.status(HttpStatus.OK).body(remoteRepos);
|
||||
OrganisationsExternalSourcesModel projectsExternalSourcesModel = new OrganisationsExternalSourcesModel().fromExternalItem(remoteRepos);
|
||||
return new ResponseItem<OrganisationsExternalSourcesModel>().payload(projectsExternalSourcesModel).status(HttpStatus.OK);
|
||||
}
|
||||
catch(NoURLFound ex) {
|
||||
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(null);
|
||||
return new ResponseItem<OrganisationsExternalSourcesModel>().status(HttpStatus.BAD_REQUEST).message("External Url Not Found");
|
||||
}
|
||||
catch(HugeResultSet ex) {
|
||||
return ResponseEntity.status(HttpStatus.UNPROCESSABLE_ENTITY).body(null); //the ex.getMessage has the appropriate text description
|
||||
return new ResponseItem<OrganisationsExternalSourcesModel>().status(HttpStatus.BAD_REQUEST).message("Huge Result Set");
|
||||
}catch (Exception ex){
|
||||
return new ResponseItem<OrganisationsExternalSourcesModel>().status(HttpStatus.BAD_REQUEST).message(ex.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -9,6 +9,8 @@ import java.util.UUID;
|
|||
import javax.transaction.Transactional;
|
||||
|
||||
import eu.eudat.models.criteria.ProjectCriteria;
|
||||
import eu.eudat.models.external.ProjectsExternalSourcesModel;
|
||||
import eu.eudat.models.external.RegistriesExternalSourcesModel;
|
||||
import eu.eudat.models.helpers.responses.*;
|
||||
import eu.eudat.models.project.ProjectCriteriaRequest;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
@ -137,16 +139,19 @@ public class Projects {
|
|||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@RequestMapping(method = RequestMethod.GET, value = { "/external/projects" }, produces="application/json")
|
||||
public @ResponseBody ResponseEntity<List<Map<String,String>>> listExternalProjects(@RequestParam(value="query", required=false) String query ){
|
||||
public @ResponseBody ResponseItem<ProjectsExternalSourcesModel> listExternalProjects(@RequestParam(value="query", required=false) String query ){
|
||||
try {
|
||||
List<Map<String,String>> remoteRepos = remoteFetcher.getProjects(query);
|
||||
return ResponseEntity.status(HttpStatus.OK).body(remoteRepos);
|
||||
ProjectsExternalSourcesModel projectsExternalSourcesModel = new ProjectsExternalSourcesModel().fromExternalItem(remoteRepos);
|
||||
return new ResponseItem<ProjectsExternalSourcesModel>().payload(projectsExternalSourcesModel).status(HttpStatus.OK);
|
||||
}
|
||||
catch(NoURLFound ex) {
|
||||
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(null);
|
||||
return new ResponseItem<ProjectsExternalSourcesModel>().status(HttpStatus.BAD_REQUEST).message("External Url Not Found");
|
||||
}
|
||||
catch(HugeResultSet ex) {
|
||||
return ResponseEntity.status(HttpStatus.UNPROCESSABLE_ENTITY).body(null); //the ex.getMessage has the appropriate text description
|
||||
return new ResponseItem<ProjectsExternalSourcesModel>().status(HttpStatus.BAD_REQUEST).message("Huge Result Set");
|
||||
}catch (Exception ex){
|
||||
return new ResponseItem<ProjectsExternalSourcesModel>().status(HttpStatus.BAD_REQUEST).message(ex.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -5,6 +5,9 @@ import java.util.Map;
|
|||
import java.util.UUID;
|
||||
|
||||
import eu.eudat.entities.Registry;
|
||||
import eu.eudat.models.external.RegistriesExternalSourcesModel;
|
||||
import eu.eudat.models.external.ResearchersExternalSourcesModel;
|
||||
import eu.eudat.models.helpers.responses.ResponseItem;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
|
@ -58,16 +61,19 @@ public class Registries {
|
|||
|
||||
|
||||
@RequestMapping(method = RequestMethod.GET, value = { "/external/registries" }, produces="application/json")
|
||||
public @ResponseBody ResponseEntity<List<Map<String,String>>> listExternalRegistries(@RequestParam(value="query", required=false) String query ){
|
||||
public @ResponseBody ResponseItem<RegistriesExternalSourcesModel> listExternalRegistries(@RequestParam(value="query", required=false) String query ){
|
||||
try {
|
||||
List<Map<String,String>> remoteRepos = remoteFetcher.getRegistries(query);
|
||||
return ResponseEntity.status(HttpStatus.OK).body(remoteRepos);
|
||||
RegistriesExternalSourcesModel registriesExternalSourcesModel = new RegistriesExternalSourcesModel().fromExternalItem(remoteRepos);
|
||||
return new ResponseItem<RegistriesExternalSourcesModel>().payload(registriesExternalSourcesModel).status(HttpStatus.OK);
|
||||
}
|
||||
catch(NoURLFound ex) {
|
||||
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(null);
|
||||
return new ResponseItem<RegistriesExternalSourcesModel>().status(HttpStatus.BAD_REQUEST).message("External Url Not Found");
|
||||
}
|
||||
catch(HugeResultSet ex) {
|
||||
return ResponseEntity.status(HttpStatus.UNPROCESSABLE_ENTITY).body(null); //the ex.getMessage has the appropriate text description
|
||||
return new ResponseItem<RegistriesExternalSourcesModel>().status(HttpStatus.BAD_REQUEST).message("Huge Result Set");
|
||||
}catch (Exception ex){
|
||||
return new ResponseItem<RegistriesExternalSourcesModel>().status(HttpStatus.BAD_REQUEST).message(ex.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -7,6 +7,9 @@ import java.util.UUID;
|
|||
import javax.transaction.Transactional;
|
||||
|
||||
import eu.eudat.entities.Researcher;
|
||||
import eu.eudat.models.external.ResearchersExternalSourcesModel;
|
||||
import eu.eudat.models.external.ServiceExternalSourcesModel;
|
||||
import eu.eudat.models.helpers.responses.ResponseItem;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
|
@ -57,16 +60,19 @@ public class Researchers {
|
|||
|
||||
|
||||
@RequestMapping(method = RequestMethod.GET, value = { "/external/researchers" }, produces="application/json")
|
||||
public @ResponseBody ResponseEntity<List<Map<String,String>>> listExternalResearchers(@RequestParam(value="query", required=false) String query ){
|
||||
public @ResponseBody ResponseItem<ResearchersExternalSourcesModel> listExternalResearchers(@RequestParam(value="query", required=false) String query ){
|
||||
try {
|
||||
List<Map<String,String>> remoteRepos = remoteFetcher.getResearchers(query);
|
||||
return ResponseEntity.status(HttpStatus.OK).body(remoteRepos);
|
||||
ResearchersExternalSourcesModel researchersExternalSourcesModel = new ResearchersExternalSourcesModel().fromExternalItem(remoteRepos);
|
||||
return new ResponseItem<ResearchersExternalSourcesModel>().payload(researchersExternalSourcesModel).status(HttpStatus.OK);
|
||||
}
|
||||
catch(NoURLFound ex) {
|
||||
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(null);
|
||||
return new ResponseItem<ResearchersExternalSourcesModel>().status(HttpStatus.BAD_REQUEST).message("External Url Not Found");
|
||||
}
|
||||
catch(HugeResultSet ex) {
|
||||
return ResponseEntity.status(HttpStatus.UNPROCESSABLE_ENTITY).body(null); //the ex.getMessage has the appropriate text description
|
||||
return new ResponseItem<ResearchersExternalSourcesModel>().status(HttpStatus.BAD_REQUEST).message("Huge Result Set");
|
||||
}catch (Exception ex){
|
||||
return new ResponseItem<ResearchersExternalSourcesModel>().status(HttpStatus.BAD_REQUEST).message(ex.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -7,6 +7,8 @@ import java.util.UUID;
|
|||
import javax.transaction.Transactional;
|
||||
|
||||
import eu.eudat.entities.Service;
|
||||
import eu.eudat.models.external.ServiceExternalSourcesModel;
|
||||
import eu.eudat.models.helpers.responses.ResponseItem;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
|
@ -57,20 +59,29 @@ public class Services {
|
|||
|
||||
|
||||
@RequestMapping(method = RequestMethod.GET, value = { "/external/services" }, produces="application/json")
|
||||
public @ResponseBody ResponseEntity<List<Map<String,String>>> listExternalServices(@RequestParam(value="query", required=false) String query ){
|
||||
public @ResponseBody ResponseItem<ServiceExternalSourcesModel> listExternalServices(@RequestParam(value="query", required=false) String query ){
|
||||
try {
|
||||
List<Map<String,String>> remoteRepos = remoteFetcher.getServices(query);
|
||||
return ResponseEntity.status(HttpStatus.OK).body(remoteRepos);
|
||||
ServiceExternalSourcesModel serviceExternalSourcesModel = new ServiceExternalSourcesModel().fromExternalItem(remoteRepos);
|
||||
return new ResponseItem<ServiceExternalSourcesModel>().payload(serviceExternalSourcesModel).status(HttpStatus.OK);
|
||||
}
|
||||
catch(NoURLFound ex) {
|
||||
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(null);
|
||||
return new ResponseItem<ServiceExternalSourcesModel>().status(HttpStatus.BAD_REQUEST).message("External Url Not Found");
|
||||
}
|
||||
catch(HugeResultSet ex) {
|
||||
return ResponseEntity.status(HttpStatus.UNPROCESSABLE_ENTITY).body(null); //the ex.getMessage has the appropriate text description
|
||||
return new ResponseItem<ServiceExternalSourcesModel>().status(HttpStatus.BAD_REQUEST).message("Huge Result Set");
|
||||
}catch (Exception ex){
|
||||
return new ResponseItem<ServiceExternalSourcesModel>().status(HttpStatus.BAD_REQUEST).message(ex.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// MANAGE SERVICE(S)
|
||||
|
||||
@RequestMapping(method = RequestMethod.GET, value = { "/services" })
|
||||
|
|
|
@ -10,18 +10,19 @@ import eu.eudat.models.dmp.DataManagementPlan;
|
|||
import eu.eudat.models.dmp.DataManagementPlanCriteriaRequest;
|
||||
import eu.eudat.models.dmp.DataManagementPlanTableRequest;
|
||||
import eu.eudat.models.helpers.DataTableData;
|
||||
import eu.eudat.models.listingmodels.DataManagementPlanListingModel;
|
||||
import eu.eudat.queryable.QueryableList;
|
||||
import eu.eudat.utilities.builders.DomainModelConverter;
|
||||
|
||||
public class DataManagementPlanManager {
|
||||
|
||||
public DataTableData<eu.eudat.models.dmp.DataManagementPlan> getPaged(DMPDao dmpsRepository, DataManagementPlanTableRequest dataManagementPlanTableRequest) throws IllegalAccessException, InstantiationException{
|
||||
public DataTableData<DataManagementPlanListingModel> getPaged(DMPDao dmpsRepository, DataManagementPlanTableRequest dataManagementPlanTableRequest) throws IllegalAccessException, InstantiationException{
|
||||
QueryableList<DMP> items = dmpsRepository.getWithCriteria(dataManagementPlanTableRequest.getCriteria());
|
||||
QueryableList<DMP> pagedItems = PaginationManager.applyPaging(items,dataManagementPlanTableRequest);
|
||||
List<eu.eudat.models.dmp.DataManagementPlan> datamanagementPlans = new DomainModelConverter<eu.eudat.entities.DMP, eu.eudat.models.dmp.DataManagementPlan>().fromDataModel( pagedItems.toList(), eu.eudat.models.dmp.DataManagementPlan.class);
|
||||
DataTableData<eu.eudat.models.dmp.DataManagementPlan> dataTable = new DataTableData<eu.eudat.models.dmp.DataManagementPlan>();
|
||||
List<DataManagementPlanListingModel> datamanagementPlans = new DomainModelConverter<eu.eudat.entities.DMP, DataManagementPlanListingModel>().fromDataModel( pagedItems.toList(), DataManagementPlanListingModel.class);
|
||||
DataTableData<DataManagementPlanListingModel> dataTable = new DataTableData<DataManagementPlanListingModel>();
|
||||
dataTable.setData(datamanagementPlans);
|
||||
dataTable.setTotalCount(datamanagementPlans.size());
|
||||
dataTable.setTotalCount(items.count());
|
||||
return dataTable;
|
||||
}
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ public class DatasetManager {
|
|||
List<Dataset> datasets = new DomainModelConverter<eu.eudat.entities.Dataset, Dataset>().fromDataModel( pagedItems.toList(), eu.eudat.models.dataset.Dataset.class);
|
||||
DataTableData<eu.eudat.models.dataset.Dataset> dataTable = new DataTableData<eu.eudat.models.dataset.Dataset>();
|
||||
dataTable.setData(datasets);
|
||||
dataTable.setTotalCount(datasets.size());
|
||||
dataTable.setTotalCount(items.count());
|
||||
return dataTable;
|
||||
}
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ public class ProjectManager {
|
|||
List<eu.eudat.models.project.Project> projects = new DomainModelConverter<eu.eudat.entities.Project, Project>().fromDataModel(pagedItems.toList(), eu.eudat.models.project.Project.class);
|
||||
DataTableData<eu.eudat.models.project.Project> dataTable = new DataTableData<eu.eudat.models.project.Project>();
|
||||
dataTable.setData(projects);
|
||||
dataTable.setTotalCount(projects.size());
|
||||
dataTable.setTotalCount(items.count());
|
||||
return dataTable;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,11 +1,74 @@
|
|||
package eu.eudat.models.dataset;
|
||||
|
||||
import eu.eudat.models.DataModel;
|
||||
import org.hibernate.annotations.Type;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import java.util.UUID;
|
||||
|
||||
public class Registry implements DataModel<eu.eudat.entities.Registry>{
|
||||
private UUID id;
|
||||
private String label;
|
||||
private String abbreviation;
|
||||
private String reference;
|
||||
private String uri;
|
||||
private String definition;
|
||||
|
||||
public UUID getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(UUID id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getLabel() {
|
||||
return label;
|
||||
}
|
||||
|
||||
public void setLabel(String label) {
|
||||
this.label = label;
|
||||
}
|
||||
|
||||
public String getAbbreviation() {
|
||||
return abbreviation;
|
||||
}
|
||||
|
||||
public void setAbbreviation(String abbreviation) {
|
||||
this.abbreviation = abbreviation;
|
||||
}
|
||||
|
||||
public String getReference() {
|
||||
return reference;
|
||||
}
|
||||
|
||||
public void setReference(String reference) {
|
||||
this.reference = reference;
|
||||
}
|
||||
|
||||
public String getUri() {
|
||||
return uri;
|
||||
}
|
||||
|
||||
public void setUri(String uri) {
|
||||
this.uri = uri;
|
||||
}
|
||||
|
||||
public String getDefinition() {
|
||||
return definition;
|
||||
}
|
||||
|
||||
public void setDefinition(String definition) {
|
||||
this.definition = definition;
|
||||
}
|
||||
|
||||
public void fromDataModel(eu.eudat.entities.Registry entity){
|
||||
|
||||
this.id = entity.getId();
|
||||
this.label = entity.getLabel();
|
||||
this.abbreviation = entity.getAbbreviation();
|
||||
this.reference = entity.getReference();
|
||||
this.uri = entity.getUri();
|
||||
this.definition = entity.getDefinition();
|
||||
}
|
||||
|
||||
public eu.eudat.entities.Registry toDataModel(){
|
||||
|
|
|
@ -1,10 +1,78 @@
|
|||
package eu.eudat.models.dataset;
|
||||
|
||||
import eu.eudat.models.DataModel;
|
||||
import org.hibernate.annotations.Type;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import java.util.UUID;
|
||||
|
||||
public class Service implements DataModel<eu.eudat.entities.Service>{
|
||||
private UUID id;
|
||||
private String label;
|
||||
|
||||
private String abbreviation;
|
||||
|
||||
private String reference;
|
||||
|
||||
private String uri;
|
||||
|
||||
private String definition;
|
||||
|
||||
public UUID getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(UUID id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getLabel() {
|
||||
return label;
|
||||
}
|
||||
|
||||
public void setLabel(String label) {
|
||||
this.label = label;
|
||||
}
|
||||
|
||||
public String getAbbreviation() {
|
||||
return abbreviation;
|
||||
}
|
||||
|
||||
public void setAbbreviation(String abbreviation) {
|
||||
this.abbreviation = abbreviation;
|
||||
}
|
||||
|
||||
public String getReference() {
|
||||
return reference;
|
||||
}
|
||||
|
||||
public void setReference(String reference) {
|
||||
this.reference = reference;
|
||||
}
|
||||
|
||||
public String getUri() {
|
||||
return uri;
|
||||
}
|
||||
|
||||
public void setUri(String uri) {
|
||||
this.uri = uri;
|
||||
}
|
||||
|
||||
public String getDefinition() {
|
||||
return definition;
|
||||
}
|
||||
|
||||
public void setDefinition(String definition) {
|
||||
this.definition = definition;
|
||||
}
|
||||
|
||||
public void fromDataModel(eu.eudat.entities.Service entity){
|
||||
|
||||
this.id = entity.getId();
|
||||
this.label = entity.getLabel();
|
||||
this.abbreviation = entity.getAbbreviation();
|
||||
this.reference = entity.getReference();
|
||||
this.uri = entity.getUri();
|
||||
this.definition = entity.getDefinition();
|
||||
}
|
||||
|
||||
public eu.eudat.entities.Service toDataModel(){
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
package eu.eudat.models.dmp;
|
||||
|
||||
import eu.eudat.models.DataModel;
|
||||
import eu.eudat.utilities.helpers.LabelGenerator;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
public class Organisation implements DataModel<eu.eudat.entities.Organisation> {
|
||||
public class Organisation implements DataModel<eu.eudat.entities.Organisation>,LabelGenerator {
|
||||
private String pid;
|
||||
private String name;
|
||||
private String uri;
|
||||
|
@ -51,4 +52,9 @@ public class Organisation implements DataModel<eu.eudat.entities.Organisation> {
|
|||
organisationEntity.setStatus((short)this.status);
|
||||
return organisationEntity;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String generateLabel() {
|
||||
return this.getName();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
package eu.eudat.models.dmp;
|
||||
|
||||
import eu.eudat.models.DataModel;
|
||||
import eu.eudat.utilities.helpers.LabelGenerator;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
public class Researcher implements DataModel<eu.eudat.entities.Researcher> {
|
||||
public class Researcher implements DataModel<eu.eudat.entities.Researcher>,LabelGenerator {
|
||||
private String pid;
|
||||
private String name;
|
||||
private String uri;
|
||||
|
@ -59,4 +60,9 @@ public class Researcher implements DataModel<eu.eudat.entities.Researcher> {
|
|||
researcher.setStatus((short)this.status);
|
||||
return researcher;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String generateLabel() {
|
||||
return this.getName();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
package eu.eudat.models.external;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Created by ikalyvas on 12/19/2017.
|
||||
*/
|
||||
public interface ExternalItem<T> {
|
||||
T fromExternalItem(List<Map<String,String>> values);
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
package eu.eudat.models.external;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by ikalyvas on 12/19/2017.
|
||||
*/
|
||||
public abstract class ExternalListingItem<T> implements ExternalItem<T>{
|
||||
private List<ExternalSourcesItemModel> data;
|
||||
|
||||
public List<ExternalSourcesItemModel> getData() {
|
||||
return data;
|
||||
}
|
||||
|
||||
public void setData(List<ExternalSourcesItemModel> data) {
|
||||
this.data = data;
|
||||
}
|
||||
}
|
34
dmp-backend/src/main/java/eu/eudat/models/external/ExternalSourcesItemModel.java
vendored
Normal file
34
dmp-backend/src/main/java/eu/eudat/models/external/ExternalSourcesItemModel.java
vendored
Normal file
|
@ -0,0 +1,34 @@
|
|||
package eu.eudat.models.external;
|
||||
|
||||
/**
|
||||
* Created by ikalyvas on 12/19/2017.
|
||||
*/
|
||||
public class ExternalSourcesItemModel{
|
||||
private String id;
|
||||
private String name;
|
||||
private String label;
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getLabel() {
|
||||
return label;
|
||||
}
|
||||
|
||||
public void setLabel(String label) {
|
||||
this.label = label;
|
||||
}
|
||||
}
|
24
dmp-backend/src/main/java/eu/eudat/models/external/OrganisationsExternalSourcesModel.java
vendored
Normal file
24
dmp-backend/src/main/java/eu/eudat/models/external/OrganisationsExternalSourcesModel.java
vendored
Normal file
|
@ -0,0 +1,24 @@
|
|||
package eu.eudat.models.external;
|
||||
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Created by ikalyvas on 12/19/2017.
|
||||
*/
|
||||
public class OrganisationsExternalSourcesModel extends ExternalListingItem<OrganisationsExternalSourcesModel>{
|
||||
@Override
|
||||
public OrganisationsExternalSourcesModel fromExternalItem(List<Map<String,String>> values) {
|
||||
List<ExternalSourcesItemModel> items = new LinkedList<>();
|
||||
for(Map<String,String> item : values){
|
||||
ExternalSourcesItemModel model = new ExternalSourcesItemModel();
|
||||
model.setId(item.get("pid"));
|
||||
model.setLabel(item.get("uri"));
|
||||
model.setName(item.get("name"));
|
||||
items.add(model);
|
||||
}
|
||||
this.setData(items);
|
||||
return this;
|
||||
}
|
||||
}
|
24
dmp-backend/src/main/java/eu/eudat/models/external/ProjectsExternalSourcesModel.java
vendored
Normal file
24
dmp-backend/src/main/java/eu/eudat/models/external/ProjectsExternalSourcesModel.java
vendored
Normal file
|
@ -0,0 +1,24 @@
|
|||
package eu.eudat.models.external;
|
||||
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Created by ikalyvas on 12/19/2017.
|
||||
*/
|
||||
public class ProjectsExternalSourcesModel extends ExternalListingItem<ProjectsExternalSourcesModel> {
|
||||
@Override
|
||||
public ProjectsExternalSourcesModel fromExternalItem(List<Map<String,String>> values) {
|
||||
List<ExternalSourcesItemModel> items = new LinkedList<>();
|
||||
for(Map<String,String> item : values){
|
||||
ExternalSourcesItemModel model = new ExternalSourcesItemModel();
|
||||
model.setId(item.get("pid"));
|
||||
model.setLabel(item.get("uri"));
|
||||
model.setName(item.get("name"));
|
||||
items.add(model);
|
||||
}
|
||||
this.setData(items);
|
||||
return this;
|
||||
}
|
||||
}
|
24
dmp-backend/src/main/java/eu/eudat/models/external/RegistriesExternalSourcesModel.java
vendored
Normal file
24
dmp-backend/src/main/java/eu/eudat/models/external/RegistriesExternalSourcesModel.java
vendored
Normal file
|
@ -0,0 +1,24 @@
|
|||
package eu.eudat.models.external;
|
||||
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Created by ikalyvas on 12/19/2017.
|
||||
*/
|
||||
public class RegistriesExternalSourcesModel extends ExternalListingItem<RegistriesExternalSourcesModel> {
|
||||
@Override
|
||||
public RegistriesExternalSourcesModel fromExternalItem(List<Map<String,String>> values) {
|
||||
List<ExternalSourcesItemModel> items = new LinkedList<>();
|
||||
for(Map<String,String> item : values){
|
||||
ExternalSourcesItemModel model = new ExternalSourcesItemModel();
|
||||
model.setId(item.get("pid"));
|
||||
model.setLabel(item.get("uri"));
|
||||
model.setName(item.get("name"));
|
||||
items.add(model);
|
||||
}
|
||||
this.setData(items);
|
||||
return this;
|
||||
}
|
||||
}
|
24
dmp-backend/src/main/java/eu/eudat/models/external/ResearchersExternalSourcesModel.java
vendored
Normal file
24
dmp-backend/src/main/java/eu/eudat/models/external/ResearchersExternalSourcesModel.java
vendored
Normal file
|
@ -0,0 +1,24 @@
|
|||
package eu.eudat.models.external;
|
||||
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Created by ikalyvas on 12/19/2017.
|
||||
*/
|
||||
public class ResearchersExternalSourcesModel extends ExternalListingItem<ResearchersExternalSourcesModel> {
|
||||
@Override
|
||||
public ResearchersExternalSourcesModel fromExternalItem(List<Map<String,String>> values) {
|
||||
List<ExternalSourcesItemModel> items = new LinkedList<>();
|
||||
for(Map<String,String> item : values){
|
||||
ExternalSourcesItemModel model = new ExternalSourcesItemModel();
|
||||
model.setId(item.get("pid"));
|
||||
model.setLabel(item.get("uri"));
|
||||
model.setName(item.get("name"));
|
||||
items.add(model);
|
||||
}
|
||||
this.setData(items);
|
||||
return this;
|
||||
}
|
||||
}
|
24
dmp-backend/src/main/java/eu/eudat/models/external/ServiceExternalSourcesModel.java
vendored
Normal file
24
dmp-backend/src/main/java/eu/eudat/models/external/ServiceExternalSourcesModel.java
vendored
Normal file
|
@ -0,0 +1,24 @@
|
|||
package eu.eudat.models.external;
|
||||
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Created by ikalyvas on 12/19/2017.
|
||||
*/
|
||||
public class ServiceExternalSourcesModel extends ExternalListingItem<ServiceExternalSourcesModel> {
|
||||
@Override
|
||||
public ServiceExternalSourcesModel fromExternalItem(List<Map<String,String>> values) {
|
||||
List<ExternalSourcesItemModel> items = new LinkedList<>();
|
||||
for(Map<String,String> item : values){
|
||||
ExternalSourcesItemModel model = new ExternalSourcesItemModel();
|
||||
model.setId(item.get("pid"));
|
||||
model.setLabel(item.get("label"));
|
||||
model.setName(item.get("name"));
|
||||
items.add(model);
|
||||
}
|
||||
this.setData(items);
|
||||
return this;
|
||||
}
|
||||
}
|
|
@ -3,13 +3,13 @@ package eu.eudat.models.helpers;
|
|||
import java.util.List;
|
||||
|
||||
public class DataTableData<T> {
|
||||
private Integer totalCount;
|
||||
private Long totalCount;
|
||||
private List<T> data;
|
||||
|
||||
public Integer getTotalCount() {
|
||||
public Long getTotalCount() {
|
||||
return totalCount;
|
||||
}
|
||||
public void setTotalCount(Integer totalCount) {
|
||||
public void setTotalCount(Long totalCount) {
|
||||
this.totalCount = totalCount;
|
||||
}
|
||||
public List<T> getData() {
|
||||
|
|
|
@ -0,0 +1,102 @@
|
|||
package eu.eudat.models.listingmodels;
|
||||
|
||||
import eu.eudat.entities.DMP;
|
||||
import eu.eudat.entities.DataRepository;
|
||||
import eu.eudat.models.DataModel;
|
||||
import eu.eudat.models.dmp.Organisation;
|
||||
import eu.eudat.models.dmp.Researcher;
|
||||
import eu.eudat.utilities.builders.DomainModelConverter;
|
||||
import eu.eudat.utilities.helpers.LabelBuilder;
|
||||
import eu.eudat.utilities.helpers.LabelGenerator;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* Created by ikalyvas on 12/19/2017.
|
||||
*/
|
||||
public class DataManagementPlanListingModel implements DataModel<DMP> {
|
||||
private String id;
|
||||
private String label;
|
||||
private String project;
|
||||
private String profile;
|
||||
private String researchers;
|
||||
private String organisations;
|
||||
private String version;
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getLabel() {
|
||||
return label;
|
||||
}
|
||||
|
||||
public void setLabel(String label) {
|
||||
this.label = label;
|
||||
}
|
||||
|
||||
public String getProject() {
|
||||
return project;
|
||||
}
|
||||
|
||||
public void setProject(String project) {
|
||||
this.project = project;
|
||||
}
|
||||
|
||||
public String getProfile() {
|
||||
return profile;
|
||||
}
|
||||
|
||||
public void setProfile(String profile) {
|
||||
this.profile = profile;
|
||||
}
|
||||
|
||||
public String getResearchers() {
|
||||
return researchers;
|
||||
}
|
||||
|
||||
public void setResearchers(String researchers) {
|
||||
this.researchers = researchers;
|
||||
}
|
||||
|
||||
public String getOrganisations() {
|
||||
return organisations;
|
||||
}
|
||||
|
||||
public void setOrganisations(String organisations) {
|
||||
this.organisations = organisations;
|
||||
}
|
||||
|
||||
public String getVersion() {
|
||||
return version;
|
||||
}
|
||||
|
||||
public void setVersion(String version) {
|
||||
this.version = version;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fromDataModel(DMP entity) throws InstantiationException, IllegalAccessException {
|
||||
this.id = entity.getId().toString();
|
||||
this.label = entity.getLabel();
|
||||
this.project = entity.getProject().getLabel();
|
||||
this.profile = entity.getProfile().getLabel();
|
||||
this.organisations =getLabel(new DomainModelConverter<eu.eudat.entities.Organisation,Organisation>().fromDataModel(entity.getOrganisations().stream().collect(Collectors.toList()),Organisation.class));
|
||||
this.researchers =getLabel(new DomainModelConverter<eu.eudat.entities.Researcher,Researcher>().fromDataModel(entity.getResearchers().stream().collect(Collectors.toList()),Researcher.class));
|
||||
this.version = ""+entity.getVersion();
|
||||
}
|
||||
|
||||
@Override
|
||||
public DMP toDataModel() {
|
||||
return null;
|
||||
}
|
||||
|
||||
private <T extends LabelGenerator> String getLabel(List<T> items){
|
||||
return LabelBuilder.generateLabel(items);
|
||||
}
|
||||
}
|
|
@ -21,4 +21,6 @@ public interface QueryableList<T> {
|
|||
QueryableList<T> distinct();
|
||||
|
||||
QueryableList<T> orderBy(OrderByPredicate<T> predicate);
|
||||
|
||||
Long count();
|
||||
}
|
||||
|
|
|
@ -83,6 +83,16 @@ public class QueryableHibernateList<T> implements QueryableList<T> {
|
|||
return this;
|
||||
}
|
||||
|
||||
public Long count(){
|
||||
CriteriaBuilder criteriaBuilder = this.manager.getCriteriaBuilder();
|
||||
CriteriaQuery<Long> criteriaQuery = criteriaBuilder.createQuery(Long.class);
|
||||
criteriaQuery.select(criteriaBuilder.count(criteriaQuery.from(this.tClass)));
|
||||
Predicate[] array = new Predicate[this.predicates.size()];
|
||||
this.predicates.toArray(array);
|
||||
criteriaQuery.where(array);
|
||||
return this.manager.createQuery(criteriaQuery).getSingleResult();
|
||||
}
|
||||
|
||||
public List<T> toList() {
|
||||
Predicate[] array = new Predicate[this.predicates.size()];
|
||||
this.predicates.toArray(array);
|
||||
|
|
|
@ -0,0 +1,21 @@
|
|||
package eu.eudat.utilities.helpers;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by ikalyvas on 12/19/2017.
|
||||
*/
|
||||
public class LabelBuilder {
|
||||
public static <T extends LabelGenerator> String generateLabel(List<T> items){
|
||||
String label="";
|
||||
for(T item : items){
|
||||
if(items.indexOf(item)==3){
|
||||
label+="...";
|
||||
break;
|
||||
}
|
||||
label+=item.generateLabel();
|
||||
}
|
||||
return label;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
package eu.eudat.utilities.helpers;
|
||||
|
||||
/**
|
||||
* Created by ikalyvas on 12/19/2017.
|
||||
*/
|
||||
public interface LabelGenerator {
|
||||
String generateLabel();
|
||||
}
|
|
@ -19,12 +19,9 @@
|
|||
"testTsconfig": "tsconfig.spec.json",
|
||||
"prefix": "app",
|
||||
"styles": [
|
||||
"./../node_modules/bootstrap/dist/css/bootstrap.min.css",
|
||||
"styles.scss"
|
||||
],
|
||||
"scripts": [
|
||||
"./../node_modules/bootstrap/dist/js/bootstrap.min.js",
|
||||
"./assets/xml2json.min.js"
|
||||
],
|
||||
"environmentSource": "environments/environment.ts",
|
||||
"environments": {
|
||||
|
|
|
@ -285,11 +285,6 @@
|
|||
"tslib": "1.7.1"
|
||||
}
|
||||
},
|
||||
"@ng-bootstrap/ng-bootstrap": {
|
||||
"version": "1.0.0-beta.7",
|
||||
"resolved": "https://registry.npmjs.org/@ng-bootstrap/ng-bootstrap/-/ng-bootstrap-1.0.0-beta.7.tgz",
|
||||
"integrity": "sha1-WLyB9hACj0BSZSnOQEg6lQKBY7A="
|
||||
},
|
||||
"@ngtools/json-schema": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/@ngtools/json-schema/-/json-schema-1.1.0.tgz",
|
||||
|
@ -1389,11 +1384,6 @@
|
|||
"hoek": "2.16.3"
|
||||
}
|
||||
},
|
||||
"bootstrap": {
|
||||
"version": "3.3.7",
|
||||
"resolved": "https://registry.npmjs.org/bootstrap/-/bootstrap-3.3.7.tgz",
|
||||
"integrity": "sha1-WjiTlFSfIzMIdaOxUGVldPip63E="
|
||||
},
|
||||
"brace-expansion": {
|
||||
"version": "1.1.8",
|
||||
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.8.tgz",
|
||||
|
|
|
@ -19,7 +19,6 @@ import { DataManagementPlanEditorComponent } from './dmps/editor/dmp-editor.comp
|
|||
const appRoutes: Routes = [
|
||||
|
||||
{ path: 'dynamic-form/:id', component: DynamicFormComponent, canActivate: [AuthGuard] },
|
||||
//{ path: 'dataset', component: DatasetsComponent },
|
||||
{ path: 'projects', component: ProjectListingComponent, canActivate: [AuthGuard]},
|
||||
{ path: 'project/:id', component: ProjectEditorComponent, canActivate: [AuthGuard]},
|
||||
{ path: 'projects/new', component: ProjectEditorComponent, canActivate: [AuthGuard]},
|
||||
|
|
|
@ -1,78 +1,2 @@
|
|||
<app-navigation></app-navigation>
|
||||
<div class="container">
|
||||
<router-outlet></router-outlet>
|
||||
</div>
|
||||
<!-- <div>
|
||||
<nav class="navbar navbar-default shadowed">
|
||||
<div class="col-md-5">
|
||||
<div class="nav navbar-nav navbar-left">
|
||||
<li class="dropdown" [ngClass]="{false:'invisible'}[tokenService.isLoggedIn() == true]">
|
||||
<a class="dropdown-toggle" data-toggle="dropdown" href="#">Quick Navigate
|
||||
<span class="caret"></span>
|
||||
</a>
|
||||
<ul class="dropdown-menu">
|
||||
<li>
|
||||
<a class="cursor" (click)="goToDMPs()">My DMPs</a>
|
||||
</li>
|
||||
<li>
|
||||
<a class="cursor" (click)="goToProjects()">Projects</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="col-md-3">
|
||||
<h3 class="navbar-title">Data Management Plans Creator</h3>
|
||||
</div>
|
||||
|
||||
<div class="col-md-4">
|
||||
<ul class="nav navbar-nav navbar-right">
|
||||
<li class="dropdown" [ngClass]="{true:'invisible'}[loggedInAs == null]">
|
||||
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Quick links
|
||||
<span class="caret"></span>
|
||||
</a>
|
||||
<ul class="dropdown-menu">
|
||||
<li>
|
||||
<a href="#">Action</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#">Another action</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#">Something else here</a>
|
||||
</li>
|
||||
<li role="separator" class="divider"></li>
|
||||
<li>
|
||||
<a href="#">Separated link</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li [ngClass]="{false:'invisible'}[tokenService.isLoggedIn() == true]">
|
||||
<a>{{tokenService.getEmail()}}</a>
|
||||
</li>
|
||||
<li class="cursor" [ngClass]="{false:'invisible'}[tokenService.isLoggedIn() == true]" (click)="logout()">
|
||||
<a>Logout</a>
|
||||
</li>
|
||||
<li class="cursor" [ngClass]="{true:'invisible'}[tokenService.isLoggedIn() == true]" (click)="login()">
|
||||
<a>Login</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
</nav>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<div class="col-md-12">
|
||||
<breadcrumb></breadcrumb>
|
||||
</div> -->
|
||||
<!--
|
||||
<router-outlet></router-outlet> -->
|
||||
<router-outlet></router-outlet>
|
|
@ -50,7 +50,6 @@ import { ConfirmationComponent } from './widgets/confirmation/confirmation.compo
|
|||
|
||||
|
||||
import { EestoreService } from './services/eestore.service';
|
||||
import { GlobalInterceptor } from './services/interceptor';
|
||||
import { PDFService } from './services/transformers/pdf.service';
|
||||
|
||||
import { TabModule } from './tabs/tab.module';
|
||||
|
@ -81,7 +80,6 @@ import { NgDatepickerModule } from 'ng2-datepicker';
|
|||
import { StatusToString } from './pipes/various/status-to-string';
|
||||
import { SidebarModule } from 'ng-sidebar';
|
||||
|
||||
import { Ng4LoadingSpinnerModule } from 'ng4-loading-spinner';
|
||||
import { BreadcrumbComponent } from './widgets/breadcrumb/breadcrumb.component';
|
||||
import { DmpDetailedComponent } from './viewers/dmp-detailed/dmp-detailed.component';
|
||||
import { ProjectDetailedComponent } from './viewers/project-detailed/project-detailed.component';
|
||||
|
@ -167,7 +165,6 @@ import { FigurecardComponent } from './shared/components/figurecard/figurecard.c
|
|||
AngularDraggableModule,
|
||||
DataTableModule,
|
||||
NgDatepickerModule,
|
||||
Ng4LoadingSpinnerModule,
|
||||
NguiAutoCompleteModule,
|
||||
BreadcrumbModule,
|
||||
ProgressBarModule,
|
||||
|
@ -189,11 +186,7 @@ import { FigurecardComponent } from './shared/components/figurecard/figurecard.c
|
|||
BrowserAnimationsModule,
|
||||
MaterialModule
|
||||
],
|
||||
providers: [{
|
||||
provide: HTTP_INTERCEPTORS,
|
||||
useClass: GlobalInterceptor,
|
||||
multi: true,
|
||||
},
|
||||
providers: [
|
||||
ServerService, VisibilityRulesService, PaginationService, GlobalVariables, AuthGuard,
|
||||
LocalStorageService, RestBase, EestoreService, PDFService,
|
||||
AuthService,DashboardService,DatasetService,
|
||||
|
|
|
@ -8,7 +8,7 @@ import { TranslateService } from "@ngx-translate/core";
|
|||
|
||||
declare const gapi: any;
|
||||
|
||||
declare var auth2 :any;
|
||||
declare const auth2 :any;
|
||||
|
||||
declare function simple_notifier(type: string, title: string, message:string): any;
|
||||
|
||||
|
@ -51,34 +51,7 @@ export class GooggleSignInComponent implements OnInit, Injectable {
|
|||
|
||||
|
||||
|
||||
public signIn() {
|
||||
auth2.grantOfflineAccess().then((authResult)=>this.signInCallback(authResult))
|
||||
}
|
||||
|
||||
signInCallback(authResult){
|
||||
if (authResult['code']) {
|
||||
this.authService.login({ticket:authResult['code'],service:"google"}).subscribe(
|
||||
res => this.onLogInSuccess(res),
|
||||
error => this.onLogInError(error)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
public onLogInSuccess(logoutMessage: any) {
|
||||
this.route.queryParams.subscribe((params: Params) => {
|
||||
let redirectUrl = params['returnUrl'] ? params['returnUrl'] : '/';
|
||||
this.router.navigate([redirectUrl]);
|
||||
})
|
||||
}
|
||||
|
||||
public onLogInError(errorMessage: string) {
|
||||
console.log(errorMessage);
|
||||
this.snackBar.openFromComponent(SnackBarNotificationComponent, {
|
||||
data: { message: 'GENERAL.SNACK-BAR.UNSUCCESSFUL-LOGIN', language: this.language },
|
||||
duration: 3000,
|
||||
extraClasses: ['snackbar-warning']
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -1,75 +1,101 @@
|
|||
.form-signin
|
||||
{
|
||||
max-width: 330px;
|
||||
padding: 15px;
|
||||
margin: 0 auto;
|
||||
}
|
||||
.form-signin .form-signin-heading, .form-signin .checkbox
|
||||
{
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
.form-signin .checkbox
|
||||
{
|
||||
font-weight: normal;
|
||||
}
|
||||
.form-signin .form-control
|
||||
{
|
||||
.login{
|
||||
height: 100%;
|
||||
position: relative;
|
||||
font-size: 16px;
|
||||
height: auto;
|
||||
padding: 10px;
|
||||
-webkit-box-sizing: border-box;
|
||||
-moz-box-sizing: border-box;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
.form-signin .form-control:focus
|
||||
{
|
||||
z-index: 2;
|
||||
}
|
||||
.form-signin input[type="text"]
|
||||
{
|
||||
margin-bottom: -1px;
|
||||
border-bottom-left-radius: 0;
|
||||
border-bottom-right-radius: 0;
|
||||
}
|
||||
.form-signin input[type="password"]
|
||||
{
|
||||
margin-bottom: 10px;
|
||||
border-top-left-radius: 0;
|
||||
border-top-right-radius: 0;
|
||||
}
|
||||
.account-wall
|
||||
{
|
||||
margin-top: 20px;
|
||||
padding: 40px 0px 20px 0px;
|
||||
background-color: #f7f7f7;
|
||||
-moz-box-shadow: 0px 2px 2px rgba(0, 0, 0, 0.3);
|
||||
-webkit-box-shadow: 0px 2px 2px rgba(0, 0, 0, 0.3);
|
||||
box-shadow: 0px 2px 2px rgba(0, 0, 0, 0.3);
|
||||
}
|
||||
.login-title
|
||||
{
|
||||
color: #555;
|
||||
font-size: 18px;
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
.card{
|
||||
position: relative;
|
||||
padding: 20px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
margin-top: 90px;
|
||||
top: -90px;
|
||||
-webkit-animation-name: card;
|
||||
-moz-animation-name: card;
|
||||
-o-animation-name: card;
|
||||
animation-name: card;
|
||||
-webkit-animation-duration: 600ms;
|
||||
-moz-animation-duration: 600ms;
|
||||
-o-animation-duration: 600ms;
|
||||
animation-duration: 600ms;
|
||||
-webkit-animation-fill-mode: forwards;
|
||||
-moz-animation-fill-mode: forwards;
|
||||
-o-animation-fill-mode: forwards;
|
||||
animation-fill-mode: forwards;
|
||||
}
|
||||
|
||||
@-webkit-keyframes card {
|
||||
from {top: -40px;}
|
||||
to {top: 0;}
|
||||
}
|
||||
|
||||
@keyframes card {
|
||||
from {top: -40px;}
|
||||
to {top: 0;}
|
||||
}
|
||||
|
||||
.card-header{
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
top: -40px;
|
||||
width: 100%;
|
||||
padding: 25px;
|
||||
border-radius: 3px;
|
||||
background: linear-gradient(60deg, #ec407a, #d81b60);
|
||||
box-shadow: 0 4px 20px 0px rgba(0, 0, 0, 0.14), 0 7px 10px -5px rgba(233, 30, 99, 0.4);
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.card-header h4{
|
||||
font-weight: 400;
|
||||
display: block;
|
||||
}
|
||||
.profile-img
|
||||
{
|
||||
width: 96px;
|
||||
height: 96px;
|
||||
margin: 0 auto 10px;
|
||||
display: block;
|
||||
-moz-border-radius: 50%;
|
||||
-webkit-border-radius: 50%;
|
||||
border-radius: 50%;
|
||||
}
|
||||
.need-help
|
||||
{
|
||||
margin-top: 10px;
|
||||
}
|
||||
.new-account
|
||||
{
|
||||
display: block;
|
||||
margin-top: 10px;
|
||||
}
|
||||
color: #fff;
|
||||
margin-bottom: 25px;
|
||||
margin-top: 5px;
|
||||
}
|
||||
|
||||
.social-btns i{
|
||||
font-size: 21px;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.social-btns button{
|
||||
margin: 0 8px;
|
||||
}
|
||||
|
||||
.tip{
|
||||
margin-top: -20px;
|
||||
}
|
||||
|
||||
.form-row, .card-form, .mat-input-container{
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.card-form{
|
||||
padding: 5px;
|
||||
}
|
||||
|
||||
.form-row{
|
||||
position: relative;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin-top: 13px;
|
||||
}
|
||||
|
||||
.form-row i{
|
||||
position: relative;
|
||||
top: -5px;
|
||||
margin-right: 15px;
|
||||
color: #555;
|
||||
}
|
||||
|
||||
.card-footer{
|
||||
margin: 10px;
|
||||
}
|
||||
|
||||
.card-footer button{
|
||||
color: #e91e63;
|
||||
}
|
|
@ -1,43 +1,40 @@
|
|||
<div class="container">
|
||||
<div class="login">
|
||||
<div class="row">
|
||||
<div class="col-sm-6 col-md-4 col-md-offset-4">
|
||||
<h1 class="text-center login-title"></h1>
|
||||
<div class="account-wall">
|
||||
<img class="profile-img" src="/assets/icons/user-icon.png">
|
||||
<form class="form-signin" [formGroup]="nativeLoginForm">
|
||||
<input type="text" class="form-control" [(ngModel)]="creds.username" formControlName="username" placeholder="Username or Email" required autofocus>
|
||||
<input type="password" class="form-control" [(ngModel)]="creds.password" formControlName="password" placeholder="Password" required>
|
||||
<button class="btn btn-lg btn-primary btn-block" type="submit" (click)="login()">
|
||||
Sign in
|
||||
</button>
|
||||
<label class="checkbox pull-left">
|
||||
<input type="checkbox" value="remember-me">
|
||||
Remember me
|
||||
</label>
|
||||
<a href="#" class="pull-right need-help">Need help? </a><span class="clearfix"></span>
|
||||
</form>
|
||||
|
||||
<!--
|
||||
<p>Form value: {{ nativeLoginForm.value | json }}</p>
|
||||
-->
|
||||
|
||||
<a href="#" class="text-center new-account">Create an account </a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-sm-6 col-md-4 col-md-offset-4">
|
||||
<div class="account-wall">
|
||||
<h1 class="text-center login-title"></h1>
|
||||
<h4 class="text-center">Sign in with social</h4>
|
||||
<googgle-sign-in></googgle-sign-in>
|
||||
<div class="col-mat-4 col-sm-6 col-mat-offset-4 col-sm-offset-3">
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<h4>Login</h4>
|
||||
<div class="social-btns">
|
||||
<button mat-icon-button><i class="fa fa-facebook-square"></i></button>
|
||||
<button mat-icon-button><i class="fa fa-twitter"></i></button>
|
||||
<button mat-icon-button><i class="fa fa-google-plus" (click)="googleSignIn()"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
<p class="tip">Or Be Classical</p>
|
||||
<div class="card-form">
|
||||
<div class="form-row">
|
||||
<i class="material-icons">face</i>
|
||||
<mat-input-container color="accent">
|
||||
<input type="text" matInput placeholder="First Name" />
|
||||
</mat-input-container>
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<i class="material-icons">email</i>
|
||||
<mat-input-container color="accent">
|
||||
<input type="text" matInput placeholder="Email address" />
|
||||
</mat-input-container>
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<i class="material-icons">lock_outline</i>
|
||||
<mat-input-container color="accent">
|
||||
<input type="password" matInput placeholder="Password" />
|
||||
</mat-input-container>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-footer">
|
||||
<button mat-button (click)="loginBtn()">LET'S GO</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
|
@ -1,11 +1,13 @@
|
|||
import { Component, OnInit } from '@angular/core';
|
||||
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
|
||||
import {Router} from '@angular/router';
|
||||
import {MenuItem} from 'primeng/primeng';
|
||||
import { AuthService } from '../../services/auth/auth.service';
|
||||
import { HttpClient } from '@angular/common/http';
|
||||
import { Component, OnInit, ElementRef, AfterViewInit, VERSION, Injectable } from '@angular/core';
|
||||
import { Router, ActivatedRoute, Params } from "@angular/router";
|
||||
import { SnackBarNotificationComponent } from "../../shared/components/notificaiton/snack-bar-notification.component";
|
||||
import { MatPaginator, MatSort, MatSnackBar } from "@angular/material";
|
||||
import { TranslateService } from "@ngx-translate/core";
|
||||
declare const gapi: any;
|
||||
|
||||
declare function simple_notifier(type: string, title: string, message:string): any;
|
||||
|
||||
declare const auth2 :any;
|
||||
@Component({
|
||||
selector: 'app-main-sign-in',
|
||||
templateUrl: './main-sign-in.component.html',
|
||||
|
@ -13,36 +15,42 @@ declare function simple_notifier(type: string, title: string, message:string): a
|
|||
})
|
||||
export class MainSignInComponent implements OnInit {
|
||||
|
||||
|
||||
nativeLoginForm : any;
|
||||
|
||||
creds : any = {"username":"","password":""};
|
||||
|
||||
|
||||
constructor( private fb: FormBuilder, private router : Router) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
createForm(){
|
||||
|
||||
this.nativeLoginForm = this.fb.group({
|
||||
username: ['', Validators.required ],
|
||||
password: ['', Validators.required ]
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
constructor(private element: ElementRef, private router : Router,private authService:AuthService,private route:ActivatedRoute,
|
||||
public snackBar: MatSnackBar,public language: TranslateService) { }
|
||||
|
||||
ngOnInit() {
|
||||
this.createForm();
|
||||
}
|
||||
|
||||
loginBtn() {
|
||||
}
|
||||
|
||||
|
||||
login(){
|
||||
//login using the credentials
|
||||
|
||||
|
||||
}
|
||||
|
||||
public googleSignIn() {
|
||||
auth2.grantOfflineAccess().then((authResult)=>this.signInCallback(authResult))
|
||||
}
|
||||
|
||||
signInCallback(authResult){
|
||||
if (authResult['code']) {
|
||||
this.authService.login({ticket:authResult['code'],service:"google"}).subscribe(
|
||||
res => this.onLogInSuccess(res),
|
||||
error => this.onLogInError(error)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
public onLogInSuccess(logoutMessage: any) {
|
||||
this.route.queryParams.subscribe((params: Params) => {
|
||||
let redirectUrl = params['returnUrl'] ? params['returnUrl'] : '/';
|
||||
this.router.navigate([redirectUrl]);
|
||||
})
|
||||
}
|
||||
|
||||
public onLogInError(errorMessage: string) {
|
||||
console.log(errorMessage);
|
||||
this.snackBar.openFromComponent(SnackBarNotificationComponent, {
|
||||
data: { message: 'GENERAL.SNACK-BAR.UNSUCCESSFUL-LOGIN', language: this.language },
|
||||
duration: 3000,
|
||||
extraClasses: ['snackbar-warning']
|
||||
})
|
||||
}
|
||||
}
|
|
@ -1,31 +0,0 @@
|
|||
import {Injectable} from '@angular/core';
|
||||
import {Observable} from 'rxjs/Observable';
|
||||
import {HttpEvent, HttpInterceptor, HttpHandler, HttpRequest, HttpResponse, HttpErrorResponse} from '@angular/common/http';
|
||||
import {Router} from '@angular/router';
|
||||
|
||||
@Injectable()
|
||||
export class GlobalInterceptor implements HttpInterceptor {
|
||||
|
||||
constructor( private router : Router) {}
|
||||
|
||||
intercept(req: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<any>> {
|
||||
|
||||
return next.handle(req).do((event: HttpEvent<any>) => {
|
||||
/*
|
||||
if (event instanceof HttpResponse) {
|
||||
console.log("response ok");
|
||||
}
|
||||
*/
|
||||
}, (err: any) => {
|
||||
if (err instanceof HttpErrorResponse) {
|
||||
if (err.status === 401) {
|
||||
console.log("Received an unauthorized... redirecting to login page");
|
||||
this.router.navigate(['/login'], { queryParams: { /*returnUrl: this.state.url*/ }});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
//return next.handle(req);
|
||||
}
|
||||
}
|
|
@ -11,7 +11,6 @@ export class RestBase {
|
|||
static get parameters() { return [HttpClient] }
|
||||
|
||||
constructor(public http : HttpClient) {
|
||||
this.xml2jsonOBJ = new X2JS();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -11,10 +11,8 @@ declare var X2JS: any;
|
|||
@Injectable()
|
||||
export class ServerService {
|
||||
|
||||
xml2jsonOBJ: any;
|
||||
|
||||
constructor(private restBase: RestBase) {
|
||||
this.xml2jsonOBJ = new X2JS();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -12,7 +12,6 @@ import { Component } from '@angular/core';
|
|||
</li>
|
||||
</ul>
|
||||
|
||||
<router-outlet></router-outlet>
|
||||
`
|
||||
})
|
||||
export class TabComponent {
|
||||
|
|
Loading…
Reference in New Issue