Skip to content

Commit

Permalink
Show/Hide Features settings (#128)
Browse files Browse the repository at this point in the history
  • Loading branch information
salmma authored Apr 22, 2021
1 parent eccab0b commit ad34482
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 12 deletions.
3 changes: 2 additions & 1 deletion .docker/features.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"nisqAnalyzer": "true",
"qprov": "true",
"patternAtlas": "true",
"nisqAnalyzerCompilerComparison": "true"
"nisqAnalyzerCompilerComparison": "true",
"showSettings": "true"
}
}
19 changes: 16 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -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 <http://localhost:4200>. The app will automatically reload if you change any of the source files.

## Code scaffolding

Expand Down
22 changes: 15 additions & 7 deletions src/app/components/feature-toggling/feature-toggling.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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!'
);
}
}
}
4 changes: 3 additions & 1 deletion src/app/components/navigation/navigation.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,9 @@
<span class="pl-3">Compute Resource Property Types</span>
</a>
</div>
<a mat-list-item (click)="executionEnvironmentCollapseContent.hide(); minorComponentsCollapse.hide()" [routerLink]="'./feature-toggling'" routerLinkActive="routerLinkActive">
<a *ngIf="configData.configuration.features.showSettings"
mat-list-item (click)="executionEnvironmentCollapseContent.hide(); minorComponentsCollapse.hide()"
[routerLink]="'./feature-toggling'" routerLinkActive="routerLinkActive">
Settings
</a>
</mat-nav-list>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ export enum UiFeatures {
QPROV = 'qprov',
PATTERN_ATLAS = 'patternAtlas',
NISQ_ANALYZER_COMPILER_COMPARISON = 'nisqAnalyzerCompilerComparison',
SHOW_SETTINGS = 'showSettings',
}

export interface QcAtlasUiConfiguration {
Expand All @@ -17,6 +18,7 @@ export interface QcAtlasUiConfiguration {
qprov: boolean;
patternAtlas: boolean;
nisqAnalyzerCompilerComparison: boolean;
showSettings: boolean;
};
}

Expand All @@ -40,6 +42,7 @@ const initialValues: QcAtlasUiConfiguration = {
qprov: false,
patternAtlas: false,
nisqAnalyzerCompilerComparison: false,
showSettings: false,
},
};

Expand Down

0 comments on commit ad34482

Please sign in to comment.