Commit 10c9bd60 authored by a001188's avatar a001188
Browse files

Sort implemented

parent 02a7df6c
function search_ciTable(family_name){
$('#cmdb-table').jtable(createSearchCiTable(search_ciColumnDef(), family_name));
//**************************************************
// family_type: filterparamter, value from database
// family_name: from database, value from database
// sub_queries_included: if filter should be included in subqueries
//**************************************************
function ciTable(family_type, family_name, sub_queries_included){
$('#cmdb-table').jtable(createSearchCiTable(ciColumnDef(), family_type, family_name, sub_queries_included));
$('#cmdb-table').jtable('load');
}
function search_ciColumnDef(){
function ciColumnDef(){
var cd = {
prev: {
title: '',
......@@ -95,11 +102,11 @@ function search_ciColumnDef(){
function createSearchCiTable(ciColumnDef, family_name){
function createSearchCiTable(ciColumnDef, family_type, family_name, sub_queries_included){
var table = {
title: function (){
if(family_name !== 'Sök')
return 'Sök: ' + family_name;
return 'Sök: ' + family_type + family_name;
else
return 'Sök';
},
......@@ -120,7 +127,7 @@ function search_ciColumnDef(){
return $.Deferred(function ($dfd) {
$.ajax({
url: '/cmdb/api/v1/ci/search/list/' + family_name + '?jtStartIndex=' + jtParams.jtStartIndex + '&jtPageSize=' + jtParams.jtPageSize + '&jtSorting=' + jtParams.jtSorting,
url: '/cmdb/api/v1/ci/list/' + family_type + '/' + family_name + '?jtStartIndex=' + jtParams.jtStartIndex + '&jtPageSize=' + jtParams.jtPageSize + '&jtSorting=' + jtParams.jtSorting,
type: 'POST',
dataType: 'json',
data: postData,
......@@ -163,7 +170,7 @@ function createSearchCiChildTable(data, row){
actions: {
listAction: '/cmdb/api/v1/ci/child/list/' + data.record.ci_id
},
fields: search_ciColumnDef()
fields: ciColumnDef()
},
function (data) { //opened handler
data.childTable.jtable('load');
......@@ -193,7 +200,7 @@ function createSearchCiSiblingTable(data, row){
actions: {
listAction: '/cmdb/api/v1/ci/child/list/' + data.record.ci_parent_id
},
fields: search_ciColumnDef()
fields: ciColumnDef()
},
function (data) { //opened handler
data.childTable.jtable('load');
......@@ -223,7 +230,7 @@ function renderSearchCiParentTable (data) {
actions: {
listAction: '/cmdb/api/v1/ci/parent/list/' + data.record.ci_parent_id
},
fields: search_ciColumnDef()
fields: ciColumnDef()
},
function (data) { //opened handler
data.childTable.jtable('load');
......
......@@ -4,8 +4,15 @@ $(document).ready(function () {
if(ref.includes('/family-and-class/')){
structureTable();
}
if(ref.includes('/ec-ci/')){
ec_ciTable();
if(ref.includes('/ec-system-ci/')){
ciTable('IT-Tjänst','Drift av System',false);
// ec_ciTable();
}
if(ref.includes('/ec-file-ci/')){
ciTable('IT-Tjänst','Filtjänst',false);
}
if(ref.includes('/ec-office-ci/')){
ciTable('IT-Tjänst','Klientarbetsplats',false);
}
if(ref.includes('/tfo-ci/')){
tfo_ciTable();
......@@ -21,7 +28,10 @@ $(document).ready(function () {
accessNodesTable();
accessGraph(-1);
}
if(ref.includes('/person/')){
ciTable('','Anställd');
}
if(ref.includes('/search/')){
search_ciTable('Sök');
ciTable('All','Sök',false);
}
});
\ No newline at end of file
......@@ -135,7 +135,7 @@ function formateResult(req, res, result){
}
router.post('/search/list/:family_name', (req, res, next) => {
router.post('/list/:family_type/:family_name', (req, res, next) => {
var family_name = req.params['family_name'];
var sql = getSQLSearchQuery(SEARCH, family_name, req);
......
......@@ -25,11 +25,11 @@ block menu
a(href="#") IT-Tjänster
ul
li
a(href="/view/ec-ci/1") Drift av System (CI)
a(href="/view/ec-system-ci/3") Drift av System (CI)
li
a(href="/") Kontorsarbetsplats (CI) - Ej implementerad
a(href="/view/ec-office-ci/3") Kontorsarbetsplats (CI)
li
a(href="/") Filtjänst (CI) - Ej implementerad
a(href="/view/ec-file-ci/3") Filtjänst (CI)
li
a(href="#") Infrastruktur
ul
......@@ -46,7 +46,7 @@ block menu
li
a(href="/view/organisation/2") Organisation
li
a(href="/view/person/1") Person
a(href="/view/person/3") Person
li
a(href="/view/financial-account/1") Kontoplan
li
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment