{:uriI"file://app/assets/javascripts/mappings.js?type=application/javascript&pipeline=self&id=8aa5e2219bcdba930789eff64b526a4fd366c0e1285d62b3040d61b95b5f6c8f:ET:load_pathI"app/assets/javascripts;T:
filenameI"'app/assets/javascripts/mappings.js;T: nameI"
mappings;T:logical_pathI"mappings.self.js;T:content_typeI"application/javascript;T:sourceI" $(document).ready(function(){
$('select#boards, select#pipelines').on('change', fetchMappings);
$('form.mapping-select').on('ajax:success', createMapping);
});
function removeMapping(e) {
e.preventDefault();
$.ajax({
type: "DELETE",
url: `/mappings/${$(this).siblings('.mapping-id').data('id')}`,
dataType: 'json',
success: function(result) {
$(`.mapping-id[data-id="${result.data.id}"]`).parent().remove();
}
});
}
function createMapping(event) {
[response, _, _] = event.detail;
addMappingtoDOM(response.data.mapping);
}
function addMappingtoDOM(mappingData) {
var mappingRow = $('.mapping-row.template').clone().removeClass('template');
mappingRow.find('.board-list-id').text(mappingData.board_list_name);
mappingRow.find('.pipeline-stage-id').text(mappingData.pipeline_stage_label);
mappingRow.find('.mapping-id').attr('data-id', mappingData.id);
mappingRow.find('.remove-button').on('click', removeMapping);
$('.mapping-row.template').parent().append(mappingRow);
}
function fetchMappings() {
var spinner = new jQuerySpinner({
parentClass: 'wrapper'
});
spinner.show();
$.ajax({
url: "/mappings",
type: 'GET',
dataType: 'json',
data: {
board_id: $('#boards option:selected').val(),
pipeline_id: $('#pipelines option:selected').val(),
},
success: function(rsp){
if (rsp.status == 'ok'){
spinner.hide();
$('.mapping-row').not('.template').remove();
if (rsp.data.board_lists != null && rsp.data.pipeline_stages != null) {
if (rsp.data.mappings != null) {
$('.mapping-headers').css('display', 'flex');
_.each(rsp.data.mappings, function(mapping) { addMappingtoDOM(mapping) });
}
$('.mapping-select').css('display', 'flex');
_.each(rsp.data.board_lists, function(board_list){
$('#mapping_board_list_id').append(``);
});
_.each(rsp.data.pipeline_stages, function(pipeline_stage){
$('#mapping_pipeline_stage_id').append(``);
});
$('#mapping_board_id').val(rsp.data.board_id);
$('#mapping_pipeline_id').val(rsp.data.pipeline_id);
} else {
$('.mapping-select').hide();
$('.mapping-headers').hide();
}
}
}
});
}
;T:
metadata{:dependencieso:Set:
@hash}
I"environment-version;TTI"environment-paths;TTI"rails-env;TTI"Zprocessors:type=application/javascript&file_type=application/javascript&pipeline=self;TTI"5file-digest://app/assets/javascripts/mappings.js;TTF:
requiredo;;} F:stubbedo;;} F:
linkso;;} F:charsetI"
utf-8;F:digest"%ڹM$Bj1a}8(,pL:lengthi :dependencies_digest"%=˰vF!K)l\pN&db:idI"E8aa5e2219bcdba930789eff64b526a4fd366c0e1285d62b3040d61b95b5f6c8f;F:
mtimel+^)_