How to use addGroupUser method in devicefarmer-stf

Best JavaScript code snippet using devicefarmer-stf

WorkgroupView.js

Source:WorkgroupView.js Github

copy

Full Screen

1Ext.define('FS.controller.WorkgroupView', {2 extend: 'Ext.app.Controller',3 stores: [4 'WorkgroupTreeTwo',5 'WorkgroupList'6 ],7 views:[8 'workgroup.WorkgroupView',9 'workgroup.List',10 'workgroup.Tree',11 'workgroup.EditWorkgroup', 12 'workgroup.AddWorkgroup',13 'workgroup.AddGroupUser', 14 'workgroup.EditGroupUser', 15 'workgroup.UserTree' 16 ],17 refs:[{18 ref: 'editWorkgroup',19 selector: 'editworkgroup' 20 },{21 ref: 'workgroupTreeList',22 selector: 'workgroupTreeList' 23 },{24 ref: 'addWorkgroup',25 selector: 'addworkgroup' 26 },{27 ref: 'addGroupuser',28 selector: 'addgroupuser' 29 },{30 ref: 'editGroupUser',31 selector: 'editgroupuser' 32 }],33 init: function(){34 this.control({35 'workgroupTreeList':{36 itemexpand: this.itemexpand,37 beforeitemexpand:this.beforeitemexpand,38 itemcontextmenu : this.workcontextmenu,39 itemclick: this.itemclick40 },41 'workgroupList':{42 itemdblclick: this.itemclick43 },44 'editworkgroup button':{45 click:this.summitworkgroupinfo46 },47 'addworkgroup button': {48 click:this.addworkgroup49 },50 'addgroupuser button': {51 click: this.addgroupuser52 },53 'editgroupuser button':{54 click: this.editgroupuser 55 }56 });57 },58 workcontextmenu:function(view, rcd, item, idx, event) {59 event.preventDefault();60 event.stopEvent();61 var me=this;62 var editworkgroup=addworkgroup=addgroupuser=delgroupuser=false;63 for(var p=0; p<power.length; p++){64 switch(power[p]){65 case 'editworkgroup' : editworkgroup=true;break;66 case 'addworkgroup': addworkgroup=true;break;67 case 'addgroupuser': addgroupuser=true;break;68 case 'delgroupuser': delgroupuser=true;break;69 }70 }71 var editworkgroup_obj=addworkgroup_obj=addgroupuser_obj=delgroupuser_obj=null;72 if(editworkgroup){73 editworkgroup_obj = {74 text: '编辑',75 iconCls: 'icon-edit',76 handler: function(){77 this.up("menu").hide();78 if(rcd.get('u_isgroup')=='1'){79 me.editworkgroupform(rcd);80 }else{81 me.editgroupuserform(rcd);82 }83 }84 };85 }86 if(addworkgroup && (login_user.u_grade=='99' || login_user.u_grade=='100')){87 addworkgroup_obj={88 text: '添加工作组',89 iconCls: 'icon-user-add',90 handler: function(){91 this.up("menu").hide();92 me.addworkgroupform();93 }94 };95 }96 if(addgroupuser && rcd.get('u_isgroup')==1){97 addgroupuser_obj={98 text:'添加组员',99 iconCls: 'icon-user-add',100 handler: function(){101 this.up('menu').hide();102 me.addworkgroupuserform(rcd);103 }104 };105 }106 if(delgroupuser && rcd.get('u_isgroup')==0){107 delgroupuser_obj={108 text: '删除组员',109 iconCls: 'icon-user-del',110 handler: function(){111 this.up("menu").hide();112 Ext.Msg.show({ 113 title:'提示',114 closable: false, 115 msg:'确定要删除 '+rcd.parentNode.get('text')+' '+rcd.get('u_name')+' 组员信息吗?', 116 icon:Ext.MessageBox.QUESTION,117 buttons:Ext.Msg.OKCANCEL,118 fn: function(btn){119 if(btn=='ok'){120 deletegroupuser(rcd.get('u_id'));121 }122 return false;123 } 124 }); 125 } 126 }127 }128 var refresh = {129 text: '刷新',130 iconCls: 'refresh',131 handler: function(){132 this.up("menu").hide();133 me.getWorkgroupTreeTwoStore().reload();134 } 135 }136 var menu = new Ext.menu.Menu({137 float: true138 });139 rcd.raw.u_isgroup=='1' && menu.add(refresh);140 Ext.isEmpty(editworkgroup_obj) || menu.add(editworkgroup_obj);141 Ext.isEmpty(addworkgroup_obj) || menu.add(addworkgroup_obj);142 Ext.isEmpty(addgroupuser_obj) || menu.add(addgroupuser_obj);143 Ext.isEmpty(delgroupuser_obj) || menu.add(delgroupuser_obj);144 menu.showAt(event.getXY());145 },146 beforeitemexpand: function(rcd){147 if(rcd.get('u_isgroup')=='1'){148 this.getWorkgroupTreeTwoStore().setProxy({149 type:'ajax', 150 url: base_path + "index.php?c=usergroup&a=listgroupuser&groupid="+rcd.get('u_id'),151 reader:'json'152 });153 }154 },155 itemexpand: function(rcd){156 if(login_user.u_grade=='1'){157 this.getWorkgroupListStore().getProxy().extraParams={workgroup_id:login_user.u_targetgroup}; 158 }else{159 this.getWorkgroupListStore().getProxy().extraParams={workgroup_id:rcd.get('u_id')}; 160 }161 this.getWorkgroupListStore().load();162 },163 itemclick:function(view, rcd, item, index, event){164 event.preventDefault();165 event.stopEvent();166 view.toggleOnDblClick=false;167 if(rcd.get('u_isgroup')=='1'){168 this.getWorkgroupListStore().getProxy().extraParams={workgroup_id:rcd.get('u_id')};169 this.getWorkgroupListStore().load();170 }else{171 this.showUserTree(view, rcd, item, index, event);172 }173 },174 editworkgroupform: function(rcd){175 var win=Ext.widget('editworkgroup', {rcd:rcd});176 win.show();177 },178 summitworkgroupinfo: function(){179 var me=this;180 var editworkgrouppanel=this.getEditWorkgroup().items.getAt(0);181 if(editworkgrouppanel.getForm().isValid()){182 editworkgrouppanel.getForm().submit({183 url: base_path + 'index.php?c=usergroup&a=editgroup',184 method: 'post',185 timeout: 30,186 params: editworkgrouppanel.getForm().getValues(),187 success: function(form, action){188 Ext.Msg.alert('温馨提示', action.result.msg);189 //me.getEditWorkgroup().initialConfig.rcd.set('u_name', editworkgrouppanel.getForm().getValues().workgroup_name);190 me.getWorkgroupTreeTwoStore().setProxy({type: 'ajax',191 url: base_path + "index.php?c=usergroup&a=listworkgroup",//&type=checkbox192 reader: {193 type: 'json',194 root: ''195 }196 });197 me.getWorkgroupTreeTwoStore().load();198 me.getEditWorkgroup().close();199 },200 failure: function(form, action){201 Ext.Msg.alert('温馨提示', action.result.msg);202 }203 });204 }205 },206 editgroupuserform:function(rcd){207 var win=Ext.widget('editgroupuser', {rcd:rcd});208 win.show();209 },210 editgroupuser:function(){211 var me=this;212 var editworkgrouppanel=this.getEditGroupUser().items.getAt(0);213 if(editworkgrouppanel.form.isValid()){214 var formparams = editworkgrouppanel.getForm().getValues();215 editworkgrouppanel.getForm().submit({216 url: base_path + 'index.php?c=usergroup&a=editgroupuser',217 method: 'post',218 timeout: 30,219 params: formparams,220 success: function(form, action){221 Ext.Msg.alert('温馨提示', action.result.msg);222 me.getWorkgroupListStore().reload();223 me.getWorkgroupTreeTwoStore().reload();224 me.getEditGroupUser().close();225 },226 failure: function(form, action){227 Ext.Msg.alert('温馨提示', action.result.msg);228 }229 });230 }231 },232 addworkgroupform: function(){233 var win=Ext.widget('addworkgroup');234 win.show();235 },236 addworkgroup: function(){237 var me=this;238 var addworkgroupPanel=this.getAddWorkgroup().items.getAt(0);239 if(addworkgroupPanel.getForm().isValid()){240 addworkgroupPanel.getForm().submit({241 url: base_path+'index.php?c=usergroup&a=addworkgroup',242 method: 'post',243 timeout: 30,244 params: addworkgroupPanel.getForm().getValues,245 success: function(form, action){246 Ext.Msg.alert('温馨提示', action.result.msg);247 me.getAddWorkgroup().close();248 me.getWorkgroupTreeTwoStore().setProxy({type: 'ajax',249 url: base_path + "index.php?c=usergroup&a=listworkgroup",//&type=checkbox250 reader: {251 type: 'json',252 root: ''253 }254 });255 me.getWorkgroupTreeTwoStore().load();256 },257 failure: function(form, action){258 Ext.Msg.alert('温馨提示', action.result.msg); 259 }260 });261 }262 },263 addworkgroupuserform:function(rcd){264 var win=Ext.widget('addgroupuser', {rcd:rcd});265 win.show();266 },267 addgroupuser:function(){268 var me=this;269 var addgroupuserPanel=this.getAddGroupuser().items.getAt(0);270 if(addgroupuserPanel.getForm().isValid()){271 addgroupuserPanel.getForm().submit({272 url: base_path+'index.php?c=usergroup&a=addgroupuser',273 method: 'post',274 timeout: 30,275 params: addgroupuserPanel.getForm().getValues,276 success: function(form, action){277 Ext.Msg.alert('温馨提示', action.result.msg);278 me.getWorkgroupTreeTwoStore().reload();279 me.getAddGroupuser().close();280 },281 failure: function(form, action){282 Ext.Msg.alert('温馨提示', action.result.msg);283 }284 });285 }286 },287 showUserTree: function(view, rcd, item, index, event){288 var win=Ext.widget('usertree', {rcd:rcd});289 win.show();290 }...

Full Screen

Full Screen

index.js

Source:index.js Github

copy

Full Screen

...43 handleAddUser = ({ member_id: user_id }) => {44 const { addGroupUser, group } = this.props45 const variables = { id: group.id, user_id }46 const refetchQueries = this.getRefetchQueries()47 return addGroupUser({48 variables,49 refetchQueries,50 })51 }52 handleRemoveUser = ({ member_id: user_id }) => {53 const { removeGroupUser, group } = this.props54 const variables = { id: group.id, user_id }55 const refetchQueries = this.getRefetchQueries()56 return removeGroupUser({57 variables,58 refetchQueries,59 })60 }61 handleInviteUser = ({ email }) => {...

Full Screen

Full Screen

groupview.js

Source:groupview.js Github

copy

Full Screen

1angular.module('GroupView.controllers', [])2.controller('GroupViewCtrl', function($scope, $ionicModal, $rootScope, $ionicLoading, $ionicPlatform, $state, localStorageService, APIService) {3 $ionicPlatform.ready(function(){4 try{5 $scope.addUserlist = [];6 $scope.updateList = [];7 $scope.url_prefix1 = url_prefix_for_image;8 $scope.groupList = JSON.parse(localStorage.getItem("groupList"));9 $scope.usernumber = localStorageService.get('usernumber');10 console.log($scope.groupList);11 if($scope.groupList.admin_number==$scope.usernumber){12 $scope.shouldShowDelete = true;13 $scope.Admin = false;14 $scope.listCanSwipe = true;15 }else{16 $scope.shouldShowDelete = false;17 $scope.Admin = true;18 $scope.listCanSwipe = false;19 }20 21 $scope.deleteuser = function(userList){22 var index = $scope.groupList.users.indexOf(userList);23 console.log(index);24 $scope.groupList.users.splice(index,1);25 console.log($scope.groupList.users);26 }27 // var gorupID = $scope.groupList._id;28 // var usersLst = $scope.groupList.users;29 // console.log(usersLst);30 $scope.updateUserList = function(){31 console.log('done');32 APIService.setData({33 req_url: url_prefix + 'updateGroup',34 data: {id:$scope.groupList._id, users: $scope.groupList.users, user_number:$scope.usernumber}35 }).then(function(resp) {36 console.log(resp);37 if(resp.data) {38 console.log(resp.data);39 localStorage.setItem("userList", JSON.stringify(resp.data));40 $scope.groupList = resp.data;41 }42 },function(resp) {43 console.log('error',resp);44 });45 }46 $ionicModal.fromTemplateUrl('templates/addgroupuser.html', {47 scope: $scope,48 animation: 'slide-in-up'49 }).then(function(addgroupuser) {50 $scope.addgroupuser = addgroupuser;51 });52 $scope.openModaladdgroupuser = function() {53 $scope.updateList = angular.copy($scope.groupList.users);54 $scope.addgroupuser.show();55 56 };57 $scope.closeModaladdgroupuser = function(value) {58 console.log(value);59 if(value=="2"){60 $scope.adduser();61 }62 $scope.addgroupuser.hide();63 };64 65 $scope.addMember = function(adduser, isCheck){66 if(isCheck==true){67 $scope.updateList.push(adduser);68 }69 if(isCheck==false){70 $scope.updateList.pop(adduser);71 }72 73 console.log($scope.updateList);74 };75 $scope.usernumber = localStorageService.get('usernumber');76 77 // $rootScope.addList.push($scope.usernumber);78 79 $scope.adduser = function(){80 console.log("add", $scope.updateList);81 APIService.setData({82 req_url: url_prefix + 'updateGroup',83 data: {id:$scope.groupList._id, users: $scope.updateList, user_number:$scope.usernumber}84 }).then(function(resp) {85 console.log(resp);86 if(resp.data) {87 localStorage.setItem("userList", JSON.stringify(resp.data));88 $scope.groupList = resp.data;89 }90 },function(resp) {91 console.log('error',resp);92 });93 }94 95 }catch(err){96 console.log(err.message);97 }98 });...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1var stf = require('devicefarmer-stf-client');2client.addGroupUser('group_name', 'user_name', function(err, res) {3 if (err) {4 return console.log(err);5 }6 console.log(res);7});8var stf = require('devicefarmer-stf-client');9client.removeGroupUser('group_name', 'user_name', function(err, res) {10 if (err) {11 return console.log(err);12 }13 console.log(res);14});15var stf = require('devicefarmer-stf-client');16client.getDevices(function(err, res) {17 if (err) {18 return console.log(err);19 }20 console.log(res);21});22var stf = require('devicefarmer-stf-client');23client.getDevice('device_id', function(err, res) {24 if (err) {25 return console.log(err);26 }27 console.log(res);28});29var stf = require('devicefarmer-stf-client');30client.getDeviceBySerial('device_serial', function(err, res) {31 if (err) {32 return console.log(err);33 }34 console.log(res);35});36var stf = require('devicefarmer-stf-client');37client.getDeviceBySerial('device_serial', function(err, res) {38 if (err) {39 return console.log(err);40 }41 console.log(res);42});

Full Screen

Using AI Code Generation

copy

Full Screen

1var client = require('devicefarmer-stf-client');2stf.addGroupUser('groupname', 'username', function(err, result) {3 if (err) {4 console.log(err);5 } else {6 console.log(result);7 }8});9var client = require('devicefarmer-stf-client');10stf.removeGroupUser('groupname', 'username', function(err, result) {11 if (err) {12 console.log(err);13 } else {14 console.log(result);15 }16});17var client = require('devicefarmer-stf-client');18stf.getGroupUsers('groupname', function(err, result) {19 if (err) {20 console.log(err);21 } else {22 console.log(result);23 }24});25var client = require('devicefarmer-stf-client');26stf.addGroupDevice('groupname', 'deviceid', function(err, result) {27 if (err) {28 console.log(err);29 } else {30 console.log(result);31 }32});

Full Screen

Using AI Code Generation

copy

Full Screen

1var stf = require('devicefarmer-stf');2client.addGroupUser('Group1', 'user1');3var stf = require('devicefarmer-stf');4client.removeGroupUser('Group1', 'user1');5var stf = require('devicefarmer-stf');6client.getGroupDevices('Group1').then(function (devices) {7 console.log(devices);8});9var stf = require('devicefarmer-stf');10client.getGroupDevices('Group1').then(function (devices) {11 console.log(devices);12});13var stf = require('devicefarmer-stf');14client.addGroupDevice('Group1', '1234567890abcdef').then(function (devices) {15 console.log(devices);16});17var stf = require('devicefarmer-stf');18client.removeGroupDevice('Group1', '1234567890abcdef').then(function (devices) {19 console.log(devices);20});21var stf = require('devicefarmer-stf');22client.getGroupApps('Group1').then(function (apps) {23 console.log(apps);24});25var stf = require('devicefarmer-stf');

Full Screen

Using AI Code Generation

copy

Full Screen

1var stf = require('devicefarmer-stf');2client.addGroupUser('group1','user1',function(err, result){3 if (err) {4 console.log(err);5 } else {6 console.log(result);7 }8});9{ success: true }10var stf = require('devicefarmer-stf');11client.removeGroupUser('group1','user1',function(err, result){12 if (err) {13 console.log(err);14 } else {15 console.log(result);16 }17});18{ success: true }19var stf = require('devicefarmer-stf');20client.getGroups(function(err, result){21 if (err) {22 console.log(err);23 } else {24 console.log(result);25 }26});27var stf = require('devicefarmer-stf');28client.getGroupUsers('group1',function(err, result){29 if (err) {30 console.log(err);31 } else {32 console.log(result);33 }34});

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 devicefarmer-stf automation tests on LambdaTest cloud grid

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

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful