@@ -115,19 +115,38 @@ export class CloudClientsComponent implements OnInit, OnDestroy {
115115 mutation : gql `
116116 mutation CreateCloudClient($input: CloudClientInput!){
117117 createCloudClient(input: $input) {
118- id
119- name
118+ id
119+ name
120+ type
121+ serverNamePrefix
122+ visible
123+ openStackProviderConfiguration {
124+ applicationId
125+ applicationSecret
126+ computeEndpoint
127+ placementEndpoint
128+ imageEndpoint
129+ networkEndpoint
130+ identityEndpoint
131+ addressProvider
132+ addressProviderUUID
133+ }
134+ webProviderConfiguration {
135+ url
136+ authToken
137+ }
120138 }
121139 }
122140 ` ,
123141 variables : { input} ,
124142 } ) . pipe (
125- takeUntil ( this . _destroy$ )
143+ takeUntil ( this . _destroy$ ) ,
144+ map ( ( { data} ) => ( { cloudClient : data . createCloudClient } ) ) ,
126145 )
127146 } ) ) . subscribe ( {
128- next : ( ) => {
147+ next : ( { cloudClient } ) => {
129148 this . _notifierService . notify ( 'success' , 'Cloud provider created' ) ;
130- this . _refresh$ . next ( ) ;
149+ this . _cloudClients . push ( cloudClient ) ;
131150 dialogRef . close ( ) ;
132151 } ,
133152 error : ( error ) => {
@@ -158,7 +177,7 @@ export class CloudClientsComponent implements OnInit, OnDestroy {
158177 } ) ) . subscribe ( {
159178 next : ( ) => {
160179 this . _notifierService . notify ( 'success' , 'Successfully deleted cloud provider' ) ;
161- this . _refresh$ . next ( ) ;
180+ this . _cloudClients = this . _cloudClients . filter ( aCloudClient => aCloudClient . id !== cloudClient . id ) ;
162181 } ,
163182 error : ( error ) => {
164183 this . _notifierService . notify ( 'error' , error ) ;
@@ -179,17 +198,37 @@ export class CloudClientsComponent implements OnInit, OnDestroy {
179198 mutation UpdateCloudClient($id: Int!,$input: CloudClientInput!){
180199 updateCloudClient(id: $id, input: $input) {
181200 id
201+ name
202+ type
203+ serverNamePrefix
204+ visible
205+ openStackProviderConfiguration {
206+ applicationId
207+ applicationSecret
208+ computeEndpoint
209+ placementEndpoint
210+ imageEndpoint
211+ networkEndpoint
212+ identityEndpoint
213+ addressProvider
214+ addressProviderUUID
215+ }
216+ webProviderConfiguration {
217+ url
218+ authToken
219+ }
182220 }
183221 }
184222 ` ,
185223 variables : { id : cloudClient . id , input} ,
186224 } ) . pipe (
187- takeUntil ( this . _destroy$ )
225+ takeUntil ( this . _destroy$ ) ,
226+ map ( ( { data} ) => ( { cloudClient : data . updateCloudClient } ) ) ,
188227 )
189228 } ) ) . subscribe ( {
190- next : ( ) => {
229+ next : ( { cloudClient} ) => {
230+ this . _cloudClients = this . _cloudClients . map ( aCloudClient => cloudClient . id === aCloudClient . id ? cloudClient : aCloudClient ) ;
191231 this . _notifierService . notify ( 'success' , 'Cloud provider saved' ) ;
192- this . _refresh$ . next ( ) ;
193232 dialogRef . close ( ) ;
194233 } ,
195234 error : ( error ) => {
0 commit comments