diff options
author | Clement Ho <clemmakesapps@gmail.com> | 2019-04-05 23:35:24 +0300 |
---|---|---|
committer | Clement Ho <clemmakesapps@gmail.com> | 2019-04-05 23:35:24 +0300 |
commit | a5eb29c16045f5ae96ad107474f8fde974c3197e (patch) | |
tree | b1e4140a1ae79a47a1b5c0b19094e24c097b6365 | |
parent | 2210f5e8696693e1f36b6fa3f98c6bd0ca370fc0 (diff) | |
parent | 8906de37202d8631e6a4bca9a68d09b181502b0c (diff) |
Merge branch '60068-avoid-null-domain-help-text' into 'master'
Do not display Ingress IP help text when there isn’t an Ingress IP assigned
Closes #60068
See merge request gitlab-org/gitlab-ce!27057
-rw-r--r-- | app/assets/javascripts/clusters/clusters_bundle.js | 7 | ||||
-rw-r--r-- | changelogs/unreleased/60068-avoid-null-domain-help-text.yml | 5 | ||||
-rw-r--r-- | spec/javascripts/clusters/clusters_bundle_spec.js | 20 |
3 files changed, 26 insertions, 6 deletions
diff --git a/app/assets/javascripts/clusters/clusters_bundle.js b/app/assets/javascripts/clusters/clusters_bundle.js index c95d7608e37..a88e4b7b314 100644 --- a/app/assets/javascripts/clusters/clusters_bundle.js +++ b/app/assets/javascripts/clusters/clusters_bundle.js @@ -288,10 +288,11 @@ export default class Clusters { } toggleIngressDomainHelpText(ingressPreviousState, ingressNewState) { - const helpTextHidden = ingressNewState.status !== APPLICATION_STATUS.INSTALLED; - const domainSnippetText = `${ingressNewState.externalIp}${INGRESS_DOMAIN_SUFFIX}`; + const { externalIp, status } = ingressNewState; + const helpTextHidden = status !== APPLICATION_STATUS.INSTALLED || !externalIp; + const domainSnippetText = `${externalIp}${INGRESS_DOMAIN_SUFFIX}`; - if (ingressPreviousState.status !== ingressNewState.status) { + if (ingressPreviousState.status !== status) { this.ingressDomainHelpText.classList.toggle('hide', helpTextHidden); this.ingressDomainSnippet.textContent = domainSnippetText; } diff --git a/changelogs/unreleased/60068-avoid-null-domain-help-text.yml b/changelogs/unreleased/60068-avoid-null-domain-help-text.yml new file mode 100644 index 00000000000..5305b8584a8 --- /dev/null +++ b/changelogs/unreleased/60068-avoid-null-domain-help-text.yml @@ -0,0 +1,5 @@ +--- +title: Do not display Ingress IP help text when there isn’t an Ingress IP assigned +merge_request: 27057 +author: +type: fixed diff --git a/spec/javascripts/clusters/clusters_bundle_spec.js b/spec/javascripts/clusters/clusters_bundle_spec.js index 0d3dcc29f22..0a98df45b5d 100644 --- a/spec/javascripts/clusters/clusters_bundle_spec.js +++ b/spec/javascripts/clusters/clusters_bundle_spec.js @@ -300,9 +300,13 @@ describe('Clusters', () => { describe('toggleIngressDomainHelpText', () => { const { INSTALLED, INSTALLABLE, NOT_INSTALLABLE } = APPLICATION_STATUS; + let ingressPreviousState; + let ingressNewState; - const ingressPreviousState = { status: INSTALLABLE }; - const ingressNewState = { status: INSTALLED, externalIp: '127.0.0.1' }; + beforeEach(() => { + ingressPreviousState = { status: INSTALLABLE }; + ingressNewState = { status: INSTALLED, externalIp: '127.0.0.1' }; + }); describe(`when ingress application new status is ${INSTALLED}`, () => { beforeEach(() => { @@ -333,7 +337,7 @@ describe('Clusters', () => { }); describe('when ingress application new status and old status are the same', () => { - it('does not modify custom domain help text', () => { + it('does not display custom domain help text', () => { ingressPreviousState.status = INSTALLED; ingressNewState.status = ingressPreviousState.status; @@ -342,5 +346,15 @@ describe('Clusters', () => { expect(cluster.ingressDomainHelpText.classList.contains('hide')).toEqual(true); }); }); + + describe(`when ingress new status is ${INSTALLED} and there isn’t an ip assigned`, () => { + it('does not display custom domain help text', () => { + ingressNewState.externalIp = null; + + cluster.toggleIngressDomainHelpText(ingressPreviousState, ingressNewState); + + expect(cluster.ingressDomainHelpText.classList.contains('hide')).toEqual(true); + }); + }); }); }); |