diff --git a/modules/monitoring/application/views/scripts/list/services.phtml b/modules/monitoring/application/views/scripts/list/services.phtml
index ccb501d10..229b3f898 100644
--- a/modules/monitoring/application/views/scripts/list/services.phtml
+++ b/modules/monitoring/application/views/scripts/list/services.phtml
@@ -1,13 +1,12 @@
= $this->tabs->render($this); ?>
paginate();
$viewHelper = $this->getHelper('MonitoringState');
?>
= $this->sortControl->render($this); ?>
- = $this->paginationControl($paginator, null, null, array('preserve' => $this->preserve)) ?>
+ = $this->paginationControl($this->services, null, null, array('preserve' => $this->preserve)) ?>
@@ -20,7 +19,7 @@ $viewHelper = $this->getHelper('MonitoringState');
- fetchAll() as $service): ?>
+
href('monitoring/show/service',array(
'host' => $service->host_name,
diff --git a/modules/monitoring/application/views/scripts/show/host.phtml b/modules/monitoring/application/views/scripts/show/host.phtml
index fe8de35cf..347d52564 100644
--- a/modules/monitoring/application/views/scripts/show/host.phtml
+++ b/modules/monitoring/application/views/scripts/show/host.phtml
@@ -1,4 +1,5 @@
hostgroups)) {
foreach ($this->hostgroups as $name => $alias) {
diff --git a/public/js/icinga/componentLoader.js b/public/js/icinga/componentLoader.js
index 2b9817d25..e966b74ab 100644
--- a/public/js/icinga/componentLoader.js
+++ b/public/js/icinga/componentLoader.js
@@ -109,7 +109,7 @@ define(['jquery', 'logging', 'icinga/componentRegistry'], function ($, log, regi
type,
el,
function(cmp) {
- var id = registry.add(cmp, el.id, type);
+ var id = registry.add(cmp, type);
registry.markActive(id);
el.id = id;
finalize();
diff --git a/public/js/icinga/componentRegistry.js b/public/js/icinga/componentRegistry.js
index 197b6b0f4..aa4b0c84b 100644
--- a/public/js/icinga/componentRegistry.js
+++ b/public/js/icinga/componentRegistry.js
@@ -112,10 +112,8 @@ define(['jquery'], function($) {
*
* @returns {*|Array}
*/
- this.add = function(cmp, id, type) {
- if (!id){
- id = self.getId(cmp) || createId();
- }
+ this.add = function(cmp, type) {
+ var id = createId();
components[id] = {
cmp: cmp,
type: type,
diff --git a/public/js/icinga/components/container.js b/public/js/icinga/components/container.js
index 5d1cc1774..7a31a3a46 100644
--- a/public/js/icinga/components/container.js
+++ b/public/js/icinga/components/container.js
@@ -26,9 +26,23 @@
*/
// {{{ICINGA_LICENSE_HEADER}}}
-define(['jquery', 'logging', 'icinga/componentLoader', 'URIjs/URI', 'URIjs/URITemplate'], function($, logger, componentLoader, URI) {
+define(['jquery', 'logging', 'icinga/componentLoader', 'URIjs/URI', 'URIjs/URITemplate'],
+ function($, logger, componentLoader, URI) {
"use strict";
+ var Icinga;
+
+ /**
+ * Enumeration of possible container types
+ *
+ * @type {{GENERIC: string, MAIN: string, DETAIL: string}}
+ */
+ var CONTAINER_TYPES = {
+ 'GENERIC' : 'generic',
+ 'MAIN' : 'icingamain',
+ 'DETAIL': 'icingadetail'
+ };
+
/**
* Static reference to the main container, populated on the first 'getMainContainer' call
*
@@ -60,17 +74,6 @@ define(['jquery', 'logging', 'icinga/componentLoader', 'URIjs/URI', 'URIjs/URITe
*/
var Container = function(target) {
- /**
- * Enumeration of possible container types
- *
- * @type {{GENERIC: string, MAIN: string, DETAIL: string}}
- */
- var CONTAINER_TYPES = {
- 'GENERIC' : 'generic',
- 'MAIN' : 'icingamain',
- 'DETAIL': 'icingadetail'
- };
-
/**
* Set to true when no history changes should be made
*
@@ -113,8 +116,14 @@ define(['jquery', 'logging', 'icinga/componentLoader', 'URIjs/URI', 'URIjs/URITe
} else {
this.containerType = CONTAINER_TYPES.GENERIC;
}
+ this.containerDom.attr('data-icinga-href', this.getContainerHref());
};
+ /**
+ * Returns the window without the hostname
+ *
+ * @returns {string} path with query, search and hash
+ */
var getWindowLocationWithoutHost = function() {
return window.location.pathname + window.location.search + window.location.hash;
};
@@ -126,9 +135,9 @@ define(['jquery', 'logging', 'icinga/componentLoader', 'URIjs/URI', 'URIjs/URITe
*
* @returns {string} The Url of the main container
*/
- var getMainContainerHrefFromUrl = function() {
+ var getMainContainerHrefFromUrl = function(baseUrl) {
// main has the url without the icingadetail part
- var href = URI(getWindowLocationWithoutHost());
+ var href = URI(getWindowLocationWithoutHost(baseUrl));
href.removeQuery('detail');
return href.href();
};
@@ -141,8 +150,8 @@ define(['jquery', 'logging', 'icinga/componentLoader', 'URIjs/URI', 'URIjs/URITe
*
* @returns {string|undefined} The Url of the detail container or undefined if no detail container is active
*/
- var getDetailContainerHrefFromUrl = function() {
- var location = new URI(getWindowLocationWithoutHost());
+ var getDetailContainerHrefFromUrl = function(baseUrl) {
+ var location = new URI(baseUrl);
var href = URI.parseQuery(location.query()).detail;
if (!href) {
return;
@@ -165,17 +174,18 @@ define(['jquery', 'logging', 'icinga/componentLoader', 'URIjs/URI', 'URIjs/URITe
*
* @returns {String|undefined} The Url of the container or undefined if the container has no Url set
*/
- this.getContainerHref = function() {
+ this.getContainerHref = function(baseUrl) {
+ baseUrl = baseUrl || getWindowLocationWithoutHost();
switch (this.containerType) {
case CONTAINER_TYPES.MAIN:
- return getMainContainerHrefFromUrl();
+ return getMainContainerHrefFromUrl(baseUrl);
case CONTAINER_TYPES.DETAIL:
- return getDetailContainerHrefFromUrl();
+ return getDetailContainerHrefFromUrl(baseUrl);
case CONTAINER_TYPES.GENERIC:
if (this.containerDom.attr('data-icinga-href')) {
return URI(this.containerDom.attr('data-icinga-href'));
} else {
- return URI(getWindowLocationWithoutHost()).href();
+ return URI(baseUrl).href();
}
}
};
@@ -187,8 +197,8 @@ define(['jquery', 'logging', 'icinga/componentLoader', 'URIjs/URI', 'URIjs/URITe
*
* @returns {URI} The modified URI.js containing the new main and the current detail link
*/
- var setMainContainerHref = function(url) {
- var detail = getDetailContainerHrefFromUrl();
+ var setMainContainerHref = function(url, baseUrl) {
+ var detail = getDetailContainerHrefFromUrl(baseUrl);
if (detail) {
url.addQuery('detail', detail);
}
@@ -202,8 +212,8 @@ define(['jquery', 'logging', 'icinga/componentLoader', 'URIjs/URI', 'URIjs/URITe
*
* @returns {URI} The modified URI.js containing the new detail and the current main link
*/
- var setDetailContainerHref = function(url) {
- var location = new URI(window.location.href);
+ var setDetailContainerHref = function(url, baseUrl) {
+ var location = new URI(baseUrl);
location.removeQuery('detail');
if (typeof url !== 'undefined') { // no detail Url given
location.addQuery('detail', url);
@@ -219,23 +229,27 @@ define(['jquery', 'logging', 'icinga/componentLoader', 'URIjs/URI', 'URIjs/URITe
* but the containers data-icinga-href still points to the containers element).
*
* @param {String|URI} url An Url string or a URI.js object representing the new Url for this container
+ *
+ * @return {String} url The new Url of the application (main and detail)
*/
- this.updateContainerHref = function(url) {
+ this.updateContainerHref = function(url, baseUrl) {
+ baseUrl = baseUrl || getWindowLocationWithoutHost();
if (typeof url === "string") {
url = URI(url);
}
var containerUrl, windowUrl;
switch (this.containerType) {
case CONTAINER_TYPES.MAIN:
- windowUrl = setMainContainerHref(url);
+ windowUrl = setMainContainerHref(url, baseUrl);
containerUrl = windowUrl.clone().removeQuery('detail');
break;
case CONTAINER_TYPES.DETAIL:
- windowUrl = setDetailContainerHref(url);
+ windowUrl = setDetailContainerHref(url, baseUrl);
containerUrl = url;
break;
case CONTAINER_TYPES.GENERIC:
containerUrl = url;
+ windowUrl = baseUrl;
break;
}
@@ -244,56 +258,10 @@ define(['jquery', 'logging', 'icinga/componentLoader', 'URIjs/URI', 'URIjs/URITe
} else {
this.containerDom.removeAttr('data-icinga-href');
}
- if (!this.freezeHistory) {
- History.pushState({container: this.containerDom.attr('id')}, document.title, windowUrl.href());
- }
- return windowUrl;
+
+ return windowUrl.href();
};
- /**
- * Synchronize the container with the currently active window Url
- *
- * This is called mostly after changes in the history and makes sure the container contains the same content
- * as the Url refers to. If the Url is the same as the Url in the container (the one in the data-icinga-href
- * attribute), the container will be untouched, otherwise it's content and data-icinga-href attribute will be
- * updated with the Url from the window.
- */
- this.syncWithCurrentUrl = function() {
- if (this.containerType === CONTAINER_TYPES.GENERIC) {
- return; // generic containers would require this method to be specialised
- }
- // Catch initial page loading: Here no data-icinga-href is set and no url is given, so we're safe to ignore this
- if (typeof this.containerDom.attr('data-icinga-href') === 'undefined' &&
- typeof this.getContainerHref() === 'undefined') {
- return;
- }
- // This is the case when an detail is removed on history back
- if (typeof this.getContainerHref() === 'undefined' && typeof this.containerDom.attr('data-icinga-href') !== 'undefined') {
- this.containerDom.removeAttr('data-icinga-href');
- this.containerDom.empty();
- this.hideDetail();
- logger.debug("Hiding detail panel on Url change");
- return;
- }
-
- if (!URI(this.getContainerHref()).equals(this.containerDom.attr('data-icinga-href'))) {
- logger.debug(
- "Applying URL change for ", this.containerType,
- "from", this.getContainerHref(),
- "to", this.containerDom.attr('data-icinga-href')
- );
-
- if (typeof this.containerDom.attr('data-icinga-href') === 'undefined') { // container is empty now
- //this.replaceDom('');
- } else {
- this.freezeHistory = true;
- this.replaceDomFromUrl(this.getContainerHref());
- this.freezeHistory = false;
- }
- } else {
- logger.debug("No action performed on Url change, same Url for ", this.containerType);
- }
- };
/**
* Load the provided url, stop all pending requests for this container and call replaceDom for the returned html
@@ -303,26 +271,7 @@ define(['jquery', 'logging', 'icinga/componentLoader', 'URIjs/URI', 'URIjs/URITe
* @param {String, URI} url The Url to load or and URI.js object encapsulating it
*/
this.replaceDomFromUrl = function(url) {
- if (!Modernizr.history) {
- window.location.href = this.updateContainerHref(url);
- }
-
- this.updateContainerHref(url);
- var scope = this;
- if (this.containerDom.pending) {
- this.containerDom.pending.abort();
- }
- this.containerDom.pending = $.ajax({
- url: url,
- success: function(domNodes) {
- scope.replaceDom(domNodes);
- },
- error: function(response) {
- if (response.status === 401) {
- window.location.reload();
- }
- }
- });
+ Icinga.replaceBodyFromUrl(this.updateContainerHref(url));
};
/**
@@ -340,8 +289,7 @@ define(['jquery', 'logging', 'icinga/componentLoader', 'URIjs/URI', 'URIjs/URITe
* @see registerOnUpdate
*/
this.replaceDom = function(domNodes, keepLayout) {
- var newDom = $('#icingamain', domNodes);
- this.containerDom.empty().append(newDom.children());
+ this.containerDom.empty().append(domNodes);
this.containerDom.trigger('updated', [domNodes]);
componentLoader.load();
if (!keepLayout) {
@@ -351,6 +299,8 @@ define(['jquery', 'logging', 'icinga/componentLoader', 'URIjs/URI', 'URIjs/URITe
}
};
+
+
/**
* Register a method to be called when this container is updated
*
@@ -461,7 +411,7 @@ define(['jquery', 'logging', 'icinga/componentLoader', 'URIjs/URI', 'URIjs/URITe
* more specific handler, causes an update of the main container if it's not external or a browser behaviour link
* (those starting with '#').
*/
- $('body').on('click', '#icingamain', function(ev) {
+ $('body').on('click', '#icingamain, #icingadetail', function(ev) {
var targetEl = ev.target || ev.toElement || ev.relatedTarget;
if (targetEl.tagName.toLowerCase() !== 'a') {
return true;
@@ -470,12 +420,27 @@ define(['jquery', 'logging', 'icinga/componentLoader', 'URIjs/URI', 'URIjs/URITe
if (Container.isExternalLink($(targetEl).attr('href'))) {
return true;
} else {
- Container.getMainContainer().replaceDomFromUrl(URI($(targetEl).attr('href')).href());
+ var container = new Container($(targetEl));
+ // detail links render to main by default;
+ Icinga.replaceBodyFromUrl(URI($(targetEl).attr('href')).href());
+
ev.preventDefault();
ev.stopPropagation();
return false;
}
});
}
+
+ /**
+ * Injects the icinga object into the Container class
+ *
+ * This can't be done via requirejs as we would end up in circular references
+ *
+ * @param {Icinga} icingaObj The Icinga object to use for reloading
+ */
+ Container.setIcinga = function(icingaObj) {
+ Icinga = icingaObj;
+ };
+
return Container;
});
\ No newline at end of file
diff --git a/public/js/icinga/components/form.js b/public/js/icinga/components/form.js
index 8a94f3e1b..c76f0b372 100644
--- a/public/js/icinga/components/form.js
+++ b/public/js/icinga/components/form.js
@@ -97,13 +97,14 @@ define(['jquery'], function($) {
form.change(function(changed) {
if ($(changed.target).attr('data-icinga-form-autosubmit')) {
form.clearModificationFlag();
+ form.submit();
} else {
form.setModificationFlag();
}
});
// submissions should clear the modification flag
form.submit(function() {
- form.clearModificationFlag()
+ form.clearModificationFlag();
});
};
@@ -127,7 +128,12 @@ define(['jquery'], function($) {
*/
return function(targetForm) {
var form = getFormObject(targetForm);
+
+
registerFormEventHandler(form);
registerLeaveConfirmationHandler(form);
+
+ // Remove DOM level onchange, we registered proper jQuery listeners for them
+ $('[data-icinga-form-autosubmit]').removeAttr('onchange');
};
});
\ No newline at end of file
diff --git a/public/js/icinga/components/mainDetailGrid.js b/public/js/icinga/components/mainDetailGrid.js
index 1a0d00e39..76ebf0881 100644
--- a/public/js/icinga/components/mainDetailGrid.js
+++ b/public/js/icinga/components/mainDetailGrid.js
@@ -25,8 +25,8 @@
* @author Icinga Development Team
*/
// {{{ICINGA_LICENSE_HEADER}}}
-define(['components/app/container', 'jquery', 'logging', 'icinga/util/async', 'URIjs/URI', 'URIjs/URITemplate'],
-function(Container, $, logger, async, URI) {
+define(['components/app/container', 'jquery', 'logging', 'URIjs/URI', 'URIjs/URITemplate'],
+function(Container, $, logger, URI) {
"use strict";
/**
@@ -120,7 +120,6 @@ function(Container, $, logger, async, URI) {
*/
this.registerTableLinks = function(domContext) {
domContext = domContext || contentNode;
- this.container.disableClickHandler();
$('tbody tr', domContext).on('click', function(ev) {
var targetEl = ev.target || ev.toElement || ev.relatedTarget;
@@ -148,18 +147,27 @@ function(Container, $, logger, async, URI) {
* current container
*/
this.registerControls = function() {
- controlForms.on('submit', (function(evt) {
- // append the form's parameters to the current container href
- var form = $(evt.currentTarget);
- var url = URI(this.container.getContainerHref());
+
+ controlForms.on('submit', function(evt) {
+ var form = $(this);
+ var container = (new Container(this));
+ var url = URI(container.getContainerHref());
url.search(URI.parseQuery(form.serialize()));
- // reload this container
- this.container.replaceDomFromUrl(url);
+ container.replaceDomFromUrl(url.href());
evt.preventDefault();
evt.stopPropagation();
return false;
- }).bind(this));
+
+ });
+ $('.pagination li a', contentNode).on('click', function() {
+ Container.hideDetail();
+ });
+ };
+
+ var getSelectedRows = function() {
+ return $('a[href="' + Container.getDetailContainer().getContainerHref() + '"]', determineContentTable()).
+ parentsUntil('table', 'tr');
};
/**
@@ -167,9 +175,7 @@ function(Container, $, logger, async, URI) {
*/
this.syncSelectionWithDetail = function() {
$('tr', contentNode).removeClass('active');
- var selection = $('a[href="' + Container.getDetailContainer().getContainerHref() + '"]', contentNode).
- parentsUntil('table', 'tr');
- selection.addClass('active');
+ getSelectedRows().addClass('active');
};
/**
@@ -184,10 +190,8 @@ function(Container, $, logger, async, URI) {
*/
this.construct = function(target) {
this.container = new Container(target);
- logger.debug("Registering table events for ", this.container.containerType);
controlForms = determineControlForms();
contentNode = determineContentTable();
-
this.registerControls();
this.registerTableLinks();
this.registerHistoryChanges();
diff --git a/public/js/icinga/icinga.js b/public/js/icinga/icinga.js
index 4f460af15..977d67767 100755
--- a/public/js/icinga/icinga.js
+++ b/public/js/icinga/icinga.js
@@ -29,11 +29,10 @@
define([
'jquery',
'logging',
- 'icinga/util/async',
'icinga/componentLoader',
'components/app/container',
'URIjs/URI'
-], function ($, log, async, components, Container, URI) {
+], function ($, log, components, Container, URI) {
'use strict';
/**
@@ -45,7 +44,9 @@ define([
var initialize = function () {
components.load();
+ ignoreHistoryChanges = true;
registerGenericHistoryHandler();
+ ignoreHistoryChanges = false;
log.debug("Initialization finished");
};
@@ -60,15 +61,8 @@ define([
if (ignoreHistoryChanges) {
return;
}
- log.debug(URI(History.getState().url).relativeTo(lastUrl).href());
- var relativeURLPart = URI(History.getState().url).relativeTo(lastUrl).href();
- if (relativeURLPart !== "" && relativeURLPart[0] === '?' ) {
- // same controller, different parameters, so only update the container
- Container.getMainContainer().syncWithCurrentUrl();
- Container.getDetailContainer().syncWithCurrentUrl();
- } else {
- gotoUrl(History.getState().url);
- }
+
+ gotoUrl(History.getState().url);
lastUrl = URI(window.location.href);
});
};
@@ -78,15 +72,18 @@ define([
if (typeof document.body.pending !== 'undefined') {
document.body.pending.abort();
}
- $.ajax({
+ if (typeof href === 'string') {
+ href = URI(href);
+ }
+ document.body.pending = $.ajax({
success: function(domNodes) {
+ $('body').empty().append(jQuery.parseHTML(domNodes));
ignoreHistoryChanges = true;
- History.pushState({}, document.title, href);
- $('body').empty().append($(domNodes));
+ History.pushState({}, document.title, href.href());
ignoreHistoryChanges = false;
components.load();
},
- url: href
+ url: href.href()
});
return false;
@@ -110,11 +107,11 @@ define([
});
}
$(document).ready(initialize.bind(this));
- return {
-
- components: components,
- gotoUrl: gotoUrl
- };
+ Container.setIcinga(this);
+ this.components = components;
+ this.replaceBodyFromUrl = gotoUrl;
};
+
+
return new Icinga();
});
diff --git a/public/js/main.js b/public/js/main.js
index 924625319..6bdf90485 100755
--- a/public/js/main.js
+++ b/public/js/main.js
@@ -22,7 +22,7 @@ requirejs.config({
define(['jquery', 'history'], function ($) {
- requirejs(['bootstrap', 'jqueryPlugins/wookmark'], function() {
+ requirejs(['bootstrap'], function() {
requirejs(['datetimepicker']);
});
diff --git a/test/js/test/icinga/componentTest.js b/test/js/test/icinga/componentTest.js
index 90b75c77c..71ec5536d 100644
--- a/test/js/test/icinga/componentTest.js
+++ b/test/js/test/icinga/componentTest.js
@@ -81,7 +81,7 @@ describe('Component loader', function() {
});
});
- it('Component load with user-defined id', function() {
+ xit('Component load with user-defined id', function() {
setUp();
addComponent('app/component2','some-id');
diff --git a/test/js/test/icinga/components/containerTest.js b/test/js/test/icinga/components/containerTest.js
index 85cd9dba3..ccc5cd289 100644
--- a/test/js/test/icinga/components/containerTest.js
+++ b/test/js/test/icinga/components/containerTest.js
@@ -73,8 +73,11 @@ describe('The container component', function() {
* Test dom selectors and instance creation
*/
it('should provide access to the main and detail component', function() {
- requireNew('icinga/components/container.js');
createDOM();
+ rjsmock.registerDependencies({
+ 'URIjs/URI' : URI
+ });
+ requireNew('icinga/components/container.js');
var Container = rjsmock.getDefine();
should.exist(Container.getMainContainer().containerDom, 'Assert that the main container has an DOM attached');
should.exist(Container.getDetailContainer().containerDom, 'Assert that the detail container has an DOM attached');
@@ -94,62 +97,31 @@ describe('The container component', function() {
requireNew('icinga/components/container.js');
createDOM();
var Container = rjsmock.getDefine();
- Container.getMainContainer().updateContainerHref('/some/other/url?test');
+ var url = Container.getMainContainer().updateContainerHref('/some/other/url?test');
+ window.setWindowUrl(url);
Container.getMainContainer().containerDom.attr('data-icinga-href').should.equal('/some/other/url?test');
- window.location.href.should.equal(
+ url.should.equal(
'/some/other/url?test',
'Assert the main container updating the url correctly');
- Container.getDetailContainer().updateContainerHref('/some/detail/url?test');
+ url = Container.getDetailContainer().updateContainerHref('/some/detail/url?test');
+ window.setWindowUrl(url);
+
Container.getDetailContainer().containerDom.attr('data-icinga-href').should.equal('/some/detail/url?test');
- window.location.href.should.equal(
+ url.should.equal(
'/some/other/url?test&detail=' + encodeURIComponent('/some/detail/url?test'),
'Assert the detail container only updating the "detail" portion of the URL'
);
- Container.getMainContainer().updateContainerHref('/some/other2/url?test=test');
+ url = Container.getMainContainer().updateContainerHref('/some/other2/url?test=test');
+
+ window.setWindowUrl(Container.getMainContainer().getContainerHref(window.location.href));
Container.getMainContainer().containerDom.attr('data-icinga-href').should.equal('/some/other2/url?test=test');
- window.location.href.should.equal(
+ url.should.equal(
'/some/other2/url?test=test&detail=' + encodeURIComponent('/some/detail/url?test'),
'Assert the main container keeping the detail portion untouched if being assigned a new URL'
);
});
- /**
- * Test synchronization with Url
- */
- it('should be able to sync correctly with the current url if the URL changed', function() {
- rjsmock.registerDependencies({
- 'URIjs/URI' : URI,
- 'icinga/componentLoader' : {
- load: function() {}
- }
- });
- requireNew('icinga/components/container.js');
- createDOM();
-
- var Container = rjsmock.getDefine();
- var containerModified = false;
-
- Container.getMainContainer().updateContainerHref('/my/test/url?test=1');
- Container.getMainContainer().registerOnUpdate(function() {
- containerModified = true;
- });
-
- window.setWindowUrl('/my/test/url?test=2');
- Container.getMainContainer().syncWithCurrentUrl();
- Container.getMainContainer().containerDom.attr('data-icinga-href').should.equal('/my/test/url?test=2');
- containerModified.should.equal(true);
- containerModified = false;
-
- Container.getMainContainer().syncWithCurrentUrl();
- // URL hasn't changed, so this should not return true
- containerModified.should.equal(false);
-
- window.setWindowUrl('/my/test/url?test=2&detail=test');
- Container.getMainContainer().syncWithCurrentUrl();
- // URL is not modified for main container, so this should not return true
- containerModified.should.equal(false);
- });
});
diff --git a/test/js/test/icinga/registryTest.js b/test/js/test/icinga/registryTest.js
index 14cb6cb93..2449f1ef6 100644
--- a/test/js/test/icinga/registryTest.js
+++ b/test/js/test/icinga/registryTest.js
@@ -30,7 +30,7 @@ describe('Component registry',function() {
cleanTestDom();
});
- it('Existing ids are preserved', function() {
+ xit('Existing ids are preserved', function() {
setUp();
registry.add({}, 'user-defined-id', null).should.equal('user-defined-id');
@@ -41,10 +41,6 @@ describe('Component registry',function() {
it('Components are correctly added to the library', function() {
setUp();
- var cmp1 = { component: "cmp1" };
- registry.add(cmp1, 'user-defined-id', null);
- registry.getById('user-defined-id').should.equal(cmp1);
-
var cmp2 = { component: "cmp2" };
registry.add(cmp2, null, null);
registry.getById('icinga-component-0').should.equal(cmp2);
@@ -52,7 +48,10 @@ describe('Component registry',function() {
cleanTestDom();
});
- it('getId(component) should return the components assigned id.', function() {
+ /**
+ * Not supported anymore
+ */
+ xit('getId(component) should return the components assigned id.', function() {
setUp();
var cmp1 = { component: "cmp1" };
@@ -72,13 +71,13 @@ describe('Component registry',function() {
setUp();
var cmp1 = { component: "some/type" };
- registry.add(cmp1, null, 'some/type');
+ registry.add(cmp1,'some/type');
var cmp2 = { component: "some/type" };
- registry.add(cmp2, null, "some/type");
+ registry.add(cmp2, "some/type");
var cmp3 = { component: "other/type" };
- registry.add(cmp3, null, "other/type");
+ registry.add(cmp3, "other/type");
var cmps = registry.getByType('some/type');
cmps.length.should.equal(2);
diff --git a/test/js/testlib/historymock.js b/test/js/testlib/historymock.js
index bbefd6467..067dcbf4e 100644
--- a/test/js/testlib/historymock.js
+++ b/test/js/testlib/historymock.js
@@ -21,6 +21,11 @@ var URI = require('URIjs');
var states = [];
+ /**
+ * Api for setting the window URL
+ *
+ * @param {string} url The new url to use for window.location
+ */
window.setWindowUrl = function(url) {
var url = URI(url);
window.location.protocol = url.protocol();
|