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A,UAAU,wBAAf,UACE,kBAAMC,KAAK,qBAAqBC,SAAUnB,KAAKoB,OAA/C,WACE,iBAAKH,UAAU,UAAf,iBACE,kBAAOA,UAAU,wBAAjB,oBACA,SAAC1C,EAAD,CACE8C,KAAK,OACLJ,UAAU,yBACVf,MAAOR,EAAOgB,MACdY,SAAUtB,KAAKuB,oBAGnB,iBAAKN,UAAU,qBAAf,WACE,SAAC,EAAAO,OAAD,CAAQH,KAAK,SAASI,UAAW/B,EAAOgC,UAAYhC,EAAOiC,WAA3D,mBAGA,SAAC,EAAAH,OAAD,CAAQI,QAAQ,cAAcC,QAAS7B,KAAK8B,SAAUL,UAAW/B,EAAOqC,UAAxE,kCAYhB,QAAejD,EAAUa","sources":["webpack://grafana/./public/app/features/folders/FolderSettingsPage.tsx"],"sourcesContent":["import React, { PureComponent } from 'react';\nimport { connect, ConnectedProps } from 'react-redux';\n\nimport { Button, LegacyForms } from '@grafana/ui';\nconst { Input } = LegacyForms;\nimport appEvents from 'app/core/app_events';\nimport Page from 'app/core/components/Page/Page';\nimport { GrafanaRouteComponentProps } from 'app/core/navigation/types';\nimport { getNavModel } from 'app/core/selectors/navModel';\nimport { StoreState } from 'app/types';\n\nimport { ShowConfirmModalEvent } from '../../types/events';\n\nimport { deleteFolder, getFolderByUid, saveFolder } from './state/actions';\nimport { getLoadingNav } from './state/navModel';\nimport { setFolderTitle } from './state/reducers';\n\nexport interface OwnProps extends GrafanaRouteComponentProps<{ uid: string }> {}\n\nconst mapStateToProps = (state: StoreState, props: OwnProps) => {\n const uid = props.match.params.uid;\n return {\n navModel: getNavModel(state.navIndex, `folder-settings-${uid}`, getLoadingNav(2)),\n folderUid: uid,\n folder: state.folder,\n };\n};\n\nconst mapDispatchToProps = {\n getFolderByUid,\n saveFolder,\n setFolderTitle,\n deleteFolder,\n};\n\nconst connector = connect(mapStateToProps, mapDispatchToProps);\n\nexport type Props = OwnProps & ConnectedProps<typeof connector>;\n\nexport interface State {\n isLoading: boolean;\n}\n\nexport class FolderSettingsPage extends PureComponent<Props, State> {\n constructor(props: Props) {\n super(props);\n this.state = {\n isLoading: false,\n };\n }\n\n componentDidMount() {\n this.props.getFolderByUid(this.props.folderUid);\n }\n\n onTitleChange = (evt: React.ChangeEvent<HTMLInputElement>) => {\n this.props.setFolderTitle(evt.target.value);\n };\n\n onSave = async (evt: React.FormEvent<HTMLFormElement>) => {\n evt.preventDefault();\n evt.stopPropagation();\n this.setState({ isLoading: true });\n await this.props.saveFolder(this.props.folder);\n this.setState({ isLoading: false });\n };\n\n onDelete = (evt: React.MouseEvent<HTMLButtonElement>) => {\n evt.stopPropagation();\n evt.preventDefault();\n\n const confirmationText = `Do you want to delete this folder and all its dashboards and alerts?`;\n appEvents.publish(\n new ShowConfirmModalEvent({\n title: 'Delete',\n text: confirmationText,\n icon: 'trash-alt',\n yesText: 'Delete',\n onConfirm: () => {\n this.props.deleteFolder(this.props.folder.uid);\n },\n })\n );\n };\n\n render() {\n const { navModel, folder } = this.props;\n\n return (\n <Page navModel={navModel}>\n <Page.Contents isLoading={this.state.isLoading}>\n <h3 className=\"page-sub-heading\">Folder settings</h3>\n\n <div className=\"section gf-form-group\">\n <form name=\"folderSettingsForm\" onSubmit={this.onSave}>\n <div className=\"gf-form\">\n <label className=\"gf-form-label width-7\">Name</label>\n <Input\n type=\"text\"\n className=\"gf-form-input width-30\"\n value={folder.title}\n onChange={this.onTitleChange}\n />\n </div>\n <div className=\"gf-form-button-row\">\n <Button type=\"submit\" disabled={!folder.canSave || !folder.hasChanged}>\n Save\n </Button>\n <Button variant=\"destructive\" onClick={this.onDelete} disabled={!folder.canDelete}>\n Delete\n </Button>\n </div>\n </form>\n </div>\n </Page.Contents>\n </Page>\n );\n }\n}\n\nexport default connector(FolderSettingsPage);\n"],"names":["Input","LegacyForms","mapDispatchToProps","getFolderByUid","saveFolder","setFolderTitle","deleteFolder","connector","connect","state","props","uid","match","params","navModel","getNavModel","navIndex","getLoadingNav","folderUid","folder","FolderSettingsPage","PureComponent","constructor","super","evt","this","target","value","async","preventDefault","stopPropagation","setState","isLoading","appEvents","ShowConfirmModalEvent","title","text","icon","yesText","onConfirm","componentDidMount","render","className","name","onSubmit","onSave","type","onChange","onTitleChange","Button","disabled","canSave","hasChanged","variant","onClick","onDelete","canDelete"],"sourceRoot":""}