@@ -16,7 +16,7 @@ export default class AppDeployStore extends Store {
16
16
cluster : { } ,
17
17
env : { }
18
18
} ;
19
- @observable Name = '' ;
19
+ @observable name = '' ;
20
20
@observable isKubernetes = false ;
21
21
@observable paramsData = '' ;
22
22
@observable configBasics = [ ] ;
@@ -58,7 +58,7 @@ export default class AppDeployStore extends Store {
58
58
59
59
@action
60
60
changeName = event => {
61
- this . Name = event . target . value ;
61
+ this . name = event . target . value ;
62
62
} ;
63
63
64
64
@action
@@ -87,14 +87,8 @@ export default class AppDeployStore extends Store {
87
87
let conf = null ;
88
88
89
89
if ( this . isKubernetes ) {
90
- //this.checkResult = 'ok';
91
- let yamlObj = unflattenObject ( this . yamlObj ) ;
92
- /*this.yamlConfig.map(config => {
93
- if (typeof config.value === 'string' && !config.value) {
94
- this.checkResult = config.name;
95
- }
96
- });*/
97
- yamlObj . Name = this . Name ;
90
+ const yamlObj = unflattenObject ( this . yamlObj ) ;
91
+ yamlObj . name = this . name ;
98
92
conf = yaml . safeDump ( yamlObj ) ;
99
93
} else {
100
94
this . getConfigData ( ) ;
@@ -165,35 +159,26 @@ export default class AppDeployStore extends Store {
165
159
this . configData = { cluster, env } ;
166
160
} ;
167
161
168
- changeConfigData = ( item , root , parent ) => {
169
- let location = '{{.' ;
170
- if ( parent ) {
171
- location += root + '.' + parent + '.' + item . key + '}}' ;
172
- } else {
173
- location += root + '.' + item . key + '}}' ;
174
- }
175
- if ( item . type === 'integer' ) item . default = parseInt ( item . default ) ;
176
- this . paramsData = this . paramsData . replace ( location , item . default ) ;
177
- } ;
178
-
179
162
@action
180
- async fetchVersions ( params = { } , flag ) {
181
- //this.isLoading = true;
163
+ fetchVersions = async ( params = { } , flag ) => {
182
164
const result = await this . request . get ( 'app_versions' , params ) ;
183
165
this . versions = get ( result , 'app_version_set' , [ ] ) ;
184
166
this . versionId = get ( this . versions [ 0 ] , 'version_id' ) ;
185
- //if (!flag) this.isLoading = false;
186
- if ( flag ) await this . fetchFiles ( get ( this . versions [ 0 ] , 'version_id' ) ) ;
187
- }
167
+ if ( flag ) {
168
+ await this . fetchFiles ( get ( this . versions [ 0 ] , 'version_id' ) ) ;
169
+ }
170
+ } ;
188
171
189
172
@action
190
173
fetchRuntimes = async ( params = { } ) => {
191
174
this . isLoading = true ;
192
175
const result = await this . request . get ( 'runtimes' , params ) ;
193
176
this . runtimes = get ( result , 'runtime_set' , [ ] ) ;
194
- if ( this . runtimes . length && this . runtimes [ 0 ] ) {
177
+ if ( this . runtimes . length > 0 ) {
195
178
this . runtimeId = this . runtimes [ 0 ] . runtime_id ;
196
- if ( ! this . isKubernetes ) await this . fetchSubnets ( this . runtimes [ 0 ] . runtime_id ) ;
179
+ if ( ! this . isKubernetes ) {
180
+ await this . fetchSubnets ( this . runtimeId ) ;
181
+ }
197
182
} else {
198
183
this . info ( 'Not find Runtime data!' ) ;
199
184
}
@@ -204,12 +189,7 @@ export default class AppDeployStore extends Store {
204
189
async fetchSubnets ( runtimeId ) {
205
190
const result = await this . request . get ( `clusters/subnets` , { runtime_id : runtimeId } ) ;
206
191
this . subnets = get ( result , 'subnet_set' , [ ] ) ;
207
- let arrSubnets = this . subnets . toJSON ( ) ;
208
- if ( arrSubnets [ 0 ] ) {
209
- this . subnetId = arrSubnets [ 0 ] . subnet_id ;
210
- } else {
211
- this . subnetId = '' ;
212
- }
192
+ this . subnetId = this . subnets [ 0 ] ? this . subnets [ 0 ] . subnet_id : '' ;
213
193
}
214
194
215
195
@action
0 commit comments