##// END OF EJS Templates
bump version to 1.1.1
bump version to 1.1.1

File last commit:

r112:998f0d14
r134:b9b70494 1.1.1 stable
Show More
admin-partitions-view.js
123 lines | 3.8 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;
vm.permanentPartitions = [];
vm.dailyPartitions = [];
vm.loading = {partitions: true};
vm.dailyChecked = false;
vm.permChecked = false;
vm.dailyConfirm = '';
vm.permConfirm = '';
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;
if (scope === 'dailyPartitions'){
toTest = 'dailyChecked';
}
else{
toTest = 'permChecked';
}
if (vm[toTest]) {
var val = true;
}
else {
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;
};
sectionViewResource.get({section:'admin_section', view: 'partitions'},
vm.loadPartitions);
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};
sectionViewResource.save({section:'admin_section',
view: 'partitions_remove'}, {
es_indices: es_indices,
pg_indices: pg_indices,
confirm: 'CONFIRM'
}, vm.loadPartitions);
}
}