diff --git a/src/views/empty-state.component.js b/src/views/empty-state.component.js index 367d29868..7db5e2f9d 100644 --- a/src/views/empty-state.component.js +++ b/src/views/empty-state.component.js @@ -107,7 +107,7 @@ angular.module('patternfly.views').component('pfEmptyState', { templateUrl: 'views/empty-state.html', controller: function ($filter) { 'use strict'; - var ctrl = this; + var ctrl = this, prevConfig; ctrl.defaultConfig = { title: 'No Items Available' @@ -121,7 +121,12 @@ angular.module('patternfly.views').component('pfEmptyState', { }; ctrl.updateConfig = function () { + prevConfig = angular.copy(ctrl.config); _.defaults(ctrl.config, ctrl.defaultConfig); + if (ctrl.config.helpLink && angular.isUndefined(ctrl.config.helpLink.url)) { + // if no url specified, set url to not redirect. ie. just do urlAction + ctrl.config.helpLink.url = "javascript:void(0)"; + } }; ctrl.$onChanges = function (changesObj) { @@ -130,6 +135,13 @@ angular.module('patternfly.views').component('pfEmptyState', { } }; + ctrl.$doCheck = function () { + // do a deep compare on config + if (!angular.equals(ctrl.config, prevConfig)) { + ctrl.updateConfig(); + } + }; + ctrl.hasMainActions = function () { var mainActions;