Skip to content

Commit

Permalink
refactor: Remove legacy data type service in connect (#2739)
Browse files Browse the repository at this point in the history
* refactor: Remove legacy data type service in connect

* refactor: Fix linting
  • Loading branch information
tenthe authored Apr 17, 2024
1 parent ac318d7 commit f619d82
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 80 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,24 +16,44 @@
*
*/

import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
import { DataTypesService } from '../../../../../services/data-type.service';
import { Component, EventEmitter, Input, Output } from '@angular/core';
import { DataType } from '@streampipes/platform-services';

@Component({
selector: 'sp-edit-data-type',
templateUrl: './edit-data-type.component.html',
styleUrls: ['./edit-data-type.component.scss'],
})
export class EditDataTypeComponent implements OnInit {
export class EditDataTypeComponent {
@Input() cachedProperty: any;
@Output() dataTypeChanged = new EventEmitter<boolean>();

runtimeDataTypes;
constructor(private dataTypeService: DataTypesService) {}

ngOnInit() {
this.runtimeDataTypes = this.dataTypeService.dataTypes;
}
runtimeDataTypes: { label: string; url: string }[] = [
{
label: "String - A textual datatype, e.g., 'machine1'",
url: DataType.STRING,
},
{
label: 'Boolean - A true/false value',
url: DataType.BOOLEAN,
},
{
label: "Double - A number, e.g., '1.25'",
url: DataType.DOUBLE,
},
{
label: "Float - A number, e.g., '1.25'",
url: DataType.FLOAT,
},
{
label: "Integer - A number, e.g., '2'",
url: DataType.INTEGER,
},
{
label: "Long - A number, e.g., '1623871455232'",
url: DataType.LONG,
},
];

valueChanged() {
this.dataTypeChanged.emit(true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,13 @@ import {
Validators,
} from '@angular/forms';
import {
DataType,
EventPropertyList,
EventPropertyNested,
EventPropertyPrimitive,
EventPropertyUnion,
SemanticType,
} from '@streampipes/platform-services';
import { DataTypesService } from '../../services/data-type.service';
import { DialogRef } from '@streampipes/shared-ui';
import { EditSchemaTransformationComponent } from './components/edit-schema-transformation/edit-schema-transformation.component';
import { EditValueTransformationComponent } from './components/edit-value-transformation/edit-value-transformation.component';
Expand Down Expand Up @@ -73,7 +73,6 @@ export class EditEventPropertyComponent implements OnInit {
constructor(
public dialogRef: DialogRef<EditEventPropertyComponent>,
private formBuilder: UntypedFormBuilder,
private dataTypeService: DataTypesService,
private shepherdService: ShepherdService,
) {}

Expand All @@ -89,9 +88,7 @@ export class EditEventPropertyComponent implements OnInit {
this.property instanceof EventPropertyNested;
this.isNumericProperty =
SemanticType.isNumber(this.cachedProperty) ||
this.dataTypeService.isNumeric(
(this.cachedProperty as any).runtimeType,
);
DataType.isNumberType((this.cachedProperty as any).runtimeType);
this.createForm();
}

Expand Down Expand Up @@ -188,7 +185,7 @@ export class EditEventPropertyComponent implements OnInit {
}

handleDataTypeChange(changed: boolean) {
this.isNumericProperty = this.dataTypeService.isNumeric(
this.isNumericProperty = DataType.isNumberType(
(this.cachedProperty as any).runtimeType,
);
}
Expand Down
65 changes: 0 additions & 65 deletions ui/src/app/connect/services/data-type.service.ts

This file was deleted.

0 comments on commit f619d82

Please sign in to comment.