Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.

Bug 1084935

Summary: Unable to assign icon to the custom Work Item
Product: [Retired] JBoss BPMS Platform 6 Reporter: Anton Giertli <agiertli>
Component: Business CentralAssignee: Marco Rietveld <mrietvel>
Status: CLOSED EOL QA Contact: Sona Mala <smala>
Severity: high Docs Contact:
Priority: high    
Version: 6.0.1CC: kverlaen, mbaluch, smala, tsurdilo
Target Milestone: ER5   
Target Release: 6.1.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-03-27 20:13:53 UTC Type: Enhancement
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
icon
none
Screenshot: differences between git and uploaded file
none
Work Item definitions (tasks with different paths to the custom icons)
none
Zip file with custom icons none

Description Anton Giertli 2014-04-07 10:21:54 UTC
Created attachment 883552 [details]
icon

Description of problem:

It is not possible to assign custom item to the custom Work Item.

Version-Release number of selected component (if applicable):

BPM 6.0.1
BPM 6.0.0 (even file upload does not work)
How reproducible:
always

Steps to Reproduce:
My test case consisted of the following :
 
1) new repo
2) new project
3) new process
4) New item -> Uploaded file - select 16x16 icon from the disk (sample check.png is attached) - git url indicates the icon will be uploaded in src/main/resources
Icon is there, however, it is *not* possible to reference this icon in the workitem definition

For example:

  [
    "name" : "MyIcon",
    "parameters" : [
      "Message" : new StringDataType()
    ],
    "displayName" : "MyIcon",
    "icon" : "checkicon" // does not work

  check.png does not work either. Also, it is very confusing to have there also resource name when uploading the icon -- how to know which one use for referencing ? resource name OR filename ?

One possible workaround is to add icon manually into the repository (in the global folder) with the following command sequence:

git clone ssh://anton@localhost:8001/playground-repo
cd playground-repo/iconUpload/global
cp ~/Downloads/check.png .
git add check.png 
git commit -m "icon"
git push

once the icon is in the "global" folder it is possible to reference it using filename; i.e.:

 "icon" : "check.png"

IF it is possible to reference icon even if it's uploaded in the src/main/resources then show how - I have tried *many* ways, such as ../src/main/resources/check.png and none of them worked.

IF it is not possible to reference icon if it's uploaded in the src/main/resources then make sure that user has the possibility to upload icon directly in the 'global' folder and that he does not need to use command line git in order to do it.

Actual results:
It is not possible to assign uploaded icon to the custom work item
Expected results:
It is possible to assign uploaded icon to the custom work item

Additional info:

Comment 3 Sona Mala 2014-04-07 11:15:24 UTC
Hi Anton,
please try use name for the uploaded file "checkicon.png" instead of "checkicon".

I think that this is still the issue of the user experience. Lots of OS hide extensions of files. I think that it will be a nice feature to copy extension from the uploaded file. Please allow to use the original name without typing.

Comment 4 Sona Mala 2014-04-07 11:51:55 UTC
I think that the best idea how it should work is:

   1) If the input field is empty then use name of the file which is uploaded.
      Please, do not forgot check the name of the file (incorrect character, file already exists, extension control, etc.)

   2) In case that the validation of the name fails, set a value of the input field to the name of the uploaded file or the previous value of the input field.

   3) Optional: in case that the value of input field does not contain extension, use the extension of file (of course if the file has any extension).

Comment 5 Anton Giertli 2014-04-07 14:11:59 UTC
Hi Sona,

I am not sure I understand correctly. The issue is not with the confusion regarding resource name / file name (though from the UX perspective it is not very fortunate ).

The issue is that the newly uploaded icon will be placed into the src/main/resources folder where it can't be referenced from the WorkItem definition.

If I manually put it in the 'global' folder (via git) then I can reference it in the definition easily just by using filename.

Cheers,
Anton

Comment 6 Sona Mala 2014-04-08 07:36:27 UTC
Hi Anton,
I added my custom icon to the default package in my project. Please follow my steps:

1. create new repository (for example "myRepo")
2. create new project (for example "project")
3. project explorer settings are "Project View" and "Shows as Folder"
4. go to default package
5. create WID (fro example "task1")
6. show options for the select element "Select icon to add"
    -> options are missing
7. close WID
8. create new Uploaded file which name is "myicon" (no extension)
9. open WID
    -> options for icon are still missing
10. create new uploaded file which name is "myicon.png" (with extension)
    -> the selector contains one option "myicon.png"


There is difference between name of Uploaded file "myicon" versus "myicon.png".

I will check what happen if the icon is added by git.

Comment 7 Sona Mala 2014-04-08 07:52:17 UTC
Created attachment 883917 [details]
Screenshot: differences between git and uploaded file

Hi Anton,
when you use git then the name of the file still contains extension.

If you uploaded file and you do not use extension (for example just "customicon") then you loose information about the type of the uploaded file.

For more information, see this attachment.

Comment 9 Sona Mala 2014-04-08 09:50:52 UTC
My misunderstanding of this issue.

I though that something is wrong with WID like that validation failed, etc. 

The original problem is that Designer does not show the desired content of the imported icon. It shows just a default one.

It seems that this issue is quite larger. I cannot change the icon to defaultemailicon.gif or defaultlogicon.gif. In all cases, defaultservicenodeicon.png is displayed in Designer.

Comment 10 Sona Mala 2014-04-08 13:12:11 UTC
The first problem is that the selector of icons generates invalid path:
    - Actual result:
        - the icon is references as relative path from WID
        - for example: WID is in default package so the selector inserts "../../../global/icon.png"
    - Expected result:
        - show same path which expect Designer
        - now (6.0.1.GA) it is only images in global directory and its child folders


The second problem is that business-central does not allow adding custom files into the "global" folder:
    - Actual result:
        - options of the "New Item" drop down menu are disabled
    - Expected result:
        - because user can modify files in this folder (WID, *.json. etc.) so this folder does not require read-only mode.
        - Option 1:
              - dedicate one folder in busines-central.war where users can specify own extensions (icons, configuration file, WID, etc)
              - this folder will be copied into project when user create new project
                (not when the first process is opened)
        - Option 2:
              - enable options of the "New Item" drop down menu which are expected in the "global" folder (for example WID, Uploaded files, etc.).
        - Option 3:
              - implement option 1 and option 2 

The third problem is that users need to open Designer when they want to use some predefined icons/services:
     - Email,Log,Rest,WS WID should be the part of the "global" folder (now each package contains same file)
     - this issue should be partially solved by Option 1 in the previous problem.

Comment 12 Jeremy Lindop 2015-01-09 12:01:34 UTC
The problem of associating an icon with a WID has been fixed by the commits in Comment10 of https://bugzilla.redhat.com/show_bug.cgi?id=1040910.
When you import a WID from an external repository such as http://people.redhat.com/tsurdilo/repository, the .wid and associated icon files are now placed in src/main/resources, not in the globals directory. Since you can upload icons to src/main/resources, you can upload an icon file and change the reference to the icon in the .wid file.

This fix is not straightforward to test because there is a bug in the uploading of .png files (and other file types) - see https://bugzilla.redhat.com/show_bug.cgi?id=1180224

At present, to successfully upload a .png file, you need to do this:
In Project Authoring:
1. Select New Item -> Uploaded File
2. Browse to a .png file, e.g. the attached icon 'check.png'
3. Enter filename as the same as the file you're going to upload, i.e. 'check.png'
4. To check the file contents, open the "Others" section, select the file (alternatively, select the file in Repository View. Then in the editor that opens
 a) Click 'Download' and look at the downloaded file on your file system - the file will be empty
 b) Still in the editor with the "Download" button, click "Choose file..." then browse to the original check.png on your file system
 c) Click "Upload"
 d) To verify that the file has been uploaded, click 'Download' a 2nd time and look at the file that has been downloaded.
 
 For the issues noted in Comment 1-3 around file extensions, see https://bugzilla.redhat.com/show_bug.cgi?id=1091204

Comment 14 Sona Mala 2015-01-14 15:46:28 UTC
Hi Jeremy,
there are two options how I can create a custom task in Designer:
  a) import it from some Service Repository,
  b) create a WID file in a project where I have to reference an icon path.

Description of this issue:
-------------------------
This issue is about a referencing of an icon from a WID file (WID can be place in various packages). There should be possibility to create an custom icon. It means that a user can add, delete or change icons in project.

=============================================================================


Notes:
------

I mentioned 3 problems in comment #10:
  1) WID editor contains a selector of icons
         - scope of this issue: If I use the selector, I want to insert the right path of the icon and Designer displays the right icon in Object repository
         - there should be an agreement between WID Editor and Designer
  2) The folder 'global' does not allow to add an icon
         - scope of this issue: User can add, delete or change an icon
  3) The empty project does not allow to select any icon (no predefined icons)
         - this is not important when an user can defined and use own icon.


I put all these problems here because they can be solve in one system solution. If some problem lefts I will report new issues.


Please, can you write me if something is still unclear?

Comment 15 Jeremy Lindop 2015-01-15 10:32:09 UTC
Hi Sona,
Thanks for the clarification.

I am wondering whether we should mark this BZ entry as modified now that the initial bug is (almost) fixed, and create a separate Feature Request for your notes in Comment 10 / Comment 14. In particular, your note in Comment 14 "2) The folder 'global' does not allow to add an icon..." requires a change to the "New -> Uploaded File" functionality which is a Business-Central issue rather than a Designer issue, so maybe it makes sense to make a new Feature Request BZ entry for this. If you agree that a new Feature Request should be created, will you create one? Thanks.

- When I say the original bug is 'almost' fixed, there's an aspect of it that I'll work on today to complete it.

Comment 16 Sona Mala 2015-01-15 13:33:22 UTC
I think that Problem #2 is out of scope, because you moved WID which are imported from service repository from 'global' directory to 'src/main/resources' directory and there could be posible to add icons.

I am going to check it (fire bugs) when the issue will be set to ON_QA.

I would like to know where I should create an icon file if I wrote "icon": "customicon.png" into WID.

Comment 17 Jeremy Lindop 2015-01-15 17:14:50 UTC
Thanks Sona for your response.

I've completed the fix for the initial bug so that relative and absolute icon paths work in WID files. For example:

 "icon" : "myicon.png"           (icon in same folder as .wid file)
 "icon" : "com/test/myicon.png"  (icon relative to .wid file location)
 "icon" : "../test/myicon.png"   (icon relative to .wid file location)
 "icon" : "/HR/src/main/resources/myicon.png"   (absolute path to icon)
	
master: https://github.com/droolsjbpm/jbpm-designer/commit/68b31b993f011045b89c26747f6f9f29a47a0f56
6.2.x: https://github.com/droolsjbpm/jbpm-designer/commit/808124d608ef46b1d1955c2249dba4e5dfbe4df7

Comment 18 Sona Mala 2015-02-25 09:14:37 UTC
The creation of own icons is allowed in 6.1.0 ER5.

The uploaded file asset always saves a new file into this folder: src/main/resources. The user can modify just a package where the file will be stored.

The user has to use git when he or she wants to add a file to the different location. My opinion is that business central supports the best practice now. The project customization should be stored in src/main/resources.

The user has to add an extension which represents an image content to the name of the updated file asset. The file without extension cannot be used as an icon of a custom task. This issue was verified with PNG extension. (open a new issue if you have problems with JPEG, GIF etc.).

The Designer accepts relative and absolute paths. The absolute path is referenced from the root of repository (/project/...). The relative path is referenced from the WID which uses the icon.

Steps which verify this issue:
1. Create uloaded files:  
     - /src/main/resources/checkicon (file checkicon from the attached zip)
     - /src/main/resources/checkicon.png (file blueicon.png from the attached zip)
     - /src/main/resources/org/kie/myicon.png (file checkicon from the attached zip)
     - /src/main/resource/org/kie/example/project1/icon.png (file check.png from the attached zip)
2. Create WID in /src/main/resources/org/kie/example/project1/ file
   (use attached WID definition)
3. Create BP
4. open Object library / service tasks section

Actual results:
All imported tasks contains the desired custom icon. Only the "Without Extension" task was not present in the service tasks section. Server.log contains error:

ERROR [org.jbpm.designer.web.preprocessing.impl.JbpmPreprocessingUnit] (http-localhost/127.0.0.1:8080-1) Unable to parse a workitem definition: String index out of range: -1

Comment 19 Sona Mala 2015-02-25 09:16:46 UTC
Created attachment 995035 [details]
Work Item definitions (tasks with different paths to the custom icons)

Comment 20 Sona Mala 2015-02-25 09:17:50 UTC
Created attachment 995036 [details]
Zip file with custom icons