@@ -3,51 +3,23 @@ import type { State as RootState } from "core/bootstrap";
33import { name } from "./state" ;
44import * as projectManagement from "core/usecases/projectManagement" ;
55
6- export type RestorableServiceConfig =
7- projectManagement . ProjectConfigs . RestorableServiceConfig ;
8-
96function state ( rootState : RootState ) {
107 return rootState [ name ] ;
118}
129
1310const restorableConfigs = createSelector (
1411 projectManagement . protectedSelectors . projectConfig ,
15- ( { restorableConfigs } ) => [ ...restorableConfigs ] . reverse ( )
16- ) ;
17-
18- const chartIconUrlByRestorableConfigIndex = createSelector (
19- state ,
20- restorableConfigs ,
21- ( state , restorableConfigs ) : Record < number , string | undefined > => {
22- const { indexedChartsIcons } = state ;
23-
24- const chartIconUrlByRestorableConfigIndex = Object . fromEntries (
25- restorableConfigs . map ( ( restorableConfig , restorableConfigIndex ) => [
26- restorableConfigIndex ,
12+ createSelector ( state , state => state . indexedChartsIcons ) ,
13+ ( { restorableConfigs } , indexedChartsIcons ) =>
14+ restorableConfigs . map ( restorableConfig => ( {
15+ ...restorableConfig ,
16+ chartIconUrl :
2717 indexedChartsIcons [ restorableConfig . catalogId ] ?. [
2818 restorableConfig . chartName
2919 ]
30- ] )
31- ) ;
32-
33- return chartIconUrlByRestorableConfigIndex ;
34- }
20+ } ) )
3521) ;
3622
37- const main = createSelector (
38- restorableConfigs ,
39- chartIconUrlByRestorableConfigIndex ,
40- ( restorableConfigs , chartIconUrlByRestorableConfigIndex ) => ( {
41- restorableConfigs,
42- chartIconUrlByRestorableConfigIndex
43- } )
44- ) ;
45-
46- export const protectedSelectors = {
47- restorableConfigs,
48- chartIconUrlByRestorableConfigIndex
49- } ;
50-
5123export const selectors = {
52- main
24+ restorableConfigs
5325} ;
0 commit comments