PluginProbe
Visualizer – Tables & Charts Manager with Built-in AI Generator / 3.10.9
Visualizer – Tables & Charts Manager with Built-in AI Generator v3.10.9
4.0.7 4.0.6 4.0.5 4.0.4 4.0.3 3.0.5 3.0.6 3.0.7 3.0.8 3.0.9 3.1.0 3.1.1 3.1.2 3.1.3 3.10.0 3.10.1 3.10.10 3.10.11 3.10.12 3.10.13 3.10.14 3.10.15 3.10.2 3.10.3 3.10.4 All 148 releases
visualizer / classes / Visualizer / Gutenberg / src / Components / Import / DataImport.js

DataImport.js in Visualizer – Tables & Charts Manager with Built-in AI Generator 3.10.9, at classes/Visualizer/Gutenberg/src/Components/Import/DataImport.js

110 lines 2.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 /**
2 * WordPress dependencies
3 */
4 const { __ } = wp.i18n;
5
6 const { Component } = wp.element;
7
8 const {
9 Button,
10 Modal,
11 PanelBody,
12 SelectControl
13 } = wp.components;
14
15 /**
16 * Internal dependencies
17 */
18 import SQLEditor from './SQLEditor.js';
19
20 class DataImport extends Component {
21 constructor() {
22 super( ...arguments );
23 this.save = this.save.bind( this );
24
25 this.state = {
26 isOpen: false
27 };
28 }
29
30 save( query, name, series, data ) {
31 this.props.databaseImportData( query, name, series, data );
32 this.setState({ isOpen: false });
33 }
34
35 render() {
36 if ( ( 'business' !== visualizerLocalize.isPro ) ) {
37 return (
38 <PanelBody
39 title={ __( 'Import data from database' ) }
40 icon="lock"
41 initialOpen={ false }
42 >
43
44 <p>{ __( 'Upgrade your license to at least the DEVELOPER version to activate this feature!' ) }</p>
45
46 <Button
47 isPrimary
48 href={ visualizerLocalize.proTeaser }
49 target="_blank"
50 >
51 { __( 'Upgrade Now' ) }
52 </Button>
53
54 </PanelBody>
55 );
56 }
57
58 return (
59 <PanelBody
60 title={ __( 'Import data from database' ) }
61 initialOpen={ false }
62 >
63
64 <p>{ __( 'You can import data from the database here.' ) }</p>
65
66 <p>{ __( 'How often do you want to refresh the data from the database.' ) }</p>
67
68 <SelectControl
69 label={ __( 'How often do you want to check the url?' ) }
70 value={ this.props.chart['visualizer-db-schedule'] ? this.props.chart['visualizer-db-schedule'] : 0 }
71 options={ [
72 { label: __( 'Live' ), value: '0' },
73 { label: __( 'Each hour' ), value: '1' },
74 { label: __( 'Each 12 hours' ), value: '12' },
75 { label: __( 'Each day' ), value: '24' },
76 { label: __( 'Each 3 days' ), value: '72' }
77 ] }
78 onChange={ this.props.editSchedule }
79 />
80
81 <Button
82 isPrimary
83 isLarge
84 onClick={ () => this.setState({ isOpen: true }) }
85 >
86 { __( 'Create Query' ) }
87 </Button>
88
89 { this.state.isOpen && (
90 <Modal
91 title={ __( 'Import from database' ) }
92 onRequestClose={ () => this.setState({ isOpen: false }) }
93 className="visualizer-db-query-modal"
94 shouldCloseOnClickOutside={ false }
95 >
96 <SQLEditor
97 chart={ this.props.chart }
98 changeQuery={ this.props.changeQuery }
99 save={ this.save }
100 />
101 </Modal>
102 )}
103
104 </PanelBody>
105 );
106 }
107 }
108
109 export default DataImport;
110