How to use device.clean method in Appium Xcuitest Driver

Best JavaScript code snippet using appium-xcuitest-driver

api.js

Source:api.js Github

copy

Full Screen

1// const domain = 'https://qinyuan-test.yunext.com'2var apiConfig = {3 // *****产品管理*****4 // 获取产品信息5 manage_product_getInfo: 'manage/product/getInfo',6 // 产品列表信息7 manage_product_list: 'manage/product/list',8 // 修改产品信息9 manage_product_update: 'manage/product/update',10 // 产品配置文件图片11 manage_productFile_getProductFileInfo: 'manage/productFile/getProductFileInfo',12 // 保存配置文件13 manage_productFile_saveProductFile: 'manage/productFile/saveProductFile',14 // 修改设备流量修正15 manage_waterConfig_saveWaterCorrectConfig: 'manage/waterConfig/saveWaterCorrectConfig',16 // 下载文件17 getFilesAfterDelete: '/web/api/common/getFilesAfterDelete',18 // *****设备管理*****19 // 设备详情20 manage_device_detail: 'manage/device/detail',21 // 设备列表22 manage_device_list: 'manage/device/list',23 // 获取设备总数24 manage_device_deviceCount: 'manage/device/deviceCount',25 // 设备新增趋势概况26 manage_device_trend_deviceCount: 'manage/device/trend/deviceCount',27 // 解绑设备28 manage_user_unbind_device: 'manage/user/unbind/device',29 // 获取设备租期详情30 manage_deviceLease_getDeviceLeaseInfo: 'manage/deviceLease/getDeviceLeaseInfo',31 // 保存设备租期32 manage_deviceLease_saveDeviceLease: 'manage/deviceLease/saveDeviceLease',33 // 清除2G设备故障34 manage_device_cleanIOTDeviceError: 'manage/device/cleanIOTDeviceError',35 // 清除wifi设备故障36 manage_device_cleanIlopDeviceError: 'manage/device/cleanIlopDeviceError',37 // 设置设备节能时间38 manage_deviceSaveEnergy_saveDeviceSaveEnergy: 'manage/deviceSaveEnergy/saveDeviceSaveEnergy',39 // 设备趋势列表40 manage_device_trend_list: 'manage/device/trend/list',41 // 获取水质信息 TDS 浊度 余氯42 manage_deviceProperties_getDevicePropertiesInfo: 'manage/deviceProperties/getDevicePropertiesInfo',43 // 设备详情顶部数据44 manage_device_getIoTDeviceLeaseAndTraffic: 'manage/device/getIoTDeviceLeaseAndTraffic',45 // 绑定用户列表46 manage_device_detail_bindDeviceList: 'manage/device/detail/bindDeviceList',47 // 用户分享列表48 manage_device_detail_shareUser_list: 'manage/device/detail/shareUser/list',49 // 获取故障报警列表50 manage_device_detail_deviceError_trend_list: 'manage/device/detail/deviceError/trend/list',51 // 获取调试历史52 manage_deviceAuth_getDeviceLeaseAuthList: 'manage/deviceAuth/getDeviceLeaseAuthList',53 // 发送重置调试次数54 manage_deviceDebug_resetDeviceLeaseDebug: 'manage/deviceDebug/resetDeviceLeaseDebug',55 // 2G设备解绑56 manage_device_iotRemoveBindUser: 'manage/device/iotRemoveBindUser',57 // 解绑分享用户设备58 manage_device_unbind_shareUser: 'manage/device/unbind/shareUser',59 // 获取设备TDS地图数据60 manage_device_tds_map: 'manage/device/tds/map',61 // 用户绑定设备62 manage_device_iotBind: 'manage/device/iotBind',63 // 编辑设备属性64 manage_deviceProperties_saveDeviceProperties: 'manage/deviceProperties/saveDeviceProperties',65 // 编辑设备调试次数66 manage_deviceDebug_saveDeviceLeaseDebug: 'manage/deviceDebug/saveDeviceLeaseDebug',67 // 审核设备调试请求68 manage_deviceAuth_authDeviceLeaseDebug: 'manage/deviceAuth/authDeviceLeaseDebug',69 // 修正设备位置70 manage_device_reviseDeviceLocation: 'manage/device/reviseDeviceLocation',71 // *****系统管理*****72 // 新增管理员73 manage_userAccount_create: 'manage/userAccount/create',74 // 删除管理员75 manage_userAccount_delete: 'manage/userAccount/delete',76 // 禁用管理员77 manage_userAccount_forbidden: 'manage/userAccount/forbidden',78 // 管理员列表79 manage_userAccount_list: 'manage/userAccount/list',80 // 重置密码81 manage_userAccount_reset_password: 'manage/userAccount/reset/password',82 // 新增角色83 manage_role_create: 'manage/role/create',84 // 删除角色85 manage_role_delete: 'manage/role/delete',86 // 角色详情87 manage_role_detail: 'manage/role/detail',88 // 角色列表89 manage_role_list: 'manage/role/list',90 // 修改角色91 manage_role_update: 'manage/role/update',92 // 权限列表93 common_account_permission_list: 'common/account/permission/list',94 // 角色列表95 common_account_role_list: 'common/account/role/list',96 // 验证手机号是否存在97 common_account_checkPhone: 'common/account/checkPhone',98 // 验证用户名是否存在99 common_account_checkUserName: 'common/account/checkUserName',100 // ******故障*****101 // 故障列表102 manage_breakdowns_getDeviceCurrentErrorList: 'manage/breakdowns/getDeviceCurrentErrorList',103 // 故障驱势104 manage_breakdowns_getDeviceCurrentErrorTrent: 'manage/breakdowns/getDeviceCurrentErrorTrent',105 // 根据时间查询设备故障总数106 manage_breakdowns_getDeviceCurrentErrorCount: 'manage/breakdowns/getDeviceCurrentErrorCount',107 //获取故障详情108 manage_breakdowns_getBreakdownAndDealInfo: 'manage/breakdowns/getBreakdownAndDealInfo',109 // 故障设置列表110 manage_breakdown_getBreakdownList: 'manage/breakdown/getBreakdownList',111 // 删除股长列表112 manage_breakdown_deleteDeviceError: 'manage/breakdown/deleteDeviceError',113 // 故障设置编辑114 manage_breakdown_updateBreakdown: 'manage/breakdown/updateBreakdown',115 // 新增故障设置116 manage_breakdown_createBreakdown: 'manage/breakdown/createBreakdown',117 //故障禁用、启用状态118 manage_breakdown_forbidden: 'manage/breakdown/forbidden',119 // 删除故障设置120 manage_breakdown_deleteBreakdown: 'manage/breakdown/deleteBreakdown',121 // 故障预处理页面接口122 manage_breakdown_getPretreatmentList: 'manage/breakdown/getPretreatmentList',123 // 新增预处理方案124 manage_breakdown_createPretreatment: 'manage/breakdown/createPretreatment',125 // 编辑/停用处理方案126 manage_breakdown_updatePretreatment: 'manage/breakdown/updatePretreatment',127 // 删除处理方案128 manage_breakdown_deletePretreatment: 'manage/breakdown/deletePretreatment',129 // 保修列表130 manage_breakdowns_getBreakdownDealList: 'manage/breakdowns/getBreakdownDealList',131 // ******用户******132 // 用户列表133 manage_user_list: 'manage/user/list',134 // 查询用户详情135 manage_user_detail: 'manage/user/detail',136 // 用户趋势137 manage_user_trend_list: 'manage/user/trend/list',138 // 删除用户139 manage_user_delete: 'manage/user/delete',140 // 用户设备列表141 manage_user_detail_deviceList: 'manage/user/detail/deviceList',142 // 查询绑定设备的用户数量143 manage_user_bind_device_count: 'manage/user/bind/device/count',144 // 查询用户新增数145 manage_user_trend_count: 'manage/user/trend/count',146 // ******消息******147 // 消息列表148 manage_messageRecord_getMessageRecordList: 'manage/messageRecord/getMessageRecordList',149 // 消息推送历史150 manage_messageRecord_getMessageHistoryList: 'manage/messageRecord/getMessageHistoryList',151 // 消息详情列表数据152 manage_messageRecord_getMessageRecordList: 'manage/messageRecord/getMessageRecordList',153 // 消息详情154 manage_messageRecord_getMessageHistoryinfo: 'manage/messageRecord/getMessageHistoryinfo',155 // 消息类型列表156 manage_messageType_getMessageTypeList: 'manage/messageType/getMessageTypeList',157 // 删除消息记录158 manage_messageRecord_deleteMessageRecord: 'manage/messageRecord/deleteMessagePushHistory',159 // 推送规则列表160 manage_message_getMessageConfigList: 'manage/message/getMessageConfigList',161 // 启用/停用推送规则162 manage_message_updateMessageConfigStatus: 'manage/message/updateMessageConfigStatus',163 // 推送规则删除164 manage_message_deleteMessageConfig: 'manage/message/deleteMessageConfig',165 // 推送规则修改/新增166 manage_message_saveMessageConfig: 'manage/message/saveMessageConfig',167 // 消息类型列表168 manage_messageType_getMessageTypeList: 'manage/messageType/getMessageTypeList',169 // 新建/修改消息类型170 manage_messageType_saveMessageType: 'manage/messageType/saveMessageType',171 // 删除消息类型172 manage_messageType_deleteMessageType: 'manage/messageType/deleteMessageType',173 // 反馈列表接口174 manage_feedBack_list: 'manage/feedBack/list',175 // 回复反馈接口176 manage_feedBack_updateFeedBackFeedContent: 'manage/feedBack/updateFeedBackFeedContent',177 // 推送对象列表178 manage_messageSystem_getMessageSystemList: 'manage/messageSystem/getMessageSystemList',179 // 删除推送对象列表180 manage_messageSystem_deleteMessageSystem: 'manage/messageSystem/deleteMessageSystem',181 // 新增/编辑推动对象182 manage_messageSystem_saveMessageSystem: 'manage/messageSystem/saveMessageSystem',183 // 推送消息184 manage_messageRecord_systemMessagePush: 'manage/messageRecord/systemMessagePush',185 // 获取反馈详情186 manage_feedBack_detail: 'manage/feedBack/detail',187 // ******广告******188 // 广告编辑189 manage_advertise_update: 'manage/advertise/update',190 // 广告启用/停用191 manage_advertise_change: 'manage/advertise/change',192 // 广告列表193 manage_advertise_list: 'manage/advertise/list',194 // 广告添加195 manage_advertise_add: 'manage/advertise/add',196 // 广告删除197 manage_advertise_delete: 'manage/advertise/delete',198 // 获取单条详细数据199 manage_advertise_selectOne: 'manage/advertise/selectOne',200 // ******日志******201 // app用户操作日志列表202 manage_log_app_list: 'manage/log/app/list',203 // 用户操作日志详情204 manage_log_app_detail: 'manage/log/app/detail',205 // 管理后台操作日志列表206 manage_log_list: 'manage/log/list',207 // 管理后台操日志详情208 manage_log_detail: 'manage/log/detail',209 // 故障日志210 manage_breakdown_getBreakdownRecordList: 'manage/breakdown/getBreakdownRecordList',211 // 故障日志删除212 manage_breakdown_deleteHistoryDeviceError: 'manage/breakdown/deleteHistoryDeviceError',213 // ******流量卡******214 // 流量卡列表215 manage_simCard_getSimCardList: 'manage/simCard/getSimCardList',216 // 流量卡列表V2217 manage_simCard_getSimCardV2List: 'manage/simCard/getSimCardV2List',218 // 流量卡列表V2219 manage_v2_simCard_getSimCardList: '/manage/v2/simCard/getSimCardList',220 // 流量卡详情221 manage_simCard_getSimCardInfo: 'manage/simCard/getSimCardInfo',222 // 停用启用223 manage_simCard_closeSimCardGPRS: 'manage/simCard/closeSimCardGPRS',224 // 停机复机225 manage_simCard_shutAndResetSimCard: 'manage/simCard/shutAndResetSimCard',226 // 查询物联网卡套餐列表227 manage_v2_simCard_getPackageList: 'manage/v2/simCard/getPackageList',228 // 查询物联网卡套餐详情229 manage_simCard_getGPGSPackageInfo: 'manage/simCard/getGPGSPackageInfo',230 // 获取操作记录231 manage_simOperateRecord_getSimOperateRecordList: 'manage/simOperateRecord/getSimOperateRecordList',232 // 获取流量池数据233 manage_v2_simCard_getGroupFlowPool: 'manage/v2/simCard/getGroupFlowPool',234 // 刷新流量数据235 manage_v2_simCard_refresh: 'manage/v2/simCard/refresh',236 // 获取sim卡237 manage_v2_simCard_getSimCardInfo: 'manage/v2/simCard/getSimCardInfo',238 // 获取套餐信息239 manage_v2_simCard_getPackageInfo: 'manage/v2/simCard/getPackageInfo',240 // sim卡近六月流量走势241 manage_v2_simCard_getSimCardRecentFlowCount: 'manage/v2/simCard/getSimCardRecentFlowCount',242 // 停机243 manage_v2_simCard_closeSim: 'manage/v2/simCard/closeSim',244 // 复机245 manage_v2_simCard_openSim: 'manage/v2/simCard/openSim',246 // 后台开始导出数据247 manage_exportSim: 'manage/v2/simCard/exportSim',248 // 监测后台数据导出进度249 manage_progress: 'manage/v2/simCard/export/progress',250 // ******公共部分******251 // 产品列表252 common_getProductName_list: 'common/getProductName/list',253 // 故障名称列表 下拉框254 common_getErrorName_list: 'common/getErrorName/list',255 // 管理员修改密码256 account_change_password: 'account/change/password',257 // 管理员登陆258 account_login: 'account/login',259 // 管理员登出260 account_logout: 'account/logout',261 // 获取验证码图片262 common_code_getCheckCode: 'common/code/getCheckCode',263 // 图片上传接口264 common_uploadImg: 'common/uploadImg',265 // 批量操作266 getBatchOperateConfigPage: "manage/batch/operate/config/getBatchOperateConfigPage",267 // 保存批量操作配置268 saveBatchOperateConfig: 'manage/batch/operate/config/saveBatchOperateConfig',269 // 禁用操作270 batch_operate_config_forbidden: 'manage/batch/operate/config/forbidden',271 // 获取批量操作详情272 getBatchOperateConfigInfo: "manage/batch/operate/config/getBatchOperateConfigInfo",273 // 删除批量操作274 batch_operate_config_delete: 'manage/batch/operate/config/delete',275 // 根据产品获取批量操作列表276 getProductBatchOperateList: 'manage/product/operate/config/getProductBatchOperateList',277 // 获取产品已经配置的批量操作278 getBatchOperateConfigByPK: 'manage/batch/operate/config/getBatchOperateConfigByPK',279 // 保存产品配置的批量操作280 saveProductBatchOperate: 'manage/product/operate/config/saveProductBatchOperate',281 // 保存系统维护信息282 saveSystemMaintainConfig: 'manage/maintain/saveSystemMaintainConfig',283 // 获取已发送的系统维护消息内容284 getSystemMaintainConfigInfo: 'manage/maintain/getSystemMaintainConfigInfo',...

Full Screen

Full Screen

deviceInfoList.js

Source:deviceInfoList.js Github

copy

Full Screen

1jQuery(function($) {2 $("#submenu-menu-device-info").addClass("active");3 $("#menu-device").addClass("active");4 $("#menu-device").addClass("open");5 initOrgTree();6 $("#searchGoodsBtn").click(function () {7 searchDevice();8 });9 $("#keyword").keyup(function () {10 oTable.fnDraw();11 });12 13// $('#deviceInfo_list tbody').on('click','tr td:nth-child(3)', function (e) {14// var name = $(this).text();15// alert(name);16// } );17});18oTable = null;19function initTable() {20 if(oTable == null) {21 oTable = $("#deviceInfo_list").dataTable({22 "bAutoWidth":false,23 "bLengthChange" :false,24 "bProcessing": false,25 "bInfo": true,26 "bFilter" : false,// 搜索栏27 "bServerSide" : true,//异步请求必须设置 28 "sAjaxSource": ROOT_PATH +"/view/device/deviceInfo/queryDeviceInfo.action", //异步请求地址29 "aoColumns" : [ 30 {"mDataProp":"deviceNo","sClass":"center"},31 {"mDataProp":"deviceName","sClass":"center"},32 {"mDataProp":"deviceTypeName","sClass":"center"},33 {"mDataProp":"deviceAddress","sClass":"left"},34 {"mDataProp":"createDate","sClass":"center"},35 {"mDataProp":"deviceStatus","sClass":"center", "mRender": function (data, type, full) {36 var deviceStatus = '';37 if (data == '1') {38 deviceStatus = '<input title="启用" class="ace ace-switch ace-switch-6" type="checkbox" onclick="changeStatus(this,'+full.deviceId+')" checked/><span class="lbl"></span>';39 }40 else if (data == '0' || data == '2' || data == '3') {41 deviceStatus = '<input title="禁用" class="ace ace-switch ace-switch-6" type="checkbox" onclick="changeStatus(this,'+full.deviceId+')" /><span class="lbl"></span>';42 }43 return deviceStatus;44 }},45 {"sDefaultContent": "","sClass":"center","mRender": function(data, type, full) { 46 var actionDiv = '';47 actionDiv = '<div class="hidden-sm hidden-xs btn-group">'+48 '<a class="tooltip-info" data-rel="tooltip" title="维修">'+49 '<button class="btn btn-xs btn-info" onclick="deviceMaintenance(\'' + full.deviceId + '\')" >维修</button>'+50 '</a>&nbsp;'+51 '<a class="tooltip-info" data-rel="tooltip" title="清洗">'+52 '<button class="btn btn-xs btn-info" onclick="deviceClean(\'' + full.deviceId + '\')" >清洗</button>'+53 '</a>&nbsp;'+54 '<a class="tooltip-info" data-rel="tooltip" title="销售" onclick="sell(\'' + full.deviceId + '\')">'+55 '<button class="btn btn-xs btn-info">销售</button>'+56 '</a>';57 58 actionDiv += '</div>';59 return actionDiv;60 }},61 {"sDefaultContent": "","sClass":"center","mRender": function(data, type, full) { 62 var actionDiv = '';63 actionDiv = '<div class="hidden-sm hidden-xs btn-group">'+64 '<button onclick="deviceDtl(\'' + full.deviceId + '\')" class="btn btn-xs btn-success"><i class="ace-icon fa fa-search-plus bigger-120"></i></button>' +65 '<button class="btn btn-xs btn-info" onclick="modifyDeviceInfo(\'' + full.deviceId + '\')"><i class="ace-icon fa fa-pencil bigger-120"></i></button>'+66 '<button class="btn btn-xs btn-danger" onclick="deleteDeviceInfo(\'' + full.deviceId + '\')"><i class="ace-icon fa fa-trash-o bigger-120"></i></button>';67 actionDiv += '</div>';68 return actionDiv;69 }}70 ],71 "oLanguage": {72 "sProcessing": "正在加载中......",73 "sLengthMenu": "每页显示 _MENU_ 条记录",74 "sZeroRecords": "没有数据!",75 "sEmptyTable": "表中无数据存在!",76 "sInfo": "当前显示 _START_ 到 _END_ 条,共 _TOTAL_ 条记录",77 "sInfoEmpty": "显示0到0条记录",78 "sInfoFiltered": "数据表中共为 _MAX_ 条记录",79 zeroRecords: "没有内容",80 "sSearch": "搜索",81 "oPaginate": {82 "sFirst": "首页",83 "sPrevious": "上一页",84 "sNext": "下一页",85 "sLast": "末页"86 }87 },88 "aoColumnDefs": [//和aoColums类似,但他可以给指定列附近爱属性89 {90 sDefaultContent: '',91 aTargets: [ '_all' ]92 },93 {"bSortable": false, "aTargets": [0, 1, 2, 3, 4, 5, 6,7]}, //这句话意思是第1,3,6,7,8,9列(从0开始算) 不能排序94 95 {"aTargets":[0],"mRender":function(data,type,full){96 return "<a onclick='deviceMapInfo(\"" + full.deviceId + "\")'>" + data + "</a>"}97 }98 ],99 "fnServerData": retrieveData,100 101 });102 } else {103 oTable.fnDraw(); //重新加载数据104 }105}106/**107* sSource 查询链接108* aoData 参数109* fnCallback 返回数据填充方法110*/111function retrieveData(sSource, aoData, fnCallback) { 112 //商品名称或编号113 var keyword = $("#keyword").val();114 //商品状态115 var deviceStatus = $("#status_sele").val();116 var param = {"keyword": keyword};117 param.deviceStatus = deviceStatus;118 var selectNodes = $.fn.zTree.getZTreeObj("org_tree");119 if(selectNodes!=null){120 if(selectNodes.getSelectedNodes() != ""){121 var id=selectNodes.getSelectedNodes()[0].id; 122 var pid=selectNodes.getSelectedNodes()[0].pid; 123 var level = selectNodes.getSelectedNodes()[0].level;124 param.id = id;125 param.pid = pid;126 param.level = level;127 } 128 } 129 for(var i = 0;i < aoData.length;i++) {130 var _aoData = aoData[i];131 if(_aoData.name == "iDisplayStart") {132 /*开始页数*/133 param.iDisplayStart = _aoData.value;134 }else if(_aoData.name == "iDisplayLength"){135 /*记录条数*/136 param.iDisplayLength = _aoData.value;137 }else if(_aoData.name == "sEcho"){138 /*操作次数*/139 param.sEcho = _aoData.value;140 }141 }142 //提交访问143 $.ajax( { 144 type: "POST", 145 url: sSource, 146 dataType: "json", 147 data: param, // 以json格式传递 148 success: function(resp) {149 fnCallback(resp);150// removeMask($('.goods-container'));151 } 152 }); 153}154//搜索商品155function searchDevice() {156 if(oTable){157 oTable.fnDraw();158 }159}160function modifyDeviceInfo(id){161 window.location.href = ROOT_PATH +"/view/device/deviceInfo/addOrModifyDeviceInfo.action?deviceId="+id;162}163function deleteDeviceInfo(id){164 var isAdmin = $("#isAdmin").val();165 alert(isAdmin);166 if(isAdmin != null && isAdmin == '1'){167 if (confirm("确定删除此条设备信息吗?")) {168 window.location.href = ROOT_PATH +"/view/device/deviceInfo/delDeviceById.action?deviceId="+id;169 }170 }171 else{172 alert("您没有权限删除该设备!");173 }174 175}176function add(id){177 window.location.href = ROOT_PATH +"/view/device/deviceInfo/addOrModifyDeviceInfo.action?deviceId="+id;178}179function deviceMaintenance(id){180 var url = ROOT_PATH +"/view/device/deviceMain/queryDeviceMaintenance.action?deviceId="+id;181 window.location.href = url;182}183function deviceClean(id){184 window.location.href = ROOT_PATH +"/view/device/deviceClean/queryDeviceCleanList.action?deviceId="+id;185}186function sell(id){187 //window.location.href = ROOT_PATH +"/view/device/deviceInfo/deviceMap.action?deviceId="+id;188}189function deviceMapInfo(id){190 window.location.href = ROOT_PATH +"/view/device/deviceInfo/deviceMap.action?deviceId="+id;191}192function allDeviceMap(){193 $.ajax({194 url: ROOT_PATH + '/view/device/deviceInfo/checkDevice.action',195 type:'POST',196 dataType:'json',197 success:function(data){ 198 if(data){199 window.location.href = ROOT_PATH +"/view/device/deviceInfo/queryAllDevice.action";200 }201 else{202 alert("请添加设备!");203 }204 }205 });206}207function carMap(){208 window.location.href = ROOT_PATH +"/view/device/testMap.jsp";209}210//设备详情211function deviceDtl(id){212 window.location.href = ROOT_PATH +"/view/device/deviceInfo/queryDeviceById.action?deviceId="+id;213}214/**215 * 启用禁止216 * @param deviceId 设备ID217 */218function changeStatus(checkbox,deviceId) {219 if(deviceId){220 var isDisable = null;221 if($(checkbox).prop("checked")) {222 isDisable = '1';223 } else {224 isDisable = '0';225 }226 $.ajax({227 type : "POST",228 url : ROOT_PATH + "/view/device/deviceInfo/changeDeviceStatus.action",229 data : { "deviceId" : deviceId,"isDisable":isDisable}, 230 success : function(data) {231 if(!data) {232 alert("系统错误,请联系管理员!");233 }234 //initTable();235 }236 });237 }238}239//初始化机构树240function initOrgTree() {241 var setting = {242 data: {243 simpleData: {244 enable: true245 }246 },247 callback: {248 onClick: function(){249 searchDevice();250 }251 }252 };253 var treeObj = $("#org_tree");254 var zNodes;255 $.ajax({256 url: ROOT_PATH + '/view/inventory/warehouse/getMulSubDictDataByPcode.action',257 type:'POST',258 data:{"dictPcode" : "AL_POSITION" ,"dictLevel":"5"},259 dataType:'json',260 success:function(data){261 zNodes = data;262 $.fn.zTree.init($("#org_tree"), setting, zNodes);263 }264 });265 treeObj.hover(function () {266 if (!treeObj.hasClass("showIcon")) {267 treeObj.addClass("showIcon");268 }269 }, function() {270 treeObj.removeClass("showIcon");271 });272 initTable();273}274function showMenu() {275 var gtObj = $("#dict_provice_id");276 //alert(gtObj);277 if($("#gt_combobox").css("display") == "none"){278 var gtOffset = $("#dict_provice_id").offset();279 $("#gt_combobox").css({width:gtObj.css("width"),left:gtOffset.left + "px", top:gtOffset.top + gtObj.outerHeight() + "px"}).slideDown("fast");280 }281 $("body").bind("mousedown", onBodyDown);282}283function hideMenu() {284 $("#gt_combobox").fadeOut("fast");285 $("body").unbind("mousedown", onBodyDown);286}287function onBodyDown(event) {288 if (!(event.target.id == "menuBtn" || event.target.id == "gt_combobox" || $(event.target).parents("#gt_combobox").length>0)) {289 hideMenu();290 }291}292function show(){293 var selectNodes = $.fn.zTree.getZTreeObj("org_tree").getSelectedNodes();...

Full Screen

Full Screen

deviceCleanList.js

Source:deviceCleanList.js Github

copy

Full Screen

1jQuery(function($) {2 $("#submenu-menu-device-clean").addClass("active");3 $("#menu-device").addClass("active");4 $("#menu-device").addClass("open");5 6 initTable();7 $("#keyword").keyup(function () {8 initTable();9 });10 11 $("#dp_quoteStartDate").datetimepicker({12 minView: "month",13 format: 'yyyy-mm-dd',14 language: 'zh-CN',15 weekStart: 1,16 todayBtn: 1,17 autoclose: true,18 todayHighlight: 1,19 startView: 2,20 minView: 2,21 forceParse: 022 });23 24 $("#dp_quoteEndDate").datetimepicker({25 minView: "month",26 format: 'yyyy-mm-dd',27 language: 'zh-CN',28 weekStart: 1,29 todayBtn: 1,30 autoclose: true,31 todayHighlight: 1,32 startView: 2,33 minView: 2,34 forceParse: 035 });36});37oTable = null;38function initTable() {39 var deviceId = $("#deviceId").val();40 if(oTable == null) {41 oTable = $("#deviceClean_list").dataTable({42 "bAutoWidth":false,43 "bLengthChange" :false,44 "bProcessing": false,45 "bFilter" : false,// 搜索栏46 "bServerSide" : true,//异步请求必须设置 47 "sAjaxSource": ROOT_PATH +"/view/device/deviceClean/queryDeviceClean.action?deviceId="+deviceId, //异步请求地址48 "aoColumns" : [ 49 {"mDataProp":"cleanNo","sClass":"center"},50 {"mDataProp":"deviceInfo.deviceNo","sClass":"center"},51 {"mDataProp":"deviceInfo.deviceName","sClass":"center"},52 {"mDataProp":"deviceInfo.deviceType.deviceTypeName","sClass":"center"},53 {"mDataProp":"cleanEndTiem","sClass":"center"},54 {"mDataProp":"finishTime","sClass":"center"},55 {"mDataProp":"cleanDate","sClass":"center"},56 {"mDataProp":"sysUser.realName","sClass":"center"},57 {"mDataProp":"cleanStatus","sClass":"center" ,"mRender": function (data, type, full) {58 var cleanStatus = '';59 if (data == '0') {60 cleanStatus = '<span class="lbl">完成</span>';61 62 }63 else if (data == '1') {64 cleanStatus = '<span class="lbl">未完成</span>';65 }66 return cleanStatus;67 }},68// {"mDataProp":"cleanStatus","sClass":"center" ,"mRender": function (data, type, full) {69// var cleanStatus = '';70// if (data == '0') {71// cleanStatus = '<input title="完成" class="ace ace-switch ace-switch-6" type="checkbox" onclick="changeStatus(this,'+full.cleanId+')" checked /><span class="lbl"></span>';72// 73// }74// else if (data == '1') {75// cleanStatus = '<input title="未完成" class="ace ace-switch ace-switch-6" type="checkbox" onclick="changeStatus(this,'+full.cleanId+')" /><span class="lbl"></span>';76// }77// return cleanStatus;78// }},79 {"sDefaultContent": "","sClass":"center","mRender": function(data, type, full) { 80 var actionDiv = '';81 actionDiv = '<div class="hidden-sm hidden-xs btn-group">'+82 '<button class="btn btn-xs btn-success" onclick="deviceCleanDtl(\'' + full.cleanId + '\')"><i class="ace-icon fa fa-search-plus bigger-120"></i></button>' +83 '<button class="btn btn-xs btn-danger" onclick="deleteType(\'' + full.cleanId + '\')"><i class="ace-icon fa fa-trash-o bigger-120"></i></button>';84 actionDiv += '</div>';85 return actionDiv;86 }}87 ],88 "oLanguage": {89 "sProcessing": "正在加载中......",90 "sLengthMenu": "每页显示 _MENU_ 条记录",91 "sZeroRecords": "没有数据!",92 "sEmptyTable": "表中无数据存在!",93 "sInfo": "当前显示 _START_ 到 _END_ 条,共 _TOTAL_ 条记录",94 "sInfoEmpty": "显示0到0条记录",95 "sInfoFiltered": "数据表中共为 _MAX_ 条记录",96 zeroRecords: "没有内容",97 "sSearch": "搜索",98 "oPaginate": {99 "sFirst": "首页",100 "sPrevious": "上一页",101 "sNext": "下一页",102 "sLast": "末页"103 }104 },105 "aoColumnDefs": [//和aoColums类似,但他可以给指定列附近爱属性106 {"bSortable": false, "aTargets": [0, 1, 2, 3, 4, 5, 6 ,7 ,8 ,9]} //这句话意思是第1,3,6,7,8,9列(从0开始算) 不能排序107 ],108 "fnServerData": retrieveData,109 110 });111 } else {112 oTable.fnDraw(); //重新加载数据113 }114}115/**116* sSource 查询链接117* aoData 参数118* fnCallback 返回数据填充方法119*/120function retrieveData(sSource, aoData, fnCallback) { 121 //商品名称或编号122 var keyword = $("#keyword").val();123 124 //有效起始日期125 var startDate = $("#dp_quoteStartDate").val();126 //有效终止日期127 var endDate = $("#dp_quoteEndDate").val();128 var deviceId = $("#deviceId").val(); 129 var param = {130 "keyword":keyword,131 "deviceId" : deviceId,132 "startDate":startDate,133 "endDate":endDate134 };135 for(var i = 0;i < aoData.length;i++) {136 var _aoData = aoData[i];137 if(_aoData.name == "iDisplayStart") {138 /*开始页数*/139 param.iDisplayStart = _aoData.value;140 }else if(_aoData.name == "iDisplayLength"){141 /*记录条数*/142 param.iDisplayLength = _aoData.value;143 }else if(_aoData.name == "sEcho"){144 /*操作次数*/145 param.sEcho = _aoData.value;146 }147 }148 //提交访问149 $.ajax( { 150 type: "POST", 151 url: sSource, 152 dataType: "json", 153 data: param, // 以json格式传递 154 success: function(resp) {155 fnCallback(resp);156// removeMask($('.goods-container'));157 } 158 }); 159}160//搜索商品161function searchGoods() {162 if(oTable){163 oTable.fnDraw();164 }165}166/**167 * 设备清洗是否完成168 * @param checkbox169 * @param deviceId170 */171function changeStatus(checkbox,cleanId) {172 if(cleanId){173 var isDisable = null;174 if($(checkbox).prop("checked")) {175 isDisable = '0';176 } else {177 isDisable = '1';178 }179 $.ajax({180 type : "POST",181 url : ROOT_PATH + "/view/device/deviceClean/changeCleanStatus.action",182 data : { "cleanId" : cleanId,"isDisable":isDisable}, 183 success : function(data) {184 if(!data) {185 alert("系统错误,请联系管理员!");186 }187 initTable();188 }189 });190 }191}192function deleteType(id){193 if (confirm("确定删除此条设备清洗信息吗?")) {194 window.location.href = ROOT_PATH +"/view/device/deviceClean/delDeviceCleanById.action?cleanId="+id;195 }196}197function deviceCleanDtl(cleanId){198 window.location.href = ROOT_PATH +"/view/device/deviceClean/deviceCleanDtl.action?cleanId="+cleanId;199}200function add(){201 window.location.href = ROOT_PATH +"/view/device/deviceClean/addOrModifyDeviceClean.action?cleanId=add";202}203function dateFind(){204 if($("#dp_quoteStartDate").val() != "" && $("#dp_quoteEndDate").val() != ""){205 initTable();206 }207}208function quickSearch(type) {209 var startDate = "";210 var endDate = "";211 if (type == 1) { //本周212 startDate = DateUtil.dateToStr('yyyy-MM-dd', DateUtil.weekStartDate());213 endDate = DateUtil.dateToStr('yyyy-MM-dd', DateUtil.weekEndDate());214 } else if (type == 2) { //上周215 startDate = DateUtil.dateToStr('yyyy-MM-dd', DateUtil.lastWeekStartDate());216 endDate = DateUtil.dateToStr('yyyy-MM-dd', DateUtil.lastWeekEndDate());217 } else if (type == 3) { //本月218 startDate = DateUtil.dateToStr('yyyy-MM-dd', DateUtil.monthStartDate());219 endDate = DateUtil.dateToStr('yyyy-MM-dd', DateUtil.monthEndDate());220 } else if (type == 4) { //上月221 startDate = DateUtil.dateToStr('yyyy-MM-dd', DateUtil.lastMonthStartDate());222 endDate = DateUtil.dateToStr('yyyy-MM-dd', DateUtil.lastMonthEndDate());223 }224 $("#dp_quoteStartDate").val(startDate);225 $("#dp_quoteEndDate").val(endDate);226 initTable();...

Full Screen

Full Screen

yubikey.js

Source:yubikey.js Github

copy

Full Screen

1var webusb = {};2var lightsParent;3const REPORT_TYPE_FEATURE = 0x034const REPORT_TYPE_SIZE = 85const HID_GET_REPORT = 16const HMAC_CHALRESP_SLOT2 = 0x387const SLOT_WRITE_FLAG = 0x80 // send by the host, cleared by the device8const RESP_PENDING_FLAG = 0x40 /* Response pending flag */ 9const SHA1_HASH_LENGTH = 4010function sleep(ms) {11 return new Promise(resolve => setTimeout(resolve, ms));12}13function str2ab(str) {14 var buf = new Array(64); 15 for (var i=0, strLen=str.length; i<strLen; i++) {16 buf[i] = str.charCodeAt(i) & 0xFF;17 }18 for (var i = str.length; i < 64; i++) {19 buf[i] = 0;20 }21 return buf;22}23function yk_endian_swap_16(x) {24 console.log("Big endian is not supported, so this function is a NO-OP");25 return x;26}27function _create_report_size_message() {28 return {29 recipient: "interface",30 requestType: "class",31 request: HID_GET_REPORT,32 value: REPORT_TYPE_FEATURE << 8,33 index: 0,34 length: REPORT_TYPE_SIZE,35 timeout: 100036 }37}38function _wait_for_key_status(device, boolean_and, flag, sleeptime) {39 return new Promise(async function(resolve, reject) {40 await sleep(sleeptime);41 device.controlTransferIn(_create_report_size_message(), REPORT_TYPE_SIZE)42 .then(data => {43 var status_flag = data.data.getUint8(data.data.byteLength -1);44 if ((status_flag & flag) == boolean_and) {45 resolve(data.data);46 } else {47 _wait_for_key_status(device, boolean_and, flag)48 .then((wanted_data) => {resolve(wanted_data)});49 }50 });51 });52}53function _read_hash_from_key(device, acc) {54 return new Promise(function(resolve, reject) {55 result = acc56 _wait_for_key_status(device, RESP_PENDING_FLAG, RESP_PENDING_FLAG, 100)57 .then(data => {58 for (var i = 0; i < data.byteLength -1; i++)59 result += data.getUint8(i).toString(16);60 if (result.length > SHA1_HASH_LENGTH) {61 resolve(result);62 return 63 } 64 return _read_hash_from_key(device, result)65 .then((final_result) => resolve(final_result));66 });67 });68}69function yubikey_crc16 (buf) {70 var m_crc = 0xffff;71 buf.forEach(function (value, index) {72 var i, j;73 m_crc ^= value & 0xFF;74 for (i = 0; i < 8; i++) {75 j = m_crc & 1;76 m_crc >>= 1;77 if (j)78 m_crc ^= 0x8408;79 }80 m_crc &= 0xFFFF;81 });82 return m_crc;83}84function chunk_buffer(data) {85 // slice the data on nine different chunks86 var data_chunks = [];87 var start, end;88 for (var i = 0; i < 9; i ++) {89 start = i * 7;90 end = (i + 1) * 7;91 thischunk = data.slice(start, end);92 if (thischunk.reduce((acc, value) => {return acc += value}) == 0) {93 continue; // this was all zero's, no need to send this chunk94 }95 thischunk.push(SLOT_WRITE_FLAG | (i & 0x0F));96 data_chunks.push(thischunk);97 }98 // now we prepare the header.99 header = new Array(8); 100 crc = yubikey_crc16(data);101 header[0] = 0;102 // we could probably make this work using a toggle in the interface103 header[1] = HMAC_CHALRESP_SLOT2;104 header[2] = crc & 0xff;105 header[3] = (crc & 0xff00) >> 8;106 header[4] = 0107 header[5] = 0108 header[6] = 0109 header[7] = SLOT_WRITE_FLAG | (i & 0x0F);110 data_chunks.push(header);111 result = []112 data_chunks.forEach((value, i) => {113 arrayChunk = new Uint8Array(8);114 value.forEach((value, i) => {115 arrayChunk[i] = value;116 })117 result.push(arrayChunk);118 });119 return result;120}121(function() {122 'use strict';123 webusb.devices = {};124 function findOrCreateDevice(rawDevice) {125 let device = webusb.getDevice(rawDevice);126 if (device === undefined)127 device = new webusb.Device(rawDevice);128 return device;129 }130 webusb.getDevices = function() {131 return navigator.usb.getDevices().then(devices => {132 return devices.map(device => findOrCreateDevice(device));133 });134 };135 webusb.requestDevice = function() {136 var filters = [137 { vendorId: 0x1050, productId: 0x0111 }138 ];139 return navigator.usb.requestDevice({filters: filters}).then(device => {140 return findOrCreateDevice(device);141 });142 };143 webusb.Device = function(device) {144 this.device_ = device;145 webusb.devices[device.serialNumber] = this;146 };147 webusb.deleteDevice = function(device) {148 delete webusb.devices[device.device_.serialNumber];149 };150 webusb.getDevice = function(device) {151 return webusb.devices[device.serialNumber];152 };153 webusb.Device.prototype.connect = function() {154 return this.device_.open()155 .then(() => {156 if (this.device_.configuration === null) {157 return this.device_.selectConfiguration(1);158 }159 })160 .then(() => this.device_.claimInterface(0));161 };162 webusb.Device.prototype.disconnect = function() {163 return this.device_.close();164 };165 webusb.Device.prototype.controlTransferOut = function(setup, data) {166 return this.device_.controlTransferOut(setup, data);167 };168 webusb.Device.prototype.controlTransferIn = function(setup, length) {169 return this.device_.controlTransferIn(setup, length);170 };171 webusb.Device.prototype.challengeResponse = function (challenge) {172 var challenge_buffer = str2ab(challenge);173 var data_chunks = chunk_buffer(challenge_buffer);174 var thispromise;175 data_chunks.reduce((acc, value) => {176 return acc.then(() => {return _wait_for_key_status(this.device_, 0, SLOT_WRITE_FLAG, 200)})177 .then((ayylmao) => {this.controlTransferOut(this._prepare_transfer_info(), 178 value)});179 }, this.connect())180 .then(() => {return _read_hash_from_key(this.device_, "")})181 .then((hash) => {hash = hash.slice(0, SHA1_HASH_LENGTH);182 document.getElementById("response-field").value = hash;})183 .then(() => {this.disconnect();});184 }185 webusb.Device.prototype._prepare_transfer_info = function(data) {186 return {187 recipient: "interface",188 requestType: "class",189 request: 9,190 value: 0x0300,191 index: 0,192 }193 };194})();195function logDeviceStrings(device) {196 console.log("Connection:",197 device.device_.manufacturerName,198 device.device_.productName,199 device.device_.serialNumber);200}201function setElementDeviceInfo(e, text) {202 //e.getElementsByClassName("lightTitle")[0].innerText = text;203}204function connectDevice(device) {205 var e = document.getElementById("lightCardTemplate");206 e.style.display = "block";207 device.element = e;208 var s = device.device_.productName + "\n" +209 device.device_.serialNumber;210 setElementDeviceInfo(device.element, s);211 var sendButton = document.getElementById("send-challenge");212 sendButton.addEventListener('click', challengeResponse.bind(this, device));213}214function handleConnectEvent(event) {215 var rawDevice = event.device;216 console.log('connect event', rawDevice);217 var device = new webusb.Device(rawDevice);218 connectDevice(device);219}220function cleanUpDevice(device) {221 clearInterval(device.intervalId);222 webusb.deleteDevice(device);223}224function disconnectDevice(rawDevice) {225 var device = webusb.getDevice(rawDevice);226 if (device) { // This can fail if the I/O code already threw an exception227 console.log("removing!");228 lightsParent.removeChild(device.element);229 device.disconnect()230 .then(s => {231 console.log("disconnected", device);232 cleanUpDevice(device);233 }, e => {234 console.log("nothing to disconnect", device);235 cleanUpDevice(device);236 });237 }238}239function handleDisconnectEvent(event) {240 console.log('disconnect event', event.device);241 disconnectDevice(event.device);242}243function registerEventListeners() {244 navigator.usb.addEventListener('connect', handleConnectEvent);245 navigator.usb.addEventListener('disconnect', handleDisconnectEvent);246}247function startInitialConnections() {248 webusb.getDevices().then(devices => {249 for (var i in devices) {250 var device = devices[i];251 connectDevice(device);252 }253 });254}255function requestConnection(event) {256 webusb.requestDevice().then(device => {257 console.log(device);258 connectDevice(device);259 });260 event.preventDefault();261}262function challengeResponse(device) {263 var challenge = document.getElementById("challenge-field").value264 response = device.challengeResponse(challenge);265 document.getElementById("response-field").innerHTML = response;266}267function start() {268 registerEventListeners();269 var lightsConnect = document.getElementById("lightConnect");270 lightsConnect.addEventListener("click", requestConnection);271 lightsParent = document.getElementById("lightsParent");272 startInitialConnections();273}...

Full Screen

Full Screen

EventStoreService.js

Source:EventStoreService.js Github

copy

Full Screen

1const Rx = require('rxjs');2const device = require('../../domain/Device')();3const eventSourcing = require('../../tools/EventSourcing')();4const mbeKey = "ms-devices-location_mbe_devices-location";5/**6 * Singleton instance7 */8let instance;9class EventStoreService {10 constructor() {11 this.functionMap = this.generateFunctionMap();12 this.subscriptions = [];13 this.aggregateEventsArray = this.generateAggregateEventsArray();14 }15 /**16 * Starts listening to the EventStore17 * Returns observable that resolves to each subscribe agregate/event18 * emit value: { aggregateType, eventType, handlerName}19 */20 start$() {21 //default error handler22 const onErrorHandler = (error) => {23 console.error('Error handling EventStore incoming event', error);24 process.exit(1);25 };26 //default onComplete handler27 const onCompleteHandler = () => {28 () => console.log('EventStore incoming event subscription completed');29 }30 return Rx.Observable.from(this.aggregateEventsArray)31 .map(aggregateEvent => ({ ...aggregateEvent, onErrorHandler, onCompleteHandler }))32 .map(params => this.subscribeEventHandler(params));33 }34 /**35 * Stops listening to the Event store36 * Returns observable that resolves to each unsubscribed subscription as string 37 */38 stop$() {39 return Rx.Observable.from(this.subscriptions)40 .map(subscription => {41 subscription.subscription.unsubscribe();42 return `Unsubscribed: aggregateType=${aggregateType}, eventType=${eventType}, handlerName=${handlerName}`;43 })44 }45/**46 * Create a subscrition to the event store and returns the subscription info 47 * @param {{aggregateType, eventType, onErrorHandler, onCompleteHandler}} params48 * @return { aggregateType, eventType, handlerName }49 */50 subscribeEventHandler({ aggregateType, eventType, onErrorHandler, onCompleteHandler }) {51 const handler = this.functionMap[eventType];52 const subscription =53 //MANDATORY: AVOIDS ACK REGISTRY DUPLICATIONS54 eventSourcing.eventStore.ensureAcknowledgeRegistry$(aggregateType)55 .mergeMap(() => eventSourcing.eventStore.getEventListener$(aggregateType,mbeKey))56 .filter(evt => evt.et === eventType)57 .mergeMap(evt => Rx.Observable.concat(58 handler.fn.call(handler.obj, evt),59 //MANDATORY: ACKWOWLEDGE THIS EVENT WAS PROCESSED60 eventSourcing.eventStore.acknowledgeEvent$(evt, mbeKey),61 ))62 .subscribe(63 (evt) => {64 //console.log(`EventStoreService: ${eventType} process: ${JSON.stringify(evt)}`);65 },66 onErrorHandler,67 onCompleteHandler68 );69 this.subscriptions.push({ aggregateType, eventType, handlerName: handler.fn.name, subscription });70 return { aggregateType, eventType, handlerName: `${handler.obj.name}.${handler.fn.name}` };71 }72 /**73 * Starts listening to the EventStore74 * Returns observable that resolves to each subscribe agregate/event75 * emit value: { aggregateType, eventType, handlerName}76 */77 syncState$() {78 return Rx.Observable.from(this.aggregateEventsArray)79 .concatMap(params => this.subscribeEventRetrieval$(params))80 }81 /**82 * Create a subscrition to the event store and returns the subscription info 83 * @param {{aggregateType, eventType, onErrorHandler, onCompleteHandler}} params84 * @return { aggregateType, eventType, handlerName }85 */86 subscribeEventRetrieval$({ aggregateType, eventType }) {87 const handler = this.functionMap[eventType];88 //MANDATORY: AVOIDS ACK REGISTRY DUPLICATIONS89 return eventSourcing.eventStore.ensureAcknowledgeRegistry$(aggregateType)90 .switchMap(() => eventSourcing.eventStore.retrieveUnacknowledgedEvents$(aggregateType, mbeKey))91 .filter(evt => evt.et === eventType)92 .concatMap(evt => Rx.Observable.concat(93 handler.fn.call(handler.obj, evt),94 //MANDATORY: ACKWOWLEDGE THIS EVENT WAS PROCESSED95 eventSourcing.eventStore.acknowledgeEvent$(evt, mbeKey)96 ));97 }98 /**99 * Generates a map that assocs each Event with its handler100 */101 generateFunctionMap() {102 return {103 'DeviceLocationReported': { fn: device.updateDeviceLocation$, obj: device },104 'DeviceDeviceStateReported': { fn: device.updateDeviceData$, obj: device },105 'DeviceRamuUsageAlarmActivated': { fn: device.updateDeviceAlarmsState$, obj: device },106 'DeviceRamUsageAlarmDeactivated': { fn: device.updateDeviceAlarmsState$, obj: device },107 'DeviceSdUsageAlarmActivated': { fn: device.updateDeviceAlarmsState$, obj: device },108 'DeviceSdUsageAlarmDeactivated': { fn: device.updateDeviceAlarmsState$, obj: device },109 'DeviceCpuUsageAlarmActivated': { fn: device.updateDeviceAlarmsState$, obj: device },110 'DeviceCpuUsageAlarmDeactivated': { fn: device.updateDeviceAlarmsState$, obj: device },111 'DeviceTemperatureAlarmActivated': { fn: device.updateDeviceAlarmsState$, obj: device },112 'DeviceTemperatureAlarmDeactivated': { fn: device.updateDeviceAlarmsState$, obj: device },113 'DeviceConnected': { fn: device.updateDeviceAlarmsState$, obj: device },114 'DeviceDisconnected': { fn: device.updateDeviceAlarmsState$, obj: device },115 'CleanDeviceLocationHistoryJobTriggered': { fn: device.cleanDeviceLocationHistory$, obj: device },116 'CleanGroupNamesJobTriggered': { fn: device.cleanGroupNames$, obj: device }117 };118 }119 /**120 * Generates a map that assocs each AggretateType withs its events121 */122 generateAggregateEventsArray() {123 return [124 { aggregateType: 'Device', eventType: 'DeviceDeviceStateReported' },125 { aggregateType: 'Device', eventType: 'DeviceLocationReported' },126 { aggregateType: 'Device', eventType: 'DeviceRamuUsageAlarmActivated' },127 { aggregateType: 'Device', eventType: 'DeviceRamUsageAlarmDeactivated' },128 { aggregateType: 'Device', eventType: 'DeviceSdUsageAlarmActivated' },129 { aggregateType: 'Device', eventType: 'DeviceSdUsageAlarmDeactivated' },130 { aggregateType: 'Device', eventType: 'DeviceCpuUsageAlarmActivated' },131 { aggregateType: 'Device', eventType: 'DeviceCpuUsageAlarmDeactivated' },132 { aggregateType: 'Device', eventType: 'DeviceTemperatureAlarmActivated' },133 { aggregateType: 'Device', eventType: 'DeviceTemperatureAlarmDeactivated', },134 { aggregateType: 'Device', eventType: 'DeviceConnected' },135 { aggregateType: 'Device', eventType: 'DeviceDisconnected' },136 { aggregateType: 'Cronjob', eventType: 'CleanDeviceLocationHistoryJobTriggered' },137 { aggregateType: 'Cronjob', eventType: 'CleanGroupNamesJobTriggered' },138 ];139 }140}141/**142 * @returns {EventStoreService}143 */144module.exports = () => {145 if (!instance) {146 instance = new EventStoreService();147 console.log('EventStoreService Singleton created');148 }149 return instance;...

Full Screen

Full Screen

simulator-management.js

Source:simulator-management.js Github

copy

Full Screen

...58 }59}60async function fullResetSimulator (device) {61 if (device) {62 await device.clean();63 }64}65async function resetSimulator (device, opts) {66 if (!device) return;67 log.debug('Cleaning simulator state.');68 try {69 await clearAppData(device, opts);70 await device.clean();71 } catch (err) {72 log.warn(err);73 log.warn('Could not reset simulator. Leaving as is.');74 }75}76async function endSimulator (device) {77 if (!device) return;78 log.debug('Shutting down simulator');79 await device.shutdown();80}81async function clearAppData (device, opts) {82 if (opts.app && opts.bundleId) {83 await device.cleanCustomApp(path.basename(opts.app), opts.bundleId);84 }...

Full Screen

Full Screen

app2.js

Source:app2.js Github

copy

Full Screen

1var express = require('express');2var bodyParser = require('body-parser');3var app = express();4var exec = require('child_process').exec;56app.use(bodyParser.urlencoded({ extended: false }));7app.use(bodyParser.json());89app.get('/', function (req, res) {10 res.sendFile(__dirname + '/index.htm');11 console.log('get /');12});1314app.get('/payload', function (req, res) {15 res.sendStatus(200);16 console.log('get /payload');17});1819app.post('/payload', function (req, res) {20 //verify that the payload is a push from the correct repo21 //verify repository.name == 'wackcoon-device' or repository.full_name = 'DanielEgan/wackcoon-device'22 console.log(req.body.pusher.name + ' just pushed to ' + req.body.repository.name);2324 console.log('pulling code from GitHub...');2526 // reset any changes that have been made locally27 exec('pwd && git -C /home/leo/GitHub-webhooks-integrations-example reset --hard', execCallback);2829 // and ditch any files that have been added locally too30 //exec('git -C ~/projects/wackcoon-device clean -df', execCallback);3132 // now pull down the latest33 exec('pwd && git -C /home/leo/GitHub-webhooks-integrations-example pull -f', execCallback);34 35 // run36 exec('pwd && chmod 744 /home/leo/GitHub-webhooks-integrations-example/mvnw');37 exec('cd /home/leo/GitHub-webhooks-integrations-example');38 exec('pwd && ./mvnw spring-boot:run', execCallback);3940});4142app.listen(19569, function () {43 console.log('listening on port 19569')44});45function execCallback(err, stdout, stderr) {46 if(stdout) console.log(stdout);47 if(stderr) console.log(stderr); ...

Full Screen

Full Screen

app.js

Source:app.js Github

copy

Full Screen

1var express = require('express');2var bodyParser = require('body-parser');3var app = express();4var exec = require('child_process').exec;56app.use(bodyParser.urlencoded({ extended: false }));7app.use(bodyParser.json());89app.get('/', function (req, res) {10 res.sendFile(__dirname + '/index.htm');11 console.log('get /');12});1314app.get('/payload', function (req, res) {15 res.sendStatus(200);16 console.log('get /payload');17});1819app.post('/payload', function (req, res) {20 //verify that the payload is a push from the correct repo21 //verify repository.name == 'wackcoon-device' or repository.full_name = 'DanielEgan/wackcoon-device'22 console.log(req.body.pusher.name + ' just pushed to ' + req.body.repository.name);2324 console.log('pulling code from GitHub...');2526 // reset any changes that have been made locally27 exec('git -C ~/projects/wackcoon-device reset --hard', execCallback);2829 // and ditch any files that have been added locally too30 exec('git -C ~/projects/wackcoon-device clean -df', execCallback);3132 // now pull down the latest33 exec('git -C ~/projects/wackcoon-device pull -f', execCallback);3435 // and npm install with --production36 exec('npm -C ~/projects/wackcoon-device install --production', execCallback);3738 // and run tsc39 exec('tsc', execCallback);40});4142app.listen(5000, function () {43 console.log('listening on port 5000')44});4546function execCallback(err, stdout, stderr) {47 if(stdout) console.log(stdout);48 if(stderr) console.log(stderr); ...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1var wd = require('wd');2var assert = require('assert');3var chai = require('chai');4var chaiAsPromised = require('chai-as-promised');5chai.use(chaiAsPromised);6var expect = chai.expect;7var desired = {8};9var driver = wd.promiseChainRemote('localhost', 4723);10driver.init(desired)11 .then(function() {12 return driver.clean();13 })14 .then(function() {15 return driver.quit();16 })17 .done();18var wd = require('wd');19var assert = require('assert');20var chai = require('chai');21var chaiAsPromised = require('chai-as-promised');22chai.use(chaiAsPromised);23var expect = chai.expect;24var desired = {25};26var driver = wd.promiseChainRemote('localhost', 4723);27driver.init(desired)28 .then(function() {29 return driver.installApp('/Users/username/Downloads/MyApp.app');30 })31 .then(function() {32 return driver.quit();33 })34 .done();35var wd = require('wd');36var assert = require('assert');37var chai = require('chai');38var chaiAsPromised = require('chai-as-promised');39chai.use(chaiAsPromised);40var expect = chai.expect;41var desired = {42};43var driver = wd.promiseChainRemote('localhost', 4723);44driver.init(desired)

Full Screen

Using AI Code Generation

copy

Full Screen

1const { remote } = require('webdriverio');2const opts = {3 capabilities: {4 }5};6(async () => {7 const client = await remote(opts);8 await client.clean();9})();

Full Screen

Using AI Code Generation

copy

Full Screen

1const wd = require('wd');2const assert = require('assert');3const {exec} = require('child_process');4const PORT = 4723;5const HOST = 'localhost';6const config = {7};8async function main() {9 const driver = wd.promiseChainRemote(URL);10 await driver.init(config);11 await driver.sleep(10000);12 await driver.execute('mobile: deviceClean', {bundleId: 'com.my.app'});13 await driver.quit();14}15main();16const wd = require('wd');17const assert = require('assert');18const {exec} = require('child_process');19const PORT = 4723;20const HOST = 'localhost';21const config = {22};23async function main() {24 const driver = wd.promiseChainRemote(URL);25 await driver.init(config);26 await driver.sleep(10000);27 await driver.execute('mobile: deviceClean', {bundleId: 'com.my.app'});28 await driver.quit();29}30main();31const wd = require('wd');32const assert = require('assert');33const {exec} = require('child_process');34const PORT = 4723;35const HOST = 'localhost';36const config = {37};38async function main() {39 const driver = wd.promiseChainRemote(URL);40 await driver.init(config);41 await driver.sleep(10000);42 await driver.execute('mobile: deviceClean',

Full Screen

Using AI Code Generation

copy

Full Screen

1const wd = require('wd');2const chai = require('chai');3const chaiAsPromised = require('chai-as-promised');4const expect = chai.expect;5chai.use(chaiAsPromised);6chai.should();7describe('Test', function () {8 this.timeout(300000);9 let driver;10 before(async () => {11 const desiredCaps = {12 };13 await driver.init(desiredCaps);14 });15 after(async () => {16 await driver.quit();17 });18 it('should clean the device', async () => {19 await driver.clean();20 });21});

Full Screen

Using AI Code Generation

copy

Full Screen

1const wdio = require('webdriverio');2const opts = {3 desiredCapabilities: {4 }5};6const client = wdio.remote(opts);7 .init()8 .then(() => client.deviceClean())9 .then(() => client.end());10const wdio = require('webdriverio');11const opts = {12 desiredCapabilities: {13 }14};15const client = wdio.remote(opts);16 .init()17 .then(() => client.deviceLaunchApp())18 .then(() => client.end());19const wdio = require('webdriverio');20const opts = {21 desiredCapabilities: {

Full Screen

Using AI Code Generation

copy

Full Screen

1var webdriver = require('selenium-webdriver');2var By = webdriver.By;3var until = webdriver.until;4var fs = require('fs');5var path = require('path');6var driver = new webdriver.Builder().forBrowser('chrome').build();7driver.findElement(By.name('q')).sendKeys('webdriver');8driver.findElement(By.name('btnK')).click();9driver.wait(until.titleIs('webdriver - Google Search'), 1000);10driver.manage().window().maximize();11driver.quit();12driver.executeScript("mobile: device: clean", { "deviceName": "iPhone 8" });13driver.quit();14driver.executeScript("mobile: device: clean", { "deviceName": "iPhone 8" });15driver.quit();16driver.executeScript("mobile: device: clean", { "deviceName": "iPhone 8" });17driver.quit();18driver.executeScript("mobile: device: clean", { "deviceName": "iPhone 8" });19driver.quit();20driver.executeScript("mobile: device: clean", { "deviceName": "iPhone 8" });21driver.quit();22driver.executeScript("mobile: device: clean", { "deviceName": "iPhone 8" });23driver.quit();24driver.executeScript("mobile: device: clean", { "deviceName": "iPhone 8" });25driver.quit();26driver.executeScript("mobile: device: clean", { "deviceName": "iPhone 8" });27driver.quit();

Full Screen

Using AI Code Generation

copy

Full Screen

1const wdio = require("webdriverio");2const opts = {3 capabilities: {4 }5};6(async () => {7 const client = await wdio.remote(opts);8 await client.pause(5000);9 await client.deviceClean();10 await client.pause(5000);11 await client.deleteSession();12})();13const wdio = require("webdriverio");14const opts = {15 capabilities: {16 }17};18(async () => {19 const client = await wdio.remote(opts);20 await client.pause(5000);21 await client.deviceLaunchApp({22 environment: {

Full Screen

Using AI Code Generation

copy

Full Screen

1describe('Test Appium Device Clean Method', function() {2 it('should delete the app from the device', function() {3 .deviceClean()4 .then(function() {5 console.log("App deleted");6 })7 .catch(function(err) {8 console.log("Error occurred: " + err);9 });10 });11});

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run Appium Xcuitest Driver automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Sign up Free
_

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful