diff --git a/module/bug/js/common.ui.js b/module/bug/js/common.ui.js index 2605cb5831..ee901c424a 100644 --- a/module/bug/js/common.ui.js +++ b/module/bug/js/common.ui.js @@ -8,7 +8,7 @@ function changeProduct(event) const productID = $(event.target).val(); if(productID == undefined) return false; - if(typeof(changeProductConfirmed) != 'undefined' && !changeProductConfirmed && productID != bug.productID) + if(typeof(changeProductConfirmed) != 'undefined' && !changeProductConfirmed && productID != bug.productID && (typeof(isShadowProduct) == 'undefined' || !isShadowProduct)) { zui.Modal.confirm({message: confirmChangeProduct, onResult: function(result) { @@ -54,13 +54,37 @@ function changeBranch(event) function changeProject(event) { - const productID = $('[name="product"]').val(); - const projectID = $(event.target).val(); + const projectID = $(event.target).val(); + const projectInfoLink = $.createLink('bug', 'ajaxGetProjectInfo', 'projectID=' + projectID); + $.getJSON(projectInfoLink, function(project) + { + $('#executionBox').closest('tr').toggleClass('hidden', project.multiple == 0); + }); - loadExecutionLabel(projectID); - loadExecutions(productID, projectID); - loadAssignedTo(productID, projectID); - if(methodName == 'edit' && edition == 'max') loadIdentify(); + if(config.currentMethod == 'edit' && isShadowProduct) + { + const productIDLink = $.createLink('bug', 'ajaxGetProductIDByProject', 'projectID=' + projectID); + $.get(productIDLink, function(id) + { + const productID = id; + const $productPicker = $('.detail-side [name=product]').zui('picker'); + $productPicker.$.setValue(productID); + + loadExecutionLabel(projectID); + loadExecutions(productID, projectID); + loadAssignedTo(productID, projectID); + if(methodName == 'edit' && edition == 'max') loadIdentify(); + }); + } + else + { + const productID = $('[name="product"]').val(); + + loadExecutionLabel(projectID); + loadExecutions(productID, projectID); + loadAssignedTo(productID, projectID); + if(methodName == 'edit' && edition == 'max') loadIdentify(); + } } function changeExecution(event) @@ -184,6 +208,9 @@ function loadProductModules(productID) let $modulePicker = $('[name="module"]').zui('picker'); $modulePicker.render({items: data}); if(moduleID != 0) $modulePicker.$.setValue('0'); + + $('#manageModule').toggleClass('hidden', data.length > 1); + if(data.length <= 1) $('#manageModule').attr('href', $.createLink('tree', 'browse', 'rootID=' + productID + '¤tModuleID=' + moduleID + '&branch=' + branch)); }); } @@ -192,7 +219,7 @@ function loadProductProjects(productID) let branch = $('[name="branch"]').val(); if(typeof(branch) == 'undefined') branch = 0; - const link = $.createLink('product', 'ajaxGetProjects', 'productID=' + productID + '&branch=' + branch + '&projectID=' + $('[name="project"]').val()); + const link = $.createLink('bug', 'ajaxGetProjects', 'productID=' + productID + '&branch=' + branch + '&projectID=' + $('[name="project"]').val()); $.getJSON(link, function(data) { let project = $('[name="project"]').val(); @@ -547,8 +574,9 @@ function loadTestTasks(productID, executionID) function loadAllBuilds(event) { - const productID = $('[name="product"]').val(); - const buildBox = $(event.target).closest('.input-group').find('select').attr('name').replace('[]', ''); + const productID = $('[name="product"]').val(); + const $buildElement = $(event.target).closest('.input-group').find('select').length > 0 ? $(event.target).closest('.input-group').find('select') : $(event.target).closest('.input-group').find('input'); + const buildBox = $buildElement.attr('name').replace('[]', ''); loadProductBuilds(productID, 'all', buildBox); } diff --git a/module/bug/ui/edit.html.php b/module/bug/ui/edit.html.php index 0d301ecacd..3f5517a5ff 100644 --- a/module/bug/ui/edit.html.php +++ b/module/bug/ui/edit.html.php @@ -22,6 +22,7 @@ jsVar('released', $lang->build->released); jsVar('confirmUnlinkBuild', sprintf($lang->bug->notice->confirmUnlinkBuild, zget($resolvedBuildPairs, $bug->resolvedBuild))); jsVar('projectExecutionPairs', $projectExecutionPairs); jsVar('edition', $config->edition); +jsVar('isShadowProduct', !empty($product->shadow)); detailHeader ( @@ -359,7 +360,8 @@ detailBody ( set::name('project'), set::items($projects), - set::value($bug->project) + set::value($bug->project), + set::required(!empty($product->shadow)) ) ) ),