PluginProbe
Visualizer – Tables & Charts Manager with Built-in AI Generator / 3.5.1
Visualizer – Tables & Charts Manager with Built-in AI Generator v3.5.1
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 / RemoteImport.js

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

144 lines 4.1 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 ExternalLink,
11 PanelBody,
12 SelectControl,
13 TextControl
14 } = wp.components;
15
16 /**
17 * Internal dependencies
18 */
19 import JSONImport from './JSONImport.js';
20
21 class RemoteImport extends Component {
22 constructor() {
23 super( ...arguments );
24 }
25
26 render() {
27 return (
28 <PanelBody
29 title={ __( 'Import data from URL' ) }
30 initialOpen={ false }
31 className="visualizer-advanced-panel"
32 >
33
34 <PanelBody
35 title={ __( 'One Time Import' ) }
36 className="visualizer-inner-sections"
37 initialOpen={ false }
38 >
39
40 <p>{ __( 'You can use this to import data from a remote CSV file. The first row of the CSV file should contain the column headings. The second one should contain series type (string, number, boolean, date, datetime, timeofday).' ) }</p>
41 <p>
42 { __( 'If you are unsure about how to format your data CSV then please take a look at this sample: ' ) }
43 <ExternalLink href={ `${visualizerLocalize.absurl}samples/${this.props.chart['visualizer-chart-type']}.csv` }>
44 { `${this.props.chart['visualizer-chart-type']}.csv` }
45 </ExternalLink>
46 </p>
47 <p>{ __( 'You can also import data from Google Spreadsheet.' ) }</p>
48
49 <TextControl
50 placeholder={ __( 'Please enter the URL of your CSV file' ) }
51 value={ this.props.chart['visualizer-chart-url'] ? this.props.chart['visualizer-chart-url'] : '' }
52 onChange={ this.props.editURL }
53 />
54
55 <Button
56 isPrimary
57 isLarge
58 isBusy={ 'uploadData' === this.props.isLoading }
59 disabled={ 'uploadData' === this.props.isLoading }
60 onClick={ () => this.props.uploadData( false ) }
61 >
62 { __( 'Import Data' ) }
63 </Button>
64
65 </PanelBody>
66
67 { ( 'business' === visualizerLocalize.isPro ) ?
68 <PanelBody
69 title={ __( 'Schedule Import' ) }
70 className="visualizer-inner-sections"
71 initialOpen={ false }
72 >
73
74 <p>{ __( 'You can choose here to synchronize your chart data with a remote CSV file. ' ) }</p>
75 <p>{ __( 'You can also synchronize with your Google Spreadsheet file.' ) }</p>
76 <p>{ __( 'We will update the chart data based on your time interval preference by overwritting the current data with the one from the URL.' ) }</p>
77
78 <TextControl
79 placeholder={ __( 'Please enter the URL of your CSV file' ) }
80 value={ this.props.chart['visualizer-chart-url'] ? this.props.chart['visualizer-chart-url'] : '' }
81 onChange={ this.props.editURL }
82 />
83
84 <SelectControl
85 label={ __( 'How often do you want to check the url?' ) }
86 value={ this.props.chart['visualizer-chart-schedule'] ? this.props.chart['visualizer-chart-schedule'] : 1 }
87 options={ [
88 { label: __( 'Each hour' ), value: '1' },
89 { label: __( 'Each 12 hours' ), value: '12' },
90 { label: __( 'Each day' ), value: '24' },
91 { label: __( 'Each 3 days' ), value: '72' }
92 ] }
93 onChange={ this.props.editSchedule }
94 />
95
96 <Button
97 isPrimary
98 isLarge
99 isBusy={ 'uploadData' === this.props.isLoading }
100 disabled={ 'uploadData' === this.props.isLoading }
101 onClick={ () => this.props.uploadData( true ) }
102 >
103 { __( 'Save Schedule' ) }
104 </Button>
105
106 </PanelBody> :
107 <PanelBody
108 title={ __( 'Schedule Import' ) }
109 icon="lock"
110 className="visualizer-inner-sections"
111 initialOpen={ false }
112 >
113
114 <p>{ __( 'Upgrade your license to at least the DEVELOPER version to activate this feature!' ) }</p>
115
116 <Button
117 isPrimary
118 href={ visualizerLocalize.proTeaser }
119 target="_blank"
120 >
121 { __( 'Buy Now' ) }
122 </Button>
123
124 </PanelBody>
125 }
126
127 <JSONImport
128 id={ this.props.id }
129 chart={ this.props.chart }
130 editSchedule={ this.props.editJSONSchedule }
131 editJSONURL={ this.props.editJSONURL }
132 editJSONHeaders={ this.props.editJSONHeaders }
133 editJSONRoot={ this.props.editJSONRoot }
134 editJSONPaging={ this.props.editJSONPaging }
135 JSONImportData={ this.props.JSONImportData }
136 />
137
138 </PanelBody>
139 );
140 }
141 }
142
143 export default RemoteImport;
144