You've already forked joplin
mirror of
https://github.com/laurent22/joplin.git
synced 2025-06-15 23:00:36 +02:00
Mobile: Added button to fix search engine index
This commit is contained in:
@ -1,5 +1,5 @@
|
||||
const React = require('react'); const Component = React.Component;
|
||||
const { Platform, TouchableOpacity, Linking, View, Switch, StyleSheet, Text, Button, ScrollView, TextInput } = require('react-native');
|
||||
const { Platform, TouchableOpacity, Linking, View, Switch, StyleSheet, Text, Button, ScrollView, TextInput, Alert } = require('react-native');
|
||||
const { connect } = require('react-redux');
|
||||
const { ScreenHeader } = require('lib/components/screen-header.js');
|
||||
const { _, setLocale } = require('lib/locale.js');
|
||||
@ -14,6 +14,7 @@ const NavService = require('lib/services/NavService.js');
|
||||
const VersionInfo = require('react-native-version-info').default;
|
||||
const { ReportService } = require('lib/services/report.js');
|
||||
const { time } = require('lib/time-utils');
|
||||
const SearchEngine = require('lib/services/SearchEngine');
|
||||
const RNFS = require('react-native-fs');
|
||||
|
||||
import Slider from '@react-native-community/slider';
|
||||
@ -78,6 +79,12 @@ class ConfigScreenComponent extends BaseScreenComponent {
|
||||
this.setState({ creatingReport: false });
|
||||
}
|
||||
|
||||
this.fixSearchEngineIndexButtonPress_ = async () => {
|
||||
this.setState({ fixingSearchIndex: true });
|
||||
await SearchEngine.instance().rebuildIndex();
|
||||
this.setState({ fixingSearchIndex: false });
|
||||
}
|
||||
|
||||
this.logButtonPress_ = () => {
|
||||
NavService.go('Log');
|
||||
}
|
||||
@ -191,6 +198,15 @@ class ConfigScreenComponent extends BaseScreenComponent {
|
||||
renderButton(key, title, clickHandler, options = null) {
|
||||
if (!options) options = {};
|
||||
|
||||
let descriptionComp = null;
|
||||
if (options.description) {
|
||||
descriptionComp = (
|
||||
<View style={{flex:1, marginTop: 10}}>
|
||||
<Text style={this.styles().descriptionText}>{options.description}</Text>
|
||||
</View>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<View key={key} style={this.styles().settingContainer}>
|
||||
<View style={{flex:1, flexDirection: 'column'}}>
|
||||
@ -198,6 +214,7 @@ class ConfigScreenComponent extends BaseScreenComponent {
|
||||
<Button title={title} onPress={clickHandler} disabled={!!options.disabled}/>
|
||||
</View>
|
||||
{ options.statusComp }
|
||||
{ descriptionComp }
|
||||
</View>
|
||||
</View>
|
||||
);
|
||||
@ -338,6 +355,7 @@ class ConfigScreenComponent extends BaseScreenComponent {
|
||||
settingComps.push(this.renderButton('status_button', _('Sync Status'), this.syncStatusButtonPress_));
|
||||
settingComps.push(this.renderButton('log_button', _('Log'), this.logButtonPress_));
|
||||
settingComps.push(this.renderButton('export_report_button', this.state.creatingReport ? _('Creating report...') : _('Export Debug Report'), this.exportDebugButtonPress_, { disabled: this.state.creatingReport }));
|
||||
settingComps.push(this.renderButton('fix_search_engine_index', this.state.fixingSearchIndex ? _('Fixing search index...') : _('Fix search index'), this.fixSearchEngineIndexButtonPress_, { disabled: this.state.fixingSearchIndex, description: _('Use this to rebuild the search index if there is a problem with search. It may take some times depending on the number of notes.') }));
|
||||
|
||||
settingComps.push(this.renderHeader('moreInfo', _('More information')));
|
||||
|
||||
|
Reference in New Issue
Block a user