more frontend changes

This commit is contained in:
Diamantis Tziotzios 2023-12-28 17:18:49 +02:00
parent 2d377f6003
commit 244e0e83a2
381 changed files with 3895 additions and 27118 deletions

View File

@ -114,4 +114,9 @@ public class AuditableAction {
public static final EventId Deposit_GetAccessToken = new EventId(18001, "Deposit_GetAccessToken");
public static final EventId Deposit_Deposit = new EventId(18002, "Deposit_Deposit");
public static final EventId Deposit_GetLogo = new EventId(18003, "Deposit_GetLogo");
public static final EventId Tag_Query = new EventId(19000, "Tag_Query");
public static final EventId Tag_Lookup = new EventId(19001, "Tag_Lookup");
public static final EventId Tag_Persist = new EventId(19002, "Tag_Persist");
public static final EventId Tag_Delete = new EventId(19003, "Tag_Delete");
}

View File

@ -50,4 +50,8 @@ public class EventBroker {
this.applicationEventPublisher.publishEvent(event);
}
public void emit(TagTouchedEvent event) {
this.applicationEventPublisher.publishEvent(event);
}
}

View File

@ -0,0 +1,24 @@
package eu.eudat.event;
import java.util.UUID;
public class TagTouchedEvent {
public TagTouchedEvent() {
}
public TagTouchedEvent(UUID id) {
this.id = id;
}
private UUID id;
public UUID getId() {
return id;
}
public void setId(UUID id) {
this.id = id;
}
}

View File

@ -12,95 +12,75 @@ import java.util.UUID;
public class Dmp {
private UUID id;
public static final String _id = "id";
private String label;
public static final String _label = "label";
private Short version;
public static final String _version = "version";
private DmpStatus status;
public static final String _status = "status";
private DmpVersionStatus versionStatus;
public static final String _versionStatus = "versionStatus";
private String properties;
public static final String _properties = "properties";
private UUID groupId;
public static final String _groupId = "groupId";
private String description;
public static final String _description = "description";
private Instant createdAt;
public static final String _createdAt = "createdAt";
private Instant updatedAt;
public static final String _updatedAt = "updatedAt";
private IsActive isActive;
public static final String _isActive = "isActive";
private Instant finalizedAt;
public static final String _finalizedAt = "finalizedAt";
private Instant publishedAt;
public static final String _publishedAt = "publishedAt";
private User creator;
public static final String _creator = "creator";
private DmpAccessType accessType;
public static final String _accessType = "accessType";
private DmpBlueprint blueprint;
public static final String _blueprint = "blueprint";
private String language;
public static final String _language = "language";
private Instant publicAfter;
public static final String _publicAfter = "publicAfter";
private String hash;
public static final String _hash = "hash";
private List<DmpReference> dmpReferences;
public static final String _dmpReferences = "dmpReferences";
private List<DmpUser> dmpUsers;
public static final String _dmpUsers = "dmpUsers";
private List<Description> descriptions;
public static final String _descriptions = "descriptions";
private List<EntityDoi> entityDois;
private List<DmpDescriptionTemplate> dmpDescriptionTemplates;
public static final String _dmpDescriptionTemplates = "dmpDescriptionTemplates";
private List<EntityDoi> entityDois;
public static final String _entityDois = "entityDois";
public UUID getId() {
@ -279,6 +259,14 @@ public class Dmp {
this.descriptions = descriptions;
}
public List<DmpDescriptionTemplate> getDmpDescriptionTemplates() {
return dmpDescriptionTemplates;
}
public void setDmpDescriptionTemplates(List<DmpDescriptionTemplate> dmpDescriptionTemplates) {
this.dmpDescriptionTemplates = dmpDescriptionTemplates;
}
public List<EntityDoi> getEntityDois() {
return entityDois;
}

View File

@ -3,6 +3,7 @@ package eu.eudat.model.builder;
import eu.eudat.authorization.AuthorizationFlags;
import eu.eudat.commons.enums.EntityType;
import eu.eudat.convention.ConventionService;
import eu.eudat.data.DmpDescriptionTemplateEntity;
import eu.eudat.data.DmpEntity;
import eu.eudat.model.*;
import eu.eudat.query.*;
@ -73,6 +74,9 @@ public class DmpBuilder extends BaseBuilder<Dmp, DmpEntity> {
FieldSet descriptionsFields = fields.extractPrefixed(this.asPrefix(Dmp._descriptions));
Map<UUID, List<Description>> descriptionsMap = this.collectDmpDescriptions(descriptionsFields, data);
FieldSet dmpDescriptionTemplatesFields = fields.extractPrefixed(this.asPrefix(Dmp._dmpDescriptionTemplates));
Map<UUID, List<DmpDescriptionTemplate>> dmpDescriptionTemplatesMap = this.collectDmpDescriptionTemplates(dmpDescriptionTemplatesFields, data);
for (DmpEntity d : data) {
Dmp m = new Dmp();
if (fields.hasField(this.asIndexer(Dmp._id))) m.setId(d.getId());
@ -97,6 +101,7 @@ public class DmpBuilder extends BaseBuilder<Dmp, DmpEntity> {
if (dmpReferencesMap != null && !dmpReferencesMap.isEmpty() && dmpReferencesMap.containsKey(d.getId())) m.setDmpReferences(dmpReferencesMap.get(d.getId()));
if (dmpUsersMap != null && !dmpUsersMap.isEmpty() && dmpUsersMap.containsKey(d.getId())) m.setDmpUsers(dmpUsersMap.get(d.getId()));
if (descriptionsMap != null && !descriptionsMap.isEmpty() && descriptionsMap.containsKey(d.getId())) m.setDescriptions(descriptionsMap.get(d.getId()));
if (dmpDescriptionTemplatesMap != null && !dmpDescriptionTemplatesMap.isEmpty() && dmpDescriptionTemplatesMap.containsKey(d.getId())) m.setDmpDescriptionTemplates(dmpDescriptionTemplatesMap.get(d.getId()));
models.add(m);
}
@ -110,7 +115,7 @@ public class DmpBuilder extends BaseBuilder<Dmp, DmpEntity> {
this.logger.debug("checking related - {}", DmpReference.class.getSimpleName());
Map<UUID, List<DmpReference>> itemMap;
FieldSet clone = new BaseFieldSet(fields.getFields()).ensure(this.asIndexer(DmpReference._dmp, Dmp._id));
FieldSet clone = new BaseFieldSet(fields.getFields()).ensure(this.asIndexer(DmpReference._dmp, DmpReference._id));
DmpReferenceQuery query = this.queryFactory.query(DmpReferenceQuery.class).authorize(this.authorize).dmpIds(data.stream().map(DmpEntity::getId).distinct().collect(Collectors.toList()));
itemMap = this.builderFactory.builder(DmpReferenceBuilder.class).authorize(this.authorize).asMasterKey(query, clone, x -> x.getDmp().getId());
@ -207,7 +212,7 @@ public class DmpBuilder extends BaseBuilder<Dmp, DmpEntity> {
this.logger.debug("checking related - {}", DmpUser.class.getSimpleName());
Map<UUID, List<DmpUser>> itemMap;
FieldSet clone = new BaseFieldSet(fields.getFields()).ensure(this.asIndexer(DmpUser._dmp, Dmp._id));
FieldSet clone = new BaseFieldSet(fields.getFields()).ensure(this.asIndexer(DmpUser._dmp, DmpUser._id));
DmpUserQuery query = this.queryFactory.query(DmpUserQuery.class).authorize(this.authorize).dmpIds(data.stream().map(DmpEntity::getId).distinct().collect(Collectors.toList()));
itemMap = this.builderFactory.builder(DmpUserBuilder.class).authorize(this.authorize).asMasterKey(query, clone, x -> x.getDmp().getId());
@ -225,7 +230,7 @@ public class DmpBuilder extends BaseBuilder<Dmp, DmpEntity> {
this.logger.debug("checking related - {}", Description.class.getSimpleName());
Map<UUID, List<Description>> itemMap;
FieldSet clone = new BaseFieldSet(fields.getFields()).ensure(this.asIndexer(Description._dmp, Dmp._id));
FieldSet clone = new BaseFieldSet(fields.getFields()).ensure(this.asIndexer(Description._dmp, Description._id));
DescriptionQuery query = this.queryFactory.query(DescriptionQuery.class).authorize(this.authorize).dmpIds(data.stream().map(DmpEntity::getId).distinct().collect(Collectors.toList()));
itemMap = this.builderFactory.builder(DescriptionBuilder.class).authorize(this.authorize).asMasterKey(query, clone, x -> x.getDmp().getId());
@ -238,4 +243,22 @@ public class DmpBuilder extends BaseBuilder<Dmp, DmpEntity> {
return itemMap;
}
private Map<UUID, List<DmpDescriptionTemplate>> collectDmpDescriptionTemplates(FieldSet fields, List<DmpEntity> data) throws MyApplicationException {
if (fields.isEmpty() || data.isEmpty()) return null;
this.logger.debug("checking related - {}", Description.class.getSimpleName());
Map<UUID, List<DmpDescriptionTemplate>> itemMap;
FieldSet clone = new BaseFieldSet(fields.getFields()).ensure(this.asIndexer(DmpDescriptionTemplate._dmp, DmpDescriptionTemplate._id));
DmpDescriptionTemplateQuery query = this.queryFactory.query(DmpDescriptionTemplateQuery.class).authorize(this.authorize).dmpIds(data.stream().map(DmpEntity::getId).distinct().collect(Collectors.toList()));
itemMap = this.builderFactory.builder(DmpDescriptionTemplateBuilder.class).authorize(this.authorize).asMasterKey(query, clone, x -> x.getDmp().getId());
if (!fields.hasField(this.asIndexer(DmpDescriptionTemplate._dmp, Dmp._id))) {
itemMap.values().stream().flatMap(List::stream).filter(x -> x != null && x.getDmp() != null).peek(x -> {
x.getDmp().setId(null);
});
}
return itemMap;
}
}

View File

@ -0,0 +1,97 @@
package eu.eudat.model.persist;
import eu.eudat.commons.validation.BaseValidator;
import eu.eudat.commons.validation.specification.Specification;
import eu.eudat.convention.ConventionService;
import eu.eudat.data.TagEntity;
import eu.eudat.errorcode.ErrorThesaurusProperties;
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
import org.springframework.context.MessageSource;
import org.springframework.context.annotation.Scope;
import org.springframework.context.i18n.LocaleContextHolder;
import org.springframework.stereotype.Component;
import java.util.Arrays;
import java.util.List;
import java.util.UUID;
public class TagPersist {
private UUID id;
public final static String _id = "id";
private String label = null;
public final static String _label = "label";
private String hash;
public final static String _hash = "hash";
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 getHash() {
return hash;
}
public void setHash(String hash) {
this.hash = hash;
}
@Component(TagPersistValidator.ValidatorName)
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
public static class TagPersistValidator extends BaseValidator<TagPersist> {
public static final String ValidatorName = "TagPersistValidator";
private final MessageSource messageSource;
public TagPersistValidator(MessageSource messageSource, ConventionService conventionService, ErrorThesaurusProperties errors) {
super(conventionService, errors);
this.messageSource = messageSource;
}
@Override
protected Class<TagPersist> modelClass() {
return TagPersist.class;
}
@Override
protected List<Specification> specifications(TagPersist item) {
return Arrays.asList(
this.spec()
.iff(() -> this.isValidGuid(item.getId()))
.must(() -> this.isValidHash(item.getHash()))
.failOn(TagPersist._hash).failWith(messageSource.getMessage("Validation_Required", new Object[]{TagPersist._hash}, LocaleContextHolder.getLocale())),
this.spec()
.iff(() -> !this.isValidGuid(item.getId()))
.must(() -> !this.isValidHash(item.getHash()))
.failOn(TagPersist._hash).failWith(messageSource.getMessage("Validation_OverPosting", new Object[]{}, LocaleContextHolder.getLocale())),
this.spec()
.must(() -> !this.isEmpty(item.getLabel()))
.failOn(TagPersist._label).failWith(messageSource.getMessage("Validation_Required", new Object[]{TagPersist._label}, LocaleContextHolder.getLocale())),
this.spec()
.iff(() -> !this.isEmpty(item.getLabel()))
.must(() -> this.lessEqual(item.getLabel(), TagEntity._labelLength))
.failOn(TagPersist._label).failWith(messageSource.getMessage("Validation_MaxLength", new Object[]{TagPersist._label}, LocaleContextHolder.getLocale()))
);
}
}
}

View File

@ -0,0 +1,20 @@
package eu.eudat.service.tag;
import eu.eudat.model.Tag;
import eu.eudat.model.persist.TagPersist;
import gr.cite.tools.exception.MyApplicationException;
import gr.cite.tools.exception.MyForbiddenException;
import gr.cite.tools.exception.MyNotFoundException;
import gr.cite.tools.exception.MyValidationException;
import gr.cite.tools.fieldset.FieldSet;
import javax.management.InvalidApplicationException;
import java.util.UUID;
public interface TagService {
Tag persist(TagPersist model, FieldSet fields) throws MyForbiddenException, MyValidationException, MyApplicationException, MyNotFoundException, InvalidApplicationException;
void deleteAndSave(UUID id) throws MyForbiddenException, InvalidApplicationException;
}

View File

@ -0,0 +1,127 @@
package eu.eudat.service.tag;
import eu.eudat.authorization.AuthorizationFlags;
import eu.eudat.authorization.Permission;
import eu.eudat.commons.enums.IsActive;
import eu.eudat.commons.scope.user.UserScope;
import eu.eudat.convention.ConventionService;
import eu.eudat.data.TagEntity;
import eu.eudat.errorcode.ErrorThesaurusProperties;
import eu.eudat.event.EventBroker;
import eu.eudat.event.TagTouchedEvent;
import eu.eudat.model.Tag;
import eu.eudat.model.builder.TagBuilder;
import eu.eudat.model.deleter.TagDeleter;
import eu.eudat.model.persist.TagPersist;
import gr.cite.commons.web.authz.service.AuthorizationService;
import gr.cite.tools.data.builder.BuilderFactory;
import gr.cite.tools.data.deleter.DeleterFactory;
import gr.cite.tools.exception.MyApplicationException;
import gr.cite.tools.exception.MyForbiddenException;
import gr.cite.tools.exception.MyNotFoundException;
import gr.cite.tools.exception.MyValidationException;
import gr.cite.tools.fieldset.BaseFieldSet;
import gr.cite.tools.fieldset.FieldSet;
import gr.cite.tools.logging.LoggerService;
import gr.cite.tools.logging.MapLogEntry;
import jakarta.persistence.EntityManager;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.MessageSource;
import org.springframework.context.i18n.LocaleContextHolder;
import org.springframework.stereotype.Service;
import javax.management.InvalidApplicationException;
import java.time.Instant;
import java.util.List;
import java.util.UUID;
@Service
public class TagServiceImpl implements TagService {
private static final LoggerService logger = new LoggerService(LoggerFactory.getLogger(TagServiceImpl.class));
private final EntityManager entityManager;
private final AuthorizationService authorizationService;
private final DeleterFactory deleterFactory;
private final BuilderFactory builderFactory;
private final ConventionService conventionService;
private final ErrorThesaurusProperties errors;
private final MessageSource messageSource;
private final EventBroker eventBroker;
private final UserScope userScope;
@Autowired
public TagServiceImpl(
EntityManager entityManager,
AuthorizationService authorizationService,
DeleterFactory deleterFactory,
BuilderFactory builderFactory,
ConventionService conventionService,
ErrorThesaurusProperties errors,
MessageSource messageSource,
UserScope userScope,
EventBroker eventBroker) {
this.entityManager = entityManager;
this.authorizationService = authorizationService;
this.deleterFactory = deleterFactory;
this.builderFactory = builderFactory;
this.conventionService = conventionService;
this.errors = errors;
this.messageSource = messageSource;
this.eventBroker = eventBroker;
this.userScope = userScope;
}
public Tag persist(TagPersist model, FieldSet fields) throws MyForbiddenException, MyValidationException, MyApplicationException, MyNotFoundException, InvalidApplicationException {
logger.debug(new MapLogEntry("persisting data tag").And("model", model).And("fields", fields));
this.authorizationService.authorizeForce(Permission.EditTag);
Boolean isUpdate = this.conventionService.isValidGuid(model.getId());
TagEntity data;
if (isUpdate) {
data = this.entityManager.find(TagEntity.class, model.getId());
if (data == null) throw new MyNotFoundException(messageSource.getMessage("General_ItemNotFound", new Object[]{model.getId(), Tag.class.getSimpleName()}, LocaleContextHolder.getLocale()));
if (!this.conventionService.hashValue(data.getUpdatedAt()).equals(model.getHash())) throw new MyValidationException(this.errors.getHashConflict().getCode(), this.errors.getHashConflict().getMessage());
} else {
data = new TagEntity();
data.setId(UUID.randomUUID());
data.setIsActive(IsActive.Active);
data.setCreatedAt(Instant.now());
data.setCreatedById(userScope.getUserId());
}
data.setLabel(model.getLabel());
data.setUpdatedAt(Instant.now());
if (isUpdate)
this.entityManager.merge(data);
else
this.entityManager.persist(data);
this.entityManager.flush();
this.eventBroker.emit(new TagTouchedEvent(data.getId()));
return this.builderFactory.builder(TagBuilder.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermissionOrPublic).build(BaseFieldSet.build(fields, Tag._id), data);
}
public void deleteAndSave(UUID id) throws MyForbiddenException, InvalidApplicationException {
logger.debug("deleting tag: {}", id);
this.authorizationService.authorizeForce(Permission.DeleteTag);
this.deleterFactory.deleter(TagDeleter.class).deleteAndSaveByIds(List.of(id));
}
}

View File

@ -0,0 +1,3 @@
artifactId=core
groupId=eu.eudat
version=1.0.0-SNAPSHOT

View File

@ -0,0 +1,133 @@
package eu.eudat.controllers.v2;
import eu.eudat.audit.AuditableAction;
import eu.eudat.authorization.AuthorizationFlags;
import eu.eudat.commons.validation.ValidationFilterAnnotation;
import eu.eudat.data.TagEntity;
import eu.eudat.logic.services.ApiContext;
import eu.eudat.model.Tag;
import eu.eudat.model.builder.TagBuilder;
import eu.eudat.model.censorship.TagCensor;
import eu.eudat.model.persist.TagPersist;
import eu.eudat.model.result.QueryResult;
import eu.eudat.query.TagQuery;
import eu.eudat.query.lookup.TagLookup;
import eu.eudat.service.tag.TagService;
import gr.cite.tools.auditing.AuditService;
import gr.cite.tools.data.builder.BuilderFactory;
import gr.cite.tools.data.censor.CensorFactory;
import gr.cite.tools.data.query.QueryFactory;
import gr.cite.tools.exception.MyApplicationException;
import gr.cite.tools.exception.MyForbiddenException;
import gr.cite.tools.exception.MyNotFoundException;
import gr.cite.tools.fieldset.FieldSet;
import gr.cite.tools.logging.LoggerService;
import gr.cite.tools.logging.MapLogEntry;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.MessageSource;
import org.springframework.context.i18n.LocaleContextHolder;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;
import javax.management.InvalidApplicationException;
import java.util.*;
@RestController
@RequestMapping(path = "api/tag")
public class TagController {
private static final LoggerService logger = new LoggerService(LoggerFactory.getLogger(TagController.class));
@Autowired
private ApiContext apiContext;
private final BuilderFactory builderFactory;
private final AuditService auditService;
private final TagService tagService;
private final CensorFactory censorFactory;
private final QueryFactory queryFactory;
private final MessageSource messageSource;
public TagController(
BuilderFactory builderFactory,
AuditService auditService,
TagService tagService,
CensorFactory censorFactory,
QueryFactory queryFactory,
MessageSource messageSource) {
this.builderFactory = builderFactory;
this.auditService = auditService;
this.tagService = tagService;
this.censorFactory = censorFactory;
this.queryFactory = queryFactory;
this.messageSource = messageSource;
}
@PostMapping("query")
public QueryResult<Tag> Query(@RequestBody TagLookup lookup) throws MyApplicationException, MyForbiddenException {
logger.debug("querying {}", Tag.class.getSimpleName());
this.censorFactory.censor(TagCensor.class).censor(lookup.getProject(), null);
TagQuery query = lookup.enrich(this.queryFactory).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermissionOrPublic);
List<TagEntity> data = query.collectAs(lookup.getProject());
List<Tag> models = this.builderFactory.builder(TagBuilder.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermissionOrPublic).build(lookup.getProject(), data);
long count = (lookup.getMetadata() != null && lookup.getMetadata().getCountAll()) ? query.count() : models.size();
this.auditService.track(AuditableAction.Tag_Query, "lookup", lookup);
//this.auditService.trackIdentity(AuditableAction.IdentityTracking_Action);
return new QueryResult<>(models, count);
}
@GetMapping("{id}")
public Tag Get(@PathVariable("id") UUID id, FieldSet fieldSet, Locale locale) throws MyApplicationException, MyForbiddenException, MyNotFoundException {
logger.debug(new MapLogEntry("retrieving" + Tag.class.getSimpleName()).And("id", id).And("fields", fieldSet));
this.censorFactory.censor(TagCensor.class).censor(fieldSet, null);
TagQuery query = this.queryFactory.query(TagQuery.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermissionOrPublic).ids(id);
Tag model = this.builderFactory.builder(TagBuilder.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermissionOrPublic).build(fieldSet, query.firstAs(fieldSet));
if (model == null)
throw new MyNotFoundException(messageSource.getMessage("General_ItemNotFound", new Object[]{id, Tag.class.getSimpleName()}, LocaleContextHolder.getLocale()));
this.auditService.track(AuditableAction.Tag_Lookup, Map.ofEntries(
new AbstractMap.SimpleEntry<String, Object>("id", id),
new AbstractMap.SimpleEntry<String, Object>("fields", fieldSet)
));
//this.auditService.trackIdentity(AuditableAction.IdentityTracking_Action);
return model;
}
@PostMapping("persist")
@Transactional
@ValidationFilterAnnotation(validator = TagPersist.TagPersistValidator.ValidatorName, argumentName ="model")
public Tag Persist(@RequestBody TagPersist model, FieldSet fieldSet) throws MyApplicationException, MyForbiddenException, MyNotFoundException, InvalidApplicationException {
logger.debug(new MapLogEntry("persisting" + Tag.class.getSimpleName()).And("model", model).And("fieldSet", fieldSet));
Tag persisted = this.tagService.persist(model, fieldSet);
this.auditService.track(AuditableAction.Tag_Persist, Map.ofEntries(
new AbstractMap.SimpleEntry<String, Object>("model", model),
new AbstractMap.SimpleEntry<String, Object>("fields", fieldSet)
));
//this.auditService.trackIdentity(AuditableAction.IdentityTracking_Action);
return persisted;
}
@DeleteMapping("{id}")
@Transactional
public void Delete(@PathVariable("id") UUID id) throws MyForbiddenException, InvalidApplicationException {
logger.debug(new MapLogEntry("retrieving" + Tag.class.getSimpleName()).And("id", id));
this.tagService.deleteAndSave(id);
this.auditService.track(AuditableAction.Tag_Delete, "id", id);
//this.auditService.trackIdentity(AuditableAction.IdentityTracking_Action);
}
}

View File

@ -0,0 +1,17 @@
DO $$DECLARE
this_version CONSTANT varchar := '00.01.042';
BEGIN
PERFORM * FROM "DBVersion" WHERE version = this_version;
IF FOUND THEN RETURN; END IF;
ALTER TABLE IF EXISTS public."EntityDoi" DROP COLUMN IF EXISTS entity_type;
ALTER TABLE IF EXISTS public."EntityDoi"
ADD COLUMN entity_type smallint NOT NULL DEFAULT 0;
ALTER TABLE IF EXISTS public."EntityDoi"
ALTER COLUMN entity_type DROP DEFAULT;
INSERT INTO public."DBVersion" VALUES ('DMPDB', '00.01.042', '2023-12-27 12:00:00.000000+02', now(), 'Change Entity Type To Enum at Entity DOI table');
END$$;

View File

@ -91,14 +91,6 @@ const appRoutes: Routes = [
// },
{
path: 'dataset-profiles',
loadChildren: () => import('./ui/admin/dataset-profile/dataset-profile.module').then(m => m.DatasetProfileModule),
data: {
breadcrumb: true,
title: 'GENERAL.TITLES.DATASET-PROFILES'
}
},
{
path: 'description-templates',
loadChildren: () => import('./ui/admin/description-template/description-template.module').then(m => m.DescriptionTemplateModule),

View File

@ -9,11 +9,16 @@ export enum AppPermission {
EditDmpBlueprint = "EditDmpBlueprint",
DeleteDmpBlueprint = "DeleteDmpBlueprint",
//DmpBlueprint
//Description
BrowseDescription = "BrowseDescription",
EditDescription = "EditDescription",
DeleteDescription= "DeleteDescription",
//Dmp
BrowseDmp = "BrowseDmp",
EditDmp = "EditDmp",
DeleteDmp= "DeleteDmp",
//DescriptionTemplateType
BrowseDescriptionTemplate = "BrowseDescriptionTemplate",
EditDescriptionTemplate = "EditDescriptionTemplate",

View File

@ -9,10 +9,6 @@ import { CultureService } from './services/culture/culture-service';
import { LanguageInfoService } from './services/culture/language-info-service';
import { CurrencyService } from './services/currency/currency.service';
import { DashboardService } from './services/dashboard/dashboard.service';
import { DatasetProfileService } from './services/dataset-profile/dataset-profile.service';
import { DatasetWizardService } from './services/dataset-wizard/dataset-wizard.service';
import { DatasetExternalAutocompleteService } from './services/dataset/dataset-external-autocomplete.service';
import { DatasetService } from './services/dataset/dataset.service';
import { DepositRepositoriesService } from './services/deposit-repositories/deposit-repositories.service';
import { DescriptionTemplateTypeService } from './services/description-template-type/description-template-type.service';
import { DmpBlueprintService } from './services/dmp/dmp-blueprint.service';
@ -64,6 +60,8 @@ import { LanguageHttpService } from './services/language/language.http.service';
import { DescriptionService } from './services/description/description.service';
import { MaintenanceService } from './services/maintenance/maintenance.service';
import { NotificationTemplateService } from './services/notification-template/notification-template.service';
import { TagService } from './services/tag/tag.service';
import { CanDeactivateGuard } from '@app/library/deactivate/can-deactivate.guard';
//
//
// This is shared module that provides all the services. Its imported only once on the AppModule.
@ -108,17 +106,13 @@ export class CoreServiceModule {
DmpBlueprintService,
ExternalSourcesService,
ExternalSourcesConfigurationService,
DatasetService,
DatasetWizardService,
ExternalDatasetService,
ExternalDataRepositoryService,
ExternalRegistryService,
ExternalResearcherService,
ExternalServiceService,
DatasetProfileService,
UserServiceOld,
DmpInvitationService,
DatasetExternalAutocompleteService,
OrganisationService,
EmailConfirmationService,
ContactSupportService,
@ -147,7 +141,9 @@ export class CoreServiceModule {
DmpServiceNew,
DescriptionService,
MaintenanceService,
NotificationTemplateService
NotificationTemplateService,
TagService,
CanDeactivateGuard
],
};
}

View File

@ -9,7 +9,6 @@ import { JsonParserPipe } from './pipes/json-parser.pipe';
import { DateTimeCultureFormatPipe } from './pipes/date-time-culture-format.pipe';
import {FieldValuePipe} from "@app/core/pipes/field-value.pipe";
import {ColumnClassPipe} from "@app/core/pipes/column-class.pipe";
import { DatasetInSectioPipe } from './pipes/dataset-in-section.pipe';
import { PipeService } from '@common/formatting/pipe.service';
//
@ -28,7 +27,6 @@ import { PipeService } from '@common/formatting/pipe.service';
JsonParserPipe,
FieldValuePipe,
ColumnClassPipe,
DatasetInSectioPipe,
],
exports: [
NgForLimitPipe,
@ -39,7 +37,6 @@ import { PipeService } from '@common/formatting/pipe.service';
JsonParserPipe,
FieldValuePipe,
ColumnClassPipe,
DatasetInSectioPipe
],
providers: [
EnumUtils,
@ -53,7 +50,6 @@ import { PipeService } from '@common/formatting/pipe.service';
JsonParserPipe,
FieldValuePipe,
ColumnClassPipe,
DatasetInSectioPipe
]
})
export class FormattingModule { }

View File

@ -2,7 +2,7 @@ import { DescriptionStatus } from "@app/core/common/enum/description-status";
import { BaseEntity, BaseEntityPersist } from "@common/base/base-entity.model";
import { Guid } from "@common/types/guid";
import { DescriptionTemplate } from "../description-template/description-template";
import { Dmp, DmpDescriptionTemplatePersist } from "../dmp/dmp";
import { Dmp, DmpDescriptionTemplate, DmpDescriptionTemplatePersist } from "../dmp/dmp";
import { Reference, ReferencePersist } from "../reference/reference";
import { Tag } from "../tag/tag";
import { User } from "../user/user";
@ -19,7 +19,7 @@ export interface Description extends BaseEntity {
descriptionReferences: DescriptionReference[];
descriptionTags: DescriptionTag[];
descriptionTemplate: DescriptionTemplate;
dmpDescriptionTemplate: DmpDescriptionTemplatePersist;
dmpDescriptionTemplate: DmpDescriptionTemplate;
dmp: Dmp;
}

View File

@ -8,5 +8,5 @@ import { Dmp } from "./dmp";
export interface DmpReference extends BaseEntity {
dmp?: Dmp;
reference?: Reference;
data: String;
data: string;
}

View File

@ -12,13 +12,15 @@ import { FunderModel } from "../funder/funder";
import { GrantListingModel } from "../grant/grant-listing";
import { OrganizationModel } from "../organisation/organization";
import { ProjectModel } from "../project/project";
import { DmpReference, ReferencePersist } from '../reference/reference';
import { ReferencePersist } from '../reference/reference';
import { ResearcherModel } from "../researcher/researcher";
import { User, UserModel } from "../user/user";
import { UserInfoListingModel } from "../user/user-info-listing";
import { DmpDatasetProfile } from "./dmp-dataset-profile/dmp-dataset-profile";
import { DmpDynamicField } from "./dmp-dynamic-field";
import { DmpExtraField } from "./dmp-extra-field";
import { DmpBlueprint } from '../dmp-blueprint/dmp-blueprint';
import { DmpReference } from './dmp-reference';
export interface DmpModel { //TODO: Delete
id: string;
@ -47,12 +49,6 @@ export interface DmpModel { //TODO: Delete
language: String;
}
export interface DmpBlueprint {
id: string;
label: string;
}
export interface Dmp extends BaseEntity {
label: string;
version: number;
@ -71,6 +67,7 @@ export interface Dmp extends BaseEntity {
dmpReferences: DmpReference[];
dmpUsers: DmpUser[];
descriptions: Description[];
dmpDescriptionTemplates: DmpDescriptionTemplate[];
entityDois: EntityDoi[];
@ -119,15 +116,15 @@ export interface DmpPersist extends BaseEntityPersist {
properties: string;
description: String;
language: String;
blueprint: DmpBlueprint;
blueprint: Guid;
accessType: DmpAccessType;
references: DmpReferencePersist[];
descriptionTemplates: DmpDescriptionTemplatePersist[];
}
export interface DmpReferencePersist extends BaseEntityPersist {
reference: ReferencePersist;
data: string;
reference?: ReferencePersist;
data?: string;
}
export interface DmpDescriptionTemplatePersist extends BaseEntityPersist {

View File

@ -0,0 +1,5 @@
export interface FileFormat {
format: string;
formatName: string;
icon: string;
}

View File

@ -1,4 +1,3 @@
import { UrlListingItem } from "../../../library/url-listing/url-listing-item";
import { GrantType } from '../../common/enum/grant-type';
import { Status } from '../../common/enum/status';
@ -16,7 +15,6 @@ export interface GrantListingModel {
contentUrl?: string;
funderId?: string;
files?: ContentFile[];
dmps?: UrlListingItem[];
source?: string;
}

View File

@ -1,5 +1,4 @@
import { Status } from "../../common/enum/status";
import { UrlListingItem } from "../../../library/url-listing/url-listing-item";
import { ProjectType } from "../../common/enum/project-type";
export class ProjectModel {
@ -15,7 +14,6 @@ export class ProjectModel {
description?: String;
contentUrl?: string;
files?: ContentFile[];
dmps?: UrlListingItem[];
}
export interface ContentFile {

View File

@ -14,7 +14,7 @@ export interface Reference extends BaseEntity{
abbreviation: string;
source: string;
sourceType: ReferenceSourceType;
dmpReferences: DmpReference[];
// dmpReferences: DmpReference[];
}
export interface Definition {
@ -27,15 +27,6 @@ export interface Field {
value: string;
}
export interface DmpReference {
id: UUID;
dmp: DmpModel;
reference: Reference;
data: string;
createdAt: Date;
updatedAt: Date;
}
// old fetcher
export interface FetcherReference {
id: string;
@ -61,7 +52,7 @@ export interface ReferencePersist extends BaseEntityPersist {
label: string;
type: ReferenceType;
description: string;
definition?: DefinitionPersist;
definition: DefinitionPersist;
reference: string;
abbreviation: string;
source: string;

View File

@ -1,4 +1,4 @@
import { BaseEntity } from "@common/base/base-entity.model";
import { BaseEntity, BaseEntityPersist } from "@common/base/base-entity.model";
import { User } from "../user/user";
export interface TagModel { //TODO: old entity, delete
@ -10,3 +10,7 @@ export interface Tag extends BaseEntity {
label?: string;
createdBy?: User;
}
export interface TagPersist extends BaseEntityPersist {
label?: string;
}

View File

@ -1,18 +0,0 @@
import { Pipe, PipeTransform } from "@angular/core";
import { UntypedFormGroup } from "@angular/forms";
@Pipe({
name: 'datasetInSection'
})
export class DatasetInSectioPipe implements PipeTransform{
transform(datasets: UntypedFormGroup[], args: string): UntypedFormGroup[] {
let values = [];
for(var dataset of datasets){
if(dataset.get('dmpSectionIndex').value == args){
values.push(dataset);
}
}
return values;
}
}

View File

@ -0,0 +1,23 @@
import { Lookup } from "@common/model/lookup";
import { Guid } from "@common/types/guid";
import { IsActive } from "../common/enum/is-active.enum";
export class TagLookup extends Lookup implements TagFilter {
ids: Guid[];
excludedIds: Guid[];
like: string;
isActive: IsActive[];
createdByIds: Guid[];
constructor() {
super();
}
}
export interface TagFilter {
ids: Guid[];
excludedIds: Guid[];
like: string;
isActive: IsActive[];
createdByIds: Guid[];
}

View File

@ -1,84 +0,0 @@
import { HttpClient, HttpHeaders, HttpResponse } from '@angular/common/http';
import { Injectable } from '@angular/core';
import { DatasetProfile } from '@app/core/model/admin/dataset-profile/dataset-profile';
import { DataTableData } from '@app/core/model/data-table/data-table-data';
import { DataTableRequest } from '@app/core/model/data-table/data-table-request';
import { DatasetProfileDefinitionModel } from '@app/core/model/dataset-profile-definition/dataset-profile-definition';
import { DatasetListingModel } from '@app/core/model/dataset/dataset-listing';
import { DatasetProfileCriteria } from '@app/core/query/dataset-profile/dataset-profile-criteria';
import { BaseHttpService } from '@app/core/services/http/base-http.service';
import { DatasetProfileEditorModel } from '@app/ui/admin/dataset-profile/editor/dataset-profile-editor-model';
import { BaseService } from '@common/base/base.service';
import { BaseHttpParams } from '@common/http/base-http-params';
import { InterceptorType } from '@common/http/interceptors/interceptor-type';
import { environment } from 'environments/environment';
import { Observable } from 'rxjs';
import { takeUntil } from "rxjs/operators";
import { ConfigurationService } from '../configuration/configuration.service';
@Injectable()
export class DatasetProfileService extends BaseService {
private actionUrl: string;
private headers = new HttpHeaders();
constructor(private http: BaseHttpService, private httpClient: HttpClient, private configurationService: ConfigurationService) {
super();
this.actionUrl = configurationService.server + 'admin/';
}
createForm(data) {
return this.httpClient.post<string>(this.actionUrl + 'addDmp', data);
}
updateForm(id, data): Observable<DatasetProfileEditorModel> {
return this.http.post<DatasetProfileEditorModel>(this.actionUrl + 'addDmp/' + id, data);
}
getDatasetProfileById(datasetProfileID): Observable<DatasetProfile> {
return this.http.get<DatasetProfile>(this.actionUrl + 'get/' + datasetProfileID);
}
getPaged(dataTableRequest: DataTableRequest<DatasetProfileCriteria>): Observable<DataTableData<DatasetListingModel>> {
return this.http.post<DataTableData<DatasetListingModel>>(this.actionUrl + 'datasetprofiles/getPaged', dataTableRequest);
}
preview(data: DatasetProfile): Observable<DatasetProfileDefinitionModel> {
return this.http.post<DatasetProfileDefinitionModel>(this.actionUrl + 'preview', data);
}
clone(id: string): Observable<DatasetProfile> {
return this.http.post<DatasetProfile>(this.actionUrl + 'datasetprofile/clone/' + id, {});
}
newVersion(id, data) {
return this.httpClient.post<string>(this.actionUrl + 'newVersion/' + id, data);
}
delete(id: string, data): Observable<DatasetProfile> {
//return this.http.post<DatasetProfile>(this.actionUrl + 'addDmp/' + id, data);
return this.http.delete<DatasetProfile>(this.actionUrl + id, {});
}
downloadXML(id: string): Observable<HttpResponse<Blob>> {
let headerXml: HttpHeaders = this.headers.set('Content-Type', 'application/xml')
return this.httpClient.get(this.actionUrl + 'getXml/' + id, { responseType: 'blob', observe: 'response', headers: headerXml });
}
uploadFile(file: FileList, labelSent: string, datasetProfileId?: string): Observable<DataTableData<DatasetListingModel>> {
const params = new BaseHttpParams();
params.interceptorContext = {
excludedInterceptors: [InterceptorType.JSONContentType]
};
const formData = new FormData();
formData.append('file', file[0], labelSent);
return (datasetProfileId === undefined || datasetProfileId == null)
? this.http.post(this.actionUrl + "upload", formData, { params: params })
: this.http.post(this.actionUrl + "upload/" + datasetProfileId, formData, { params: params });
}
searchSemantics(like: string): Observable<String[]> {
return this.http.get<String[]>(this.actionUrl + "getSemantics?query=" + like);
}
}

View File

@ -1,95 +0,0 @@
import { HttpClient, HttpHeaders, HttpResponse } from '@angular/common/http';
import { Injectable } from '@angular/core';
import { Observable } from 'rxjs';
import { environment } from '../../../../environments/environment';
import { BaseHttpParams } from '../../../../common/http/base-http-params';
import { InterceptorType } from '../../../../common/http/interceptors/interceptor-type';
import { DatasetProfileDefinitionModel } from '../../model/dataset-profile-definition/dataset-profile-definition';
import { DatasetProfileModel } from '../../model/dataset/dataset-profile';
import { DatasetWizardModel } from '../../model/dataset/dataset-wizard';
import { DatasetProfileCriteria } from '../../query/dataset-profile/dataset-profile-criteria';
import { RequestItem } from '../../query/request-item';
import { BaseHttpService } from '../http/base-http.service';
import { ConfigurationService } from '../configuration/configuration.service';
@Injectable()
export class DatasetWizardService {
private actionUrl: string;
private headers = new HttpHeaders();
constructor(private http: BaseHttpService, private httpClient: HttpClient, private configurationService: ConfigurationService) {
this.actionUrl = configurationService.server + 'datasets/';
}
// public userDmps(criteria: RequestItem<DmpCriteria>): Observable<DmpModel[]> {
// return this.http.post<DmpModel[]>(this.actionUrl + 'userDmps', criteria, { headers: this.headers });
// }
public getAvailableProfiles(criteria: RequestItem<DatasetProfileCriteria>): Observable<DatasetProfileModel[]> {
return this.http.post<DatasetProfileModel[]>(this.actionUrl + 'getAvailableProfiles/', criteria, { headers: this.headers });
}
public getSingle(id: String): Observable<DatasetWizardModel> {
return this.http.get<DatasetWizardModel>(this.actionUrl + id, { headers: this.headers }); // + 'getSingle/'
}
public getSinglePublic(id: String): Observable<DatasetWizardModel> {
return this.http.get<DatasetWizardModel>(this.actionUrl + 'public/' + id, { headers: this.headers }); // + 'getSingle/'
}
public delete(id: string): Observable<DatasetWizardModel> {
return this.http.delete<DatasetWizardModel>(this.actionUrl + 'delete/' + id, { headers: this.headers });
}
createDataset(datasetModel: DatasetWizardModel): Observable<DatasetWizardModel> {
return this.http.post<DatasetWizardModel>(this.actionUrl, datasetModel, { headers: this.headers });
}
public downloadPDF(id: string): Observable<HttpResponse<Blob>> {
return this.httpClient.get(this.actionUrl + 'getPDF/' + id, { responseType: 'blob', observe: 'response', headers: this.headers });
}
public downloadDOCX(id: string): Observable<HttpResponse<Blob>> {
let headerDocx: HttpHeaders = this.headers.set('Content-Type', 'application/msword')
return this.httpClient.get(this.actionUrl + id, { responseType: 'blob', observe: 'response', headers: headerDocx });
}
public downloadXML(id: string): Observable<HttpResponse<Blob>> {
let headerXml: HttpHeaders = this.headers.set('Content-Type', 'application/xml')
return this.httpClient.get(this.actionUrl + id, { responseType: 'blob', observe: 'response', headers: headerXml }); // + 'getXml/'
}
public getDefinition(id: String): Observable<DatasetProfileDefinitionModel> {
return this.http.get<DatasetProfileDefinitionModel>(this.actionUrl + 'get/' + id, { headers: this.headers });
}
unlock(id: String): Observable<DatasetWizardModel> {
return this.http.get<DatasetWizardModel>(this.actionUrl + id + '/unlock', { headers: this.headers });
}
public uploadXml(fileList: FileList, datasetTitle: string, dmpId: string, datasetProfileId: string): Observable<any> {
const formData: FormData = new FormData();
if (fileList instanceof FileList) {
for (let i = 0; i < fileList.length; i++) {
formData.append('file', fileList[i], datasetTitle);
}
} else if (Array.isArray(fileList)) {
formData.append('files', fileList);
} else {
formData.append('file', fileList);
}
formData.append('dmpId', dmpId);
formData.append('datasetProfileId', datasetProfileId);
const params = new BaseHttpParams();
params.interceptorContext = {
excludedInterceptors: [InterceptorType.JSONContentType]
};
return this.http.post(this.actionUrl + 'upload', formData, { params: params });
}
public updateDatasetProfile(id: String): Observable<DatasetWizardModel> {
return this.http.get<DatasetWizardModel>(this.actionUrl + "profile/" + id, { headers: this.headers });
}
}

View File

@ -1,35 +0,0 @@
import { HttpClient } from '@angular/common/http';
import { Injectable } from '@angular/core';
import { Observable, of } from 'rxjs';
import { environment } from '../../../../environments/environment';
import { DatasetExternalAutocompleteCriteria, DatasetExternalAutocompleteOptionsCriteria } from '../../query/dataset/daatset-external-autocomplete-criteria';
import { RequestItem } from '../../query/request-item';
import { DatasetProfileService } from '../dataset-profile/dataset-profile.service';
import { ConfigurationService } from '../configuration/configuration.service';
import { map } from 'rxjs/operators';
@Injectable()
export class DatasetExternalAutocompleteService {
private actionUrl: string;
constructor(
private httpClient: HttpClient,
private datasetProfileService: DatasetProfileService,
private configurationService: ConfigurationService) {
this.actionUrl = configurationService.server + '/';
}
getDatasetProfileById(datasetProfileID) {
return this.datasetProfileService.getDatasetProfileById(datasetProfileID);
}
queryAutocomplete(lookUpItem: RequestItem<DatasetExternalAutocompleteCriteria>): Observable<any> {
return this.httpClient.post(this.configurationService.server + 'search/autocomplete', lookUpItem);
}
queryApi(lookUpItem: RequestItem<DatasetExternalAutocompleteOptionsCriteria>): Observable<any>{
return this.httpClient.post(this.configurationService.server + 'search/autocompleteOptions', lookUpItem);
}
}

View File

@ -1,101 +0,0 @@
import { Injectable } from '@angular/core';
import { Observable } from 'rxjs';
import { environment } from '../../../../environments/environment';
import { DataTableData } from '../../model/data-table/data-table-data';
import { DataTableRequest } from '../../model/data-table/data-table-request';
import { DatasetListingModel } from '../../model/dataset/dataset-listing';
import { DatasetProfileModel } from '../../model/dataset/dataset-profile';
import { DatasetCriteria } from '../../query/dataset/dataset-criteria';
import { ExploreDatasetCriteriaModel } from '../../query/explore-dataset/explore-dataset-criteria';
import { BaseHttpService } from '../http/base-http.service';
import { DatasetProfileCriteria } from '../../query/dataset-profile/dataset-profile-criteria';
import { ConfigurationService } from '../configuration/configuration.service';
import { DatasetOverviewModel } from '@app/core/model/dataset/dataset-overview';
import { HttpHeaders, HttpResponse, HttpClient } from '@angular/common/http';
import { DatasetModel } from '@app/core/model/dataset/dataset';
@Injectable()
export class DatasetService {
private actionUrl: string;
private headers = new HttpHeaders();
constructor(
private http: BaseHttpService,
private configurationSevice: ConfigurationService,
private httpClient: HttpClient) {
this.actionUrl = configurationSevice.server + 'datasets/';
}
getPaged(dataTableRequest: DataTableRequest<DatasetCriteria>): Observable<DataTableData<DatasetListingModel>> {
return this.http.post<DataTableData<DatasetListingModel>>(this.actionUrl + 'paged', dataTableRequest);
}
getPublicPaged(dataTableRequest: DataTableRequest<ExploreDatasetCriteriaModel>): Observable<DataTableData<DatasetListingModel>> {
return this.http.post<DataTableData<DatasetListingModel>>(this.actionUrl + 'public/paged', dataTableRequest);
}
makeDatasetPublic(id: String) {
return this.http.get(this.actionUrl + 'makepublic/' + id);
}
getDatasetProfiles(dataTableRequest: DataTableRequest<DatasetProfileCriteria>): Observable<DatasetProfileModel[]> {
return this.http.post<DatasetProfileModel[]>(this.configurationSevice.server + 'datasetprofiles/getAll', dataTableRequest);
}
getDatasetProfilesUsedPaged(dataTableRequest: DataTableRequest<DatasetProfileCriteria>) {
return this.http.post<DataTableData<DatasetListingModel>>(this.actionUrl + 'datasetProfilesUsedByDatasets/paged', dataTableRequest);
}
generateIndex() {
return this.http.post(this.actionUrl + 'index', {});
}
clearIndex() {
return this.http.delete(this.actionUrl + 'index');
}
getOverviewSingle(id: string): Observable<DatasetOverviewModel> {
return this.http.get<DatasetOverviewModel>(this.actionUrl + 'overview/' + id, { headers: this.headers });
}
getOverviewSinglePublic(id: string): Observable<DatasetOverviewModel> {
return this.http.get<DatasetOverviewModel>(this.actionUrl + 'publicOverview/' + id, { headers: this.headers })
}
clone(datasetModel: DatasetModel, id: String): Observable<DatasetModel> {
return this.http.post<DatasetModel>(this.actionUrl + 'clone/' + id, datasetModel, { headers: this.headers });
}
delete(id: String): Observable<DatasetModel> {
return this.http.delete<DatasetModel>(this.actionUrl + 'delete/' + id, { headers: this.headers }); // + 'delete/'
}
publish(id: String): Observable<DatasetModel> {
return this.http.get<DatasetModel>(this.actionUrl + 'makepublic/' + id, { headers: this.headers });
}
public downloadXML(id: string): Observable<HttpResponse<Blob>> {
let headerXml: HttpHeaders = this.headers.set('Content-Type', 'application/xml')
return this.httpClient.get(this.actionUrl + id, { responseType: 'blob', observe: 'response', headers: headerXml }); //+ "/getXml/"
}
public downloadDocx(id: string): Observable<HttpResponse<Blob>> {
let headerDoc: HttpHeaders = this.headers.set('Content-Type', 'application/msword')
return this.httpClient.get(this.actionUrl + id, { responseType: 'blob', observe: 'response', headers: headerDoc });
}
public downloadPDF(id: string): Observable<HttpResponse<Blob>> {
let headerPdf: HttpHeaders = this.headers.set('Content-Type', 'application/pdf')
return this.httpClient.get(this.actionUrl + 'getPDF/' + id, { responseType: 'blob', observe: 'response', headers: headerPdf });
}
public validateDataset(id: string) : Observable<any>{
return this.http.get<any>(this.actionUrl+id+"/validate");
}
//GK: NO
// public downloadJson(id: string): Observable<HttpResponse<Blob>> {
// return this.httpClient.get(this.actionUrl + 'rda/' + id, { responseType: 'blob', observe: 'response' });
// }
}

View File

@ -111,7 +111,7 @@ export class DescriptionTemplateService {
valueAssign: (item: DescriptionTemplate) => item.id,
};
private buildAutocompleteLookup(like?: string, excludedIds?: Guid[], ids?: Guid[]): DescriptionTemplateLookup {
public buildAutocompleteLookup(like?: string, excludedIds?: Guid[], ids?: Guid[]): DescriptionTemplateLookup {
const lookup: DescriptionTemplateLookup = new DescriptionTemplateLookup();
lookup.page = { size: 100, offset: 0 };
if (excludedIds && excludedIds.length > 0) { lookup.excludedIds = excludedIds; }

View File

@ -113,7 +113,7 @@ export class DescriptionService {
valueAssign: (item: Description) => item.id,
};
private buildAutocompleteLookup(like?: string, excludedIds?: Guid[], ids?: Guid[]): DescriptionLookup {
public buildAutocompleteLookup(like?: string, excludedIds?: Guid[], ids?: Guid[]): DescriptionLookup {
const lookup: DescriptionLookup = new DescriptionLookup();
lookup.page = { size: 100, offset: 0 };
if (excludedIds && excludedIds.length > 0) { lookup.excludedIds = excludedIds; }

View File

@ -2,7 +2,7 @@ import { HttpClient, HttpHeaders, HttpResponse } from '@angular/common/http';
import { Injectable } from '@angular/core';
import { IsActive } from '@app/core/common/enum/is-active.enum';
import { DataTableData } from '@app/core/model/data-table/data-table-data';
import { DmpBlueprint, DmpBlueprintPersist } from '@app/core/model/dmp-blueprint/dmp-blueprint';
import { DmpBlueprint, DmpBlueprintDefinitionSection, DmpBlueprintPersist } from '@app/core/model/dmp-blueprint/dmp-blueprint';
import { DmpBlueprintLookup } from '@app/core/query/dmp-blueprint.lookup';
import { MultipleAutoCompleteConfiguration } from '@app/library/auto-complete/multiple/multiple-auto-complete-configuration';
import { SingleAutoCompleteConfiguration } from '@app/library/auto-complete/single/single-auto-complete-configuration';
@ -126,4 +126,14 @@ export class DmpBlueprintService {
if (like) { lookup.like = this.filterService.transformLike(like); }
return lookup;
}
//
//
// UI Helpers
//
//
getSection(dmpBlueprint: DmpBlueprint, sectionId: Guid): DmpBlueprintDefinitionSection {
return dmpBlueprint?.definition?.sections?.find(x => x.id === sectionId);
}
}

View File

@ -1,7 +1,10 @@
import { Injectable } from '@angular/core';
import { IsActive } from '@app/core/common/enum/is-active.enum';
import { ReferenceSourceType } from '@app/core/common/enum/reference-source-type';
import { ReferenceType } from '@app/core/common/enum/reference-type';
import { DmpReference, Reference, ReferencePersist } from '@app/core/model/reference/reference';
import { DmpReference } from '@app/core/model/dmp/dmp-reference';
import { Reference, ReferencePersist } from '@app/core/model/reference/reference';
import { ReferenceSearchDefinitionLookup, ReferenceSearchLookup } from '@app/core/query/reference-search.lookup';
import { ReferenceLookup } from '@app/core/query/reference.lookup';
import { MultipleAutoCompleteConfiguration } from '@app/library/auto-complete/multiple/multiple-auto-complete-configuration';
import { SingleAutoCompleteConfiguration } from '@app/library/auto-complete/single/single-auto-complete-configuration';
@ -13,9 +16,6 @@ import { catchError, map } from 'rxjs/operators';
import { nameof } from 'ts-simple-nameof';
import { ConfigurationService } from '../configuration/configuration.service';
import { BaseHttpV2Service } from '../http/base-http-v2.service';
import { ReferenceSourceType } from '@app/core/common/enum/reference-source-type';
import { ReferenceSearchDefinitionLookup, ReferenceSearchLookup } from '@app/core/query/reference-search.lookup';
import { Dmp } from '@app/core/model/dmp/dmp';
@Injectable()
export class ReferenceService {
@ -130,5 +130,5 @@ export class ReferenceService {
getReferencesForTypesFirstSafe(dmpReferences: DmpReference[], referenceTypes: ReferenceType[]): DmpReference {
return this.getReferencesForTypes(dmpReferences, referenceTypes)?.find(Boolean);
}
}

View File

@ -0,0 +1,98 @@
import { Injectable } from '@angular/core';
import { IsActive } from '@app/core/common/enum/is-active.enum';
import { Tag, TagPersist } from '@app/core/model/tag/tag';
import { TagLookup } from '@app/core/query/tag.lookup';
import { MultipleAutoCompleteConfiguration } from '@app/library/auto-complete/multiple/multiple-auto-complete-configuration';
import { SingleAutoCompleteConfiguration } from '@app/library/auto-complete/single/single-auto-complete-configuration';
import { QueryResult } from '@common/model/query-result';
import { FilterService } from '@common/modules/text-filter/filter-service';
import { Guid } from '@common/types/guid';
import { Observable, throwError } from 'rxjs';
import { catchError, map } from 'rxjs/operators';
import { nameof } from 'ts-simple-nameof';
import { ConfigurationService } from '../configuration/configuration.service';
import { BaseHttpV2Service } from '../http/base-http-v2.service';
@Injectable()
export class TagService {
constructor(
private http: BaseHttpV2Service,
private installationConfiguration: ConfigurationService,
private filterService: FilterService
) { }
private get apiBase(): string { return `${this.installationConfiguration.server}tag`; }
query(q: TagLookup): Observable<QueryResult<Tag>> {
const url = `${this.apiBase}/query`;
return this.http
.post<QueryResult<Tag>>(url, q).pipe(
catchError((error: any) => throwError(error)));
}
getSingle(id: Guid, reqFields: string[] = []): Observable<Tag> {
const url = `${this.apiBase}/${id}`;
const options = { params: { f: reqFields } };
return this.http
.get<Tag>(url, options).pipe(
catchError((error: any) => throwError(error)));
}
persist(item: TagPersist): Observable<Tag> {
const url = `${this.apiBase}/persist`;
return this.http
.post<Tag>(url, item).pipe(
catchError((error: any) => throwError(error)));
}
delete(id: Guid): Observable<Tag> {
const url = `${this.apiBase}/${id}`;
return this.http
.delete<Tag>(url).pipe(
catchError((error: any) => throwError(error)));
}
//
// Autocomplete Commons
//
// tslint:disable-next-line: member-ordering
singleAutocompleteConfiguration: SingleAutoCompleteConfiguration = {
initialItems: (data?: any) => this.query(this.buildAutocompleteLookup()).pipe(map(x => x.items)),
filterFn: (searchQuery: string, data?: any) => this.query(this.buildAutocompleteLookup(searchQuery)).pipe(map(x => x.items)),
getSelectedItem: (selectedItem: any) => this.query(this.buildAutocompleteLookup(null, null, [selectedItem])).pipe(map(x => x.items[0])),
displayFn: (item: Tag) => item.label,
titleFn: (item: Tag) => item.label,
valueAssign: (item: Tag) => item.id,
};
// tslint:disable-next-line: member-ordering
multipleAutocompleteConfiguration: MultipleAutoCompleteConfiguration = {
initialItems: (excludedItems: any[], data?: any) => this.query(this.buildAutocompleteLookup(null, excludedItems ? excludedItems : null)).pipe(map(x => x.items)),
filterFn: (searchQuery: string, excludedItems: any[]) => this.query(this.buildAutocompleteLookup(searchQuery, excludedItems)).pipe(map(x => x.items)),
getSelectedItems: (selectedItems: any[]) => this.query(this.buildAutocompleteLookup(null, null, selectedItems)).pipe(map(x => x.items)),
displayFn: (item: Tag) => item.label,
titleFn: (item: Tag) => item.label,
valueAssign: (item: Tag) => item.id,
};
public buildAutocompleteLookup(like?: string, excludedIds?: Guid[], ids?: Guid[]): TagLookup {
const lookup: TagLookup = new TagLookup();
lookup.page = { size: 100, offset: 0 };
if (excludedIds && excludedIds.length > 0) { lookup.excludedIds = excludedIds; }
if (ids && ids.length > 0) { lookup.ids = ids; }
lookup.isActive = [IsActive.Active];
lookup.project = {
fields: [
nameof<Tag>(x => x.id),
nameof<Tag>(x => x.label)
]
};
lookup.order = { items: [nameof<Tag>(x => x.label)] };
if (like) { lookup.like = this.filterService.transformLike(like); }
return lookup;
}
}

View File

@ -15,7 +15,6 @@ import { Role } from '@app/core/common/enum/role';
import { RoleOrganizationType } from '@app/core/common/enum/role-organization-type';
import { SupportiveMaterialFieldType } from '@app/core/common/enum/supportive-material-field-type';
import { UserDescriptionTemplateRole } from '@app/core/common/enum/user-description-template-role';
import { ViewStyleType } from '@app/ui/admin/dataset-profile/editor/components/field/view-style-enum';
import { TranslateService } from '@ngx-translate/core';
import { AppRole } from '../../common/enum/app-role';
import { DatasetProfileComboBoxType } from '../../common/enum/dataset-profile-combo-box-type';
@ -132,38 +131,38 @@ export class EnumUtils {
case DatasetProfileFieldViewStyle.Validation: return this.language.instant('TYPES.DATASET-PROFILE-FIELD-VIEW-STYLE.VALIDATION');
}
}
toDatasetProfileViewTypeString(status: ViewStyleType): string {
switch (status) {
case ViewStyleType.BooleanDecision: return this.language.instant('TYPES.DATASET-PROFILE-FIELD-VIEW-STYLE.BOOLEAN-DECISION');
case ViewStyleType.CheckBox: return this.language.instant('TYPES.DATASET-PROFILE-FIELD-VIEW-STYLE.CHECKBOX');
case ViewStyleType.Select: return this.language.instant('TYPES.DATASET-PROFILE-FIELD-VIEW-STYLE.SELECT');
case ViewStyleType.InternalDmpEntities: return this.language.instant('TYPES.DATASET-PROFILE-FIELD-VIEW-STYLE.INTERNAL-DMP-ENTITIES');
case ViewStyleType.FreeText: return this.language.instant('TYPES.DATASET-PROFILE-FIELD-VIEW-STYLE.FREE-TEXT');
case ViewStyleType.RadioBox: return this.language.instant('TYPES.DATASET-PROFILE-FIELD-VIEW-STYLE.RADIO-BOX');
case ViewStyleType.TextArea: return this.language.instant('TYPES.DATASET-PROFILE-FIELD-VIEW-STYLE.TEXT-AREA');
case ViewStyleType.RichTextArea: return this.language.instant('TYPES.DATASET-PROFILE-FIELD-VIEW-STYLE.RICH-TEXT-AREA');
case ViewStyleType.Table: return this.language.instant('TYPES.DATASET-PROFILE-FIELD-VIEW-STYLE.TABLE');
case ViewStyleType.Upload: return this.language.instant('TYPES.DATASET-PROFILE-FIELD-VIEW-STYLE.UPLOAD');
case ViewStyleType.DatePicker: return this.language.instant('TYPES.DATASET-PROFILE-FIELD-VIEW-STYLE.DATE-PICKER');
case ViewStyleType.ExternalDatasets: return this.language.instant('TYPES.DATASET-PROFILE-FIELD-VIEW-STYLE.EXTERNAL-DATASETS');
case ViewStyleType.DataRepositories: return this.language.instant('TYPES.DATASET-PROFILE-FIELD-VIEW-STYLE.DATA-REPOSITORIES');
case ViewStyleType.PubRepositories: return this.language.instant('TYPES.DATASET-PROFILE-FIELD-VIEW-STYLE.PUB-REPOSITORIES');
case ViewStyleType.JournalRepositories: return this.language.instant('TYPES.DATASET-PROFILE-FIELD-VIEW-STYLE.JOURNALS-REPOSITORIES');
case ViewStyleType.Taxonomies: return this.language.instant('TYPES.DATASET-PROFILE-FIELD-VIEW-STYLE.TAXONOMIES');
case ViewStyleType.Licenses: return this.language.instant('TYPES.DATASET-PROFILE-FIELD-VIEW-STYLE.LICENSES');
case ViewStyleType.Publications: return this.language.instant('TYPES.DATASET-PROFILE-FIELD-VIEW-STYLE.PUBLICATIONS');
case ViewStyleType.Registries: return this.language.instant('TYPES.DATASET-PROFILE-FIELD-VIEW-STYLE.REGISTRIES');
case ViewStyleType.Services: return this.language.instant('TYPES.DATASET-PROFILE-FIELD-VIEW-STYLE.SERVICES');
case ViewStyleType.Tags: return this.language.instant('TYPES.DATASET-PROFILE-FIELD-VIEW-STYLE.TAGS');
case ViewStyleType.Researchers: return this.language.instant('TYPES.DATASET-PROFILE-FIELD-VIEW-STYLE.RESEARCHERS');
case ViewStyleType.Organizations: return this.language.instant('TYPES.DATASET-PROFILE-FIELD-VIEW-STYLE.ORGANIZATIONS');
case ViewStyleType.DatasetIdentifier: return this.language.instant('TYPES.DATASET-PROFILE-FIELD-VIEW-STYLE.DATASET-IDENTIFIER');
case ViewStyleType.Currency: return this.language.instant('TYPES.DATASET-PROFILE-FIELD-VIEW-STYLE.CURRENCY');
case ViewStyleType.Validation: return this.language.instant('TYPES.DATASET-PROFILE-FIELD-VIEW-STYLE.VALIDATION');
case ViewStyleType.Other: return this.language.instant('TYPES.DATASET-PROFILE-FIELD-VIEW-STYLE.OTHER');
}
// toDatasetProfileViewTypeString(status: ViewStyleType): string {
// switch (status) {
// case ViewStyleType.BooleanDecision: return this.language.instant('TYPES.DATASET-PROFILE-FIELD-VIEW-STYLE.BOOLEAN-DECISION');
// case ViewStyleType.CheckBox: return this.language.instant('TYPES.DATASET-PROFILE-FIELD-VIEW-STYLE.CHECKBOX');
// case ViewStyleType.Select: return this.language.instant('TYPES.DATASET-PROFILE-FIELD-VIEW-STYLE.SELECT');
// case ViewStyleType.InternalDmpEntities: return this.language.instant('TYPES.DATASET-PROFILE-FIELD-VIEW-STYLE.INTERNAL-DMP-ENTITIES');
// case ViewStyleType.FreeText: return this.language.instant('TYPES.DATASET-PROFILE-FIELD-VIEW-STYLE.FREE-TEXT');
// case ViewStyleType.RadioBox: return this.language.instant('TYPES.DATASET-PROFILE-FIELD-VIEW-STYLE.RADIO-BOX');
// case ViewStyleType.TextArea: return this.language.instant('TYPES.DATASET-PROFILE-FIELD-VIEW-STYLE.TEXT-AREA');
// case ViewStyleType.RichTextArea: return this.language.instant('TYPES.DATASET-PROFILE-FIELD-VIEW-STYLE.RICH-TEXT-AREA');
// case ViewStyleType.Table: return this.language.instant('TYPES.DATASET-PROFILE-FIELD-VIEW-STYLE.TABLE');
// case ViewStyleType.Upload: return this.language.instant('TYPES.DATASET-PROFILE-FIELD-VIEW-STYLE.UPLOAD');
// case ViewStyleType.DatePicker: return this.language.instant('TYPES.DATASET-PROFILE-FIELD-VIEW-STYLE.DATE-PICKER');
// case ViewStyleType.ExternalDatasets: return this.language.instant('TYPES.DATASET-PROFILE-FIELD-VIEW-STYLE.EXTERNAL-DATASETS');
// case ViewStyleType.DataRepositories: return this.language.instant('TYPES.DATASET-PROFILE-FIELD-VIEW-STYLE.DATA-REPOSITORIES');
// case ViewStyleType.PubRepositories: return this.language.instant('TYPES.DATASET-PROFILE-FIELD-VIEW-STYLE.PUB-REPOSITORIES');
// case ViewStyleType.JournalRepositories: return this.language.instant('TYPES.DATASET-PROFILE-FIELD-VIEW-STYLE.JOURNALS-REPOSITORIES');
// case ViewStyleType.Taxonomies: return this.language.instant('TYPES.DATASET-PROFILE-FIELD-VIEW-STYLE.TAXONOMIES');
// case ViewStyleType.Licenses: return this.language.instant('TYPES.DATASET-PROFILE-FIELD-VIEW-STYLE.LICENSES');
// case ViewStyleType.Publications: return this.language.instant('TYPES.DATASET-PROFILE-FIELD-VIEW-STYLE.PUBLICATIONS');
// case ViewStyleType.Registries: return this.language.instant('TYPES.DATASET-PROFILE-FIELD-VIEW-STYLE.REGISTRIES');
// case ViewStyleType.Services: return this.language.instant('TYPES.DATASET-PROFILE-FIELD-VIEW-STYLE.SERVICES');
// case ViewStyleType.Tags: return this.language.instant('TYPES.DATASET-PROFILE-FIELD-VIEW-STYLE.TAGS');
// case ViewStyleType.Researchers: return this.language.instant('TYPES.DATASET-PROFILE-FIELD-VIEW-STYLE.RESEARCHERS');
// case ViewStyleType.Organizations: return this.language.instant('TYPES.DATASET-PROFILE-FIELD-VIEW-STYLE.ORGANIZATIONS');
// case ViewStyleType.DatasetIdentifier: return this.language.instant('TYPES.DATASET-PROFILE-FIELD-VIEW-STYLE.DATASET-IDENTIFIER');
// case ViewStyleType.Currency: return this.language.instant('TYPES.DATASET-PROFILE-FIELD-VIEW-STYLE.CURRENCY');
// case ViewStyleType.Validation: return this.language.instant('TYPES.DATASET-PROFILE-FIELD-VIEW-STYLE.VALIDATION');
// case ViewStyleType.Other: return this.language.instant('TYPES.DATASET-PROFILE-FIELD-VIEW-STYLE.OTHER');
// }
}
// }
toDatasetProfileComboBoxTypeString(status: DatasetProfileComboBoxType): string {
switch (status) {

View File

@ -1,6 +1,5 @@
import {Component, Input} from "@angular/core";
import {AngularEditorConfig} from "@kolkov/angular-editor";
import {UntypedFormControl} from "@angular/forms";
import { ChangeDetectionStrategy, Component, Input } from "@angular/core";
import { AngularEditorConfig } from "@kolkov/angular-editor";
@Component({
selector: 'rich-text-editor-component',
@ -10,10 +9,12 @@ import {UntypedFormControl} from "@angular/forms";
[config]="editorConfig" [formControlName]="controlName"
placeholder="{{(placeholder? (placeholder | translate) : '') + (required ? ' *': '')}}"
(paste)="pasteWithoutFormatting($event)"></angular-editor>
<mat-icon *ngIf="formInput.value && editable" (click)="formInput.patchValue('')" class="clear">close</mat-icon>
<mat-icon *ngIf="parentFormGroup.get(controlName).value && editable" (click)="parentFormGroup.get(controlName).patchValue('')" class="clear">close</mat-icon>
</div>
`,
styleUrls: ['./rich-text-editor.component.scss']
styleUrls: ['./rich-text-editor.component.scss'],
// TODO: performance issue with this control. changed the change detection strategy in case it improves
changeDetection: ChangeDetectionStrategy.OnPush
})
export class RichTextEditorComponent {
@Input() parentFormGroup;
@ -42,12 +43,12 @@ export class RichTextEditorComponent {
sanitize: true,
toolbarPosition: 'top',
customClasses: [
{ name: 'H1 header', class: '', tag: 'h1' },
{ name: 'H2 header', class: '', tag: 'h2' },
{ name: 'H3 header', class: '', tag: 'h3' },
{ name: 'H4 header', class: '', tag: 'h4' },
{ name: 'H5 header', class: '', tag: 'h5'},
{ name: 'H6 header', class: '', tag: 'h6'}
{ name: 'H1 header', class: '', tag: 'h1' },
{ name: 'H2 header', class: '', tag: 'h2' },
{ name: 'H3 header', class: '', tag: 'h3' },
{ name: 'H4 header', class: '', tag: 'h4' },
{ name: 'H5 header', class: '', tag: 'h5' },
{ name: 'H6 header', class: '', tag: 'h6' }
],
toolbarHiddenButtons: [
[
@ -66,8 +67,9 @@ export class RichTextEditorComponent {
]
};
get formInput(): UntypedFormControl {
return this.parentFormGroup.get(this.controlName);
ngOnInit() {
console.log('ngOnInit: ');
}
ngAfterContentInit() {

View File

@ -1,6 +0,0 @@
export class UrlListingItem {
public label: string;
public url: string;
public all: string;
}

View File

@ -1,4 +0,0 @@
<div *ngFor="let item of items | limitTo:urlLimit">
<a class="url-listing-item" (click)="navigate(item.url)">{{item.label}}</a>
</div>
<a class="url-listing-item" *ngIf="this.items.length > this.urlLimit" (click)="navigate(items[0].all)">{{'URL-LISTING-COMPONENT.SHOW-MORE'|translate}}</a>

View File

@ -1,8 +0,0 @@
.url-listing-item:hover {
color: #0056b3 !important;
text-decoration: underline !important;
}
.url-listing-item {
color: #007bff !important;
}

View File

@ -1,27 +0,0 @@
import { Component, Input } from "@angular/core";
import { Router } from "@angular/router";
import { UrlListingItem } from "./url-listing-item";
@Component({
selector: 'app-url-listing',
templateUrl: './url-listing.component.html',
styleUrls: ['./url-listing.component.scss']
})
export class UrlListingComponent {
@Input() items: UrlListingItem[];
@Input() parameters: any
@Input() urlLimit: number = 3;
constructor(
private router: Router
) { }
ngOnInit() {
}
navigate(link: string) {
this.router.navigate([link], { queryParams: this.parameters });
}
}

View File

@ -1,20 +0,0 @@
import { NgModule } from '@angular/core';
import { FormattingModule } from '@app/core/formatting.module';
import { UrlListingComponent } from '@app/library/url-listing/url-listing.component';
import { CommonUiModule } from '@common/ui/common-ui.module';
@NgModule({
imports: [
CommonUiModule,
FormattingModule
],
declarations: [
UrlListingComponent
],
exports: [
UrlListingComponent
]
})
export class UrlListingModule {
constructor() { }
}

View File

@ -1,22 +0,0 @@
import { UntypedFormGroup } from '@angular/forms';
import { DefaultValue } from '../../../../core/model/admin/dataset-profile/dataset-profile';
import { BaseFormModel } from '../../../../core/model/base-form-model';
export class DefaultValueEditorModel extends BaseFormModel {
public type: string;
public value: string;
fromModel(item: DefaultValue): DefaultValueEditorModel {
this.type = item.type;
this.value = item.value;
return this;
}
buildForm(disabled: boolean = false, skipDisable: Array<String> = []): UntypedFormGroup {
const formGroup = this.formBuilder.group({
type: [{ value: this.type, disabled: (disabled && !skipDisable.includes('DefaultValueEditorModel.type')) }],
value: [{ value: this.value, disabled: (disabled && !skipDisable.includes('DefaultValueEditorModel.value')) }]
});
return formGroup;
}
}

View File

@ -1,33 +0,0 @@
import { UntypedFormGroup, Validators } from "@angular/forms";
import { FieldDataEditorModel } from "./field-data-editor-model";
import { AuthAutoCompleteData, AutoCompleteSingleData } from "@app/core/model/dataset-profile-definition/field-data/field-data";
export class AuthFieldEditorModel extends FieldDataEditorModel<AuthFieldEditorModel> {
url: string;
method: string;
body: string;
path: string;
type: string;
buildForm(disabled: boolean = false, skipDisable: Array<String> = []): UntypedFormGroup {
const formGroup = this.formBuilder.group({
method: [{ value: this.method, disabled: (disabled && !skipDisable.includes('AuthFieldEditorModel.method')) }],
url: [{ value: this.url, disabled: (disabled && !skipDisable.includes('AuthFieldEditorModel.url')) },[Validators.required]],
body: [{ value: this.body, disabled: (disabled && !skipDisable.includes('AuthFieldEditorModel.body')) }],
path: [{ value: this.path, disabled: (disabled && !skipDisable.includes('AuthFieldEditorModel.path')) }, [Validators.required]],
type: [{ value: this.type, disabled: (disabled && !skipDisable.includes('AuthFieldEditorModel.type')) }, [Validators.required]]
});
return formGroup;
}
fromModel(item: AuthAutoCompleteData): AuthFieldEditorModel {
this.url = item.url;
this.method = item.method;
this.body = item.body;
this.path = item.path;
this.type = item.type;
return this;
}
}

View File

@ -1,42 +0,0 @@
import { UntypedFormGroup } from '@angular/forms';
import { DatasetProfileComboBoxType } from '../../../../../core/common/enum/dataset-profile-combo-box-type';
import { AutoCompleteFieldData } from '../../../../../core/model/dataset-profile-definition/field-data/field-data';
import { FieldDataEditorModel } from './field-data-editor-model';
import { FieldDataOptionEditorModel } from './field-data-option-editor-model';
import { AutoCompleteSingleDataEditorModel } from './auto-complete-single-data';
export class AutoCompleteFieldDataEditorModel extends FieldDataEditorModel<AutoCompleteFieldDataEditorModel> {
public type: DatasetProfileComboBoxType = DatasetProfileComboBoxType.Autocomplete;
public multiAutoComplete: boolean;
public autoCompleteSingleDataList: Array<AutoCompleteSingleDataEditorModel> = new Array<AutoCompleteSingleDataEditorModel>();
//public multiAutoCompleteOptions: FieldDataOptionEditorModel = new FieldDataOptionEditorModel();
buildForm(disabled: boolean = false, skipDisable: Array<String> = []): UntypedFormGroup {
const formGroup = this.formBuilder.group({
label: [{ value: this.label, disabled: (disabled && !skipDisable.includes('AutoCompleteFieldDataEditorModel.label')) }],
type: [{ value: this.type, disabled: (disabled && !skipDisable.includes('AutoCompleteFieldDataEditorModel.type')) }],
multiAutoComplete: [{ value: this.multiAutoComplete, disabled: (disabled && !skipDisable.includes('AutoCompleteFieldDataEditorModel.multiAutoComplete')) }]
});
const autocompleteFormArray = new Array<UntypedFormGroup>();
if (this.autoCompleteSingleDataList) {
this.autoCompleteSingleDataList.forEach(item => {
const form: UntypedFormGroup = item.buildForm(disabled, skipDisable);
autocompleteFormArray.push(form);
});
}
formGroup.addControl('autoCompleteSingleDataList', this.formBuilder.array(autocompleteFormArray));
return formGroup;
}
fromModel(item: AutoCompleteFieldData): AutoCompleteFieldDataEditorModel {
this.type = item.type;
this.label = item.label;
this.multiAutoComplete = item.multiAutoComplete;
if (item.autoCompleteSingleDataList) { this.autoCompleteSingleDataList = item.autoCompleteSingleDataList.map(x => new AutoCompleteSingleDataEditorModel().fromModel(x)); }
return this;
}
}

View File

@ -1,46 +0,0 @@
import { FieldDataEditorModel } from './field-data-editor-model';
import { DatasetProfileComboBoxType } from '@app/core/common/enum/dataset-profile-combo-box-type';
import { FieldDataOptionEditorModel } from './field-data-option-editor-model';
import { UntypedFormGroup, Validators } from '@angular/forms';
import { AutoCompleteFieldData, AutoCompleteSingleData } from '@app/core/model/dataset-profile-definition/field-data/field-data';
//import { AuthFieldEditorModel } from './auto-complete-auth-field-data.model';
export class AutoCompleteSingleDataEditorModel extends FieldDataEditorModel<AutoCompleteSingleDataEditorModel> {
public url: string;
public optionsRoot: string;
public autoCompleteOptions: FieldDataOptionEditorModel = new FieldDataOptionEditorModel();
public autoCompleteType: number;
public method: string;
public hasAuth: boolean;
//public auth: AuthFieldEditorModel = new AuthFieldEditorModel();
//public multiAutoCompleteOptions: FieldDataOptionEditorModel = new FieldDataOptionEditorModel();
buildForm(disabled: boolean = false, skipDisable: Array<String> = []): UntypedFormGroup {
const formGroup = this.formBuilder.group({
label: [{ value: this.label, disabled: (disabled && !skipDisable.includes('AutoCompleteSingleDataEditorModel.label')) }],
url: [{ value: this.url, disabled: (disabled && !skipDisable.includes('AutoCompleteSingleDataEditorModel.url')) },[Validators.required]],
optionsRoot: [{ value: this.optionsRoot, disabled: (disabled && !skipDisable.includes('AutoCompleteSingleDataEditorModel.optionsRoot')) }, [Validators.required]],
autoCompleteType: [{ value: this.autoCompleteType, disabled: (disabled && !skipDisable.includes('AutoCompleteSingleDataEditorModel.autoCompleteType')) }],
hasAuth: [{ value: this.hasAuth, disabled: (disabled && !skipDisable.includes('AutoCompleteSingleDataEditorModel.hasAuth')) }],
method: [{ value: this.method, disabled: (disabled && !skipDisable.includes('AutoCompleteSingleDataEditorModel.method')) }]
});
formGroup.addControl('autoCompleteOptions', this.autoCompleteOptions.buildForm(disabled, skipDisable));
//formGroup.addControl('auth', this.auth.buildForm(disabled, skipDisable));
return formGroup;
}
fromModel(item: AutoCompleteSingleData): AutoCompleteSingleDataEditorModel {
this.url = item.url;
this.label = item.label;
this.optionsRoot = item.optionsRoot;
this.autoCompleteType = item.autocompleteType;
this.hasAuth = item.hasAuth;
this.method = item.method ? item.method : 'GET';
this.autoCompleteOptions = new FieldDataOptionEditorModel().fromModel(item.autoCompleteOptions);
//this.auth = new AuthFieldEditorModel().fromModel(item.auth);
return this;
}
}

View File

@ -1,18 +0,0 @@
import { UntypedFormGroup } from '@angular/forms';
import { BooleanDecisionFieldData } from '../../../../../core/model/dataset-profile-definition/field-data/field-data';
import { FieldDataEditorModel } from './field-data-editor-model';
export class BooleanDecisionFieldDataEditorModel extends FieldDataEditorModel<BooleanDecisionFieldDataEditorModel> {
buildForm(disabled: boolean = false, skipDisable: Array<String> = []): UntypedFormGroup {
const formGroup = this.formBuilder.group({
label: [{ value: this.label, disabled: (disabled && !skipDisable.includes('BooleanDecisionFieldDataEditorModel.label')) }]
});
return formGroup;
}
fromModel(item: BooleanDecisionFieldData): BooleanDecisionFieldDataEditorModel {
this.label = item.label;
return this;
}
}

View File

@ -1,18 +0,0 @@
import { UntypedFormGroup } from '@angular/forms';
import { CheckBoxFieldData } from '../../../../../core/model/dataset-profile-definition/field-data/field-data';
import { FieldDataEditorModel } from './field-data-editor-model';
export class CheckBoxFieldDataEditorModel extends FieldDataEditorModel<CheckBoxFieldDataEditorModel> {
buildForm(disabled: boolean = false, skipDisable: Array<String> = []): UntypedFormGroup {
const formGroup = this.formBuilder.group({
label: [{ value: this.label, disabled: (disabled && !skipDisable.includes('CheckBoxFieldDataEditorModel.label')) }]
});
return formGroup;
}
fromModel(item: CheckBoxFieldData): CheckBoxFieldDataEditorModel {
this.label = item.label;
return this;
}
}

View File

@ -1,19 +0,0 @@
import { UntypedFormGroup } from '@angular/forms';
import { FieldDataEditorModel } from './field-data-editor-model';
import { CurrencyFieldData } from '../../../../../core/model/dataset-profile-definition/field-data/field-data';
export class CurrencyDataEditorModel extends FieldDataEditorModel<CurrencyDataEditorModel> {
public label: string;
buildForm(disabled: boolean = false, skipDisable: Array<String> = []): UntypedFormGroup {
const formGroup = this.formBuilder.group({
label: [{ value: this.label, disabled: (disabled && !skipDisable.includes('CurrencyDataEditorModel.label')) }]
});
return formGroup;
}
fromModel(item: CurrencyFieldData): CurrencyDataEditorModel {
this.label = item.label;
return this;
}
}

View File

@ -1,22 +0,0 @@
import { UntypedFormGroup } from '@angular/forms';
import { FieldDataEditorModel } from './field-data-editor-model';
import { DataRepositoriesFieldData } from '../../../../../core/model/dataset-profile-definition/field-data/field-data';
export class DataRepositoriesDataEditorModel extends FieldDataEditorModel<DataRepositoriesDataEditorModel> {
public label: string;
public multiAutoComplete: boolean;
buildForm(disabled: boolean = false, skipDisable: Array<String> = []): UntypedFormGroup {
const formGroup = this.formBuilder.group({
label: [{ value: this.label, disabled: (disabled && !skipDisable.includes('ServicesDataEditorModel.label')) }],
multiAutoComplete: [{ value: this.multiAutoComplete, disabled: (disabled && !skipDisable.includes('ServicesDataEditorModel.multiAutoComplete')) }]
});
return formGroup;
}
fromModel(item: DataRepositoriesFieldData): DataRepositoriesDataEditorModel {
this.label = item.label;
this.multiAutoComplete = item.multiAutoComplete;
return this;
}
}

View File

@ -1,19 +0,0 @@
import { UntypedFormGroup } from '@angular/forms';
import { FieldDataEditorModel } from './field-data-editor-model';
import { DatasetIdentifierFieldData } from '../../../../../core/model/dataset-profile-definition/field-data/field-data';
export class DatasetIdentifierDataEditorModel extends FieldDataEditorModel<DatasetIdentifierDataEditorModel> {
public label: string;
buildForm(disabled: boolean = false, skipDisable: Array<String> = []): UntypedFormGroup {
const formGroup = this.formBuilder.group({
label: [{ value: this.label, disabled: (disabled && !skipDisable.includes('DatasetIdentifierDataEditorModel.label')) }]
});
return formGroup;
}
fromModel(item: DatasetIdentifierFieldData): DatasetIdentifierDataEditorModel {
this.label = item.label;
return this;
}
}

View File

@ -1,26 +0,0 @@
import { UntypedFormGroup } from "@angular/forms";
import { DatasetProfileInternalDmpEntitiesType } from "../../../../../core/common/enum/dataset-profile-internal-dmp-entities-type";
import { DatasetsAutoCompleteFieldData } from "../../../../../core/model/dataset-profile-definition/field-data/field-data";
import { FieldDataEditorModel } from "./field-data-editor-model";
export class DatasetsAutoCompleteFieldDataEditorModel extends FieldDataEditorModel<DatasetsAutoCompleteFieldDataEditorModel> {
public type: DatasetProfileInternalDmpEntitiesType = DatasetProfileInternalDmpEntitiesType.Datasets;
public multiAutoComplete: boolean = false;
//public autoCompleteOptions: FieldDataOptionEditorModel = new FieldDataOptionEditorModel();
buildForm(disabled: boolean = false, skipDisable: Array<String> = []): UntypedFormGroup {
const formGroup = this.formBuilder.group({
label: [{ value: this.label, disabled: (disabled && !skipDisable.includes('DatasetsAutoCompleteFieldDataEditorModel.label')) }],
type: [{ value: this.type, disabled: (disabled && !skipDisable.includes('DatasetsAutoCompleteFieldDataEditorModel.type')) }],
multiAutoComplete: [{ value: this.multiAutoComplete, disabled: (disabled && !skipDisable.includes('DatasetsAutoCompleteFieldDataEditorModel.multiAutoComplete')) }],
})
return formGroup;
}
fromModel(item: DatasetsAutoCompleteFieldData): DatasetsAutoCompleteFieldDataEditorModel {
this.label = item.label;
this.type = item.type;
this.multiAutoComplete = item.multiAutoComplete;
return this;
}
}

View File

@ -1,19 +0,0 @@
import { UntypedFormGroup } from '@angular/forms';
import { FieldDataEditorModel } from './field-data-editor-model';
import { DatePickerFieldData } from '../../../../../core/model/dataset-profile-definition/field-data/field-data';
export class DatePickerDataEditorModel extends FieldDataEditorModel<DatePickerDataEditorModel> {
public label: string;
buildForm(disabled: boolean = false, skipDisable: Array<String> = []): UntypedFormGroup {
const formGroup = this.formBuilder.group({
label: [{ value: this.label, disabled: (disabled && !skipDisable.includes('DatePickerDataEditorModel.label')) }]
});
return formGroup;
}
fromModel(item: DatePickerFieldData): DatePickerDataEditorModel {
this.label = item.label;
return this;
}
}

View File

@ -1,27 +0,0 @@
import { FieldDataEditorModel } from "./field-data-editor-model";
import { DatasetProfileInternalDmpEntitiesType } from "../../../../../core/common/enum/dataset-profile-internal-dmp-entities-type";
import { FieldDataOptionEditorModel } from "./field-data-option-editor-model";
import { DmpsAutoCompleteFieldData } from "../../../../../core/model/dataset-profile-definition/field-data/field-data";
import { UntypedFormGroup } from "@angular/forms";
export class DmpsAutoCompleteFieldDataEditorModel extends FieldDataEditorModel<DmpsAutoCompleteFieldDataEditorModel> {
public type: DatasetProfileInternalDmpEntitiesType = DatasetProfileInternalDmpEntitiesType.Dmps;
public multiAutoComplete: boolean = false;
//public autoCompleteOptions: FieldDataOptionEditorModel = new FieldDataOptionEditorModel();
buildForm(disabled: boolean = false, skipDisable: Array<String> = []): UntypedFormGroup {
const formGroup = this.formBuilder.group({
label: [{ value: this.label, disabled: (disabled && !skipDisable.includes('DmpsAutoCompleteFieldDataEditorModel.label')) }],
type: [{ value: this.type, disabled: (disabled && !skipDisable.includes('DmpsAutoCompleteFieldDataEditorModel.type')) }],
multiAutoComplete: [{ value: this.multiAutoComplete, disabled: (disabled && !skipDisable.includes('DmpsAutoCompleteFieldDataEditorModel.multiAutoComplete')) }]
})
return formGroup;
}
fromModel(item: DmpsAutoCompleteFieldData): DmpsAutoCompleteFieldDataEditorModel {
this.label = item.label;
this.type = item.type;
this.multiAutoComplete = item.multiAutoComplete;
return this;
}
}

View File

@ -1,26 +0,0 @@
import { UntypedFormGroup } from '@angular/forms';
import { FieldDataEditorModel } from './field-data-editor-model';
import { ExternalDatasetsFieldData } from '../../../../../core/model/dataset-profile-definition/field-data/field-data';
import { ExternalDatasetTypeEnum } from '@app/core/common/enum/external-dataset-type-enum';
export class ExternalDatasetsDataEditorModel extends FieldDataEditorModel<ExternalDatasetsDataEditorModel> {
public label: string;
public multiAutoComplete: boolean;
public type: ExternalDatasetTypeEnum;
buildForm(disabled: boolean = false, skipDisable: Array<String> = []): UntypedFormGroup {
const formGroup = this.formBuilder.group({
label: [{ value: this.label, disabled: (disabled && !skipDisable.includes('ExternalDatasetsDataEditorModel.label')) }],
multiAutoComplete: [{ value: this.multiAutoComplete, disabled: (disabled && !skipDisable.includes('ExternalDatasetsDataEditorModel.multiAutoComplete')) }],
type: [{ value: this.type, disabled: (disabled && !skipDisable.includes('ExternalDatasetsDataEditorModel.type')) }]
});
return formGroup;
}
fromModel(item: ExternalDatasetsFieldData): ExternalDatasetsDataEditorModel {
this.label = item.label;
this.multiAutoComplete = item.multiAutoComplete;
this.type = item.type;
return this;
}
}

View File

@ -1,15 +0,0 @@
import { UntypedFormGroup } from '@angular/forms';
import { BaseFormModel } from '../../../../../core/model/base-form-model';
export abstract class FieldDataEditorModel<T> extends BaseFormModel {
public label: string;
buildForm(disabled: boolean = false, skipDisable: Array<String> = []): UntypedFormGroup {
throw new Error('Build Form Is not not correctly overriden');
}
fromJSONObject(item: any): T {
throw new Error('From Json Object is not correctly overriden');
}
}

View File

@ -1,23 +0,0 @@
import { UntypedFormBuilder, UntypedFormGroup, Validators } from '@angular/forms';
import { FieldDataOption } from '../../../../../core/model/dataset-profile-definition/field-data/field-data';
import { FieldDataEditorModel } from './field-data-editor-model';
export class FieldDataOptionEditorModel extends FieldDataEditorModel<FieldDataOptionEditorModel> {
public label: string;
public value: string;
buildForm(disabled: boolean = false, skipDisable: Array<String> = []): UntypedFormGroup {
return new UntypedFormBuilder().group({
label: [{ value: this.label, disabled: (disabled && !skipDisable.includes('FieldDataOptionEditorModel.label')) },[Validators.required]],
value: [{ value: this.value, disabled: (disabled && !skipDisable.includes('FieldDataOptionEditorModel.value')) },[Validators.required]],
});
}
fromModel(item: FieldDataOption): FieldDataOptionEditorModel {
if (item) {
this.label = item.label;
this.value = item.value;
}
return this;
}
}

View File

@ -1,18 +0,0 @@
import { UntypedFormGroup } from '@angular/forms';
import { FreeTextFieldData } from '../../../../../core/model/dataset-profile-definition/field-data/field-data';
import { FieldDataEditorModel } from './field-data-editor-model';
export class FreeTextFieldDataEditorModel extends FieldDataEditorModel<FreeTextFieldDataEditorModel> {
buildForm(disabled: boolean = false, skipDisable: Array<String> = []): UntypedFormGroup {
const formGroup = this.formBuilder.group({
label: [{ value: this.label, disabled: (disabled && !skipDisable.includes('FreeTextFieldDataEditorModel.label')) }]
});
return formGroup;
}
fromModel(item: FreeTextFieldData): FreeTextFieldDataEditorModel {
this.label = item.label;
return this;
}
}

View File

@ -1,21 +0,0 @@
import { UntypedFormGroup } from '@angular/forms';
import { FieldDataEditorModel } from './field-data-editor-model';
import { LicensesFieldData } from '../../../../../core/model/dataset-profile-definition/field-data/field-data';
export class LicensesDataEditorModel extends FieldDataEditorModel<LicensesDataEditorModel> {
public label: string;
public multiAutoComplete: boolean;
buildForm(disabled: boolean = false, skipDisable: Array<String> = []): UntypedFormGroup {
const formGroup = this.formBuilder.group({
label: [{ value: this.label, disabled: (disabled && !skipDisable.includes('ServicesDataEditorModel.label')) }],
multiAutoComplete: [{ value: this.multiAutoComplete, disabled: (disabled && !skipDisable.includes('ServicesDataEditorModel.multiAutoComplete')) }]
});
return formGroup;
}
fromModel(item: LicensesFieldData): LicensesDataEditorModel {
this.label = item.label;
this.multiAutoComplete = item.multiAutoComplete;
return this;
}
}

View File

@ -1,22 +0,0 @@
import { UntypedFormGroup } from '@angular/forms';
import { FieldDataEditorModel } from './field-data-editor-model';
import { OrganizationsFieldData } from '../../../../../core/model/dataset-profile-definition/field-data/field-data';
export class OrganizationsDataEditorModel extends FieldDataEditorModel<OrganizationsDataEditorModel> {
public label: string;
public multiAutoComplete: boolean = false;
buildForm(disabled: boolean = false, skipDisable: Array<String> = []): UntypedFormGroup {
const formGroup = this.formBuilder.group({
label: [{ value: this.label, disabled: (disabled && !skipDisable.includes('OrganizationsDataEditorModel.label')) }],
multiAutoComplete: [{ value: this.multiAutoComplete, disabled: (disabled && !skipDisable.includes('OrganizationsDataEditorModel.multiAutoComplete')) }]
});
return formGroup;
}
fromModel(item: OrganizationsFieldData): OrganizationsDataEditorModel {
this.label = item.label;
this.multiAutoComplete = item.multiAutoComplete;
return this;
}
}

View File

@ -1,21 +0,0 @@
import { UntypedFormGroup } from '@angular/forms';
import { FieldDataEditorModel } from './field-data-editor-model';
import { PublicationsFieldData } from '../../../../../core/model/dataset-profile-definition/field-data/field-data';
export class PublicationsDataEditorModel extends FieldDataEditorModel<PublicationsDataEditorModel> {
public label: string;
public multiAutoComplete: boolean;
buildForm(disabled: boolean = false, skipDisable: Array<String> = []): UntypedFormGroup {
const formGroup = this.formBuilder.group({
label: [{ value: this.label, disabled: (disabled && !skipDisable.includes('ServicesDataEditorModel.label')) }],
multiAutoComplete: [{ value: this.multiAutoComplete, disabled: (disabled && !skipDisable.includes('ServicesDataEditorModel.multiAutoComplete')) }]
});
return formGroup;
}
fromModel(item: PublicationsFieldData): PublicationsDataEditorModel {
this.label = item.label;
this.multiAutoComplete = item.multiAutoComplete;
return this;
}
}

View File

@ -1,30 +0,0 @@
import { UntypedFormGroup } from '@angular/forms';
import { RadioBoxFieldData } from '../../../../../core/model/dataset-profile-definition/field-data/field-data';
import { FieldDataEditorModel } from './field-data-editor-model';
import { FieldDataOptionEditorModel } from './field-data-option-editor-model';
export class RadioBoxFieldDataEditorModel extends FieldDataEditorModel<RadioBoxFieldDataEditorModel> {
public options: Array<FieldDataOptionEditorModel> = [];
buildForm(disabled: boolean = false, skipDisable: Array<String> = []): UntypedFormGroup {
const formGroup = this.formBuilder.group({
label: [{ value: this.label, disabled: (disabled && !skipDisable.includes('RadioBoxFieldDataEditorModel.label')) }]
});
const optionsFormArray = new Array<UntypedFormGroup>();
if (this.options) {
this.options.forEach(item => {
const form: UntypedFormGroup = item.buildForm(disabled, skipDisable);
optionsFormArray.push(form);
});
}
formGroup.addControl('options', this.formBuilder.array(optionsFormArray));
return formGroup;
}
fromModel(item: RadioBoxFieldData): RadioBoxFieldDataEditorModel {
if (item.options) { this.options = item.options.map(x => new FieldDataOptionEditorModel().fromModel(x)); }
this.label = item.label;
return this;
}
}

View File

@ -1,22 +0,0 @@
import { UntypedFormGroup } from '@angular/forms';
import { FieldDataEditorModel } from './field-data-editor-model';
import { RegistriesFieldData } from '../../../../../core/model/dataset-profile-definition/field-data/field-data';
export class RegistriesDataEditorModel extends FieldDataEditorModel<RegistriesDataEditorModel> {
public label: string;
public multiAutoComplete: boolean;
buildForm(disabled: boolean = false, skipDisable: Array<String> = []): UntypedFormGroup {
const formGroup = this.formBuilder.group({
label: [{ value: this.label, disabled: (disabled && !skipDisable.includes('RegistriesDataEditorModel.label')) }],
multiAutoComplete: [{ value: this.multiAutoComplete, disabled: (disabled && !skipDisable.includes('RegistriesDataEditorModel.multiAutoComplete')) }]
});
return formGroup;
}
fromModel(item: RegistriesFieldData): RegistriesDataEditorModel {
this.label = item.label;
this.multiAutoComplete = item.multiAutoComplete;
return this;
}
}

View File

@ -1,31 +0,0 @@
import { FieldDataEditorModel } from "./field-data-editor-model";
import { DatasetProfileInternalDmpEntitiesType } from "../../../../../core/common/enum/dataset-profile-internal-dmp-entities-type";
import { FieldDataOptionEditorModel } from "./field-data-option-editor-model";
import { UntypedFormGroup } from "@angular/forms";
import { ResearchersAutoCompleteFieldData } from "../../../../../core/model/dataset-profile-definition/field-data/field-data";
export class ResearchersAutoCompleteFieldDataEditorModel extends FieldDataEditorModel<ResearchersAutoCompleteFieldDataEditorModel> {
public type: DatasetProfileInternalDmpEntitiesType = DatasetProfileInternalDmpEntitiesType.Researchers;
public multiAutoComplete: boolean = false;
//public autoCompleteOptions: FieldDataOptionEditorModel = new FieldDataOptionEditorModel();
buildForm(disabled: boolean = false, skipDisable: Array<String> = []): UntypedFormGroup {
const formGroup = this.formBuilder.group({
label: [{ value: this.label, disabled: (disabled && !skipDisable.includes('ResearchersAutoCompleteFieldDataEditorModel.label')) }],
type: [{ value: this.type, disabled: (disabled && !skipDisable.includes('ResearchersAutoCompleteFieldDataEditorModel.type')) }],
multiAutoComplete: [{ value: this.multiAutoComplete, disabled: (disabled && !skipDisable.includes('ResearchersAutoCompleteFieldDataEditorModel.multiAutoComplete')) }]
})
//formGroup.addControl('autoCompleteOptions', this.autoCompleteOptions.buildForm(disabled, skipDisable));
return formGroup;
}
fromModel(item: ResearchersAutoCompleteFieldData): ResearchersAutoCompleteFieldDataEditorModel {
this.label = item.label;
this.type = item.type;
this.multiAutoComplete = item.multiAutoComplete;
// this.autoCompleteOptions = new FieldDataOptionEditorModel().fromModel(item.autoCompleteOptions);
return this;
}
}

View File

@ -1,22 +0,0 @@
import { UntypedFormGroup } from '@angular/forms';
import { FieldDataEditorModel } from './field-data-editor-model';
import { ResearchersFieldData } from '../../../../../core/model/dataset-profile-definition/field-data/field-data';
export class ResearchersDataEditorModel extends FieldDataEditorModel<ResearchersDataEditorModel> {
public label: string;
public multiAutoComplete: boolean = false;
buildForm(disabled: boolean = false, skipDisable: Array<String> = []): UntypedFormGroup {
const formGroup = this.formBuilder.group({
label: [{ value: this.label, disabled: (disabled && !skipDisable.includes('ResearchersDataEditorModel.label')) }],
multiAutoComplete: [{ value: this.multiAutoComplete, disabled: (disabled && !skipDisable.includes('ResearchersAutoCompleteFieldDataEditorModel.multiAutoComplete')) }]
});
return formGroup;
}
fromModel(item: ResearchersFieldData): ResearchersDataEditorModel {
this.label = item.label;
this.multiAutoComplete = item.multiAutoComplete;
return this;
}
}

View File

@ -1,18 +0,0 @@
import { UntypedFormGroup } from '@angular/forms';
import { RichTextAreaFieldData } from '../../../../../core/model/dataset-profile-definition/field-data/field-data';
import { FieldDataEditorModel } from './field-data-editor-model';
export class RichTextAreaFieldDataEditorModel extends FieldDataEditorModel<RichTextAreaFieldDataEditorModel> {
buildForm(disabled: boolean = false, skipDisable: Array<String> = []): UntypedFormGroup {
const formGroup = this.formBuilder.group({
label: [{ value: this.label, disabled: (disabled && !skipDisable.includes('RichTextAreaFieldDataEditorModel.label')) }]
});
return formGroup;
}
fromModel(item: RichTextAreaFieldData): RichTextAreaFieldDataEditorModel {
this.label = item.label;
return this;
}
}

View File

@ -1,22 +0,0 @@
import { UntypedFormGroup } from '@angular/forms';
import { FieldDataEditorModel } from './field-data-editor-model';
import { ServicesFieldData } from '../../../../../core/model/dataset-profile-definition/field-data/field-data';
export class ServicesDataEditorModel extends FieldDataEditorModel<ServicesDataEditorModel> {
public label: string;
public multiAutoComplete: boolean;
buildForm(disabled: boolean = false, skipDisable: Array<String> = []): UntypedFormGroup {
const formGroup = this.formBuilder.group({
label: [{ value: this.label, disabled: (disabled && !skipDisable.includes('ServicesDataEditorModel.label')) }],
multiAutoComplete: [{ value: this.multiAutoComplete, disabled: (disabled && !skipDisable.includes('ServicesDataEditorModel.multiAutoComplete')) }]
});
return formGroup;
}
fromModel(item: ServicesFieldData): ServicesDataEditorModel {
this.label = item.label;
this.multiAutoComplete = item.multiAutoComplete;
return this;
}
}

View File

@ -1,19 +0,0 @@
import { UntypedFormGroup } from '@angular/forms';
import { FieldDataEditorModel } from './field-data-editor-model';
import { TagsFieldData } from '../../../../../core/model/dataset-profile-definition/field-data/field-data';
export class TagsDataEditorModel extends FieldDataEditorModel<TagsDataEditorModel> {
public label: string;
buildForm(disabled: boolean = false, skipDisable: Array<String> = []): UntypedFormGroup {
const formGroup = this.formBuilder.group({
label: [{ value: this.label, disabled: (disabled && !skipDisable.includes('TagsDataEditorModel.label')) }]
});
return formGroup;
}
fromModel(item: TagsFieldData): TagsDataEditorModel {
this.label = item.label;
return this;
}
}

View File

@ -1,22 +0,0 @@
import { UntypedFormGroup } from '@angular/forms';
import { FieldDataEditorModel } from './field-data-editor-model';
import {TaxonomiesFieldData} from "@app/core/model/dataset-profile-definition/field-data/field-data";
export class TaxonomiesDataEditorModel extends FieldDataEditorModel<TaxonomiesDataEditorModel> {
public label: string;
public multiAutoComplete: boolean;
buildForm(disabled: boolean = false, skipDisable: Array<String> = []): UntypedFormGroup {
const formGroup = this.formBuilder.group({
label: [{ value: this.label, disabled: (disabled && !skipDisable.includes('ServicesDataEditorModel.label')) }],
multiAutoComplete: [{ value: this.multiAutoComplete, disabled: (disabled && !skipDisable.includes('ServicesDataEditorModel.multiAutoComplete')) }]
});
return formGroup;
}
fromModel(item: TaxonomiesFieldData): TaxonomiesDataEditorModel {
this.label = item.label;
this.multiAutoComplete = item.multiAutoComplete;
return this;
}
}

View File

@ -1,18 +0,0 @@
import { UntypedFormGroup } from '@angular/forms';
import { TextAreaFieldData } from '../../../../../core/model/dataset-profile-definition/field-data/field-data';
import { FieldDataEditorModel } from './field-data-editor-model';
export class TextAreaFieldDataEditorModel extends FieldDataEditorModel<TextAreaFieldDataEditorModel> {
buildForm(disabled: boolean = false, skipDisable: Array<String> = []): UntypedFormGroup {
const formGroup = this.formBuilder.group({
label: [{ value: this.label, disabled: (disabled && !skipDisable.includes('TextAreaFieldDataEditorModel.label')) }]
});
return formGroup;
}
fromModel(item: TextAreaFieldData): TextAreaFieldDataEditorModel {
this.label = item.label;
return this;
}
}

View File

@ -1,39 +0,0 @@
import { UntypedFormGroup } from '@angular/forms';
import {
FieldDataOption,
UploadFieldData
} from '../../../../../core/model/dataset-profile-definition/field-data/field-data';
import { FieldDataEditorModel } from './field-data-editor-model';
import {FieldDataOptionEditorModel} from "@app/ui/admin/dataset-profile/admin/field-data/field-data-option-editor-model";
export class UploadFieldDataEditorModel extends FieldDataEditorModel<UploadFieldDataEditorModel> {
public types: Array<FieldDataOptionEditorModel> = [];
public maxFileSizeInMB: number;
buildForm(disabled: boolean = false, skipDisable: Array<String> = []): UntypedFormGroup {
const formGroup = this.formBuilder.group({
label: [{ value: this.label, disabled: (disabled && !skipDisable.includes('UploadFieldDataEditorModel.label')) }],
maxFileSizeInMB: [{ value: this.maxFileSizeInMB, disabled: (disabled && !skipDisable.includes('UploadFieldDataEditorModel.maxFileSizeInMB')) }],
// types: [{ value: this.types, disabled: (disabled && !skipDisable.includes('UploadFieldDataEditorModel.types')) }]
});
const optionsFormArray = new Array<UntypedFormGroup>();
if (this.types) {
this.types.forEach(item => {
const form: UntypedFormGroup = item.buildForm(disabled, skipDisable);
optionsFormArray.push(form);
});
}
formGroup.addControl('types', this.formBuilder.array(optionsFormArray));
if(disabled && !skipDisable.includes('UploadFieldDataEditorModel.types')) {
formGroup.disable();
}
return formGroup; }
fromModel(item: UploadFieldData): UploadFieldDataEditorModel {
if (item.types) { this.types = item.types.map(x => new FieldDataOptionEditorModel().fromModel(x)); }
this.label = item.label;
this.maxFileSizeInMB = item.maxFileSizeInMB;
// this.types = item.types;
return this;
}
}

View File

@ -1,19 +0,0 @@
import { UntypedFormGroup } from '@angular/forms';
import { FieldDataEditorModel } from './field-data-editor-model';
import { ValidationFieldData } from '../../../../../core/model/dataset-profile-definition/field-data/field-data';
export class ValidationDataEditorModel extends FieldDataEditorModel<ValidationDataEditorModel> {
public label: string;
buildForm(disabled: boolean = false, skipDisable: Array<String> = []): UntypedFormGroup {
const formGroup = this.formBuilder.group({
label: [{ value: this.label, disabled: (disabled && !skipDisable.includes('ValidationDataEditorModel.label')) }]
});
return formGroup;
}
fromModel(item: ValidationFieldData): ValidationDataEditorModel {
this.label = item.label;
return this;
}
}

View File

@ -1,37 +0,0 @@
import { UntypedFormGroup } from '@angular/forms';
import { DatasetProfileComboBoxType } from '../../../../../core/common/enum/dataset-profile-combo-box-type';
import { WordListFieldData } from '../../../../../core/model/dataset-profile-definition/field-data/field-data';
import { FieldDataEditorModel } from './field-data-editor-model';
import { FieldDataOptionEditorModel } from './field-data-option-editor-model';
export class WordListFieldDataEditorModel extends FieldDataEditorModel<WordListFieldDataEditorModel> {
public type: DatasetProfileComboBoxType = DatasetProfileComboBoxType.WordList;
public options: Array<FieldDataOptionEditorModel>;
public multipleList: boolean;
buildForm(disabled: boolean = false, skipDisable: Array<String> = []): UntypedFormGroup {
const formGroup = this.formBuilder.group({
type: [{ value: this.type, disabled: (disabled && !skipDisable.includes('WordListFieldDataEditorModel.type')) }],
label: [{ value: this.label, disabled: (disabled && !skipDisable.includes('WordListFieldDataEditorModel.label')) }],
multiList: [{ value: this.multipleList, disabled: (disabled && !skipDisable.includes('WordListFieldDataEditorModel.multipleList'))}]
});
const optionsFormArray = new Array<UntypedFormGroup>();
if (this.options) {
this.options.forEach(item => {
const form: UntypedFormGroup = item.buildForm(disabled, skipDisable);
optionsFormArray.push(form);
});
}
formGroup.addControl('options', this.formBuilder.array(optionsFormArray));
return formGroup;
}
fromModel(item: WordListFieldData): WordListFieldDataEditorModel {
this.type = item.type;
if (item.options) { this.options = item.options.map(x => new FieldDataOptionEditorModel().fromModel(x)); }
this.label = item.label;
this.multipleList = item.multiList;
return this;
}
}

View File

@ -1,175 +0,0 @@
import { FormArray, FormControl, UntypedFormGroup, Validators } from '@angular/forms';
import { ValidationType } from '../../../../core/common/enum/validation-type';
import { Field } from '../../../../core/model/admin/dataset-profile/dataset-profile';
import { BaseFormModel } from '../../../../core/model/base-form-model';
import { DefaultValueEditorModel } from './default-value-editor-model';
import { AutoCompleteFieldDataEditorModel } from './field-data/auto-complete-field-data-editor-model';
import { BooleanDecisionFieldDataEditorModel } from './field-data/boolean-decision-field-data-editor-model';
import { CheckBoxFieldDataEditorModel } from './field-data/check-box-field-data-editor-model';
import { FieldDataEditorModel } from './field-data/field-data-editor-model';
import { FreeTextFieldDataEditorModel } from './field-data/free-text-field-data-editor-model';
import { RadioBoxFieldDataEditorModel } from './field-data/radio-box-field-data-editor-model';
import { TextAreaFieldDataEditorModel } from './field-data/text-area-field-data-editor-model';
import { RichTextAreaFieldDataEditorModel } from './field-data/rich-text-area-field-data-editor-model';
import {UploadFieldDataEditorModel} from "./field-data/upload-field-data-editor-model";
import { WordListFieldDataEditorModel } from './field-data/word-list-field-data-editor-model';
import { ViewStyleEditorModel } from './view-style-editor-model';
import { VisibilityEditorModel } from './visibility-editor-model';
import { DatasetProfileEditorDatePickerFieldComponent } from '../editor/components/field-type/datepicker/dataset-profile-editor-date-picker-field.component';
import { DatePickerDataEditorModel } from './field-data/date-picker-data-editor-models';
import { ResearchersAutoCompleteFieldDataEditorModel } from './field-data/researchers-auto-complete-field-data-editor-model';
import { DatasetsAutoCompleteFieldDataEditorModel } from './field-data/datasets-autocomplete-field-data-editor-mode';
import { DmpsAutoCompleteFieldDataEditorModel } from './field-data/dmps-autocomplete-field-data-editor-model';
import { ExternalDatasetsDataEditorModel } from './field-data/external-datasets-data-editor-models';
import { DataRepositoriesDataEditorModel } from './field-data/data-repositories-data-editor-models';
import { RegistriesDataEditorModel } from './field-data/registries-data-editor-models';
import { ServicesDataEditorModel } from './field-data/services-data-editor-models';
import { TagsDataEditorModel } from './field-data/tags-data-editor-models';
import { ResearchersDataEditorModel } from './field-data/researchers-data-editor-models';
import { OrganizationsDataEditorModel } from './field-data/organizations-data-editor-models';
import { DatasetIdentifierDataEditorModel } from './field-data/dataset-identifier-data-editor-models';
import { CurrencyDataEditorModel } from './field-data/currency-data-editor-models';
import { DatasetProfileComboBoxType } from '@app/core/common/enum/dataset-profile-combo-box-type';
import { EditorCustomValidators } from '../editor/custom-validators/editor-custom-validators';
import { ValidationDataEditorModel } from './field-data/validation-data-editor-models';
import {PublicationsDataEditorModel} from "@app/ui/admin/dataset-profile/admin/field-data/publications-data-editor-models";
import {LicensesDataEditorModel} from "@app/ui/admin/dataset-profile/admin/field-data/licenses-data-editor-models";
import {TaxonomiesDataEditorModel} from "@app/ui/admin/dataset-profile/admin/field-data/taxonomies-data-editor-models";
export class FieldEditorModel extends BaseFormModel {
public id: string;
// public title: string;
public defaultValue: DefaultValueEditorModel = new DefaultValueEditorModel();
public viewStyle: ViewStyleEditorModel = new ViewStyleEditorModel();
public page: number = null;
public ordinal: number = null;
public visible: VisibilityEditorModel = new VisibilityEditorModel();
public data: FieldDataEditorModel<any>;
public validations: ValidationType[] = [];
public schematics: string[];
public export: boolean = true;
fromModel(item: Field): FieldEditorModel {
this.id = item.id;
if (item.defaultValue) { this.defaultValue = new DefaultValueEditorModel().fromModel(item.defaultValue); }
this.page = item.page;
this.ordinal = item.ordinal;
this.validations = item.validations;
this.viewStyle = new ViewStyleEditorModel().fromModel(item.viewStyle);
this.visible = new VisibilityEditorModel().fromModel(item.visible);
this.schematics = item.schematics;
this.export = item.export;
if (item.data) {
if (this.viewStyle.renderStyle === 'combobox') {
if (item.data.type === 'autocomplete') { this.data = new AutoCompleteFieldDataEditorModel().fromModel(item.data); }
if (item.data.type === 'wordlist') { this.data = new WordListFieldDataEditorModel().fromModel(item.data); }
} else if (this.viewStyle.renderStyle === 'internalDmpEntities') {
if (item.data.type === 'researchers') { this.data = new ResearchersAutoCompleteFieldDataEditorModel().fromModel(item.data); }
if (item.data.type === 'datasets') { this.data = new DatasetsAutoCompleteFieldDataEditorModel().fromModel(item.data); }
if (item.data.type === 'dmps') { this.data = new DmpsAutoCompleteFieldDataEditorModel().fromModel(item.data); }
} else {
if (this.viewStyle.renderStyle === 'radiobox') { this.data = new RadioBoxFieldDataEditorModel().fromModel(item.data); }
if (this.viewStyle.renderStyle === 'checkBox') { this.data = new CheckBoxFieldDataEditorModel().fromModel(item.data); }
if (this.viewStyle.renderStyle === 'textarea') { this.data = new TextAreaFieldDataEditorModel().fromModel(item.data); }
if (this.viewStyle.renderStyle === 'richTextarea') { this.data = new RichTextAreaFieldDataEditorModel().fromModel(item.data); }
if (this.viewStyle.renderStyle === 'upload') { this.data = new UploadFieldDataEditorModel().fromModel(item.data); }
if (this.viewStyle.renderStyle === 'freetext') { this.data = new FreeTextFieldDataEditorModel().fromModel(item.data); }
if (this.viewStyle.renderStyle === 'booleanDecision') { this.data = new BooleanDecisionFieldDataEditorModel().fromModel(item.data); }
if (this.viewStyle.renderStyle === 'datePicker') { this.data = new DatePickerDataEditorModel().fromModel(item.data); }
if (this.viewStyle.renderStyle === 'externalDatasets') { this.data = new ExternalDatasetsDataEditorModel().fromModel(item.data); }
if (this.viewStyle.renderStyle === 'dataRepositories') { this.data = new DataRepositoriesDataEditorModel().fromModel(item.data); }
if (this.viewStyle.renderStyle === 'pubRepositories') { this.data = new DataRepositoriesDataEditorModel().fromModel(item.data); }
if (this.viewStyle.renderStyle === 'journalRepositories') { this.data = new DataRepositoriesDataEditorModel().fromModel(item.data); }
if (this.viewStyle.renderStyle === 'taxonomies') { this.data = new TaxonomiesDataEditorModel().fromModel(item.data); }
if (this.viewStyle.renderStyle === 'licenses') { this.data = new LicensesDataEditorModel().fromModel(item.data); }
if (this.viewStyle.renderStyle === 'publications') { this.data = new PublicationsDataEditorModel().fromModel(item.data); }
if (this.viewStyle.renderStyle === 'registries') { this.data = new RegistriesDataEditorModel().fromModel(item.data); }
if (this.viewStyle.renderStyle === 'services') { this.data = new ServicesDataEditorModel().fromModel(item.data); }
if (this.viewStyle.renderStyle === 'tags') { this.data = new TagsDataEditorModel().fromModel(item.data); }
if (this.viewStyle.renderStyle === 'researchers') { this.data = new ResearchersAutoCompleteFieldDataEditorModel().fromModel(item.data); }
if (this.viewStyle.renderStyle === 'organizations') { this.data = new OrganizationsDataEditorModel().fromModel(item.data); }
if (this.viewStyle.renderStyle === 'datasetIdentifier') { this.data = new DatasetIdentifierDataEditorModel().fromModel(item.data); }
if (this.viewStyle.renderStyle === 'currency') { this.data = new CurrencyDataEditorModel().fromModel(item.data); }
if (this.viewStyle.renderStyle === 'validation') { this.data = new ValidationDataEditorModel().fromModel(item.data); }
}
}
return this;
}
buildForm(disabled: boolean = false, skipDisable: Array<String> = []): UntypedFormGroup {
const formGroup = this.formBuilder.group({
id: [{ value: this.id, disabled: (disabled && !skipDisable.includes('FieldEditorModel.id')) }, [Validators.required, Validators.pattern('^[^<_>]+$')]],
// title: [this.title],
page: [{ value: this.page, disabled: (disabled && !skipDisable.includes('FieldEditorModel.page')) }],
ordinal: [{ value: this.ordinal, disabled: (disabled && !skipDisable.includes('FieldEditorModel.ordinal')) }],
validations: [{ value: this.validations, disabled: (disabled && !skipDisable.includes('FieldEditorModel.validations')) }],
schematics: [{ value: this.schematics, disabled: (disabled && !skipDisable.includes('FieldEditorModel.schematics')) }],
export: [{value: this.export, disabled: (disabled && !skipDisable.includes('FieldSetEditorModel.export'))}]
});
formGroup.addControl('defaultValue', this.defaultValue.buildForm(disabled, skipDisable));
formGroup.addControl('viewStyle', this.viewStyle.buildForm(disabled, skipDisable));
formGroup.addControl('visible', this.visible.buildForm(disabled, skipDisable));
if (this.data) { formGroup.addControl('data', this.data.buildForm(disabled, skipDisable)); }
else { formGroup.addControl('data', new WordListFieldDataEditorModel().buildForm(disabled, skipDisable)); }
// //append validators
this._appendCustomValidators(formGroup);
// //setting up listeners
// formGroup.get('viewStyle').valueChanges.subscribe(changes=>{
// // const viewStyleChanges:{cssClass:string, renderStyle: string} = changes;
// this._removeCustomValidators(formGroup);
// this._appendCustomValidators(formGroup);
// })
return formGroup;
}
private _appendCustomValidators(formGroup: UntypedFormGroup){
const renderStyleValue = formGroup.get('viewStyle').get('renderStyle').value;
if(renderStyleValue === 'checkBox'){
formGroup.get('defaultValue').get('value').setValidators(Validators.required);
formGroup.get('defaultValue').get('value').updateValueAndValidity();
}else if(renderStyleValue === 'combobox'){
try{
const comboType = formGroup.get('data').get('type').value;
if(comboType === DatasetProfileComboBoxType.Autocomplete){//As 'Other' in UI
formGroup.get('data').setValidators(EditorCustomValidators.atLeastOneElementListValidator('autoCompleteSingleDataList'));
}else if(comboType === DatasetProfileComboBoxType.WordList){
formGroup.get('data').setValidators(EditorCustomValidators.atLeastOneElementListValidator('options'));
}
}catch(e){
console.error('Error setting validators.');
console.error(e);
}
}else if(renderStyleValue === 'radiobox'){
formGroup.get('data').setValidators(EditorCustomValidators.atLeastOneElementListValidator('options'));
}else if(renderStyleValue === 'upload'){
formGroup.get('data').setValidators(EditorCustomValidators.atLeastOneElementListValidator('types'));
formGroup.get('data').get('maxFileSizeInMB').setValidators(Validators.required);
}
formGroup.get('data').updateValueAndValidity();
}
// private _removeCustomValidators(formGroup:FormGroup){
// const renderStyleValue = formGroup.get('viewStyle').get('renderStyle').value;
// if(renderStyleValue != 'checkBox'){
// formGroup.get('defaultValue').get('value').clearValidators();
// }else if(renderStyleValue === 'combobox'){
// formGroup.get('data').clearValidators();
// }
// }
// private _buildData(formGroup: FormGroup){
// }
}

View File

@ -1,54 +0,0 @@

import { UntypedFormGroup, Validators } from '@angular/forms';
import { FieldSet } from '../../../../core/model/admin/dataset-profile/dataset-profile';
import { BaseFormModel } from '../../../../core/model/base-form-model';
import { FieldEditorModel } from './field-editor-model';
import { MultiplicityEditorModel } from './multiplicity-editor-model';
export class FieldSetEditorModel extends BaseFormModel {
public fields: Array<FieldEditorModel> = new Array<FieldEditorModel>();
public id: string;
public ordinal: number;
public multiplicity: MultiplicityEditorModel = new MultiplicityEditorModel();
public title: string;
public description: string;
public extendedDescription: string;
public additionalInformation: string;
public hasCommentField: boolean;
fromModel(item: FieldSet): FieldSetEditorModel {
if (item.fields) { this.fields = item.fields.map(x => new FieldEditorModel().fromModel(x)); }
if (item.multiplicity) this.multiplicity = new MultiplicityEditorModel().fromModel(item.multiplicity);
this.id = item.id;
this.ordinal = item.ordinal;
this.title = item.title;
this.description = item.description;
this.extendedDescription = item.extendedDescription;
this.additionalInformation = item.additionalInformation;
this.hasCommentField = item.hasCommentField;
return this;
}
buildForm(disabled: boolean = false, skipDisable: Array<String> = []): UntypedFormGroup {
const formGroup = this.formBuilder.group({
id: [{ value: this.id, disabled: (disabled && !skipDisable.includes('FieldSetEditorModel.id')) }, [Validators.required, Validators.pattern('^[^<_>]+$')]],
ordinal: [{ value: this.ordinal, disabled: (disabled && !skipDisable.includes('FieldSetEditorModel.ordinal')) }],
title: [{ value: this.title, disabled: (disabled && !skipDisable.includes('FieldSetEditorModel.title')) }, [Validators.required]],
description: [{ value: this.description, disabled: (disabled && !skipDisable.includes('FieldSetEditorModel.description')) }],
extendedDescription: [{ value: this.extendedDescription, disabled: (disabled && !skipDisable.includes('FieldSetEditorModel.extendedDescription')) }],
additionalInformation: [{ value: this.additionalInformation, disabled: (disabled && !skipDisable.includes('FieldSetEditorModel.additionalInformation')) }],
hasCommentField: [{ value: this.hasCommentField, disabled: (disabled && !skipDisable.includes('FieldSetEditorModel.hasCommentField')) }]
});
const fieldsFormArray = new Array<UntypedFormGroup>();
this.fields.forEach(item => {
const form: UntypedFormGroup = item.buildForm(disabled, skipDisable);
fieldsFormArray.push(form);
});
formGroup.addControl('fields', this.formBuilder.array(fieldsFormArray));
formGroup.addControl('multiplicity', this.multiplicity.buildForm(disabled, skipDisable));
return formGroup;
}
}

View File

@ -1,30 +0,0 @@
import {UntypedFormGroup} from '@angular/forms';
import {Multiplicity} from '../../../../core/model/admin/dataset-profile/dataset-profile';
import {BaseFormModel} from '../../../../core/model/base-form-model';
export class MultiplicityEditorModel extends BaseFormModel {
public min: number;
public max: number;
public placeholder: string;
public tableView: boolean;
fromModel(item: Multiplicity): MultiplicityEditorModel {
this.min = item.min;
this.max = item.max;
this.placeholder = item.placeholder;
this.tableView = item.tableView;
return this;
}
buildForm(disabled: boolean = false, skipDisable: Array<String> = []): UntypedFormGroup {
return this.formBuilder.group({
min: [{value: this.min, disabled: (disabled && !skipDisable.includes('MultiplicityEditorModel.min'))}],
max: [{value: this.max, disabled: (disabled && !skipDisable.includes('MultiplicityEditorModel.max'))}],
placeholder: [{
value: this.placeholder,
disabled: (disabled && !skipDisable.includes('MultiplicityEditorModel.placeholder'))
}],
tableView: [{value: this.tableView, disabled: (disabled && !skipDisable.includes('MultiplicityEditorModel.tableView'))}]
});
}
}

View File

@ -1,32 +0,0 @@
import { UntypedFormGroup, Validators } from '@angular/forms';
import { Page } from '@app/core/model/admin/dataset-profile/dataset-profile';
import { BaseFormModel } from '@app/core/model/base-form-model';
import { Guid } from '@common/types/guid';
export class PageEditorModel extends BaseFormModel {
public title: string;
public id: string;
public ordinal: number;
constructor(ordinal?: number) {
super();
if (isNaN(ordinal)) { this.ordinal = 0; } else { this.ordinal = ordinal; }
this.id = Guid.create().toString();
}
fromModel(item: Page): PageEditorModel {
this.title = item.title;
this.id = item.id;
this.ordinal = item.ordinal;
return this;
}
buildForm(disabled: boolean = false, skipDisable: Array<String> = []): UntypedFormGroup {
const formGroup = this.formBuilder.group({
title: [{ value: this.title, disabled: (disabled && !skipDisable.includes('PageEditorModel.title')) }, [Validators.required]],
id: [{ value: this.id, disabled: (disabled && !skipDisable.includes('PageEditorModel.id')) }, [Validators.required]],
ordinal: [{ value: this.ordinal, disabled: (disabled && !skipDisable.includes('PageEditorModel.ordinal')) }]
});
return formGroup;
}
}

View File

@ -1,32 +0,0 @@
import { UntypedFormGroup, Validators } from "@angular/forms";
import { Rule } from "../../../../core/model/admin/dataset-profile/dataset-profile";
import { BaseFormModel } from "../../../../core/model/base-form-model";
export class RuleEditorModel extends BaseFormModel {
public target: string;
public value: string;
public ruleType: string;
public ruleStyle: string;
public valueType: string;
fromModel(item: Rule): RuleEditorModel {
this.target = item.target;
this.value = item.value;
this.ruleType = item.ruleType;
this.ruleStyle = item.ruleStyle;
this.valueType = item.valueType;
return this;
}
buildForm(disabled: boolean = false, skipDisable: Array<String> = []): UntypedFormGroup {
const formGroup = this.formBuilder.group({
// sourceField: [this.sourceField],
target: [{ value: this.target, disabled: (disabled && !skipDisable.includes('RuleEditorModel.target')) }, [Validators.required]],
ruleStyle: [{ value: this.ruleStyle, disabled: (disabled && !skipDisable.includes('RuleEditorModel.ruleStyle')) }],
value: [{ value: this.value, disabled: (disabled && !skipDisable.includes('RuleEditorModel.value')) }, [Validators.required]],
ruleType: [{ value: this.ruleType, disabled: (disabled && !skipDisable.includes('RuleEditorModel.ruleType')) }],
valueType: [{ value: this.valueType, disabled: (disabled && !skipDisable.includes('RuleEditorModel.valueType')) }]
});
return formGroup;
}
}

View File

@ -1,61 +0,0 @@
import { UntypedFormBuilder, FormControl, UntypedFormGroup, Validators } from '@angular/forms';
import { Section } from '../../../../core/model/admin/dataset-profile/dataset-profile';
import { BaseFormModel } from '../../../../core/model/base-form-model';
import { EditorCustomValidators } from '../editor/custom-validators/editor-custom-validators';
import { FieldSetEditorModel } from './field-set-editor-model';
export class SectionEditorModel extends BaseFormModel {
public sections: Array<SectionEditorModel> = new Array<SectionEditorModel>();
public defaultVisibility: boolean;
public page: string;
public id: string;
public title: string;
public description: string;
public ordinal: number;
public fieldSets: Array<FieldSetEditorModel> = new Array<FieldSetEditorModel>();
fromModel(item: Section): SectionEditorModel {
if (item.sections) { this.sections = item.sections.map(x => new SectionEditorModel().fromModel(x)); }
this.page = item.page;
this.defaultVisibility = item.defaultVisibility;
this.id = item.id;
this.title = item.title;
this.description = item.description;
this.ordinal = item.ordinal;
if (item.fieldSets) { this.fieldSets = item.fieldSets.map(x => new FieldSetEditorModel().fromModel(x)); }
return this;
}
buildForm(disabled: boolean = false, skipDisable: Array<String> = []): UntypedFormGroup {
const formGroup: UntypedFormGroup = new UntypedFormBuilder().group({
id: [{ value: this.id, disabled: (disabled && !skipDisable.includes('SectionEditorModel.id')) }, [Validators.required, Validators.pattern('^[^<_>]+$')]],
page: [{ value: this.page, disabled: (disabled && !skipDisable.includes('SectionEditorModel.page')) }, [Validators.required]],
title: [{ value: this.title, disabled: (disabled && !skipDisable.includes('SectionEditorModel.title')) } , [Validators.required]],
description: [{ value: this.description, disabled: (disabled && !skipDisable.includes('SectionEditorModel.description')) }],
ordinal: [{ value: this.ordinal, disabled: (disabled && !skipDisable.includes('SectionEditorModel.ordinal')) }, [Validators.required]],
defaultVisibility: [{ value: this.defaultVisibility, disabled: (disabled && !skipDisable.includes('SectionEditorModel.defaultVisibility')) }]
});
const sectionsFormArray = new Array<UntypedFormGroup>();
if (this.sections) {
this.sections.forEach(item => {
const form: UntypedFormGroup = item.buildForm(disabled, skipDisable);
sectionsFormArray.push(form);
});
}
const compositeFieldsFormArray = new Array<UntypedFormGroup>();
if (this.fieldSets) {
this.fieldSets.forEach(item => {
const form: UntypedFormGroup = item.buildForm(disabled, skipDisable);
compositeFieldsFormArray.push(form);
});
}
formGroup.addControl('sections', this.formBuilder.array(sectionsFormArray));
formGroup.addControl('fieldSets', this.formBuilder.array(compositeFieldsFormArray));
if (!formGroup.controls['defaultVisibility'].value) { formGroup.controls['defaultVisibility'].setValue(true); }
formGroup.setValidators(EditorCustomValidators.sectionHasAtLeastOneChildOf('fieldSets','sections'));
formGroup.updateValueAndValidity();
return formGroup;
}
}

View File

@ -1,22 +0,0 @@
import { UntypedFormGroup, Validators } from "@angular/forms";
import { ViewStyle } from "../../../../core/model/admin/dataset-profile/dataset-profile";
import { BaseFormModel } from "../../../../core/model/base-form-model";
export class ViewStyleEditorModel extends BaseFormModel {
public cssClass: string;
public renderStyle: string;
fromModel(item: ViewStyle): ViewStyleEditorModel {
this.cssClass = item.cssClass;
this.renderStyle = item.renderStyle;
return this;
}
buildForm(disabled: boolean = false, skipDisable: Array<String> = []): UntypedFormGroup {
const formGroup = this.formBuilder.group({
cssClass: [{ value: this.cssClass, disabled: (disabled && !skipDisable.includes('ViewStyleEditorModel.cssClass')) }],
renderStyle: [{ value: this.renderStyle, disabled: (disabled && !skipDisable.includes('ViewStyleEditorModel.renderStyle')) }, Validators.required]
});
return formGroup;
}
}

View File

@ -1,36 +0,0 @@
import { UntypedFormGroup } from '@angular/forms';
import { Visibility } from '../../../../core/model/admin/dataset-profile/dataset-profile';
import { BaseFormModel } from '../../../../core/model/base-form-model';
import { RuleEditorModel } from './rule-editor-model';
export class VisibilityEditorModel extends BaseFormModel {
public rules: Array<RuleEditorModel> = new Array<RuleEditorModel>();
public style: string;
fromModel(item: Visibility): VisibilityEditorModel {
if (item.rules) { this.rules = item.rules.map(x => new RuleEditorModel().fromModel(x)); }
this.style = item.style;
return this;
}
buildForm(disabled: boolean = false, skipDisable: Array<String> = []): UntypedFormGroup {
const formGroup = this.formBuilder.group({
style: [{ value: this.style, disabled: (disabled && !skipDisable.includes('VisibilityEditorModel.style')) }]
});
const rulesFormArray = new Array<UntypedFormGroup>();
if (this.rules) {
this.rules.forEach(rule => {
const form: UntypedFormGroup = rule.buildForm(disabled, skipDisable);
rulesFormArray.push(form);
});
}
formGroup.addControl('rules', this.formBuilder.array(rulesFormArray));
return formGroup;
}
}

View File

@ -1,137 +0,0 @@
import { DragDropModule } from '@angular/cdk/drag-drop';
import { NgModule } from '@angular/core';
//matrial
import { MatBadgeModule } from '@angular/material/badge';
import { FormattingModule } from '@app/core/formatting.module';
import { AutoCompleteModule } from '@app/library/auto-complete/auto-complete.module';
import { DatasetProfileRoutingModule } from '@app/ui/admin/dataset-profile/dataset-profile.routing';
import { DatasetProfileEditorCompositeFieldComponent } from '@app/ui/admin/dataset-profile/editor/components/composite-field/dataset-profile-editor-composite-field.component';
import { DatasetProfileEditorDefaultValueComponent } from '@app/ui/admin/dataset-profile/editor/components/composite-profile-editor-default-value/component-profile-editor-default-value.component';
import { DatasetProfileEditorAutoCompleteFieldComponent } from '@app/ui/admin/dataset-profile/editor/components/field-type/auto-complete/dataset-profile-editor-auto-complete-field.component';
import { DatasetProfileEditorBooleanDecisionFieldComponent } from '@app/ui/admin/dataset-profile/editor/components/field-type/boolean-decision/dataset-profile-editor-boolean-decision-field.component';
import { DatasetProfileEditorCheckboxFieldComponent } from '@app/ui/admin/dataset-profile/editor/components/field-type/checkbox/dataset-profile-editor-checkbox-field.component';
import { DatasetProfileEditorComboBoxFieldComponent } from '@app/ui/admin/dataset-profile/editor/components/field-type/combo-box/dataset-profile-editor-combo-box-field.component';
import { DatasetProfileEditorDatasetsAutoCompleteFieldComponent } from '@app/ui/admin/dataset-profile/editor/components/field-type/datasets-auto-complete/dataset-profile-editor-datasets-autocomplete-field.component';
import { DatasetProfileEditorDatePickerFieldComponent } from '@app/ui/admin/dataset-profile/editor/components/field-type/datepicker/dataset-profile-editor-date-picker-field.component';
import { DatasetProfileEditorDmpsAutoCompleteFieldComponent } from '@app/ui/admin/dataset-profile/editor/components/field-type/dmps-auto-complete/dataset-profile-editor-dmps-autocomplete-field.component';
import { DatasetProfileEditorFreeTextFieldComponent } from '@app/ui/admin/dataset-profile/editor/components/field-type/free-text/dataset-profile-editor-free-text-field.component';
import { DatasetProfileEditorInternalDmpEntitiesFieldComponent } from '@app/ui/admin/dataset-profile/editor/components/field-type/internal-dmp-entities/dataset-profile-editor-internal-dmp-entities-field.component';
import { DatasetProfileEditorRadioBoxFieldComponent } from '@app/ui/admin/dataset-profile/editor/components/field-type/radio-box/dataset-profile-editor-radio-box-field.component';
import { DatasetProfileEditorResearchersAutoCompleteFieldComponent } from '@app/ui/admin/dataset-profile/editor/components/field-type/researchers-auto-complete/dataset-profile-editor-researchers-auto-complete-field.component';
import { DatasetProfileEditorTextAreaFieldComponent } from '@app/ui/admin/dataset-profile/editor/components/field-type/textarea/dataset-profile-editor-text-area-field.component';
import { DatasetProfileEditorWordListFieldComponent } from '@app/ui/admin/dataset-profile/editor/components/field-type/word-list/dataset-profile-editor-word-list-field.component';
import { DatasetProfileEditorFieldComponent } from '@app/ui/admin/dataset-profile/editor/components/field/dataset-profile-editor-field.component';
import { DatasetProfileEditorPageComponent } from '@app/ui/admin/dataset-profile/editor/components/page/dataset-profile-editor-page.component';
import { DatasetProfileEditorRuleComponent } from '@app/ui/admin/dataset-profile/editor/components/rule/dataset-profile-editor-rule.component';
import { DatasetProfileEditorSectionComponent } from '@app/ui/admin/dataset-profile/editor/components/section/dataset-profile-editor-section.component';
import { DatasetProfileEditorComponent } from '@app/ui/admin/dataset-profile/editor/dataset-profile-editor.component';
import { DatasetProfileCriteriaComponent } from '@app/ui/admin/dataset-profile/listing/criteria/dataset-profile.component';
import { DialogConfirmationUploadDatasetProfiles } from '@app/ui/admin/dataset-profile/listing/criteria/dialog-confirmation-upload-profile/dialog-confirmation-upload-profiles.component';
import { DatasetProfileListingComponent } from '@app/ui/admin/dataset-profile/listing/dataset-profile-listing.component';
import { DatasetModule } from '@app/ui/dataset/dataset.module';
import { FormProgressIndicationModule } from '@app/ui/misc/dataset-description-form/components/form-progress-indication/form-progress-indication.module';
import { CommonFormsModule } from '@common/forms/common-forms.module';
import { ConfirmationDialogModule } from '@common/modules/confirmation-dialog/confirmation-dialog.module';
import { CommonUiModule } from '@common/ui/common-ui.module';
import { AngularStickyThingsModule } from '@w11k/angular-sticky-things';
import { DragulaModule } from 'ng2-dragula';
import { NgxDropzoneModule } from 'ngx-dropzone';
import { DatasetProfileEditorCurrencyFieldComponent } from './editor/components/field-type/currency/dataset-profile-editor-currency-field.component';
import { DatasetProfileEditorDataRepositoriesFieldComponent } from './editor/components/field-type/data-repositories/dataset-profile-editor-data-repositories-field.component';
import { DatasetProfileEditorDatasetIdentifierFieldComponent } from './editor/components/field-type/dataset-identifier/dataset-profile-editor-dataset-identifier-field.component';
import { DatasetProfileEditorExternalDatasetsFieldComponent } from './editor/components/field-type/external-datasets/dataset-profile-editor-external-datasets-field.component';
import { DatasetProfileEditorOrganizationsFieldComponent } from './editor/components/field-type/organizations/dataset-profile-editor-organizations-field.component';
import { DatasetProfileEditorRegistriesFieldComponent } from './editor/components/field-type/registries/dataset-profile-editor-registries-field.component';
import { DatasetProfileEditorResearchersFieldComponent } from './editor/components/field-type/researchers/dataset-profile-editor-researchers-field.component';
import { DatasetProfileEditorServicesFieldComponent } from './editor/components/field-type/services/dataset-profile-editor-services-field.component';
import { DatasetProfileEditorTagsFieldComponent } from './editor/components/field-type/tags/dataset-profile-editor-tags-field.component';
import { DatasetProfileEditorValidatorFieldComponent } from './editor/components/field-type/validator/dataset-profile-editor-validator-field.component';
import { FinalPreviewComponent } from './editor/components/final-preview/final-preview.component';
import { DatasetProfileEditorSectionFieldSetComponent } from './editor/components/section-fieldset/dataset-profile-editor-section-fieldset.component';
import { ParseStatus } from './listing/pipe/parse-status.pipe';
import { DatasetProfileTableOfContents } from './table-of-contents/table-of-contents';
import { DatasetProfileTableOfContentsInternalSection } from './table-of-contents/table-of-contents-internal-section/table-of-contents-internal-section';
import {TransitionGroupModule} from "@app/ui/transition-group/transition-group.module";
import { RichTextEditorModule } from "@app/library/rich-text-editor/rich-text-editor.module";
import {DatasetProfileEditorRichTextAreaFieldComponent} from "@app/ui/admin/dataset-profile/editor/components/field-type/rich-textarea/dataset-profile-editor-rich-text-area-field.component";
import {DatasetProfileEditorTaxonomiesFieldComponent} from "@app/ui/admin/dataset-profile/editor/components/field-type/taxonomies/dataset-profile-editor-taxonomies-field.component";
import {DatasetProfileEditorLicensesFieldComponent} from "@app/ui/admin/dataset-profile/editor/components/field-type/licenses/dataset-profile-editor-licenses-field.component";
import {DatasetProfileEditorPublicationsFieldComponent} from "@app/ui/admin/dataset-profile/editor/components/field-type/publications/dataset-profile-editor-publications-field.component";
import {DatasetProfileEditorJournalRepositoriesFieldComponent} from "@app/ui/admin/dataset-profile/editor/components/field-type/journal-repositories/dataset-profile-editor-journal-repositories-field.component";
import {DatasetProfileEditorPubRepositoriesFieldComponent} from "@app/ui/admin/dataset-profile/editor/components/field-type/pub-repositories/dataset-profile-editor-pub-repositories-field.component";
import {DatasetProfileEditorUploadFieldComponent} from "@app/ui/admin/dataset-profile/editor/components/field-type/upload/dataset-profile-editor-upload-field.component";
// import { TableEditorModule } from "@app/library/table-editor/table-editor.module";
// import {DatasetProfileEditorTableFieldComponent} from "@app/ui/admin/dataset-profile/editor/components/field-type/table/dataset-profile-editor-table-field.component";
@NgModule({
imports: [
CommonUiModule,
CommonFormsModule,
FormattingModule,
DatasetProfileRoutingModule,
ConfirmationDialogModule,
NgxDropzoneModule,
FormProgressIndicationModule,
DatasetModule,
AngularStickyThingsModule,
DragDropModule,
MatBadgeModule,
DragulaModule,
AutoCompleteModule,
TransitionGroupModule,
RichTextEditorModule,
// TableEditorModule
],
declarations: [
DatasetProfileListingComponent,
DatasetProfileCriteriaComponent,
DatasetProfileEditorComponent,
DatasetProfileEditorSectionComponent,
DatasetProfileEditorCompositeFieldComponent,
DatasetProfileEditorFieldComponent,
DatasetProfileEditorPageComponent,
DatasetProfileEditorRuleComponent,
DatasetProfileEditorAutoCompleteFieldComponent,
DatasetProfileEditorBooleanDecisionFieldComponent,
DatasetProfileEditorCheckboxFieldComponent,
DatasetProfileEditorComboBoxFieldComponent,
DatasetProfileEditorFreeTextFieldComponent,
DatasetProfileEditorRadioBoxFieldComponent,
DatasetProfileEditorTextAreaFieldComponent,
DatasetProfileEditorRichTextAreaFieldComponent,
DatasetProfileEditorUploadFieldComponent,
// DatasetProfileEditorTableFieldComponent,
DatasetProfileEditorDatePickerFieldComponent,
DatasetProfileEditorWordListFieldComponent,
DatasetProfileEditorDefaultValueComponent,
DialogConfirmationUploadDatasetProfiles,
DatasetProfileEditorInternalDmpEntitiesFieldComponent,
DatasetProfileEditorResearchersAutoCompleteFieldComponent,
DatasetProfileEditorDatasetsAutoCompleteFieldComponent,
DatasetProfileEditorDmpsAutoCompleteFieldComponent,
ParseStatus,
DatasetProfileEditorExternalDatasetsFieldComponent,
DatasetProfileEditorDataRepositoriesFieldComponent,
DatasetProfileEditorPubRepositoriesFieldComponent,
DatasetProfileEditorJournalRepositoriesFieldComponent,
DatasetProfileEditorTaxonomiesFieldComponent,
DatasetProfileEditorLicensesFieldComponent,
DatasetProfileEditorPublicationsFieldComponent,
DatasetProfileEditorRegistriesFieldComponent,
DatasetProfileEditorServicesFieldComponent,
DatasetProfileEditorTagsFieldComponent,
DatasetProfileEditorResearchersFieldComponent,
DatasetProfileEditorOrganizationsFieldComponent,
DatasetProfileEditorDatasetIdentifierFieldComponent,
DatasetProfileEditorCurrencyFieldComponent,
DatasetProfileEditorValidatorFieldComponent,
DatasetProfileTableOfContents,
DatasetProfileTableOfContentsInternalSection,
DatasetProfileEditorSectionFieldSetComponent,
FinalPreviewComponent
]
})
export class DatasetProfileModule { }

View File

@ -1,85 +0,0 @@
import { NgModule } from '@angular/core';
import { RouterModule, Routes } from '@angular/router';
import { DatasetProfileEditorComponent } from './editor/dataset-profile-editor.component';
import { DatasetProfileListingComponent } from './listing/dataset-profile-listing.component';
import { AdminAuthGuard } from '@app/core/admin-auth-guard.service';
import { AppRole } from '@app/core/common/enum/app-role';
import { SpecialAuthGuard } from '@app/core/special-auth-guard.service';
import { CanDeactivateGuard } from '@app/library/deactivate/can-deactivate.guard';
const routes: Routes = [
{
path: 'new',
component: DatasetProfileEditorComponent,
data: {
title: 'GENERAL.TITLES.DATASET-PROFILES-NEW',
authContext: {
permissions: [AppRole.Admin, AppRole.DescriptionTemplateEditor]
}
},
canActivate: [SpecialAuthGuard],
canDeactivate:[CanDeactivateGuard]
},
{
path: ':id',
component: DatasetProfileEditorComponent,
data: {
title: 'GENERAL.TITLES.DATASET-PROFILES-EDIT',
authContext: {
permissions: [AppRole.Admin, AppRole.DescriptionTemplateEditor]
}
},
canActivate: [SpecialAuthGuard],
canDeactivate:[CanDeactivateGuard]
},
{
path: 'clone/:cloneid',
component: DatasetProfileEditorComponent,
data: {
title: 'GENERAL.TITLES.DATASET-PROFILES-CLONE',
authContext: {
permissions: [AppRole.Admin, AppRole.DescriptionTemplateEditor]
}
},
canActivate: [SpecialAuthGuard],
canDeactivate:[CanDeactivateGuard]
},
{
path: 'newversion/:newversionid',
component: DatasetProfileEditorComponent,
data: {
title: 'GENERAL.TITLES.DATASET-PROFILES-NEW-VERSION',
authContext: {
permissions: [AppRole.Admin, AppRole.DescriptionTemplateEditor]
}
},
canActivate: [SpecialAuthGuard],
canDeactivate:[CanDeactivateGuard]
},
{
path: 'versions/:groupId',
component: DatasetProfileListingComponent,
data: {
authContext: {
permissions: [AppRole.Admin, AppRole.DescriptionTemplateEditor]
}
},
canActivate: [SpecialAuthGuard]
},
{
path: '',
component: DatasetProfileListingComponent,
data: {
authContext: {
permissions: [AppRole.Admin, AppRole.DescriptionTemplateEditor]
}
},
canActivate: [SpecialAuthGuard]
},
];
@NgModule({
imports: [RouterModule.forChild(routes)],
exports: [RouterModule]
})
export class DatasetProfileRoutingModule { }

View File

@ -1,90 +0,0 @@
import { animate, keyframes, state, style, transition, trigger } from "@angular/animations";
export const STEPPER_ANIMATIONS = [
trigger('previous_btn',[
transition(':enter',[
style({'transform': 'translateX(100%)', 'z-index':'9999', 'opacity':0.4}),
animate('600ms ease-out', style({
'transform': 'translateX(0)',
'opacity':1
}))
]),
transition(':leave',[
style({
'transform': 'translateX(0)',
'opacity':'1',
'z-index':'9999'
}),
animate('800ms ease-out', keyframes([
style({'transform': 'translateX(120%)', offset:0.8}),
style({'opacity': '0.2', offset:0.96})
]))
])
]),
trigger('next_btn', [
transition(':leave',[
style({opacity:1, position:'absolute', 'z-index':'9999'}),
animate('700ms ease-out', keyframes( [
style({ transform:'translateX(-100%)', offset:0.6}),
style({ opacity:'0.2', offset:0.87})
]))
]),
transition(':enter',[
style({opacity:0.3, 'z-index':'9999', transform:'translateX(-100%)'}),
animate('600ms ease-out', style({ opacity:'1', transform:'translateX(0)' }))
])
]),
trigger('finalize_btn',[
transition(':enter',[
style({opacity:0.3}),
animate('400ms ease-in', style({opacity:1}))
]),
transition(':leave',[
style({opacity:1, position:'absolute'}),
animate('600ms ease-in', style({opacity:0.3}))
])
])
];
export const GENERAL_ANIMATIONS = [
trigger('enterIn',[
transition(':enter',[
style({
transform:'scale(0)',
'transform-origin':'50% 0',
opacity:0
}),
animate('800ms ease', style({transform:'scale(1)', opacity:1}))
])
]),
trigger('fadeElement',[
state('updated',style({opacity:0})),
transition("*=>updated",
animate('2s 1s ease-out'))
]),
trigger('add-new-user-field', [
state('untriggered', style({
transform:'translateX(120%)'
})),
state('triggered', style({
transform:'translateX(0)'
})),
transition('untriggered => triggered', animate('400ms ease')),
transition('triggered => untriggered', animate('400ms 100ms ease'))
]),
trigger('scroll-on-top-btn',[
transition(":enter", [style({opacity:0, transform:'scale(0)'}), animate('400ms ease', style({'opacity':1, transform:'scale(1)'}))]),
transition(":leave", [style({opacity:1,transform:'scale(1)'}), animate('400ms ease', style({'opacity':0, transform:'scale(0)'}))])
]),
trigger('action-btn',[
transition(":enter", [style({opacity:0, transform:'scale(0)'}), animate('400ms ease', style({'opacity':1, transform:'scale(1)'}))]),
transition(":leave", [style({opacity:1,transform:'scale(1)'}), animate('400ms ease', style({'opacity':0, transform:'scale(0)'}))])
]),
trigger('fade-in',[
transition(":enter", [style({opacity:0}), animate('1000ms 800ms ease', style({'opacity':1}))]),
]),
trigger('fade-in-fast',[
transition(":enter", [style({opacity:0}), animate('800ms 100ms ease', style({'opacity':1}))]),
]),
]

View File

@ -1,463 +0,0 @@
<!-- TO LINK -->
<!-- <div class="row">
<h4 *ngIf="isComposite" class="col-auto titleStile">{{'DATASET-PROFILE-EDITOR.STEPS.FORM.COMPOSITE-FIELD.TITLE' | translate}}</h4>
<h4 *ngIf="!isComposite" class="col-auto titleStile">{{'DATASET-PROFILE-EDITOR.STEPS.FORM.COMPOSITE-FIELD.SIMPLE-FIELD-TITLE' | translate}}</h4>
<mat-checkbox class="col-auto" [(ngModel)]="isComposite" (ngModelChange)="onIsCompositeChange(isComposite)" [disabled]="viewOnly">{{'DATASET-PROFILE-EDITOR.STEPS.FORM.COMPOSITE-FIELD.FIELDS.COMPOSITE-CHECKBOX' | translate}}</mat-checkbox>
<mat-checkbox class="col-auto" [(ngModel)]="isMultiplicityEnabled" (ngModelChange)="onIsMultiplicityEnabledChange(isMultiplicityEnabled)"
[disabled]="viewOnly">{{'DATASET-PROFILE-EDITOR.STEPS.FORM.COMPOSITE-FIELD.FIELDS.MULTIPLICITY-CHECKBOX' | translate}}</mat-checkbox>
<mat-checkbox class="col" [formControl]="this.form.get('hasCommentField')">{{'DATASET-PROFILE-EDITOR.STEPS.FORM.COMPOSITE-FIELD.FIELDS.COMMENT-CHECKBOX' | translate}}</mat-checkbox>
</div> -->
<!-- TO LINK -->
<!--
<div class="row">
<mat-form-field *ngIf="isComposite" class="col">
<input matInput type="string" placeholder="Id" [formControl]="form.get('id')" required>
<mat-error *ngIf="form.get('id').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
<mat-error *ngIf="form.get('id').hasError('pattern')">{{'GENERAL.VALIDATION.PATTERN-_' | translate}}</mat-error>
</mat-form-field>
<mat-form-field *ngIf="isComposite" class="col">
<input matInput type="text" placeholder="{{'DATASET-PROFILE-EDITOR.STEPS.FORM.COMPOSITE-FIELD.FIELDS.COMPOSITE-TITLE' | translate}}"
[formControl]="this.form.get('title')">
</mat-form-field>
<mat-form-field *ngIf="!isComposite" class="col">
<input matInput type="text" placeholder="{{'DATASET-PROFILE-EDITOR.STEPS.FORM.COMPOSITE-FIELD.FIELDS.FIELD-TITLE' | translate}}"
[formControl]="this.form.get('title')">
</mat-form-field>
<mat-form-field *ngIf="isMultiplicityEnabled" class="col">
<input matInput placeholder="{{'DATASET-PROFILE-EDITOR.STEPS.FORM.COMPOSITE-FIELD.FIELDS.MULTIPLICITY-MIN' | translate}}"
type="number" [formControl]="form.get('multiplicity').get('min')" required>
<mat-error *ngIf="form.get('multiplicity').get('min').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}
</mat-error>
</mat-form-field>
<mat-form-field *ngIf="isMultiplicityEnabled" class="col">
<input matInput placeholder="{{'DATASET-PROFILE-EDITOR.STEPS.FORM.COMPOSITE-FIELD.FIELDS.MULTIPLICITY-MAX' | translate}}"
type="number" [formControl]="this.form.get('multiplicity').get('max')" required>
<mat-error *ngIf="form.get('multiplicity').get('max').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}
</mat-error>
</mat-form-field>
<mat-form-field class="col">
<input matInput type="number" placeholder="{{'DATASET-PROFILE-EDITOR.STEPS.FORM.COMPOSITE-FIELD.FIELDS.ORDER' | translate}}"
[formControl]="this.form.get('ordinal')" required>
</mat-form-field>
</div> -->
<!-- ID TOP RIGHT CORNER -->
<!-- <div class="field-id-container">
{{this.form.get('id').value}}
<button mat-mini-fab class="field-id-container-icon">
<mat-icon>delete</mat-icon>
</button>
</div> -->
<!-- MAIN CONTENT -->
<div class="main-content-page" [ngClass]="{'pb-2': !hasFocus}">
<!-- TITLE -->
<div class="col-12">
<div class="row fielset-header">
<!-- <div class="col-auto d-flex">
<div class="align-self-center">
{{numbering}}
</div>
</div> -->
<mat-form-field class="numbering-label" [ngStyle]="calculateLabelWidth(numbering)">
<input [ngClass]="{'text-danger':form.get('title').invalid &&form.get('title').touched}" matInput type="text" [value]="numbering" disabled>
</mat-form-field>
<!-- [appearance]="titleControl.focused? 'legacy':'none'" floatLabel="never" -->
<mat-form-field class="col field-title" floatLabel="never">
<textarea matInput type="text" [placeholder]="('DATASET-PROFILE-EDITOR.STEPS.GENERAL-INFO.UNTITLED' |translate)+' '+('DATASET-PROFILE-EDITOR.STEPS.GENERAL-INFO.QUESTION'| translate)" #titleControl="matInput"
[formControl]="this.form.get('title')"></textarea>
</mat-form-field>
</div>
</div>
<div style="position: relative;" class="col-12" *ngIf="hasFocus" [@fade-in]>
<div *ngIf="showDescription" class="mb-4">
<h5 style="font-weight: bold" class="row">{{'DATASET-PROFILE-EDITOR.STEPS.FORM.COMPOSITE-FIELD.FIELDS.DESCRIPTION' | translate}}</h5>
<rich-text-editor-component [parentFormGroup]="form" [controlName]="'description'"
[id]="'editor1'" [placeholder]="'DATASET-PROFILE-EDITOR.STEPS.FORM.COMPOSITE-FIELD.FIELDS.DESCRIPTION'"
[wrapperClasses]="'row'">
</rich-text-editor-component>
</div>
<div *ngIf="showExtendedDescription" class="mb-4">
<h5 style="font-weight: bold" class="row">{{'DATASET-PROFILE-EDITOR.STEPS.FORM.COMPOSITE-FIELD.FIELDS.EXTENDED-DESCRIPTION' | translate}}</h5>
<rich-text-editor-component [parentFormGroup]="form" [controlName]="'extendedDescription'"
[id]="'editor2'" [placeholder]="'DATASET-PROFILE-EDITOR.STEPS.FORM.COMPOSITE-FIELD.FIELDS.EXTENDED-DESCRIPTION'"
[wrapperClasses]="'row'">
</rich-text-editor-component>
</div>
<div class="row" *ngIf="showAdditionalInfo">
<mat-form-field class="col p-0 underline-line-field">
<input matInput type="text" placeholder="{{'DATASET-PROFILE-EDITOR.STEPS.FORM.COMPOSITE-FIELD.FIELDS.ADDITIONAL-INFORMATION' | translate}}"
[formControl]="this.form.get('additionalInformation')"/>
</mat-form-field>
</div>
<div class="row">
<mat-form-field *ngIf="isMultiplicityEnabled" class="col pl-0 underline-line-field">
<input matInput placeholder="{{'DATASET-PROFILE-EDITOR.STEPS.FORM.COMPOSITE-FIELD.FIELDS.MULTIPLICITY-MIN' | translate}}"
type="number" [formControl]="form.get('multiplicity').get('min')" required>
<mat-error *ngIf="form.get('multiplicity').get('min').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}
</mat-error>
</mat-form-field>
<mat-form-field *ngIf="isMultiplicityEnabled" class="col pr-0 underline-line-field">
<input matInput placeholder="{{'DATASET-PROFILE-EDITOR.STEPS.FORM.COMPOSITE-FIELD.FIELDS.MULTIPLICITY-MAX' | translate}}"
type="number" [formControl]="this.form.get('multiplicity').get('max')" required>
<mat-error *ngIf="form.get('multiplicity').get('max').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}
</mat-error>
</mat-form-field>
</div>
<div class="row">
<mat-form-field *ngIf="isMultiplicityEnabled" class="col pl-0 underline-line-field">
<input matInput placeholder="{{'DATASET-PROFILE-EDITOR.STEPS.FORM.COMPOSITE-FIELD.FIELDS.MULTIPLICITY-PLACEHOLDER' | translate}}"
type="text" [formControl]="form.get('multiplicity').get('placeholder')">
</mat-form-field>
</div>
<div class="row">
<mat-checkbox *ngIf="isMultiplicityEnabled" class="col pl-0 underline-line-field fieldset-checkbox-action-dataset-profile-editor"
[formControl]="form.get('multiplicity').get('tableView')">
{{'DATASET-PROFILE-EDITOR.STEPS.FORM.COMPOSITE-FIELD.FIELDS.MULTIPLICITY-TABLEVIEW' | translate}}
</mat-checkbox>
</div>
</div>
<!-- FIELDS DETAILS AND ACTIONS -->
<div class="row">
<!-- FIELDS -->
<div #inputs transition-group class="col-12" *ngIf="hasFocus" [@fade-in]>
<div *ngFor="let field of fieldsArray.controls; let i=index;" class="row bg-white field-input mt-3" (click)="setTargetField(field)" transition-group-item>
<!-- field-container -->
<!-- [ngClass]="{'field-container-active': (field.get('id').value === targetField?.get('id').value) && hasFocus}" -->
<!-- <div class="field-id-container">
{{form.get('fields').get(''+i).get('id').value}} -->
<!-- <button mat-mini-fab class="field-id-container-icon" (click)="DeleteField(i)">
<mat-icon>delete</mat-icon>
</button> -->
<!-- </div> -->
<!-- *ngIf="!isComposite" -->
<app-dataset-profile-editor-field-component class="col-12"
[form]="field" [showOrdinal]="false"
[indexPath]="indexPath + 'f' + i" [viewOnly]="viewOnly"
[expandView]="hasFocus"
[canBeDeleted]="fieldsArray.length !=1"
(delete)="deleteField(i)">
<div class="arrows mt-2">
<ul class="list-unstyled list-inline d-flex align-items-center">
<li *ngIf="canGoUp(i)" class="text-muted">
<mat-icon style="cursor: pointer;" (click)="move(i)" [matTooltip]="'DATASET-PROFILE-EDITOR.ACTIONS.FIELD.MOVE-UP' | translate">keyboard_arrow_up</mat-icon>
</li>
<li *ngIf="canGoDown(i)" class="text-muted">
<mat-icon style="cursor: pointer;" (click)="move(i, 'down')" [matTooltip]="'DATASET-PROFILE-EDITOR.ACTIONS.FIELD.MOVE-DOWN' | translate">keyboard_arrow_down</mat-icon>
</li>
</ul>
</div>
</app-dataset-profile-editor-field-component>
<hr>
</div>
<!--
<div *ngIf="isComposite" class="row">
<h4 class="col-12 titleStile">{{'DATASET-PROFILE-EDITOR.STEPS.FORM.COMPOSITE-FIELD.SUB-FIELDS-TITLE' | translate}}
</h4>
<div class="col-12">
<mat-expansion-panel *ngFor="let field of form.get('fields')['controls'] let i=index;" #panel class="field-container">
<div class="field-id-container">
random id
</div>
<mat-expansion-panel-header>
<mat-panel-title class="cardTitle">{{i + 1}}. {{getFieldTile(field, i)}}</mat-panel-title>
<div class="row">
<button mat-icon-button type="button" class="deleteBtn col-auto" (click)="DeleteField(i);" [disabled]="viewOnly">
<mat-icon>delete</mat-icon>
</button>
</div>
</mat-expansion-panel-header>
<div id="{{indexPath + 'f' + i}}" *ngIf="panel.expanded">
<app-dataset-profile-editor-field-component [form]="form.get('fields').get(''+i)" [indexPath]="indexPath + 'f' + i" [viewOnly]="viewOnly"></app-dataset-profile-editor-field-component>
</div>
</mat-expansion-panel>
</div>
<div class="col-12">
<button mat-button class="full-width" (click)="addNewField()" [disabled]="viewOnly">{{'DATASET-PROFILE-EDITOR.STEPS.FORM.COMPOSITE-FIELD.ACTIONS.ADD-CHILD-FIELD' | translate}}</button>
</div>
</div> -->
</div>
<!-- PREVIEW -->
<div class="col-12 previewer">
<div *ngIf="hasFocus" class="d-flex mb-3" style="justify-content: space-between;">
<span class="previewer-text">{{'DATASET-PROFILE-EDITOR.ACTIONS.FIELD.PREVIEW' | translate}}</span>
<span [@fadeElement]="updatedClass" *ngIf="firstField?.get('viewStyle').get('renderStyle').value">
<ng-container *ngIf="!previewDirty">
{{'DATASET-PROFILE-EDITOR.STEPS.FORM.FIELD.STATUS.PREVIEW-UPDATED' | translate}}
</ng-container>
<ng-container *ngIf="previewDirty">
{{'DATASET-PROFILE-EDITOR.STEPS.FORM.FIELD.STATUS.CALCULATING-PREVIEW' | translate}}
</ng-container>
</span>
</div>
<div [id]="'preview_container'+ form.get('id').value" class="w-100" style="margin-right: -15px; margin-left: -15px;" >
<div *ngIf="previewForm && showPreview && firstField?.get('viewStyle').get('renderStyle').value" [@fade-in-fast]>
<app-form-section-inner [form]="previewForm" [tableView]="form.getRawValue().multiplicity?.tableView" [datasetProfileId]="datasetProfileId">
</app-form-section-inner>
</div>
</div>
<div class="w-100" *ngIf="!firstField?.get('viewStyle').get('renderStyle').value">
<em>
{{'DATASET-PROFILE-EDITOR.ACTIONS.FIELD.NOT-INITIALIZED' | translate}}
</em>
</div>
</div>
<div class="col-12">
<hr *ngIf="hasFocus">
</div>
</div>
<ng-container *ngIf="hasFocus">
<div class="row justify-content-end pt-2" >
<div class="col-auto">
<ul class="list-unstyled list-inline fieldset-actions-list d-flex align-items-center text-primary-blue">
<!-- <li class="list-inline-item" (click)="addNewField()"><mat-icon>folder</mat-icon> <small>Add input</small></li> -->
<li class="list-inline-item" *ngIf="!viewOnly">
<span [matMenuTriggerFor]="inputmenu" class="inputMenuTrigger">
<img src="/assets/images/editor/icons/add_input.svg" style="width: 18px;transform: translateY(-1px);" class="input_icon" alt="'DATASET-PROFILE-EDITOR.ACTIONS.FIELDSET.ADD-INPUT' | translate"/>
<span class="fieldset-new-input-action">{{'DATASET-PROFILE-EDITOR.ACTIONS.FIELDSET.ADD-INPUT' | translate}}</span>
</span>
<!-- <mat-icon [matMenuTriggerFor]="inputmenu" [matTooltip]="'DATASET-PROFILE-EDITOR.ACTIONS.FIELDSET.ADD-INPUT' | translate">folder</mat-icon> -->
<mat-menu #inputmenu="matMenu" [class]="'add_input_menu'">
<!-- <button class="mat-menu-item" (click)="addNewInput(viewTypeEnum.TextArea)">{{enumUtils.toDatasetProfileViewTypeString(viewTypeEnum.TextArea)}}</button>
<button class="mat-menu-item" (click)="addNewInput(viewTypeEnum.FreeText)">{{enumUtils.toDatasetProfileViewTypeString(viewTypeEnum.FreeText)}}</button>
<mat-divider></mat-divider>
<button class="mat-menu-item" (click)="addNewInput(viewTypeEnum.BooleanDecision)">{{enumUtils.toDatasetProfileViewTypeString(viewTypeEnum.BooleanDecision)}}</button>
<button class="mat-menu-item" (click)="addNewInput(viewTypeEnum.RadioBox)">{{enumUtils.toDatasetProfileViewTypeString(viewTypeEnum.RadioBox)}}</button>
<button class="mat-menu-item" (click)="addNewInput(viewTypeEnum.Select)">{{enumUtils.toDatasetProfileViewTypeString(viewTypeEnum.Select)}}</button>
<button class="mat-menu-item" (click)="addNewInput(viewTypeEnum.CheckBox)">{{enumUtils.toDatasetProfileViewTypeString(viewTypeEnum.CheckBox)}}</button>
<mat-divider></mat-divider>
<button class="mat-menu-item" (click)="addNewInput(viewTypeEnum.DatePicker)">{{enumUtils.toDatasetProfileViewTypeString(viewTypeEnum.DatePicker)}}</button>
<button class="mat-menu-item" (click)="addNewInput(viewTypeEnum.Currency)">{{enumUtils.toDatasetProfileViewTypeString(viewTypeEnum.Currency)}}</button>
<mat-divider></mat-divider>
<button class="mat-menu-item" (click)="addNewInput(viewTypeEnum.Registries)">{{enumUtils.toDatasetProfileViewTypeString(viewTypeEnum.Registries)}}</button>
<button class="mat-menu-item" (click)="addNewInput(viewTypeEnum.Services)">{{enumUtils.toDatasetProfileViewTypeString(viewTypeEnum.Services)}}</button>
<button class="mat-menu-item" (click)="addNewInput(viewTypeEnum.Researchers)">{{enumUtils.toDatasetProfileViewTypeString(viewTypeEnum.Researchers)}}</button>
<button class="mat-menu-item" (click)="addNewInput(viewTypeEnum.Organizations)">{{enumUtils.toDatasetProfileViewTypeString(viewTypeEnum.Organizations)}}</button>
<button class="mat-menu-item" (click)="addNewInput(viewTypeEnum.ExternalDatasets)">{{enumUtils.toDatasetProfileViewTypeString(viewTypeEnum.ExternalDatasets)}}</button>
<button class="mat-menu-item" (click)="addNewInput(viewTypeEnum.DataRepositories)">{{enumUtils.toDatasetProfileViewTypeString(viewTypeEnum.DataRepositories)}}</button>
<button class="mat-menu-item" (click)="addNewInput(viewTypeEnum.Other)">{{enumUtils.toDatasetProfileViewTypeString(viewTypeEnum.Other)}}</button>
<mat-divider></mat-divider>
<button class="mat-menu-item" (click)="addNewInput(viewTypeEnum.InternalDmpEntities)">Internal DMPs</button>
<button class="mat-menu-item" (click)="addNewInput(viewTypeEnum.Tags)">Tags</button>
<button class="mat-menu-item" (click)="addNewInput(viewTypeEnum.DatasetIdentifier)">Dataset Identifier</button>
<button class="mat-menu-item" (click)="addNewInput(viewTypeEnum.Validation)">Validation</button>
-->
<mat-action-list>
<button mat-list-item (click)="addNewInput(viewTypeEnum.TextArea)">
<img src="/assets/images/editor/icons/text_area.svg" class="input_icon" alt="Text Area icon">
{{enumUtils.toDatasetProfileViewTypeString(viewTypeEnum.TextArea)}}
</button>
<button mat-list-item (click)="addNewInput(viewTypeEnum.RichTextArea)">
<img src="/assets/images/editor/icons/text_area.svg" class="input_icon" alt="Rich Text Area icon">
{{enumUtils.toDatasetProfileViewTypeString(viewTypeEnum.RichTextArea)}}
</button>
<button mat-list-item (click)="addNewInput(viewTypeEnum.FreeText)">
<img src="/assets/images/editor/icons/free_text.svg" class="input_icon" alt="Free Text icon">
{{enumUtils.toDatasetProfileViewTypeString(viewTypeEnum.FreeText)}}
</button>
<mat-divider></mat-divider>
<button mat-list-item (click)="addNewInput(viewTypeEnum.Upload)">
<!-- <img src="/assets/images/editor/icons/text_area.svg" class="input_icon" alt="Upload icon">-->
<mat-icon class="input_icon" style="font-size: 14px; color: #129d99; display: inline-flex; align-items: center">upload</mat-icon>
{{enumUtils.toDatasetProfileViewTypeString(viewTypeEnum.Upload)}}
</button>
<mat-divider></mat-divider>
<button mat-list-item (click)="addNewInput(viewTypeEnum.BooleanDecision)">
<img src="/assets/images/editor/icons/boolean.svg" class="input_icon" alt="Boolean icon">
{{enumUtils.toDatasetProfileViewTypeString(viewTypeEnum.BooleanDecision)}}
</button>
<button mat-list-item (click)="addNewInput(viewTypeEnum.RadioBox)">
<img src="/assets/images/editor/icons/radio_box.svg" class="input_icon" alt="RadioBox icon">
{{enumUtils.toDatasetProfileViewTypeString(viewTypeEnum.RadioBox)}}
</button>
<button mat-list-item (click)="addNewInput(viewTypeEnum.Select)">
<span class="input_icon">
<img src="/assets/images/editor/icons/select.svg" alt="Select icon">
</span>
{{enumUtils.toDatasetProfileViewTypeString(viewTypeEnum.Select)}}
</button>
<button mat-list-item (click)="addNewInput(viewTypeEnum.CheckBox)">
<img src="/assets/images/editor/icons/checkbox.svg" class="input_icon" alt="CheckBox Icon">
{{enumUtils.toDatasetProfileViewTypeString(viewTypeEnum.CheckBox)}}
</button>
<mat-divider></mat-divider>
<button mat-list-item (click)="addNewInput(viewTypeEnum.DatePicker)">
<img src="/assets/images/editor/icons/date_picker.svg" class="input_icon" alt="DatePicker Icon">
{{enumUtils.toDatasetProfileViewTypeString(viewTypeEnum.DatePicker)}}
</button>
<button mat-list-item (click)="addNewInput(viewTypeEnum.Currency)">
<img src="/assets/images/editor/icons/currency.svg" class="input_icon" alt="Currency Icon">
{{enumUtils.toDatasetProfileViewTypeString(viewTypeEnum.Currency)}}
</button>
<mat-divider></mat-divider>
<button mat-list-item (click)="$event.stopPropagation();" style="font-style: italic;">
<img src="/assets/images/editor/icons/api.svg" class="input_icon" alt="APIs icon">
APIs
</button>
<mat-action-list class="ml-4">
<button mat-list-item (click)="addNewInput(viewTypeEnum.Registries)">
<img src="/assets/images/editor/icons/api_entity.svg" class="input_icon" alt="Registries icon">
{{enumUtils.toDatasetProfileViewTypeString(viewTypeEnum.Registries)}}
</button>
<button mat-list-item (click)="addNewInput(viewTypeEnum.Services)">
<img src="/assets/images/editor/icons/api_entity.svg" class="input_icon" alt="Services icon">
{{enumUtils.toDatasetProfileViewTypeString(viewTypeEnum.Services)}}
</button>
<button mat-list-item (click)="addNewInput(viewTypeEnum.Researchers)">
<img src="/assets/images/editor/icons/api_entity.svg" class="input_icon" alt="Researchers icon">
{{enumUtils.toDatasetProfileViewTypeString(viewTypeEnum.Researchers)}}
</button>
<button mat-list-item (click)="addNewInput(viewTypeEnum.Organizations)">
<img src="/assets/images/editor/icons/api_entity.svg" class="input_icon" alt="Organizations icon">
{{enumUtils.toDatasetProfileViewTypeString(viewTypeEnum.Organizations)}}
</button>
<button mat-list-item (click)="addNewInput(viewTypeEnum.ExternalDatasets)">
<img src="/assets/images/editor/icons/api_entity.svg" class="input_icon" alt="External Datasets icon">
{{enumUtils.toDatasetProfileViewTypeString(viewTypeEnum.ExternalDatasets)}}
</button>
<button mat-list-item (click)="addNewInput(viewTypeEnum.DataRepositories)">
<img src="/assets/images/editor/icons/api_entity.svg" class="input_icon" alt="DataRepositories icon">
{{enumUtils.toDatasetProfileViewTypeString(viewTypeEnum.DataRepositories)}}
</button>
<button mat-list-item (click)="addNewInput(viewTypeEnum.PubRepositories)">
<img src="/assets/images/editor/icons/api_entity.svg" class="input_icon" alt="PubRepositories icon">
{{enumUtils.toDatasetProfileViewTypeString(viewTypeEnum.PubRepositories)}}
</button>
<button mat-list-item (click)="addNewInput(viewTypeEnum.JournalRepositories)">
<img src="/assets/images/editor/icons/api_entity.svg" class="input_icon" alt="JournalRepositories icon">
{{enumUtils.toDatasetProfileViewTypeString(viewTypeEnum.JournalRepositories)}}
</button>
<button mat-list-item (click)="addNewInput(viewTypeEnum.Taxonomies)">
<img src="/assets/images/editor/icons/api_entity.svg" class="input_icon" alt="Taxonomies icon">
{{enumUtils.toDatasetProfileViewTypeString(viewTypeEnum.Taxonomies)}}
</button>
<button mat-list-item (click)="addNewInput(viewTypeEnum.Licenses)">
<img src="/assets/images/editor/icons/api_entity.svg" class="input_icon" alt="Licenses icon">
{{enumUtils.toDatasetProfileViewTypeString(viewTypeEnum.Licenses)}}
</button>
<button mat-list-item (click)="addNewInput(viewTypeEnum.Publications)">
<img src="/assets/images/editor/icons/api_entity.svg" class="input_icon" alt="Publications icon">
{{enumUtils.toDatasetProfileViewTypeString(viewTypeEnum.Publications)}}
</button>
<button mat-list-item (click)="addNewInput(viewTypeEnum.Other)">
<img src="/assets/images/editor/icons/api_entity.svg" class="input_icon" alt="Other icon">
{{enumUtils.toDatasetProfileViewTypeString(viewTypeEnum.Other)}}
</button>
</mat-action-list>
<mat-divider></mat-divider>
<button mat-list-item (click)="$event.stopPropagation();" style="font-style: italic;">
<img src="/assets/images/editor/icons/argos_entities.svg" class="input_icon" alt="Argos Entities icon">
Argos Entities
</button>
<mat-action-list class="ml-4">
<button mat-list-item (click)="addNewInput(viewTypeEnum.InternalDmpEntities)">
<img src="/assets/images/editor/icons/api_entity.svg" class="input_icon" alt="Internal Dmp icon">
{{enumUtils.toDatasetProfileViewTypeString(viewTypeEnum.InternalDmpEntities)}}
</button>
<button mat-list-item (click)="addNewInput(viewTypeEnum.Tags)">
<img src="/assets/images/editor/icons/api_entity.svg" class="input_icon" alt="Tags icon">
{{enumUtils.toDatasetProfileViewTypeString(viewTypeEnum.Tags)}}
</button>
<button mat-list-item (click)="addNewInput(viewTypeEnum.DatasetIdentifier)">
<img src="/assets/images/editor/icons/api_entity.svg" class="input_icon" alt="Datset Identifier icon">
{{enumUtils.toDatasetProfileViewTypeString(viewTypeEnum.DatasetIdentifier)}}
</button>
<button mat-list-item (click)="addNewInput(viewTypeEnum.Validation)">
<img src="/assets/images/editor/icons/api_entity.svg" class="input_icon" alt="Validation icon">
{{enumUtils.toDatasetProfileViewTypeString(viewTypeEnum.Validation)}}
</button>
</mat-action-list>
</mat-action-list>
</mat-menu>
</li>
<!-- <li class="list-inline-item"><mat-icon>folder</mat-icon><small>CommentField</small></li> -->
<li class="list-inline-item">
<mat-checkbox class="fieldset-checkbox-action-dataset-profile-editor" [formControl]="this.form.get('hasCommentField')" [matTooltip]="'DATASET-PROFILE-EDITOR.ACTIONS.FIELDSET.INCLUDE-COMMENT-FIELD' | translate">{{'DATASET-PROFILE-EDITOR.ACTIONS.FIELDSET.COMMENT-FIELD' | translate}}</mat-checkbox>
</li>
<li class="list-inline-item">
<mat-checkbox class="fieldset-checkbox-action-dataset-profile-editor" [(checked)]="isMultiplicityEnabled" (change)="onIsMultiplicityEnabledChange($event)" [matTooltip]="'DATASET-PROFILE-EDITOR.ACTIONS.FIELDSET.ENABLE-MULTIPLICITY' | translate" [disabled]="viewOnly">
{{'DATASET-PROFILE-EDITOR.ACTIONS.FIELDSET.MULTIPLICITY' | translate}}
</mat-checkbox>
</li>
<li class="list-inline-item">
<!-- <mat-icon>more_vert</mat-icon> -->
<mat-icon [matMenuTriggerFor]="menu" [matTooltip]="'DATASET-PROFILE-EDITOR.ACTIONS.FIELDSET.MORE' | translate" style="transform: translateY(-1px);">more_vert</mat-icon>
<mat-menu #menu="matMenu">
<!-- TODO to check -->
<mat-checkbox class="mat-menu-item" (click)="$event.stopPropagation()" [(ngModel)]="showDescription">{{'DATASET-PROFILE-EDITOR.STEPS.FORM.COMPOSITE-FIELD.FIELDS.DESCRIPTION' | translate}}</mat-checkbox>
<mat-checkbox class="mat-menu-item" (click)="$event.stopPropagation()" [(ngModel)]="showExtendedDescription">{{'DATASET-PROFILE-EDITOR.STEPS.FORM.COMPOSITE-FIELD.FIELDS.EXTENDED-DESCRIPTION' | translate}}</mat-checkbox>
<mat-checkbox class="mat-menu-item" (click)="$event.stopPropagation()" [(ngModel)]="showAdditionalInfo">{{'DATASET-PROFILE-EDITOR.STEPS.FORM.COMPOSITE-FIELD.FIELDS.ADDITIONAL-INFORMATION' | translate}}</mat-checkbox>
</mat-menu>
</li>
</ul>
</div>
</div>
</ng-container>
</div>
<!--
<span>Preview</span>
<app-form-composite-field [form]="previewForm" *ngIf="previewForm">
</app-form-composite-field> -->
<!--
Current FORM: {{this.form.value |json}}
<br>
Target: {{this.targetField?.value |json}} -->
<!--
<button (click)="generatePreview()">Generate preview</button>
-->

View File

@ -1,146 +0,0 @@
.full-width{
width: 100%;
}
.deleteBtn{
margin-right:0.7em;
}
.titleStile{
font-weight: bold;
}
//REFACTOR SECTION
//Palete
$blue-color : var(--primary-color);
$blue-color-light: #5cf7f2;
.actions-list{
border-radius: 7px;
box-shadow: 0 1px 0.8em $blue-color;
padding: 1em 0em;
font-size: small;
}
.field-container{
box-shadow: 0px 1px 2px rgb(173, 173, 173) ;
padding: 3em;
border-radius: .3em;
// border-left: 0.3em solid yellow;
padding-bottom: 2em;
margin-bottom: 2em;
}
.field-container-active{
box-shadow: 0px 1px 2px rgb(173, 173, 173) ;
padding: 3em;
border-radius: .3em;
border-left: 0.3em solid $blue-color;
padding-bottom: 2em;
margin-bottom: 2em;
}
.field-id-container{
background-color: $blue-color-light;
position: absolute;
right: 0;
top: 0;
padding: .6em 1.2em;
overflow: visible;
.field-id-container-icon{
position: absolute;
top: -50%;
}
}
.main-content-page{
padding: 0em 1.5em;
}
.fielset-header{
font-size: 1.5em;
font-weight: bold;
// .numbering{
// padding: 0.5em 0em;
// }
}
.fieldset-actions-list{
margin: 0;
cursor: pointer;
}
// ::ng-deep .main-content-page .fieldset-header .field-title .mat-form-field-infix{
// border-top: 0px;
// }
.numbering-label .mat-input-element:disabled{
color: #212121;
}
:host ::ng-deep .fieldset-checkbox-action-dataset-profile-editor
{
.mat-checkbox-label{
font-size: 0.8em;
color: #212121;
transform: translateY(3px);
}
.mat-checkbox-frame{
border: 1px solid $blue-color ;
}
}
.fieldset-new-input-action {
font-size: 0.8em;
font-weight: 400;
color: #212121;
display: inline-block;
transform: translateY(1px);
}
.inputMenuTrigger {
margin-bottom: 0.3rem;
display: inline-block;
}
.previewer{
background-color: #129d9811;
padding: 2em;
border: 1px solid #70707015;
border-radius: 4px;
}
.input_icon{
width: 14px;
margin-right: 0.5em;
// display: flex;
// align-items: center;
}
::ng-deep .mat-menu-panel{
max-height: 32em;
}
:host ::ng-deep .fielset-header .mat-form-field-wrapper{
padding-bottom: 0px;
}
.previewer-text{
font-weight: bold;
font-style: italic;
}
.field-input {
position: relative;
}
.field-input .arrows {
position: absolute;
top: 0;
left: 50%;
transform: translateX(-50%);
}

View File

@ -1,97 +0,0 @@
<div class="row">
<!-- BooleanDecision -->
<mat-form-field class="col-md-12" *ngIf="viewStyle === viewStyleEnum.BooleanDecision">
<mat-label>{{placeHolder}}</mat-label>
<mat-select [formControl]="form" [placeholder]="placeHolder">
<mat-option [value]="null">{{'DATASET-PROFILE-EDITOR.STEPS.FORM.FIELD.DEFAULT-VALUES.NONE' |
translate}}</mat-option>
<mat-option [value]="'true'">{{'DATASET-PROFILE-EDITOR.STEPS.FORM.FIELD.DEFAULT-VALUES.BOOLEAN-DECISION.YES'
|
translate}}</mat-option>
<mat-option [value]="'false'">{{'DATASET-PROFILE-EDITOR.STEPS.FORM.FIELD.DEFAULT-VALUES.BOOLEAN-DECISION.NO'
|
translate}}</mat-option>
</mat-select>
<mat-error *ngIf="form.hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
</mat-form-field>
<!-- CheckBox -->
<mat-form-field class="col-md-12" *ngIf="viewStyle === viewStyleEnum.CheckBox">
<mat-label>{{placeHolder}}</mat-label>
<mat-select [formControl]="form" [placeholder]="placeHolder" >
<mat-option [value]="'true'">{{'DATASET-PROFILE-EDITOR.STEPS.FORM.FIELD.DEFAULT-VALUES.CHECK-BOX.CHECKED' | translate}}</mat-option>
<mat-option [value]="'false'">{{'DATASET-PROFILE-EDITOR.STEPS.FORM.FIELD.DEFAULT-VALUES.CHECK-BOX.UNCHECKED' | translate}}</mat-option>
</mat-select>
<mat-error *ngIf="form.hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
</mat-form-field>
<!-- ComboBox -->
<!-- <mat-form-field class="col-md-12" *ngIf="viewStyle === viewStyleEnum.ComboBox && comboBoxType === comboBoxTypeEnum.Autocomplete">
<mat-label>{{placeHolder}}</mat-label>
<input matInput type="text" [placeholder]="placeHolder" [formControl]="form" [required]="required">
</mat-form-field> -->
<mat-form-field class="col-md-12" *ngIf="viewStyle === viewStyleEnum.ComboBox && comboBoxType === comboBoxTypeEnum.WordList">
<mat-label>{{placeHolder}}</mat-label>
<mat-select [formControl]="form" [placeholder]="placeHolder" >
<mat-option [value]="null">{{'DATASET-PROFILE-EDITOR.STEPS.FORM.FIELD.DEFAULT-VALUES.NONE' | translate }}</mat-option>
<mat-option *ngFor="let opt of formArrayOptions['controls']" [value]="opt.get('value').value">{{opt.get('label').value}}</mat-option>
</mat-select>
<mat-error *ngIf="form.hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
</mat-form-field>
<!-- InternalDmpEntities -->
<!-- <mat-form-field class="col-md-12" *ngIf="viewStyle === viewStyleEnum.InternalDmpEntities && internalDmpEntitiesType === internalDmpEntitiesTypeEnum.Researchers">
<mat-label>{{placeHolder}}</mat-label>
<input matInput type="text" [placeholder]="placeHolder" [formControl]="form" [required]="required">
</mat-form-field>
<mat-form-field class="col-md-12" *ngIf="viewStyle === viewStyleEnum.InternalDmpEntities && internalDmpEntitiesType === internalDmpEntitiesTypeEnum.Datasets">
<mat-label>{{placeHolder}}</mat-label>
<input matInput type="text" [placeholder]="placeHolder" [formControl]="form" [required]="required">
</mat-form-field>
<mat-form-field class="col-md-12" *ngIf="viewStyle === viewStyleEnum.InternalDmpEntities && internalDmpEntitiesType === internalDmpEntitiesTypeEnum.Dmps">
<mat-label>{{placeHolder}}</mat-label>
<input matInput type="text" [placeholder]="placeHolder" [formControl]="form" [required]="required">
</mat-form-field> -->
<!-- FreeText -->
<mat-form-field class="col-md-12" *ngIf="viewStyle === viewStyleEnum.FreeText">
<mat-label>{{placeHolder}}</mat-label>
<input matInput type="text" [placeholder]="placeHolder" [formControl]="form" >
<mat-error *ngIf="form.hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
</mat-form-field>
<!-- RadioBox -->
<mat-form-field class="col-md-12" *ngIf="viewStyle === viewStyleEnum.RadioBox">
<mat-label>{{placeHolder}}</mat-label>
<mat-select [formControl]="form" [placeholder]="placeHolder" >
<mat-option [value]="null">{{'DATASET-PROFILE-EDITOR.STEPS.FORM.FIELD.DEFAULT-VALUES.NONE' | translate}}</mat-option>
<mat-option *ngFor="let opt of formArrayOptions['controls']" [value]="opt.get('value').value">{{opt.get('label').value}}</mat-option>
</mat-select>
<mat-error *ngIf="form.hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
</mat-form-field>
<!-- TextArea -->
<mat-form-field class="col-md-12" *ngIf="viewStyle === viewStyleEnum.TextArea">
<mat-label>{{placeHolder}}</mat-label>
<input matInput type="text" [placeholder]="placeHolder" [formControl]="form">
<mat-error *ngIf="form.hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
</mat-form-field>
<!-- RichTextArea -->
<mat-form-field class="col-md-12" *ngIf="viewStyle === viewStyleEnum.RichTextArea">
<mat-label>{{placeHolder}}</mat-label>
<input matInput type="text" [placeholder]="placeHolder" [formControl]="form">
<mat-error *ngIf="form.hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
</mat-form-field>
<!-- DatePicker -->
<mat-form-field class="col-12" *ngIf="viewStyle === viewStyleEnum.DatePicker">
<!--(focus)="date.open()" (click)="date.open()"-->
<mat-label>{{placeHolder}}</mat-label>
<input matInput [placeholder]="placeHolder" class="table-input" [matDatepicker]="date" [formControl]="form" >
<mat-datepicker-toggle matSuffix [for]="date"></mat-datepicker-toggle>
<mat-datepicker #date></mat-datepicker>
<mat-error *ngIf="form.hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}
</mat-error>
</mat-form-field>
</div>

View File

@ -1,31 +0,0 @@
import { Component, Input, OnInit } from '@angular/core';
import { UntypedFormArray, UntypedFormControl } from '@angular/forms';
import { DatasetProfileComboBoxType } from '../../../../../../core/common/enum/dataset-profile-combo-box-type';
import { DatasetProfileFieldViewStyle } from '../../../../../../core/common/enum/dataset-profile-field-view-style';
import { DatasetProfileInternalDmpEntitiesType } from '../../../../../../core/common/enum/dataset-profile-internal-dmp-entities-type';
@Component({
selector: 'app-component-profile-editor-default-value-component',
templateUrl: './component-profile-editor-default-value.component.html',
styleUrls: ['./component-profile-editor-default-value.component.scss']
})
export class DatasetProfileEditorDefaultValueComponent implements OnInit {
@Input() viewStyle: DatasetProfileFieldViewStyle;
@Input() form: UntypedFormControl;
@Input() formArrayOptions: UntypedFormArray;
@Input() comboBoxType: DatasetProfileComboBoxType;
@Input() internalDmpEntitiesType: DatasetProfileInternalDmpEntitiesType;
@Input() placeHolder: String;
// @Input() required: Boolean;
comboBoxTypeEnum = DatasetProfileComboBoxType;
internalDmpEntitiesTypeEnum = DatasetProfileInternalDmpEntitiesType;
viewStyleEnum = DatasetProfileFieldViewStyle;
constructor() { }
ngOnInit() {
}
}

View File

@ -1,112 +0,0 @@
<div class="row" *ngIf="form.get('data')">
<h5 style="font-weight: bold" class="col-auto">{{'DATASET-PROFILE-EDITOR.STEPS.FORM.FIELD.FIELDS.FIELD-AUTOCOMPLETE-TITLE' | translate}}</h5>
<mat-checkbox class="col-auto" [formControl]="this.form.get('data').get('multiAutoComplete')">
{{'DATASET-PROFILE-EDITOR.STEPS.FORM.FIELD.FIELDS.FIELD-MULTIPLE-AUTOCOMPLETE' | translate}}
</mat-checkbox>
<mat-form-field class="col-12">
<mat-label>{{'DATASET-PROFILE-EDITOR.STEPS.FORM.FIELD.FIELDS.FIELD-AUTOCOMPLETE-PLACEHOLDER' | translate}}</mat-label>
<input matInput type="string"
[formControl]="form.get('data').get('label')">
</mat-form-field>
<h6 class="col-12" style="font-weight: bold">{{'DATASET-PROFILE-EDITOR.STEPS.FORM.FIELD.FIELDS.FIELD-AUTOCOMPLETE-SOURCE-TITLE' | translate}}</h6>
<div class="col-12 d-flex align-items-center" style="margin-bottom: 1em;">
<button mat-raised-button
type="button"
(click)="addSource()"
style="margin-right: 2em;"
>
<!-- [ngClass]="{'text-danger':form.get('data').errors?.emptyArray && form.touched}" -->
{{'DATASET-PROFILE-EDITOR.STEPS.FORM.FIELD.FIELDS.FIELD-AUTOCOMPLETE-ADD_SOURCE' | translate}}
</button>
<!-- *ngIf="form.get('data').errors?.emptyArray && form.get('data').touched" -->
<div class="d-flex" *ngIf="form.get('data').errors?.emptyArray && form.get('data').touched">
<mat-icon
class="text-danger"
matTooltip="At least one source must be provided."
>warning_amber</mat-icon>
<small class="text-danger">{{'DATASET-PROFILE-EDITOR.STEPS.FORM.FIELD.ERROR-MESSAGES.FIELD-OTHER-SOURCES-REQUIRED'| translate}}</small>
</div>
</div>
</div>
<div *ngFor="let singleForm of multiForm.controls; let i = index" class="row">
<!-- <mat-form-field class="col-12">
<mat-label>{{'DATASET-PROFILE-EDITOR.STEPS.FORM.FIELD.FIELDS.FIELD-AUTOCOMPLETE-TYPE' | translate}}</mat-label>
<mat-select [formControl]="singleForm.get('autoCompleteType')">
<mat-option [value]="0">{{'DATASET-PROFILE-EDITOR.STEPS.FORM.FIELD.FIELDS.FIELD-AUTOCOMPLETE-TYPE-UNCACHED' | translate}}</mat-option>
<mat-option [value]="1">{{'DATASET-PROFILE-EDITOR.STEPS.FORM.FIELD.FIELDS.FIELD-AUTOCOMPLETE-TYPE-CACHED' | translate}}</mat-option>
</mat-select>
</mat-form-field> -->
<mat-form-field class="col-md-6">
<mat-label>{{'DATASET-PROFILE-EDITOR.STEPS.FORM.FIELD.FIELDS.FIELD-AUTOCOMPLETE-AUTH-METHOD' | translate}}</mat-label>
<mat-select [formControl]="singleForm.get('method')">
<mat-option *ngFor="let method of htmlMethods | keyvalue" [value]="method.value">{{method.value}}</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field class="col-md-6">
<mat-label>{{'DATASET-PROFILE-EDITOR.STEPS.FORM.FIELD.FIELDS.FIELD-AUTOCOMPLETE-URL' | translate}}</mat-label>
<input matInput [formControl]="singleForm.get('url')">
<mat-error *ngIf="singleForm.get('url').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
</mat-form-field>
<mat-form-field class="col-md-3">
<mat-label>{{'DATASET-PROFILE-EDITOR.STEPS.FORM.FIELD.FIELDS.FIELD-AUTOCOMPLETE-OPTIONS-ROOT' | translate}}</mat-label>
<input matInput
[formControl]="singleForm.get('optionsRoot')">
<mat-error *ngIf="singleForm.get('optionsRoot').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
</mat-form-field>
<mat-form-field class="col-md-3">
<mat-label>{{'DATASET-PROFILE-EDITOR.STEPS.FORM.FIELD.FIELDS.FIELD-AUTOCOMPLETE-LABEL' | translate}}</mat-label>
<input matInput [formControl]="singleForm.get('autoCompleteOptions').get('label')">
<mat-error *ngIf="singleForm.get('autoCompleteOptions').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
</mat-form-field>
<mat-form-field class="col-md-3">
<mat-label>{{'DATASET-PROFILE-EDITOR.STEPS.FORM.FIELD.FIELDS.FIELD-AUTOCOMPLETE-VALUE' | translate}}</mat-label>
<input matInput [formControl]="singleForm.get('autoCompleteOptions').get('value')">
</mat-form-field>
<mat-form-field class="col-md-3">
<mat-label>{{'DATASET-PROFILE-EDITOR.STEPS.FORM.FIELD.FIELDS.FIELD-AUTOCOMPLETE-SOURCE' | translate}}</mat-label>
<input matInput [formControl]="singleForm.get('autoCompleteOptions').get('source')">
<mat-error *ngIf="singleForm.get('autoCompleteOptions').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
</mat-form-field>
<mat-checkbox class="col-12" [formControl]="singleForm.get('hasAuth')">{{'DATASET-PROFILE-EDITOR.STEPS.FORM.FIELD.FIELDS.FIELD-AUTOCOMPLETE-HAS-AUTH' | translate}}</mat-checkbox>
<div *ngIf="singleForm.get('hasAuth').value === true" class="col-12">
<mat-form-field class="col-md-6">
<mat-label>{{'DATASET-PROFILE-EDITOR.STEPS.FORM.FIELD.FIELDS.FIELD-AUTOCOMPLETE-AUTH-METHOD' | translate}}</mat-label>
<mat-select [formControl]="singleForm.get('auth').get('method')">
<mat-option *ngFor="let method of htmlMethods | keyvalue" [value]="method.value">{{method.value}}</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field class="col-md-6">
<mat-label>{{'DATASET-PROFILE-EDITOR.STEPS.FORM.FIELD.FIELDS.FIELD-AUTOCOMPLETE-URL' | translate}}</mat-label>
<input matInput [formControl]="singleForm.get('auth').get('url')">
<mat-error *ngIf="singleForm.get('auth').get('url').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
</mat-form-field>
<mat-form-field class="col-md-6">
<mat-label>{{'DATASET-PROFILE-EDITOR.STEPS.FORM.FIELD.FIELDS.FIELD-AUTOCOMPLETE-AUTH-TYPE' | translate}}</mat-label>
<mat-select [formControl]="singleForm.get('auth').get('type')">
<mat-option *ngFor="let type of authTypes | keyvalue" [value]="type.value">{{type.value}}</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field class="col-md-6">
<mat-label>{{'DATASET-PROFILE-EDITOR.STEPS.FORM.FIELD.FIELDS.FIELD-AUTOCOMPLETE-OPTIONS-ROOT' | translate}}</mat-label>
<input matInput [formControl]="singleForm.get('auth').get('path')">
<mat-error *ngIf="singleForm.get('auth').get('path').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
</mat-form-field>
<mat-form-field class="col-md-12">
<mat-label>{{'DATASET-PROFILE-EDITOR.STEPS.FORM.FIELD.FIELDS.FIELD-AUTOCOMPLETE-AUTH-BODY' | translate}}</mat-label>
<textarea matInput [formControl]="singleForm.get('auth').get('body')"></textarea>
<mat-error *ngIf="singleForm.get('auth').get('body').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
</mat-form-field>
</div>
<button mat-button type="button" (click)="removeSource(i)"><mat-icon>delete</mat-icon></button>
</div>

View File

@ -1,35 +0,0 @@
import { Component, Input, OnInit } from '@angular/core';
import { UntypedFormGroup, UntypedFormArray, AbstractControl } from '@angular/forms';
import { DatasetProfileComboBoxType } from '../../../../../../../core/common/enum/dataset-profile-combo-box-type';
import { AutoCompleteFieldDataEditorModel } from '../../../../admin/field-data/auto-complete-field-data-editor-model';
import { AutoCompleteSingleDataEditorModel } from '@app/ui/admin/dataset-profile/admin/field-data/auto-complete-single-data';
// import { HtmlMethod } from '@app/core/model/dataset-profile-definition/html-method.enum';
// import { AuthType } from '@app/core/model/dataset-profile-definition/auth-type.enum';
@Component({
selector: 'app-dataset-profile-editor-auto-complete-field-component',
styleUrls: ['./dataset-profile-editor-auto-complete-field.component.scss'],
templateUrl: './dataset-profile-editor-auto-complete-field.component.html'
})
export class DatasetProfileEditorAutoCompleteFieldComponent implements OnInit {
// public htmlMethods = HtmlMethod;
// public authTypes = AuthType;
@Input() form: UntypedFormGroup;
private data: AutoCompleteFieldDataEditorModel = new AutoCompleteFieldDataEditorModel();
multiForm: UntypedFormArray;
ngOnInit() {
this.multiForm = (<UntypedFormArray>this.form.get('data').get('autoCompleteSingleDataList'));
this.data.type = DatasetProfileComboBoxType.Autocomplete;
}
addSource() {
(<UntypedFormArray>this.multiForm).push(new AutoCompleteSingleDataEditorModel().buildForm());
}
removeSource(index: number) {
(<UntypedFormArray>this.multiForm).removeAt(index);
}
}

View File

@ -1,9 +0,0 @@
<!-- <div class="row" *ngIf="form.get('data')">
<h5 style="font-weight: bold" class="col-12">{{'DATASET-PROFILE-EDITOR.STEPS.FORM.FIELD.FIELDS.FIELD-BOOLEAN-DECISION-TITLE' | translate}}</h5>
<mat-form-field class="col-12">
<mat-label>{{'DATASET-PROFILE-EDITOR.STEPS.FORM.FIELD.FIELDS.FIELD-BOOLEAN-DECISION-PLACEHOLDER' | translate}}</mat-label>
<input matInput type="string" [formControl]="form.get('data').get('label')">
</mat-form-field>
</div> -->

View File

@ -1,19 +0,0 @@
import { Component, Input, OnInit } from '@angular/core';
import { UntypedFormGroup } from '@angular/forms';
import { BooleanDecisionFieldDataEditorModel } from '../../../../admin/field-data/boolean-decision-field-data-editor-model';
@Component({
selector: 'app-dataset-profile-editor-boolean-decision-field-component',
styleUrls: ['./dataset-profile-editor-boolean-decision-field.component.scss'],
templateUrl: './dataset-profile-editor-boolean-decision-field.component.html'
})
export class DatasetProfileEditorBooleanDecisionFieldComponent implements OnInit {
@Input() form: UntypedFormGroup;
private data: BooleanDecisionFieldDataEditorModel = new BooleanDecisionFieldDataEditorModel();
ngOnInit() {
if (!this.form.get('data')) { this.form.addControl('data', this.data.buildForm()); }
}
}

View File

@ -1,9 +0,0 @@
<div class="row" *ngIf="form.get('data')">
<h5 style="font-weight: bold" class="col-12">{{'DATASET-PROFILE-EDITOR.STEPS.FORM.FIELD.FIELDS.FIELD-CHECKBOX-TITLE' | translate}}</h5>
<mat-form-field class="col-12">
<mat-label>{{'DATASET-PROFILE-EDITOR.STEPS.FORM.FIELD.FIELDS.FIELD-CHECKBOX-PLACEHOLDER' | translate}}</mat-label>
<input matInput type="string" [formControl]="form.get('data').get('label')">
</mat-form-field>
</div>

View File

@ -1,18 +0,0 @@
import { Component, Input, OnInit } from '@angular/core';
import { UntypedFormGroup } from '@angular/forms';
import { CheckBoxFieldDataEditorModel } from '../../../../admin/field-data/check-box-field-data-editor-model';
@Component({
selector: 'app-dataset-profile-editor-checkbox-field-component',
styleUrls: ['./dataset-profile-editor-checkbox-field.component.scss'],
templateUrl: './dataset-profile-editor-checkbox-field.component.html'
})
export class DatasetProfileEditorCheckboxFieldComponent implements OnInit {
@Input() form: UntypedFormGroup;
private data: CheckBoxFieldDataEditorModel = new CheckBoxFieldDataEditorModel();
ngOnInit() {
if (!this.form.get('data')) { this.form.addControl('data', this.data.buildForm()); }
}
}

View File

@ -1,10 +0,0 @@
<div class="row">
<!-- <mat-form-field class="col-12">
<mat-select placeholder="{{'DATASET-PROFILE-EDITOR.STEPS.FORM.FIELD.FIELDS.FIELD-COMBO-BOX-TYPE' | translate}}" [formControl]="this.form.get('data').get('type')">
<mat-option [value]="options.Autocomplete">{{enumUtils.toDatasetProfileComboBoxTypeString(options.Autocomplete)}}</mat-option>
<mat-option [value]="options.WordList">{{enumUtils.toDatasetProfileComboBoxTypeString(options.WordList)}}</mat-option>
</mat-select>
</mat-form-field> -->
<app-dataset-profile-editor-auto-complete-field-component *ngIf="this.form.get('data').get('type').value === options.Autocomplete" class="col-12" [form]="form"></app-dataset-profile-editor-auto-complete-field-component>
<app-dataset-profile-editor-word-list-field-component *ngIf="this.form.get('data').get('type').value === options.WordList" class="col-12" [form]="form"></app-dataset-profile-editor-word-list-field-component>
</div>

Some files were not shown because too many files have changed in this diff Show More