Ticket #10084 (assigned enhancement)

Opened 1 year ago

Last modified 8 months ago

component selection depending on projects

Reported by: falkb Assigned to: falkb (accepted)
Priority: normal Component: SimpleMultiProjectPlugin
Severity: normal Keywords: planned
Cc: crossroad, thomasd Trac Release: 0.11

Description

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

Attachments

Change History

06/13/12 08:46:00 changed by falkb

  • keywords set to planned.

06/18/12 09:15:08 changed 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

(follow-up: ↓ 4 ) 06/18/12 18:38:38 changed by AdrianFritz

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

(in reply to: ↑ 3 ) 06/18/12 20:33:04 changed by falkb

  • cc changed from crossroad to crossroad, thomasd.

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.

06/25/12 09:23:49 changed by falkb

  • owner changed from crossroad to falkb.
  • status changed from new to assigned.
  • keywords changed from planned to planned testing.

06/25/12 11:14:59 changed by falkb

  • keywords changed from planned testing to planned.

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

06/28/12 04:22:48 changed by AdrianFritz

Working good.

(follow-up: ↓ 9 ) 09/05/12 09:46:45 changed by 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?

(in reply to: ↑ 8 ) 09/12/12 11:13:02 changed 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?

(follow-up: ↓ 12 ) 09/14/12 23:20:24 changed by heiko.boettger@gmx.de

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.

09/17/12 08:21:50 changed 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!

(in reply to: ↑ 10 ) 09/17/12 08:32:04 changed 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


Add/Change #10084 (component selection depending on projects)




Change Properties
Action