1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- import {t} from 'sentry/locale';
- import {Relay} from 'sentry/types';
- import ModalManager from './modalManager';
- type Props = {
- relay: Relay;
- } & ModalManager['props'];
- type State = ModalManager['state'];
- class Edit extends ModalManager<Props, State> {
- getDefaultState() {
- return {
- ...super.getDefaultState(),
- values: {
- name: this.props.relay.name,
- publicKey: this.props.relay.publicKey,
- description: this.props.relay.description || '',
- },
- disables: {publicKey: true},
- };
- }
- getTitle() {
- return t('Edit Key');
- }
- getData() {
- const {savedRelays} = this.props;
- const updatedRelay = this.state.values;
- const trustedRelays = savedRelays.map(relay => {
- if (relay.publicKey === updatedRelay.publicKey) {
- return updatedRelay;
- }
- return relay;
- });
- return {trustedRelays};
- }
- }
- export default Edit;
|