##// END OF EJS Templates
search: enable case sensitivity
search: enable case sensitivity

File last commit:

r147:bb4c1b51
r179:03929809
Show More
admin-partitions-view.js
124 lines | 3.9 KiB | application/javascript | JavascriptLexer
license: change the license to Apache 2.0
r112 // Copyright 2010 - 2017 RhodeCode GmbH and the AppEnlight project authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
project: initial commit
r0
components: admin panel componentized
r85 angular.module('appenlight.components.adminPartitionsView', [])
.component('adminPartitionsView', {
templateUrl: 'components/views/admin-partitions-view/admin-partitions-view.html',
controller: AdminPartitionsViewController
});
project: initial commit
r0
components: admin panel componentized
r85 AdminPartitionsViewController.$inject = ['sectionViewResource'];
project: initial commit
r0
components: admin panel componentized
r85 function AdminPartitionsViewController(sectionViewResource) {
project: initial commit
r0 var vm = this;
frontend: angular 1.7.7
r147 this.$onInit = function () {
vm.permanentPartitions = [];
vm.dailyPartitions = [];
vm.loading = {partitions: true};
vm.dailyChecked = false;
vm.permChecked = false;
vm.dailyConfirm = '';
vm.permConfirm = '';
project: initial commit
r0
frontend: angular 1.7.7
r147 sectionViewResource.get({section: 'admin_section', view: 'partitions'},
vm.loadPartitions);
}
project: initial commit
r0
vm.loadPartitions = function (data) {
var permanentPartitions = vm.transformPartitionList(
data.permanent_partitions);
var dailyPartitions = vm.transformPartitionList(
data.daily_partitions);
vm.permanentPartitions = permanentPartitions;
vm.dailyPartitions = dailyPartitions;
vm.loading = {partitions: false};
};
vm.setCheckedList = function (scope) {
var toTest = null;
frontend: angular 1.7.7
r147 if (scope === 'dailyPartitions') {
project: initial commit
r0 toTest = 'dailyChecked';
frontend: angular 1.7.7
r147 } else {
project: initial commit
r0 toTest = 'permChecked';
}
if (vm[toTest]) {
var val = true;
frontend: angular 1.7.7
r147 } else {
project: initial commit
r0 var val = false;
}
console.log('scope', scope);
_.each(vm[scope], function (item) {
_.each(item[1].pg, function (index) {
index.checked = val;
});
_.each(item[1].elasticsearch, function (index) {
index.checked = val;
});
});
}
vm.transformPartitionList = function (inputList) {
var outputList = [];
_.each(inputList, function (item) {
var time = [item[0], {
elasticsearch: [],
pg: []
}]
_.each(item[1].pg, function (index) {
time[1].pg.push({name: index, checked: false})
});
_.each(item[1].elasticsearch, function (index) {
time[1].elasticsearch.push({
name: index,
checked: false
})
});
outputList.push(time);
});
return outputList;
};
vm.partitionsDelete = function (partitionType) {
var es_indices = [];
var pg_indices = [];
_.each(vm[partitionType], function (item) {
_.each(item[1].pg, function (index) {
if (index.checked) {
pg_indices.push(index.name)
}
});
_.each(item[1].elasticsearch, function (index) {
if (index.checked) {
es_indices.push(index.name)
}
});
});
console.log(es_indices, pg_indices);
vm.loading = {partitions: true};
frontend: angular 1.7.7
r147 sectionViewResource.save({
section: 'admin_section',
view: 'partitions_remove'
}, {
project: initial commit
r0 es_indices: es_indices,
pg_indices: pg_indices,
confirm: 'CONFIRM'
}, vm.loadPartitions);
}
}