Skip to content
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

Link value component #27

Merged
merged 40 commits into from
Mar 25, 2020
Merged
Show file tree
Hide file tree
Changes from 37 commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
937a3f5
feature (value): initialize link value component
SepidehAlassi Feb 17, 2020
40ff579
fix (value) add linkValueComponent to the viewer module
SepidehAlassi Feb 17, 2020
891716b
feature (value) change app component to link value
SepidehAlassi Feb 17, 2020
50e64fd
fix (value) add custom validator implementation
SepidehAlassi Feb 17, 2020
194f548
fix (value) remove faulty tests, to be corrected later
SepidehAlassi Feb 17, 2020
b1e927b
feature (linkValue) property display the content of link value proper…
SepidehAlassi Feb 21, 2020
de67c0f
fix (linkValue) correct the failing test
SepidehAlassi Feb 21, 2020
7042c39
Merge branch 'master' into 14-linkValueComponent
SepidehAlassi Feb 25, 2020
f7296e2
fix (LinkValue) add the missing comma
SepidehAlassi Feb 25, 2020
1678d55
feature (LinkValue) change menu options to resources
SepidehAlassi Feb 25, 2020
084e647
feature (LinkValue) save changed link
SepidehAlassi Feb 25, 2020
1242d37
feauture (linkValue) update and save the edited link value
SepidehAlassi Feb 27, 2020
93b9ddf
fix (LinkValue) get the value with the new uuid
SepidehAlassi Feb 27, 2020
7865455
fix (linkValue) get the value with the new uuid of the link property
SepidehAlassi Feb 27, 2020
54fb9f8
fix (linkValue) add the Knora api configuration token to the test
SepidehAlassi Feb 27, 2020
c12ee8c
fix (linkValue) display-edit test of calling get value with uuid give…
SepidehAlassi Feb 27, 2020
1783a54
feature (linkValue) some more tests
SepidehAlassi Feb 27, 2020
dc8d311
fix (linkValue) remove the extra validator
SepidehAlassi Feb 27, 2020
08b840f
style (linkValue) css for display of fields
SepidehAlassi Feb 27, 2020
d16c2b3
feature (linkValue) test the linkedResource label and type
SepidehAlassi Feb 27, 2020
249a82b
test (linkValue) more display test
SepidehAlassi Mar 2, 2020
daee9b0
test (linkValue) more test for update of comment
SepidehAlassi Mar 2, 2020
ca1c07a
test (LinkValue) more tests for searches with labels
SepidehAlassi Mar 3, 2020
25e076f
fix (linkValue) restrict linked resource classes
SepidehAlassi Mar 3, 2020
69a4551
style (linkValue) css to wrap labels given in input field entirely
SepidehAlassi Mar 3, 2020
3586e53
feature (ListValue) FormControl is a ListValue
SepidehAlassi Mar 12, 2020
b866456
Merge branch 'master' into wip/14-linkValueComponent
SepidehAlassi Mar 12, 2020
ab64574
fix (LinkValue) failing tests corrected
SepidehAlassi Mar 12, 2020
664724b
test (LinkValue) add tests for creation
SepidehAlassi Mar 12, 2020
bdfa456
Merge branch 'master' into wip/14-link-value
SepidehAlassi Mar 17, 2020
4d0ca01
feature (LinkValue) -get the object type of the link property from IR…
SepidehAlassi Mar 17, 2020
c534fdf
fix (LinkValue) bug with init val fix
SepidehAlassi Mar 17, 2020
59960b3
feature (LinkValue) get the property type as a parameter
SepidehAlassi Mar 17, 2020
b76b75b
feature (LinkValue) fix test for creation
SepidehAlassi Mar 17, 2020
0e7e3b8
feature (LinkValue) use standard form reset and some tests
SepidehAlassi Mar 23, 2020
8a8234f
fix (linkValue) check for instance of ReadResource instead of !null
SepidehAlassi Mar 23, 2020
f11fbed
fix (LinkValue) add validator for options
SepidehAlassi Mar 25, 2020
f03ecb7
fix [LinkValue] last refactoring
SepidehAlassi Mar 25, 2020
6c8e24d
fix (LinkValue) evaluation of restrictToResourceClass just once in ng…
SepidehAlassi Mar 25, 2020
b9533ae
fix (LinkValue) bring back the clear selection
SepidehAlassi Mar 25, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<div>
<span [ngSwitch]="displayValue.type">

<kui-text-value-as-string #displayVal *ngSwitchCase="constants.TextValue" [mode]="mode"
[displayValue]="displayValue"></kui-text-value-as-string>
<kui-int-value #displayVal *ngSwitchCase="constants.IntValue" [mode]="mode" [displayValue]="displayValue">
Expand All @@ -16,6 +17,8 @@
</kui-interval-value>
<kui-time-value #displayVal *ngSwitchCase="constants.TimeValue" [mode]="mode" [displayValue]="displayValue">
</kui-time-value>
<kui-link-value #displayVal *ngSwitchCase="constants.LinkValue" [mode]="mode" [displayValue]="displayValue"
SepidehAlassi marked this conversation as resolved.
Show resolved Hide resolved
[parentResource]="parentResource" [propType]="displayValue.property"></kui-link-value>
</span>
</div>
<div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,18 @@ class TestTextValueAsStringComponent {

@Input() displayValue;
}
@Component({
selector: `kui-link-value`,
template: ``
})
class TestLinkValueComponent {

@Input() mode;

@Input() displayValue;
@Input() parentResource;
@Input() propType;
SepidehAlassi marked this conversation as resolved.
Show resolved Hide resolved
}
@Component({
selector: `kui-uri-value`,
template: ``
Expand Down Expand Up @@ -203,6 +214,7 @@ describe('DisplayEditComponent', () => {
TestHostDisplayValueComponent,
TestTextValueAsStringComponent,
TestIntValueComponent,
TestLinkValueComponent,
TestIntervalValueComponent,
TestBooleanValueComponent,
TestUriValueComponent,
Expand Down Expand Up @@ -315,7 +327,8 @@ describe('DisplayEditComponent', () => {
expect(valuesSpy.v2.values.updateValue).toHaveBeenCalledTimes(1);

expect(valuesSpy.v2.values.getValue).toHaveBeenCalledTimes(1);
expect(valuesSpy.v2.values.getValue).toHaveBeenCalledWith(testHostComponent.readResource.id, testHostComponent.readValue.uuid);
expect(valuesSpy.v2.values.getValue).toHaveBeenCalledWith(testHostComponent.readResource.id,
testHostComponent.displayEditValueComponent.displayValue.uuid);

expect(testHostComponent.displayEditValueComponent.displayValue.id).toEqual('newID');
expect(testHostComponent.displayEditValueComponent.mode).toEqual('read');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,15 +67,12 @@ export class DisplayEditComponent implements OnInit {
updateRes.type = this.parentResource.type;
updateRes.property = this.displayValue.property;
updateRes.value = updatedVal;

this.knoraApiConnection.v2.values.updateValue(updateRes as UpdateResource<UpdateValue>).pipe(
mergeMap((res: WriteValueResponse) => {
// console.log(res);
return this.knoraApiConnection.v2.values.getValue(this.parentResource.id, this.displayValue.uuid);
return this.knoraApiConnection.v2.values.getValue(this.parentResource.id, res.uuid);
})
).subscribe(
(res2: ReadResource) => {
// console.log(res2);
this.displayValue = res2.getValues(this.displayValue.property)[0];
this.mode = 'read';
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ describe('DecimalValueComponent', () => {

beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [
declarations: [
DecimalValueComponent,
TestHostDisplayValueComponent,
TestHostCreateValueComponent
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<span [formGroup]="form">
<mat-form-field class="example-full-width linkValue-field">
<input [formControlName]="'linkValue'" type="text" placeholder="Link value" aria-label="resource" matInput [matAutocomplete]="auto" [readonly]="mode === 'read'">

<mat-autocomplete #auto="matAutocomplete" [displayWith]="displayResource">
<mat-option *ngFor="let res of resources" [value]="res">
{{res?.label}}
</mat-option>
</mat-autocomplete>
</mat-form-field>
<mat-form-field class="large-field comment-field">
<input matInput [formControlName]="'comment'" class="comment" placeholder="Comment" type="text" [readonly]="mode === 'read'">
</mat-form-field>
</span>
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
.comment-field {
display: block;
max-width: 250px;
}
.linkValue-field {
display: block;
max-width: 250px;

}
Loading