Bug 226851 - support custom attributes in the new bugzilla task editor
Summary: support custom attributes in the new bugzilla task editor
Status: RESOLVED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Mylyn (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows Vista
: P3 normal with 1 vote (vote)
Target Milestone: 3.1   Edit
Assignee: Frank Becker CLA
QA Contact:
URL:
Whiteboard:
Keywords: noteworthy
: 247900 (view as bug list)
Depends on: 254697
Blocks: 246260
  Show dependency tree
 
Reported: 2008-04-13 20:35 EDT by Robert Elves CLA
Modified: 2008-11-09 14:57 EST (History)
4 users (show)

See Also:


Attachments
patch (12.05 KB, patch)
2008-04-20 16:58 EDT, Frank Becker CLA
no flags Details | Diff
mylyn/context/zip (11.23 KB, application/octet-stream)
2008-04-20 16:58 EDT, Frank Becker CLA
no flags Details
patch with new custom field type (34.45 KB, patch)
2008-04-24 16:16 EDT, Frank Becker CLA
no flags Details | Diff
mylyn/context/zip (34.73 KB, application/octet-stream)
2008-04-24 16:16 EDT, Frank Becker CLA
no flags Details
patch for 3.1 (10.82 KB, patch)
2008-09-10 17:25 EDT, Frank Becker CLA
no flags Details | Diff
mylyn/context/zip (54.98 KB, application/octet-stream)
2008-09-10 17:25 EDT, Frank Becker CLA
no flags Details
updated patch for 3.1 (10.60 KB, patch)
2008-09-10 17:36 EDT, Frank Becker CLA
no flags Details | Diff
mylyn/context/zip (53.48 KB, application/octet-stream)
2008-09-10 17:36 EDT, Frank Becker CLA
no flags Details
patch full function without junit tests (21.28 KB, patch)
2008-10-27 23:41 EDT, Frank Becker CLA
no flags Details | Diff
mylyn/context/zip (48.32 KB, application/octet-stream)
2008-10-27 23:41 EDT, Frank Becker CLA
no flags Details
patch with junit test (29.86 KB, patch)
2008-10-30 17:34 EDT, Frank Becker CLA
no flags Details | Diff
mylyn/context/zip (50.71 KB, application/octet-stream)
2008-10-30 17:34 EDT, Frank Becker CLA
no flags Details
new patch (34.51 KB, patch)
2008-11-01 16:06 EDT, Frank Becker CLA
no flags Details | Diff
mylyn/context/zip (60.93 KB, application/octet-stream)
2008-11-01 16:06 EDT, Frank Becker CLA
no flags Details
Updated patch (33.67 KB, patch)
2008-11-03 18:27 EST, Robert Elves CLA
no flags Details | Diff
update without tests (26.42 KB, patch)
2008-11-04 01:26 EST, Robert Elves CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Robert Elves CLA 2008-04-13 20:35:43 EDT
It would be great if we could add custom attribute support to the NewBugzillaTaskEditor, but we don't have access to the "Can be set on bug creation" field in the config rdf output. We'll need to investigate whether the new bugzilla web service api is exposing this field or not (perhaps as part of bug#154785 ).
Comment 1 Frank Becker CLA 2008-04-14 16:51:09 EDT
(In reply to comment #0)
> It would be great if we could add custom attribute support to the
> NewBugzillaTaskEditor, but we don't have access to the "Can be set on bug
> creation" field in the config rdf output. We'll need to investigate whether the
> new bugzilla web service api is exposing this field or not (perhaps as part of
> bug#154785 ).
> 

After solving my problems with SOAP::Lite I try to find out if the needed information are included.

But my knowledge of perl is not that perfect, so that could take some time.



Comment 2 Frank Becker CLA 2008-04-18 17:10:57 EDT
Rob,

I did some test with Bugzilla 3.1.3 and found no way to get the value of the creationflag for custom attributes.

I think we must create a  enhancment that config.cgi returns the flag for custom attributes.

Comment 3 Frank Becker CLA 2008-04-19 15:30:23 EDT
Request created:

See https://bugzilla.mozilla.org/show_bug.cgi?id=429847
Comment 4 Frank Becker CLA 2008-04-20 16:58:53 EDT
Created attachment 96757 [details]
patch

This is the first Version.

Here the point that I think we should work on.

1) Code in NewBugzillaTaskEditor is duplicate of BugzillaTaskEditor
2) actually I did no tests with Bugzilla 3.1.3 only Bugzilla - Development was used
    (see https://bugzilla.mozilla.org/show_bug.cgi?id=429847)
3) The new included Custom Filed Types are currently not supported.

Thoughts?
Comment 5 Frank Becker CLA 2008-04-20 16:58:56 EDT
Created attachment 96758 [details]
mylyn/context/zip
Comment 6 Steffen Pingel CLA 2008-04-21 02:12:56 EDT
I am still in the process of refactoring the editor API. Once that is complete connectors will only need to implement one editor that can be used for creating new tasks as well editing existing tasks. 
Comment 7 Frank Becker CLA 2008-04-24 16:16:07 EDT
Created attachment 97520 [details]
patch with new custom field type 

The upcoming Bugzilla Version 3.2 will have support for the following 5 types
1) Free Text
2) Drop Down
3) Multiple-Selection Box
4) Large Text Box
5) Date/Time

All five Types are now supported in Edit and New Editor Mode.
Comment 8 Frank Becker CLA 2008-04-24 16:16:10 EDT
Created attachment 97521 [details]
mylyn/context/zip
Comment 9 Frank Becker CLA 2008-09-10 17:25:01 EDT
Created attachment 112252 [details]
patch for 3.1

Here is my patch for Mylyn 3.1.

Support for Bugzilla 3.2rc1 is included
Comment 10 Frank Becker CLA 2008-09-10 17:25:06 EDT
Created attachment 112253 [details]
mylyn/context/zip
Comment 11 Frank Becker CLA 2008-09-10 17:36:01 EDT
Created attachment 112257 [details]
updated patch for 3.1

Sorry,

I had inserted unnecessary lines.
Comment 12 Frank Becker CLA 2008-09-10 17:36:04 EDT
Created attachment 112258 [details]
mylyn/context/zip
Comment 13 Robert Elves CLA 2008-10-04 15:48:14 EDT
This is going to be *great* Frank. I've set up a Bugzilla 3.2rc1 that we can test against (along with the regualar test account):

		http://mylyn.eclipse.org/bugs32/

Here are a few nits that would be great if you could investigate and write up some unit test coverage for:

* Submission of multiselect is only submitting first selected item, (may be bug in multiselect editor part?)
* The date widet isn't getting updated, nor does submission work (looks like time format differences need to be accounted for)
Comment 14 Robert Elves CLA 2008-10-04 17:22:02 EDT
*** Bug 247900 has been marked as a duplicate of this bug. ***
Comment 15 Frank Becker CLA 2008-10-27 23:41:38 EDT
Created attachment 116247 [details]
patch full function without junit tests

(In reply to comment #13)
> This is going to be *great* Frank. I've set up a Bugzilla 3.2rc1 that we can
> test against (along with the regualar test account):
> 
>                 http://mylyn.eclipse.org/bugs32/

Sorry this is comming soon for the submit of bugs.

Please point me to an junit test for UI (simulate keystrokes) 
> 
> Here are a few nits that would be great if you could investigate and write up
> some unit test coverage for:
> 
> * Submission of multiselect is only submitting first selected item, (may be bug
> in multiselect editor part?)
Fix is included
> * The date widet isn't getting updated, nor does submission work (looks like
> time format differences need to be accounted for)
Fix is included
Comment 16 Frank Becker CLA 2008-10-27 23:41:42 EDT
Created attachment 116248 [details]
mylyn/context/zip
Comment 17 Frank Becker CLA 2008-10-30 17:34:51 EDT
Created attachment 116568 [details]
patch with junit test
Comment 18 Frank Becker CLA 2008-10-30 17:34:55 EDT
Created attachment 116569 [details]
mylyn/context/zip
Comment 19 Robert Elves CLA 2008-10-31 00:14:56 EDT
Awesome Frank. My concern now is just with the changes that were necessary in DateAttributeEditor and TaskEditorAttributePart.  These changes were necessary to get time to display in the ui.  I wonder if this warrants a TaskAttribute.TYPE_DATETIME in addition to the existing TaskAttribute.TYPE_DATE type (and would simply extend the existing DateAttributeEditor but set show time to true?  

Steffen, does this sound reasonable to you?
Comment 20 Steffen Pingel CLA 2008-10-31 01:18:57 EDT
Yes, a new type for date/time sounds fine.
Comment 21 Frank Becker CLA 2008-11-01 16:06:15 EDT
Created attachment 116701 [details]
new patch

In TaskEditorSummaryPart.addAttribute the following lines can be removed after Jira, Trac and XPlanner have changed there implementation from TYPE_DATE to TYPE_TIMESTAMP

			if (isAttribute(attribute, TaskAttribute.DATE_MODIFICATION) && editor instanceof DateAttributeEditor) {
				((DateAttributeEditor) editor).setShowTime(true);
			}
Comment 22 Frank Becker CLA 2008-11-01 16:06:23 EDT
Created attachment 116702 [details]
mylyn/context/zip
Comment 23 Robert Elves CLA 2008-11-03 18:27:51 EST
Created attachment 116886 [details]
Updated patch

Looks like were done here Frank!  I just fixed up a few layout issues and eliminated a couple classes.  Steffen, if you could review the editor framework changes proposed here then we can commit if all is well!
Comment 24 Steffen Pingel CLA 2008-11-03 21:06:38 EST
Looks good! Minor nit: The constructor of BugzillaCustomField could be simplified and the class should be made immutable.

I have extended LayoutHint so you should be able to use the copy constructor in BugzillaTaskEditorPage.createAttributeEditorFactory():

 editor.setLayoutHint(new LayoutHint(editor.getLayoutHint()) {
						@Override
						public int getPriority() {
							return super.getPriority() * 10;
						}
					});


I have created bug 253633 to track the API changes.
Comment 25 Steffen Pingel CLA 2008-11-03 21:18:43 EST
Here is how you could refactor BugzillaCustomField to make it immutable:

	public BugzillaCustomField(String description, String name, String type, String typeDesc, String enterBug) {
		this.description = description;
		this.name = name;

		this.type = parseInt(type);
		this.typeDesc = typeDesc;
		this.enterBug = "1".equals(enterBug);
	}

	private int parseInt(String type) {
		try {
			return Integer.parseInt(type);
		} catch (NumberFormatException e) {
			return -1;
		}
	}
	
The patch is pretty big. It would probably make sense to split out the test case and create a separate bug for that.
Comment 26 Robert Elves CLA 2008-11-04 00:23:24 EST
Okay thanks Steffen. I'll update the path with these suggestions....
Comment 27 Robert Elves CLA 2008-11-04 01:26:12 EST
Created attachment 116902 [details]
update without tests

Updated patch with changes suggested and removed tests. Frank, if you want to post those to a separate report that would be great. I can apply this patch as is.  Steffen, note I had to set layout hints for in the constructor of the DateAttributeEditor and TextAttributeEditor. Shouldn't be any nagative side effects.
Comment 28 Robert Elves CLA 2008-11-04 01:39:19 EST
Patch applied, ip log updated.
Comment 29 Robert Elves CLA 2008-11-09 14:57:33 EST
Marking resolved, Frank if you could post the unit tests to bug#254697 that would be great.