jellyfish-aws 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b23f9f7d13b09a7359d5f618bb267f6ac9767158
|
4
|
+
data.tar.gz: 96fac169b1c7309f703ff0372e2135a370a74e43
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9f6a2020064df9343fc79b02616516754da244c1ed0d4a559d61d0336c06821fe8d360b1397749208516d783bc4bdb52b0bdff20cedb6b11728152dd244dfd9a
|
7
|
+
data.tar.gz: 873ae46fec505df50beb93a32a0b27868a0f6828e4a77d9ffe6ca883db49918d1f3feb1b257b7314d215cf0ddcc7a5ed414062b0a9a04c382fb3bdf546246524
|
@@ -0,0 +1,115 @@
|
|
1
|
+
(function() {
|
2
|
+
'use strict';
|
3
|
+
|
4
|
+
angular.module('app.components')
|
5
|
+
.run(initFields);
|
6
|
+
|
7
|
+
/** @ngInject */
|
8
|
+
function initFields(Forms) {
|
9
|
+
Forms.fields('aws_regions', {
|
10
|
+
type: 'select',
|
11
|
+
templateOptions: {
|
12
|
+
label: 'Region',
|
13
|
+
options: [
|
14
|
+
{label: 'N. Virginia (US-East-1)', value: 'us-east-1', group: 'US'},
|
15
|
+
{label: 'N. California (US-West-1)', value: 'us-west-1', group: 'US'},
|
16
|
+
{label: 'Oregon (US-West-2)', value: 'us-west-2', group: 'US'},
|
17
|
+
{label: 'Ireland (EU-West-1)', value: 'eu-west-1', group: 'Europe'},
|
18
|
+
{label: 'Frankfurt (EU-Central-1)', value: 'eu-central-1', group: 'Europe'},
|
19
|
+
{label: 'Singapore (AP-Southeast-1)', value: 'ap-southeast-1', group: 'Asia Pacific'},
|
20
|
+
{label: 'Sydney (AP-Southeast-2)', value: 'ap-southeast-2', group: 'Asia Pacific'},
|
21
|
+
{label: 'Tokyo (AP-Northeast-1)', value: 'ap-northeast-1', group: 'Asia Pacific'},
|
22
|
+
{label: 'Sãn Paulo (SA-East-1)', value: 'sa-east-1', group: 'South America'}
|
23
|
+
]
|
24
|
+
}
|
25
|
+
});
|
26
|
+
|
27
|
+
Forms.fields('aws_ec2_images', {
|
28
|
+
type: 'async_select',
|
29
|
+
templateOptions: {
|
30
|
+
label: 'System Image',
|
31
|
+
options: []
|
32
|
+
},
|
33
|
+
data: {
|
34
|
+
action: 'ec2Images'
|
35
|
+
},
|
36
|
+
controller: AwsDataController
|
37
|
+
});
|
38
|
+
|
39
|
+
Forms.fields('aws_ec2_flavors', {
|
40
|
+
type: 'async_select',
|
41
|
+
templateOptions: {
|
42
|
+
label: 'Instance Type',
|
43
|
+
options: []
|
44
|
+
},
|
45
|
+
data: {
|
46
|
+
action: 'ec2Flavors'
|
47
|
+
},
|
48
|
+
controller: AwsDataController
|
49
|
+
});
|
50
|
+
|
51
|
+
Forms.fields('aws_subnets', {
|
52
|
+
type: 'async_select',
|
53
|
+
templateOptions: {
|
54
|
+
label: 'Subnet',
|
55
|
+
options: []
|
56
|
+
},
|
57
|
+
data: {
|
58
|
+
action: 'subnets'
|
59
|
+
},
|
60
|
+
controller: AwsDataController
|
61
|
+
});
|
62
|
+
|
63
|
+
Forms.fields('aws_zones', {
|
64
|
+
type: 'async_select',
|
65
|
+
templateOptions: {
|
66
|
+
label: 'Availability Zone',
|
67
|
+
options: []
|
68
|
+
},
|
69
|
+
data: {
|
70
|
+
action: 'zones'
|
71
|
+
},
|
72
|
+
controller: AwsDataController
|
73
|
+
});
|
74
|
+
|
75
|
+
/** @ngInject */
|
76
|
+
function AwsDataController($scope, AwsData, Toasts) {
|
77
|
+
var provider = $scope.formState.provider;
|
78
|
+
var action = $scope.options.data.action;
|
79
|
+
|
80
|
+
// Cannot do anything without a provider
|
81
|
+
if (angular.isUndefined(provider)) {
|
82
|
+
Toasts.warning('No provider set in form state', $scope.options.label);
|
83
|
+
return;
|
84
|
+
}
|
85
|
+
|
86
|
+
if (!action) {
|
87
|
+
Toasts.warning('No action set in field data', $scope.options.label);
|
88
|
+
return;
|
89
|
+
}
|
90
|
+
|
91
|
+
$scope.to.loading = AwsData[action](provider.id).then(handleResults, handleError);
|
92
|
+
|
93
|
+
function handleResults(data) {
|
94
|
+
$scope.to.options = data;
|
95
|
+
return data;
|
96
|
+
}
|
97
|
+
|
98
|
+
|
99
|
+
function handleError(response) {
|
100
|
+
var error = response.data;
|
101
|
+
|
102
|
+
if (!error.error) {
|
103
|
+
error = {
|
104
|
+
type: 'Server Error',
|
105
|
+
error: 'An unknown server error has occurred.'
|
106
|
+
};
|
107
|
+
}
|
108
|
+
|
109
|
+
Toasts.error(error.error, [$scope.to.label, error.type].join('::'));
|
110
|
+
|
111
|
+
return response;
|
112
|
+
}
|
113
|
+
}
|
114
|
+
}
|
115
|
+
})();
|
@@ -0,0 +1,35 @@
|
|
1
|
+
(function() {
|
2
|
+
'use strict';
|
3
|
+
|
4
|
+
angular.module('app.resources')
|
5
|
+
.factory('AwsData', AwsDataFactory);
|
6
|
+
|
7
|
+
/** @ngInject */
|
8
|
+
function AwsDataFactory($resource) {
|
9
|
+
var base = '/api/v1/aws/providers/:id/:action';
|
10
|
+
var AwsData = $resource(base, {action: '@action', id: '@id'});
|
11
|
+
|
12
|
+
AwsData.ec2Flavors = ec2Flavors;
|
13
|
+
AwsData.ec2Images = ec2Images;
|
14
|
+
AwsData.subnets = subnets;
|
15
|
+
AwsData.zones = zones;
|
16
|
+
|
17
|
+
return AwsData;
|
18
|
+
|
19
|
+
function ec2Flavors(id) {
|
20
|
+
return AwsData.query({id: id, action: 'ec2_flavors'}).$promise;
|
21
|
+
}
|
22
|
+
|
23
|
+
function ec2Images(id) {
|
24
|
+
return AwsData.query({id: id, action: 'ec2_images'}).$promise;
|
25
|
+
}
|
26
|
+
|
27
|
+
function subnets(id) {
|
28
|
+
return AwsData.query({id: id, action: 'subnets'}).$promise;
|
29
|
+
}
|
30
|
+
|
31
|
+
function zones(id) {
|
32
|
+
return AwsData.query({id: id, action: 'availability_zones'}).$promise;
|
33
|
+
}
|
34
|
+
}
|
35
|
+
})();
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jellyfish-aws
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Stack
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-09-
|
11
|
+
date: 2015-09-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -131,6 +131,8 @@ files:
|
|
131
131
|
- lib/jellyfish_aws/engine.rb
|
132
132
|
- lib/jellyfish_aws/version.rb
|
133
133
|
- lib/tasks/jellyfish_aws_tasks.rake
|
134
|
+
- public/extensions/aws/components/forms/fields.config.js
|
135
|
+
- public/extensions/aws/resources/aws-data.factory.js
|
134
136
|
- spec/rails_helper.rb
|
135
137
|
- spec/spec_helper.rb
|
136
138
|
- spec/test_app/README.rdoc
|