All Downloads are FREE. Search and download functionalities are using the official Maven repository.

res.ui.services.js Maven / Gradle / Ivy

Go to download

Web Based Management Console for OSGi Frameworks. See http://felix.apache.org/site/apache-felix-web-console.html for more information on this bundle.

There is a newer version: 5.0.8
Show newest version
/*
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You 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.
 */
var tableEntryTemplate = false;
var tableBody = false;

function unescapeXML(str){
return str.replace(/&/g,"&").replace(/>/g,">").replace( /</g,"<").replace(/"/g,"\"").replace(/'/g,"'");
}
function renderFilter(filterString) {
$('.servicesFilter').val(unescapeXML(filterString));
}
function renderData(eventData) {
	$('.statline').empty().append(i18n.statline.msgFormat(eventData.serviceCount));
	$('#plugin_table > tbody > tr').remove();
	for ( var idx in eventData.data) {
		entry(eventData.data[idx]);
	}
	if (drawDetails) {
		renderDetails(eventData);
	}
}

function entry( /* Object */dataEntry) {
	var id = dataEntry.id;
	var name = dataEntry.id;

	var _ = tableEntryTemplate.clone().attr('id', 'entry' + id).appendTo(tableBody);
	_.find('.bIcon').attr('id', 'img' + id).click(function() {
		showDetails(id);
	}).after(drawDetails ? name : ('' + name + ''));
	  
	_.find('td:eq(1)').text(dataEntry.types);
	_.find('td:eq(2)').html('' + dataEntry.bundleSymbolicName + ' (' + dataEntry.bundleId + ')' );
	_.find('td:eq(3)').text(dataEntry.ranking);
}

function showDetails(id) {
	$.get(pluginRoot + '/' + id + '.json', null, function(data) {
		renderDetails(data);
	}, 'json');
}

function hideDetails(id) {
	$('#img' + id).each(function() {
		$('#pluginInlineDetails' + id).remove();
		$(this).
			removeClass('ui-icon-triangle-1-w').//left
			removeClass('ui-icon-triangle-1-s').//down
			addClass('ui-icon-triangle-1-e').//right
			unbind('click').click(function() {showDetails(id)});
	});
}
function renderDetails(data) {
	data = data.data[0];
	$('#entry' + data.id + ' > td').eq(1).append('
'); $('#img' + data.id).each(function() { if (drawDetails) { var ref = window.location.pathname; ref = ref.substring(0, ref.lastIndexOf('/')); $(this). removeClass('ui-icon-triangle-1-e').//right removeClass('ui-icon-triangle-1-s').//down addClass('ui-icon-triangle-1-w').//left attr('title', i18n.back). unbind('click').click(function() {window.location = ref;}); } else { $(this). removeClass('ui-icon-triangle-1-w').//left removeClass('ui-icon-triangle-1-e').//right addClass('ui-icon-triangle-1-s').//down attr('title', i18n.detailsHide). unbind('click').click(function() {hideDetails(data.id)}); } }); var details = ""; if (data.props) { details += renderObjectAsTable(data.props); } if (data.usingBundles) { details += renderUsingBundlesAsTable(data.usingBundles); } if (details) { details = '' + details + '
'; $('#pluginInlineDetails' + data.id).append( details ); } } function renderObjectAsTable(/* Object*/ details) { var txt = ''; for (var idx in details) { var prop = details[idx]; txt += '' + prop.key + ''; if (typeof prop.value !== 'undefined') { if ($.isArray(prop.value)) { var i = 0; for ( var pi in prop.value) { var value = prop.value[pi]; if (i > 0) { txt = txt + '
'; } txt = txt + value; i++; } } else { txt = txt + prop.value; } } else { txt = txt + '\u00a0'; } txt = txt + ''; } return txt; } function renderUsingBundlesAsTable(/* Object[] */ bundles) { var txt = ''; for (var idx in bundles) { var bundle = bundles[idx]; txt += '' + bundle.bundleSymbolicName + ' (' + bundle.bundleId + ')' + '
'; } if (txt) { txt = '' + i18n.usingBundles + '' + txt + ''; } return txt; } $(document).ready(function() { tableBody = $('#plugin_table tbody'); tableEntryTemplate = tableBody.find('tr').clone(); tableBody.empty(); renderFilter(filter); renderData(data); $('#plugin_table').tablesorter( { headers : { 0 : { sorter : 'digit' }, 3 : { sorter : 'digit' } }, sortList : [ [ 1, 0 ] ], textExtraction : mixedLinksExtraction }); });




© 2015 - 2024 Weber Informatics LLC | Privacy Policy