PluginProbe
ElasticPress / 4.5.2
ElasticPress v4.5.2
5.3.5 5.3.4 3.6.5 3.6.6 4.0.0 4.0.1 4.1.0 4.2.0 4.2.1 4.2.2 4.3.0 4.3.1 4.4.0 4.4.1 4.5.0 4.5.1 4.5.2 4.6.0 4.6.1 4.7.0 4.7.1 4.7.2 5.0.0 5.0.1 5.0.2 All 108 releases
elasticpress / assets / js / sync / components / sync-page.js

sync-page.js in ElasticPress 4.5.2, at assets/js/sync/components/sync-page.js

96 lines 3.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 /**
2 * WordPress dependencies.
3 */
4 import { WPElement } from '@wordpress/element';
5 import { __, sprintf } from '@wordpress/i18n';
6
7 /**
8 * Internal dependencies.
9 */
10 import SyncPanel from './sync/panel';
11
12 /**
13 * Sync page component.
14 *
15 * @param {object} props Component props.
16 * @param {boolean} props.isCli If sync is a CLI sync.
17 * @param {boolean} props.isComplete If sync is complete.
18 * @param {boolean} props.isDeleting If sync is a delete and sync.
19 * @param {boolean} props.isEpio If ElasticPress is using ElasticPress.io.
20 * @param {boolean} props.isFailed If sync has failed.
21 * @param {boolean} props.isPaused If sync is paused.
22 * @param {boolean} props.isSyncing If sync is running.
23 * @param {number} props.itemsProcessed Number of items processed.
24 * @param {number} props.itemsTotal Number of items to process.
25 * @param {string} props.lastSyncDateTime Date and time of last sync in ISO-8601.
26 * @param {boolean} props.lastSyncFailed If the last sync had failures.
27 * @param {object[]} props.log Sync message log.
28 * @param {Function} props.onDelete Callback for clicking delete and sync.
29 * @param {Function} props.onPause Callback for clicking pause.
30 * @param {Function} props.onResume Callback for clicking resume.
31 * @param {Function} props.onStop Callback for clicking stop.
32 * @param {Function} props.onSync Callback for clicking sync.
33 * @param {string} props.syncStartDateTime Date and time of current sync in ISO 8601.
34 * @returns {WPElement} Sync page component.
35 */
36 export default ({ isCli, isComplete, isDeleting, isEpio, isFailed, isSyncing, log, ...props }) => {
37 const isInitialSync = props.lastSyncDateTime === null;
38
39 return (
40 <>
41 <h1 className="ep-sync-heading">{__('Sync Settings', 'elasticpress')}</h1>
42
43 <SyncPanel
44 introduction={
45 isInitialSync
46 ? sprintf(
47 /* translators: %s: Index type. ElasticPress.io or Elasticsearch. */
48 __(
49 'Run a sync to index your existing content %s. Once syncing finishes, your site is officially supercharged.',
50 'elasticpress',
51 ),
52 isEpio
53 ? __('on ElasticPress.io', 'elasticpress')
54 : __('in Elasticsearch', 'elasticpress'),
55 )
56 : __(
57 'If you are missing data in your search results or have recently added custom content types to your site, you should run a sync to reflect these changes.',
58 'elasticpress',
59 )
60 }
61 isComplete={isComplete}
62 isDisabled={(isSyncing && isDeleting) || (isSyncing && isCli)}
63 isFailed={isFailed}
64 isSyncing={isSyncing && !isDeleting}
65 logMessages={log.filter((m) => !m.isDeleting)}
66 showLastSync
67 showProgress={!isDeleting && (isSyncing || isComplete || isFailed)}
68 showSync
69 {...props}
70 />
71
72 {!isInitialSync ? (
73 <SyncPanel
74 heading={__('Delete All Data and Sync', 'elasticpress')}
75 introduction={__(
76 'If you are still having issues with your search results, you may need to do a completely fresh sync.',
77 'elasticpress',
78 )}
79 isComplete={isComplete}
80 isDisabled={(isSyncing && !isDeleting) || (isSyncing && isCli)}
81 isFailed={isFailed}
82 isSyncing={isSyncing && isDeleting}
83 logMessages={log.filter((m) => m.isDeleting)}
84 showDelete
85 showProgress={isDeleting && (isSyncing || isComplete || isFailed)}
86 warningMessage={__(
87 'All indexed data on ElasticPress will be deleted without affecting anything on your WordPress website. This may take a few hours depending on the amount of content that needs to be synced and indexed. While this is happening, searches will use the default WordPress results',
88 'elasticpress',
89 )}
90 {...props}
91 />
92 ) : null}
93 </>
94 );
95 };
96