Skip to content

Commit 76233ea

Browse files
authored
refactor(value): remove old date value components (DEV-633) (#684)
* refactor(value): remove old date value components * refactor(value): rename yet-another-date-value * chore(ontology): default timestamp * refactor(form): remove asterisk from required inputs * refactor(ontology): remove console log * refactor(ontology): bring back the previous setup
1 parent b374a3b commit 76233ea

47 files changed

Lines changed: 92 additions & 3775 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎src/app/app.module.ts‎

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ import { KnoraDatePipe } from './main/pipes/formatting/knoradate.pipe';
4545
import { SplitPipe } from './main/pipes/split.pipe';
4646
import { LinkifyPipe } from './main/pipes/string-transformation/linkify.pipe';
4747
import { StringifyStringLiteralPipe } from './main/pipes/string-transformation/stringify-string-literal.pipe';
48+
import { TitleFromCamelCasePipe } from './main/pipes/string-transformation/title-from-camel-case.pipe';
4849
import { TruncatePipe } from './main/pipes/string-transformation/truncate.pipe';
4950
import { SelectLanguageComponent } from './main/select-language/select-language.component';
5051
import { DatadogRumService } from './main/services/datadog-rum.service';
@@ -111,10 +112,8 @@ import { ResourceComponent } from './workspace/resource/resource.component';
111112
import { BooleanValueComponent } from './workspace/resource/values/boolean-value/boolean-value.component';
112113
import { ColorPickerComponent } from './workspace/resource/values/color-value/color-picker/color-picker.component';
113114
import { ColorValueComponent } from './workspace/resource/values/color-value/color-value.component';
114-
import { CalendarHeaderComponent } from './workspace/resource/values/date-value/calendar-header/calendar-header.component';
115-
import { DateEditComponent } from './workspace/resource/values/date-value/date-input-text/date-edit/date-edit.component';
116-
import { DateInputTextComponent } from './workspace/resource/values/date-value/date-input-text/date-input-text.component';
117-
import { DateInputComponent } from './workspace/resource/values/date-value/date-input/date-input.component';
115+
import { DatePickerComponent } from './workspace/resource/values/date-value/date-picker/date-picker.component';
116+
import { DateValueHandlerComponent } from './workspace/resource/values/date-value/date-value-handler/date-value-handler.component';
118117
import { DateValueComponent } from './workspace/resource/values/date-value/date-value.component';
119118
import { DecimalValueComponent } from './workspace/resource/values/decimal-value/decimal-value.component';
120119
import { GeonameValueComponent } from './workspace/resource/values/geoname-value/geoname-value.component';
@@ -131,9 +130,6 @@ import { TextValueAsXMLComponent } from './workspace/resource/values/text-value/
131130
import { TimeInputComponent } from './workspace/resource/values/time-value/time-input/time-input.component';
132131
import { TimeValueComponent } from './workspace/resource/values/time-value/time-value.component';
133132
import { UriValueComponent } from './workspace/resource/values/uri-value/uri-value.component';
134-
import { DatePickerComponent } from './workspace/resource/values/yet-another-date-value/date-picker/date-picker.component';
135-
import { DateValueHandlerComponent } from './workspace/resource/values/yet-another-date-value/date-value-handler/date-value-handler.component';
136-
import { YetAnotherDateValueComponent } from './workspace/resource/values/yet-another-date-value/yet-another-date-value.component';
137133
import { ListViewComponent } from './workspace/results/list-view/list-view.component';
138134
import { ResourceGridComponent } from './workspace/results/list-view/resource-grid/resource-grid.component';
139135
import { ResourceListComponent } from './workspace/results/list-view/resource-list/resource-list.component';
@@ -157,7 +153,6 @@ import { SearchSelectOntologyComponent } from './workspace/search/advanced-searc
157153
import { ExpertSearchComponent } from './workspace/search/expert-search/expert-search.component';
158154
import { FulltextSearchComponent } from './workspace/search/fulltext-search/fulltext-search.component';
159155
import { SearchPanelComponent } from './workspace/search/search-panel/search-panel.component';
160-
import { TitleFromCamelCasePipe } from './main/pipes/string-transformation/title-from-camel-case.pipe';
161156

162157
// translate: AoT requires an exported function for factories
163158
export function httpLoaderFactory(httpClient: HttpClient) {
@@ -178,7 +173,6 @@ export function httpLoaderFactory(httpClient: HttpClient) {
178173
AudioComponent,
179174
BoardComponent,
180175
BooleanValueComponent,
181-
CalendarHeaderComponent,
182176
CollaborationComponent,
183177
CollectionListComponent,
184178
ColorPickerComponent,
@@ -189,9 +183,6 @@ export function httpLoaderFactory(httpClient: HttpClient) {
189183
CookiePolicyComponent,
190184
CreateLinkResourceComponent,
191185
DashboardComponent,
192-
DateEditComponent,
193-
DateInputComponent,
194-
DateInputTextComponent,
195186
DatePickerComponent,
196187
DateValueComponent,
197188
DateValueHandlerComponent,
@@ -294,6 +285,7 @@ export function httpLoaderFactory(httpClient: HttpClient) {
294285
TextValueHtmlLinkDirective,
295286
TimeInputComponent,
296287
TimeValueComponent,
288+
TitleFromCamelCasePipe,
297289
TruncatePipe,
298290
UploadComponent,
299291
UriValueComponent,
@@ -302,8 +294,6 @@ export function httpLoaderFactory(httpClient: HttpClient) {
302294
UserMenuComponent,
303295
UsersComponent,
304296
UsersListComponent,
305-
YetAnotherDateValueComponent,
306-
TitleFromCamelCasePipe
307297
],
308298
imports: [
309299
AngularSplitModule.forRoot(),

‎src/app/project/ontology/default-data/default-properties.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ export class DefaultProperties {
121121
{
122122
icon: 'access_time',
123123
label: 'Timestamp',
124-
description: 'A single timestamp on a timeline',
124+
description: 'A single timestamp (date and time) on a timeline',
125125
subPropOf: Constants.HasValue,
126126
objectType: Constants.TimeValue,
127127
guiEle: Constants.GuiTimeStamp,

‎src/app/project/ontology/ontology-form/ontology-form.component.html‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<div class="form-content">
44
<mat-form-field class="large-field ontology-name">
55
<input matInput class="ontology-name" autocomplete="off" [maxlength]="nameMaxLength" [formControl]="ontologyForm.controls['name']"
6-
[placeholder]="'Set a unique name *'">
6+
[placeholder]="'Set a unique name'">
77
<mat-icon matSuffix [matTooltip]="ontologyNameInfo" matTooltipPosition="above" matTooltipClass="multi-line-tooltip">help</mat-icon>
88
<mat-hint *ngIf="formErrors.name" class="medium-field">
99
{{ formErrors.name }}
@@ -13,7 +13,7 @@
1313

1414
<mat-form-field class="large-field ontology-label">
1515
<span *ngIf="!iri" matPrefix>{{project.shortname}}:&nbsp;</span>
16-
<input matInput [formControl]="ontologyForm.controls['label']" placeholder="Label *"
16+
<input matInput [formControl]="ontologyForm.controls['label']" placeholder="Label"
1717
[value]="ontologyLabel">
1818
<mat-hint *ngIf="formErrors.label">
1919
{{ formErrors.label }}

‎src/app/project/ontology/ontology-form/ontology-form.component.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,7 @@ export class OntologyFormComponent implements OnInit {
186186
label: new FormControl({
187187
value: this.ontologyLabel, disabled: false
188188
}, [
189+
Validators.required,
189190
Validators.minLength(this.nameMinLength)
190191
]),
191192
comment: new FormControl({

‎src/app/project/ontology/property-form/property-form.component.html‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
<span matPrefix class="ontology-prefix-icon">
4242
<mat-icon>fingerprint</mat-icon>&nbsp;
4343
</span>
44-
<mat-label>Property name *</mat-label>
44+
<mat-label>Property name</mat-label>
4545
<input matInput formControlName="name" >
4646
<mat-hint class="ontology-error-with-prefix" *ngIf="formErrors.name">
4747
{{formErrors.name}}

‎src/app/project/ontology/property-form/property-form.component.ts‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -424,6 +424,7 @@ export class PropertyFormComponent implements OnInit {
424424

425425
this._dspApiConnection.v2.onto.updateResourceProperty(onto4Comment).subscribe(
426426
(classCommentResponse: ResourcePropertyDefinitionWithAllLanguages) => {
427+
console.log(classCommentResponse);
427428
this.lastModificationDate = classCommentResponse.lastModificationDate;
428429

429430
if (!this.unsupportedPropertyType) {
@@ -491,7 +492,7 @@ export class PropertyFormComponent implements OnInit {
491492
const newResProp = new CreateResourceProperty();
492493
newResProp.name = this.propertyForm.controls['name'].value;
493494
newResProp.label = this.labels;
494-
newResProp.comment = (this.comments.length ? this.comments : this.labels);
495+
newResProp.comment = this.comments;
495496
const guiAttr = this.propertyForm.controls['guiAttr'].value;
496497
if (guiAttr) {
497498
newResProp.guiAttributes = this.setGuiAttribute(guiAttr);

‎src/app/project/ontology/resource-class-form/resource-class-form.component.html‎

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
<span matPrefix class="ontology-prefix-icon">
1111
<mat-icon>fingerprint</mat-icon>&nbsp;
1212
</span>
13-
<mat-label>Class name *</mat-label>
13+
<mat-label>Class name</mat-label>
1414
<input matInput formControlName="name" >
1515
<mat-hint class="ontology-error-with-prefix" *ngIf="formErrors.name">
1616
{{formErrors.name}}
@@ -34,15 +34,12 @@
3434
<!-- description -->
3535
<div class="large-field string-literal-container more-space-top">
3636
<app-string-literal-input
37-
[placeholder]="'Comment *'"
37+
[placeholder]="'Comment'"
3838
[value]="resourceClassComments"
3939
[textarea]="true"
4040
(touched)="resourceClassCommentsTouched = $event"
4141
(dataChanged)="handleData($event, 'comment')">
4242
</app-string-literal-input>
43-
<mat-hint class="string-literal-error" *ngIf="formErrors.comment">
44-
{{ formErrors.comment }}
45-
</mat-hint>
4643
</div>
4744
</div>
4845

@@ -56,12 +53,12 @@
5653
<span class="fill-remaining-space"></span>
5754
<span>
5855
<button *ngIf="!edit" mat-raised-button type="button" color="primary"
59-
[disabled]="!resourceClassLabels.length || !resourceClassComments.length"
56+
[disabled]="!resourceClassLabels.length || (resourceClassForm.enabled && !resourceClassForm.valid)"
6057
(click)="submitData()">
6158
Submit
6259
</button>
6360
<button *ngIf="edit" mat-raised-button type="button" color="primary"
64-
[disabled]="!resourceClassLabels.length || !resourceClassComments.length"
61+
[disabled]="!resourceClassLabels.length || (resourceClassForm.enabled && !resourceClassForm.valid)"
6562
(click)="submitData()">
6663
<app-progress-indicator [color]="'white'" [status]="0" *ngIf="loading" class="submit-progress">
6764
</app-progress-indicator>

‎src/app/project/ontology/resource-class-form/resource-class-form.component.ts‎

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -103,8 +103,7 @@ export class ResourceClassFormComponent implements OnInit, AfterViewChecked {
103103
// form errors on the following fields:
104104
formErrors = {
105105
'name': '',
106-
'label': '',
107-
'comment': ''
106+
'label': ''
108107
};
109108

110109
// in case of form error: show message
@@ -116,9 +115,6 @@ export class ResourceClassFormComponent implements OnInit, AfterViewChecked {
116115
},
117116
'label': {
118117
'required': 'Label is required.'
119-
},
120-
'comment': {
121-
'required': 'Comment is required.'
122118
}
123119
};
124120

@@ -216,9 +212,7 @@ export class ResourceClassFormComponent implements OnInit, AfterViewChecked {
216212
]),
217213
comment: new FormControl({
218214
value: this.resourceClassComments, disabled: false
219-
}, [
220-
Validators.required
221-
])
215+
})
222216
});
223217

224218
this.resourceClassForm.valueChanges.subscribe(data => this.onValueChanged(data));
@@ -253,6 +247,7 @@ export class ResourceClassFormComponent implements OnInit, AfterViewChecked {
253247
switch (type) {
254248
case 'label':
255249
this.resourceClassLabels = data;
250+
this.resourceClassForm.controls['label'].setValue(data);
256251
this.handleError(this.resourceClassLabelsTouched, type);
257252
break;
258253

@@ -307,7 +302,7 @@ export class ResourceClassFormComponent implements OnInit, AfterViewChecked {
307302

308303
const updateComment = new UpdateResourceClassComment();
309304
updateComment.id = this.iri;
310-
updateComment.comments = this.resourceClassComments;
305+
updateComment.comments = (this.resourceClassComments.length ? this.resourceClassComments : this.resourceClassLabels);
311306
onto4Comment.entity = updateComment;
312307

313308
this._dspApiConnection.v2.onto.updateResourceClass(onto4Label).subscribe(
@@ -351,6 +346,7 @@ export class ResourceClassFormComponent implements OnInit, AfterViewChecked {
351346
newResClass.subClassOf = [this.iri];
352347

353348
onto.entity = newResClass;
349+
354350
this._dspApiConnection.v2.onto.createResourceClass(onto).subscribe(
355351
(classResponse: ResourceClassDefinitionWithAllLanguages) => {
356352
// need lmd from classResponse

‎src/app/project/project-form/project-form.component.html‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
<!-- short and long name -->
88
<mat-form-field class="small-field">
9-
<input matInput placeholder="{{'appLabels.form.project.general.shortcode' | translate}} * "
9+
<input matInput placeholder="{{'appLabels.form.project.general.shortcode' | translate}}"
1010
[maxlength]="shortcodeMaxLength" [formControl]="form.controls['shortcode']">
1111
<mat-hint *ngIf="formErrors.shortcode">
1212
{{ formErrors.shortcode }}
@@ -16,7 +16,7 @@
1616
<!-- short name -->
1717
<mat-form-field class="medium-field">
1818
<input matInput [maxlength]="shortnameMaxLength"
19-
placeholder="{{'appLabels.form.project.general.shortname' | translate}} * "
19+
placeholder="{{'appLabels.form.project.general.shortname' | translate}}"
2020
[formControl]="form.controls['shortname']">
2121
<mat-hint *ngIf="formErrors.shortname">
2222
{{ formErrors.shortname }}
@@ -25,7 +25,7 @@
2525

2626
<!-- long name -->
2727
<mat-form-field class="large-field">
28-
<input matInput placeholder="{{'appLabels.form.project.general.longname' | translate}} *"
28+
<input matInput placeholder="{{'appLabels.form.project.general.longname' | translate}}"
2929
[formControl]="form.controls['longname']">
3030
<mat-hint *ngIf="formErrors.longname">
3131
{{ formErrors.longname }}

‎src/app/user/user-form/password-form/password-form.component.html‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ <h4 class="mat-subheading-1">As system admin, please enter your password before
1717
<mat-form-field class="large-field">
1818
<input matInput [type]="showRequesterPassword ? 'text' : 'password'"
1919
[formControl]="confirmForm.controls['requesterPassword']" autocomplete="old-password"
20-
placeholder="{{ 'appLabels.form.user.general.requesterPassword' | translate}} *">
20+
placeholder="{{ 'appLabels.form.user.general.requesterPassword' | translate}}">
2121

2222
<button mat-button type="button" matSuffix mat-icon-button class="input-icon"
2323
attr.aria-label="{{showRequesterPassword ? 'Hide password' : 'Show password'}}"
@@ -57,7 +57,7 @@ <h4 class="mat-subheading-1">As system admin, please enter your password before
5757

5858
<input matInput [type]="showRequesterPassword ? 'text' : 'password'"
5959
[formControl]="form.controls['requesterPassword']" autocomplete="current-password"
60-
placeholder="{{ 'appLabels.form.user.general.oldPassword' | translate}} *">
60+
placeholder="{{ 'appLabels.form.user.general.oldPassword' | translate}}">
6161

6262
<button mat-button type="button" matSuffix mat-icon-button class="input-icon"
6363
attr.aria-label="{{showRequesterPassword ? 'Hide password' : 'Show password'}}"
@@ -76,7 +76,7 @@ <h4 class="mat-subheading-1">As system admin, please enter your password before
7676
<!-- password -->
7777
<mat-form-field class="large-field">
7878
<input matInput [type]="showPassword ? 'text' : 'password'" [formControl]="form.controls['password']"
79-
autocomplete="new-password" placeholder="{{ 'appLabels.form.user.general.password' | translate}} *">
79+
autocomplete="new-password" placeholder="{{ 'appLabels.form.user.general.password' | translate}}">
8080

8181
<button mat-button type="button" matSuffix mat-icon-button class="input-icon"
8282
attr.aria-label="{{showPassword ? 'Hide password' : 'Show password'}}"
@@ -97,7 +97,7 @@ <h4 class="mat-subheading-1">As system admin, please enter your password before
9797
<input matInput [type]="showConfirmPassword ? 'text' : 'password'"
9898
[class.error]="formErrors.confirmPassword || (!matchingPasswords)"
9999
[formControl]="form.controls['confirmPassword']" autocomplete="confirm-password"
100-
placeholder="{{ 'appLabels.form.user.general.confirmPassword' | translate}} *">
100+
placeholder="{{ 'appLabels.form.user.general.confirmPassword' | translate}}">
101101

102102
<button mat-button type="button" matSuffix mat-icon-button class="input-icon"
103103
attr.aria-label="{{showConfirmPassword ? 'Hide password' : 'Show password'}}"

0 commit comments

Comments
 (0)