Skip to content

Commit c1594ad

Browse files
Merge pull request #697 from dtaylor113/empty-state-no-helplink-url
fix(pfEmptyState): Do not redirect when no helpLink url specified
2 parents 668ed10 + 0274412 commit c1594ad

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

src/views/empty-state.component.js

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ angular.module('patternfly.views').component('pfEmptyState', {
107107
templateUrl: 'views/empty-state.html',
108108
controller: function ($filter) {
109109
'use strict';
110-
var ctrl = this;
110+
var ctrl = this, prevConfig;
111111

112112
ctrl.defaultConfig = {
113113
title: 'No Items Available'
@@ -121,7 +121,12 @@ angular.module('patternfly.views').component('pfEmptyState', {
121121
};
122122

123123
ctrl.updateConfig = function () {
124+
prevConfig = angular.copy(ctrl.config);
124125
_.defaults(ctrl.config, ctrl.defaultConfig);
126+
if (ctrl.config.helpLink && angular.isUndefined(ctrl.config.helpLink.url)) {
127+
// if no url specified, set url to not redirect. ie. just do urlAction
128+
ctrl.config.helpLink.url = "javascript:void(0)";
129+
}
125130
};
126131

127132
ctrl.$onChanges = function (changesObj) {
@@ -130,6 +135,13 @@ angular.module('patternfly.views').component('pfEmptyState', {
130135
}
131136
};
132137

138+
ctrl.$doCheck = function () {
139+
// do a deep compare on config
140+
if (!angular.equals(ctrl.config, prevConfig)) {
141+
ctrl.updateConfig();
142+
}
143+
};
144+
133145
ctrl.hasMainActions = function () {
134146
var mainActions;
135147

0 commit comments

Comments
 (0)