We currently have a service visual overview page which is displaying the service definition path and its assigned resources.
As you'll be able to see in the below presented screenshot, the source resource is a contributing service as well as the 2 transport service blocks. The default names of these blocks are quite long and not that userfriendly to the operators, therefore i would like to use regex to limit the presented name to only a part of the actual full object name.
Would this be possible to configure? If so, any guidance to how to do this would be much appreciated.
In case you're showing the name of the enhanced service's element name, this is possible with RegexReplace and the [this element] placeholder. First off, in the shape where you have your text, add the following to the Options shape data: "ForcePropertyFromParent". Next, you can just place your RegexReplace placeholder in your shape text. The format will be as follows: [RegexReplace:<regular expression>,[this element],<replaceValue>]
- <regular expression>: Let's say you want the part after the last '_' in your name. Here's what it would look like: .*_(?<niceName>.+) .*: Matches any number of characters (even no characters) _: Matches the exact '_' character (?<niceName>...): Defines a named capture group, the match of which you can then reuse in your <replaceValue> .+: Matches a part with any characters, the length of which is at least one.
- [this element]: Gets replaced by the name of the element in the context you decided
- <replaceValue>: Here you put what you want the matches to be replaced by, with the possibility to also reuse the named capture groups. What it looks like in this case: ${niceName}
Your eventual placeholder to put in your shape text is then: [RegexReplace:.*_(?<niceName>.+),[this element],${niceName}]
Eventually I got my final result by applying the following RegEx as text in my text field: [RegexReplace:[-].+[z0-9],[this element],]
This is a great solution and a creative way of using the [this element] placeholder. Nice!