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

[#877] Format and lint core-services module #1116

Merged
merged 1 commit into from
Jan 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 0 additions & 1 deletion ui/.eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ cypress/fixtures/**/*.csv

# Remove these in the future to lint additional modules
# Please also see .prettierignore
src/app/core-services
src/app/core-ui
src/app/CustomMaterial
src/app/dashboard
Expand Down
1 change: 0 additions & 1 deletion ui/.prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ cypress/fixtures/**/*.csv

# Remove these in the future to format additional modules
# Please also see .eslintignore
src/app/core-services
src/app/core-ui
src/app/CustomMaterial
src/app/dashboard
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,24 +21,22 @@ import { EventProperty } from '@streampipes/platform-services';

@Injectable()
export class SemanticTypeUtilsService {

public TIMESTAMP = 'http://schema.org/DateTime';
public IMAGE = 'https://image.com';
public NUMBER = 'http://schema.org/Number';

constructor() {
}
constructor() {}

public getValue(inputValue, semanticType) {
if (semanticType === this.TIMESTAMP) {
return new Date(inputValue).toLocaleString() ;
return new Date(inputValue).toLocaleString();
} else {
return inputValue;
}
}

public isTimestamp(property: EventProperty): boolean {
return property.domainProperties.includes(this.TIMESTAMP);
return property.domainProperties.includes(this.TIMESTAMP);
}

public is(property: EventProperty, uri: string): boolean {
Expand Down
86 changes: 47 additions & 39 deletions ui/src/app/core-services/template/PipelineInvocationBuilder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,54 +15,62 @@
* limitations under the License.
*
*/
import { FreeTextStaticProperty, MappingPropertyUnary, PipelineTemplateInvocation } from '@streampipes/platform-services';
import {
FreeTextStaticProperty,
MappingPropertyUnary,
PipelineTemplateInvocation,
} from '@streampipes/platform-services';

export class PipelineInvocationBuilder {
private pipelineTemplateInvocation: PipelineTemplateInvocation;

private pipelineTemplateInvocation: PipelineTemplateInvocation;
constructor(pipelineTemplateInvocation: PipelineTemplateInvocation) {
this.pipelineTemplateInvocation = pipelineTemplateInvocation;
}

constructor(pipelineTemplateInvocation: PipelineTemplateInvocation) {
this.pipelineTemplateInvocation = pipelineTemplateInvocation;
}
public static create(
pipelineTemplateInvocation: PipelineTemplateInvocation,
) {
return new PipelineInvocationBuilder(pipelineTemplateInvocation);
}

public static create(pipelineTemplateInvocation: PipelineTemplateInvocation) {
return new PipelineInvocationBuilder(pipelineTemplateInvocation);
}
public setTemplateId(id: string) {
this.pipelineTemplateInvocation.pipelineTemplateId = id;
return this;
}

public setTemplateId(id: string) {
this.pipelineTemplateInvocation.pipelineTemplateId = id;
return this;
}
public setName(name: string) {
this.pipelineTemplateInvocation.kviName = name;
return this;
}

public setName(name: string) {
this.pipelineTemplateInvocation.kviName = name;
return this;
}
public setFreeTextStaticProperty(name: string, value: string) {
this.pipelineTemplateInvocation.staticProperties.forEach(property => {
if (
property instanceof FreeTextStaticProperty &&
'jsplumb_domId2' + name === property.internalName
) {
property.value = value;
}
});

public setFreeTextStaticProperty(name: string, value: string) {
this.pipelineTemplateInvocation.staticProperties.forEach(property => {
if (property instanceof FreeTextStaticProperty && 'jsplumb_domId2' + name === property.internalName) {
property.value = value;
}
});
return this;
}

return this;
}

public setMappingPropertyUnary(name: string, value: string) {
this.pipelineTemplateInvocation.staticProperties.forEach(property => {
if (property instanceof MappingPropertyUnary && 'jsplumb_domId2' + name === property.internalName) {
property.selectedProperty = value;
}
});

return this;
}

public build() {
return this.pipelineTemplateInvocation;
}
public setMappingPropertyUnary(name: string, value: string) {
this.pipelineTemplateInvocation.staticProperties.forEach(property => {
if (
property instanceof MappingPropertyUnary &&
'jsplumb_domId2' + name === property.internalName
) {
property.selectedProperty = value;
}
});

return this;
}

public build() {
return this.pipelineTemplateInvocation;
}
}