From ad34482d9d8c521ec9880360fc9c251dd9ee8841 Mon Sep 17 00:00:00 2001 From: Marie Salm Date: Thu, 22 Apr 2021 13:56:02 +0200 Subject: [PATCH] Show/Hide Features settings (#128) --- .docker/features.json | 3 ++- README.md | 19 +++++++++++++--- .../feature-toggling.component.ts | 22 +++++++++++++------ .../navigation/navigation.component.html | 4 +++- ...las-ui-repository-configuration.service.ts | 3 +++ 5 files changed, 39 insertions(+), 12 deletions(-) diff --git a/.docker/features.json b/.docker/features.json index 2ecac56d..73219bf6 100644 --- a/.docker/features.json +++ b/.docker/features.json @@ -3,6 +3,7 @@ "nisqAnalyzer": "true", "qprov": "true", "patternAtlas": "true", - "nisqAnalyzerCompilerComparison": "true" + "nisqAnalyzerCompilerComparison": "true", + "showSettings": "true" } } diff --git a/README.md b/README.md index c36428f3..42a8dde0 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,23 @@ -# QcAtlasUi +# QC Atlas UI -This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 9.0.2. +[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0) + +User Interface for the QuAntiL Environment supporting + - [QC Atlas](https://github.com/UST-QuAntiL/qc-atlas) + - [LaTeX Renderer](https://github.com/UST-QuAntiL/latex-renderer) + - [NISQ Analyzer](https://github.com/UST-QuAntiL/nisq-analyzer) + - [Pattern Atlas](https://github.com/PatternAtlas/pattern-atlas-api) + - [QProv](https://github.com/UST-QuAntiL/qprov) + +A detailed user guide and documentation can be found [here](https://quantil.readthedocs.io/en/latest/). + +For running the UI with all its backend components, visit [quantil-docker](https://github.com/UST-QuAntiL/quantil-docker). + +The UI was generated with [Angular CLI](https://github.com/angular/angular-cli) version 9.0.2. ## Development server -Run `ng serve` for a dev server. Navigate to `http://localhost:80/`. The app will automatically reload if you change any of the source files. +Run `ng serve` for a dev server. Navigate to . The app will automatically reload if you change any of the source files. ## Code scaffolding diff --git a/src/app/components/feature-toggling/feature-toggling.component.ts b/src/app/components/feature-toggling/feature-toggling.component.ts index 7b7d4156..c08f8c0d 100644 --- a/src/app/components/feature-toggling/feature-toggling.component.ts +++ b/src/app/components/feature-toggling/feature-toggling.component.ts @@ -35,12 +35,20 @@ export class FeatureTogglingComponent implements OnInit { } toggleFeature(feature: UiFeatures, event: Event): void { - this.configService.applyConfig(feature, event.target['checked']).subscribe( - () => this.utilService.callSnackBar('Successfully saved config!'), - (error: HttpErrorResponse) => - this.utilService.callSnackBar( - 'Error while saving config!' + error.message - ) - ); + if (this.config.features.showSettings) { + this.configService + .applyConfig(feature, event.target['checked']) + .subscribe( + () => this.utilService.callSnackBar('Successfully saved config!'), + (error: HttpErrorResponse) => + this.utilService.callSnackBar( + 'Error while saving config!' + error.message + ) + ); + } else { + this.utilService.callSnackBar( + 'Adjustments are not allowed and will not be saved!' + ); + } } } diff --git a/src/app/components/navigation/navigation.component.html b/src/app/components/navigation/navigation.component.html index 0add3476..d92d6cb3 100644 --- a/src/app/components/navigation/navigation.component.html +++ b/src/app/components/navigation/navigation.component.html @@ -59,7 +59,9 @@ Compute Resource Property Types - + Settings diff --git a/src/app/directives/qc-atlas-ui-repository-configuration.service.ts b/src/app/directives/qc-atlas-ui-repository-configuration.service.ts index 83f0fa8a..d6aa7b86 100644 --- a/src/app/directives/qc-atlas-ui-repository-configuration.service.ts +++ b/src/app/directives/qc-atlas-ui-repository-configuration.service.ts @@ -9,6 +9,7 @@ export enum UiFeatures { QPROV = 'qprov', PATTERN_ATLAS = 'patternAtlas', NISQ_ANALYZER_COMPILER_COMPARISON = 'nisqAnalyzerCompilerComparison', + SHOW_SETTINGS = 'showSettings', } export interface QcAtlasUiConfiguration { @@ -17,6 +18,7 @@ export interface QcAtlasUiConfiguration { qprov: boolean; patternAtlas: boolean; nisqAnalyzerCompilerComparison: boolean; + showSettings: boolean; }; } @@ -40,6 +42,7 @@ const initialValues: QcAtlasUiConfiguration = { qprov: false, patternAtlas: false, nisqAnalyzerCompilerComparison: false, + showSettings: false, }, };