/** * 用户管理 列表页 相关js * @author lifangli 2016/7/13 */ var DISPATCH_TASK_LISTNEW = {}; DISPATCH_TASK_LISTNEW.SearchUrl = "/ops/hbase/instance/v2/list.ajax"; DISPATCH_TASK_LISTNEW.DetailUrl = "/ops/hbase/instanceManage/v2/showInstance.html"; DISPATCH_TASK_LISTNEW.AtomWorkflowUrl = "/atom/workflow/v2/apply/add.html"; DISPATCH_TASK_LISTNEW.EditInstanceUrl = "/ops/hbase/instance/v2/edit.html"; DISPATCH_TASK_LISTNEW.PushGrantUrl = "/ops/hbase/instance/v2/prePushGrant.html" var taskscope = {}; var SearchUrl = ""; var grace_scope; taskscope._init_base = function () { refreshSearchUrl(); taskscope._init_grid(); grace_scope.initGrid(); }; $(document).ready(function () { $('#environmentId').select2(); $('#systemLevelListId').select2(); $('#hbaseVersionId').select2(); $('#sdkVersionId').select2(); /* initBusinessListJrc(); initProductListJrc(); initAppGroupListJrc();*/ taskscope._init_base(); initClusterList(); initGroupList(); $("#JrcSelect").toggleClass("bdp-hidden"); initButton(); }); function refreshSearchUrl() { SearchUrl = DISPATCH_TASK_LISTNEW.SearchUrl; } // 设置cookie 有效期30天 function setTipCookie() { var Days = 30; var exp = new Date(); exp.setTime(exp.getTime() + Days * 24 * 60 * 60 * 1000); document.cookie = "showTip=" + escape(false) + ";expires=" + exp.toGMTString(); } // 关闭按钮清楚cookie $("#closeTip").click(function () { setTipCookie(); }) taskscope._init_grid = function () { var isAdmin = $("#isAdmin").val(); var grace = angular.module('grace.bootstrap.demo', ['grace.bootstrap'], angular.injector(['grace.bootstrap.bootConfigs']).get('bootConfig')); grace.controller('GridDemoCtrl', ["$scope", "$http", "$gDataAdapterFactory", "$gDataAdapterModelManagerFactory", function ($scope, $http, dataAdapter, ModelManager) { function return_html(return_text,record){ //if(record.approveCount > 0){ // return "<span style='color:red' >"+(return_text || "")+"</span>" //} return return_text || "--"; } function generateData(requestData) { var data = { columnsDef: [ { field: "instanceName", id: "instanceName", name: "实例编号", visible: true,width:120, formatter: function (instanceName, record) { var href = '<a href="' + DISPATCH_TASK_LISTNEW.DetailUrl + '?instanceId=' + record.id +'" target="_blank">' + instanceName + '</a>'; return return_html(href,record); } }, {field: "prjectName", id: "prjectName", name: "项目名称", visible: true,width:120}, {field: "clusterName", id: "clusterName", name: "集群", visible: true,width:80, formatter:function(clusterName,record){ var temp = ''; temp = "<a href='/ops/hbase/cluster/showCluster.html?clusterName="+clusterName+"' target='_blank'>"+clusterName+"</a>"; return temp; } }, {field: "currentClusterName", id: "currentClusterName", name: "使用中", visible: true,width:100}, {field: "totalSize", id: "totalSize", name: "存储量(TB)", visible: true,width:120}, {field: "deptName", id: "deptName", name: "所属部门", visible: true,width:120}, {field: "environmentDesc", id: "environmentDesc", name: "环境", visible: true,width:100}, {field: "hbaseVersionDesc", id: "hbaseVersionDesc", name: "版本", visible: true,width:80}, {field: "systemLevelDesc", id: "systemLevelDesc", name: "级别", visible: true,width:80}, {field: "sdkVersion", id: "sdkVersion", name: "SDK版本", visible: true,width:100}, {field: "manageName", id: "manageName", name: "负责人", visible: true, enableTooltip: true,width:100}, {field: "groupName", id: "groupName", name: "分组", visible: true, enableTooltip: true,width:80}, { field: "", id: "", name: "操作", visible: true, formatter: function (instanceName, record) { var instanceHref="--"; var groupHref="--"; var switchSub=""; var switchMain=""; var sdkCheckUrl = ""; if(record.hbaseVersion == 2){ instanceHref = '<a href="http://query.hbase.jd.com/dashboard/db/instance?orgId=1&var-hbase='+record.clusterName+'&var-namespace='+record.spaceName+'" target="_blank">实例监控</a>'; groupHref = '<a href="http://query.hbase.jd.com/dashboard/db/group?orgId=1&var-hbase='+record.clusterName+'&var-group='+record.groupName+'" target="_blank">分组监控</a>'; } if(record.switchFlag == 1){ switchSub = '<a href="javascript:switchSub('+record.id+')">切到从</a>' switchMain = '<a href="javascript:switchMain('+record.id+')">切到主</a>' } if(isAdmin == 'true'){ sdkCheckUrl = '<a href="http://mam.jd.com/dashboard/db/yan-zheng-sdkqie-huan?orgId=1&var-master='+record.clusterName+'&var-slave='+record.subClusterName+'&var-namespace='+record.spaceName+'" target="_blank">sdk验证</a>'; } return instanceHref + " "+groupHref + " " +switchSub+" " + switchMain+" "+sdkCheckUrl; } }, {field: "modifiedToStr", id: "modifiedToStr", name: "创建时间", visible: true,width:120} ], enablePagination: true, paginationConfig: { enableSetRefresh: true,//是否设置定时刷新 setTimeRefresh: 300,//时间单位为s;如果设置了开启定时刷新,请设置默认定时刷新时间 pageIcon: true, pageSize: 10, pageSizes: [50, 100], enableRefresh: true }, selectionConfig: { checkboxSelect: true, checkboxSelectWidth: 35, pinned: true }, enableSelection: true, enableSelectionMulti: true, expandableTable: false, enableColumnResize: true, expandableTable: false, enableColumnResize: true, enableSort:true, lockHeader: true,//是否固定Header表头 lockHeaderType: "top",//固定Header表头属性; enableSearchAll: true,//是否支持搜索所有 rowHeight: 40,//行高度 headerRowHeight: 40,//表头高度 minColumnWidth: 90,//最小列宽度 enableAutoResize: true,//是否自适应列宽度 enableRowDragging: true,//是否支持列drag拖拽 enableSelectAll: true,//是否支持选择所有 useRemoteData: true//是否支持远程后台数据 }; data.ajaxConfig = { url: SearchUrl, method: 'post', dataType: 'json', externalData: function () { var res = {}; var queryStr = $('#queryStr').val(); var environmentId = $('#environmentId').val(); var systemLevelListId = $('#systemLevelListId').val(); var clusterNamesId = $('#clusterNamesId').val(); var hbaseVersionId = $('#hbaseVersionId').val(); var sdkVersionId = $('#sdkVersionId').val(); var group = $("#groupNamesId").val(); if(group){ group = group.split(",")[1]; } if (!(queryStr == null || queryStr == "")) { res['instanceName'] = queryStr; } if (!(environmentId == null || environmentId == "")) { res['environment'] = environmentId; } if (!(systemLevelListId == null || systemLevelListId == "")) { res['systemLevel'] = systemLevelListId; } if (!(clusterNamesId == null || clusterNamesId == "")) { res['clusterName'] = clusterNamesId; } if (!(hbaseVersionId == null || hbaseVersionId == "")) { res['hbaseVersion'] = hbaseVersionId; } if (!(sdkVersionId == null || sdkVersionId == "")) { res['sdkVersion'] = sdkVersionId; } if (!(group == null || group == "")) { res['groupName'] = group; } return res; } }; return data; } function gridReady(api) { $scope.gridApi = api; //列编辑信息 api.event.on('contentEdit', onContentEdit); //行选中 api.event.on('rowSelect', onRowSelect); //行取消选中 api.event.on('rowUnSelect', onRowSelect); //选中所有的行 api.event.on('rowSelectAll', onRowSelectAll); //取消所有的行选中事件 api.event.on('rowUnSelectAll', onRowSelectAll); api.event.on('paging', function () { $scope.result = []; buttonSelector($scope.result); }); }; $scope.initGrid = function (data) { $scope.gridOptions = generateData(data); $scope.gridOptions.onReady = gridReady; $scope.$apply(); $scope.inited = true; }; //selectedData就是当前选择行的数据 function onRowSelectAll(evt, selectedIndex, selectedData) { $scope.result = selectedData; buttonSelector(selectedData); }; //selectedData就是当前选择行的数据 function onRowSelect(evt, rowIndex, selectedIndex, selectedData) { $scope.result = selectedData; buttonSelector(selectedData); }; function onContentEdit(evt, rowIndex, field, currentValue) { $scope.editResult = $scope.gridApi.getRowDataByIndex(rowIndex); console.log("第", rowIndex, '行', field, '列,当前值:', currentValue) }; //变量赋值 grace_scope = $scope; }]); angular.bootstrap(document, ['grace.bootstrap.demo']); } $('#search-btn').click(function () { grace_scope.gridApi.toPage(1); //grace_scope.gridApi.reload(); }); function refreshBufMagList(e) { var code = e.keyCode; if (code == 13) { grace_scope.gridApi.toPage(1); grace_scope.gridApi.reload(); } } /* *Div隐藏显示操作 */ $('#HlevSearch-btn').click(function () { $("#JrcSelect").toggleClass("bdp-hidden"); }); function buttonSelector(selectedData) { if (selectedData.length == 0) { initButton(); } else if (selectedData.length == 1) { $("#jrcedit-btn").removeClass("disabled"); $("#jrcdrop-btn").removeClass("disabled"); $("#jrcpush-btn").removeClass("disabled"); $("#jrcupgrade-btn").removeClass("disabled"); } else if (selectedData.length > 1) { initButton(); } }; function initButton() { $("#jrcedit-btn").addClass("disabled"); $("#jrcdrop-btn").addClass("disabled"); $("#jrcpush-btn").addClass("disabled"); $("#jrcupgrade-btn").addClass("disabled"); }; /** * 修改实例 */ $("#jrcedit-btn").click(function () { if (grace_scope.result == null || grace_scope.result.length == 0 || grace_scope.result.length > 1) { $.bdpUtil.alertDialog($("#mainContainer"), "您只能选中一条记录才能进行此操作,请重新选择后继续!"); return false; } //跳转到修改页面 else { var id = grace_scope.result[0].id; var instanceName = grace_scope.result[0].instanceName; $.ajax({ url:'/ops/hbase/instance/v2/flageEdit.ajax', type: 'GET', dataType: 'json', async: false, data: {id:id,instanceName:instanceName}, success: function (data) { if(data.success){ // window.open('/ops/hbase/instance/v2/edit.html?instanceId=' + id); window.open(DISPATCH_TASK_LISTNEW.EditInstanceUrl + '?instanceId=' + id,'_blank'); }else{ $.bdpUtil.alertDialog($("#mainPlatformContainer"),"您无权限进行修改,请刷新列表!"); } }, error: function(data){ //失败 $.bdpUtil.alertDialog($("#mainPlatformContainer"),"您无权限进行修改,请刷新列表!"); }, dataType: "json" }); } }); /** * 普通建表跳转 */ $('#jrcadd-btn').click(function () { var workFlowId = $("#newInstanceWorkflowId").val(); window.open(DISPATCH_TASK_LISTNEW.AtomWorkflowUrl + '?workFlowId=' + workFlowId, '_blank'); }); /** * 实例下线 */ $("#jrcdrop-btn").click(function () { if (grace_scope.result == null || grace_scope.result.length == 0 || grace_scope.result.length > 1) { $.bdpUtil.alertDialog($("#mainPlatformContainer"), "您只能选中一条记录才能进行此操作,请重新选择后继续!"); return false; } //跳转到流程中心下线申请页面 else { var instanceName = grace_scope.result[0].instanceName; // var data = "{text_1:" + '"' +instanceName + '"' + "}"; // var workFlowId = $("#offInstanceWorkFlowId").val(); $.bdpUtil.showConfirmDialog( $("#mainPlatformContainer"), "请确认是否下线实例【" + instanceName + "】?", function (result) { if (result) { // window.open(DISPATCH_TASK_LISTNEW.AtomWorkflowUrl + '?workFlowId=' + workFlowId + '&data=' + data); goWorkFlow(instanceName); } } ); } }); function goWorkFlow(instanceName) { $.ajax({ url:'/ops/hbase/instance/v2/goWorkFlow.ajax', type: 'GET', dataType: 'json', async: false, data: {instanceName:instanceName}, success: function (data) { if(data.success){ $.bdpUtil.alertDialog($("#mainPlatformContainer"),"实例下线申请提交成功,请等待审核!<br/>进入<a href='/atom/workflow/v2/request/apply.html' target='_blank' >我的申请</a>,查看审批详情"); }else{ $.bdpUtil.alertDialog($("#mainPlatformContainer"),data._msg); } }, error: function(data){ //失败 $.bdpUtil.alertDialog($("#mainPlatformContainer"),"您无权限进行修改,请刷新列表!"); }, dataType: "json" }); } function checkAccess(instanceName,record) { $.ajax({ url:'/ops/hbase/instance/v2/checkAccess.ajax', type: 'GET', dataType: 'json', async: false, data: {instanceName:instanceName}, success: function (data) { if(data.success){ // $.bdpUtil.alertDialog($("#mainPlatformContainer"),"实例下线申请提交成功,请等待审核!<br/>进入<a href='/atom/workflow/v2/request/apply.html' target='_blank' >我的申请</a>,查看审批详情"); var href = '<a href="' + DISPATCH_TASK_LISTNEW.DetailUrl + '?instanceId=' + record.id +'" target="_blank">' + instanceName + '</a>'; return return_html(href,record); }else{ $.bdpUtil.alertDialog($("#mainPlatformContainer"),data._msg); } }, error: function(data){ //失败 $.bdpUtil.alertDialog($("#mainPlatformContainer"),"您无权限进行修改,请刷新列表!"); }, dataType: "json" }); } //实例统计 $("#jrcDepInstance-btn").click(function(){ window.open("/ops/hbase/instance/v2/instanceDep.html"); }); //推数授权 $("#jrcpush-btn").click(function () { if (grace_scope.result == null || grace_scope.result.length == 0 || grace_scope.result.length > 1) { $.bdpUtil.alertDialog($("#mainContainer"), "您只能选中一条记录才能进行此操作,请重新选择后继续!"); return false; } //跳转到申请页面页面 else { var instanceName = grace_scope.result[0].instanceName; var data = '{"instance_name":"'+instanceName+'"}'; window.open(DISPATCH_TASK_LISTNEW.AtomWorkflowUrl + '?workFlowId=10338&data='+data, '_blank'); } }); //数据库迁移/升级 $('#jrcupgrade-btn').click(function () { if (grace_scope.result == null || grace_scope.result.length == 0 || grace_scope.result.length > 1) { $.bdpUtil.alertDialog($("#mainContainer"), "您只能选中一条记录才能进行此操作,请重新选择后继续!"); return false; } //跳转到申请页面页面 else { var instanceName = grace_scope.result[0].instanceName; var data = '{"instance_name":"'+instanceName+'"}'; window.open(DISPATCH_TASK_LISTNEW.AtomWorkflowUrl + '?workFlowId=10332&data='+data, '_blank'); } }); //切换到从集群 function switchSub(instanceId){ if(!instanceId){ return; } var instanceIds =[]; instanceIds[0] = instanceId; var type = "instance"; $.ajax({ url:'/ops/hbase/cluster/switchZk.ajax', type: 'GET', dataType: 'json', async: false, data: {instanceIds:instanceIds,type:type,groups:"",cluster:""}, success: function (data) { $('#show_switch_win_btn').trigger('click'); }, error: function(data){ //失败 $('#show_switch_win_btn').trigger('click'); }, dataType: "json" }); } //切换到主集群 function switchMain(instanceId){ if(!instanceId){ return; } var instanceIds =[]; instanceIds[0] = instanceId; var type = "instance"; $.ajax({ url:'/ops/hbase/cluster/switchSubZk.ajax', type: 'GET', dataType: 'json', async: false, data: {instanceIds:instanceIds,type:type,groups:"",cluster:""}, success: function (data) { $('#show_switch_win_btn').trigger('click'); }, error: function(data){ //失败 $('#show_switch_win_btn').trigger('click'); }, dataType: "json" }); } /* $("#updateDepInstance-btn").click(function () { $.ajax({ url:'/ops/hbase/instance/v2/updateInstanceDep.ajax', type: 'GET', dataType: 'json', async: false, success: function (data) { }, error: function(data){ //失败 }, dataType: "json" }); }); //实例统计 $("#sdkinfo-btn").click(function(){ window.open("/ops/hbase/instance/v2/instanceSdkVersion.html"); });*/ $("#jrcSwtichInstance-btn").click(function(){ if (grace_scope.result == null || grace_scope.result.length == 0) { $.bdpUtil.alertDialog($("#mainPlatformContainer"), "请新选择后继续!"); return false; }else { var instanceIds= new Array(); for(var i=0;i< grace_scope.result.length;i++){ instanceIds.push(grace_scope.result[i].id); } $.ajax({ url:'/ops/hbase/instance/v2/checkInstancePermission.ajax', type: 'GET', dataType: 'json', async: false, data: {instanceIds:instanceIds}, success: function (data) { if(!data._code){ var tempData = data.data; $("#permission_content").data("instanceSwitchData",tempData); var trStr = ''; for(var n = 0; n < tempData.length;n++){ var node = tempData[n]; var projectName = node.projectName; var currentClusterName = node.currentClusterName; var targetName = node.targetName; var instanceName = node.instanceName; var currentNamePermission = node[instanceName+"_"+currentClusterName]; var targetNamePermission = node[instanceName+"_"+targetName]; var tempCurrentPermission=''; for(var key in currentNamePermission){ var permissionValue = currentNamePermission[key]; //判断当前权限是否在目标集群周一致 var targetPersimissionValue = targetNamePermission[key]; if(permissionValue != targetPersimissionValue){ tempCurrentPermission =tempCurrentPermission +'<span title="此权限在目标集群不一致" style="color:red">'+key+":"+currentNamePermission[key]+'</span><br>'; }else{ tempCurrentPermission =tempCurrentPermission +key+":"+currentNamePermission[key]+'<br>'; } } var tempTargetPermission=''; for(var key in targetNamePermission){ tempTargetPermission =tempTargetPermission +key+":"+targetNamePermission[key]+"<br>"; } trStr = trStr+ "<tr>" + " <td>"+instanceName+"</td>" + " <td>"+projectName+"</td>" + " <td>"+currentClusterName+"</td>" + " <td>"+tempCurrentPermission+"</td>" + " <td>"+targetName+"</td>" + " <td>"+tempTargetPermission+"</td>" + "</tr>"; } $("#permission_content").empty().append(trStr); $('#switch_win_btn').trigger('click'); }else{ $.bdpUtil.alertDialog($("#mainPlatformContainer"), "获取权限校验失败"); } }, error: function(data){ //失败 console.info("切换失败:"+data) $.bdpUtil.alertDialog($("#mainPlatformContainer"), "切换失败请联系管理员"); } }); } }); $("#jrcancle-btn-switch").click(function(){ $('#switch_win_btn').trigger('click'); }); $("#jrcIPInstance-btn").click(function(){ window.open("/ops/hbase/instance/v2/instanceIps.html"); }); $("#jrok-btn-switch").click(function(){ var switchInstanceInfo = $("#permission_content").data("instanceSwitchData"); var node1 = switchInstanceInfo[0]; var currentClusterName1 = node1.currentClusterName; var targetCluster1 = node1.targetName; //检验所选的集群是否一致 for(var i = 1; i < switchInstanceInfo.length;i++){ var node = switchInstanceInfo[i]; if(currentClusterName1 != node.currentClusterName){ $.bdpUtil.alertDialog($("#mainPlatformContainer"), "所选实例当前所在集群不一致"); return; } if(targetCluster1 != node.targetName){ $.bdpUtil.alertDialog($("#mainPlatformContainer"), "所选实例的目标集群不一致"); return; } } $.ajax({ url:'/ops/hbase/instance/v2/switchInstance.ajax', type: 'POST', dataType: 'json', async: false, data: {data:JSON.stringify(switchInstanceInfo)}, success: function (data) { $.bdpUtil.alertDialog($("#mainPlatformContainer"), data._msg); $("#jrcancle-btn-switch").trigger('click'); }, error: function(data){ //失败 } }); console.info(switchInstanceInfo); });
相关推荐
标题中的"FPGA-I2C-读LM75BDP温度传感器-驱动程序"是指一个基于现场可编程门阵列(FPGA)的项目,该项目实现了通过I2C(Inter-Integrated Circuit)总线与LM75BDP温度传感器进行通信的驱动程序。在这个过程中,我们...
先锋BDP-4110是一款高性能的蓝光播放器,其固件更新对于优化设备性能、提升用户体验以及保持与最新技术同步至关重要。固件,全称为“Firmware”,是存储在电子设备内部的一种程序,它控制设备的操作,并提供与硬件和...
2. 安装遥控器电池:指导用户如何正确安装和更换遥控器的电池,这通常包括打开电池盖、选择正确的电池型号并按照正负极指示进行安装。 3. 软件更新:部分设备可能支持通过网络或USB连接进行固件更新,从而提供额外...
BDP(生物倍增)工艺是一种先进的污水处理技术,由必德普(北京)环保科技有限公司研发并拥有专利。这项技术旨在解决传统污水处理设施普遍存在的问题,如高溶氧导致的高能耗、剩余污泥量大、占地面积大以及对高浓度...
2. **BDP(Blu-ray Disc Player)**:蓝光播放器是用于读取和播放蓝光光盘的设备,同时通常也支持DVD和CD等其他光盘格式。 3. **固件**:固件是设备内部的软件,控制硬件如何运行。对于蓝光播放器,固件可能包含...
2. **安全须知**:在使用任何机械设备前,安全总是首要考虑的因素。手册中应列出一系列的安全警告和注意事项,包括如何正确佩戴个人防护装备,避免触电、机械伤害等风险。 3. **组装与拆卸**:说明书中将详细指导...
bdp-lab-0.1-01 的RPM安装包,bdp-lab-0.1-01.noarch.rpm
BDP2040V1.16 固件 1. 新版CNTV(网动版) 2. 3\4T硬盘支持 3. DLNA DMR手机推送 4. AIRPLAY 5. NFS 6. SAMBA 7. USB 音乐自动播放 8. 解决了CNTV部分节目编码兼容性
BDP-4110 固件v7.04F 没有说明文档
本文将详细介绍“BDP-4110-K/G 固件升级文件”及其版本v1.77,探讨如何通过固件升级,将你的蓝光播放器打造成功能更强大、性能更稳定、界面更友好的多媒体设备。 ### 固件升级的意义 在IT领域,固件升级是为了让...
2. **用户界面(UI)**:良好的UI设计应简洁、直观,符合用户的认知习惯。这包括色彩搭配、图标设计、按钮布局、字体选择等,旨在增强用户的沉浸感和操作效率。 3. **交互设计(IXD)**:关注用户与系统的交互过程,如...
bdp2hive项目介绍一、概述项目主要是集成生成sqoop脚本和创建hive分区表组件。生成sqoop脚本组件主要通过传递的数据库信息查询数据库获取表字段与数据集之间的对照关系SQL语句,通过模板拼接成sqoop脚本,上传服务器...
BDP-S185说明书 文档 PDF
华录BDP2012可能通过此更新提高了处理高清视频的效率,提升了播放流畅度,减少了卡顿现象,同时也可能增强了对不同编码标准的支持,包括MPEG-2、H.264、HEVC等。 在实际操作中,用户需要将“BDP2012 Ver1.18”这个...
BDP组件的源码对于Delphi开发者来说是一份宝贵的资源,它可以帮助他们学习如何设计和实现复杂的组件功能,同时也可以在自己的项目中复用和扩展这些组件。 BDP组件可能包括各种功能模块,如数据库连接、数据处理、...
2. **数据源接入** - **本地文件**:支持Excel和CSV格式,用户可以直接在界面上上传文件,可以设置去重、字段格式和表头等。 - **同步宝**:适用于多文件场景,无需BDP账户也可上传数据。 - **Excel插件**:允许...
2. OPPO BDP-10X Blu-ray Disc Player的RS-232控制协议(版本1.1,2012年10月): - 该协议是BDP-83控制协议的扩展,要求使用特定版本的MCU固件(如MCU103-05-0914针对BDP-103,MCU105-04-0914针对BDP-105)和主...
哈尔滨BDP生物倍增报告.pptx
【第14章 BDP数据库引擎应用】 BDP(Borland Data Provider)数据库引擎是Delphi 2005中用于.NET框架的一种数据访问接口,它为开发者提供了一个统一的方式来连接和操作多种数据库系统,如InterBase、Oracle、DB2、...