diff --git a/client/src/app/admin/instance/components/instance-form.component.html b/client/src/app/admin/instance/components/instance-form.component.html index 06f689f946492894913aa41a959a7e8915910dda..531367d983834932b80a5f0aba596ae582197c62 100644 --- a/client/src/app/admin/instance/components/instance-form.component.html +++ b/client/src/app/admin/instance/components/instance-form.component.html @@ -13,6 +13,18 @@ <label for="description">Description</label> <textarea class="form-control" rows="5" id="description" name="description" formControlName="description"></textarea> </div> + <div class="form-group"> + <label for="scientific_manager">Scientific manager</label> + <input type="text" class="form-control" id="scientific_manager" name="scientific_manager" formControlName="scientific_manager"> + </div> + <div class="form-group"> + <label for="instrument">Instrument</label> + <input type="text" class="form-control" id="instrument" name="instrument" formControlName="instrument"> + </div> + <div class="form-group"> + <label for="wavelength_domain">Wavelength domain</label> + <input type="text" class="form-control" id="wavelength_domain" name="wavelength_domain" formControlName="wavelength_domain"> + </div> <div class="form-group"> <label for="display">Display</label> <input type="number" class="form-control" id="display" name="display" formControlName="display"> diff --git a/client/src/app/admin/instance/components/instance-form.component.ts b/client/src/app/admin/instance/components/instance-form.component.ts index 7ee22005564c21e61fd1a93c02d2256a5f93d7a3..818d27068334f5ac842d1913780cbad8fc896c22 100644 --- a/client/src/app/admin/instance/components/instance-form.component.ts +++ b/client/src/app/admin/instance/components/instance-form.component.ts @@ -29,6 +29,9 @@ export class InstanceFormComponent implements OnInit { name: new FormControl('', [Validators.required]), label: new FormControl('', [Validators.required]), description: new FormControl('', [Validators.required]), + scientific_manager: new FormControl('', [Validators.required]), + instrument: new FormControl('', [Validators.required]), + wavelength_domain: new FormControl('', [Validators.required]), display: new FormControl('', [Validators.required]), data_path: new FormControl(''), files_path: new FormControl(''), diff --git a/client/src/app/metamodel/models/instance.model.ts b/client/src/app/metamodel/models/instance.model.ts index 0ac2e840a37362025eb10a1ea15dba77d2f9829a..7ac7685cb3968e3701df4e94bcbc8bd26aebfbde 100644 --- a/client/src/app/metamodel/models/instance.model.ts +++ b/client/src/app/metamodel/models/instance.model.ts @@ -16,6 +16,9 @@ export interface Instance { name: string; label: string; description: string; + scientific_manager: string; + instrument: string; + wavelength_domain: string; display: number; data_path: string; portal_logo: string; diff --git a/client/src/app/portal/components/instance-card.component.html b/client/src/app/portal/components/instance-card.component.html index 67b3233d17a5be57497cab1ec7ab0f91510e2b61..53869a04afb0692a086faa9ca3f8badb7cca6e11 100644 --- a/client/src/app/portal/components/instance-card.component.html +++ b/client/src/app/portal/components/instance-card.component.html @@ -3,7 +3,23 @@ <div *ngIf="!instance.portal_logo" class="card-header card-instance-letter" [ngStyle]="{'background-color': instance.design_color }">{{ instance.label[0] }}</div> <div class="card-body card-instance-body"> <h5 class="card-title">{{ instance.label }}</h5> - <p class="card-text">{{ instance.description }}</p> + <p> + <small class="text-muted"> + <span class="font-weight-bold">Scientist manager:</span> {{ instance.scientific_manager }} + </small> + <br> + <small class="text-muted"> + <span class="font-weight-bold">Instrument:</span> {{ instance.instrument }} + </small> + <br> + <small class="text-muted"> + <span class="font-weight-bold">Wavelength domain:</span> {{ instance.wavelength_domain }} + </small> + <br> + <small class="text-muted"> + <span class="font-weight-bold">Description:</span> {{ instance.description }} + </small> + </p> </div> <div class="card-footer bg-transparent text-right"> <a routerLink="/instance/{{ instance.name }}" class="btn btn-outline-primary" title="Go to instance"> diff --git a/conf-dev/create-db.sh b/conf-dev/create-db.sh index f46d5c55d8b9e01e66755d93d2f413031935e95b..8621cf0b986a4c0ee4d814d82409557205f601ca 100644 --- a/conf-dev/create-db.sh +++ b/conf-dev/create-db.sh @@ -49,7 +49,7 @@ curl -d '{"label":"Spectra graph","value":"spectra_graph","display":20,"select_n curl -d '{"label":"Test","dbname":"anis_test","dbtype":"pdo_pgsql","dbhost":"db","dbport":5432,"dblogin":"anis","dbpassword":"anis"}' --header 'Content-Type: application/json' -X POST http://localhost/database # Add default instance -curl -d '{"name":"default","label":"Default instance","description":"Instance for the test","display":10,"data_path":"\/DEFAULT","files_path":"\/INSTANCE_FILES","public":true,"portal_logo":"","design_color":"#7AC29A","design_background_color":"#ffffff","design_logo":"/logo.png","design_favicon":"/favicon.ico","home_component":"WelcomeComponent","home_component_config":{"home_component_text":"AstroNomical Information System","home_component_logo":"/home_component_logo.png"},"samp_enabled":true,"back_to_portal":true,"search_by_criteria_allowed":true,"search_by_criteria_label":"Search","search_multiple_allowed":false,"search_multiple_label":"Search multiple","search_multiple_all_datasets_selected":false,"documentation_allowed":false,"documentation_label":"Documentation"}' --header 'Content-Type: application/json' -X POST http://localhost/instance +curl -d '{"name":"default","label":"Default instance","description":"Instance for the test","scientific_manager":"M. Durand","instrument":"Multiple","wavelength_domain":"Visible imaging / Spectroscopy","display":10,"data_path":"\/DEFAULT","files_path":"\/INSTANCE_FILES","public":true,"portal_logo":"","design_color":"#7AC29A","design_background_color":"#ffffff","design_logo":"/logo.png","design_favicon":"/favicon.ico","home_component":"WelcomeComponent","home_component_config":{"home_component_text":"AstroNomical Information System","home_component_logo":"/home_component_logo.png"},"samp_enabled":true,"back_to_portal":true,"search_by_criteria_allowed":true,"search_by_criteria_label":"Search","search_multiple_allowed":false,"search_multiple_label":"Search multiple","search_multiple_all_datasets_selected":false,"documentation_allowed":false,"documentation_label":"Documentation"}' --header 'Content-Type: application/json' -X POST http://localhost/instance # Add dataset families curl -d '{"label":"Default dataset family","display":10,"opened":true}' --header 'Content-Type: application/json' -X POST http://localhost/instance/default/dataset-family diff --git a/server/doctrine-proxy/__CG__AppEntityInstance.php b/server/doctrine-proxy/__CG__AppEntityInstance.php index ed87c9138c09d718b5527218db49e1e630a4288b..bd2aab261cf8de6bbff87ff7ca87acc15770cc14 100644 --- a/server/doctrine-proxy/__CG__AppEntityInstance.php +++ b/server/doctrine-proxy/__CG__AppEntityInstance.php @@ -67,10 +67,10 @@ class Instance extends \App\Entity\Instance implements \Doctrine\ORM\Proxy\Proxy public function __sleep() { if ($this->__isInitialized__) { - return ['__isInitialized__', 'name', 'label', 'description', 'display', 'dataPath', 'filesPath', 'public', 'portalLogo', 'designColor', 'designBackgroundColor', 'designLogo', 'designFavicon', 'homeComponent', 'homeComponentConfig', 'sampEnabled', 'backToPortal', 'searchByCriteriaAllowed', 'searchByCriteriaLabel', 'searchMultipleAllowed', 'searchMultipleLabel', 'searchMultipleAllDatasetsSelected', 'documentationAllowed', 'documentationLabel', 'datasetFamilies']; + return ['__isInitialized__', 'name', 'label', 'description', 'scientificManager', 'instrument', 'wavelengthDomain', 'display', 'dataPath', 'filesPath', 'public', 'portalLogo', 'designColor', 'designBackgroundColor', 'designLogo', 'designFavicon', 'homeComponent', 'homeComponentConfig', 'sampEnabled', 'backToPortal', 'searchByCriteriaAllowed', 'searchByCriteriaLabel', 'searchMultipleAllowed', 'searchMultipleLabel', 'searchMultipleAllDatasetsSelected', 'documentationAllowed', 'documentationLabel', 'datasetFamilies']; } - return ['__isInitialized__', 'name', 'label', 'description', 'display', 'dataPath', 'filesPath', 'public', 'portalLogo', 'designColor', 'designBackgroundColor', 'designLogo', 'designFavicon', 'homeComponent', 'homeComponentConfig', 'sampEnabled', 'backToPortal', 'searchByCriteriaAllowed', 'searchByCriteriaLabel', 'searchMultipleAllowed', 'searchMultipleLabel', 'searchMultipleAllDatasetsSelected', 'documentationAllowed', 'documentationLabel', 'datasetFamilies']; + return ['__isInitialized__', 'name', 'label', 'description', 'scientificManager', 'instrument', 'wavelengthDomain', 'display', 'dataPath', 'filesPath', 'public', 'portalLogo', 'designColor', 'designBackgroundColor', 'designLogo', 'designFavicon', 'homeComponent', 'homeComponentConfig', 'sampEnabled', 'backToPortal', 'searchByCriteriaAllowed', 'searchByCriteriaLabel', 'searchMultipleAllowed', 'searchMultipleLabel', 'searchMultipleAllDatasetsSelected', 'documentationAllowed', 'documentationLabel', 'datasetFamilies']; } /** @@ -236,6 +236,72 @@ class Instance extends \App\Entity\Instance implements \Doctrine\ORM\Proxy\Proxy return parent::setDescription($description); } + /** + * {@inheritDoc} + */ + public function getScientificManager() + { + + $this->__initializer__ && $this->__initializer__->__invoke($this, 'getScientificManager', []); + + return parent::getScientificManager(); + } + + /** + * {@inheritDoc} + */ + public function setScientificManager($scientificManager) + { + + $this->__initializer__ && $this->__initializer__->__invoke($this, 'setScientificManager', [$scientificManager]); + + return parent::setScientificManager($scientificManager); + } + + /** + * {@inheritDoc} + */ + public function getInstrument() + { + + $this->__initializer__ && $this->__initializer__->__invoke($this, 'getInstrument', []); + + return parent::getInstrument(); + } + + /** + * {@inheritDoc} + */ + public function setInstrument($instrument) + { + + $this->__initializer__ && $this->__initializer__->__invoke($this, 'setInstrument', [$instrument]); + + return parent::setInstrument($instrument); + } + + /** + * {@inheritDoc} + */ + public function getWavelengthDomain() + { + + $this->__initializer__ && $this->__initializer__->__invoke($this, 'getWavelengthDomain', []); + + return parent::getWavelengthDomain(); + } + + /** + * {@inheritDoc} + */ + public function setWavelengthDomain($wavelengthDomain) + { + + $this->__initializer__ && $this->__initializer__->__invoke($this, 'setWavelengthDomain', [$wavelengthDomain]); + + return parent::setWavelengthDomain($wavelengthDomain); + } + /** * {@inheritDoc} */ diff --git a/server/doctrine-proxy/__CG__AppEntitySurvey.php b/server/doctrine-proxy/__CG__AppEntitySurvey.php deleted file mode 100644 index aa09365115e9cb3c363ca1792b65ff15a75f62f0..0000000000000000000000000000000000000000 --- a/server/doctrine-proxy/__CG__AppEntitySurvey.php +++ /dev/null @@ -1,327 +0,0 @@ -<?php - -namespace DoctrineProxies\__CG__\App\Entity; - - -/** - * DO NOT EDIT THIS FILE - IT WAS CREATED BY DOCTRINE'S PROXY GENERATOR - */ -class Survey extends \App\Entity\Survey implements \Doctrine\ORM\Proxy\Proxy -{ - /** - * @var \Closure the callback responsible for loading properties in the proxy object. This callback is called with - * three parameters, being respectively the proxy object to be initialized, the method that triggered the - * initialization process and an array of ordered parameters that were passed to that method. - * - * @see \Doctrine\Common\Proxy\Proxy::__setInitializer - */ - public $__initializer__; - - /** - * @var \Closure the callback responsible of loading properties that need to be copied in the cloned object - * - * @see \Doctrine\Common\Proxy\Proxy::__setCloner - */ - public $__cloner__; - - /** - * @var boolean flag indicating if this object was already initialized - * - * @see \Doctrine\Persistence\Proxy::__isInitialized - */ - public $__isInitialized__ = false; - - /** - * @var array<string, null> properties to be lazy loaded, indexed by property name - */ - public static $lazyPropertiesNames = array ( -); - - /** - * @var array<string, mixed> default values of properties to be lazy loaded, with keys being the property names - * - * @see \Doctrine\Common\Proxy\Proxy::__getLazyProperties - */ - public static $lazyPropertiesDefaults = array ( -); - - - - public function __construct(?\Closure $initializer = null, ?\Closure $cloner = null) - { - - $this->__initializer__ = $initializer; - $this->__cloner__ = $cloner; - } - - - - - - - - /** - * - * @return array - */ - public function __sleep() - { - if ($this->__isInitialized__) { - return ['__isInitialized__', 'name', 'label', 'description', 'link', 'manager', 'database', 'datasets']; - } - - return ['__isInitialized__', 'name', 'label', 'description', 'link', 'manager', 'database', 'datasets']; - } - - /** - * - */ - public function __wakeup() - { - if ( ! $this->__isInitialized__) { - $this->__initializer__ = function (Survey $proxy) { - $proxy->__setInitializer(null); - $proxy->__setCloner(null); - - $existingProperties = get_object_vars($proxy); - - foreach ($proxy::$lazyPropertiesDefaults as $property => $defaultValue) { - if ( ! array_key_exists($property, $existingProperties)) { - $proxy->$property = $defaultValue; - } - } - }; - - } - } - - /** - * - */ - public function __clone() - { - $this->__cloner__ && $this->__cloner__->__invoke($this, '__clone', []); - } - - /** - * Forces initialization of the proxy - */ - public function __load() - { - $this->__initializer__ && $this->__initializer__->__invoke($this, '__load', []); - } - - /** - * {@inheritDoc} - * @internal generated method: use only when explicitly handling proxy specific loading logic - */ - public function __isInitialized() - { - return $this->__isInitialized__; - } - - /** - * {@inheritDoc} - * @internal generated method: use only when explicitly handling proxy specific loading logic - */ - public function __setInitialized($initialized) - { - $this->__isInitialized__ = $initialized; - } - - /** - * {@inheritDoc} - * @internal generated method: use only when explicitly handling proxy specific loading logic - */ - public function __setInitializer(\Closure $initializer = null) - { - $this->__initializer__ = $initializer; - } - - /** - * {@inheritDoc} - * @internal generated method: use only when explicitly handling proxy specific loading logic - */ - public function __getInitializer() - { - return $this->__initializer__; - } - - /** - * {@inheritDoc} - * @internal generated method: use only when explicitly handling proxy specific loading logic - */ - public function __setCloner(\Closure $cloner = null) - { - $this->__cloner__ = $cloner; - } - - /** - * {@inheritDoc} - * @internal generated method: use only when explicitly handling proxy specific cloning logic - */ - public function __getCloner() - { - return $this->__cloner__; - } - - /** - * {@inheritDoc} - * @internal generated method: use only when explicitly handling proxy specific loading logic - * @deprecated no longer in use - generated code now relies on internal components rather than generated public API - * @static - */ - public function __getLazyProperties() - { - return self::$lazyPropertiesDefaults; - } - - - /** - * {@inheritDoc} - */ - public function getName() - { - if ($this->__isInitialized__ === false) { - return parent::getName(); - } - - - $this->__initializer__ && $this->__initializer__->__invoke($this, 'getName', []); - - return parent::getName(); - } - - /** - * {@inheritDoc} - */ - public function getLabel() - { - - $this->__initializer__ && $this->__initializer__->__invoke($this, 'getLabel', []); - - return parent::getLabel(); - } - - /** - * {@inheritDoc} - */ - public function setLabel($label) - { - - $this->__initializer__ && $this->__initializer__->__invoke($this, 'setLabel', [$label]); - - return parent::setLabel($label); - } - - /** - * {@inheritDoc} - */ - public function getDescription() - { - - $this->__initializer__ && $this->__initializer__->__invoke($this, 'getDescription', []); - - return parent::getDescription(); - } - - /** - * {@inheritDoc} - */ - public function setDescription($description) - { - - $this->__initializer__ && $this->__initializer__->__invoke($this, 'setDescription', [$description]); - - return parent::setDescription($description); - } - - /** - * {@inheritDoc} - */ - public function getLink() - { - - $this->__initializer__ && $this->__initializer__->__invoke($this, 'getLink', []); - - return parent::getLink(); - } - - /** - * {@inheritDoc} - */ - public function setLink($link) - { - - $this->__initializer__ && $this->__initializer__->__invoke($this, 'setLink', [$link]); - - return parent::setLink($link); - } - - /** - * {@inheritDoc} - */ - public function getManager() - { - - $this->__initializer__ && $this->__initializer__->__invoke($this, 'getManager', []); - - return parent::getManager(); - } - - /** - * {@inheritDoc} - */ - public function setManager($manager) - { - - $this->__initializer__ && $this->__initializer__->__invoke($this, 'setManager', [$manager]); - - return parent::setManager($manager); - } - - /** - * {@inheritDoc} - */ - public function setDatabase($database) - { - - $this->__initializer__ && $this->__initializer__->__invoke($this, 'setDatabase', [$database]); - - return parent::setDatabase($database); - } - - /** - * {@inheritDoc} - */ - public function getDatabase() - { - - $this->__initializer__ && $this->__initializer__->__invoke($this, 'getDatabase', []); - - return parent::getDatabase(); - } - - /** - * {@inheritDoc} - */ - public function getDatasets() - { - - $this->__initializer__ && $this->__initializer__->__invoke($this, 'getDatasets', []); - - return parent::getDatasets(); - } - - /** - * {@inheritDoc} - */ - public function jsonSerialize(): array - { - - $this->__initializer__ && $this->__initializer__->__invoke($this, 'jsonSerialize', []); - - return parent::jsonSerialize(); - } - -} diff --git a/server/src/Action/InstanceAction.php b/server/src/Action/InstanceAction.php index f116e2be3b69391e9745d34a9afced027d8ecd12..52593f04606475afb249fdfbe2ba6e7a69968af2 100644 --- a/server/src/Action/InstanceAction.php +++ b/server/src/Action/InstanceAction.php @@ -97,6 +97,9 @@ final class InstanceAction extends AbstractAction { $instance->setLabel($parsedBody['label']); $instance->setDescription($parsedBody['description']); + $instance->setScientificManager($parsedBody['scientific_manager']); + $instance->setInstrument($parsedBody['instrument']); + $instance->setWavelengthDomain($parsedBody['wavelength_domain']); $instance->setDisplay($parsedBody['display']); $instance->setDataPath($parsedBody['data_path']); $instance->setFilesPath($parsedBody['files_path']); diff --git a/server/src/Action/InstanceListAction.php b/server/src/Action/InstanceListAction.php index eaafb1fab5f9dc89f7513f05f56b8ec3d342a051..4e2820c55ab7d9a510c46294d78adddeea6a3aad 100644 --- a/server/src/Action/InstanceListAction.php +++ b/server/src/Action/InstanceListAction.php @@ -130,6 +130,9 @@ final class InstanceListAction extends AbstractAction { $instance = new Instance($parsedBody['name'], $parsedBody['label']); $instance->setDescription($parsedBody['description']); + $instance->setScientificManager($parsedBody['scientific_manager']); + $instance->setInstrument($parsedBody['instrument']); + $instance->setWavelengthDomain($parsedBody['wavelength_domain']); $instance->setDisplay($parsedBody['display']); $instance->setDataPath($parsedBody['data_path']); $instance->setFilesPath($parsedBody['files_path']); diff --git a/server/src/Entity/Instance.php b/server/src/Entity/Instance.php index 3a8280651068deb3c1da651d26dd51c6d857fa47..88f42af0d4cc230389286800040de3c2af4ba467 100644 --- a/server/src/Entity/Instance.php +++ b/server/src/Entity/Instance.php @@ -45,6 +45,27 @@ class Instance implements \JsonSerializable */ protected $description; + /** + * @var string + * + * @Column(type="string", name="scientific_manager", nullable=true) + */ + protected $scientificManager; + + /** + * @var string + * + * @Column(type="string", name="instrument", nullable=true) + */ + protected $instrument; + + /** + * @var string + * + * @Column(type="string", name="wavelength_domain", nullable=true) + */ + protected $wavelengthDomain; + /** * @var int * @@ -224,6 +245,36 @@ class Instance implements \JsonSerializable $this->description = $description; } + public function getScientificManager() + { + return $this->scientificManager; + } + + public function setScientificManager($scientificManager) + { + $this->scientificManager = $scientificManager; + } + + public function getInstrument() + { + return $this->instrument; + } + + public function setInstrument($instrument) + { + $this->instrument = $instrument; + } + + public function getWavelengthDomain() + { + return $this->wavelengthDomain; + } + + public function setWavelengthDomain($wavelengthDomain) + { + $this->wavelengthDomain = $wavelengthDomain; + } + public function getDisplay() { return $this->display; @@ -444,6 +495,9 @@ class Instance implements \JsonSerializable 'name' => $this->getName(), 'label' => $this->getLabel(), 'description' => $this->getDescription(), + 'scientific_manager' => $this->getScientificManager(), + 'instrument' => $this->getInstrument(), + 'wavelength_domain' => $this->getWavelengthDomain(), 'display' => $this->getDisplay(), 'data_path' => $this->getDataPath(), 'files_path' => $this->getFilesPath(), diff --git a/server/tests/Action/InstanceActionTest.php b/server/tests/Action/InstanceActionTest.php index 60645f6a7cb15520aae64404c53f2ff96615e7f1..f630dcf7de6d0e1795fac5af2d78ff3d39c5e250 100644 --- a/server/tests/Action/InstanceActionTest.php +++ b/server/tests/Action/InstanceActionTest.php @@ -80,6 +80,9 @@ final class InstanceActionTest extends TestCase 'name' => 'aspic', 'label' => 'Aspic', 'description' => 'Test', + 'scientific_manager' => 'M. Durand', + 'instrument' => 'Multiple', + 'wavelength_domain' => 'Visible imaging', 'display' => 10, 'data_path' => '/DEFAULT', 'files_path' => '/INSTANCE_FILES', diff --git a/server/tests/Action/InstanceListActionTest.php b/server/tests/Action/InstanceListActionTest.php index 5ad65130deb8c2523db59691e44137eb42cbb5fc..bd1b515b9b660db6eaa940cb6a358935ec20dd33 100644 --- a/server/tests/Action/InstanceListActionTest.php +++ b/server/tests/Action/InstanceListActionTest.php @@ -79,6 +79,9 @@ final class InstanceListActionTest extends TestCase 'name' => 'aspic', 'label' => 'Aspic', 'description' => 'Test', + 'scientific_manager' => 'M. Durand', + 'instrument' => 'Multiple', + 'wavelength_domain' => 'Visible imaging', 'display' => 10, 'data_path' => '/DEFAULT', 'files_path' => '/INSTANCE_FILES',