Modify

Opened 12 years ago

Closed 11 years ago

#10084 closed enhancement (fixed)

component selection depending on projects

Reported by: falkb Owned by: falkb
Priority: normal Component: SimpleMultiProjectPlugin
Severity: normal Keywords:
Cc: Christopher Paredes, thomasd Trac Release: 0.11

Description

each project can have its own component set which should be filtered at 'New Ticket'

Attachments (0)

Change History (13)

comment:1 Changed 12 years ago by falkb

Keywords: planned added

comment:2 Changed 12 years ago by falkb

(In [11650]) introduced mapping component<->project (additional Admin panel page for category project)

  • Refs #10084: now 'New Ticket' only offers the components associated with the chosen project
  • Refs #10085: now 'New Ticket' only offers the versions associated with the chosen project
  • Refs #10086: now the project<->version mapping is via the roadmap page, just click on a version date there and assign a project
  • Refs #10088: 2 additional checkboxes on the roadmap page: hide milestones + hide versions

comment:3 Changed 12 years ago by Adrian Fritz

Question: is it possible to have a component associated to more than one project?

  • Use case 1:
    1. a component is developed in project 1
    2. same component evolves in project 2
  • Use case 2:
    1. a component is developed in project 1
    2. same component is simultaneously developed under project 2

comment:4 in reply to:  3 Changed 12 years ago by falkb

Cc: thomasd added

Replying to AdrianFritz:

Question: is it possible to have a component associated to more than one project?

Yes, for a list of components and for every component, you just select in which projects the component is available.

comment:5 Changed 12 years ago by falkb

Keywords: testing added
Owner: changed from Christopher Paredes to falkb
Status: newassigned

comment:6 Changed 12 years ago by falkb

Keywords: testing removed

TODO reuse 'Admin'=>'Ticket System'=>'Components' instead of having an own 'Admin'=>'Manage Projects'=>'Components'

comment:7 Changed 12 years ago by Adrian Fritz

Working good.

comment:8 Changed 12 years ago by heiko.boettger@…

Just tried to create a ticket and found out that there is a little issue. When a ticket is created, the first component is filled in a standard. Now when changing the project selection the component (i think its always the last selection) remains in the combobox. Is it possible to change the component to empty, when the old selection is no longer valid?

comment:9 in reply to:  8 Changed 12 years ago by falkb

Replying to heiko.boettger@gmx.de:

Just tried to create a ticket and found out that there is a little issue. When a ticket is created, the first component is filled in a standard. Now when changing the project selection the component (i think its always the last selection) remains in the combobox. Is it possible to change the component to empty, when the old selection is no longer valid?

Before I'm able to have a look at this problem in some days, could you have a look at simplemultiprojectplugin/trunk/simplemultiproject/htdocs/filter_milestones.js and see if you can provide a fix to us by yourself?

comment:10 Changed 12 years ago by heiko.boettger@…

Yes, why not. Ah I see, the problem is that the cur_comp must be reset if not valid:

When I remember js-script right it should look something like that:

function smp_updateSelect(id, newOptions, selectedOption)
{
    var field_id = '#field-' + id;
    var select = $(field_id);
    var options;
    if (select.prop) {
        options = select.prop('options');
    }
    else {
        options = select.attr('options');
    }
    select.empty();
    
    var addedOptions = [];
    if (newOptions) {
        $.each(newOptions, function(val, text) {
            var isSelected = (selectedOption && text == selectedOption);
            options[options.length] = new Option(text, text, isSelected, isSelected);
            addedOptions.push(text);
        });
    }

    if (selectedOption && $.inArray(selectedOption, addedOptions) == -1) {
        options[options.length] = new Option(selectedOption, selectedOption, true, true);
    }
    
    // call custom event trigger to allow other plugins to notify the change
    $(field_id).trigger("onUpdate");
}

function smp_onProjectChange(project)
{
    if (!project) {
        project = smp_initialProjectMilestone[0];
    }

    // milestones
    var milestones = smp_milestonesForProject[project];
    var selectedMilestone = "";

    if (project == smp_initialProjectMilestone[0]) {
        selectedMilestone = smp_initialProjectMilestone[1];
    }
    smp_updateSelect('milestone', milestones, selectedMilestone);

    // components
    var components = smp_all_components;
    var cur_comp = $('#field-component option:selected').text();
    var filtered_components = [];
    var cur_comp_valid = false;  
  
    for (var i = 0; i < components.length; i++) {
        var comp = components[i];
        if (!smp_component_projects[comp] || $.inArray(project, smp_component_projects[comp]) != -1) {
            filtered_components.push(comp);
            cur_comp_valid = cur_comp_valid || (comp == cur_comp);       
        }
    }

    if (!cur_comp || cur_comp == "" || !cur_comp_valid) {
        cur_comp = smp_default_component;
    } 
    
    smp_updateSelect('component', filtered_components, cur_comp);

    // versions
    smp_updateSelect('version', smp_project_versions[project], smp_default_version);
}

jQuery(document).ready(function($) {
    smp_onProjectChange();
});

Is there a way to know if this is a new ticket and the user never touched the component field. I think this is the only case where the component field should be auto-filled.

comment:11 Changed 12 years ago by falkb

(In [12006]) Refs #10084: applied the Heiko Böttger's patch of 10, reset of component if not available anymore after project switch. Thank you very much Heiko!

comment:12 in reply to:  10 Changed 12 years ago by falkb

Replying to heiko.boettger@gmx.de:

Is there a way to know if this is a new ticket and the user never touched the component field.

No, I don't think so

comment:13 Changed 11 years ago by falkb

Keywords: planned removed
Resolution: fixed
Status: assignedclosed

Now I've dropped the idea of reusing 'Admin'=>'Ticket System'=>'Components' instead of having an own 'Admin'=>'Manage Projects'=>'Components'. Reasons:

  • It's hard to integrate another column with HTML stream Genshi transformers, especially if other plugins also add columns.
  • And the output would be just a cosmetic improvement.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain falkb.
The resolution will be deleted. Next status will be 'reopened'.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.