New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(resource): draw regions (DSP-1845) #524
Merged
Merged
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
1bb0dc9
Implemented drawing of regions
EricSommerhalder b052bb7
get coordinates for region
EricSommerhalder 6716b2d
implemented form
EricSommerhalder 1e1d6e8
Compiled search
EricSommerhalder 9b11439
Finalized request
EricSommerhalder 530f59c
Merge branch 'main' into wip/DSP-1845-draw-regions
kilchenmann 166a276
fix(resource): correct dspApiConnectionToken
kilchenmann fd7d647
feat(resource): add color picker to region form
EricSommerhalder 609f2ec
refactor: fix formatting
EricSommerhalder 7dd2f8a
test: fixes unit tests
mdelez deb97b3
Merge branch 'main' into wip/DSP-1845-draw-regions
kilchenmann 1db686a
feat(resource): regions update automatically after a new one is submi…
EricSommerhalder 9e57c84
feat(resource): Update regions and highlight new region on submit
EricSommerhalder 9693cf6
refactor(region): make lint happy
EricSommerhalder c2dc6aa
refactor: merging
EricSommerhalder File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
src/app/workspace/resource/representation/add-region-form/add-region-form.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
<form [formGroup]="regionForm"> | ||
<mat-form-field> | ||
<mat-label>Comment*</mat-label> | ||
<textarea matInput formControlName="comment"></textarea> | ||
</mat-form-field> | ||
<mat-form-field> | ||
<mat-label>Label*</mat-label> | ||
<input matInput formControlName="label"> | ||
</mat-form-field> | ||
<mat-form-field> | ||
<mat-label>Color*</mat-label> | ||
<app-color-picker | ||
#colorInput | ||
[formControlName]="'color'" | ||
class="value"> | ||
</app-color-picker> | ||
</mat-form-field> | ||
<mat-form-field> | ||
<mat-label>Is Region Of</mat-label> | ||
<input matInput disabled [value]="resourceIri"> | ||
</mat-form-field> | ||
<!-- Further inputs would be status, lineColor and lineWidth if we want to have these options--> | ||
<div class="form-panel large-field"> | ||
<span> | ||
<button mat-button type="button" mat-dialog-close> | ||
{{ 'appLabels.form.action.cancel' | translate }} | ||
</button> | ||
</span> | ||
<span class="fill-remaining-space"></span> | ||
<span> | ||
<button | ||
mat-raised-button | ||
[mat-dialog-close]="regionForm.value" | ||
type="button" | ||
color="primary" | ||
[disabled]="!regionForm.valid" | ||
class="form-submit"> | ||
Submit | ||
</button> | ||
</span> | ||
</div> | ||
</form> |
Empty file.
35 changes: 35 additions & 0 deletions
35
src/app/workspace/resource/representation/add-region-form/add-region-form.component.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import { ComponentFixture, TestBed } from '@angular/core/testing'; | ||
import { FormBuilder } from '@angular/forms'; | ||
import { TranslateModule } from '@ngx-translate/core'; | ||
|
||
import { AddRegionFormComponent } from './add-region-form.component'; | ||
|
||
describe('AddRegionFormComponent', () => { | ||
let component: AddRegionFormComponent; | ||
let fixture: ComponentFixture<AddRegionFormComponent>; | ||
|
||
beforeEach(async () => { | ||
await TestBed.configureTestingModule({ | ||
declarations: [ | ||
AddRegionFormComponent | ||
], | ||
imports: [ | ||
TranslateModule.forRoot() | ||
], | ||
providers:[ | ||
FormBuilder | ||
] | ||
}) | ||
.compileComponents(); | ||
}); | ||
|
||
beforeEach(() => { | ||
fixture = TestBed.createComponent(AddRegionFormComponent); | ||
component = fixture.componentInstance; | ||
fixture.detectChanges(); | ||
}); | ||
|
||
it('should create', () => { | ||
expect(component).toBeTruthy(); | ||
}); | ||
}); |
24 changes: 24 additions & 0 deletions
24
src/app/workspace/resource/representation/add-region-form/add-region-form.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import { Component, OnInit, Input } from '@angular/core'; | ||
import { FormBuilder, FormGroup, Validators } from '@angular/forms'; | ||
|
||
@Component({ | ||
selector: 'app-add-region-form', | ||
templateUrl: './add-region-form.component.html', | ||
styleUrls: ['./add-region-form.component.scss'] | ||
}) | ||
export class AddRegionFormComponent implements OnInit { | ||
@Input() resourceIri: string; | ||
regionForm: FormGroup; | ||
colorPattern = '^#[a-f0-9]{6}$'; | ||
constructor(private _fb: FormBuilder) { | ||
} | ||
|
||
ngOnInit(): void { | ||
this.regionForm = this._fb.group({ | ||
color: ['#ff3333', [Validators.required, Validators.pattern(this.colorPattern)]], | ||
comment: [null, Validators.required], | ||
label: [null, Validators.required] | ||
}); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is a comment actually required to submit the region?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, otherwise the api is not happy. Not sure why though.