|
723 | 723 | isBoolean:true, |
724 | 724 | isChecked:false |
725 | 725 |
|
726 | | - } |
| 726 | + }, |
| 727 | + |
| 728 | + aclid:{ |
| 729 | + label:'ACL', |
| 730 | + select:function(args){ |
| 731 | + $.ajax({ |
| 732 | + url: createURL('listNetworkACLLists'), |
| 733 | + dataType: 'json', |
| 734 | + async: true, |
| 735 | + success: function(json) { |
| 736 | + var objs = json.listnetworkacllistsresponse.networkacllist; |
| 737 | + var items = []; |
| 738 | + $(objs).each(function() { |
| 739 | + if(this.name == "default_deny") |
| 740 | + items.unshift({id:this.id,description:this.name}); |
| 741 | + else |
| 742 | + items.push({id: this.id, description: this.name}); |
| 743 | + |
| 744 | + |
| 745 | + }); |
| 746 | + args.response.success({data: items}); |
| 747 | + } |
| 748 | + }); |
727 | 749 |
|
728 | | - |
| 750 | + } |
| 751 | + } |
729 | 752 | } |
730 | 753 | }, |
731 | 754 | action: function(args) { |
|
745 | 768 | ipaddress: args.data.ipaddress, |
746 | 769 | gateway: args.data.gateway, |
747 | 770 | netmask: args.data.netmask, |
748 | | - vlan: args.data.vlan |
| 771 | + vlan: args.data.vlan, |
| 772 | + aclid:args.data.aclid |
| 773 | + |
749 | 774 | }, |
750 | 775 | success: function(json) { |
751 | 776 | var jid = json.createprivategatewayresponse.jobid; |
|
834 | 859 | isBoolean:true, |
835 | 860 | isChecked:false |
836 | 861 |
|
837 | | - } |
| 862 | + }, |
838 | 863 |
|
839 | | - } |
| 864 | + aclid:{ |
| 865 | + label:'ACL', |
| 866 | + select:function(args){ |
| 867 | + $.ajax({ |
| 868 | + url: createURL('listNetworkACLLists'), |
| 869 | + dataType: 'json', |
| 870 | + async: true, |
| 871 | + success: function(json) { |
| 872 | + var objs = json.listnetworkacllistsresponse.networkacllist; |
| 873 | + var items = []; |
| 874 | + $(objs).each(function() { |
| 875 | + if(this.name == "default_deny") |
| 876 | + items.unshift({id:this.id,description:this.name}); |
| 877 | + else |
| 878 | + items.push({id: this.id, description: this.name}); |
| 879 | + |
| 880 | + |
| 881 | + }); |
| 882 | + args.response.success({data: items}); |
| 883 | + } |
| 884 | + }); |
840 | 885 |
|
| 886 | + } |
| 887 | + } |
841 | 888 |
|
| 889 | + } |
842 | 890 |
|
843 | 891 | }, |
844 | 892 | action:function(args){ |
|
851 | 899 | array1.push("&sourcenatsupported=false"); |
852 | 900 |
|
853 | 901 |
|
854 | | - $.ajax({ |
| 902 | + $.ajax({ |
855 | 903 | url: createURL('createPrivateGateway'+ array1.join("")), |
856 | 904 | data: { |
857 | | - physicalnetworkid: args.data.physicalnetworkid, |
| 905 | + physicalnetworkid: args.data.physicalnetworkid, |
858 | 906 | vpcid: args.context.vpc[0].id, |
859 | 907 | ipaddress: args.data.ipaddress, |
860 | 908 | gateway: args.data.gateway, |
861 | 909 | netmask: args.data.netmask, |
862 | | - vlan: args.data.vlan |
| 910 | + vlan: args.data.vlan, |
| 911 | + aclid:args.data.aclid |
| 912 | + |
863 | 913 | }, |
864 | 914 | success: function(json) { |
865 | 915 | var jid = json.createprivategatewayresponse.jobid; |
|
933 | 983 | notification: { |
934 | 984 | poll: pollAsyncJobResult |
935 | 985 | } |
| 986 | + }, |
| 987 | + |
| 988 | + replaceACL:{ |
| 989 | + label:'Replace ACL', |
| 990 | + createForm:{ |
| 991 | + title:'Replace ACL', |
| 992 | + label:'Replace ACL', |
| 993 | + fields:{ |
| 994 | + aclid:{ |
| 995 | + label:'ACL', |
| 996 | + select:function(args){ |
| 997 | + $.ajax({ |
| 998 | + url: createURL('listNetworkACLLists'), |
| 999 | + dataType: 'json', |
| 1000 | + async: true, |
| 1001 | + success: function(json) { |
| 1002 | + var objs = json.listnetworkacllistsresponse.networkacllist; |
| 1003 | + var items = []; |
| 1004 | + $(objs).each(function() { |
| 1005 | + |
| 1006 | + items.push({id: this.id, description: this.name}); |
| 1007 | + }); |
| 1008 | + args.response.success({data: items}); |
| 1009 | + } |
| 1010 | + }); |
| 1011 | + } |
936 | 1012 | } |
| 1013 | + } |
| 1014 | + }, |
| 1015 | + |
| 1016 | + action: function(args) { |
| 1017 | + $.ajax({ |
| 1018 | + url: createURL("replaceNetworkACLList&gatewayid=" + args.context.vpcGateways[0].id + "&aclid=" + args.data.aclid ), |
| 1019 | + dataType: "json", |
| 1020 | + success: function(json) { |
| 1021 | + var jid = json.replacenetworkacllistresponse.jobid; |
| 1022 | + args.response.success( |
| 1023 | + |
| 1024 | + {_custom: |
| 1025 | + { |
| 1026 | + jobId: jid, |
| 1027 | + getUpdatedItem: function(json) { |
| 1028 | + var item = json.queryasyncjobresultresponse.jobresult.aclid; |
| 1029 | + return {data:item}; |
| 1030 | + } |
| 1031 | + } |
| 1032 | + } |
| 1033 | + |
| 1034 | + ) |
| 1035 | + }, |
| 1036 | + |
| 1037 | + error:function(json){ |
| 1038 | + |
| 1039 | + args.response.error(parseXMLHttpResponse(json)); |
| 1040 | + } |
| 1041 | + }); |
| 1042 | + }, |
| 1043 | + |
| 1044 | + notification: { |
| 1045 | + poll: pollAsyncJobResult |
| 1046 | + }, |
| 1047 | + |
| 1048 | + messages: { |
| 1049 | + confirm: function(args) { |
| 1050 | + return 'Do you want to replace the ACL with a new one ?'; |
| 1051 | + }, |
| 1052 | + notification: function(args) { |
| 1053 | + return 'ACL replaced'; |
| 1054 | + } |
| 1055 | + } |
| 1056 | + } |
937 | 1057 | }, |
938 | 1058 | tabs: { |
939 | 1059 | details: { |
|
975 | 1095 | var allowedActions = []; |
976 | 1096 | if(isAdmin()) { |
977 | 1097 | allowedActions.push("remove"); |
| 1098 | + allowedActions.push("replaceACL"); |
| 1099 | + |
978 | 1100 | } |
979 | 1101 | return allowedActions; |
980 | 1102 | } |
|
0 commit comments