From 93d026cc42bd51ae264d129dfb76513d4e66cd46 Mon Sep 17 00:00:00 2001 From: Tifenn Guillas Date: Mon, 5 Oct 2020 16:07:47 +0200 Subject: [PATCH 1/3] Add config attribute to Instance entity --- conf-dev/create-db.sh | 5 +---- src/Action/InstanceAction.php | 1 + src/Action/InstanceListAction.php | 1 + src/Entity/Instance.php | 18 ++++++++++++++++++ 4 files changed, 21 insertions(+), 4 deletions(-) diff --git a/conf-dev/create-db.sh b/conf-dev/create-db.sh index fcdff79..a86f85a 100644 --- a/conf-dev/create-db.sh +++ b/conf-dev/create-db.sh @@ -8,7 +8,7 @@ set -e curl -d '{"label":"Test","dbname":"anis_test","dbtype":"pdo_pgsql","dbhost":"db","dbport":5432,"dblogin":"anis","dbpassword":"anis"}' -H "Content-Type: application/json" -X POST http://localhost/database # Add default instance -curl -d '{"name":"default","label":"Default instance","client_url":"http://localhost:4200"}' -H "Content-Type: application/json" -X POST http://localhost/instance +curl -d '{"name":"default","label":"Default instance","client_url":"http://localhost:4200","config":{"search":true,"search_multiple":true}}' -H "Content-Type: application/json" -X POST http://localhost/instance # Add ANIS, SVOM and COLIBRI projects curl -d '{"name":"anis_project","label":"Anis Project Test","description":"Project used for testing","link":"http://project.com","manager":"M. Durand","id_database":1}' -H "Content-Type: application/json" -X POST http://localhost/project @@ -127,11 +127,8 @@ curl -d '{"id":13,"name":"pack_calib","table_name":"anis_observation","label":"p curl -d '{"id":14,"name":"readme_calib","table_name":"anis_observation","label":"readme_calib","form_label":"Calibration Readme (zip)","description":"Calibration Readme (zip)","output_display":140,"criteria_display":140,"search_flag":null,"search_type":null,"type":"string","operator":null,"min":null,"max":null,"placeholder_min":null,"placeholder_max":null,"uri_action":null,"renderer":"download","display_detail":140,"selected":false,"order_by":false,"order_display":140,"detail":false,"renderer_detail":null,"options":null,"vo_utype":null,"vo_ucd":null,"vo_unit":null,"vo_description":null,"vo_datatype":null,"vo_size":null,"id_criteria_family":null,"id_output_category":7}' -H "Content-Type: application/json" -X PUT http://localhost/dataset/anis_observation/attribute/14 # Add ANIS vipers_dr2_w1 default criteria family, default output family and default output category -# id 8 curl -d '{"label":"Default criteria family","display":10}' -H "Content-Type: application/json" -X POST http://localhost/dataset/vipers_dr2_w1/criteria-family -# id 7 curl -d '{"label":"Default output family","display":10}' -H "Content-Type: application/json" -X POST http://localhost/dataset/vipers_dr2_w1/output-family -# id 8 curl -d '{"label":"Default output category","display":10}' -H "Content-Type: application/json" -X POST http://localhost/output-family/7/output-category # Edit ANIS vipers_dr2_w1 attributes diff --git a/src/Action/InstanceAction.php b/src/Action/InstanceAction.php index 1e9d1bd..d399891 100644 --- a/src/Action/InstanceAction.php +++ b/src/Action/InstanceAction.php @@ -94,6 +94,7 @@ final class InstanceAction extends AbstractAction } else { $instance->setClientUrl(null); } + $instance->setConfig($parsedBody['config']); $this->em->flush(); } } diff --git a/src/Action/InstanceListAction.php b/src/Action/InstanceListAction.php index 55bc2a1..e376dcb 100644 --- a/src/Action/InstanceListAction.php +++ b/src/Action/InstanceListAction.php @@ -74,6 +74,7 @@ final class InstanceListAction extends AbstractAction if (!$this->isEmptyField('client_url', $parsedBody)) { $instance->setClientUrl($parsedBody['client_url']); } + $instance->setConfig($parsedBody['config']); $this->em->persist($instance); $this->em->flush(); diff --git a/src/Entity/Instance.php b/src/Entity/Instance.php index 77a3183..90cb1ce 100644 --- a/src/Entity/Instance.php +++ b/src/Entity/Instance.php @@ -42,6 +42,13 @@ class Instance implements \JsonSerializable */ protected $clientUrl; + /** + * @var string + * + * @Column(type="json", nullable=true) + */ + protected $config; + /** * @var Anis\Entity\DatasetFamily[] * @@ -81,6 +88,16 @@ class Instance implements \JsonSerializable $this->clientUrl = $clientUrl; } + public function getConfig() + { + return $this->config; + } + + public function setConfig($config) + { + $this->config = $config; + } + public function getDatasetFamilies() { return $this->datasetFamilies; @@ -101,6 +118,7 @@ class Instance implements \JsonSerializable 'name' => $this->getName(), 'label' => $this->getLabel(), 'client_url' => $this->getClientUrl(), + 'config' => $this->getConfig(), 'nb_dataset_families' => $this->getDatasetFamilies()->count(), 'nb_datasets' => $this->getNbDatasets() ]; -- GitLab From 63618d52e683c389facdb712aab213b78d62b49d Mon Sep 17 00:00:00 2001 From: Tifenn Guillas Date: Mon, 5 Oct 2020 16:29:54 +0200 Subject: [PATCH 2/3] Delete selectable_row from Dataset entity --- conf-dev/create-db.sh | 16 ++++++++-------- src/Action/DatasetAction.php | 2 -- src/Action/DatasetListAction.php | 2 -- src/Entity/Dataset.php | 18 ------------------ 4 files changed, 8 insertions(+), 30 deletions(-) diff --git a/conf-dev/create-db.sh b/conf-dev/create-db.sh index a86f85a..46ac523 100644 --- a/conf-dev/create-db.sh +++ b/conf-dev/create-db.sh @@ -17,10 +17,10 @@ curl -d '{"name":"colibri","label":"Colibri Project Test","description":"Project # Add default dataset family and ANIS datasets curl -d '{"label":"Default dataset family","display":10}' -H "Content-Type: application/json" -X POST http://localhost/instance/default/dataset-family -curl -d '{"name":"obs_cat","table_ref":"obs_cat","label":"ObsCat dataset","description":"ObsCat","display":10,"count":10000,"vo":false,"data_path":"/mnt/mount","selectable_row":true,"config":{"cone_search":{"enabled":true,"column_ra":2,"column_dec":3}},"project_name":"anis_project"}' -H "Content-Type: application/json" -X POST http://localhost/dataset-family/1/dataset -curl -d '{"name":"observations","table_ref":"observations_info","label":"Observations dataset","description":"Observations","display":20,"count":177454,"vo":false,"data_path":"/mnt/mount","selectable_row":false,"config":{},"project_name":"anis_project"}' -H "Content-Type: application/json" -X POST http://localhost/dataset-family/1/dataset -curl -d '{"name":"vipers_dr2_w1","table_ref":"aspic_vipers_dr2_w1","label":"VIPERS-W1 (DR2)","description":"VIPERS W1 dataset","display":30,"count":1000,"vo":false,"data_path":"/mnt/mount","selectable_row":false,"config":{},"project_name":"anis_project"}' -H "Content-Type: application/json" -X POST http://localhost/dataset-family/1/dataset -curl -d '{"name":"gama_g02_dr3","table_ref":"aspic_gama_g02","label":"GAMA G02 (DR3)","description":"GAMA G02 dataset","display":40,"count":8,"vo":false,"data_path":"/mnt/mount","selectable_row":false,"config":{},"project_name":"anis_project"}' -H "Content-Type: application/json" -X POST http://localhost/dataset-family/1/dataset +curl -d '{"name":"obs_cat","table_ref":"obs_cat","label":"ObsCat dataset","description":"ObsCat","display":10,"count":10000,"vo":false,"data_path":"/mnt/mount","config":{"cone_search":{"enabled":true,"column_ra":2,"column_dec":3},"selectable_row":true},"project_name":"anis_project"}' -H "Content-Type: application/json" -X POST http://localhost/dataset-family/1/dataset +curl -d '{"name":"observations","table_ref":"observations_info","label":"Observations dataset","description":"Observations","display":20,"count":177454,"vo":false,"data_path":"/mnt/mount","config":{"selectable_row":false},"project_name":"anis_project"}' -H "Content-Type: application/json" -X POST http://localhost/dataset-family/1/dataset +curl -d '{"name":"vipers_dr2_w1","table_ref":"aspic_vipers_dr2_w1","label":"VIPERS-W1 (DR2)","description":"VIPERS W1 dataset","display":30,"count":1000,"vo":false,"data_path":"/mnt/mount","config":{"selectable_row":false},"project_name":"anis_project"}' -H "Content-Type: application/json" -X POST http://localhost/dataset-family/1/dataset +curl -d '{"name":"gama_g02_dr3","table_ref":"aspic_gama_g02","label":"GAMA G02 (DR3)","description":"GAMA G02 dataset","display":40,"count":8,"vo":false,"data_path":"/mnt/mount","config":{"selectable_row":false},"project_name":"anis_project"}' -H "Content-Type: application/json" -X POST http://localhost/dataset-family/1/dataset # Add ANIS obs_cat default criteria family, default output family and default output category curl -d '{"label":"Default criteria family","display":10}' -H "Content-Type: application/json" -X POST http://localhost/dataset/obs_cat/criteria-family @@ -29,9 +29,9 @@ curl -d '{"label":"Default output category","display":10}' -H "Content-Type: app # Add SVOM dataset family and SVOM datasets curl -d '{"label":"Svom dataset family","display":20}' -H "Content-Type: application/json" -X POST http://localhost/instance/default/dataset-family -curl -d '{"name":"l1","table_ref":"public.v_rawproducts","label":"L0 & L1","description":"L0 & L1 products list","display":10,"count":0,"vo":false,"data_path":"/mnt/mount","selectable_row":false,"config":{"results_server_link":{"enabled":true}},"project_name":"svom"}' -H "Content-Type: application/json" -X POST http://localhost/dataset-family/2/dataset -curl -d '{"name":"products","table_ref":"public.v_products","label":"Scientific Products","description":"SR3 & SR4 products list","display":20,"count":0,"vo":false,"data_path":"/mnt/mount","selectable_row":false,"config":{"results_server_link":{"enabled":true}},"project_name":"svom"}' -H "Content-Type: application/json" -X POST http://localhost/dataset-family/2/dataset -curl -d '{"name":"sp_cards","table_ref":"sp_cards","label":"SP Metadata","description":"Contains metadata of scientific products (Core Program & General Program)","display":30,"count":100,"vo":false,"data_path":"/mnt/mount","selectable_row":false,"config":{"results_server_link":{"enabled":true}},"project_name":"svom"}' -H "Content-Type: application/json" -X POST http://localhost/dataset-family/2/dataset +curl -d '{"name":"l1","table_ref":"public.v_rawproducts","label":"L0 & L1","description":"L0 & L1 products list","display":10,"count":0,"vo":false,"data_path":"/mnt/mount","config":{"results_server_link":{"enabled":true},"selectable_row":false},"project_name":"svom"}' -H "Content-Type: application/json" -X POST http://localhost/dataset-family/2/dataset +curl -d '{"name":"products","table_ref":"public.v_products","label":"Scientific Products","description":"SR3 & SR4 products list","display":20,"count":0,"vo":false,"data_path":"/mnt/mount","config":{"results_server_link":{"enabled":true},"selectable_row":false},"project_name":"svom"}' -H "Content-Type: application/json" -X POST http://localhost/dataset-family/2/dataset +curl -d '{"name":"sp_cards","table_ref":"sp_cards","label":"SP Metadata","description":"Contains metadata of scientific products (Core Program & General Program)","display":30,"count":100,"vo":false,"data_path":"/mnt/mount","config":{"results_server_link":{"enabled":true},"selectable_row":false},"project_name":"svom"}' -H "Content-Type: application/json" -X POST http://localhost/dataset-family/2/dataset # Add SVOM l1 criteria families, default output family and default output category curl -d '{"label":"Obs","display":10}' -H "Content-Type: application/json" -X POST http://localhost/dataset/l1/criteria-family @@ -100,7 +100,7 @@ curl -d '{"id":9,"name":"json_schema_uploaded","table_name":"sp_cards","label":" # Add COLIBRI dataset family and COLIBRI dataset curl -d '{"label":"Colibri dataset family","display":30}' -H "Content-Type: application/json" -X POST http://localhost/instance/default/dataset-family -curl -d '{"name":"anis_observation","table_ref":"anis_observation","label":"COLIBRI OBS","description":"colibri observations","display":10,"count":0,"vo":true,"data_path":"/mnt/mount","selectable_row":true,"config":{"cone_search":{"enabled":true,"column_ra":2,"column_dec":3}},"project_name":"colibri"}' -H "Content-Type: application/json" -X POST http://localhost/dataset-family/3/dataset +curl -d '{"name":"anis_observation","table_ref":"anis_observation","label":"COLIBRI OBS","description":"colibri observations","display":10,"count":0,"vo":true,"data_path":"/mnt/mount","config":{"cone_search":{"enabled":true,"column_ra":2,"column_dec":3},"selectable_row":true},"project_name":"colibri"}' -H "Content-Type: application/json" -X POST http://localhost/dataset-family/3/dataset # Add COLIBRI anis_observation default criteria family, output families and output categories curl -d '{"label":"Default criteria family","display":10}' -H "Content-Type: application/json" -X POST http://localhost/dataset/anis_observation/criteria-family diff --git a/src/Action/DatasetAction.php b/src/Action/DatasetAction.php index 69f7c83..052fb8b 100644 --- a/src/Action/DatasetAction.php +++ b/src/Action/DatasetAction.php @@ -64,7 +64,6 @@ final class DatasetAction extends AbstractAction 'count', 'vo', 'data_path', - 'selectable_row', 'config', 'id_dataset_family' ); @@ -117,7 +116,6 @@ final class DatasetAction extends AbstractAction $dataset->setCount($parsedBody['count']); $dataset->setVo($parsedBody['vo']); $dataset->setDataPath($parsedBody['data_path']); - $dataset->setSelectableRow($parsedBody['selectable_row']); $dataset->setConfig($parsedBody['config']); $this->em->flush(); } diff --git a/src/Action/DatasetListAction.php b/src/Action/DatasetListAction.php index dfe2aad..7d72101 100644 --- a/src/Action/DatasetListAction.php +++ b/src/Action/DatasetListAction.php @@ -83,7 +83,6 @@ final class DatasetListAction extends AbstractAction 'count', 'vo', 'data_path', - 'selectable_row', 'config', 'project_name' ); @@ -136,7 +135,6 @@ final class DatasetListAction extends AbstractAction $dataset->setCount($parsedBody['count']); $dataset->setVo($parsedBody['vo']); $dataset->setDataPath($parsedBody['data_path']); - $dataset->setSelectableRow($parsedBody['selectable_row']); $dataset->setConfig($parsedBody['config']); $dataset->setProject($project); $dataset->setDatasetFamily($datasetFamily); diff --git a/src/Entity/Dataset.php b/src/Entity/Dataset.php index 05d29fb..c926142 100644 --- a/src/Entity/Dataset.php +++ b/src/Entity/Dataset.php @@ -77,13 +77,6 @@ class Dataset implements \JsonSerializable */ protected $dataPath; - /** - * @var bool - * - * @Column(type="boolean", name="selectable_row", nullable=false) - */ - protected $selectableRow; - /** * @var string * @@ -195,16 +188,6 @@ class Dataset implements \JsonSerializable $this->dataPath = $dataPath; } - public function getSelectableRow() - { - return $this->selectableRow; - } - - public function setSelectableRow($selectableRow) - { - $this->selectableRow = $selectableRow; - } - public function getConfig() { return $this->config; @@ -251,7 +234,6 @@ class Dataset implements \JsonSerializable 'count' => $this->getCount(), 'vo' => $this->getVo(), 'data_path' => $this->getDataPath(), - 'selectable_row' => $this->getSelectableRow(), 'config' => $this->getConfig(), 'project_name' => $this->getProject()->getName(), 'id_dataset_family' => $this->getDatasetFamily()->getId() -- GitLab From 0f2825d245a09c9e4ad695d35eabfcdf09ec6a85 Mon Sep 17 00:00:00 2001 From: Tifenn Guillas Date: Tue, 6 Oct 2020 16:26:18 +0200 Subject: [PATCH 3/3] Update CHANGELOG --- CHANGELOG.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9b2bbcd..1f6d10e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,7 +4,11 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). -## [3.3.0] +## [3.4.0] +### Added + - #56: Added config attribute to Instance entity + + ## [3.3.0] ### Added - #54: Added search by cone-search -- GitLab