Skip to content

Commit 1b9863f

Browse files
Fix file conflict
2 parents 72b0650 + 11c5b97 commit 1b9863f

File tree

11 files changed

+45
-12
lines changed

11 files changed

+45
-12
lines changed

classes/Visualizer/Gutenberg/Block.php

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -442,8 +442,8 @@ public function get_visualizer_data( $post ) {
442442

443443
$json_paging = get_post_meta( $post_id, Visualizer_Plugin::CF_JSON_PAGING, true );
444444

445-
if ( ! empty( $import ) && ! empty( $schedule ) ) {
446-
$data['visualizer-chart-url'] = $import;
445+
if ( ! empty( $import ) && $schedule >= 0 ) {
446+
$data['visualizer-chart-url'] = $import;
447447
$data['visualizer-chart-schedule'] = $schedule;
448448
}
449449

@@ -598,7 +598,7 @@ public function update_chart_data( $data ) {
598598
update_post_meta( $data['id'], Visualizer_Plugin::CF_SERIES, $data['visualizer-series'] );
599599
update_post_meta( $data['id'], Visualizer_Plugin::CF_SETTINGS, $data['visualizer-settings'] );
600600

601-
if ( $data['visualizer-chart-url'] && $data['visualizer-chart-schedule'] ) {
601+
if ( $data['visualizer-chart-url'] && $data['visualizer-chart-schedule'] >= 0 ) {
602602
$chart_url = esc_url_raw( $data['visualizer-chart-url'] );
603603
$chart_schedule = intval( $data['visualizer-chart-schedule'] );
604604
update_post_meta( $data['id'], Visualizer_Plugin::CF_CHART_URL, $chart_url );
@@ -621,6 +621,16 @@ public function update_chart_data( $data ) {
621621
delete_post_meta( $data['id'], Visualizer_Plugin::CF_DB_SCHEDULE );
622622
delete_post_meta( $data['id'], Visualizer_Plugin::CF_DB_QUERY );
623623
}
624+
625+
if ( 'Visualizer_Source_Csv_Remote' === $source_type ) {
626+
$schedule_url = $data['visualizer-chart-url'];
627+
$schedule_id = $data['visualizer-chart-schedule'];
628+
update_post_meta( $data['id'], Visualizer_Plugin::CF_CHART_URL, $schedule_url );
629+
update_post_meta( $data['id'], Visualizer_Plugin::CF_CHART_SCHEDULE, $schedule_id );
630+
} else {
631+
delete_post_meta( $data['id'], Visualizer_Plugin::CF_CHART_URL );
632+
delete_post_meta( $data['id'], Visualizer_Plugin::CF_CHART_SCHEDULE );
633+
}
624634
}
625635

626636
if ( $source_type === 'Visualizer_Source_Json' ) {

classes/Visualizer/Gutenberg/build/block.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

classes/Visualizer/Gutenberg/src/Components/Import/RemoteImport.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ class RemoteImport extends Component {
8686
value={ this.props.chart['visualizer-chart-schedule'] ? this.props.chart['visualizer-chart-schedule'] : 1 }
8787
options={ [
8888
{ label: __( 'Each hour' ), value: '1' },
89+
{ label: __( 'Live' ), value: '0' },
8990
{ label: __( 'Each 12 hours' ), value: '12' },
9091
{ label: __( 'Each day' ), value: '24' },
9192
{ label: __( 'Each 3 days' ), value: '72' }

classes/Visualizer/Gutenberg/webpack.config.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ const NODE_ENV = process.env.NODE_ENV || 'development';
33
const MiniCssExtractPlugin = require( 'mini-css-extract-plugin' );
44

55
module.exports = {
6+
externals: {
7+
'lodash': 'lodash'
8+
},
69
mode: NODE_ENV,
710
entry: './src/index.js',
811
output: {

classes/Visualizer/Module.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -523,6 +523,10 @@ protected function get_user_customization_js() {
523523
require_once( ABSPATH . 'wp-admin/includes/file.php' );
524524
WP_Filesystem();
525525
global $wp_filesystem;
526+
if ( ! is_a( $wp_filesystem, 'WP_Filesystem_Base' ) ) {
527+
$creds = request_filesystem_credentials( site_url() );
528+
wp_filesystem( $creds );
529+
}
526530

527531
$multisite_arg = '/';
528532
if ( is_multisite() && ! is_main_site() ) {

classes/Visualizer/Module/Chart.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1587,6 +1587,10 @@ public function save_chart_image( $base64_img, $chart_id, $save_attachment = tru
15871587
require_once ABSPATH . '/wp-admin/includes/file.php';
15881588
\WP_Filesystem();
15891589
global $wp_filesystem;
1590+
if ( ! is_a( $wp_filesystem, 'WP_Filesystem_Base' ) ) {
1591+
$creds = request_filesystem_credentials( site_url() );
1592+
wp_filesystem( $creds );
1593+
}
15901594
$upload_file = $wp_filesystem->put_contents( $upload_path . $hashed_filename, $decoded );
15911595

15921596
// Insert new chart image.

composer.lock

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

index.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,9 @@ function visualizer_launch() {
7373
define( 'VISUALIZER_REST_VERSION', 1 );
7474
// if the below is true, then the js/customization.js in the plugin folder will be used instead of the one in the uploads folder (if it exists).
7575
// this is also used in Block.php
76-
define( 'VISUALIZER_TEST_JS_CUSTOMIZATION', false );
76+
if ( ! defined( 'VISUALIZER_TEST_JS_CUSTOMIZATION' ) ) {
77+
define( 'VISUALIZER_TEST_JS_CUSTOMIZATION', false );
78+
}
7779

7880
if ( ! defined( 'VISUALIZER_CSV_DELIMITER' ) ) {
7981
define( 'VISUALIZER_CSV_DELIMITER', ',' );

js/render-chartjs.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,8 @@
133133
}
134134
var format = context.dataset.format || '';
135135
if ( format ) {
136-
label += format_datum( context.formattedValue, format );
136+
var lastSuffix = numeral(context.formattedValue).format(format).replace(/[0-9]/g, '');
137+
label += context.formattedValue + lastSuffix;
137138
} else {
138139
format = 'undefined' !== typeof context.chart.config._config.options.format ? context.chart.config._config.options.format : '';
139140
if ( format ) {
@@ -467,7 +468,7 @@
467468
switch(type) {
468469
case 'number':
469470
// numeral.js works on 0 instead of # so we just replace that in the ICU pattern set.
470-
format = format.replace(/#/g, '0');
471+
format = format.replace(/#/g, '0').replace(/%/g, '');
471472
// we also replace all instance of '$' as that is more relevant for ticks.
472473
if(removeDollar){
473474
format = format.replace(/\$/g, '');

js/render-facade.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,9 @@ var vizClipboard1=null;
109109

110110
// Refresh charts if chart not generated.
111111
function refreshEachCharts() {
112+
if ( 'object' === typeof window.fusionAnimationsVars ) {
113+
return;
114+
}
112115
setTimeout( function() {
113116
displayChartsOnFrontEnd();
114117
}, 100 );

0 commit comments

Comments
 (0)