This is an automated email from the ASF dual-hosted git repository. cwylie pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/incubator-druid.git
The following commit(s) were added to refs/heads/master by this push: new b0271b4 Saving author to local storage in snitch dialog (#7307) b0271b4 is described below commit b0271b4f4db6ae031d285918752822ee46319840 Author: Qi Shu <shuqi...@gmail.com> AuthorDate: Thu Mar 21 03:01:10 2019 -0700 Saving author to local storage in snitch dialog (#7307) * Saving author to local storage * Capitalized const --- web-console/src/dialogs/snitch-dialog.tsx | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/web-console/src/dialogs/snitch-dialog.tsx b/web-console/src/dialogs/snitch-dialog.tsx index c01913e..46cb1f0 100644 --- a/web-console/src/dialogs/snitch-dialog.tsx +++ b/web-console/src/dialogs/snitch-dialog.tsx @@ -27,6 +27,9 @@ import { import * as React from 'react'; import { FormGroup, IconNames } from '../components/filler'; +import { localStorageGet, localStorageSet } from "../utils"; + +const druidEditingAuthor = "DRUID_EDITING_AUTHOR"; export interface SnitchDialogProps extends IDialogProps { onSave: (author: string, comment: string) => void; @@ -53,6 +56,10 @@ export class SnitchDialog extends React.Component<SnitchDialogProps, SnitchDialo }; } + componentDidMount(): void { + this.getDefaultAuthor(); + } + save = () => { const { onSave, onClose } = this.props; const { author, comment } = this.state; @@ -61,6 +68,15 @@ export class SnitchDialog extends React.Component<SnitchDialogProps, SnitchDialo if (onClose) onClose(); } + getDefaultAuthor() { + const author: string | null = localStorageGet(druidEditingAuthor); + if (author) { + this.setState({ + author + }); + } + } + changeAuthor(newAuthor: string) { const { author, comment } = this.state; @@ -68,6 +84,7 @@ export class SnitchDialog extends React.Component<SnitchDialogProps, SnitchDialo author: newAuthor, saveDisabled: !newAuthor || !comment }); + localStorageSet(druidEditingAuthor, newAuthor); } changeComment(newComment: string) { --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@druid.apache.org For additional commands, e-mail: commits-h...@druid.apache.org