1- import { isEmpty } from 'lodash' ;
21import { createSelector } from '@reduxjs/toolkit' ;
32
43import { IConfigState } from '../slices/config.slice' ;
@@ -9,7 +8,7 @@ import { GIT_PROVIDERS } from '../enums/utils';
98const configSelector = ( state : RootState ) : IConfigState => state . config ;
109
1110export const selectConfigCardValues = ( ) =>
12- createSelector ( configSelector , ( { configs : configValues } ) => {
11+ createSelector ( configSelector , ( { configs } ) => {
1312 const {
1413 HOSTED_ZONE_NAME ,
1514 GITHUB_HOST ,
@@ -27,7 +26,7 @@ export const selectConfigCardValues = () =>
2726 METAPHOR_PROD ,
2827 METAPHOR_GO_PROD ,
2928 METAPHOR_FRONT_PROD ,
30- } = ! isEmpty ( configValues ) ? configValues : window . __env__ || { } ;
29+ } = configs ;
3130
3231 const params : CardsContentProps = {
3332 gitProvider : GITHUB_OWNER ? GIT_PROVIDERS . GITHUB : GIT_PROVIDERS . GITLAB ,
@@ -39,18 +38,18 @@ export const selectConfigCardValues = () =>
3938 argoUrl : ARGO_CD_URL ,
4039 atlantisUrl : ATLANTIS_URL ,
4140 metaphor : {
42- goUrl : `${ METAPHOR_GO_DEV } /app` ,
43- nodeJsUrl : `${ METAPHOR_DEV } /app` ,
41+ goUrl : METAPHOR_GO_DEV && `${ METAPHOR_GO_DEV } /app` ,
42+ nodeJsUrl : METAPHOR_DEV && `${ METAPHOR_DEV } /app` ,
4443 reactUrl : METAPHOR_FRONT_DEV ,
4544 } ,
4645 metaphorStaging : {
47- goUrl : `${ METAPHOR_GO_STAGING } /app` ,
48- nodeJsUrl : `${ METAPHOR_STAGING } /app` ,
46+ goUrl : METAPHOR_GO_STAGING && `${ METAPHOR_GO_STAGING } /app` ,
47+ nodeJsUrl : METAPHOR_STAGING && `${ METAPHOR_STAGING } /app` ,
4948 reactUrl : METAPHOR_FRONT_STAGING ,
5049 } ,
5150 metaphorProduction : {
52- goUrl : `${ METAPHOR_GO_PROD } /app` ,
53- nodeJsUrl : `${ METAPHOR_PROD } /app` ,
51+ goUrl : METAPHOR_GO_PROD && `${ METAPHOR_GO_PROD } /app` ,
52+ nodeJsUrl : METAPHOR_PROD && `${ METAPHOR_PROD } /app` ,
5453 reactUrl : METAPHOR_FRONT_PROD ,
5554 } ,
5655 } ;
@@ -59,19 +58,10 @@ export const selectConfigCardValues = () =>
5958 } ) ;
6059
6160export const selectConfigClusterName = ( ) =>
62- createSelector (
63- configSelector ,
64- ( { configs } ) => configs ?. CLUSTER_NAME || window . __env__ ?. CLUSTER_NAME ,
65- ) ;
61+ createSelector ( configSelector , ( { configs } ) => configs ?. CLUSTER_NAME ) ;
6662
6763export const selectConfigAdminEmail = ( ) =>
68- createSelector (
69- configSelector ,
70- ( { configs } ) => configs ?. ADMIN_EMAIL || window . __env__ ?. ADMIN_EMAIL ,
71- ) ;
64+ createSelector ( configSelector , ( { configs } ) => configs ?. ADMIN_EMAIL ) ;
7265
7366export const selectHostedZoneName = ( ) =>
74- createSelector (
75- configSelector ,
76- ( { configs } ) => configs ?. HOSTED_ZONE_NAME || window . __env__ ?. HOSTED_ZONE_NAME ,
77- ) ;
67+ createSelector ( configSelector , ( { configs } ) => configs ?. HOSTED_ZONE_NAME ) ;
0 commit comments