PluginProbe
Visualizer – Tables & Charts Manager with Built-in AI Generator / 3.11.0
Visualizer – Tables & Charts Manager with Built-in AI Generator v3.11.0
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.11.0, at classes/Visualizer/Gutenberg/src/Components/Import/RemoteImport.js

166 lines 4.7 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 icon={ ( 'community' === visualizerLocalize.isPro ) ? 'lock' : '' }
33 >
34 { ( 'community' !== visualizerLocalize.isPro ) ? (
35 <PanelBody
36 title={ __( 'One Time Import' ) }
37 className="visualizer-inner-sections"
38 initialOpen={ false }
39 >
40
41 <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>
42 <p>
43 { __( 'If you are unsure about how to format your data CSV then please take a look at this sample: ' ) }
44 <ExternalLink href={ `${visualizerLocalize.absurl}samples/${this.props.chart['visualizer-chart-type']}.csv` }>
45 { `${this.props.chart['visualizer-chart-type']}.csv` }
46 </ExternalLink>
47 </p>
48 <p>{ __( 'You can also import data from Google Spreadsheet.' ) }</p>
49
50 <TextControl
51 placeholder={ __( 'Please enter the URL of your CSV file' ) }
52 value={ this.props.chart['visualizer-chart-url'] ? this.props.chart['visualizer-chart-url'] : '' }
53 onChange={ this.props.editURL }
54 />
55
56 <Button
57 isPrimary
58 isLarge
59 isBusy={ 'uploadData' === this.props.isLoading }
60 disabled={ 'uploadData' === this.props.isLoading }
61 onClick={ () => this.props.uploadData( false ) }
62 >
63 { __( 'Import Data' ) }
64 </Button>
65
66 </PanelBody>
67 ) : (
68 <PanelBody
69 title={ __( 'One Time Import' ) }
70 icon="lock"
71 className="visualizer-inner-sections"
72 initialOpen={ false }
73 >
74
75 <p>{ __( 'Enable this feature in PRO version!' ) }</p>
76
77 <Button
78 isPrimary
79 href={ visualizerLocalize.proTeaser }
80 target="_blank"
81 >
82 { __( 'Upgrade Now' ) }
83 </Button>
84
85 </PanelBody>
86 ) }
87
88 { ( 'business' === visualizerLocalize.isPro ) ?
89 <PanelBody
90 title={ __( 'Schedule Import' ) }
91 className="visualizer-inner-sections"
92 initialOpen={ false }
93 >
94
95 <p>{ __( 'You can choose here to synchronize your chart data with a remote CSV file. ' ) }</p>
96 <p>{ __( 'You can also synchronize with your Google Spreadsheet file.' ) }</p>
97 <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>
98
99 <TextControl
100 placeholder={ __( 'Please enter the URL of your CSV file' ) }
101 value={ this.props.chart['visualizer-chart-url'] ? this.props.chart['visualizer-chart-url'] : '' }
102 onChange={ this.props.editURL }
103 />
104
105 <SelectControl
106 label={ __( 'How often do you want to check the url?' ) }
107 value={ this.props.chart['visualizer-chart-schedule'] ? this.props.chart['visualizer-chart-schedule'] : 1 }
108 options={ [
109 { label: __( '10 minutes' ), value: '0.16' },
110 { label: __( 'Each hour' ), value: '1' },
111 { label: __( 'Each 12 hours' ), value: '12' },
112 { label: __( 'Each day' ), value: '24' },
113 { label: __( 'Each 3 days' ), value: '72' }
114 ] }
115 onChange={ this.props.editSchedule }
116 />
117
118 <Button
119 isPrimary
120 isLarge
121 isBusy={ 'uploadData' === this.props.isLoading }
122 disabled={ 'uploadData' === this.props.isLoading }
123 onClick={ () => this.props.uploadData( true ) }
124 >
125 { __( 'Save Schedule' ) }
126 </Button>
127
128 </PanelBody> :
129 <PanelBody
130 title={ __( 'Schedule Import' ) }
131 icon="lock"
132 className="visualizer-inner-sections"
133 initialOpen={ false }
134 >
135
136 <p>{ __( 'Upgrade your license to at least the DEVELOPER version to activate this feature!' ) }</p>
137
138 <Button
139 isPrimary
140 href={ visualizerLocalize.proTeaser }
141 target="_blank"
142 >
143 { __( 'Upgrade Now' ) }
144 </Button>
145
146 </PanelBody>
147 }
148
149 <JSONImport
150 id={ this.props.id }
151 chart={ this.props.chart }
152 editSchedule={ this.props.editJSONSchedule }
153 editJSONURL={ this.props.editJSONURL }
154 editJSONHeaders={ this.props.editJSONHeaders }
155 editJSONRoot={ this.props.editJSONRoot }
156 editJSONPaging={ this.props.editJSONPaging }
157 JSONImportData={ this.props.JSONImportData }
158 />
159
160 </PanelBody>
161 );
162 }
163 }
164
165 export default RemoteImport;
166