no message
This commit is contained in:
parent
8cb464c1e9
commit
e835c35c7c
|
@ -1,5 +1,6 @@
|
|||
package eu.eudat.controllers;
|
||||
|
||||
import eu.eudat.documents.helpers.FileEnvelope;
|
||||
import eu.eudat.entities.Dataset;
|
||||
import eu.eudat.managers.DatasetManager;
|
||||
import eu.eudat.managers.DatasetWizardManager;
|
||||
|
@ -94,7 +95,7 @@ public class DatasetWizardController extends BaseController {
|
|||
}
|
||||
}
|
||||
|
||||
@RequestMapping(method = RequestMethod.GET, value = {"/getWordDocument/{id}"})
|
||||
@RequestMapping(method = RequestMethod.GET, value = {"/getPDF/{id}"})
|
||||
public @ResponseBody
|
||||
ResponseEntity<byte[]> getWordDocument(@PathVariable String id) throws IllegalAccessException, IOException, InstantiationException {
|
||||
try {
|
||||
|
@ -119,4 +120,29 @@ public class DatasetWizardController extends BaseController {
|
|||
return ResponseEntity.badRequest().body(null);
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping(method = RequestMethod.GET, value = {"/getXml/{id}"})
|
||||
public @ResponseBody
|
||||
ResponseEntity<byte[]> getXml(@PathVariable String id) throws IllegalAccessException, IOException, InstantiationException {
|
||||
try {
|
||||
FileEnvelope envelope = new DatasetManager().getXmlDocument(this.getApiContext().getOperationsContext().getDatabaseRepository().getDatasetDao(), id, this.getApiContext().getUtilitiesService().getVisibilityRuleService());
|
||||
InputStream resource = new FileInputStream(envelope.getFile());
|
||||
System.out.println("Mime Type of " + envelope.getFilename() + " is " +
|
||||
new MimetypesFileTypeMap().getContentType(envelope.getFile()));
|
||||
HttpHeaders responseHeaders = new HttpHeaders();
|
||||
responseHeaders.setContentLength(envelope.getFile().length());
|
||||
responseHeaders.setContentType(MediaType.APPLICATION_OCTET_STREAM);
|
||||
responseHeaders.set("Content-Disposition", "attachment;filename=" + envelope.getFilename() + ".xml");
|
||||
responseHeaders.set("Access-Control-Expose-Headers", "Content-Disposition");
|
||||
responseHeaders.get("Access-Control-Expose-Headers").add("Content-Type");
|
||||
|
||||
byte[] content = IOUtils.toByteArray(resource);
|
||||
return new ResponseEntity<>(content,
|
||||
responseHeaders,
|
||||
HttpStatus.OK);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return ResponseEntity.badRequest().body(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,38 +0,0 @@
|
|||
package eu.eudat.controllers.controllerhandler;
|
||||
|
||||
import eu.eudat.models.helpers.responses.ResponseItem;
|
||||
import eu.eudat.services.ApiContext;
|
||||
import eu.eudat.types.ApiMessageCode;
|
||||
import eu.eudat.types.WarningLevel;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.ControllerAdvice;
|
||||
import org.springframework.web.bind.annotation.ExceptionHandler;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.bind.annotation.ResponseStatus;
|
||||
import org.springframework.web.servlet.mvc.method.annotation.ResponseEntityExceptionHandler;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
/**
|
||||
* Created by ikalyvas on 3/1/2018.
|
||||
*/
|
||||
@ControllerAdvice
|
||||
public class GeneralErrorHandler extends ResponseEntityExceptionHandler {
|
||||
|
||||
private ApiContext apiContext;
|
||||
|
||||
@Autowired
|
||||
public GeneralErrorHandler(ApiContext apiContext) {
|
||||
this.apiContext = apiContext;
|
||||
}
|
||||
|
||||
@ExceptionHandler(Exception.class)
|
||||
@ResponseStatus(HttpStatus.BAD_REQUEST)
|
||||
@ResponseBody
|
||||
public ResponseItem<?> processValidationError(HttpServletRequest req, Exception ex) {
|
||||
apiContext.getHelpersService().getLoggerService().log(ex.getMessage(), WarningLevel.ERROR);
|
||||
return new ResponseItem().status(ApiMessageCode.ERROR_MESSAGE).message(ex.getMessage());
|
||||
}
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
package eu.eudat.documents.helpers;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
/**
|
||||
* Created by ikalyvas on 3/6/2018.
|
||||
*/
|
||||
public class FileEnvelope {
|
||||
private String filename;
|
||||
private File file;
|
||||
|
||||
public String getFilename() {
|
||||
return filename;
|
||||
}
|
||||
|
||||
public void setFilename(String filename) {
|
||||
this.filename = filename;
|
||||
}
|
||||
|
||||
public File getFile() {
|
||||
return file;
|
||||
}
|
||||
|
||||
public void setFile(File file) {
|
||||
this.file = file;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,106 @@
|
|||
package eu.eudat.documents.xml;
|
||||
|
||||
import eu.eudat.models.user.components.datasetprofile.Field;
|
||||
import eu.eudat.models.user.components.datasetprofile.FieldSet;
|
||||
import eu.eudat.models.user.components.datasetprofile.Section;
|
||||
import eu.eudat.models.user.composite.DatasetProfilePage;
|
||||
import eu.eudat.models.user.composite.PagedDatasetProfile;
|
||||
import eu.eudat.services.forms.VisibilityRuleService;
|
||||
import eu.eudat.utilities.builders.XmlBuilder;
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Element;
|
||||
import org.w3c.dom.Text;
|
||||
|
||||
import java.io.BufferedWriter;
|
||||
import java.io.File;
|
||||
import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* Created by ikalyvas on 3/5/2018.
|
||||
*/
|
||||
public class ExportXmlBuilder {
|
||||
|
||||
public File build(PagedDatasetProfile pagedDatasetProfile, VisibilityRuleService visibilityRuleService) throws IOException {
|
||||
|
||||
File xmlFile = new File(UUID.randomUUID() + ".xml");
|
||||
BufferedWriter writer = new BufferedWriter(new FileWriter(xmlFile, true));
|
||||
Document xmlDoc = XmlBuilder.getDocument();
|
||||
Element root = createPages(pagedDatasetProfile.getPages(), visibilityRuleService, xmlDoc);
|
||||
xmlDoc.appendChild(root);
|
||||
String xml = XmlBuilder.generateXml(xmlDoc);
|
||||
writer.write(xml);
|
||||
writer.close();
|
||||
return xmlFile;
|
||||
}
|
||||
|
||||
public Element createPages(List<DatasetProfilePage> datasetProfilePages, VisibilityRuleService visibilityRuleService, Document element) {
|
||||
Element root = element.createElement("root");
|
||||
Element pages = element.createElement("pages");
|
||||
datasetProfilePages.forEach(item -> {
|
||||
Element page = element.createElement("page");
|
||||
page.appendChild(createSections(item.getSections(), visibilityRuleService, element));
|
||||
pages.appendChild(page);
|
||||
});
|
||||
root.appendChild(pages);
|
||||
return root;
|
||||
}
|
||||
|
||||
public Element createSections(List<Section> sections, VisibilityRuleService visibilityRuleService, Document element) {
|
||||
Element elementSections = element.createElement("sections");
|
||||
sections.forEach(section -> {
|
||||
Element elementSection = element.createElement("section");
|
||||
if (visibilityRuleService.isElementVisible(section.getId())) {
|
||||
Element elementInnerSections = element.createElement("sections");
|
||||
Element compositeFields = element.createElement("composite-field");
|
||||
elementInnerSections.appendChild(createSections(section.getSections(), visibilityRuleService, element));
|
||||
compositeFields.appendChild(createCompositeFields(section.getCompositeFields(), visibilityRuleService, element));
|
||||
elementSection.appendChild(elementInnerSections);
|
||||
elementSections.appendChild(elementSection);
|
||||
elementSections.appendChild(compositeFields);
|
||||
}
|
||||
});
|
||||
return elementSections;
|
||||
}
|
||||
|
||||
public Element createCompositeFields(List<FieldSet> compositeFields, VisibilityRuleService visibilityRuleService, Document element) {
|
||||
Element elementComposites = element.createElement("composite-fields");
|
||||
compositeFields.forEach(compositeField -> {
|
||||
if (visibilityRuleService.isElementVisible(compositeField.getId())) {
|
||||
Element composite = element.createElement("composite-field");
|
||||
composite.setAttribute("id", compositeField.getId());
|
||||
if (compositeField.getTitle() != null && !compositeField.getTitle().isEmpty()) {
|
||||
Element title = element.createElement("title");
|
||||
title.setTextContent(compositeField.getTitle());
|
||||
composite.appendChild(title);
|
||||
}
|
||||
if (compositeField.getDescription() != null && !compositeField.getDescription().isEmpty()) {
|
||||
Element title = element.createElement("description");
|
||||
title.setTextContent(compositeField.getDescription());
|
||||
composite.appendChild(title);
|
||||
}
|
||||
composite.appendChild(createFields(compositeField.getFields(), visibilityRuleService, element));
|
||||
elementComposites.appendChild(composite);
|
||||
|
||||
}
|
||||
});
|
||||
return elementComposites;
|
||||
}
|
||||
|
||||
public Element createFields(List<Field> fields, VisibilityRuleService visibilityRuleService, Document element) {
|
||||
Element elementFields = element.createElement("fields");
|
||||
fields.forEach(field -> {
|
||||
if (visibilityRuleService.isElementVisible(field.getId())) {
|
||||
Element elementField = element.createElement("field");
|
||||
elementField.setAttribute("id", field.getId());
|
||||
if (field.getValue() != null && !field.getValue().isEmpty()) {
|
||||
elementField.setTextContent(field.getValue());
|
||||
}
|
||||
elementFields.appendChild(elementField);
|
||||
}
|
||||
});
|
||||
return elementFields;
|
||||
}
|
||||
}
|
|
@ -2,7 +2,9 @@ package eu.eudat.managers;
|
|||
|
||||
import eu.eudat.builders.entity.UserInfoBuilder;
|
||||
import eu.eudat.dao.entities.*;
|
||||
import eu.eudat.documents.helpers.FileEnvelope;
|
||||
import eu.eudat.documents.word.WordBuilder;
|
||||
import eu.eudat.documents.xml.ExportXmlBuilder;
|
||||
import eu.eudat.entities.UserInfo;
|
||||
import eu.eudat.models.HintedModelFactory;
|
||||
import eu.eudat.models.criteria.DataRepositoryCriteria;
|
||||
|
@ -87,15 +89,34 @@ public class DatasetManager {
|
|||
Map<String, Object> properties = new HashMap<>();
|
||||
if (datasetEntity.getProperties() != null) {
|
||||
JSONObject jobject = new JSONObject(datasetEntity.getProperties());
|
||||
properties = (Map<String, Object>) jobject.toMap();
|
||||
properties = jobject.toMap();
|
||||
}
|
||||
PagedDatasetProfile pagedDatasetProfile = getPagedProfile(dataset, datasetEntity);
|
||||
visibilityRuleService.setProperties(properties);
|
||||
visibilityRuleService.buildVisibilityContext(pagedDatasetProfile.getRules());
|
||||
File file = wordBuilder.build(pagedDatasetProfile, datasetEntity.getLabel(),visibilityRuleService);
|
||||
File file = wordBuilder.build(pagedDatasetProfile, datasetEntity.getLabel(), visibilityRuleService);
|
||||
return file;
|
||||
}
|
||||
|
||||
public FileEnvelope getXmlDocument(DatasetDao datatasetRepository, String id, VisibilityRuleService visibilityRuleService) throws InstantiationException, IllegalAccessException, IOException {
|
||||
ExportXmlBuilder xmlBuilder = new ExportXmlBuilder();
|
||||
DatasetWizardModel dataset = new DatasetWizardModel();
|
||||
eu.eudat.entities.Dataset datasetEntity = datatasetRepository.find(UUID.fromString(id), HintedModelFactory.getHint(DatasetWizardModel.class));
|
||||
Map<String, Object> properties = new HashMap<>();
|
||||
if (datasetEntity.getProperties() != null) {
|
||||
JSONObject jobject = new JSONObject(datasetEntity.getProperties());
|
||||
properties = jobject.toMap();
|
||||
}
|
||||
PagedDatasetProfile pagedDatasetProfile = getPagedProfile(dataset, datasetEntity);
|
||||
visibilityRuleService.setProperties(properties);
|
||||
visibilityRuleService.buildVisibilityContext(pagedDatasetProfile.getRules());
|
||||
File file = xmlBuilder.build(pagedDatasetProfile, visibilityRuleService);
|
||||
FileEnvelope fileEnvelope = new FileEnvelope();
|
||||
fileEnvelope.setFile(file);
|
||||
fileEnvelope.setFilename(datasetEntity.getLabel());
|
||||
return fileEnvelope;
|
||||
}
|
||||
|
||||
public File convertToPDF(File file, Environment environment, String label) throws IOException, InterruptedException {
|
||||
LinkedMultiValueMap<String, Object> map = new LinkedMultiValueMap<>();
|
||||
map.add("file", new FileSystemResource(file));
|
||||
|
|
|
@ -179,7 +179,7 @@ public class AuthenticationServiceImpl implements AuthenticationService {
|
|||
this.apiContext.getOperationsContext().getDatabaseRepository().getUserRoleDao().createOrUpdate(role);
|
||||
|
||||
Credential credential = this.apiContext.getOperationsContext().getBuilderFactory().getBuilder(CredentialBuilder.class)
|
||||
.userInfo(userInfo).publicValue(username).secret(password)
|
||||
.id(UUID.randomUUID()).userInfo(userInfo).publicValue(username).secret(password)
|
||||
.provider((int) TokenValidatorFactoryImpl.LoginProvider.NATIVELOGIN.getValue())
|
||||
.creationTime(new Date()).lastUpdateTime(new Date()).status(0)
|
||||
.build();
|
||||
|
|
|
@ -51,10 +51,10 @@ autouser.root.email=root@dmp.com
|
|||
autouser.root.password=root
|
||||
autouser.root.username=root
|
||||
#################################################################################
|
||||
b2access.externallogin.user_info_url = https://b2access-integration.fz-juelich.de:443/oauth2/userinfo
|
||||
b2access.externallogin.access_token_url = https://b2access-integration.fz-juelich.de:443/oauth2/token
|
||||
b2access.externallogin.redirect_uri = http://dmp.eudat.org:4200/api/oauth/authorized/b2access
|
||||
b2access.externallogin.clientid = eudatdmptool
|
||||
b2access.externallogin.clientSecret = A3b*1*92
|
||||
b2access.externallogin.user_info_url=https://b2access-integration.fz-juelich.de:443/oauth2/userinfo
|
||||
b2access.externallogin.access_token_url=https://b2access-integration.fz-juelich.de:443/oauth2/token
|
||||
b2access.externallogin.redirect_uri=http://dmp.eudat.org:4200/api/oauth/authorized/b2access
|
||||
b2access.externallogin.clientid=eudatdmptool
|
||||
b2access.externallogin.clientSecret=A3b*1*92
|
||||
#################################################################################
|
||||
pdf.converter.url = http://localhost/
|
||||
pdf.converter.url=http://localhost/
|
|
@ -2,5 +2,6 @@ import { environment } from '../environments/environment';
|
|||
export const HostConfiguration = {
|
||||
Server: environment.Server,
|
||||
App: environment.App,
|
||||
CacheLifeTimeMillis: 30000
|
||||
CacheLifeTimeMillis: 30000,
|
||||
HelpServiceUrl: environment.HelpServiceUrl
|
||||
}
|
|
@ -72,7 +72,7 @@ import { B2AccessLoginComponent } from './user-management/login/b2access/b2acces
|
|||
clientId: "eudatdmptool",
|
||||
clientSecret: "A3b*1*92",
|
||||
oauthUrl: "https://b2access-integration.fz-juelich.de:443/oauth2-as/oauth2-authz",
|
||||
redirectUri: "http://dmp.eudat.org:4200/api/oauth/authorized/b2access",
|
||||
redirectUri: "http://dl043.madgik.di.uoa.gr:8080/api/oauth/authorized/b2access",
|
||||
accessTokenUri: "https://b2access-integration.fz-juelich.de:443/oauth2/token"
|
||||
}
|
||||
}),
|
||||
|
|
|
@ -1,49 +1,40 @@
|
|||
<div>
|
||||
<label>
|
||||
<input type="checkbox" [(ngModel)]="isComposite" (ngModelChange)="onIsCompositeChange(isComposite)" /> Composite Field</label>
|
||||
<label>
|
||||
<input type="checkbox" [(ngModel)]="isMultiplicityEnabled" (ngModelChange)="onIsMultiplicityEnabledChange(isMultiplicityEnabled)"
|
||||
/> Multiplicity</label>
|
||||
<div [formGroup]="form">
|
||||
<label>
|
||||
<input type="checkbox" formControlName="hasCommentField" /> Comment</label>
|
||||
<div class="row">
|
||||
<div class="form-group col-md-12">
|
||||
<div class="row">
|
||||
<div class="col-md-4">
|
||||
<label>FieldSet Label</label>
|
||||
<input data-toggle="tooltip" title="tooltip on second input!" type="text" class="form-control" formControlName="title">
|
||||
</div>
|
||||
<div class="form-group col-md-4">
|
||||
<label>Description</label>
|
||||
<input type="text" class="form-control" formControlName="description">
|
||||
</div>
|
||||
<div class="form-group col-md-4">
|
||||
<label>ExtendedDescription</label>
|
||||
<input type="text" class="form-control" formControlName="extendedDescription">
|
||||
</div>
|
||||
</div>
|
||||
<div *ngIf="isMultiplicityEnabled" formGroupName="multiplicity">
|
||||
<div>
|
||||
<h5 style="margin-left:15px; font-weight:bold;">Multiplicity</h5>
|
||||
<div class="col-md-2">
|
||||
<label>Min</label>
|
||||
<input type="number" class="form-control" formControlName="min">
|
||||
</div>
|
||||
|
||||
<div class="col-md-2">
|
||||
<label>Max</label>
|
||||
<input type="number" class="form-control" formControlName="max">
|
||||
</div>
|
||||
<mat-checkbox [(ngModel)]="isComposite" (ngModelChange)="onIsCompositeChange(isComposite)">Composite Field</mat-checkbox>
|
||||
<mat-checkbox [(ngModel)]="isMultiplicityEnabled" (ngModelChange)="onIsMultiplicityEnabledChange(isMultiplicityEnabled)">Multiplicity</mat-checkbox>
|
||||
<div [formGroup]="form">
|
||||
<mat-checkbox formControlName="hasCommentField"> Comment</mat-checkbox>
|
||||
<div class="row">
|
||||
<div class="form-group col-md-6">
|
||||
<mat-form-field class="full-width">
|
||||
<input matInput type="text" placeholder="Title" formControlName="title">
|
||||
</mat-form-field>
|
||||
<mat-form-field class="full-width">
|
||||
<input matInput type="text" placeholder="Description" formControlName="description">
|
||||
</mat-form-field>
|
||||
<mat-form-field class="full-width">
|
||||
<input matInput type="text" placeholder="Extended Description" formControlName="extendedDescription">
|
||||
</mat-form-field>
|
||||
</div>
|
||||
<div class="form-group col-md-6">
|
||||
<div *ngIf="isMultiplicityEnabled" class="col-md-6" formGroupName="multiplicity">
|
||||
<div>
|
||||
<mat-form-field class="full-width">
|
||||
<input matInput placeholder="Min" type="number" formControlName="min">
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field class="full-width">
|
||||
<input matInput placeholder="Max" type="number" formControlName="max">
|
||||
</mat-form-field>
|
||||
</div>
|
||||
</div>
|
||||
<div *ngIf="isComposite" class="col-md-4">
|
||||
<label>Ordinal</label>
|
||||
<input type="number" class="form-control" formControlName="ordinal">
|
||||
</div>
|
||||
<div *ngIf="isComposite" class="col-md-4">
|
||||
<label>Id</label>
|
||||
<input type="string" class="form-control" formControlName="id">
|
||||
<div *ngIf="isComposite" class="col-md-6">
|
||||
<mat-form-field class="full-width">
|
||||
<input matInput type="number" placeholder="Ordinal" formControlName="ordinal">
|
||||
</mat-form-field>
|
||||
<mat-form-field class="full-width">
|
||||
<input matInput type="string" placeholder="Id" formControlName="id">
|
||||
</mat-form-field>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
@ -53,25 +44,20 @@
|
|||
<field-form *ngIf="!isComposite" [form]="form.get('fields').get(''+0)" [dataModel]="dataModel.fields[0]" [showMultiplicity]="false"
|
||||
[indexPath]="indexPath + 'f' + 0"></field-form>
|
||||
|
||||
<div *ngIf="isComposite" class="panel-group" style="margin-top:10px;">
|
||||
<div *ngFor="let field of dataModel.fields let i=index;" class="panel panel-default">
|
||||
<div class="panel-heading clearfix">
|
||||
<a *ngIf="form.get('fields').get(''+i).get('title').value" data-toggle="collapse" href="#{{indexPath + 'f' + i}}" class="panel-title pull-left"
|
||||
style="padding-top: 7.5px;">{{i + 1}}. {{form.get('fields').get(''+i).get('title').value}}</a>
|
||||
<a *ngIf="!form.get('fields').get(''+i).get('title').value" data-toggle="collapse" href="#{{indexPath + 'f' + i}}" class="panel-title pull-left"
|
||||
style="padding-top: 7.5px;">{{i + 1}}. Child Field {{i + 1}}</a>
|
||||
<div *ngIf="isComposite">
|
||||
<mat-expansion-panel *ngFor="let field of dataModel.fields let i=index;">
|
||||
<mat-expansion-panel-header>
|
||||
<mat-panel-title *ngIf="form.get('fields').get(''+i).get('title').value">{{i + 1}}. {{form.get('fields').get(''+i).get('title').value}}</mat-panel-title>
|
||||
<div class="btn-group pull-right">
|
||||
<button type="button" class="btn btn-sm" style="margin-left:5px;" (click)="DeleteField(i);">
|
||||
<span class="glyphicon glyphicon-erase"></span>
|
||||
</button>
|
||||
</div>
|
||||
</mat-expansion-panel-header>
|
||||
<div id="{{indexPath + 'f' + i}}">
|
||||
<field-form [form]="form.get('fields').get(''+i)" [dataModel]="field" [indexPath]="indexPath + 'f' + i"></field-form>
|
||||
</div>
|
||||
<div id="{{indexPath + 'f' + i}}" class="panel-collapse collapse in">
|
||||
<div class="panel-body">
|
||||
<field-form [form]="form.get('fields').get(''+i)" [dataModel]="field" [indexPath]="indexPath + 'f' + i"></field-form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</mat-expansion-panel>
|
||||
</div>
|
||||
|
||||
<div *ngIf="isComposite">
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
.full-width{
|
||||
width: 100%;
|
||||
}
|
|
@ -7,7 +7,7 @@ import { FormArray, FormControl } from '@angular/forms';
|
|||
@Component({
|
||||
selector: 'compositefield-form',
|
||||
templateUrl: './compositefield-form.component.html',
|
||||
styleUrls: []
|
||||
styleUrls: ['./compositefield-form.component.scss']
|
||||
})
|
||||
|
||||
export class CompositeFieldFormComponent {
|
||||
|
|
|
@ -23,6 +23,7 @@ import { RadioBoxComponent } from '../shared/componentsAdmin/radiobox/radiobox-c
|
|||
import { WordlistComponent } from '../shared/componentsAdmin/wordlist/wordlist-component';
|
||||
import { AutocompleteComponent } from '../shared/componentsAdmin/autocomplete/autocomplete-component';
|
||||
import { ComboboxComponent } from '../shared/componentsAdmin/combobox/combobox-component';
|
||||
import { SharedModule } from "@app/shared/shared.module";
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
|
@ -31,6 +32,7 @@ import { ComboboxComponent } from '../shared/componentsAdmin/combobox/combobox-c
|
|||
HttpClientModule,
|
||||
ReactiveFormsModule,
|
||||
RouterModule,
|
||||
SharedModule,
|
||||
RouterModule.forChild(DatasetProfileRoutes)
|
||||
],
|
||||
|
||||
|
|
|
@ -1,23 +1,21 @@
|
|||
<div>
|
||||
<div [formGroup]="form">
|
||||
<div class="row">
|
||||
<div class="form-group col-md-6">
|
||||
<label>Id</label>
|
||||
<input type="text" class="form-control" formControlName="id">
|
||||
</div>
|
||||
<div class="form-row col-md-6">
|
||||
<mat-form-field>
|
||||
<input matInput placeholder='Id' type="text" formControlName="id">
|
||||
</mat-form-field>
|
||||
<div>
|
||||
<div formGroupName="viewStyle">
|
||||
<div class="form-group">
|
||||
<label>View style</label>
|
||||
<select class="form-control" formControlName="renderStyle" (change)= "onchangeCombo($event)">
|
||||
<option value="textarea">textarea</option>
|
||||
<option value="booleanDecision">booleanDecision</option>
|
||||
<option value='combobox'>combobox</option>
|
||||
<option value="checkBox">checkBox</option>
|
||||
<option value="freetext">freetext</option>
|
||||
<option value="radiobox">radiobox</option>
|
||||
</select>
|
||||
</div>
|
||||
<mat-form-field>
|
||||
<mat-select placeholder="View Style" formControlName="renderStyle" (change)="onchangeCombo($event)">
|
||||
<mat-option value="textarea">textarea</mat-option>
|
||||
<mat-option value="booleanDecision">booleanDecision</mat-option>
|
||||
<mat-option value='combobox'>combobox</mat-option>
|
||||
<mat-option value="checkBox">checkBox</mat-option>
|
||||
<mat-option value="freetext">freetext</mat-option>
|
||||
<mat-option value="radiobox">radiobox</mat-option>
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -53,68 +51,55 @@
|
|||
</div> -->
|
||||
<div class="row">
|
||||
<div *ngIf="isFieldMultiplicityEnabled" formGroupName="multiplicity">
|
||||
<div class="form-group">
|
||||
<h5 style="margin-left:15px; font-weight:bold;">Multiplicity</h5>
|
||||
<div class="col-md-2">
|
||||
<label>Min</label>
|
||||
<input type="number" class="form-control" formControlName="min">
|
||||
</div>
|
||||
<div>
|
||||
<h5>Multiplicity</h5>
|
||||
<mat-form-field class="full-width">
|
||||
<input matInput type="number" placeholder="Min" formControlName="min">
|
||||
</mat-form-field>
|
||||
|
||||
<div class="col-md-2">
|
||||
<label>Max</label>
|
||||
<input type="number" class="form-control" formControlName="max">
|
||||
</div>
|
||||
<mat-form-field class="full-width">
|
||||
<input matInput type="number" placeholder="Max" formControlName="max">
|
||||
</mat-form-field>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group col-md-2">
|
||||
<label>Ordinal</label>
|
||||
<input type="number" class="form-control" formControlName="ordinal">
|
||||
</div>
|
||||
<mat-form-field class="full-width">
|
||||
<input matInput type="number" placeholder="Ordinal" formControlName="ordinal">
|
||||
</mat-form-field>
|
||||
<div formGroupName="defaultValue">
|
||||
<div class="form-group col-md-5">
|
||||
<label>Default Value</label>
|
||||
<input type="text" class="form-control" formControlName="value">
|
||||
</div>
|
||||
<mat-form-field class="full-width">
|
||||
<input matInput type="text" placeholder="Default Value" formControlName="value">
|
||||
</mat-form-field>
|
||||
</div>
|
||||
<div class="form-group col-md-5">
|
||||
<label>Validation</label>
|
||||
<div class="col-md-5">
|
||||
<div formArrayName="validations">
|
||||
<div *ngFor="let validation of form.controls.validations.controls; let i=index">
|
||||
<select class="form-control" [formControlName]="i">
|
||||
<option *ngFor= "let option of validationsOptions" [value]="option.key">{{option.value}}</option>
|
||||
</select>
|
||||
<mat-form-field>
|
||||
<mat-select placeholder='Validation' [formControlName]="i">
|
||||
<mat-option *ngFor="let option of validationsOptions" [value]="option.key">{{option.value}}</mat-option>
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<label *ngIf="showMultiplicity">
|
||||
<input type="checkbox" [(ngModel)]="isFieldMultiplicityEnabled" (ngModelChange)="onIsFieldMultiplicityEnabledChange(isFieldMultiplicityEnabled)"
|
||||
/> Multiplicity</label>
|
||||
<mat-checkbox *ngIf="showMultiplicity" [(ngModel)]="isFieldMultiplicityEnabled" (ngModelChange)="onIsFieldMultiplicityEnabledChange(isFieldMultiplicityEnabled)">Multiplicity</mat-checkbox>
|
||||
<mat-expansion-panel *ngFor="let rule of dataModel.visible.rules let i=index;">
|
||||
<mat-expansion-panel-header>
|
||||
<mat-panel-title>{{i + 1}}. Rule {{i + 1}}</mat-panel-title>
|
||||
|
||||
<div class="panel-group" style="margin-top:10px;">
|
||||
<div *ngFor="let rule of dataModel.visible.rules let i=index;" class="panel panel-default">
|
||||
<div class="panel-heading clearfix">
|
||||
<a data-toggle="collapse" href="#{{indexPath + 'r' + i}}" class="panel-title pull-left" style="padding-top: 7.5px;">{{i + 1}}. Rule {{i + 1}}</a>
|
||||
<div class="btn-group pull-right">
|
||||
<button type="button" class="btn btn-sm" style="margin-left:5px;" (click)="DeleteRule(i);">
|
||||
<span class="glyphicon glyphicon-erase"></span>
|
||||
</button>
|
||||
</div>
|
||||
</mat-expansion-panel-header>
|
||||
<rule-form [form]="form.get('visible').get('rules').get(''+i)" [dataModel]="rule"></rule-form>
|
||||
</mat-expansion-panel>
|
||||
<a (click)="addNewRule()" style="cursor: pointer">
|
||||
Add Rule +
|
||||
</a>
|
||||
|
||||
<div class="btn-group pull-right">
|
||||
<button type="button" class="btn btn-sm" style="margin-left:5px;" (click)="DeleteRule(i);">
|
||||
<span class="glyphicon glyphicon-erase"></span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div id="{{indexPath + 'r' + i}}" class="panel-collapse collapse in">
|
||||
<div class="panel-body">
|
||||
<rule-form [form]="form.get('visible').get('rules').get(''+i)" [dataModel]="rule"></rule-form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<a (click)="addNewRule()" style="cursor: pointer">
|
||||
Add Rule +
|
||||
</a>
|
||||
</div>
|
||||
|
||||
</div>
|
|
@ -0,0 +1,3 @@
|
|||
.full-width{
|
||||
width: 100%;
|
||||
}
|
|
@ -8,7 +8,7 @@ import { Rule } from '@app/models/datasetProfileAdmin/Rule';
|
|||
@Component({
|
||||
selector: 'field-form',
|
||||
templateUrl: './field-form.component.html',
|
||||
styleUrls: []
|
||||
styleUrls: ['./field-form.component.scss']
|
||||
})
|
||||
|
||||
export class FieldFormComponent {
|
||||
|
|
|
@ -1,59 +1,49 @@
|
|||
<div class="container">
|
||||
<div style="background-color: #f5f5f5;border: 1px solid #e3e3e3;padding: 24px;">
|
||||
<mat-card>
|
||||
<form *ngIf="form" novalidate [formGroup]="form" (ngSubmit)="onSubmit()">
|
||||
<div class="row">
|
||||
<div class="form-group col-md-12">
|
||||
<label>Label</label>
|
||||
<input type="text" class="form-control" formControlName="label">
|
||||
<div *ngIf="form.get('label').invalid && (form.get('label').dirty || form.get('label').touched)">
|
||||
<div *ngIf="form.get('label').errors.required" class="alert alert-danger">
|
||||
Label is required.
|
||||
</div>
|
||||
</div>
|
||||
<mat-form-field class="full-width">
|
||||
<input matInput formControlName="label" placeholder="Label">
|
||||
</mat-form-field>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="panel-group" style="margin-top:10px;">
|
||||
<div *ngFor="let section of dataModel.sections; let i=index;" class="panel panel-default">
|
||||
<div class="panel-heading clearfix">
|
||||
<a *ngIf="form.get('sections').get(''+i).get('title').value" data-toggle="collapse" href="#{{'s' + i}}" class="panel-title pull-left"
|
||||
style="padding-top: 7.5px;">{{i + 1}}. {{form.get('sections').get(''+i).get('title').value}}</a>
|
||||
<a *ngIf="!form.get('sections').get(''+i).get('title').value" data-toggle="collapse" href="#{{'s' + i}}" class="panel-title pull-left"
|
||||
style="padding-top: 7.5px;">{{i + 1}}. Section {{i + 1}}</a>
|
||||
<div>
|
||||
<mat-expansion-panel *ngFor="let section of dataModel.sections; let i=index;">
|
||||
<mat-expansion-panel-header>
|
||||
<mat-panel-title *ngIf="form.get('sections').get(''+i).get('title').value">{{i + 1}}. {{form.get('sections').get(''+i).get('title').value}}</mat-panel-title>
|
||||
<div class="btn-group pull-right">
|
||||
<button type="button" class="btn btn-sm" style="margin-left:5px;" (click)="DeleteSection(i);">
|
||||
<span class="glyphicon glyphicon-erase"></span>
|
||||
</button>
|
||||
<button type="button" class="btn btn-sm" style="margin-left:5px;" (click)="DeleteSection(i);">
|
||||
<span class="glyphicon glyphicon-erase"></span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div id="{{'s' + i}}" class="panel-collapse collapse in">
|
||||
<div class="panel-body">
|
||||
</mat-expansion-panel-header>
|
||||
<div id="{{'s' + i}}">
|
||||
<div>
|
||||
<section-form [form]="form.get('sections').get(''+i)" [dataModel]="section" [indexPath]="'s' + i"></section-form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</mat-expansion-panel>
|
||||
</div>
|
||||
|
||||
<div class="panel-group" style="margin-top:10px;">
|
||||
<div *ngFor="let page of dataModel.pages; let i=index;" class="panel panel-default">
|
||||
<div class="panel-heading clearfix">
|
||||
<a *ngIf="form.get('pages').at(i).get('title').value" data-toggle="collapse" href="#{{'p' + i}}" class="panel-title pull-left"
|
||||
style="padding-top: 7.5px;">{{i + 1}}.{{form.get('pages').at(i).get('title').value}}</a>
|
||||
<a *ngIf="!form.get('pages').at(i).get('title').value" data-toggle="collapse" href="#{{'p' + i}}" class="panel-title pull-left"
|
||||
style="padding-top: 7.5px;">{{i + 1}}. Page{{i + 1}}</a>
|
||||
<div class="btn-group pull-right">
|
||||
<button type="button" class="btn btn-sm" style="margin-left:5px;" (click)="DeletePage(i);">
|
||||
<span class="glyphicon glyphicon-erase"></span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div id="{{'p' + i}}" class="panel-collapse collapse in">
|
||||
<div class="panel-body">
|
||||
<page-form [form]="form.get('pages').at(i)" [dataModel]="page"></page-form>
|
||||
</div>
|
||||
</div>
|
||||
<div class="panel-group">
|
||||
<mat-expansion-panel *ngFor="let page of dataModel.pages; let i=index;">
|
||||
<mat-expansion-panel-header>
|
||||
<mat-panel-title *ngIf="form.get('pages').at(i).get('title').value">{{i + 1}}.{{form.get('pages').at(i).get('title').value}}</mat-panel-title>
|
||||
<div class="btn-group pull-right">
|
||||
<button type="button" class="btn btn-sm" style="margin-left:5px;" (click)="DeletePage(i);">
|
||||
<span class="glyphicon glyphicon-erase"></span>
|
||||
</button>
|
||||
</div>
|
||||
</mat-expansion-panel-header>
|
||||
<div id="{{'p' + i}}">
|
||||
<div>
|
||||
<page-form [form]="form.get('pages').at(i)" [dataModel]="page"></page-form>
|
||||
</div>
|
||||
</div>
|
||||
</mat-expansion-panel>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div style="margin-top:20px; padding-left: 15px;" class="row">
|
||||
<a (click)="addSection()" style="cursor: pointer">
|
||||
|
@ -61,13 +51,13 @@
|
|||
</a>
|
||||
</div>
|
||||
|
||||
<div style="margin-top:20px; padding-left: 15px;" class="row">
|
||||
<a (click)="addPage()" style="cursor: pointer">
|
||||
Add Page +
|
||||
</a>
|
||||
</div>
|
||||
<div style="margin-top:20px; padding-left: 15px;" class="row">
|
||||
<a (click)="addPage()" style="cursor: pointer">
|
||||
Add Page +
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<button class="btn btn-primary" style="margin-top:20px;" type="submit" [disabled]="!form.valid">Save</button>
|
||||
<button mat-raised-button color="primary" type="submit" [disabled]="!form.valid">Save</button>
|
||||
</form>
|
||||
</div>
|
||||
</mat-card>
|
||||
</div>
|
|
@ -0,0 +1,3 @@
|
|||
.full-width {
|
||||
width: 100%;
|
||||
}
|
|
@ -15,7 +15,7 @@ import { Section } from '@app/models/datasetProfileAdmin/Section';
|
|||
selector: 'form-comp',
|
||||
templateUrl: './form.component.html',
|
||||
providers:[DatasetProfileAdmin, DatasetProfileService],
|
||||
styleUrls: []
|
||||
styleUrls: ['./form.component.scss']
|
||||
})
|
||||
|
||||
export class FormComponent {
|
||||
|
|
|
@ -1,32 +1,22 @@
|
|||
<div>
|
||||
<div [formGroup]="form">
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-6">
|
||||
<label>Rule Type</label>
|
||||
<select class="form-control" formControlName="ruleType">
|
||||
<option>field value</option>
|
||||
</select>
|
||||
<div [formGroup]="form">
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<mat-form-field>
|
||||
<mat-select placeholder="Rule Type" formControlName="ruleType">
|
||||
<mat-option>field value</mat-option>
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
<div class="form-group col-md-6">
|
||||
<label>Target</label>
|
||||
<input type="text" class="form-control" placeholder="field id" formControlName="target" (change)="TargetValidation()">
|
||||
<div class="col-md-6">
|
||||
<mat-form-field>
|
||||
<input matInput type="text" placeholder="Target" formControlName="target" (change)="TargetValidation()">
|
||||
</mat-form-field>
|
||||
</div>
|
||||
<!-- <div class="form-group col-md-4">
|
||||
<label>Rule style</label>
|
||||
<select class="form-control">
|
||||
<option>boolean</option>
|
||||
<option>checked</option>
|
||||
<option>unchecked</option>
|
||||
<option>dropdown value</option>
|
||||
</select>
|
||||
</div> -->
|
||||
<!-- <div class="form-group col-md-6">
|
||||
<label>Value Type</label>
|
||||
<input type="text" class="form-control" formControlName="valueType">
|
||||
</div> -->
|
||||
<div class="form-group col-md-12">
|
||||
<label>Value</label>
|
||||
<input type="text" class="form-control" formControlName="value">
|
||||
<div class="col-md-12">
|
||||
<mat-form-field>
|
||||
<input matInput type="text" placeholder="Value" formControlName="value">
|
||||
</mat-form-field>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -5,7 +5,7 @@ import { Rule } from 'app/models/datasetProfileAdmin/Rule'
|
|||
@Component({
|
||||
selector: 'rule-form',
|
||||
templateUrl: './rule.component.html',
|
||||
styleUrls: []
|
||||
styleUrls: ['./rule.component.scss']
|
||||
})
|
||||
|
||||
export class RuleFormComponent {
|
||||
|
|
|
@ -1,5 +0,0 @@
|
|||
.section-container {
|
||||
background-color: #f5f5f5;
|
||||
border: 1px solid #e3e3e3;
|
||||
padding: 24px;
|
||||
}
|
|
@ -1,56 +1,46 @@
|
|||
<div class="section-container">
|
||||
<div>
|
||||
<div class="row" [formGroup]="form">
|
||||
<div class="row">
|
||||
<div class="form-group col-md-4">
|
||||
<label>Title</label>
|
||||
<input type="text" class="form-control" formControlName="title">
|
||||
</div>
|
||||
<div class="form-group col-md-2">
|
||||
<label>Id</label>
|
||||
<input type="text" class="form-control" formControlName="id">
|
||||
</div>
|
||||
<div class="form-group col-md-2">
|
||||
<label>Ordinal</label>
|
||||
<input type="number" class="form-control" formControlName="ordinal">
|
||||
</div>
|
||||
<div class="form-group col-md-2">
|
||||
<label>Page</label>
|
||||
<select class="form-control" formControlName="page">
|
||||
<option *ngFor="let pageGroup of form.root.get('pages').controls;" [value]="pageGroup.get('id').value">{{pageGroup.get('title').value}}</option>
|
||||
</select>
|
||||
<div *ngIf="form.get('page').invalid && (form.get('page').dirty || form.get('page').touched)" class="alert alert-danger">Page is required</div>
|
||||
</div>
|
||||
<div class="form-group col-md-2">
|
||||
<label class="radio control-label">Default Visibility</label>
|
||||
<label class="radio-inline">
|
||||
<input type="radio" [value]="true" formControlName="defaultVisibility"> true
|
||||
</label>
|
||||
<label class="radio-inline">
|
||||
<input type="radio" [value]="false" formControlName="defaultVisibility"> false
|
||||
</label>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<mat-form-field class="full-width">
|
||||
<input matInput type="text" placeholder="Title" formControlName="title">
|
||||
</mat-form-field>
|
||||
<mat-form-field class="full-width">
|
||||
<input matInput type="text" placeholder="Id" formControlName="id">
|
||||
</mat-form-field>
|
||||
<mat-form-field class="full-width">
|
||||
<input matInput type="number" placeholder="Ordinal" formControlName="ordinal">
|
||||
</mat-form-field>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<mat-form-field class="full-width">
|
||||
<mat-select placeholder='Page' formControlName="page">
|
||||
<mat-option *ngFor="let pageGroup of form.root.get('pages').controls;" [value]="pageGroup.get('id').value">{{pageGroup.get('title').value}}</mat-option>
|
||||
</mat-select>
|
||||
<!-- <div *ngIf="form.get('page').invalid && (form.get('page').dirty || form.get('page').touched)" class="alert alert-danger">Page is required</div> -->
|
||||
</mat-form-field>
|
||||
<label>Default Visibility</label>
|
||||
<mat-radio-group formControlName="defaultVisibility" class="full-width">
|
||||
<mat-radio-button [value]="true">true</mat-radio-button>
|
||||
<mat-radio-button [value]="false">false</mat-radio-button>
|
||||
</mat-radio-group>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div *ngIf="dataModel.sections.length > 0" class="panel-group" style="margin-top:10px;">
|
||||
<div *ngFor="let section of dataModel.sections; let i=index;" class="panel panel-default">
|
||||
<div class="panel-heading clearfix">
|
||||
<a *ngIf="form.get('sections').get(''+i).get('title').value" data-toggle="collapse" href="#{{indexPath + 's' + i}}" class="panel-title pull-left"
|
||||
style="padding-top: 7.5px;">{{i + 1}}. {{form.get('sections').get(''+i).get('title').value}}</a>
|
||||
<a *ngIf="!form.get('sections').get(''+i).get('title').value" data-toggle="collapse" href="#{{indexPath + 's' + i}}" class="panel-title pull-left"
|
||||
style="padding-top: 7.5px;">{{i + 1}}. Section {{i + 1}}</a>
|
||||
<div *ngIf="dataModel.sections.length > 0">
|
||||
<mat-expansion-panel *ngFor="let section of dataModel.sections; let i=index;">
|
||||
<mat-expansion-panel-header>
|
||||
<mat-panel-title *ngIf="form.get('sections').get(''+i).get('title').value">{{i + 1}}. {{form.get('sections').get(''+i).get('title').value}}</mat-panel-title>
|
||||
<div class="btn-group pull-right">
|
||||
<button type="button" class="btn btn-sm" style="margin-left:5px;" (click)="DeleteSectionInSection(i);">
|
||||
<span class="glyphicon glyphicon-erase"></span>
|
||||
</button>
|
||||
</div>
|
||||
</mat-expansion-panel-header>
|
||||
<div id="{{indexPath + 's' + i}}">
|
||||
<section-form [form]="form.get('sections').get(''+i)" [dataModel]="section" [indexPath]="indexPath + 's' + i"></section-form>
|
||||
</div>
|
||||
<div id="{{indexPath + 's' + i}}" class="panel-collapse collapse in">
|
||||
<div class="panel-body">
|
||||
<section-form [form]="form.get('sections').get(''+i)" [dataModel]="section" [indexPath]="indexPath + 's' + i"></section-form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</mat-expansion-panel>
|
||||
</div>
|
||||
|
||||
|
||||
|
@ -61,28 +51,25 @@
|
|||
<groupfield-form [form]="form.get('fieldGroups').get(''+i)" [dataModel]="fieldGroup" [indexPath]="indexPath + 'g' + i"></groupfield-form>
|
||||
</div> -->
|
||||
|
||||
<div class="panel-group" style="margin-top:10px;">
|
||||
<div *ngFor="let field of dataModel.fieldSets let i=index;" class="panel panel-default">
|
||||
<div class="panel-heading clearfix">
|
||||
<div>
|
||||
<mat-expansion-panel *ngFor="let field of dataModel.fieldSets let i=index;" class="panel panel-default">
|
||||
<mat-expansion-panel-header>
|
||||
<!-- <a *ngIf="form.get('compositeFields').get(''+i).get('title').value" data-toggle="collapse" href="#{{'compositeFieldCollapse' + i}}"
|
||||
class="panel-title pull-left" style="padding-top: 7.5px;">{{i + 1}}. {{form.get('compositeFields').get(''+i).get('title').value}}</a>
|
||||
<a *ngIf="!form.get('compositeFields').get(''+i).get('title').value" data-toggle="collapse" href="#{{'compositeFieldCollapse' + i}}"
|
||||
class="panel-title pull-left" style="padding-top: 7.5px;">{{i + 1}}. Field {{i + 1}}</a> -->
|
||||
<a data-toggle="collapse" href="#{{indexPath + 'cf' + i}}"
|
||||
class="panel-title pull-left" style="padding-top: 7.5px;">{{i + 1}}. Field {{i + 1}}</a>
|
||||
|
||||
<div class="btn-group pull-right">
|
||||
<mat-panel-title>{{i + 1}}. Field {{i + 1}}</mat-panel-title>
|
||||
|
||||
<div>
|
||||
<button type="button" class="btn btn-sm" style="margin-left:5px;" (click)="DeleteFieldSet(i);">
|
||||
<span class="glyphicon glyphicon-erase"></span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div id="{{indexPath + 'cf' + i}}" class="panel-collapse collapse in">
|
||||
<div class="panel-body">
|
||||
<compositefield-form [form]="form.get('fieldSets').get(''+i)" [dataModel]="field" [indexPath]="indexPath + 'cf' + i"></compositefield-form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</mat-expansion-panel-header>
|
||||
|
||||
<compositefield-form [form]="form.get('fieldSets').get(''+i)" [dataModel]="field" [indexPath]="indexPath + 'cf' + i"></compositefield-form>
|
||||
|
||||
</mat-expansion-panel>
|
||||
</div>
|
||||
|
||||
<!--
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
.full-width {
|
||||
width: 100%;
|
||||
}
|
|
@ -11,7 +11,7 @@ import { JsonSerializer } from 'app/utilities/JsonSerializer';
|
|||
@Component({
|
||||
selector: 'section-form',
|
||||
templateUrl: './section-form.component.html',
|
||||
styleUrls: ['./section-form.component.css'],
|
||||
styleUrls: ['./section-form.component.scss'],
|
||||
encapsulation: ViewEncapsulation.None
|
||||
})
|
||||
|
||||
|
|
|
@ -8,6 +8,8 @@
|
|||
(click)="saveFinalize();" type="button">Save and Finalize</button>
|
||||
<button mat-raised-button color="primary" *ngIf="datasetWizardModel&&datasetWizardModel?.status == 1" style="margin-top: 15px;margin-bottom: 15px;margin-right: 15px;"
|
||||
(click)="downloadPDF();" type="button">Download PDF</button>
|
||||
<button mat-raised-button color="primary" *ngIf="datasetWizardModel&&datasetWizardModel?.status == 1" style="margin-top: 15px;margin-bottom: 15px;margin-right: 15px;"
|
||||
(click)="downloadXML();" type="button">Download XML</button>
|
||||
<mat-horizontal-stepper [linear]="isLinear" #stepper>
|
||||
<mat-step [stepControl]="formGroup">
|
||||
<form *ngIf="formGroup" [formGroup]="formGroup">
|
||||
|
|
|
@ -255,6 +255,15 @@ export class DatasetWizardComponent {
|
|||
})
|
||||
}
|
||||
|
||||
downloadXML(): void {
|
||||
this.datasetWizardService.downloadXML(this.itemId).subscribe(response => {
|
||||
const blob = new Blob([response.body], { type: 'application/xml' })
|
||||
const filename = this.getFilenameFromContentDispositionHeader(response.headers.get('Content-Disposition'));
|
||||
|
||||
FileSaver.saveAs(blob, filename)
|
||||
})
|
||||
}
|
||||
|
||||
getFilenameFromContentDispositionHeader(header: string): string { // expecting filename=XXXX or filename="XXXX" to exist
|
||||
// const regex: RegExp = new RegExp(/filename=((\"(.*)\")|([^;]*))/g);
|
||||
const regex: RegExp = new RegExp(/filename[^;=\n]*=((['"]).*?\2|[^;\n]*)/g);
|
||||
|
|
|
@ -46,7 +46,11 @@ export class DatasetWizardService {
|
|||
}
|
||||
|
||||
public downloadPDF(id: string): Observable<HttpResponse<Blob>> {
|
||||
return this.httpClient.get(this.actionUrl + 'getWordDocument/' + id, { responseType: 'blob', observe: 'response' })
|
||||
return this.httpClient.get(this.actionUrl + 'getPDF/' + id, { responseType: 'blob', observe: 'response' })
|
||||
}
|
||||
|
||||
public downloadXML(id: string): Observable<HttpResponse<Blob>> {
|
||||
return this.httpClient.get(this.actionUrl + 'getXml/' + id, { responseType: 'blob', observe: 'response' })
|
||||
}
|
||||
|
||||
public getDefinition(id: String): Observable<DatasetProfileDefinitionModel> {
|
||||
|
|
|
@ -9,7 +9,7 @@ import { CachedContentItem } from './CachedContentItem';
|
|||
import { HostConfiguration } from '../../app.constants';
|
||||
@Injectable()
|
||||
export class HelpContentService {
|
||||
private _helpServiceUrl = "http://localhost:5000";
|
||||
private _helpServiceUrl = HostConfiguration.HelpServiceUrl;
|
||||
cache = new Map<String, CachedContentItem>();
|
||||
|
||||
constructor(private http: Http) {
|
||||
|
|
|
@ -13,6 +13,16 @@
|
|||
<mat-cell *matCellDef="let row">{{row.name}}</mat-cell>
|
||||
</ng-container>
|
||||
|
||||
<ng-container cdkColumnDef="email">
|
||||
<mat-header-cell *matHeaderCellDef>{{'USERS.LISTING.EMAIL' | translate}}</mat-header-cell>
|
||||
<mat-cell *matCellDef="let row">{{row.email}}</mat-cell>
|
||||
</ng-container>
|
||||
|
||||
<ng-container cdkColumnDef="lastloggedin">
|
||||
<mat-header-cell *matHeaderCellDef>{{'USERS.LISTING.LAST-LOGGED-IN' | translate}}</mat-header-cell>
|
||||
<mat-cell *matCellDef="let row">{{row.lastloggedin | date:'shortDate'}}</mat-cell>
|
||||
</ng-container>
|
||||
|
||||
<!-- Column Definition: Roles -->
|
||||
<ng-container cdkColumnDef="roles">
|
||||
<mat-header-cell *matHeaderCellDef>{{'USERS.LISTING.ROLES' | translate}}</mat-header-cell>
|
||||
|
|
|
@ -112,7 +112,7 @@ export class UsersComponent implements OnInit, AfterViewInit {
|
|||
@ViewChild(UsersCriteriaComponent) criteria: UsersCriteriaComponent;
|
||||
|
||||
dataSource: UsersDataSource | null;
|
||||
displayedColumns: String[] = ['name', 'roles'];
|
||||
displayedColumns: String[] = ['name', 'email', 'lastloggedin', 'roles'];
|
||||
|
||||
constructor(private userService: UserReferenceService, private router: Router, private languageService: TranslateService, public snackBar: MatSnackBar) {
|
||||
|
||||
|
|
|
@ -191,7 +191,9 @@
|
|||
},
|
||||
"USERS": {
|
||||
"LISTING": {
|
||||
"TITLE": "Users",
|
||||
"TITLE": "Users",
|
||||
"EMAIL": "Email",
|
||||
"LAST-LOGGED-IN": "Last Logged In",
|
||||
"LABEL": "Label",
|
||||
"ROLES": "Roles"
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
export const environment = {
|
||||
production: true,
|
||||
Server: 'http://dl043.madgik.di.uoa.gr:8080/api/',
|
||||
App: 'http://dl043.madgik.di.uoa.gr:8080/'
|
||||
App: 'http://dl043.madgik.di.uoa.gr:8080/',
|
||||
HelpServiceUrl:'localhost:5000/'
|
||||
};
|
||||
|
|
|
@ -6,5 +6,6 @@
|
|||
export const environment = {
|
||||
production: false,
|
||||
Server: 'http://devel-21.local.cite.gr:8080/api/',
|
||||
App: 'localhost:4200/'
|
||||
App: 'localhost:4200/',
|
||||
HelpServiceUrl:'localhost:5000/'
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue