Skip to content
Snippets Groups Projects
Commit db122ce2 authored by AndiMajore's avatar AndiMajore
Browse files

added missing components for config error handling

parent b194e798
No related branches found
No related tags found
No related merge requests found
<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>
@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;
}
}
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();
});
});
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;
}
}
<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>
@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;
}
}
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();
});
});
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;
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment