import "./create-service-account-dialog.scss"; import * as React from "react"; import { observable } from "mobx"; import { observer } from "mobx-react"; import { t, Trans } from "@lingui/macro"; import { _i18n } from "../../i18n"; import { Dialog, DialogProps } from "../dialog"; import { Wizard, WizardStep } from "../wizard"; import { SubTitle } from "../layout/sub-title"; import { serviceAccountsStore } from "./service-accounts.store"; import { Input } from "../input"; import { systemName } from "../input/input.validators"; import { NamespaceSelect } from "../+namespaces/namespace-select"; import { Notifications } from "../notifications"; import { showDetails } from "../../navigation"; interface Props extends Partial { } @observer export class CreateServiceAccountDialog extends React.Component { @observable static isOpen = false; @observable name = "" @observable namespace = "default" static open() { CreateServiceAccountDialog.isOpen = true; } static close() { CreateServiceAccountDialog.isOpen = false; } close = () => { CreateServiceAccountDialog.close(); } createAccount = async () => { const { name, namespace } = this; try { const serviceAccount = await serviceAccountsStore.create({ namespace, name }); this.name = ""; showDetails(serviceAccount.selfLink); this.close(); } catch (err) { Notifications.error(err); } } render() { const { ...dialogProps } = this.props; const { name, namespace } = this; const header =
Create Service Account
return ( Create} next={this.createAccount}> Account Name}/> this.name = v.toLowerCase()} /> Namespace}/> this.namespace = value} /> ) } }