← All changes
|
classes/Visualizer/Gutenberg/src/Components/Import/RemoteImport.js
+67
-29
3.1.1
→
3.11.14
View file →
| @@ -12,8 +12,13 @@ | ||
| 12 | 12 | SelectControl, |
| 13 | 13 | TextControl |
| 14 | 14 | } = wp.components; |
| 15 | 15 | |
| 16 | +/** | |
| 17 | + * Internal dependencies | |
| 18 | + */ | |
| 19 | +import JSONImport from './JSONImport.js'; | |
| 20 | + | |
| 16 | 21 | class RemoteImport extends Component { |
| 17 | 22 | constructor() { |
| 18 | 23 | super( ...arguments ); |
| 19 | 24 | } |
| @@ -23,43 +28,64 @@ | ||
| 23 | 28 | <PanelBody |
| 24 | 29 | title={ __( 'Import data from URL' ) } |
| 25 | 30 | initialOpen={ false } |
| 26 | 31 | className="visualizer-advanced-panel" |
| 32 | + icon={ ( 'community' === visualizerLocalize.isPro ) ? 'lock' : '' } | |
| 27 | 33 | > |
| 34 | + { ( 'community' !== visualizerLocalize.isPro ) ? ( | |
| 35 | + <PanelBody | |
| 36 | + title={ __( 'One Time Import' ) } | |
| 37 | + className="visualizer-inner-sections" | |
| 38 | + initialOpen={ false } | |
| 39 | + > | |
| 28 | 40 | |
| 29 | - <PanelBody | |
| 30 | - title={ __( 'One Time Import' ) } | |
| 31 | - className="visualizer-inner-sections" | |
| 32 | - initialOpen={ false } | |
| 33 | - > | |
| 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> | |
| 34 | 49 | |
| 35 | - <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> | |
| 36 | - <p> | |
| 37 | - { __( 'If you are unsure about how to format your data CSV then please take a look at this sample: ' ) } | |
| 38 | - <ExternalLink href={ `${visualizerLocalize.absurl}samples/${this.props.chart['visualizer-chart-type']}.csv` }> | |
| 39 | - { `${this.props.chart['visualizer-chart-type']}.csv` } | |
| 40 | - </ExternalLink> | |
| 41 | - </p> | |
| 42 | - <p>{ __( 'You can also import data from Google Spreadsheet.' ) }</p> | |
| 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 | + /> | |
| 43 | 55 | |
| 44 | - <TextControl | |
| 45 | - placeholder={ __( 'Please enter the URL of your CSV file' ) } | |
| 46 | - value={ this.props.chart['visualizer-chart-url'] ? this.props.chart['visualizer-chart-url'] : '' } | |
| 47 | - onChange={ this.props.editURL } | |
| 48 | - /> | |
| 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> | |
| 49 | 65 | |
| 50 | - <Button | |
| 51 | - isPrimary | |
| 52 | - isLarge | |
| 53 | - isBusy={ 'uploadData' === this.props.isLoading } | |
| 54 | - disabled={ 'uploadData' === this.props.isLoading } | |
| 55 | - onClick={ () => this.props.uploadData( false ) } | |
| 66 | + </PanelBody> | |
| 67 | + ) : ( | |
| 68 | + <PanelBody | |
| 69 | + title={ __( 'One Time Import' ) } | |
| 70 | + icon="lock" | |
| 71 | + className="visualizer-inner-sections" | |
| 72 | + initialOpen={ false } | |
| 56 | 73 | > |
| 57 | - { __( 'Import Data' ) } | |
| 58 | - </Button> | |
| 59 | 74 | |
| 60 | - </PanelBody> | |
| 75 | + <p>{ __( 'Enable this feature in PRO version!' ) }</p> | |
| 61 | 76 | |
| 77 | + <Button | |
| 78 | + isPrimary | |
| 79 | + href={ visualizerLocalize.proTeaser } | |
| 80 | + target="_blank" | |
| 81 | + > | |
| 82 | + { __( 'Upgrade Now' ) } | |
| 83 | + </Button> | |
| 84 | + | |
| 85 | + </PanelBody> | |
| 86 | + ) } | |
| 87 | + | |
| 62 | 88 | { ( 'business' === visualizerLocalize.isPro ) ? |
| 63 | 89 | <PanelBody |
| 64 | 90 | title={ __( 'Schedule Import' ) } |
| 65 | 91 | className="visualizer-inner-sections" |
| @@ -79,8 +105,9 @@ | ||
| 79 | 105 | <SelectControl |
| 80 | 106 | label={ __( 'How often do you want to check the url?' ) } |
| 81 | 107 | value={ this.props.chart['visualizer-chart-schedule'] ? this.props.chart['visualizer-chart-schedule'] : 1 } |
| 82 | 108 | options={ [ |
| 109 | + { label: __( '10 minutes' ), value: '0.16' }, | |
| 83 | 110 | { label: __( 'Each hour' ), value: '1' }, |
| 84 | 111 | { label: __( 'Each 12 hours' ), value: '12' }, |
| 85 | 112 | { label: __( 'Each day' ), value: '24' }, |
| 86 | 113 | { label: __( 'Each 3 days' ), value: '72' } |
| @@ -105,9 +132,9 @@ | ||
| 105 | 132 | className="visualizer-inner-sections" |
| 106 | 133 | initialOpen={ false } |
| 107 | 134 | > |
| 108 | 135 | |
| 109 | - <p>{ __( 'Enable this feature in BUSINESS version!' ) }</p> | |
| 136 | + <p>{ __( 'Upgrade your license to at least the DEVELOPER version to activate this feature!' ) }</p> | |
| 110 | 137 | |
| 111 | 138 | <Button |
| 112 | 139 | isPrimary |
| 113 | 140 | href={ visualizerLocalize.proTeaser } |
| @@ -112,13 +139,24 @@ | ||
| 112 | 139 | isPrimary |
| 113 | 140 | href={ visualizerLocalize.proTeaser } |
| 114 | 141 | target="_blank" |
| 115 | 142 | > |
| 116 | - { __( 'Buy Now' ) } | |
| 143 | + { __( 'Upgrade Now' ) } | |
| 117 | 144 | </Button> |
| 118 | 145 | |
| 119 | 146 | </PanelBody> |
| 120 | 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 | + /> | |
| 121 | 159 | |
| 122 | 160 | </PanelBody> |
| 123 | 161 | ); |
| 124 | 162 | } |