How to write components to clip long text, indicate active filter, run chosen tasks in CzechIdM
As a new member I was given some small features to improve CzechIdM 7. These features are Short Text, Indication that “Filter” is filled-in and Run chosen tasks.
Short text
This component allows our team to make some really large texts shorter. It will take the end or the beginning of the text and an optional parameter “shorten length”. It strips the text to “shorten length”. If the length of the text ends in the middle of some word then it will automatically find the closest “shorten character” and strips it there. In the final result it will add ellipsis which indicates that the text was shortened. As example let’s use this sentence:
-
This text is going to be shorter.
If developer wants to make it shorter down to 15 characters, he calls
<Basic.ShortText text="This text is going to be shorter." maxLength={ 15 } cutChar=" " cutPointEnd />
and gets:
-
This text is…
As you can see, result has 15 characters or less and an ellipsis. There is also another usage of this component in paths. With optional “shorten character” we are able to strip paths as well. For example consider this path:
-
web/new/menu/
We will use “/” as path delimiter and we will make it shorter from the beginning down to 6 characters:
-
…/menu/
This feature is very useful when you have to format a long text on a webpage and, at the same time, do not want to make it look cramped.
Indication that “Filter” is filled-in
We could look for error for a long time, for example when we weren’t able to find some identity. After a while we could find out that some filter is active. This next new feature indicates to user whether the filter is currently used or not. When the filter is used, filter button changes its color to light blue. Default color of this button is light gray and it indicates that filter is not used.
Run chosen tasks
Suppose you go to Settings > Task scheduler tab and here you create two new tasks. Then you will go to the All tasks tab where you want to run just one of these two tasks. So far, there wasn’t an option to run just one task and the only option was Run created tasks which ran executed all of them. Not anymore!
Now it is possible to tick task or tasks you want to run and then hit toggle button on the top of the page.
I hope you appreciate these new features and components. Feel free to email me at info@bcvsolutions.eu or look at our Github if you want to know more about development of CzechIdM 7.