From d926dd6710164f1d68e620cec34a0422cf7cc98b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Agneray?= <francois.agneray@lam.fr> Date: Wed, 9 Mar 2022 22:02:00 +0100 Subject: [PATCH] WIP => #26 --- .../home/components/welcome.component.html | 2 +- .../home/components/welcome.component.ts | 2 +- client/src/app/instance/instance.component.ts | 16 +- .../progress-bar-multiple.component.html | 2 +- .../progress-bar-multiple.component.ts | 10 +- .../components/progress-bar.component.html | 2 +- .../components/progress-bar.component.ts | 10 +- .../result/datatable.component.html | 2 +- .../search/containers/output.component.html | 2 +- .../store/effects/search-multiple.effects.ts | 2 +- .../app/metamodel/models/instance.model.ts | 40 +-- .../shared/components/navbar.component.html | 2 +- .../app/shared/components/navbar.component.ts | 4 +- conf-dev/create-db.sh | 2 +- server/cli-config.php | 5 - .../__CG__AppEntityAttribute.php | 1 + .../__CG__AppEntityCriteriaFamily.php | 1 + .../__CG__AppEntityDatabase.php | 1 + .../doctrine-proxy/__CG__AppEntityDataset.php | 1 + .../__CG__AppEntityDatasetFamily.php | 1 + .../doctrine-proxy/__CG__AppEntityGroup.php | 1 + .../__CG__AppEntityInstance.php | 281 +++++++++++++++++- .../doctrine-proxy/__CG__AppEntityOption.php | 1 + .../__CG__AppEntityOutputCategory.php | 1 + .../__CG__AppEntityOutputFamily.php | 1 + .../doctrine-proxy/__CG__AppEntitySelect.php | 1 + .../doctrine-proxy/__CG__AppEntitySurvey.php | 1 + server/src/Action/InstanceAction.php | 17 +- server/src/Action/InstanceListAction.php | 16 +- server/src/Entity/Instance.php | 230 +++++++++++++- 30 files changed, 580 insertions(+), 78 deletions(-) diff --git a/client/src/app/instance/home/components/welcome.component.html b/client/src/app/instance/home/components/welcome.component.html index b4132609..4413a015 100644 --- a/client/src/app/instance/home/components/welcome.component.html +++ b/client/src/app/instance/home/components/welcome.component.html @@ -2,5 +2,5 @@ <div class="col-6 col-md-4 order-md-2 mx-auto text-center"> <img class="img-fluid mb-3 mb-md-0" src="{{ getLogoSrc() }}" alt="Instance logo"> </div> - <div class="col-md-8 order-md-1 text-justify pr-md-5" [innerHtml]="instance.config.home.home_config.home_component_text"></div> + <div class="col-md-8 order-md-1 text-justify pr-md-5" [innerHtml]="instance.home_component_config.home_component_text"></div> </div> diff --git a/client/src/app/instance/home/components/welcome.component.ts b/client/src/app/instance/home/components/welcome.component.ts index 8f54362d..6eaf4c53 100644 --- a/client/src/app/instance/home/components/welcome.component.ts +++ b/client/src/app/instance/home/components/welcome.component.ts @@ -30,6 +30,6 @@ export class WelcomeComponent { * @return string */ getLogoSrc(): string { - return `${this.apiUrl}/download-instance-file/${this.instance.name}/${this.instance.config.home.home_config.home_component_logo}`; + return `${this.apiUrl}/download-instance-file/${this.instance.name}/${this.instance.home_component_config.home_component_logo}`; } } diff --git a/client/src/app/instance/instance.component.ts b/client/src/app/instance/instance.component.ts index bb78d58c..b5ccc3a2 100644 --- a/client/src/app/instance/instance.component.ts +++ b/client/src/app/instance/instance.component.ts @@ -57,17 +57,17 @@ export class InstanceComponent implements OnInit, OnDestroy { Promise.resolve(null).then(() => this.store.dispatch(datasetActions.loadDatasetList())); Promise.resolve(null).then(() => this.store.dispatch(surveyActions.loadSurveyList())); this.instanceSubscription = this.instance.subscribe(instance => { - if (instance.config.search.search_by_criteria_allowed) { - this.links.push({ label: instance.config.search.search_by_criteria_label, icon: 'fas fa-search', routerLink: 'search' }); + if (instance.search_by_criteria_allowed) { + this.links.push({ label: instance.search_by_criteria_label, icon: 'fas fa-search', routerLink: 'search' }); } - if (instance.config.search.search_multiple_allowed) { - this.links.push({ label: instance.config.search.search_multiple_label, icon: 'fas fa-search-plus', routerLink: 'search-multiple' }); + if (instance.search_multiple_allowed) { + this.links.push({ label: instance.search_multiple_label, icon: 'fas fa-search-plus', routerLink: 'search-multiple' }); } - if (instance.config.documentation.documentation_allowed) { - this.links.push({ label: instance.config.documentation.documentation_label, icon: 'fas fa-question', routerLink: 'documentation' }); + if (instance.documentation_allowed) { + this.links.push({ label: instance.documentation_label, icon: 'fas fa-question', routerLink: 'documentation' }); } - if (instance.config.design.design_favicon !== '') { - this.favIcon.href = `${this.config.apiUrl}/download-instance-file/${instance.name}/${instance.config.design.design_favicon}`; + if (instance.design_favicon !== '') { + this.favIcon.href = `${this.config.apiUrl}/download-instance-file/${instance.name}/${instance.design_favicon}`; } this.title.innerHTML = instance.label; }) diff --git a/client/src/app/instance/search-multiple/components/progress-bar-multiple.component.html b/client/src/app/instance/search-multiple/components/progress-bar-multiple.component.html index 7ac8fc5b..54904e5e 100644 --- a/client/src/app/instance/search-multiple/components/progress-bar-multiple.component.html +++ b/client/src/app/instance/search-multiple/components/progress-bar-multiple.component.html @@ -8,7 +8,7 @@ <div class="progress progress-with-circle"> <div class="progress-bar" [ngClass]="getStepClass()" - [ngStyle]="{'background-color': instance.config.design.design_color }" + [ngStyle]="{'background-color': instance.design_color }" role="progressbar" aria-valuenow="1" aria-valuemin="1" diff --git a/client/src/app/instance/search-multiple/components/progress-bar-multiple.component.ts b/client/src/app/instance/search-multiple/components/progress-bar-multiple.component.ts index 0fbeafa0..9a09a721 100644 --- a/client/src/app/instance/search-multiple/components/progress-bar-multiple.component.ts +++ b/client/src/app/instance/search-multiple/components/progress-bar-multiple.component.ts @@ -60,7 +60,7 @@ export class ProgressBarMultipleComponent { */ getNavItemAStyle(currentStep: string, checked: boolean): { color: string } | null { if (this.currentStep === currentStep || checked) { - return { 'color': this.instance.config.design.design_color } + return { 'color': this.instance.design_color } } return null; } @@ -76,12 +76,12 @@ export class ProgressBarMultipleComponent { getNavItemIconCircleStyle(currentStep: string, checked: boolean): any { let style = {}; if (this.currentStep === currentStep) { - style['border-color'] = this.instance.config.design.design_color; - style['background-color'] = this.instance.config.design.design_color; + style['border-color'] = this.instance.design_color; + style['background-color'] = this.instance.design_color; } if (checked) { - style['border-color'] = this.instance.config.design.design_color; - style['color'] = this.instance.config.design.design_color; + style['border-color'] = this.instance.design_color; + style['color'] = this.instance.design_color; } return style; } diff --git a/client/src/app/instance/search/components/progress-bar.component.html b/client/src/app/instance/search/components/progress-bar.component.html index b248b98c..79751348 100644 --- a/client/src/app/instance/search/components/progress-bar.component.html +++ b/client/src/app/instance/search/components/progress-bar.component.html @@ -8,7 +8,7 @@ <div class="progress progress-with-circle"> <div class="progress-bar" [ngClass]="getStepClass()" - [ngStyle]="{'background-color': instance.config.design.design_color }" + [ngStyle]="{'background-color': instance.design_color }" role="progressbar" aria-valuenow="1" aria-valuemin="1" diff --git a/client/src/app/instance/search/components/progress-bar.component.ts b/client/src/app/instance/search/components/progress-bar.component.ts index 64a72787..ed20b92f 100644 --- a/client/src/app/instance/search/components/progress-bar.component.ts +++ b/client/src/app/instance/search/components/progress-bar.component.ts @@ -60,7 +60,7 @@ export class ProgressBarComponent { getNavItemAStyle(currentStep: string, checked: boolean): { color: string } | null { if (this.currentStep === currentStep || checked) { return { - 'color': this.instance.config.design.design_color + 'color': this.instance.design_color } } else { return null; @@ -75,12 +75,12 @@ export class ProgressBarComponent { getNavItemIconCircleStyle(currentStep: string, checked: boolean): {} { let style = {}; if (this.currentStep === currentStep) { - style['border-color'] = this.instance.config.design.design_color; - style['background-color'] = this.instance.config.design.design_color; + style['border-color'] = this.instance.design_color; + style['background-color'] = this.instance.design_color; } if (checked) { - style['border-color'] = this.instance.config.design.design_color; - style['color'] = this.instance.config.design.design_color; + style['border-color'] = this.instance.design_color; + style['color'] = this.instance.design_color; } return style; } diff --git a/client/src/app/instance/search/components/result/datatable.component.html b/client/src/app/instance/search/components/result/datatable.component.html index 0647cae6..587d19ee 100644 --- a/client/src/app/instance/search/components/result/datatable.component.html +++ b/client/src/app/instance/search/components/result/datatable.component.html @@ -35,7 +35,7 @@ <span class="far fa-square fa-lg text-secondary"></span> </span> <span *ngIf="isSelected(datum)"> - <span class="fas fa-check-square fa-lg" [ngStyle]="{ 'color': instance.config.design.design_color }"></span> + <span class="fas fa-check-square fa-lg" [ngStyle]="{ 'color': instance.design_color }"></span> </span> </button> </td> diff --git a/client/src/app/instance/search/containers/output.component.html b/client/src/app/instance/search/containers/output.component.html index 4e68b9b9..a5ecb6da 100644 --- a/client/src/app/instance/search/containers/output.component.html +++ b/client/src/app/instance/search/containers/output.component.html @@ -12,7 +12,7 @@ [outputFamilyList]="outputFamilyList | async" [outputCategoryList]="outputCategoryList | async" [outputList]="outputList | async" - [designColor]="(instance | async).config.design.design_color" + [designColor]="(instance | async).design_color" (change)="updateOutputList($event)"> </app-output-tabs> </div> diff --git a/client/src/app/instance/store/effects/search-multiple.effects.ts b/client/src/app/instance/store/effects/search-multiple.effects.ts index 129727b1..bfdf3a1b 100644 --- a/client/src/app/instance/store/effects/search-multiple.effects.ts +++ b/client/src/app/instance/store/effects/search-multiple.effects.ts @@ -77,7 +77,7 @@ export class SearchMultipleEffects { searchMultipleActions.updateSelectedDatasets({ selectedDatasets }), searchMultipleActions.checkDatasets() ); - } else if (instance.config.search.search_multiple_all_datasets_selected) { + } else if (instance.search_multiple_all_datasets_selected) { const selectedDatasets = datasetList.map(dataset => dataset.name); actions.push( searchMultipleActions.updateSelectedDatasets({ selectedDatasets }) diff --git a/client/src/app/metamodel/models/instance.model.ts b/client/src/app/metamodel/models/instance.model.ts index bbb54364..1e155b23 100644 --- a/client/src/app/metamodel/models/instance.model.ts +++ b/client/src/app/metamodel/models/instance.model.ts @@ -16,32 +16,22 @@ export interface Instance { name: string; label: string; data_path: string; - config: { - design: { - design_color: string; - design_background_color: string; - design_logo: string; - design_favicon: string; - }; - home: { - home_component: string; - home_config: { - home_component_text: string; - home_component_logo: string; - }; - }; - search: { - search_by_criteria_allowed: boolean; - search_by_criteria_label: string; - search_multiple_allowed: boolean; - search_multiple_label: string; - search_multiple_all_datasets_selected: boolean; - }; - documentation: { - documentation_allowed: boolean; - documentation_label: string; - }; + design_color: string; + design_background_color: string; + design_logo: string; + design_favicon: string; + home_component: string; + home_component_config: { + home_component_text: string; + home_component_logo: string; }; + search_by_criteria_allowed: boolean; + search_by_criteria_label: string; + search_multiple_allowed: boolean; + search_multiple_label: string; + search_multiple_all_datasets_selected: boolean; + documentation_allowed: boolean; + documentation_label: string; nb_dataset_families: number; nb_datasets: number; } diff --git a/client/src/app/shared/components/navbar.component.html b/client/src/app/shared/components/navbar.component.html index 62139270..ffce6366 100644 --- a/client/src/app/shared/components/navbar.component.html +++ b/client/src/app/shared/components/navbar.component.html @@ -25,7 +25,7 @@ </button> <span *ngIf="isAuthenticated" id="dropdown-menu" dropdown> <button id="button-basic" dropdownToggle type="button" class="btn btn-light" aria-controls="dropdown-basic"> - <span class="fa-stack" [ngStyle]="{ color: instance ? instance.config.design.design_color : '#7AC29A' }"> + <span class="fa-stack" [ngStyle]="{ color: instance ? instance.design_color : '#7AC29A' }"> <span class="fas fa-circle fa-2x"></span> <span class="fas fa-user fa-stack-1x fa-inverse"></span> </span> diff --git a/client/src/app/shared/components/navbar.component.ts b/client/src/app/shared/components/navbar.component.ts index 6dd71ea2..66e69019 100644 --- a/client/src/app/shared/components/navbar.component.ts +++ b/client/src/app/shared/components/navbar.component.ts @@ -40,8 +40,8 @@ export class NavbarComponent { * @return string */ getLogoHref(): string { - if (this.instance.config.design.design_logo) { - return `${this.apiUrl}/download-instance-file/${this.instance.name}/${this.instance.config.design.design_logo}`; + if (this.instance.design_logo) { + return `${this.apiUrl}/download-instance-file/${this.instance.name}/${this.instance.design_logo}`; } return 'assets/cesam_anis40.png'; } diff --git a/conf-dev/create-db.sh b/conf-dev/create-db.sh index 9d007ea5..e0e599b7 100644 --- a/conf-dev/create-db.sh +++ b/conf-dev/create-db.sh @@ -60,7 +60,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","data_path":"\/DEFAULT","config":{"design":{"design_color":"#7AC29A","design_logo":"logo.png","design_favicon":"favicon.ico"},"home":{"home_component":"WelcomeComponent","home_config":{"home_component_text":"AstroNomical Information System","home_component_logo":"home_component_logo.png"}},"search":{"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":{"documentation_allowed":false,"documentation_label":"Documentation"}}}' --header 'Content-Type: application/json' -X POST http://localhost/instance +curl -d '{"name":"default","label":"Default instance","data_path":"\/DEFAULT","design_color":"#7AC29A","design_background_color":"","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"},"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 ANIS, SVOM and IRIS surveys curl -d '{"name":"anis_survey","label":"ANIS survey","description":"Survey used for testing","link":"https://anis.lam.fr","manager":"F. Agneray","id_database":1}' --header 'Content-Type: application/json' -X POST http://localhost/survey diff --git a/server/cli-config.php b/server/cli-config.php index 6ad8fe5b..d0351e85 100644 --- a/server/cli-config.php +++ b/server/cli-config.php @@ -27,9 +27,4 @@ if ($devMode) { $em = \Doctrine\ORM\EntityManager::create($database['connection_options'], $c); -$helpers = new Symfony\Component\Console\Helper\HelperSet(array( - 'db' => new \Doctrine\DBAL\Tools\Console\Helper\ConnectionHelper($em->getConnection()), - 'em' => new \Doctrine\ORM\Tools\Console\Helper\EntityManagerHelper($em) -)); - return \Doctrine\ORM\Tools\Console\ConsoleRunner::createHelperSet($em); diff --git a/server/doctrine-proxy/__CG__AppEntityAttribute.php b/server/doctrine-proxy/__CG__AppEntityAttribute.php index fecb1e94..f2c804ff 100644 --- a/server/doctrine-proxy/__CG__AppEntityAttribute.php +++ b/server/doctrine-proxy/__CG__AppEntityAttribute.php @@ -2,6 +2,7 @@ namespace DoctrineProxies\__CG__\App\Entity; + /** * DO NOT EDIT THIS FILE - IT WAS CREATED BY DOCTRINE'S PROXY GENERATOR */ diff --git a/server/doctrine-proxy/__CG__AppEntityCriteriaFamily.php b/server/doctrine-proxy/__CG__AppEntityCriteriaFamily.php index f8c224ad..f872b760 100644 --- a/server/doctrine-proxy/__CG__AppEntityCriteriaFamily.php +++ b/server/doctrine-proxy/__CG__AppEntityCriteriaFamily.php @@ -2,6 +2,7 @@ namespace DoctrineProxies\__CG__\App\Entity; + /** * DO NOT EDIT THIS FILE - IT WAS CREATED BY DOCTRINE'S PROXY GENERATOR */ diff --git a/server/doctrine-proxy/__CG__AppEntityDatabase.php b/server/doctrine-proxy/__CG__AppEntityDatabase.php index 29820260..f700d2ed 100644 --- a/server/doctrine-proxy/__CG__AppEntityDatabase.php +++ b/server/doctrine-proxy/__CG__AppEntityDatabase.php @@ -2,6 +2,7 @@ namespace DoctrineProxies\__CG__\App\Entity; + /** * DO NOT EDIT THIS FILE - IT WAS CREATED BY DOCTRINE'S PROXY GENERATOR */ diff --git a/server/doctrine-proxy/__CG__AppEntityDataset.php b/server/doctrine-proxy/__CG__AppEntityDataset.php index b4ef9b32..857d284e 100644 --- a/server/doctrine-proxy/__CG__AppEntityDataset.php +++ b/server/doctrine-proxy/__CG__AppEntityDataset.php @@ -2,6 +2,7 @@ namespace DoctrineProxies\__CG__\App\Entity; + /** * DO NOT EDIT THIS FILE - IT WAS CREATED BY DOCTRINE'S PROXY GENERATOR */ diff --git a/server/doctrine-proxy/__CG__AppEntityDatasetFamily.php b/server/doctrine-proxy/__CG__AppEntityDatasetFamily.php index c933fe64..1654475b 100644 --- a/server/doctrine-proxy/__CG__AppEntityDatasetFamily.php +++ b/server/doctrine-proxy/__CG__AppEntityDatasetFamily.php @@ -2,6 +2,7 @@ namespace DoctrineProxies\__CG__\App\Entity; + /** * DO NOT EDIT THIS FILE - IT WAS CREATED BY DOCTRINE'S PROXY GENERATOR */ diff --git a/server/doctrine-proxy/__CG__AppEntityGroup.php b/server/doctrine-proxy/__CG__AppEntityGroup.php index c8e25db7..d416c30c 100644 --- a/server/doctrine-proxy/__CG__AppEntityGroup.php +++ b/server/doctrine-proxy/__CG__AppEntityGroup.php @@ -2,6 +2,7 @@ namespace DoctrineProxies\__CG__\App\Entity; + /** * DO NOT EDIT THIS FILE - IT WAS CREATED BY DOCTRINE'S PROXY GENERATOR */ diff --git a/server/doctrine-proxy/__CG__AppEntityInstance.php b/server/doctrine-proxy/__CG__AppEntityInstance.php index 1c792170..6b47482b 100644 --- a/server/doctrine-proxy/__CG__AppEntityInstance.php +++ b/server/doctrine-proxy/__CG__AppEntityInstance.php @@ -2,6 +2,7 @@ namespace DoctrineProxies\__CG__\App\Entity; + /** * DO NOT EDIT THIS FILE - IT WAS CREATED BY DOCTRINE'S PROXY GENERATOR */ @@ -66,10 +67,10 @@ class Instance extends \App\Entity\Instance implements \Doctrine\ORM\Proxy\Proxy public function __sleep() { if ($this->__isInitialized__) { - return ['__isInitialized__', 'name', 'label', 'dataPath', 'config', 'datasetFamilies']; + return ['__isInitialized__', 'name', 'label', 'dataPath', 'designColor', 'designBackgroundColor', 'designLogo', 'designFavicon', 'homeComponent', 'homeComponentConfig', 'searchByCriteriaAllowed', 'searchByCriteriaLabel', 'searchMultipleAllowed', 'searchMultipleLabel', 'searchMultipleAllDatasetsSelected', 'documentationAllowed', 'documentationLabel', 'datasetFamilies']; } - return ['__isInitialized__', 'name', 'label', 'dataPath', 'config', 'datasetFamilies']; + return ['__isInitialized__', 'name', 'label', 'dataPath', 'designColor', 'designBackgroundColor', 'designLogo', 'designFavicon', 'homeComponent', 'homeComponentConfig', 'searchByCriteriaAllowed', 'searchByCriteriaLabel', 'searchMultipleAllowed', 'searchMultipleLabel', 'searchMultipleAllDatasetsSelected', 'documentationAllowed', 'documentationLabel', 'datasetFamilies']; } /** @@ -238,23 +239,287 @@ class Instance extends \App\Entity\Instance implements \Doctrine\ORM\Proxy\Proxy /** * {@inheritDoc} */ - public function getConfig() + public function getDesignColor() + { + + $this->__initializer__ && $this->__initializer__->__invoke($this, 'getDesignColor', []); + + return parent::getDesignColor(); + } + + /** + * {@inheritDoc} + */ + public function setDesignColor($designColor) + { + + $this->__initializer__ && $this->__initializer__->__invoke($this, 'setDesignColor', [$designColor]); + + return parent::setDesignColor($designColor); + } + + /** + * {@inheritDoc} + */ + public function getDesignBackgroundColor() + { + + $this->__initializer__ && $this->__initializer__->__invoke($this, 'getDesignBackgroundColor', []); + + return parent::getDesignBackgroundColor(); + } + + /** + * {@inheritDoc} + */ + public function setDesignBackgroundColor($designBackgroundColor) + { + + $this->__initializer__ && $this->__initializer__->__invoke($this, 'setDesignBackgroundColor', [$designBackgroundColor]); + + return parent::setDesignBackgroundColor($designBackgroundColor); + } + + /** + * {@inheritDoc} + */ + public function getDesignLogo() + { + + $this->__initializer__ && $this->__initializer__->__invoke($this, 'getDesignLogo', []); + + return parent::getDesignLogo(); + } + + /** + * {@inheritDoc} + */ + public function setDesignLogo($designLogo) + { + + $this->__initializer__ && $this->__initializer__->__invoke($this, 'setDesignLogo', [$designLogo]); + + return parent::setDesignLogo($designLogo); + } + + /** + * {@inheritDoc} + */ + public function getDesignFavicon() + { + + $this->__initializer__ && $this->__initializer__->__invoke($this, 'getDesignFavicon', []); + + return parent::getDesignFavicon(); + } + + /** + * {@inheritDoc} + */ + public function setDesignFavicon($designFavicon) + { + + $this->__initializer__ && $this->__initializer__->__invoke($this, 'setDesignFavicon', [$designFavicon]); + + return parent::setDesignFavicon($designFavicon); + } + + /** + * {@inheritDoc} + */ + public function getHomeComponent() + { + + $this->__initializer__ && $this->__initializer__->__invoke($this, 'getHomeComponent', []); + + return parent::getHomeComponent(); + } + + /** + * {@inheritDoc} + */ + public function setHomeComponent($homeComponent) + { + + $this->__initializer__ && $this->__initializer__->__invoke($this, 'setHomeComponent', [$homeComponent]); + + return parent::setHomeComponent($homeComponent); + } + + /** + * {@inheritDoc} + */ + public function getHomeComponentConfig() + { + + $this->__initializer__ && $this->__initializer__->__invoke($this, 'getHomeComponentConfig', []); + + return parent::getHomeComponentConfig(); + } + + /** + * {@inheritDoc} + */ + public function setHomeComponentConfig($homeComponentConfig) + { + + $this->__initializer__ && $this->__initializer__->__invoke($this, 'setHomeComponentConfig', [$homeComponentConfig]); + + return parent::setHomeComponentConfig($homeComponentConfig); + } + + /** + * {@inheritDoc} + */ + public function getSearchByCriteriaAllowed() + { + + $this->__initializer__ && $this->__initializer__->__invoke($this, 'getSearchByCriteriaAllowed', []); + + return parent::getSearchByCriteriaAllowed(); + } + + /** + * {@inheritDoc} + */ + public function setSearchByCriteriaAllowed($searchByCriteriaAllowed) + { + + $this->__initializer__ && $this->__initializer__->__invoke($this, 'setSearchByCriteriaAllowed', [$searchByCriteriaAllowed]); + + return parent::setSearchByCriteriaAllowed($searchByCriteriaAllowed); + } + + /** + * {@inheritDoc} + */ + public function getSearchByCriteriaLabel() + { + + $this->__initializer__ && $this->__initializer__->__invoke($this, 'getSearchByCriteriaLabel', []); + + return parent::getSearchByCriteriaLabel(); + } + + /** + * {@inheritDoc} + */ + public function setSearchByCriteriaLabel($searchByCriteriaLabel) + { + + $this->__initializer__ && $this->__initializer__->__invoke($this, 'setSearchByCriteriaLabel', [$searchByCriteriaLabel]); + + return parent::setSearchByCriteriaLabel($searchByCriteriaLabel); + } + + /** + * {@inheritDoc} + */ + public function getSearchMultipleAllowed() + { + + $this->__initializer__ && $this->__initializer__->__invoke($this, 'getSearchMultipleAllowed', []); + + return parent::getSearchMultipleAllowed(); + } + + /** + * {@inheritDoc} + */ + public function setSearchMultipleAllowed($searchMultipleAllowed) + { + + $this->__initializer__ && $this->__initializer__->__invoke($this, 'setSearchMultipleAllowed', [$searchMultipleAllowed]); + + return parent::setSearchMultipleAllowed($searchMultipleAllowed); + } + + /** + * {@inheritDoc} + */ + public function getSearchMultipleLabel() + { + + $this->__initializer__ && $this->__initializer__->__invoke($this, 'getSearchMultipleLabel', []); + + return parent::getSearchMultipleLabel(); + } + + /** + * {@inheritDoc} + */ + public function setSearchMultipleLabel($searchMultipleLabel) + { + + $this->__initializer__ && $this->__initializer__->__invoke($this, 'setSearchMultipleLabel', [$searchMultipleLabel]); + + return parent::setSearchMultipleLabel($searchMultipleLabel); + } + + /** + * {@inheritDoc} + */ + public function getSearchMultipleAllDatasetsSelected() + { + + $this->__initializer__ && $this->__initializer__->__invoke($this, 'getSearchMultipleAllDatasetsSelected', []); + + return parent::getSearchMultipleAllDatasetsSelected(); + } + + /** + * {@inheritDoc} + */ + public function setSearchMultipleAllDatasetsSelected($searchMultipleAllDatasetsSelected) + { + + $this->__initializer__ && $this->__initializer__->__invoke($this, 'setSearchMultipleAllDatasetsSelected', [$searchMultipleAllDatasetsSelected]); + + return parent::setSearchMultipleAllDatasetsSelected($searchMultipleAllDatasetsSelected); + } + + /** + * {@inheritDoc} + */ + public function getDocumentationAllowed() + { + + $this->__initializer__ && $this->__initializer__->__invoke($this, 'getDocumentationAllowed', []); + + return parent::getDocumentationAllowed(); + } + + /** + * {@inheritDoc} + */ + public function setDocumentationAllowed($documentationAllowed) + { + + $this->__initializer__ && $this->__initializer__->__invoke($this, 'setDocumentationAllowed', [$documentationAllowed]); + + return parent::setDocumentationAllowed($documentationAllowed); + } + + /** + * {@inheritDoc} + */ + public function getDocumentationLabel() { - $this->__initializer__ && $this->__initializer__->__invoke($this, 'getConfig', []); + $this->__initializer__ && $this->__initializer__->__invoke($this, 'getDocumentationLabel', []); - return parent::getConfig(); + return parent::getDocumentationLabel(); } /** * {@inheritDoc} */ - public function setConfig($config) + public function setDocumentationLabel($documentationLabel) { - $this->__initializer__ && $this->__initializer__->__invoke($this, 'setConfig', [$config]); + $this->__initializer__ && $this->__initializer__->__invoke($this, 'setDocumentationLabel', [$documentationLabel]); - return parent::setConfig($config); + return parent::setDocumentationLabel($documentationLabel); } /** diff --git a/server/doctrine-proxy/__CG__AppEntityOption.php b/server/doctrine-proxy/__CG__AppEntityOption.php index 10bf9bfc..f101582d 100644 --- a/server/doctrine-proxy/__CG__AppEntityOption.php +++ b/server/doctrine-proxy/__CG__AppEntityOption.php @@ -2,6 +2,7 @@ namespace DoctrineProxies\__CG__\App\Entity; + /** * DO NOT EDIT THIS FILE - IT WAS CREATED BY DOCTRINE'S PROXY GENERATOR */ diff --git a/server/doctrine-proxy/__CG__AppEntityOutputCategory.php b/server/doctrine-proxy/__CG__AppEntityOutputCategory.php index 697217f5..95d24126 100644 --- a/server/doctrine-proxy/__CG__AppEntityOutputCategory.php +++ b/server/doctrine-proxy/__CG__AppEntityOutputCategory.php @@ -2,6 +2,7 @@ namespace DoctrineProxies\__CG__\App\Entity; + /** * DO NOT EDIT THIS FILE - IT WAS CREATED BY DOCTRINE'S PROXY GENERATOR */ diff --git a/server/doctrine-proxy/__CG__AppEntityOutputFamily.php b/server/doctrine-proxy/__CG__AppEntityOutputFamily.php index 0faa5bac..14fe15d5 100644 --- a/server/doctrine-proxy/__CG__AppEntityOutputFamily.php +++ b/server/doctrine-proxy/__CG__AppEntityOutputFamily.php @@ -2,6 +2,7 @@ namespace DoctrineProxies\__CG__\App\Entity; + /** * DO NOT EDIT THIS FILE - IT WAS CREATED BY DOCTRINE'S PROXY GENERATOR */ diff --git a/server/doctrine-proxy/__CG__AppEntitySelect.php b/server/doctrine-proxy/__CG__AppEntitySelect.php index 88871e34..00df2306 100644 --- a/server/doctrine-proxy/__CG__AppEntitySelect.php +++ b/server/doctrine-proxy/__CG__AppEntitySelect.php @@ -2,6 +2,7 @@ namespace DoctrineProxies\__CG__\App\Entity; + /** * DO NOT EDIT THIS FILE - IT WAS CREATED BY DOCTRINE'S PROXY GENERATOR */ diff --git a/server/doctrine-proxy/__CG__AppEntitySurvey.php b/server/doctrine-proxy/__CG__AppEntitySurvey.php index 75107381..aa093651 100644 --- a/server/doctrine-proxy/__CG__AppEntitySurvey.php +++ b/server/doctrine-proxy/__CG__AppEntitySurvey.php @@ -2,6 +2,7 @@ namespace DoctrineProxies\__CG__\App\Entity; + /** * DO NOT EDIT THIS FILE - IT WAS CREATED BY DOCTRINE'S PROXY GENERATOR */ diff --git a/server/src/Action/InstanceAction.php b/server/src/Action/InstanceAction.php index 82442eb8..b06de54e 100644 --- a/server/src/Action/InstanceAction.php +++ b/server/src/Action/InstanceAction.php @@ -60,7 +60,7 @@ final class InstanceAction extends AbstractAction $parsedBody = $request->getParsedBody(); // If mandatories empty fields 400 - foreach (array('label', 'data_path') as $a) { + foreach (array('label') as $a) { if ($this->isEmptyField($a, $parsedBody)) { throw new HttpBadRequestException( $request, @@ -93,8 +93,21 @@ final class InstanceAction extends AbstractAction private function editInstance(Instance $instance, array $parsedBody): void { $instance->setLabel($parsedBody['label']); - $instance->setConfig($parsedBody['config']); $instance->setDataPath($parsedBody['data_path']); + $instance->setDesignColor($parsedBody['design_color']); + $instance->setDesignBackgroundColor($parsedBody['design_background_color']); + $instance->setDesignLogo($parsedBody['design_logo']); + $instance->setDesignFavicon($parsedBody['design_favicon']); + $instance->setHomeComponent($parsedBody['home_component']); + $instance->setHomeComponentConfig($parsedBody['home_component_config']); + $instance->setSearchByCriteriaAllowed($parsedBody['search_by_criteria_allowed']); + $instance->setSearchByCriteriaLabel($parsedBody['search_by_criteria_label']); + $instance->setSearchMultipleAllowed($parsedBody['search_multiple_allowed']); + $instance->setSearchMultipleLabel($parsedBody['search_multiple_label']); + $instance->setSearchMultipleAllDatasetsSelected($parsedBody['search_multiple_all_datasets_selected']); + $instance->setDocumentationAllowed($parsedBody['documentation_allowed']); + $instance->setDocumentationLabel($parsedBody['documentation_label']); + $this->em->flush(); } } diff --git a/server/src/Action/InstanceListAction.php b/server/src/Action/InstanceListAction.php index 9e226441..7e7dae41 100644 --- a/server/src/Action/InstanceListAction.php +++ b/server/src/Action/InstanceListAction.php @@ -48,7 +48,7 @@ final class InstanceListAction extends AbstractAction $parsedBody = $request->getParsedBody(); // To work this action needs user information to update - foreach (array('name', 'label', 'data_path') as $a) { + foreach (array('name', 'label') as $a) { if ($this->isEmptyField($a, $parsedBody)) { throw new HttpBadRequestException( $request, @@ -76,8 +76,20 @@ final class InstanceListAction extends AbstractAction private function postInstance(array $parsedBody): Instance { $instance = new Instance($parsedBody['name'], $parsedBody['label']); - $instance->setConfig($parsedBody['config']); $instance->setDataPath($parsedBody['data_path']); + $instance->setDesignColor($parsedBody['design_color']); + $instance->setDesignBackgroundColor($parsedBody['design_background_color']); + $instance->setDesignLogo($parsedBody['design_logo']); + $instance->setDesignFavicon($parsedBody['design_favicon']); + $instance->setHomeComponent($parsedBody['home_component']); + $instance->setHomeComponentConfig($parsedBody['home_component_config']); + $instance->setSearchByCriteriaAllowed($parsedBody['search_by_criteria_allowed']); + $instance->setSearchByCriteriaLabel($parsedBody['search_by_criteria_label']); + $instance->setSearchMultipleAllowed($parsedBody['search_multiple_allowed']); + $instance->setSearchMultipleLabel($parsedBody['search_multiple_label']); + $instance->setSearchMultipleAllDatasetsSelected($parsedBody['search_multiple_all_datasets_selected']); + $instance->setDocumentationAllowed($parsedBody['documentation_allowed']); + $instance->setDocumentationLabel($parsedBody['documentation_label']); $this->em->persist($instance); $this->em->flush(); diff --git a/server/src/Entity/Instance.php b/server/src/Entity/Instance.php index e0e6f385..fac4540e 100644 --- a/server/src/Entity/Instance.php +++ b/server/src/Entity/Instance.php @@ -48,9 +48,93 @@ class Instance implements \JsonSerializable /** * @var string * - * @Column(type="json", nullable=true) + * @Column(type="string", name="design_color", nullable=true) */ - protected $config; + protected $designColor; + + /** + * @var string + * + * @Column(type="string", name="design_background_color", nullable=true) + */ + protected $designBackgroundColor; + + /** + * @var string + * + * @Column(type="string", name="design_logo", nullable=true) + */ + protected $designLogo; + + /** + * @var string + * + * @Column(type="string", name="design_favicon", nullable=true) + */ + protected $designFavicon; + + /** + * @var string + * + * @Column(type="string", name="home_component", nullable=true) + */ + protected $homeComponent; + + /** + * @var array + * + * @Column(type="json", name="home_component_config", nullable=true) + */ + protected $homeComponentConfig; + + /** + * @var bool + * + * @Column(type="boolean", name="search_by_criteria_allowed", nullable=false) + */ + protected $searchByCriteriaAllowed; + + /** + * @var string + * + * @Column(type="string", name="search_by_criteria_label", nullable=false) + */ + protected $searchByCriteriaLabel; + + /** + * @var bool + * + * @Column(type="boolean", name="search_multiple_allowed", nullable=false) + */ + protected $searchMultipleAllowed; + + /** + * @var string + * + * @Column(type="string", name="search_multiple_label", nullable=false) + */ + protected $searchMultipleLabel; + + /** + * @var bool + * + * @Column(type="boolean", name="search_multiple_all_datasets_selected", nullable=false) + */ + protected $searchMultipleAllDatasetsSelected; + + /** + * @var bool + * + * @Column(type="boolean", name="documentation_allowed", nullable=false) + */ + protected $documentationAllowed; + + /** + * @var string + * + * @Column(type="string", name="documentation_label", nullable=false) + */ + protected $documentationLabel; /** * @var DatasetFamily[] @@ -91,14 +175,134 @@ class Instance implements \JsonSerializable $this->dataPath = $dataPath; } - public function getConfig() + public function getDesignColor() + { + return $this->designColor; + } + + public function setDesignColor($designColor) + { + $this->designColor = $designColor; + } + + public function getDesignBackgroundColor() + { + return $this->designBackgroundColor; + } + + public function setDesignBackgroundColor($designBackgroundColor) + { + $this->designBackgroundColor = $designBackgroundColor; + } + + public function getDesignLogo() + { + return $this->designLogo; + } + + public function setDesignLogo($designLogo) + { + $this->designLogo = $designLogo; + } + + public function getDesignFavicon() + { + return $this->designFavicon; + } + + public function setDesignFavicon($designFavicon) + { + $this->designFavicon = $designFavicon; + } + + public function getHomeComponent() + { + return $this->homeComponent; + } + + public function setHomeComponent($homeComponent) + { + $this->homeComponent = $homeComponent; + } + + public function getHomeComponentConfig() + { + return $this->homeComponentConfig; + } + + public function setHomeComponentConfig($homeComponentConfig) + { + $this->homeComponentConfig = $homeComponentConfig; + } + + public function getSearchByCriteriaAllowed() + { + return $this->searchByCriteriaAllowed; + } + + public function setSearchByCriteriaAllowed($searchByCriteriaAllowed) + { + $this->searchByCriteriaAllowed = $searchByCriteriaAllowed; + } + + public function getSearchByCriteriaLabel() + { + return $this->searchByCriteriaLabel; + } + + public function setSearchByCriteriaLabel($searchByCriteriaLabel) + { + $this->searchByCriteriaLabel = $searchByCriteriaLabel; + } + + public function getSearchMultipleAllowed() + { + return $this->searchMultipleAllowed; + } + + public function setSearchMultipleAllowed($searchMultipleAllowed) + { + $this->searchMultipleAllowed = $searchMultipleAllowed; + } + + public function getSearchMultipleLabel() + { + return $this->searchMultipleLabel; + } + + public function setSearchMultipleLabel($searchMultipleLabel) + { + $this->searchMultipleLabel = $searchMultipleLabel; + } + + public function getSearchMultipleAllDatasetsSelected() + { + return $this->searchMultipleAllDatasetsSelected; + } + + public function setSearchMultipleAllDatasetsSelected($searchMultipleAllDatasetsSelected) + { + $this->searchMultipleAllDatasetsSelected = $searchMultipleAllDatasetsSelected; + } + + public function getDocumentationAllowed() + { + return $this->documentationAllowed; + } + + public function setDocumentationAllowed($documentationAllowed) + { + $this->documentationAllowed = $documentationAllowed; + } + + public function getDocumentationLabel() { - return $this->config; + return $this->documentationLabel; } - public function setConfig($config) + public function setDocumentationLabel($documentationLabel) { - $this->config = $config; + $this->documentationLabel = $documentationLabel; } public function getDatasetFamilies() @@ -121,7 +325,19 @@ class Instance implements \JsonSerializable 'name' => $this->getName(), 'label' => $this->getLabel(), 'data_path' => $this->getDataPath(), - 'config' => $this->getConfig(), + 'design_color' => $this->getDesignColor(), + 'design_background_color' => $this->getDesignBackgroundColor(), + 'design_logo' => $this->getDesignLogo(), + 'designFavicon' => $this->getDesignFavicon(), + 'home_component' => $this->getHomeComponent(), + 'home_component_config' => $this->getHomeComponentConfig(), + 'search_by_criteria_allowed' => $this->getSearchByCriteriaAllowed(), + 'search_by_criteria_label' => $this->getSearchByCriteriaLabel(), + 'search_multiple_allowed' => $this->getSearchMultipleAllowed(), + 'search_multiple_label' => $this->getSearchMultipleLabel(), + 'search_multiple_all_datasets_selected' => $this->getSearchMultipleAllDatasetsSelected(), + 'documentation_allowed' => $this->getDocumentationAllowed(), + 'documentation_label' => $this->getDocumentationLabel(), 'nb_dataset_families' => count($this->getDatasetFamilies()), 'nb_datasets' => $this->getNbDatasets() ]; -- GitLab