Get current auth config
(&self, cx: &App)
| 395 | self.api_key_location = if config.api_key_in_header { |
| 396 | ApiKeyLocation::Header |
| 397 | } else { |
| 398 | ApiKeyLocation::QueryParam |
| 399 | }; |
| 400 | self.api_key_location_select.update(cx, |state, cx| { |
| 401 | state.set_selected_value(&self.api_key_location, window, cx); |
| 402 | }); |
| 403 | |
| 404 | self.ensure_inputs(window, cx); |
| 405 | if let Some(input) = &self.username_input { |
| 406 | let value = config.username.clone(); |
| 407 | input.update(cx, |state, cx| state.set_value(value, window, cx)); |
| 408 | } |
| 409 | if let Some(input) = &self.password_input { |
| 410 | let value = config.password.clone(); |
| 411 | input.update(cx, |state, cx| state.set_value(value, window, cx)); |
| 412 | } |
| 413 | if let Some(input) = &self.token_input { |
| 414 | let value = config.token.clone(); |
| 415 | input.update(cx, |state, cx| state.set_value(value, window, cx)); |
| 416 | } |
| 417 | if let Some(input) = &self.api_key_name_input { |
| 418 | let value = config.api_key_name.clone(); |
| 419 | input.update(cx, |state, cx| state.set_value(value, window, cx)); |
| 420 | } |
| 421 | if let Some(input) = &self.api_key_value_input { |
| 422 | let value = config.api_key_value.clone(); |
| 423 | input.update(cx, |state, cx| state.set_value(value, window, cx)); |
| 424 | } |
| 425 | cx.notify(); |
| 426 | } |
| 427 | } |
| 428 | |
| 429 | impl Focusable for AuthEditor { |
| 430 | fn focus_handle(&self, _cx: &App) -> FocusHandle { |