diff --git a/src/app/components/group-warning/group-warning.component.html b/src/app/components/group-warning/group-warning.component.html new file mode 100644 index 0000000000000000000000000000000000000000..1b0fd9421fe194e4f74992593a5e0f2be866c77f --- /dev/null +++ b/src/app/components/group-warning/group-warning.component.html @@ -0,0 +1,4 @@ +<div id="parser-issue-banner" *ngIf="!getClosedState()" class="center notification" style="background-color: rgba(255,41,41,0.6);"> + <button class="delete" (click)="close()"></button> + <span class="px-6">Missing network groups: {{getGroupString()}} .Please contact the page developer to get this issue resolved or check the browser console.</span> +</div> diff --git a/src/app/components/group-warning/group-warning.component.scss b/src/app/components/group-warning/group-warning.component.scss new file mode 100644 index 0000000000000000000000000000000000000000..87cf4e798907a307e4ca6dd693bea7592638a3b3 --- /dev/null +++ b/src/app/components/group-warning/group-warning.component.scss @@ -0,0 +1,13 @@ +@import "src/stylesheets/variables"; + +#parser-issue-banner{ + position: absolute; + bottom: 0; + z-index: $parser-issue-banner-z; + width: 100%; + padding-left: 0; + padding-right: 0; + &.disabled { + display: none; + } +} diff --git a/src/app/components/group-warning/group-warning.component.spec.ts b/src/app/components/group-warning/group-warning.component.spec.ts new file mode 100644 index 0000000000000000000000000000000000000000..1d346acaa20cfa3a15cd833dbb3d237e61cb8cd6 --- /dev/null +++ b/src/app/components/group-warning/group-warning.component.spec.ts @@ -0,0 +1,25 @@ +import { ComponentFixture, TestBed } from '@angular/core/testing'; + +import { GroupWarningComponent } from './group-warning.component'; + +describe('GroupWarningComponent', () => { + let component: GroupWarningComponent; + let fixture: ComponentFixture<GroupWarningComponent>; + + beforeEach(async () => { + await TestBed.configureTestingModule({ + declarations: [ GroupWarningComponent ] + }) + .compileComponents(); + }); + + beforeEach(() => { + fixture = TestBed.createComponent(GroupWarningComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/components/group-warning/group-warning.component.ts b/src/app/components/group-warning/group-warning.component.ts new file mode 100644 index 0000000000000000000000000000000000000000..947a4601ea5f90d0493ae37bd75aff079fbe8033 --- /dev/null +++ b/src/app/components/group-warning/group-warning.component.ts @@ -0,0 +1,31 @@ +import {Component, OnInit} from '@angular/core'; +import {DrugstoneConfigService} from '../../services/drugstone-config/drugstone-config.service'; + +@Component({ + selector: 'app-group-warning', + templateUrl: './group-warning.component.html', + styleUrls: ['./group-warning.component.scss'] +}) +export class GroupWarningComponent implements OnInit { + + constructor(public drugstoneConfig: DrugstoneConfigService) { + } + + ngOnInit(): void { + + } + + getClosedState() { + return !this.drugstoneConfig.groupIssue; + } + + getGroupString() { + let str = ''; + this.drugstoneConfig.groupIssueList.forEach(g => str += (g + ', ')); + return str.substring(0, str.length - 2); + } + + close() { + this.drugstoneConfig.groupIssue = false; + } +} diff --git a/src/app/components/parser-warning/parser-warning.component.html b/src/app/components/parser-warning/parser-warning.component.html new file mode 100644 index 0000000000000000000000000000000000000000..a632d5c55a4327b70a586662bc5d6194c4665059 --- /dev/null +++ b/src/app/components/parser-warning/parser-warning.component.html @@ -0,0 +1,4 @@ +<div id="parser-issue-banner" *ngIf="!getClosedState()" class="center notification" style="background-color: rgba(255,41,41,0.6);"> + <button *ngIf="!drugstoneConfig.parsingIssueNetwork" class="delete" (click)="close()"></button> + <span class="px-6">Issue while parsing JSON: {{getConfigs()}}. Please contact the page developer to get this issue resolved or check the browser console.</span> +</div> diff --git a/src/app/components/parser-warning/parser-warning.component.scss b/src/app/components/parser-warning/parser-warning.component.scss new file mode 100644 index 0000000000000000000000000000000000000000..87cf4e798907a307e4ca6dd693bea7592638a3b3 --- /dev/null +++ b/src/app/components/parser-warning/parser-warning.component.scss @@ -0,0 +1,13 @@ +@import "src/stylesheets/variables"; + +#parser-issue-banner{ + position: absolute; + bottom: 0; + z-index: $parser-issue-banner-z; + width: 100%; + padding-left: 0; + padding-right: 0; + &.disabled { + display: none; + } +} diff --git a/src/app/components/parser-warning/parser-warning.component.spec.ts b/src/app/components/parser-warning/parser-warning.component.spec.ts new file mode 100644 index 0000000000000000000000000000000000000000..1181ba99590c570ac3cf8cc8fbd7dc59466bf793 --- /dev/null +++ b/src/app/components/parser-warning/parser-warning.component.spec.ts @@ -0,0 +1,25 @@ +import { ComponentFixture, TestBed } from '@angular/core/testing'; + +import { ParserWarningComponent } from './parser-warning.component'; + +describe('ParserWarningComponent', () => { + let component: ParserWarningComponent; + let fixture: ComponentFixture<ParserWarningComponent>; + + beforeEach(async () => { + await TestBed.configureTestingModule({ + declarations: [ ParserWarningComponent ] + }) + .compileComponents(); + }); + + beforeEach(() => { + fixture = TestBed.createComponent(ParserWarningComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/components/parser-warning/parser-warning.component.ts b/src/app/components/parser-warning/parser-warning.component.ts new file mode 100644 index 0000000000000000000000000000000000000000..4dbec4366da8e065ed743c62ac4f4ecc2e23d395 --- /dev/null +++ b/src/app/components/parser-warning/parser-warning.component.ts @@ -0,0 +1,40 @@ +import {Component, OnInit} from '@angular/core'; +import {DrugstoneConfigService} from '../../services/drugstone-config/drugstone-config.service'; + +@Component({ + selector: 'app-parser-warning', + templateUrl: './parser-warning.component.html', + styleUrls: ['./parser-warning.component.scss'] +}) +export class ParserWarningComponent implements OnInit { + constructor(public drugstoneConfig: DrugstoneConfigService) { + } + + ngOnInit(): void { + + } + + getClosedState() { + return this.drugstoneConfig.groupIssue || !(this.drugstoneConfig.parsingIssueGroups || this.drugstoneConfig.parsingIssueConfig || this.drugstoneConfig.parsingIssueNetwork); + } + + getConfigs() { + let out = ''; + if (this.drugstoneConfig.parsingIssueNetwork) { + out += 'network, '; + } + if (this.drugstoneConfig.parsingIssueConfig) { + out += 'config, '; + } + if (this.drugstoneConfig.parsingIssueGroups) { + out += 'groups, '; + } + return out.substring(0, out.length - 2); + } + + close() { + this.drugstoneConfig.parsingIssueConfig = false; + this.drugstoneConfig.parsingIssueGroups = false; + } + +}