This is an automated email from the ASF dual-hosted git repository.
zehnder pushed a commit to branch
3160-incorrect-rename-rule-displayed-in-schema-editor
in repository https://gitbox.apache.org/repos/asf/streampipes.git
The following commit(s) were added to
refs/heads/3160-incorrect-rename-rule-displayed-in-schema-editor by this push:
new 7a01f8a193 fix(#3160): Change logic of service static-value-transform
7a01f8a193 is described below
commit 7a01f8a1937ac6c7d8c7a6690076a1c4d639d4d4
Author: Philipp Zehnder <[email protected]>
AuthorDate: Tue Aug 20 14:23:50 2024 +0200
fix(#3160): Change logic of service static-value-transform
---
.../connect/services/static-value-transform.service.ts | 16 +++++++++++++---
1 file changed, 13 insertions(+), 3 deletions(-)
diff --git a/ui/src/app/connect/services/static-value-transform.service.ts
b/ui/src/app/connect/services/static-value-transform.service.ts
index 0576bb6a0c..7ba1ae0528 100644
--- a/ui/src/app/connect/services/static-value-transform.service.ts
+++ b/ui/src/app/connect/services/static-value-transform.service.ts
@@ -17,18 +17,23 @@
*/
import { Injectable } from '@angular/core';
+import { IdGeneratorService } from
'../../core-services/id-generator/id-generator.service';
@Injectable({ providedIn: 'root' })
export class StaticValueTransformService {
prefix = 'http://eventProperty.de/staticValue/';
placeholderValue = 'placeholder';
+ constructor(private idGeneratorService: IdGeneratorService) {}
+
makeDefaultElementId(): string {
- return this.prefix + this.placeholderValue;
+ return this.getPrefix() + this.placeholderValue;
}
makeElementId(value: string) {
- return this.prefix + value;
+ const lastSlashIndex = this.prefix.lastIndexOf('/');
+ const prefixWithId = this.prefix.substring(0, lastSlashIndex + 1);
+ return prefixWithId + value;
}
isStaticValueProperty(elementId: string) {
@@ -36,6 +41,11 @@ export class StaticValueTransformService {
}
getStaticValue(elementId: string) {
- return elementId.replaceAll(this.prefix, '');
+ const lastSlashIndex = elementId.lastIndexOf('/');
+ return elementId.substring(lastSlashIndex + 1);
+ }
+
+ private getPrefix(): string {
+ return `${this.prefix + this.idGeneratorService.generate(10)}/`;
}
}