;
-
- beforeEach(async(() => {
- TestBed.configureTestingModule({
- declarations: [ ProtocolBuilderComponent ]
- })
- .compileComponents();
- }));
-
- beforeEach(() => {
- fixture = TestBed.createComponent(ProtocolBuilderComponent);
- component = fixture.componentInstance;
- fixture.detectChanges();
- });
-
- it('should create', () => {
- expect(component).toBeTruthy();
- });
-});
diff --git a/src/app/protocol-builder/protocol-builder.component.ts b/src/app/protocol-builder/protocol-builder.component.ts
deleted file mode 100644
index 770a186..0000000
--- a/src/app/protocol-builder/protocol-builder.component.ts
+++ /dev/null
@@ -1,15 +0,0 @@
-import { Component, OnInit } from '@angular/core';
-
-@Component({
- selector: 'app-protocol-builder',
- templateUrl: './protocol-builder.component.html',
- styleUrls: ['./protocol-builder.component.scss']
-})
-export class ProtocolBuilderComponent implements OnInit {
-
- constructor() { }
-
- ngOnInit(): void {
- }
-
-}
diff --git a/src/app/settings.service.spec.ts b/src/app/settings.service.spec.ts
new file mode 100644
index 0000000..359cb6b
--- /dev/null
+++ b/src/app/settings.service.spec.ts
@@ -0,0 +1,16 @@
+import { TestBed } from '@angular/core/testing';
+
+import { SettingsService } from './settings.service';
+
+describe('SettingsService', () => {
+ let service: SettingsService;
+
+ beforeEach(() => {
+ TestBed.configureTestingModule({});
+ service = TestBed.inject(SettingsService);
+ });
+
+ it('should be created', () => {
+ expect(service).toBeTruthy();
+ });
+});
diff --git a/src/app/settings.service.ts b/src/app/settings.service.ts
new file mode 100644
index 0000000..6b4bb3d
--- /dev/null
+++ b/src/app/settings.service.ts
@@ -0,0 +1,24 @@
+import { Injectable } from '@angular/core';
+
+@Injectable({
+ providedIn: 'root'
+})
+export class SettingsService {
+
+ private studyIdKey = 'study_id';
+
+ constructor() { }
+
+ setStudyIdForValidation(id: number) {
+ localStorage.setItem(this.studyIdKey, id.toString());
+ }
+
+ getStudyIdForValidation() {
+ const value = localStorage.getItem(this.studyIdKey);
+ if (value) {
+ return parseInt(value, 10);
+ } else {
+ return null;
+ }
+ }
+}
diff --git a/src/app/settings/settings.component.html b/src/app/settings/settings.component.html
new file mode 100644
index 0000000..d027479
--- /dev/null
+++ b/src/app/settings/settings.component.html
@@ -0,0 +1,14 @@
+
+
Settings
+
+ Validation Settings
+
+ Select Study
+ Here you can specify a default study to use when performing validation.
+
+
+ {{s.id}} - {{s.title}}
+
+
+
+
diff --git a/src/app/protocol-builder/protocol-builder.component.scss b/src/app/settings/settings.component.scss
similarity index 100%
rename from src/app/protocol-builder/protocol-builder.component.scss
rename to src/app/settings/settings.component.scss
diff --git a/src/app/settings/settings.component.spec.ts b/src/app/settings/settings.component.spec.ts
new file mode 100644
index 0000000..ecc88c4
--- /dev/null
+++ b/src/app/settings/settings.component.spec.ts
@@ -0,0 +1,39 @@
+import { async, ComponentFixture, TestBed } from '@angular/core/testing';
+
+import { SettingsComponent } from './settings.component';
+import {HttpClient} from '@angular/common/http';
+import {FakeMatIconRegistry} from '@angular/material/icon/testing';
+import {ApiService, MockEnvironment} from 'sartography-workflow-lib';
+import {APP_BASE_HREF} from '@angular/common';
+import {HttpClientTestingModule} from '@angular/common/http/testing';
+
+describe('SettingsComponent', () => {
+ let component: SettingsComponent;
+ let fixture: ComponentFixture;
+ const mockEnvironment = new MockEnvironment();
+
+ beforeEach(async(() => {
+ TestBed.configureTestingModule({
+ declarations: [ SettingsComponent ],
+ imports: [
+ HttpClientTestingModule,
+ ],
+ providers: [
+ HttpClient,
+ ApiService,
+ {provide: 'APP_ENVIRONMENT', useValue: mockEnvironment},
+ {provide: APP_BASE_HREF, useValue: ''},
+ ]
+ }).compileComponents();
+ }));
+
+ beforeEach(() => {
+ fixture = TestBed.createComponent(SettingsComponent);
+ component = fixture.componentInstance;
+ fixture.detectChanges();
+ });
+
+ it('should create', () => {
+ expect(component).toBeTruthy();
+ });
+});
diff --git a/src/app/settings/settings.component.ts b/src/app/settings/settings.component.ts
new file mode 100644
index 0000000..432a0a3
--- /dev/null
+++ b/src/app/settings/settings.component.ts
@@ -0,0 +1,31 @@
+import {Component, Input, OnInit, Output} from '@angular/core';
+import {Study} from 'sartography-workflow-lib/lib/types/study';
+import {ApiService} from 'sartography-workflow-lib';
+import {SettingsService} from '../settings.service';
+
+@Component({
+ selector: 'app-settings',
+ templateUrl: './settings.component.html',
+ styleUrls: ['./settings.component.scss']
+})
+export class SettingsComponent implements OnInit {
+
+ studies: Study[] = [];
+ selectedStudyId: number;
+
+ constructor(private apiService: ApiService, private settingsService: SettingsService) { }
+
+ ngOnInit(): void {
+ this.selectedStudyId = this.settingsService.getStudyIdForValidation();
+
+ this.apiService.getStudies().subscribe(s => {
+ this.studies = s;
+ });
+ }
+
+ selectStudy(studyId: number) {
+ console.log('The study is ', studyId);
+ this.settingsService.setStudyIdForValidation(studyId);
+ }
+
+}
diff --git a/src/app/workflow-spec-list/workflow-spec-list.component.spec.ts b/src/app/workflow-spec-list/workflow-spec-list.component.spec.ts
index 7953c9b..31075a8 100644
--- a/src/app/workflow-spec-list/workflow-spec-list.component.spec.ts
+++ b/src/app/workflow-spec-list/workflow-spec-list.component.spec.ts
@@ -355,7 +355,10 @@ describe('WorkflowSpecListComponent', () => {
task_name: 'task_random_num',
file_name: 'random.bpmn',
tag: 'bpmn:definitions',
- task_data: {}
+ task_data: {},
+ line_number: 12,
+ offset: 0,
+ error_line: 'x != y'
};
invalidReq.flush([mockError]);
expect(bottomSheetSpy).toHaveBeenCalled();
diff --git a/src/app/workflow-spec-list/workflow-spec-list.component.ts b/src/app/workflow-spec-list/workflow-spec-list.component.ts
index b324ef9..9f4f1ca 100644
--- a/src/app/workflow-spec-list/workflow-spec-list.component.ts
+++ b/src/app/workflow-spec-list/workflow-spec-list.component.ts
@@ -26,6 +26,7 @@ import { ActivatedRoute } from '@angular/router';
import { Location } from '@angular/common';
import { environment } from '../../environments/environment.runtime';
import { FormControl } from '@angular/forms';
+import {SettingsService} from '../settings.service';
export interface WorkflowSpecCategoryGroup {
@@ -58,7 +59,8 @@ export class WorkflowSpecListComponent implements OnInit {
private bottomSheet: MatBottomSheet,
public dialog: MatDialog,
private route: ActivatedRoute,
- private location: Location
+ private location: Location,
+ private settingsService: SettingsService
) {
}
@@ -78,7 +80,8 @@ export class WorkflowSpecListComponent implements OnInit {
}
validateWorkflowSpec(wfs: WorkflowSpec) {
- this.api.validateWorkflowSpecification(wfs.id).subscribe(apiErrors => {
+ const studyId = this.settingsService.getStudyIdForValidation();
+ this.api.validateWorkflowSpecification(wfs.id, '', studyId).subscribe(apiErrors => {
if (apiErrors && apiErrors.length > 0) {
this.bottomSheet.open(ApiErrorsComponent, { data: { apiErrors: apiErrors } });
} else {