Commit 1d6adc27 authored by Filipa Lacerda's avatar Filipa Lacerda Committed by Dmitriy Zaporozhets

Handle disabled button state in backend

parent 2ca00a36
...@@ -52,11 +52,6 @@ ...@@ -52,11 +52,6 @@
type: String, type: String,
required: false, required: false,
}, },
disableInstallButton: {
type: Boolean,
required: false,
default: false,
},
installApplicationRequestParams: { installApplicationRequestParams: {
type: Object, type: Object,
required: false, required: false,
...@@ -77,7 +72,7 @@ ...@@ -77,7 +72,7 @@
// Avoid the potential for the real-time data to say APPLICATION_INSTALLABLE but // Avoid the potential for the real-time data to say APPLICATION_INSTALLABLE but
// we already made a request to install and are just waiting for the real-time // we already made a request to install and are just waiting for the real-time
// to sync up. // to sync up.
return this.disableInstallButton || (this.status !== APPLICATION_INSTALLABLE return (this.status !== APPLICATION_INSTALLABLE
&& this.status !== APPLICATION_ERROR) || && this.status !== APPLICATION_ERROR) ||
this.requestStatus === REQUEST_LOADING || this.requestStatus === REQUEST_LOADING ||
this.requestStatus === REQUEST_SUCCESS; this.requestStatus === REQUEST_SUCCESS;
......
...@@ -292,7 +292,6 @@ export default { ...@@ -292,7 +292,6 @@ export default {
:status-reason="applications.jupyter.statusReason" :status-reason="applications.jupyter.statusReason"
:request-status="applications.jupyter.requestStatus" :request-status="applications.jupyter.requestStatus"
:request-reason="applications.jupyter.requestReason" :request-reason="applications.jupyter.requestReason"
:disable-install-button="!ingressInstalled"
:install-application-request-params="{ hostname: applications.jupyter.hostname }" :install-application-request-params="{ hostname: applications.jupyter.hostname }"
> >
<div slot="description"> <div slot="description">
...@@ -304,7 +303,7 @@ export default { ...@@ -304,7 +303,7 @@ export default {
or a scientific research group.`) }} or a scientific research group.`) }}
</p> </p>
<template v-if="ingressInstalled"> <template v-if="ingressExternalIp">
<div class="form-group"> <div class="form-group">
<label for="jupyter-hostname"> <label for="jupyter-hostname">
{{ s__('ClusterIntegration|Jupyter Hostname') }} {{ s__('ClusterIntegration|Jupyter Hostname') }}
......
...@@ -211,16 +211,6 @@ describe('Application Row', () => { ...@@ -211,16 +211,6 @@ describe('Application Row', () => {
expect(eventHub.$emit).not.toHaveBeenCalled(); expect(eventHub.$emit).not.toHaveBeenCalled();
}); });
it('is disabled when disableInstallButton prop is provided', () => {
vm = mountComponent(ApplicationRow, {
...DEFAULT_APPLICATION_STATE,
status: APPLICATION_INSTALLING,
disableInstallButton: true,
});
expect(vm.installButtonDisabled).toEqual(true);
});
}); });
describe('Error block', () => { describe('Error block', () => {
......
...@@ -114,7 +114,7 @@ describe('Applications', () => { ...@@ -114,7 +114,7 @@ describe('Applications', () => {
}); });
describe('Jupyter application', () => { describe('Jupyter application', () => {
describe('with ingress installed & jupyter not installed', () => { describe('with ingress installed with ip & jupyter installable', () => {
it('renders hostname active input', () => { it('renders hostname active input', () => {
vm = mountComponent(Applications, { vm = mountComponent(Applications, {
applications: { applications: {
...@@ -122,12 +122,13 @@ describe('Applications', () => { ...@@ -122,12 +122,13 @@ describe('Applications', () => {
ingress: { title: 'Ingress', status: 'installed', externalIp: '1.1.1.1' }, ingress: { title: 'Ingress', status: 'installed', externalIp: '1.1.1.1' },
runner: { title: 'GitLab Runner' }, runner: { title: 'GitLab Runner' },
prometheus: { title: 'Prometheus' }, prometheus: { title: 'Prometheus' },
jupyter: { title: 'JupyterHub', hostname: '' }, jupyter: { title: 'JupyterHub', hostname: '', status: 'installable' },
}, },
}); });
expect(vm.$el.querySelector('.js-hostname').getAttribute('readonly')).toEqual(null); expect(vm.$el.querySelector('.js-hostname').getAttribute('readonly')).toEqual(null);
}); });
describe('with ingress & jupyter installed', () => { describe('with ingress & jupyter installed', () => {
it('renders readonly input', () => { it('renders readonly input', () => {
vm = mountComponent(Applications, { vm = mountComponent(Applications, {
...@@ -153,7 +154,7 @@ describe('Applications', () => { ...@@ -153,7 +154,7 @@ describe('Applications', () => {
ingress: { title: 'Ingress' }, ingress: { title: 'Ingress' },
runner: { title: 'GitLab Runner' }, runner: { title: 'GitLab Runner' },
prometheus: { title: 'Prometheus' }, prometheus: { title: 'Prometheus' },
jupyter: { title: 'JupyterHub' }, jupyter: { title: 'JupyterHub', status: 'not_installable' },
}, },
}); });
}); });
......
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