Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/fulltextsearch.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--appinfo/routes.php7
-rw-r--r--js/settings.admin.js36
-rw-r--r--lib/Controller/SettingsController.php4
-rw-r--r--templates/settings.admin.php23
4 files changed, 28 insertions, 42 deletions
diff --git a/appinfo/routes.php b/appinfo/routes.php
index 893dfb9..b9e0988 100644
--- a/appinfo/routes.php
+++ b/appinfo/routes.php
@@ -34,12 +34,7 @@ return [
'name' => 'settings#setOption',
'url' => 'ajax/settings/option.php',
'verb' => 'POST'
- ],
- [
- 'name' => 'settings#forceIndex',
- 'url' => 'ajax/settings/forceindex.php',
- 'verb' => 'POST'
- ],
+ ],
[
'name' => 'settings#updateSubOptions',
'url' => 'ajax/settings/updateSubOptions.php',
diff --git a/js/settings.admin.js b/js/settings.admin.js
index 6f597d9..65427f0 100644
--- a/js/settings.admin.js
+++ b/js/settings.admin.js
@@ -34,17 +34,20 @@ $(document)
setInterval(function() {
nextantSettings.checksuboptions(false)
}, 60000);
-
},
savesuboptions : function(switched) {
+ var needed_index = -1;
+ if (switched == 'force_index')
+ needed_index = 1;
var data = {
live_extract : ($('#solr_live_extract')
.is(":checked")) ? 1 : 0,
live_docupdate : ($('#solr_live_docupdate')
.is(":checked")) ? 1 : 0,
- max_size : $('#solr_max_size').val()
+ max_size : $('#solr_max_size').val(),
+ needed_index : needed_index
}
if (switched == 'live_extract')
@@ -103,11 +106,18 @@ $(document)
$('#solr_current_docs').text(
'Nextant is not configured yet');
$('#nextant_force_index').hide(delay);
+ $('#nextant_index_scheduled').hide(delay);
} else if (response.solr_ping == 'false')
$('#solr_current_docs').text(
'Solr Core is down');
else {
- $('#nextant_force_index').show(delay);
+ if (response.needed_index == 1) {
+ $('#nextant_force_index').hide(delay);
+ $('#nextant_index_scheduled').show(delay);
+ } else {
+ $('#nextant_index_scheduled').hide(delay);
+ $('#nextant_force_index').show(delay);
+ }
if (response.current_docs > 0)
$('#solr_current_docs').text(
response.current_docs);
@@ -294,33 +304,23 @@ $(document)
$('#solr_url').attr('disabled', false);
$('#solr_core').attr('disabled', false);
$('#nextant_apply').attr('disabled', false);
- },
-
- forceindex : function() {
- $.post(OC.filePath('nextant', 'ajax/settings',
- 'forceindex.php'), {},
- nextantSettings.forced);
-
- },
-
- forced : function() {
- $('#nextant_force_index').hide();
}
}
$('#nextant_apply').on('click', nextantSettings.save);
- $('#nextant_force_index').on('click',
- nextantSettings.forceindex);
$('#solr_live_extract').mousedown(function() {
nextantSettings.savesuboptions('live_extract');
- })
+ });
$('#solr_live_docupdate').mousedown(function() {
nextantSettings.savesuboptions('live_docupdate');
- })
+ });
$('#solr_max_size').on('input', function(e) {
nextantSettings.savesuboptions();
});
+ $('#nextant_force_index').on('click', function() {
+ nextantSettings.savesuboptions('force_index');
+ });
nextantSettings.init();
});
diff --git a/lib/Controller/SettingsController.php b/lib/Controller/SettingsController.php
index 87e66c2..4634283 100644
--- a/lib/Controller/SettingsController.php
+++ b/lib/Controller/SettingsController.php
@@ -96,11 +96,13 @@ class SettingsController extends Controller
return $response;
}
- public function setOption($live_extract, $live_docupdate, $max_size)
+ public function setOption($live_extract, $live_docupdate, $max_size, $needed_index)
{
$this->configService->setAppValue('live_extract', $live_extract);
$this->configService->setAppValue('live_docupdate', $live_docupdate);
$this->configService->setAppValue('max_size', $max_size);
+ if ($needed_index == 1)
+ $this->configService->needIndex(true, true);
return $this->updateSubOptions(false);
}
diff --git a/templates/settings.admin.php b/templates/settings.admin.php
index 69f5c47..c3b9eb7 100644
--- a/templates/settings.admin.php
+++ b/templates/settings.admin.php
@@ -67,11 +67,6 @@ style('nextant', 'admin');
<tr>
<td>&nbsp;</td>
</tr>
- <!-- <tr style="height: 40px;">
- <td colspan="2" style="text-align: center; width: 300px;"><span
- id="nextant-admin-msg" class="msg"></span></td>
- </tr>
- -->
<tr style="height: 30px;">
<td class="nextant_admin_left">
@@ -90,14 +85,13 @@ style('nextant', 'admin');
<td><input type="checkbox" name="solr_live_docupdate"
id="solr_live_docupdate" value="1" style="margin: 10px;"></td>
</tr>
-
+
<tr style="height: 30px;">
<td class="nextant_admin_left">
<?php p($l->t('Maximum File Size (Mb) :')) ?></td>
- <td><input type="text" id="solr_max_size"
- style="width: 100px;"></td>
+ <td><input type="text" id="solr_max_size" style="width: 100px;"></td>
</tr>
-
+
<tr style="height: 30px;">
<td class="nextant_admin_left">
<?php p($l->t('Last index :')) ?></td>
@@ -115,16 +109,11 @@ style('nextant', 'admin');
<td>
<button type="button" id="nextant_force_index"
- style="width: 270px"><?php p($l->t('Force re-index')) ?></button>
-<?php
-// if ($_['needed_index'] == 2) {
-// <b>execute <i>./occ nextant:index</i></b>
-// } else
-// p('index scheduled');
-?></td>
+ style="width: 270px"><?php p($l->t('Force index')) ?></button>
+ <div id="nextant_index_scheduled">Index is scheduled</div>
+ </td>
</tr>
-
</table>
</td>
<td style="padding-left: 40px;">