<div class="modal" id="myModal" aria-hidden="true" style="width: 400px; margin-left: 50%; "> <div class="modal-dialog" style="width: 400px; "> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" id="myModal-exit">×</button> <h1 id="serviceTitle"></h1> </div> <div class="modal-body" id="nModal-body" style="min-height:200px;"> <textarea name="users" class="group-field" id="domain" style="width:360px;height:100px;"></textarea>
<p class="text text-info" style="font-size:12px;line-height:24px;" data-i18n="ns.dashboard:teamInfo.teamTran.tranTips"></p> <a href="javascript:void(0);" class="btn btn-success" id="transforBtn" style="float:right"> <i class="fa fa-check"></i><span>Submit</span> </a> </div> <div class="modal-footer" style="padding:0px;"> </div> </div> </div> </div>
/*存放用户权限*/ var userPerm = ""; var service = ""; /*build按钮单击事件*/ function showBuild(index) { $("#branchList").empty(); $("#buildTemplatesCheckBoxs").empty(); $("#buildPropertyList #buildProperty").empty(); document.getElementById("revision_text").value = ""; var scorllTop = top.document.body.scrollTop; $("#buildCheckBox").show() service = JSON.parse(JSON.stringify(services[index])); var branchArr = eval(service.branch_svn_urls) for (i in branchArr) { var op = '<option>' + branchArr[i] + '</option>'; $("#branchList").append(op); }
$.each(service.build_template.split(","), function (key, buildTemplate) { tempalte = buildTemplate.split(":") var op = '<input name="templates" style="vertical-align: middle" type="checkbox" value="' + tempalte[0] + '^' + tempalte[1] + '"><span style="vertical-align: middle"> ' + tempalte[1] + '</span> </label>'; $("#buildTemplatesCheckBoxs").append(op); }) $.each(eval(service.properties), function (key, property) { var op = '<tr><td><input type="text" name="propertyName" readonly value="' + property.key + '"></td><td><input type="text" name="propertyValue" id="" value=' + property.value + '></td></tr>'; $("#buildPropertyList #buildProperty").append(op); }); } /*检查build提交数据*/ function checkBuild() { var length = 0; var buildTemplates = document.getElementById("buildTemplatesCheckBoxs").getElementsByTagName("input"); for (var i = 0; i < buildTemplates.length; i++) { if (buildTemplates[i].checked) { length++; } } if (length == 0) { alert("Please select at least one Build Template"); return false; }
@Klaus.Fenng:
var valid = /[<>]+/i; var properties = document.getElementById("buildProperty").getElementsByTagName("input"); for (var i = 1; i < properties.length; i = i + 2) { if (valid.test(properties[i].value)) { alert("Value can not contain < or >"); return false; } } return true; } /*构建提交*/ function buildSubmit() { var branch = document.getElementById("branchList").value; var buildTemplates = document.getElementById("buildTemplatesCheckBoxs").getElementsByTagName("input"); var j = 0; var buildTemplate = []; //获取所有勾选的build_template $("input[name='templates']:checked").each(function (i) { buildTemplate.push($(this).val()); }) var property = ''; $("#buildPropertyList tr").each(function (i) { var prokey = $(this).find("td input[name='propertyName']").val(), proVal = $(this).find("td input[name='propertyValue']").val() if (prokey) { property += prokey + '=' + proVal + ' '; //property.push({name:prokey,value:proVal}); } })
@Klaus.Fenng:
service.revision = $("#revision_text").val(); service.properties = property; service.build_template = buildTemplate; service.branch_svn_urls = branch; service.csrfmiddlewaretoken = $.cookie('csrftoken') $("#buildCheckBox").css("display", "none"); $("#serviceInfo").waiting(); var timerResp = setTimeout("javascript:alert('svn error,please check your svn configuration!');$('#serviceInfo').waiting('done');return;", 20000); //触发构建 $.post('/panda/build/', service, function (result) { clearTimeout(timerResp); if (result.err) { if (result.message) { alert(result.message); } else { alert("param error"); } $("#serviceInfo").waiting('done'); return; } else { $("#serviceInfo").waiting('done'); getDetail(service.name); } }); }
@Klaus.Fenng:
/*detail按钮单击事件*/ /*新增一行template*/ function addTemplate() { var templateTR = '<tr><td><input name="template_name"></td>' + '<td><input name="template_file_name"></td>' + '<td><button onclick="deleTR(this)">Delete</button></td></tr>'; $("#templateList").append(templateTR); } /*删除一行template*/ function deleTR(ele) { $(ele).parent("td").parent("tr").remove(); } function closeBox(id) { $("#" + id).hide(); } var detailsTimer = null;
@Klaus.Fenng:
/* *@param serviceName sercive名称 */ function fnBuildDetailList(param) { var timerFlag = false; var pandaDetails = []; param["csrfmiddlewaretoken"]=$.cookie('csrftoken') param['workspace']=ws $.post('/panda/data/getBuildDetail/', param, function (result) { if (result.length != 0 || param.pageIndex == 1) { pandaDetails = result; $("#tb_buildDetail").dataTable({ "bInfo": false, "bFilter": false, "bPaginate": false, "bAutoWidth": false, "bDestroy": true, "bProcessing": true, "aaSorting": [], "iDisplayLength": 10, "sScrollX": "120%", "sScrollY": "120%", "bScrollCollapse": true, "aaData": pandaDetails, "sPaginationType": "uci", "oLanguage": { "sUrl": '/static/lib/dataTables/media/us_oLanguage.txt' },
@Klaus.Fenng:
"aoColumns": [ {"mData": "no", "sClass": "text-center", "sWidth": "200px"}, {"mData": "user_id", "sClass": "text-center", "sWidth": "200px"}, {"mData": "master_ip", "sClass": "text-center", "sWidth": "200px", "fnCreatedCell": function (nTd, sData, oData, iRow, iCol) { var uciUrl = "http:\/\/" + oData.master_ip + ":3000\/projects\/" + oData.service_name + "\/builds\/" + oData.no; $(nTd).html("<a href=" + uciUrl + " target='_blank'>" + oData.master_ip + "</a>"); }}, {"mData": "branch_svn_urls", "sClass": "text-center", "sWidth": "200px", "fnCreatedCell": function (nTd, sData, oData, iRow, iCol) { var text = sData; if(sData.indexOf('/') > -1){ if("/" == sData.substring(sData.lastIndexOf('/'))){ sData = sData.substring(0,sData.length-1) } text = "<span style='cursor:help;' title="+sData+">" + sData.substring(sData.lastIndexOf('/')) + "</span>" } $(nTd).html(text); }}, {"mData": "reversion", "sClass": "text-center", "sWidth": "200px"}, {"mData": "status", "sClass": "text-center", "sWidth": "200px", "fnCreatedCell": function (nTd, sData, oData, iRow, iCol) { var status = oData.status, exitCode = oData.exit_code; if (status == 'WAITING') { $(nTd).html("<div class='sbtn swaiting'>WAITING</div>") } else if (status == 'RUNNING') { $(nTd).html("<div class='sbtn srunning'>RUNNING</div>") } else if (status == 'STOPPED') { $(nTd).html("<div class='sbtn sstopped'>STOPPED</div>") }
@Klaus.Fenng:
else if (status == 'FINISH') { //失败 if (parseInt(exitCode)) { $(nTd).html("<div class='sbtn sfailed'>FAILED</div>") } //成功 else { $(nTd).html("<div class='sbtn sfinish'>FINISH</div>") } } else { $(nTd).html("<div class='sbtn sfailed'>FAILED</div>") } }}, {"mData": "start_time", "sClass": "text-center", "sWidth": "200px"}, {"mData": "run_time", "sClass": "text-center", "sWidth": "200px", "fnCreatedCell": function (nTd, sData, oData, iRow, iCol) { var runTime = oData.run_time + "" $(nTd).html(runTime.substr(0, runTime.indexOf("."))); }}, {"mData": "status", "sWidth": "130px", "fnCreatedCell": function (nTd, sData, oData, iRow, iCol) { var uciUrl = "http:\/\/" + oData.master_ip + ":3000\/projects\/" + oData.service_name + "\/builds\/" + oData.no; if (oData.status == 'RUNNING' || oData.status == 'WAITING') { timerFlag = true; var tag = '<a href="jvascript:void(0)"><button class="cancel sbtn sred"><li class="glyphicon glyphicon-stop"></li></button></a> ' + '<a href="' + uciUrl + '" target="_blank"><button class="sbtn syellow1"><li class="glyphicon glyphicon-info-sign"></li></button></a>'; $(nTd).html(tag).find(".cancel").click(function () { var buildInfo = { master_ip: oData.master_ip, master_port: oData.master_port, build_id: oData.build_id }
@Klaus.Fenng:
$.post('/panda/data/cancelBuild', {buildInfo: buildInfo}); //修改当前行的状态为STOPPED var oTable = $('#tb_buildDetail').dataTable(); oTable.fnUpdate('STOPPED', iRow, 6); //禁用该按钮 $(nTd).html('<button disabled class="sbtn sgray"><li class="glyphicon glyphicon-stop"></li></button> ' + '<a href="' + uciUrl + '" target="_blank"><button class="sbtn syellow1"><li class="glyphicon glyphicon-info-sign"></li></button></a>'); }); } else { $(nTd).html('<button disabled class="sbtn sgray"><li class="glyphicon glyphicon-stop"></li></button> ' + '<a href="' + uciUrl + '" target="_blank"><button class="sbtn syellow1"><li class="glyphicon glyphicon-info-sign"></li></button></a>'); } }} ], "fnDrawCallback": function (oSettings) { var bH = $("#buildInfo").height(); var sH = $("#serviceInfo").height(); var nbH = bH < 480?480:sH>450?sH:480 $(".dataTables_scrollBody").height(nbH>480?nbH-100:480); }, "fnInitComplete": function(oSettings, json) { clearTimeout(detailsTimer); if($("#hideDetail").is(':visible') && timerFlag){ detailsTimer = setTimeout("fnBuildDetailList({service_name:'"+param.service_name+"'})",5000); } } }).show(); }
@Klaus.Fenng:
else { if (param.pageIndex == 1) { return; } param.pageIndex = 1; fnBuildDetailList(param); } }) $("#dataTablePageIndex").text(param.pageIndex); } /* *增加一行service信息 */ var serviceNum = 0; function appendService(panda) { if (panda.length == 0) { return; } var data = panda.data; serviceNum = data.length; for (var i = 0; i < serviceNum; i++) { /*管理员按钮*/ var editOp = '<div class="btn-group">' + '<button class="btn btn-warning">Action</button>'+ '<button class="btn btn-warning dropdown-toggle" data-toggle="dropdown"><span class="caret"></span></button>' + '<ul class="dropdown-menu">' + '<li><a href="/panda/data/getService?id=' + data[i].id + '&isEdit=true&ws=' + ws + '">Edit</a></li>' + '<li><a href="javascript:delService(\'' + data[i].id + '\',\'' + ws + '\')">Delete</a></li>' + '<li><a href="/panda/data/getService?id=' + data[i].id + '&isCopy=true&ws=' + ws + '">Copy</a></li>' + '</ul></div>';
@Klaus.Fenng:
var editBtn ='<div class="btn-group">' + '<button class="btn btn-warning">Action</button>'+ '<button class="btn btn-warning dropdown-toggle" data-toggle="dropdown"><span class="caret"></span></button>' + '<ul class="dropdown-menu">' + '<li><a href="/panda/data/getService?id=' + data[i].id + '&isEdit=true">Edit</a></li>' + '</ul></div>'; /*用户权限操作*/ var visibleUser = '' if (data[i].visible_user) { visibleUser = data[i].visible_user.toString(); } var enableUser = '' if (data[i].enable_user) { enableUser = data[i].enable_user.toString(); } var adminOp = '<div class="btn-group" style="margin-left:10px">' + '<button class="btn btn-primary">Special</button>'+ '<button class="btn btn-primary dropdown-toggle" data-toggle="dropdown"><span class="caret"></span></button>' + '<ul class="dropdown-menu">' + '<li><a href="javascript:void(0);" onclick="showServiceToSpecified(\'' + data[i].id + '\',\'' + visibleUser + '\',\'V\')">Visible</a></li>' + '<li><a href="javascript:void(0);" onclick="showServiceToSpecified(\'' + data[i].id + '\',\'' + enableUser + '\',\'E\')">Editable</a></li>' + '<li><a href="javascript:void(0);" onclick="showServiceToSpecified(\'' + data[i].id + '\',\'\',\'T\')">Transfer</a></li>' + '</ul></div>';
@Klaus.Fenng:
/*普通用户按钮*/ var buildOp = '<button class="btn btn-labeled btn-info" onclick="showBuild(\'' + i + '\')" style="margin-right:10px"><span class="btn-label"><i class="glyphicon glyphicon-refresh"></i></span> Build</button>' + '<button onclick="getDetail(\'' + data[i].name + '\')" class="btn btn-success btn-labeled" style="margin-right:10px"><span class="btn-label"><i class="glyphicon glyphicon-info-sign"></i></span> Detail</button>'; /*根据用户权限设置按钮*/ var _operation = buildOp; if (data[i].author_id == panda.admin) { _operation = buildOp + editOp + adminOp; } else { if (data[i].enable_user) { if (data[i].enable_user.indexOf(panda.admin) > -1) { _operation =buildOp + editBtn ; } } } var row_class = i % 2 ? 'double' : 'single'; var _configSvnUrl = data[i].config_svn_url if (_configSvnUrl.length > 15) { _configSvnUrl = _configSvnUrl.substring(_configSvnUrl.lastIndexOf('/')) } var service_row = '<tr class="' + row_class + '">' + '<td id="' + data[i].name + '" class="serviceName"><img src ="/static/img/s' + (i % 2 + 1) + '.png" style="padding-right:10px;"/><span>' + data[i].name + '</span></td>' + '<td>' + data[i].version_c + '</td>' + '<td>' + data[i].master_ip + '</td>' + '<td>' + data[i].author_id + '</td>' + '<td title="' + data[i].config_svn_url + '">' + _configSvnUrl + '</td>' + // '<td>'+data[i].package_address+'</td>'+ '<td style="text-align:left;">' + _operation + '</td>' + '</tr>'; $("#serviceTable").append(service_row); } // resetPageHeight(); }
@Klaus.Fenng:
function delService(id) { var url = "/panda/data/deleteService/"; if (confirm("Confirm To Delete?")) { $.post(url, {"csrfmiddlewaretoken": $.cookie('csrftoken'), "ws": ws, "id": id}, function (result) { if (result.err) { alert('delete failed with db error!') } location.reload(); }) } } /*获取service的构建详情*/ function getDetail(service_name) { $("#_serviceName").val(service_name); $("#" + service_name).css("background-color", "#00B5F3"); var height = parseInt(144 + (50 * (serviceNum)), 10); $(".panda_line").css("height", height-24 + 'px'); //$("#buildInfo").css("height", height + 'px'); //获取详情数据 fnBuildDetailList({service_name: service_name}); //滑动展示详情 $(".detailDiv").animate( { left: '160px', //top : '100px', opacity: 1, filter: "alpha(opacity=" + 100 + ")" }, 100 ); $(".detailDiv").css("width",$("#serviceInfo").width()-160+28) $(".detailDiv").show() $(".serviceName").unbind('click'); $(".serviceName").bind('click', function (e) { $("#_serviceName").val($(this).text()); $('.serviceName').css("background-color", "transparent") $('.serviceName').css("color", "#666") //getDetail($(this).text()); fnBuildDetailList({service_name: $(this).text()}); $(this).css("background-color", "#00B5F3"); }); $("#hideDetail").show(); $(".serviceName").css("cursor", "pointer"); //点击serviceName,展示对应详情 }
@Klaus.Fenng:
$("#serviceInfo").resize(function(){ if($(".detailDiv").css("display") != 'none'){ $(".detailDiv").css("width",$("#serviceInfo").width()-160+28) } }); $("#hideDetail").click(function () { $(".detailDiv").animate({ left: '100%', //top : '100px', opacity: 1, filter: "alpha(opacity=" + 100 + ")" }, 1500); $("#hideDetail").hide(); $("#buildInfo").hide() $(".serviceName").unbind('click'); $(".serviceName").css("cursor", "default"); $(".serviceName").css("background-color", "transparent"); $('.serviceName').css("color", "#666"); }); //当前用户所有service信息集合,用于点击构建获取数据 var services = null; /* *获取当前用户的service信息 */ function getPandaInfo() { $.post("/panda/data/", {"csrfmiddlewaretoken": $.cookie('csrftoken'), "ws": ws}, function (serviceList) { services = serviceList.data; $("#serviceInfo").waiting('done'); appendService(serviceList); // resetPageHeight(); }); }
@Klaus.Fenng:
/** * service指定可见用户 */ function showServiceToSpecified(id, dataString, type) { console.log(dataString) //删除提交按钮的提交时间,重新绑定事件 $('#myModal').hide(); $(".text-tags").remove(); $('.text-list').remove(); // $("#createBtn").unbind("click"); var nModal = $("#myModal"), scorllTop = 0; if (top) { scorllTop = top.document.body.scrollTop; } $('#myModal').show(); var offset = nModal.offset(); offset.top = scorllTop; nModal.offset(offset); if (type == "V") { $("#serviceTitle").text("Users who can build"); } else if (type == "E") { $("#serviceTitle").text("Users who can edit"); } else if (type == "T") { $("#serviceTitle").text("Transfer to someone"); } var special_group; if (dataString) { special_group = dataString.split(","); } else { special_group = []; } initAutoComplete(special_group); $("#transforBtn").unbind('click'); $("#transforBtn").bind('click', function () { saveServiceUsers(id, type) }); } /** * 模糊查询 * @param items [Array],textext输入框显示的内容 */ var my_modal_body = $('#nModal-body').html(); function initAutoComplete(initData) { $('#nModal-body').html(my_modal_body); $('#domain').textext({ plugins : 'autocomplete tags prompt ajax', tagsItems : initData, autocomplete: {trigger:"enterKeyPress"}, "ajax": { "url": '/panda/data/user/', "dataType": "json", "type":"get" } }); }
@Klaus.Fenng:
/** * 将service管理员创建的可见用户入库 */ function saveServiceUsers(id, type) { console.log($("#domain").val()) var url = "", domain = $("#domain").textext()[0].hiddenInput().val(), users = JSON.parse(domain); if (type == "T") { if (users.length != 1) { $("#myModal .alert").remove(); var errDiv = '<div class="alert alert-error hide"><a class="close" data-dismiss="alert" href="#">×</a><div style="line-height:20px;height:20px;" id="showErr"></div></div>'; $("#nModal-body .text-info").before($(errDiv)); $("#showErr").html("Please input user,just one is allowed."); $("#myModal .alert").show(); return; } } else { if (users.length <= 0) { $("#myModal .alert").remove(); var errDiv = '<div class="alert alert-error hide"><a class="close" data-dismiss="alert" href="#">×</a><div style="line-height:20px;height:20px;" id="showErr"></div></div>'; $("#nModal-body .text-info").before($(errDiv)); $("#showErr").html($.t("ns.system:accountInfo")); $("#myModal .alert").show(); return; } } switch (type) { case 'V': url = "/panda/saveServiceVisibleUsers/"; break; case 'E': url = "/panda/saveServiceEditableUsers/"; break; case 'T': url = "/panda/transService/"; break; } $.post(url, {"user": users, "id": id,"csrfmiddlewaretoken": $.cookie('csrftoken')}, function (data) { if (!data.err) { $('#myModal').hide(); alert("Success!"); top.window.location.reload(); } else { alert("Failed!"); } }); }
@Klaus.Fenng:
/** * 获取用户权限 */ function getUserPermission() { var url = "/panda/getPermission"; $.post(url, {"ws": ws}, function (data) { if (!data.msg) { if (data.err) { $("#addService").hide(); } else { $("#addService").show(); } } }); } $("#Build_submit").click(function () { if (checkBuild()) { buildSubmit(); } }); $("#myModal-exit").click(function () { $("#myModal").hide(); $('#domain').textext()[0].tags().removeAllTags(); $("#myModal .alert").remove(); $(".text-tags").remove(); }); $("#myBuild-exit").click(function () { closeBox("buildCheckBox"); }); $(function () { $("#serviceInfo").waiting(); // getUserPermission(); getPandaInfo(); }); $("#prePageOfBuild").click(function () { var service_name = $("#_serviceName").val(); var pageIndex = parseInt($("#dataTablePageIndex").text()) - 1; if (pageIndex == 0) { return; } var pageSize = $("#dataTablePageSize").val(); var param = { service_name: service_name, pageIndex: pageIndex, pageSize: pageSize }; fnBuildDetailList(param); }); $("#nextPageBuild").click(function () { var service_name = $("#_serviceName").val(); var pageIndex = parseInt($("#dataTablePageIndex").text()) + 1; var pageSize = $("#dataTablePageSize").val(); var param = { service_name: service_name, pageIndex: pageIndex, pageSize: pageSize }; fnBuildDetailList(param); }); $("#getPageOfBuild").click(function () { var service_name = $("#_serviceName").val(); var valid = /^[1-9]\d$/ if (!$("#pageIndex").val() || valid.test($("#pageIndex").val())) { return; } var pageIndex = parseInt($("#pageIndex").val()); var pageSize = $("#dataTablePageSize").val(); var param = { service_name: service_name, pageIndex: pageIndex, pageSize: pageSize }; fnBuildDetailList(param); }); $("#dataTablePageSize").change(function () { var service_name = $("#_serviceName").val(); var pageIndex = parseInt($("#dataTablePageIndex").text()); var pageSize = $(this).val(); var param = { service_name: service_name, pageIndex: pageIndex, pageSize: pageSize }; fnBuildDetailList(param); });
@Klaus.Fenng:
getLng(function () { oLanguage = $.t("ns.common:dataTable.file"); }); var PBI_URL = "/api/userver/getpbiinfos"; function fillValToSelect(type, parentNo) { if (type == "PI") { $.get(PBI_URL, {"name": "PI"}, function (data) { var tmpInfo = data.PI bindValue(tmpInfo, "product_line"); lockSelect(1) }); } else if (type == "PP") { $.get(PBI_URL, {"name": "PP", "no": parentNo}, function (data) { var tmpInfo = data.PP bindValue(tmpInfo, "product"); lockSelect(2) }); } else if (type == "PR") { $.get(PBI_URL, {"name": "PR", "no": parentNo}, function (data) { var tmpInfo = data.PR bindValue(tmpInfo, "version_r"); lockSelect(3) }); } else { $.get(PBI_URL, {"name": "PC", "no": parentNo}, function (data) { var tmpInfo = data.PC bindValue(tmpInfo, "version_c"); }); } } function lockSelect(beginIndex) { var selects = $("#PBISelect select"); for (var i = beginIndex; i < selects.length; i++) { selects[i].disabled = true; } }
@Klaus.Fenng:
function bindValue(data, renderID) { var select = $("#" + renderID) var selectText = select.find("option").first().text() select.empty() select.append("<option value='-1'>" + selectText + "</option>"); for (var index in data) { select.append("<option value='" + data[index].no + "'>" + data[index].name + "</option>"); } select.removeAttr("disabled"); } function queryProjects() { var url = "/api/admin/dashboard/projects/queryProject" if ($("#version_r").val() == "-1") { alert($.t("ns.permissonguid:errorTip.selectPBI")) } else { if ($("#version_c option:only-child").length != 1 && $("#version_c").val() == "-1") { alert($.t("ns.permissonguid:errorTip.selectCVersion")) } else { var project = $("#project").val(); var version_r = $("#version_r").val() var version_c = $("#version_c").val() $.get(url, {"project": project, "version_r": version_r, "version_c": version_c} , function (data) { showQueryResult(data) // $("#projectInfo").css("display","block") // $("#PBISelect").css("display","none") }) } } }
@Klaus.Fenng:
function showQueryResult(data) { var areaFiled = "areaInfo."+getI18nextLanguage() var odatatable = $("#listdatatable").dataTable({ "oLanguage": { "sUrl": oLanguage }, "sDom": '<"listNavigate"' + 'F' + 'C' + 'p<"clearer">>' + 'rt<"listNavigate"p<"clearer">>', "iDisplayLength": 10, "aLengthMenu": [ [10, 50, 100], [10, 50, 100] ], "sEcho": 1, "sScrollX": "100%", "bScrollCollapse": true, "bProcessing": true, "bServerSide": false, "bDestroy": true, "bPaginate": true, "bLengthChange": true, "bFilter": true, "bInfo": true, "sPaginationType": "uci", "aaData": data, "fnServerParams": function (aoData) { }, "aoColumnDefs": [ { "aTargets": [0], "mData": "name", "sWidth": "150px", "sClass": "text-left"}, { "aTargets": [1], "mData": "product", "sWidth": "250px", "sClass": "text-left"}, { "aTargets": [2], "mData": "version", "sWidth": "200px", "sClass": "text-left"}, { "aTargets": [3], "mData": "author", "sWidth": "200px", "sClass": "text_type"}, { "aTargets": [4], "mData": areaFiled,'bSortable':false, "sWidth": "250px", "sClass": "text-left"}, { "aTargets": [5], "mData": "desc", "sWidth": "270px", "sClass": "text_time"}, { "aTargets": [6], "bSortable":false,"sWidth":"50px","mData":function(source,type,val){ var id = source["_id"], author = source["author"], team_name = source["name"], product = source["product"], version = source["version"]; var param = id + "," + author + "," + team_name + "," + product + "," + version; var strHtml = '<a href="javascript:void(0);"id="showsa" onclick="sendEmailToApplyPermission(\''+param+'\')" class="transform"><img src ="/img/edit.gif"/>Apply</a>'; return strHtml; },"sClass": "text-center"} ], "aaSorting": [ [1, "asc"] ], "fnDrawCallback": function (oSettings) { popDiv.fnInit(oSettings); render.fnInit(oSettings); resetPageHeight(); }, "fnInitComplete": function (oSettings, json) { resetPageHeight(); } }); } function back() { $("#projectInfo").css("display", "none") $("#PBISelect").css("display", "block") }
@Klaus.Fenng:
function sendEmailToApplyPermission(params){ var param = params.split(","), id = param[0], author = param[1], team = param[2], product = param[3], version = param[4]; var url = "/api/admin/dashboard/projects/sendEmail", query = { "id":id, "author":author, "team":team, "product":product, "version":version }; $.post(url,query,function(data){ if (! data.err) { alert("Send email success!"); // window.top.location.reload(); } else { alert("Send email failed!"); } }); } $(function () { fillValToSelect("PI") showQueryResult([]) });
@Klaus.Fenng:
<div id="PBISelect"> <div style="padding:10px 0;"> <div ><b><span data-i18n="ns.dashboard:teamInfo.addPage.PBI.title"></span> </b></div> <select class="span3" id="product_line" name="product_line" onchange="fillValToSelect('PP',this.options [this.selectedIndex].value)"> <option value="-1" data-i18n="ns.dashboard:teamInfo.addPage.PBI.lineTips"></option> </option> </select> <select class="span3" id="product" name="product" onchange="fillValToSelect('PR',this.options [this.selectedIndex].value)"> <option value="-1" data-i18n="ns.dashboard:teamInfo.addPage.PBI.nameTips"></option> </option> </select>
@Klaus.Fenng:
<select class="span3" id="version_r" name="version_r" onchange="fillValToSelect('PC',this.options [this.selectedIndex].value)"> <option value="-1" data-i18n="ns.dashboard:teamInfo.addPage.PBI.RVersionTips"></option> </option> </select> <select class="span3" id="version_c" name="version_c"> <option value="-1" data-i18n="ns.dashboard:teamInfo.addPage.PBI.CVersionTips"></option> </option> </select> </div> <div>