Skip to content

Commit 374b5a8

Browse files
authored
refactor: use constants from js-lib directly (DEV-799) (#712)
* refactor: replace long constants * chore(deps): bump js-lib to latest * refactor: replace long constants
1 parent 7768fb9 commit 374b5a8

8 files changed

Lines changed: 29 additions & 29 deletions

File tree

‎package-lock.json‎

Lines changed: 7 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
"@angular/platform-browser-dynamic": "^13.2.6",
3535
"@angular/router": "^13.2.6",
3636
"@ckeditor/ckeditor5-angular": "^2.0.2",
37-
"@dasch-swiss/dsp-js": "^7.0.2",
37+
"@dasch-swiss/dsp-js": "^7.1.0",
3838
"@datadog/browser-rum": "^3.11.0",
3939
"@ngx-translate/core": "^13.0.0",
4040
"@ngx-translate/http-loader": "6.0.0",

‎src/app/project/ontology/default-data/default-resource-classes.ts‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ export class DefaultResourceClasses {
5353
]
5454
},
5555
{
56-
iri: Constants.KnoraApiV2 + Constants.HashDelimiter + 'StillImageRepresentation',
56+
iri: Constants.StillImageRepresentation,
5757
label: 'Still Image',
5858
icons: [
5959
'photo',
@@ -80,7 +80,7 @@ export class DefaultResourceClasses {
8080
]
8181
},
8282
{
83-
iri: Constants.KnoraApiV2 + Constants.HashDelimiter + 'MovingImageRepresentation',
83+
iri: Constants.MovingImageRepresentation,
8484
label: 'Moving Image',
8585
icons: [
8686
'movie',
@@ -98,7 +98,7 @@ export class DefaultResourceClasses {
9898
]
9999
},
100100
{
101-
iri: Constants.KnoraApiV2 + Constants.HashDelimiter + 'AudioRepresentation',
101+
iri: Constants.AudioRepresentation,
102102
label: 'Audio',
103103
icons: [
104104
'audiotrack',
@@ -117,7 +117,7 @@ export class DefaultResourceClasses {
117117
]
118118
},
119119
{
120-
iri: Constants.KnoraApiV2 + Constants.HashDelimiter + 'TextRepresentation',
120+
iri: Constants.TextRepresentation,
121121
label: 'Text',
122122
icons: [
123123
'rtt',
@@ -127,7 +127,7 @@ export class DefaultResourceClasses {
127127
]
128128
},
129129
{
130-
iri: Constants.KnoraApiV2 + Constants.HashDelimiter + 'DocumentRepresentation',
130+
iri: Constants.DocumentRepresentation,
131131
label: 'Document (PDF, etc.)',
132132
icons: [
133133
'description',
@@ -142,7 +142,7 @@ export class DefaultResourceClasses {
142142
]
143143
},
144144
{
145-
iri: Constants.KnoraApiV2 + Constants.HashDelimiter + 'ArchiveRepresentation',
145+
iri: Constants.ArchiveRepresentation,
146146
label: 'Archive (zip, x-tar, gzip)',
147147
icons: [
148148
'archive',
@@ -156,7 +156,7 @@ export class DefaultResourceClasses {
156156
/* --> DSP-1559: disable RTI class;
157157
the following object can be added again to the default classes as soon as a RTI viewer is implemented
158158
{
159-
iri: Constants.KnoraApiV2 + Constants.HashDelimiter + 'DDDRepresentation',
159+
iri: Constants.DDDRepresentation,
160160
label: 'RTI Image',
161161
icons: [
162162
'view_in_ar',

‎src/app/workspace/resource/properties/properties.component.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ export class PropertiesComponent implements OnInit, OnChanges, OnDestroy {
133133

134134
booleanValueTypeIri = Constants.BooleanValue;
135135

136-
hasIncomingLinkIri = Constants.KnoraApiV2 + Constants.HashDelimiter + 'hasIncomingLinkValue';
136+
hasIncomingLinkIri = Constants.HasIncomingLinkValue;
137137

138138
project: ReadProject;
139139
user: ReadUser;

‎src/app/workspace/resource/representation/still-image/still-image.component.ts‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ export class StillImageComponent implements OnChanges, OnDestroy {
303303

304304
const geometry = geom.geometry;
305305

306-
const colorValues: ReadColorValue[] = geom.region.properties[Constants.KnoraApiV2 + Constants.HashDelimiter + 'hasColor'] as ReadColorValue[];
306+
const colorValues: ReadColorValue[] = geom.region.properties[Constants.HasColor] as ReadColorValue[];
307307

308308
// if the geometry has a color property, use that value as the color for the line
309309
if (colorValues && colorValues.length) {
@@ -435,7 +435,7 @@ export class StillImageComponent implements OnChanges, OnDestroy {
435435
',"y":' + y1.toString() + '},{"x":' + x2.toString() + ',"y":' + y2.toString() + '}],"type":"rectangle"}';
436436
const createResource = new CreateResource();
437437
createResource.label = label;
438-
createResource.type = Constants.KnoraApiV2 + Constants.HashDelimiter + 'Region';
438+
createResource.type = Constants.Region;
439439
createResource.attachedToProject = this.project;
440440
const geomVal = new CreateGeomValue();
441441
geomVal.type = Constants.GeomValue;
@@ -451,10 +451,10 @@ export class StillImageComponent implements OnChanges, OnDestroy {
451451
commentVal.text = comment;
452452

453453
createResource.properties = {
454-
[Constants.KnoraApiV2 + Constants.HashDelimiter + 'hasComment']: [commentVal],
455-
[Constants.KnoraApiV2 + Constants.HashDelimiter + 'hasColor']: [colorVal],
456-
[Constants.KnoraApiV2 + Constants.HashDelimiter + 'isRegionOfValue']: [linkVal],
457-
[Constants.KnoraApiV2 + Constants.HashDelimiter + 'hasGeometry']: [geomVal]
454+
[Constants.HasComment]: [commentVal],
455+
[Constants.HasColor]: [colorVal],
456+
[Constants.IsRegionOfValue]: [linkVal],
457+
[Constants.HasGeometry]: [geomVal]
458458
};
459459
this._dspApiConnection.v2.res.createResource(createResource).subscribe(
460460
(res: ReadResource) => {

‎src/app/workspace/resource/resource-link-form/resource-link-form.component.spec.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -270,11 +270,11 @@ describe('ResourceLinkFormComponent', () => {
270270
createVal.push(linkVal);
271271
});
272272

273-
props[Constants.KnoraApiV2 + Constants.HashDelimiter + 'hasLinkToValue'] = createVal;
273+
props[Constants.HasLinkToValue] = createVal;
274274

275275
const expectedCreateResource = new CreateResource();
276276
expectedCreateResource.label = 'My Label';
277-
expectedCreateResource.type = Constants.KnoraApiV2 + Constants.HashDelimiter + 'LinkObj';
277+
expectedCreateResource.type = Constants.LinkObj;
278278
expectedCreateResource.properties = props;
279279

280280
// --> TODO create a Router spy to mock the navigation

‎src/app/workspace/resource/resource-link-form/resource-link-form.component.ts‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ export class ResourceLinkFormComponent implements OnInit {
120120

121121
linkObj.label = this.form.controls['label'].value;
122122

123-
linkObj.type = Constants.KnoraApiV2 + Constants.HashDelimiter + 'LinkObj';
123+
linkObj.type = Constants.LinkObj;
124124

125125
linkObj.attachedToProject = this.selectedProject;
126126

@@ -139,12 +139,12 @@ export class ResourceLinkFormComponent implements OnInit {
139139
commentVal.type = Constants.TextValue;
140140
commentVal.text = comment;
141141
linkObj.properties = {
142-
[Constants.KnoraApiV2 + Constants.HashDelimiter + 'hasLinkToValue']: hasLinkToValue,
143-
[Constants.KnoraApiV2 + Constants.HashDelimiter + 'hasComment']: [commentVal],
142+
[Constants.HasLinkToValue]: hasLinkToValue,
143+
[Constants.HasComment]: [commentVal],
144144
};
145145
} else {
146146
linkObj.properties = {
147-
[Constants.KnoraApiV2 + Constants.HashDelimiter + 'hasLinkToValue']: hasLinkToValue,
147+
[Constants.HasLinkToValue]: hasLinkToValue,
148148
};
149149
}
150150

‎src/app/workspace/search/advanced-search/resource-and-property-selection/search-select-property/specify-property-value/operator-constants.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,5 +29,5 @@ export class ComparisonOperatorConstants {
2929
static MatchComparisonOperator = 'contains';
3030
static MatchComparisonLabel = 'matches';
3131

32-
static MatchFunction = Constants.KnoraApiV2 + Constants.HashDelimiter + 'matchText';
32+
static MatchFunction = Constants.MatchText;
3333
}

0 commit comments

Comments
 (0)