Completed
Push — master ( 0d7950...2e50fa )
by Maxence
03:01
created

js/admin.elements.js   A

Complexity

Total Complexity 7
Complexity/F 1

Size

Lines of Code 34
Function Count 7

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 7
c 1
b 0
f 0
dl 0
loc 34
rs 10
cc 0
nc 1
mnd 0
bc 7
fnc 7
bpm 1
cpm 1
noi 0
1
/*
2
 * FullTextSearch_ElasticSearch - Use Elasticsearch to index the content of your nextcloud
3
 *
4
 * This file is licensed under the Affero General Public License version 3 or
5
 * later. See the COPYING file.
6
 *
7
 * @author Maxence Lange <[email protected]>
8
 * @copyright 2018
9
 * @license GNU AGPL version 3 or any later version
10
 *
11
 * This program is free software: you can redistribute it and/or modify
12
 * it under the terms of the GNU Affero General Public License as
13
 * published by the Free Software Foundation, either version 3 of the
14
 * License, or (at your option) any later version.
15
 *
16
 * This program is distributed in the hope that it will be useful,
17
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19
 * GNU Affero General Public License for more details.
20
 *
21
 * You should have received a copy of the GNU Affero General Public License
22
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
23
 *  
24
 */
25
26
/** global: OCA */
27
/** global: fts_admin_settings */
28
/** global: elasticsearch_settings */
29
30
31
var elasticsearch_elements = {
32
	elasticsearch_div: null,
33
	elasticsearch_host: null,
34
	elasticsearch_index: null,
35
	analyzer_tokenizer: null,
36
37
38
	init: function () {
39
		elasticsearch_elements.elasticsearch_div = $('#elastic_search');
40
		elasticsearch_elements.elasticsearch_host = $('#elasticsearch_host');
41
		elasticsearch_elements.elasticsearch_index = $('#elasticsearch_index');
42
		elasticsearch_elements.analyzer_tokenizer = $('#analyzer_tokenizer');
43
44
		elasticsearch_elements.elasticsearch_host.on('input', function () {
45
			fts_admin_settings.tagSettingsAsNotSaved($(this));
46
		}).blur(function () {
47
			elasticsearch_settings.saveSettings();
48
		});
49
50
		elasticsearch_elements.elasticsearch_index.on('input', function () {
51
			fts_admin_settings.tagSettingsAsNotSaved($(this));
52
		}).blur(function () {
53
			elasticsearch_settings.saveSettings();
54
		});
55
56
		elasticsearch_elements.analyzer_tokenizer.on('input', function () {
57
			fts_admin_settings.tagSettingsAsNotSaved($(this));
58
		}).blur(function () {
59
			elasticsearch_settings.saveSettings();
60
		});
61
	}
62
63
64
};
65
66
67