|
1336 | 1336 | }); |
1337 | 1337 | } |
1338 | 1338 | } |
1339 | | - |
1340 | | - |
1341 | 1339 | } |
1342 | 1340 | }, |
1343 | 1341 |
|
|
1378 | 1376 | notification: { |
1379 | 1377 | poll: pollAsyncJobResult |
1380 | 1378 | } |
1381 | | - |
1382 | 1379 | }, |
1383 | | - |
| 1380 | + |
| 1381 | + assignVmToAnotherAccount: { |
| 1382 | + label: 'Assign Instance to Another Account', |
| 1383 | + createForm: { |
| 1384 | + title: 'Assign Instance to Another Account', |
| 1385 | + fields: { |
| 1386 | + domainid: { |
| 1387 | + label: 'label.domain', |
| 1388 | + validation: { |
| 1389 | + required: true |
| 1390 | + }, |
| 1391 | + select: function(args) { |
| 1392 | + $.ajax({ |
| 1393 | + url: createURL('listDomains'), |
| 1394 | + data: { |
| 1395 | + listAll: true, |
| 1396 | + details: 'min' |
| 1397 | + }, |
| 1398 | + success: function(json) { |
| 1399 | + var array1 = []; |
| 1400 | + var domains = json.listdomainsresponse.domain; |
| 1401 | + if (domains != null && domains.length > 0) { |
| 1402 | + for (var i = 0; i < domains.length; i++) { |
| 1403 | + array1.push({ |
| 1404 | + id: domains[i].id, |
| 1405 | + description: domains[i].path |
| 1406 | + }); |
| 1407 | + } |
| 1408 | + } |
| 1409 | + args.response.success({ |
| 1410 | + data: array1 |
| 1411 | + }); |
| 1412 | + } |
| 1413 | + }); |
| 1414 | + } |
| 1415 | + }, |
| 1416 | + account: { |
| 1417 | + label: 'label.account', |
| 1418 | + validation: { |
| 1419 | + required: true |
| 1420 | + } |
| 1421 | + } |
| 1422 | + } |
| 1423 | + }, |
| 1424 | + action: function(args) { |
| 1425 | + $.ajax({ |
| 1426 | + url: createURL('assignVirtualMachine&virtualmachine'), |
| 1427 | + data: { |
| 1428 | + virtualmachineid: args.context.instances[0].id, |
| 1429 | + domainid: args.data.domainid, |
| 1430 | + account: args.data.account |
| 1431 | + }, |
| 1432 | + success: function(json) { |
| 1433 | + var item = json.virtualmachine.virtualmachine; |
| 1434 | + args.response.success({ |
| 1435 | + data: item |
| 1436 | + }); |
| 1437 | + } |
| 1438 | + }); |
| 1439 | + }, |
| 1440 | + messages: { |
| 1441 | + notification: function(args) { |
| 1442 | + return 'Assign Instance to Another Account'; |
| 1443 | + } |
| 1444 | + }, |
| 1445 | + notification: { |
| 1446 | + poll: function(args) { |
| 1447 | + args.complete(); |
| 1448 | + } |
| 1449 | + } |
| 1450 | + }, |
| 1451 | + |
1384 | 1452 | viewConsole: { |
1385 | 1453 | label: 'label.view.console', |
1386 | 1454 | action: { |
|
1936 | 2004 | if (jsonObj.hypervisor == "BareMetal") { |
1937 | 2005 | allowedActions.push("createTemplate"); |
1938 | 2006 | } |
| 2007 | + |
| 2008 | + if (isAdmin() || isDomainAdmin()) { |
| 2009 | + allowedActions.push("assignVmToAnotherAccount"); |
| 2010 | + } |
| 2011 | + |
1939 | 2012 | } else if (jsonObj.state == 'Starting') { |
1940 | 2013 | // allowedActions.push("stop"); |
1941 | 2014 | } else if (jsonObj.state == 'Error') { |
|
0 commit comments