Skip to content

Commit

Permalink
Fix [ML functions] Function without a status is in a 'Creating' statu…
Browse files Browse the repository at this point in the history
…s `1.5.x` (#2011)
  • Loading branch information
ilan7empest authored Oct 6, 2023
1 parent 406d61c commit e9a3755
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 14 deletions.
2 changes: 2 additions & 0 deletions src/components/FunctionsPage/functions.util.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import {
FUNCTION_CREATING_STATE,
FUNCTION_ERROR_STATE,
FUNCTION_FAILED_STATE,
FUNCTION_INITIALIZED_STATE,
FUNCTION_PENDINDG_STATE,
FUNCTION_READY_STATE,
FUNCTION_RUNNING_STATE,
Expand Down Expand Up @@ -52,6 +53,7 @@ export const FUNCTIONS_FAILED_STATES = [FUNCTION_FAILED_STATE, FUNCTION_ERROR_ST
export const FUNCTIONS_READY_STATES = [FUNCTION_READY_STATE]
export const FUNCTIONS_EDITABLE_STATES = [
FUNCTION_CREATING_STATE,
FUNCTION_INITIALIZED_STATE,
...FUNCTIONS_READY_STATES,
...FUNCTIONS_FAILED_STATES
]
Expand Down
1 change: 1 addition & 0 deletions src/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,7 @@ export const SET_NEW_FUNCTION_VOLUME_MOUNTS = 'SET_NEW_FUNCTION_VOLUME_MOUNTS'
export const FUNCTION_CREATING_STATE = 'creating'
export const FUNCTION_FAILED_STATE = 'failed'
export const FUNCTION_ERROR_STATE = 'error'
export const FUNCTION_INITIALIZED_STATE = 'initialized'
export const FUNCTION_READY_STATE = 'ready'
export const FUNCTION_PENDINDG_STATE = 'pending'
export const FUNCTION_RUNNING_STATE = 'running'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
align-items: center;
width: 100%;
margin-bottom: 15px;
padding: 0 15px;
padding: 10px 15px;
border: $primaryBorder;
border-radius: 4px;
}
Expand Down
22 changes: 13 additions & 9 deletions src/scss/main.scss
Original file line number Diff line number Diff line change
Expand Up @@ -444,37 +444,41 @@ a {
text-decoration: none;
}

[class^='state-completed'],
[class^='state-ready'],
[class^='state-succeeded'],
[class^='state-active'],
[class^='state-completed'],
[class^='state-created'],
[class^='state-creating'],
[class^='state-info'],
[class^='state-online'] {
[class^='state-online'],
[class^='state-ready'],
[class^='state-succeeded'] {
@include statusState($brightTurquoise);
}

[class^='state-all'] {
@include statusState(transparent);
}

[class^='state-initialized'] {
@include statusState($chateauGreen);
}

[class^='state-warn'] {
@include statusState($grandis);
}

[class^='state-deploying'],
[class^='state-build'],
[class^='state-deploying'],
[class^='state-pending'],
[class^='state-running'] {
@include statusState($pictonBlue);
}

[class^='state-failed'],
[class^='state-fail'],
[class^='state-error'],
[class^='state-aborted'],
[class^='state-broken'],
[class^='state-aborted'] {
[class^='state-error'],
[class^='state-fail'],
[class^='state-failed'] {
@include statusState($burntSienna);
}

Expand Down
13 changes: 9 additions & 4 deletions src/utils/getState.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,19 @@ illegal under applicable law, and the grant of the foregoing license
under the Apache 2.0 license is conditioned upon your compliance with
such restriction.
*/
import { FUNCTION_CREATING_STATE, FUNCTIONS_PAGE } from '../constants'
import { isEmpty } from 'lodash'
import { FUNCTION_INITIALIZED_STATE, FUNCTIONS_PAGE } from '../constants'

const getState = (state, page, kind) => {
const stateExists = !isEmpty(state)

if (page === FUNCTIONS_PAGE) {
return {
value: state || FUNCTION_CREATING_STATE,
label: state ? functionStateLabels[state] : 'Creating',
className: `state-${state || FUNCTION_CREATING_STATE}${kind ? '-' + kind : ''}`
value: stateExists ? state : FUNCTION_INITIALIZED_STATE,
label: stateExists ? functionStateLabels[state] : 'Initialized',
className: `state-${stateExists ? state : FUNCTION_INITIALIZED_STATE}${
kind ? '-' + kind : ''
}`
}
} else {
return {
Expand Down

0 comments on commit e9a3755

Please sign in to comment.