Commit 3619c917 authored by Filipa Lacerda's avatar Filipa Lacerda

Adds missing links, uses value instead of placeholder in input field and properly sets the ip key

parent 7efb2851
...@@ -37,10 +37,11 @@ export default class Clusters { ...@@ -37,10 +37,11 @@ export default class Clusters {
clusterStatusReason, clusterStatusReason,
helpPath, helpPath,
ingressHelpPath, ingressHelpPath,
ingressDnsHelpPath,
} = document.querySelector('.js-edit-cluster-form').dataset; } = document.querySelector('.js-edit-cluster-form').dataset;
this.store = new ClustersStore(); this.store = new ClustersStore();
this.store.setHelpPaths(helpPath, ingressHelpPath); this.store.setHelpPaths(helpPath, ingressHelpPath, ingressDnsHelpPath);
this.store.setManagePrometheusPath(managePrometheusPath); this.store.setManagePrometheusPath(managePrometheusPath);
this.store.updateStatus(clusterStatus); this.store.updateStatus(clusterStatus);
this.store.updateStatusReason(clusterStatusReason); this.store.updateStatusReason(clusterStatusReason);
...@@ -98,6 +99,7 @@ export default class Clusters { ...@@ -98,6 +99,7 @@ export default class Clusters {
helpPath: this.state.helpPath, helpPath: this.state.helpPath,
ingressHelpPath: this.state.ingressHelpPath, ingressHelpPath: this.state.ingressHelpPath,
managePrometheusPath: this.state.managePrometheusPath, managePrometheusPath: this.state.managePrometheusPath,
ingressDnsHelpPath: this.state.ingressDnsHelpPath,
}, },
}); });
}, },
......
...@@ -148,10 +148,7 @@ ...@@ -148,10 +148,7 @@
</div> </div>
<div <div
class="table-section table-button-footer section-align-top" class="table-section table-button-footer section-align-top"
:class="{ :class="{ 'section-20': showManageButton, 'section-15': !showManageButton }"
'section-20': showManageButton,
'section-15': !showManageButton,
}"
role="gridcell" role="gridcell"
> >
<div <div
......
...@@ -28,6 +28,11 @@ ...@@ -28,6 +28,11 @@
required: false, required: false,
default: '', default: '',
}, },
ingressDnsHelpPath: {
type: String,
required: false,
default: '',
},
managePrometheusPath: { managePrometheusPath: {
type: String, type: String,
required: false, required: false,
...@@ -51,6 +56,9 @@ ...@@ -51,6 +56,9 @@
ingressInstalled() { ingressInstalled() {
return this.applications.ingress.status === APPLICATION_INSTALLED; return this.applications.ingress.status === APPLICATION_INSTALLED;
}, },
ingressExternalIp() {
return this.applications.ingress.externalIp;
},
ingressDescription() { ingressDescription() {
const extraCostParagraph = sprintf( const extraCostParagraph = sprintf(
_.escape(s__( _.escape(s__(
...@@ -165,19 +173,19 @@ ...@@ -165,19 +173,19 @@
{{ s__("ClusterIntegration| Ingress IP Address") }} {{ s__("ClusterIntegration| Ingress IP Address") }}
</label> </label>
<div <div
v-if="applications.ingress.external_ip" v-if="ingressExternalIp"
class="input-group" class="input-group"
> >
<input <input
type="text" type="text"
id="ipAddress" id="ipAddress"
class="form-control js-select-on-focus" class="form-control"
:placeholder="applications.ingress.external_ip" :placeholder="ingressExternalIp"
readonly readonly
/> />
<span class="input-group-btn"> <span class="input-group-btn">
<clipboard-button <clipboard-button
:text="applications.ingress.external_ip" :text="ingressExternalIp"
:title="s__('ClusterIntegration|Copy Ingress IP Address')" :title="s__('ClusterIntegration|Copy Ingress IP Address')"
css-class="btn btn-default js-clipboard-btn" css-class="btn btn-default js-clipboard-btn"
/> />
...@@ -194,14 +202,14 @@ ...@@ -194,14 +202,14 @@
</div> </div>
<p <p
v-if="!applications.ingress.external_ip" v-if="!ingressExternalIp"
class="settings-message js-no-ip-message" class="settings-message js-no-ip-message"
> >
{{ s__(`ClusterIntegration|The IP address is in process {{ s__(`ClusterIntegration|The IP address is still in
to be assigned, please check your Kubernetes the process of being assigned, please check your Kubernetes
cluster or Quotas on GKE if it takes a long time.`) }} cluster or Quotas on GKE if it takes a long time.`) }}
<a <a
href="TODO" :href="ingressHelpPath"
target="_blank" target="_blank"
rel="noopener noreferrer" rel="noopener noreferrer"
> >
...@@ -214,7 +222,7 @@ ...@@ -214,7 +222,7 @@
generated IP address in order to access generated IP address in order to access
your application after it has been deployed.`) }} your application after it has been deployed.`) }}
<a <a
href="TODO" :href="ingressDnsHelpPath"
target="_blank" target="_blank"
rel="noopener noreferrer" rel="noopener noreferrer"
> >
......
...@@ -21,6 +21,7 @@ export default class ClusterStore { ...@@ -21,6 +21,7 @@ export default class ClusterStore {
statusReason: null, statusReason: null,
requestStatus: null, requestStatus: null,
requestReason: null, requestReason: null,
externalIp: null,
}, },
runner: { runner: {
title: s__('ClusterIntegration|GitLab Runner'), title: s__('ClusterIntegration|GitLab Runner'),
...@@ -40,9 +41,10 @@ export default class ClusterStore { ...@@ -40,9 +41,10 @@ export default class ClusterStore {
}; };
} }
setHelpPaths(helpPath, ingressHelpPath) { setHelpPaths(helpPath, ingressHelpPath, ingressDnsHelpPath) {
this.state.helpPath = helpPath; this.state.helpPath = helpPath;
this.state.ingressHelpPath = ingressHelpPath; this.state.ingressHelpPath = ingressHelpPath;
this.state.ingressDnsHelpPath = ingressDnsHelpPath;
} }
setManagePrometheusPath(managePrometheusPath) { setManagePrometheusPath(managePrometheusPath) {
...@@ -64,6 +66,7 @@ export default class ClusterStore { ...@@ -64,6 +66,7 @@ export default class ClusterStore {
updateStateFromServer(serverState = {}) { updateStateFromServer(serverState = {}) {
this.state.status = serverState.status; this.state.status = serverState.status;
this.state.statusReason = serverState.status_reason; this.state.statusReason = serverState.status_reason;
serverState.applications.forEach((serverAppEntry) => { serverState.applications.forEach((serverAppEntry) => {
const { const {
name: appId, name: appId,
...@@ -76,6 +79,10 @@ export default class ClusterStore { ...@@ -76,6 +79,10 @@ export default class ClusterStore {
status, status,
statusReason, statusReason,
}; };
if (appId === 'ingress') {
this.state.applications.ingress.externalIp = serverAppEntry.external_ip;
}
}); });
} }
} }
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
cluster_status_reason: @cluster.status_reason, cluster_status_reason: @cluster.status_reason,
help_path: help_page_path('user/project/clusters/index.md', anchor: 'installing-applications'), help_path: help_page_path('user/project/clusters/index.md', anchor: 'installing-applications'),
ingress_help_path: help_page_path('user/project/clusters/index.md', anchor: 'getting-the-external-ip-address'), ingress_help_path: help_page_path('user/project/clusters/index.md', anchor: 'getting-the-external-ip-address'),
ingress_dns_help_path: help_page_path('topics/autodevops/quick_start_guide.md', anchor: 'point-dns-at-cluster-ip'),
manage_prometheus_path: edit_project_service_path(@cluster.project, 'prometheus') } } manage_prometheus_path: edit_project_service_path(@cluster.project, 'prometheus') } }
.js-cluster-application-notice .js-cluster-application-notice
......
...@@ -54,14 +54,13 @@ describe('Applications', () => { ...@@ -54,14 +54,13 @@ describe('Applications', () => {
ingress: { ingress: {
title: 'Ingress', title: 'Ingress',
status: 'installed', status: 'installed',
external_ip: '0.0.0.0', externalIp: '0.0.0.0',
}, },
helm: { title: 'Helm Tiller' }, helm: { title: 'Helm Tiller' },
runner: { title: 'GitLab Runner' }, runner: { title: 'GitLab Runner' },
prometheus: { title: 'Prometheus' }, prometheus: { title: 'Prometheus' },
}, },
}); });
expect( expect(
vm.$el.querySelector('#ipAddress').getAttribute('placeholder'), vm.$el.querySelector('#ipAddress').getAttribute('placeholder'),
).toEqual('0.0.0.0'); ).toEqual('0.0.0.0');
...@@ -92,7 +91,7 @@ describe('Applications', () => { ...@@ -92,7 +91,7 @@ describe('Applications', () => {
expect( expect(
vm.$el.querySelector('.js-no-ip-message').textContent.replace(/\n(\s)+/g, ' ').trim(), vm.$el.querySelector('.js-no-ip-message').textContent.replace(/\n(\s)+/g, ' ').trim(),
).toEqual( ).toEqual(
'The IP address is in process to be assigned, please check your Kubernetes cluster or Quotas on GKE if it takes a long time. More information', 'The IP address is still in the process of being assigned, please check your Kubernetes cluster or Quotas on GKE if it takes a long time. More information',
); );
}); });
}); });
......
...@@ -18,6 +18,7 @@ const CLUSTERS_MOCK_DATA = { ...@@ -18,6 +18,7 @@ const CLUSTERS_MOCK_DATA = {
name: 'ingress', name: 'ingress',
status: APPLICATION_ERROR, status: APPLICATION_ERROR,
status_reason: 'Cannot connect', status_reason: 'Cannot connect',
external_ip: null,
}, { }, {
name: 'runner', name: 'runner',
status: APPLICATION_INSTALLING, status: APPLICATION_INSTALLING,
......
...@@ -75,6 +75,7 @@ describe('Clusters Store', () => { ...@@ -75,6 +75,7 @@ describe('Clusters Store', () => {
statusReason: mockResponseData.applications[1].status_reason, statusReason: mockResponseData.applications[1].status_reason,
requestStatus: null, requestStatus: null,
requestReason: null, requestReason: null,
externalIp: null,
}, },
runner: { runner: {
title: 'GitLab Runner', title: 'GitLab Runner',
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment