Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Léo-Paul Géneau
gitlab-ce
Commits
83badd07
Commit
83badd07
authored
Aug 07, 2018
by
Clement Ho
Committed by
Mike Greiling
Aug 07, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix UI error whereby prometheus application status is updated
parent
29203198
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
87 additions
and
88 deletions
+87
-88
app/assets/javascripts/clusters/clusters_bundle.js
app/assets/javascripts/clusters/clusters_bundle.js
+3
-3
app/assets/javascripts/clusters/components/application_row.vue
...ssets/javascripts/clusters/components/application_row.vue
+24
-21
app/assets/javascripts/clusters/components/applications.vue
app/assets/javascripts/clusters/components/applications.vue
+3
-3
app/assets/javascripts/clusters/constants.js
app/assets/javascripts/clusters/constants.js
+9
-6
changelogs/unreleased/fix-prometheus-updated-status.yml
changelogs/unreleased/fix-prometheus-updated-status.yml
+5
-0
spec/javascripts/clusters/clusters_bundle_spec.js
spec/javascripts/clusters/clusters_bundle_spec.js
+8
-10
spec/javascripts/clusters/components/application_row_spec.js
spec/javascripts/clusters/components/application_row_spec.js
+22
-27
spec/javascripts/clusters/services/mock_data.js
spec/javascripts/clusters/services/mock_data.js
+11
-16
spec/javascripts/clusters/stores/clusters_store_spec.js
spec/javascripts/clusters/stores/clusters_store_spec.js
+2
-2
No files found.
app/assets/javascripts/clusters/clusters_bundle.js
View file @
83badd07
...
@@ -6,7 +6,7 @@ import Poll from '../lib/utils/poll';
...
@@ -6,7 +6,7 @@ import Poll from '../lib/utils/poll';
import
initSettingsPanels
from
'
../settings_panels
'
;
import
initSettingsPanels
from
'
../settings_panels
'
;
import
eventHub
from
'
./event_hub
'
;
import
eventHub
from
'
./event_hub
'
;
import
{
import
{
APPLICATION_
INSTALLED
,
APPLICATION_
STATUS
,
REQUEST_LOADING
,
REQUEST_LOADING
,
REQUEST_SUCCESS
,
REQUEST_SUCCESS
,
REQUEST_FAILURE
,
REQUEST_FAILURE
,
...
@@ -177,8 +177,8 @@ export default class Clusters {
...
@@ -177,8 +177,8 @@ export default class Clusters {
checkForNewInstalls
(
prevApplicationMap
,
newApplicationMap
)
{
checkForNewInstalls
(
prevApplicationMap
,
newApplicationMap
)
{
const
appTitles
=
Object
.
keys
(
newApplicationMap
)
const
appTitles
=
Object
.
keys
(
newApplicationMap
)
.
filter
(
appId
=>
newApplicationMap
[
appId
].
status
===
APPLICATION_INSTALLED
&&
.
filter
(
appId
=>
newApplicationMap
[
appId
].
status
===
APPLICATION_
STATUS
.
INSTALLED
&&
prevApplicationMap
[
appId
].
status
!==
APPLICATION_INSTALLED
&&
prevApplicationMap
[
appId
].
status
!==
APPLICATION_
STATUS
.
INSTALLED
&&
prevApplicationMap
[
appId
].
status
!==
null
)
prevApplicationMap
[
appId
].
status
!==
null
)
.
map
(
appId
=>
newApplicationMap
[
appId
].
title
);
.
map
(
appId
=>
newApplicationMap
[
appId
].
title
);
...
...
app/assets/javascripts/clusters/components/application_row.vue
View file @
83badd07
...
@@ -4,12 +4,7 @@
...
@@ -4,12 +4,7 @@
import
eventHub
from
'
../event_hub
'
;
import
eventHub
from
'
../event_hub
'
;
import
loadingButton
from
'
../../vue_shared/components/loading_button.vue
'
;
import
loadingButton
from
'
../../vue_shared/components/loading_button.vue
'
;
import
{
import
{
APPLICATION_NOT_INSTALLABLE
,
APPLICATION_STATUS
,
APPLICATION_SCHEDULED
,
APPLICATION_INSTALLABLE
,
APPLICATION_INSTALLING
,
APPLICATION_INSTALLED
,
APPLICATION_ERROR
,
REQUEST_LOADING
,
REQUEST_LOADING
,
REQUEST_SUCCESS
,
REQUEST_SUCCESS
,
REQUEST_FAILURE
,
REQUEST_FAILURE
,
...
@@ -59,49 +54,57 @@
...
@@ -59,49 +54,57 @@
},
},
},
},
computed
:
{
computed
:
{
isUnknownStatus
()
{
return
!
this
.
isKnownStatus
&&
this
.
status
!==
null
;
},
isKnownStatus
()
{
return
Object
.
values
(
APPLICATION_STATUS
).
includes
(
this
.
status
);
},
rowJsClass
()
{
rowJsClass
()
{
return
`js-cluster-application-row-
${
this
.
id
}
`
;
return
`js-cluster-application-row-
${
this
.
id
}
`
;
},
},
installButtonLoading
()
{
installButtonLoading
()
{
return
!
this
.
status
||
return
!
this
.
status
||
this
.
status
===
APPLICATION_SCHEDULED
||
this
.
status
===
APPLICATION_S
TATUS
.
S
CHEDULED
||
this
.
status
===
APPLICATION_INSTALLING
||
this
.
status
===
APPLICATION_
STATUS
.
INSTALLING
||
this
.
requestStatus
===
REQUEST_LOADING
;
this
.
requestStatus
===
REQUEST_LOADING
;
},
},
installButtonDisabled
()
{
installButtonDisabled
()
{
// Avoid the potential for the real-time data to say APPLICATION_INSTALLABLE but
// Avoid the potential for the real-time data to say APPLICATION_
STATUS.
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
.
status
!==
APPLICATION_
INSTALLABLE
return
(
(
this
.
status
!==
APPLICATION_STATUS
.
INSTALLABLE
&&
this
.
status
!==
APPLICATION_ERROR
)
||
&&
this
.
status
!==
APPLICATION_
STATUS
.
ERROR
)
||
this
.
requestStatus
===
REQUEST_LOADING
||
this
.
requestStatus
===
REQUEST_LOADING
||
this
.
requestStatus
===
REQUEST_SUCCESS
;
this
.
requestStatus
===
REQUEST_SUCCESS
)
&&
this
.
isKnownStatus
;
},
},
installButtonLabel
()
{
installButtonLabel
()
{
let
label
;
let
label
;
if
(
if
(
this
.
status
===
APPLICATION_NOT_INSTALLABLE
||
this
.
status
===
APPLICATION_STATUS
.
NOT_INSTALLABLE
||
this
.
status
===
APPLICATION_INSTALLABLE
||
this
.
status
===
APPLICATION_STATUS
.
INSTALLABLE
||
this
.
status
===
APPLICATION_ERROR
this
.
status
===
APPLICATION_STATUS
.
ERROR
||
this
.
isUnknownStatus
)
{
)
{
label
=
s__
(
'
ClusterIntegration|Install
'
);
label
=
s__
(
'
ClusterIntegration|Install
'
);
}
else
if
(
this
.
status
===
APPLICATION_SCHEDULED
||
}
else
if
(
this
.
status
===
APPLICATION_S
TATUS
.
S
CHEDULED
||
this
.
status
===
APPLICATION_INSTALLING
)
{
this
.
status
===
APPLICATION_
STATUS
.
INSTALLING
)
{
label
=
s__
(
'
ClusterIntegration|Installing
'
);
label
=
s__
(
'
ClusterIntegration|Installing
'
);
}
else
if
(
this
.
status
===
APPLICATION_INSTALLED
)
{
}
else
if
(
this
.
status
===
APPLICATION_STATUS
.
INSTALLED
||
this
.
status
===
APPLICATION_STATUS
.
UPDATED
)
{
label
=
s__
(
'
ClusterIntegration|Installed
'
);
label
=
s__
(
'
ClusterIntegration|Installed
'
);
}
}
return
label
;
return
label
;
},
},
showManageButton
()
{
showManageButton
()
{
return
this
.
manageLink
&&
this
.
status
===
APPLICATION_INSTALLED
;
return
this
.
manageLink
&&
this
.
status
===
APPLICATION_
STATUS
.
INSTALLED
;
},
},
manageButtonLabel
()
{
manageButtonLabel
()
{
return
s__
(
'
ClusterIntegration|Manage
'
);
return
s__
(
'
ClusterIntegration|Manage
'
);
},
},
hasError
()
{
hasError
()
{
return
this
.
status
===
APPLICATION_ERROR
||
return
this
.
status
===
APPLICATION_
STATUS
.
ERROR
||
this
.
requestStatus
===
REQUEST_FAILURE
;
this
.
requestStatus
===
REQUEST_FAILURE
;
},
},
generalErrorDescription
()
{
generalErrorDescription
()
{
...
@@ -182,7 +185,7 @@
...
@@ -182,7 +185,7 @@
</div>
</div>
</div>
</div>
<div
<div
v-if=
"hasError"
v-if=
"hasError
|| isUnknownStatus
"
class=
"gl-responsive-table-row-layout"
class=
"gl-responsive-table-row-layout"
role=
"row"
role=
"row"
>
>
...
...
app/assets/javascripts/clusters/components/applications.vue
View file @
83badd07
...
@@ -3,7 +3,7 @@ import _ from 'underscore';
...
@@ -3,7 +3,7 @@ import _ from 'underscore';
import
{
s__
,
sprintf
}
from
'
../../locale
'
;
import
{
s__
,
sprintf
}
from
'
../../locale
'
;
import
applicationRow
from
'
./application_row.vue
'
;
import
applicationRow
from
'
./application_row.vue
'
;
import
clipboardButton
from
'
../../vue_shared/components/clipboard_button.vue
'
;
import
clipboardButton
from
'
../../vue_shared/components/clipboard_button.vue
'
;
import
{
APPLICATION_
INSTALLED
,
INGRESS
}
from
'
../constants
'
;
import
{
APPLICATION_
STATUS
,
INGRESS
}
from
'
../constants
'
;
export
default
{
export
default
{
components
:
{
components
:
{
...
@@ -58,7 +58,7 @@ export default {
...
@@ -58,7 +58,7 @@ export default {
return
INGRESS
;
return
INGRESS
;
},
},
ingressInstalled
()
{
ingressInstalled
()
{
return
this
.
applications
.
ingress
.
status
===
APPLICATION_INSTALLED
;
return
this
.
applications
.
ingress
.
status
===
APPLICATION_
STATUS
.
INSTALLED
;
},
},
ingressExternalIp
()
{
ingressExternalIp
()
{
return
this
.
applications
.
ingress
.
externalIp
;
return
this
.
applications
.
ingress
.
externalIp
;
...
@@ -122,7 +122,7 @@ export default {
...
@@ -122,7 +122,7 @@ export default {
);
);
},
},
jupyterInstalled
()
{
jupyterInstalled
()
{
return
this
.
applications
.
jupyter
.
status
===
APPLICATION_INSTALLED
;
return
this
.
applications
.
jupyter
.
status
===
APPLICATION_
STATUS
.
INSTALLED
;
},
},
jupyterHostname
()
{
jupyterHostname
()
{
return
this
.
applications
.
jupyter
.
hostname
;
return
this
.
applications
.
jupyter
.
hostname
;
...
...
app/assets/javascripts/clusters/constants.js
View file @
83badd07
// These need to match what is returned from the server
// These need to match what is returned from the server
export
const
APPLICATION_NOT_INSTALLABLE
=
'
not_installable
'
;
export
const
APPLICATION_STATUS
=
{
export
const
APPLICATION_INSTALLABLE
=
'
installable
'
;
NOT_INSTALLABLE
:
'
not_installable
'
,
export
const
APPLICATION_SCHEDULED
=
'
scheduled
'
;
INSTALLABLE
:
'
installable
'
,
export
const
APPLICATION_INSTALLING
=
'
installing
'
;
SCHEDULED
:
'
scheduled
'
,
export
const
APPLICATION_INSTALLED
=
'
installed
'
;
INSTALLING
:
'
installing
'
,
export
const
APPLICATION_ERROR
=
'
errored
'
;
INSTALLED
:
'
installed
'
,
UPDATED
:
'
updated
'
,
ERROR
:
'
errored
'
,
};
// These are only used client-side
// These are only used client-side
export
const
REQUEST_LOADING
=
'
request-loading
'
;
export
const
REQUEST_LOADING
=
'
request-loading
'
;
...
...
changelogs/unreleased/fix-prometheus-updated-status.yml
0 → 100644
View file @
83badd07
---
title
:
Fix UI error whereby prometheus application status is updated
merge_request
:
21029
author
:
type
:
fixed
spec/javascripts/clusters/clusters_bundle_spec.js
View file @
83badd07
import
Clusters
from
'
~/clusters/clusters_bundle
'
;
import
Clusters
from
'
~/clusters/clusters_bundle
'
;
import
{
import
{
APPLICATION_INSTALLABLE
,
APPLICATION_INSTALLING
,
APPLICATION_INSTALLED
,
REQUEST_LOADING
,
REQUEST_LOADING
,
REQUEST_SUCCESS
,
REQUEST_SUCCESS
,
REQUEST_FAILURE
,
REQUEST_FAILURE
,
APPLICATION_STATUS
,
}
from
'
~/clusters/constants
'
;
}
from
'
~/clusters/constants
'
;
import
getSetTimeoutPromise
from
'
spec/helpers/set_timeout_promise_helper
'
;
import
getSetTimeoutPromise
from
'
spec/helpers/set_timeout_promise_helper
'
;
...
@@ -84,7 +82,7 @@ describe('Clusters', () => {
...
@@ -84,7 +82,7 @@ describe('Clusters', () => {
it
(
'
does not show alert when things transition from initial null state to something
'
,
()
=>
{
it
(
'
does not show alert when things transition from initial null state to something
'
,
()
=>
{
cluster
.
checkForNewInstalls
(
INITIAL_APP_MAP
,
{
cluster
.
checkForNewInstalls
(
INITIAL_APP_MAP
,
{
...
INITIAL_APP_MAP
,
...
INITIAL_APP_MAP
,
helm
:
{
status
:
APPLICATION_INSTALLABLE
,
title
:
'
Helm Tiller
'
},
helm
:
{
status
:
APPLICATION_
STATUS
.
INSTALLABLE
,
title
:
'
Helm Tiller
'
},
});
});
const
flashMessage
=
document
.
querySelector
(
'
.js-cluster-application-notice .flash-text
'
);
const
flashMessage
=
document
.
querySelector
(
'
.js-cluster-application-notice .flash-text
'
);
...
@@ -94,10 +92,10 @@ describe('Clusters', () => {
...
@@ -94,10 +92,10 @@ describe('Clusters', () => {
it
(
'
shows an alert when something gets newly installed
'
,
()
=>
{
it
(
'
shows an alert when something gets newly installed
'
,
()
=>
{
cluster
.
checkForNewInstalls
({
cluster
.
checkForNewInstalls
({
...
INITIAL_APP_MAP
,
...
INITIAL_APP_MAP
,
helm
:
{
status
:
APPLICATION_INSTALLING
,
title
:
'
Helm Tiller
'
},
helm
:
{
status
:
APPLICATION_
STATUS
.
INSTALLING
,
title
:
'
Helm Tiller
'
},
},
{
},
{
...
INITIAL_APP_MAP
,
...
INITIAL_APP_MAP
,
helm
:
{
status
:
APPLICATION_INSTALLED
,
title
:
'
Helm Tiller
'
},
helm
:
{
status
:
APPLICATION_
STATUS
.
INSTALLED
,
title
:
'
Helm Tiller
'
},
});
});
const
flashMessage
=
document
.
querySelector
(
'
.js-cluster-application-notice .flash-text
'
);
const
flashMessage
=
document
.
querySelector
(
'
.js-cluster-application-notice .flash-text
'
);
...
@@ -108,12 +106,12 @@ describe('Clusters', () => {
...
@@ -108,12 +106,12 @@ describe('Clusters', () => {
it
(
'
shows an alert when multiple things gets newly installed
'
,
()
=>
{
it
(
'
shows an alert when multiple things gets newly installed
'
,
()
=>
{
cluster
.
checkForNewInstalls
({
cluster
.
checkForNewInstalls
({
...
INITIAL_APP_MAP
,
...
INITIAL_APP_MAP
,
helm
:
{
status
:
APPLICATION_INSTALLING
,
title
:
'
Helm Tiller
'
},
helm
:
{
status
:
APPLICATION_
STATUS
.
INSTALLING
,
title
:
'
Helm Tiller
'
},
ingress
:
{
status
:
APPLICATION_INSTALLABLE
,
title
:
'
Ingress
'
},
ingress
:
{
status
:
APPLICATION_
STATUS
.
INSTALLABLE
,
title
:
'
Ingress
'
},
},
{
},
{
...
INITIAL_APP_MAP
,
...
INITIAL_APP_MAP
,
helm
:
{
status
:
APPLICATION_INSTALLED
,
title
:
'
Helm Tiller
'
},
helm
:
{
status
:
APPLICATION_
STATUS
.
INSTALLED
,
title
:
'
Helm Tiller
'
},
ingress
:
{
status
:
APPLICATION_INSTALLED
,
title
:
'
Ingress
'
},
ingress
:
{
status
:
APPLICATION_
STATUS
.
INSTALLED
,
title
:
'
Ingress
'
},
});
});
const
flashMessage
=
document
.
querySelector
(
'
.js-cluster-application-notice .flash-text
'
);
const
flashMessage
=
document
.
querySelector
(
'
.js-cluster-application-notice .flash-text
'
);
...
...
spec/javascripts/clusters/components/application_row_spec.js
View file @
83badd07
import
Vue
from
'
vue
'
;
import
Vue
from
'
vue
'
;
import
eventHub
from
'
~/clusters/event_hub
'
;
import
eventHub
from
'
~/clusters/event_hub
'
;
import
{
import
{
APPLICATION_NOT_INSTALLABLE
,
APPLICATION_STATUS
,
APPLICATION_SCHEDULED
,
APPLICATION_INSTALLABLE
,
APPLICATION_INSTALLING
,
APPLICATION_INSTALLED
,
APPLICATION_ERROR
,
REQUEST_LOADING
,
REQUEST_LOADING
,
REQUEST_SUCCESS
,
REQUEST_SUCCESS
,
REQUEST_FAILURE
,
REQUEST_FAILURE
,
...
@@ -62,10 +57,10 @@ describe('Application Row', () => {
...
@@ -62,10 +57,10 @@ describe('Application Row', () => {
expect
(
vm
.
installButtonLabel
).
toBeUndefined
();
expect
(
vm
.
installButtonLabel
).
toBeUndefined
();
});
});
it
(
'
has disabled "Install" when APPLICATION_NOT_INSTALLABLE
'
,
()
=>
{
it
(
'
has disabled "Install" when APPLICATION_
STATUS.
NOT_INSTALLABLE
'
,
()
=>
{
vm
=
mountComponent
(
ApplicationRow
,
{
vm
=
mountComponent
(
ApplicationRow
,
{
...
DEFAULT_APPLICATION_STATE
,
...
DEFAULT_APPLICATION_STATE
,
status
:
APPLICATION_NOT_INSTALLABLE
,
status
:
APPLICATION_
STATUS
.
NOT_INSTALLABLE
,
});
});
expect
(
vm
.
installButtonLabel
).
toEqual
(
'
Install
'
);
expect
(
vm
.
installButtonLabel
).
toEqual
(
'
Install
'
);
...
@@ -73,10 +68,10 @@ describe('Application Row', () => {
...
@@ -73,10 +68,10 @@ describe('Application Row', () => {
expect
(
vm
.
installButtonDisabled
).
toEqual
(
true
);
expect
(
vm
.
installButtonDisabled
).
toEqual
(
true
);
});
});
it
(
'
has enabled "Install" when APPLICATION_INSTALLABLE
'
,
()
=>
{
it
(
'
has enabled "Install" when APPLICATION_
STATUS.
INSTALLABLE
'
,
()
=>
{
vm
=
mountComponent
(
ApplicationRow
,
{
vm
=
mountComponent
(
ApplicationRow
,
{
...
DEFAULT_APPLICATION_STATE
,
...
DEFAULT_APPLICATION_STATE
,
status
:
APPLICATION_INSTALLABLE
,
status
:
APPLICATION_
STATUS
.
INSTALLABLE
,
});
});
expect
(
vm
.
installButtonLabel
).
toEqual
(
'
Install
'
);
expect
(
vm
.
installButtonLabel
).
toEqual
(
'
Install
'
);
...
@@ -84,10 +79,10 @@ describe('Application Row', () => {
...
@@ -84,10 +79,10 @@ describe('Application Row', () => {
expect
(
vm
.
installButtonDisabled
).
toEqual
(
false
);
expect
(
vm
.
installButtonDisabled
).
toEqual
(
false
);
});
});
it
(
'
has loading "Installing" when APPLICATION_SCHEDULED
'
,
()
=>
{
it
(
'
has loading "Installing" when APPLICATION_S
TATUS.S
CHEDULED
'
,
()
=>
{
vm
=
mountComponent
(
ApplicationRow
,
{
vm
=
mountComponent
(
ApplicationRow
,
{
...
DEFAULT_APPLICATION_STATE
,
...
DEFAULT_APPLICATION_STATE
,
status
:
APPLICATION_SCHEDULED
,
status
:
APPLICATION_S
TATUS
.
S
CHEDULED
,
});
});
expect
(
vm
.
installButtonLabel
).
toEqual
(
'
Installing
'
);
expect
(
vm
.
installButtonLabel
).
toEqual
(
'
Installing
'
);
...
@@ -95,10 +90,10 @@ describe('Application Row', () => {
...
@@ -95,10 +90,10 @@ describe('Application Row', () => {
expect
(
vm
.
installButtonDisabled
).
toEqual
(
true
);
expect
(
vm
.
installButtonDisabled
).
toEqual
(
true
);
});
});
it
(
'
has loading "Installing" when APPLICATION_INSTALLING
'
,
()
=>
{
it
(
'
has loading "Installing" when APPLICATION_
STATUS.
INSTALLING
'
,
()
=>
{
vm
=
mountComponent
(
ApplicationRow
,
{
vm
=
mountComponent
(
ApplicationRow
,
{
...
DEFAULT_APPLICATION_STATE
,
...
DEFAULT_APPLICATION_STATE
,
status
:
APPLICATION_INSTALLING
,
status
:
APPLICATION_
STATUS
.
INSTALLING
,
});
});
expect
(
vm
.
installButtonLabel
).
toEqual
(
'
Installing
'
);
expect
(
vm
.
installButtonLabel
).
toEqual
(
'
Installing
'
);
...
@@ -106,10 +101,10 @@ describe('Application Row', () => {
...
@@ -106,10 +101,10 @@ describe('Application Row', () => {
expect
(
vm
.
installButtonDisabled
).
toEqual
(
true
);
expect
(
vm
.
installButtonDisabled
).
toEqual
(
true
);
});
});
it
(
'
has disabled "Installed" when APPLICATION_INSTALLED
'
,
()
=>
{
it
(
'
has disabled "Installed" when APPLICATION_
STATUS.
INSTALLED
'
,
()
=>
{
vm
=
mountComponent
(
ApplicationRow
,
{
vm
=
mountComponent
(
ApplicationRow
,
{
...
DEFAULT_APPLICATION_STATE
,
...
DEFAULT_APPLICATION_STATE
,
status
:
APPLICATION_INSTALLED
,
status
:
APPLICATION_
STATUS
.
INSTALLED
,
});
});
expect
(
vm
.
installButtonLabel
).
toEqual
(
'
Installed
'
);
expect
(
vm
.
installButtonLabel
).
toEqual
(
'
Installed
'
);
...
@@ -117,10 +112,10 @@ describe('Application Row', () => {
...
@@ -117,10 +112,10 @@ describe('Application Row', () => {
expect
(
vm
.
installButtonDisabled
).
toEqual
(
true
);
expect
(
vm
.
installButtonDisabled
).
toEqual
(
true
);
});
});
it
(
'
has enabled "Install" when APPLICATION_ERROR
'
,
()
=>
{
it
(
'
has enabled "Install" when APPLICATION_
STATUS.
ERROR
'
,
()
=>
{
vm
=
mountComponent
(
ApplicationRow
,
{
vm
=
mountComponent
(
ApplicationRow
,
{
...
DEFAULT_APPLICATION_STATE
,
...
DEFAULT_APPLICATION_STATE
,
status
:
APPLICATION_ERROR
,
status
:
APPLICATION_
STATUS
.
ERROR
,
});
});
expect
(
vm
.
installButtonLabel
).
toEqual
(
'
Install
'
);
expect
(
vm
.
installButtonLabel
).
toEqual
(
'
Install
'
);
...
@@ -131,7 +126,7 @@ describe('Application Row', () => {
...
@@ -131,7 +126,7 @@ describe('Application Row', () => {
it
(
'
has loading "Install" when REQUEST_LOADING
'
,
()
=>
{
it
(
'
has loading "Install" when REQUEST_LOADING
'
,
()
=>
{
vm
=
mountComponent
(
ApplicationRow
,
{
vm
=
mountComponent
(
ApplicationRow
,
{
...
DEFAULT_APPLICATION_STATE
,
...
DEFAULT_APPLICATION_STATE
,
status
:
APPLICATION_INSTALLABLE
,
status
:
APPLICATION_
STATUS
.
INSTALLABLE
,
requestStatus
:
REQUEST_LOADING
,
requestStatus
:
REQUEST_LOADING
,
});
});
...
@@ -143,7 +138,7 @@ describe('Application Row', () => {
...
@@ -143,7 +138,7 @@ describe('Application Row', () => {
it
(
'
has disabled "Install" when REQUEST_SUCCESS
'
,
()
=>
{
it
(
'
has disabled "Install" when REQUEST_SUCCESS
'
,
()
=>
{
vm
=
mountComponent
(
ApplicationRow
,
{
vm
=
mountComponent
(
ApplicationRow
,
{
...
DEFAULT_APPLICATION_STATE
,
...
DEFAULT_APPLICATION_STATE
,
status
:
APPLICATION_INSTALLABLE
,
status
:
APPLICATION_
STATUS
.
INSTALLABLE
,
requestStatus
:
REQUEST_SUCCESS
,
requestStatus
:
REQUEST_SUCCESS
,
});
});
...
@@ -155,7 +150,7 @@ describe('Application Row', () => {
...
@@ -155,7 +150,7 @@ describe('Application Row', () => {
it
(
'
has enabled "Install" when REQUEST_FAILURE (so you can try installing again)
'
,
()
=>
{
it
(
'
has enabled "Install" when REQUEST_FAILURE (so you can try installing again)
'
,
()
=>
{
vm
=
mountComponent
(
ApplicationRow
,
{
vm
=
mountComponent
(
ApplicationRow
,
{
...
DEFAULT_APPLICATION_STATE
,
...
DEFAULT_APPLICATION_STATE
,
status
:
APPLICATION_INSTALLABLE
,
status
:
APPLICATION_
STATUS
.
INSTALLABLE
,
requestStatus
:
REQUEST_FAILURE
,
requestStatus
:
REQUEST_FAILURE
,
});
});
...
@@ -168,7 +163,7 @@ describe('Application Row', () => {
...
@@ -168,7 +163,7 @@ describe('Application Row', () => {
spyOn
(
eventHub
,
'
$emit
'
);
spyOn
(
eventHub
,
'
$emit
'
);
vm
=
mountComponent
(
ApplicationRow
,
{
vm
=
mountComponent
(
ApplicationRow
,
{
...
DEFAULT_APPLICATION_STATE
,
...
DEFAULT_APPLICATION_STATE
,
status
:
APPLICATION_INSTALLABLE
,
status
:
APPLICATION_
STATUS
.
INSTALLABLE
,
});
});
const
installButton
=
vm
.
$el
.
querySelector
(
'
.js-cluster-application-install-button
'
);
const
installButton
=
vm
.
$el
.
querySelector
(
'
.js-cluster-application-install-button
'
);
...
@@ -184,7 +179,7 @@ describe('Application Row', () => {
...
@@ -184,7 +179,7 @@ describe('Application Row', () => {
spyOn
(
eventHub
,
'
$emit
'
);
spyOn
(
eventHub
,
'
$emit
'
);
vm
=
mountComponent
(
ApplicationRow
,
{
vm
=
mountComponent
(
ApplicationRow
,
{
...
DEFAULT_APPLICATION_STATE
,
...
DEFAULT_APPLICATION_STATE
,
status
:
APPLICATION_INSTALLABLE
,
status
:
APPLICATION_
STATUS
.
INSTALLABLE
,
installApplicationRequestParams
:
{
hostname
:
'
jupyter
'
},
installApplicationRequestParams
:
{
hostname
:
'
jupyter
'
},
});
});
const
installButton
=
vm
.
$el
.
querySelector
(
'
.js-cluster-application-install-button
'
);
const
installButton
=
vm
.
$el
.
querySelector
(
'
.js-cluster-application-install-button
'
);
...
@@ -201,7 +196,7 @@ describe('Application Row', () => {
...
@@ -201,7 +196,7 @@ describe('Application Row', () => {
spyOn
(
eventHub
,
'
$emit
'
);
spyOn
(
eventHub
,
'
$emit
'
);
vm
=
mountComponent
(
ApplicationRow
,
{
vm
=
mountComponent
(
ApplicationRow
,
{
...
DEFAULT_APPLICATION_STATE
,
...
DEFAULT_APPLICATION_STATE
,
status
:
APPLICATION_INSTALLING
,
status
:
APPLICATION_
STATUS
.
INSTALLING
,
});
});
const
installButton
=
vm
.
$el
.
querySelector
(
'
.js-cluster-application-install-button
'
);
const
installButton
=
vm
.
$el
.
querySelector
(
'
.js-cluster-application-install-button
'
);
...
@@ -225,11 +220,11 @@ describe('Application Row', () => {
...
@@ -225,11 +220,11 @@ describe('Application Row', () => {
expect
(
generalErrorMessage
).
toBeNull
();
expect
(
generalErrorMessage
).
toBeNull
();
});
});
it
(
'
shows status reason when APPLICATION_ERROR
'
,
()
=>
{
it
(
'
shows status reason when APPLICATION_
STATUS.
ERROR
'
,
()
=>
{
const
statusReason
=
'
We broke it 0.0
'
;
const
statusReason
=
'
We broke it 0.0
'
;
vm
=
mountComponent
(
ApplicationRow
,
{
vm
=
mountComponent
(
ApplicationRow
,
{
...
DEFAULT_APPLICATION_STATE
,
...
DEFAULT_APPLICATION_STATE
,
status
:
APPLICATION_ERROR
,
status
:
APPLICATION_
STATUS
.
ERROR
,
statusReason
,
statusReason
,
});
});
const
generalErrorMessage
=
vm
.
$el
.
querySelector
(
'
.js-cluster-application-general-error-message
'
);
const
generalErrorMessage
=
vm
.
$el
.
querySelector
(
'
.js-cluster-application-general-error-message
'
);
...
@@ -243,7 +238,7 @@ describe('Application Row', () => {
...
@@ -243,7 +238,7 @@ describe('Application Row', () => {
const
requestReason
=
'
We broke thre request 0.0
'
;
const
requestReason
=
'
We broke thre request 0.0
'
;
vm
=
mountComponent
(
ApplicationRow
,
{
vm
=
mountComponent
(
ApplicationRow
,
{
...
DEFAULT_APPLICATION_STATE
,
...
DEFAULT_APPLICATION_STATE
,
status
:
APPLICATION_INSTALLABLE
,
status
:
APPLICATION_
STATUS
.
INSTALLABLE
,
requestStatus
:
REQUEST_FAILURE
,
requestStatus
:
REQUEST_FAILURE
,
requestReason
,
requestReason
,
});
});
...
...
spec/javascripts/clusters/services/mock_data.js
View file @
83badd07
import
{
import
{
APPLICATION_STATUS
}
from
'
~/clusters/constants
'
;
APPLICATION_INSTALLED
,
APPLICATION_INSTALLABLE
,
APPLICATION_INSTALLING
,
APPLICATION_ERROR
,
}
from
'
~/clusters/constants
'
;
const
CLUSTERS_MOCK_DATA
=
{
const
CLUSTERS_MOCK_DATA
=
{
GET
:
{
GET
:
{
...
@@ -13,25 +8,25 @@ const CLUSTERS_MOCK_DATA = {
...
@@ -13,25 +8,25 @@ const CLUSTERS_MOCK_DATA = {
status_reason
:
'
Failed to request to CloudPlatform.
'
,
status_reason
:
'
Failed to request to CloudPlatform.
'
,
applications
:
[{
applications
:
[{
name
:
'
helm
'
,
name
:
'
helm
'
,
status
:
APPLICATION_INSTALLABLE
,
status
:
APPLICATION_
STATUS
.
INSTALLABLE
,
status_reason
:
null
,
status_reason
:
null
,
},
{
},
{
name
:
'
ingress
'
,
name
:
'
ingress
'
,
status
:
APPLICATION_ERROR
,
status
:
APPLICATION_
STATUS
.
ERROR
,
status_reason
:
'
Cannot connect
'
,
status_reason
:
'
Cannot connect
'
,
external_ip
:
null
,
external_ip
:
null
,
},
{
},
{
name
:
'
runner
'
,
name
:
'
runner
'
,
status
:
APPLICATION_INSTALLING
,
status
:
APPLICATION_
STATUS
.
INSTALLING
,
status_reason
:
null
,
status_reason
:
null
,
},
},
{
{
name
:
'
prometheus
'
,
name
:
'
prometheus
'
,
status
:
APPLICATION_ERROR
,
status
:
APPLICATION_
STATUS
.
ERROR
,
status_reason
:
'
Cannot connect
'
,
status_reason
:
'
Cannot connect
'
,
},
{
},
{
name
:
'
jupyter
'
,
name
:
'
jupyter
'
,
status
:
APPLICATION_INSTALLING
,
status
:
APPLICATION_
STATUS
.
INSTALLING
,
status_reason
:
'
Cannot connect
'
,
status_reason
:
'
Cannot connect
'
,
}],
}],
},
},
...
@@ -42,25 +37,25 @@ const CLUSTERS_MOCK_DATA = {
...
@@ -42,25 +37,25 @@ const CLUSTERS_MOCK_DATA = {
status_reason
:
'
Failed to request to CloudPlatform.
'
,
status_reason
:
'
Failed to request to CloudPlatform.
'
,
applications
:
[{
applications
:
[{
name
:
'
helm
'
,
name
:
'
helm
'
,
status
:
APPLICATION_INSTALLED
,
status
:
APPLICATION_
STATUS
.
INSTALLED
,
status_reason
:
null
,
status_reason
:
null
,
},
{
},
{
name
:
'
ingress
'
,
name
:
'
ingress
'
,
status
:
APPLICATION_INSTALLED
,
status
:
APPLICATION_
STATUS
.
INSTALLED
,
status_reason
:
'
Cannot connect
'
,
status_reason
:
'
Cannot connect
'
,
external_ip
:
'
1.1.1.1
'
,
external_ip
:
'
1.1.1.1
'
,
},
{
},
{
name
:
'
runner
'
,
name
:
'
runner
'
,
status
:
APPLICATION_INSTALLING
,
status
:
APPLICATION_
STATUS
.
INSTALLING
,
status_reason
:
null
,
status_reason
:
null
,
},
},
{
{
name
:
'
prometheus
'
,
name
:
'
prometheus
'
,
status
:
APPLICATION_ERROR
,
status
:
APPLICATION_
STATUS
.
ERROR
,
status_reason
:
'
Cannot connect
'
,
status_reason
:
'
Cannot connect
'
,
},
{
},
{
name
:
'
jupyter
'
,
name
:
'
jupyter
'
,
status
:
APPLICATION_INSTALLABLE
,
status
:
APPLICATION_
STATUS
.
INSTALLABLE
,
status_reason
:
'
Cannot connect
'
,
status_reason
:
'
Cannot connect
'
,
}],
}],
},
},
...
...
spec/javascripts/clusters/stores/clusters_store_spec.js
View file @
83badd07
import
ClustersStore
from
'
~/clusters/stores/clusters_store
'
;
import
ClustersStore
from
'
~/clusters/stores/clusters_store
'
;
import
{
APPLICATION_
INSTALLING
}
from
'
~/clusters/constants
'
;
import
{
APPLICATION_
STATUS
}
from
'
~/clusters/constants
'
;
import
{
CLUSTERS_MOCK_DATA
}
from
'
../services/mock_data
'
;
import
{
CLUSTERS_MOCK_DATA
}
from
'
../services/mock_data
'
;
describe
(
'
Clusters Store
'
,
()
=>
{
describe
(
'
Clusters Store
'
,
()
=>
{
...
@@ -35,7 +35,7 @@ describe('Clusters Store', () => {
...
@@ -35,7 +35,7 @@ describe('Clusters Store', () => {
it
(
'
should store new request status
'
,
()
=>
{
it
(
'
should store new request status
'
,
()
=>
{
expect
(
store
.
state
.
applications
.
helm
.
requestStatus
).
toEqual
(
null
);
expect
(
store
.
state
.
applications
.
helm
.
requestStatus
).
toEqual
(
null
);
const
newStatus
=
APPLICATION_INSTALLING
;
const
newStatus
=
APPLICATION_
STATUS
.
INSTALLING
;
store
.
updateAppProperty
(
'
helm
'
,
'
requestStatus
'
,
newStatus
);
store
.
updateAppProperty
(
'
helm
'
,
'
requestStatus
'
,
newStatus
);
expect
(
store
.
state
.
applications
.
helm
.
requestStatus
).
toEqual
(
newStatus
);
expect
(
store
.
state
.
applications
.
helm
.
requestStatus
).
toEqual
(
newStatus
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment