1
+ import { DASHBOARD_FOCUS_INDEX , DEPLOYMENT_STATUS } from "../../constants" ;
1
2
import {
2
- DEPLOYMENT_STATUS ,
3
+ RESOURCE_TABLE_CONFIG ,
3
4
RESOURCE_TABLE_TYPE ,
4
- DASHBOARD_FOCUS_INDEX ,
5
- } from "../constants" ;
6
- import { getStackResources } from "../services/stackResources" ;
7
- import { padString } from "../utils/padString" ;
8
- import { lambdaStatisticsModal , lambdaInvokeModal } from "../modals" ;
9
- import { getLambdaFunctions } from "../services" ;
10
- import { abbreviateFunction } from "../utils/abbreviateFunction" ;
5
+ switchTableConfig ,
6
+ } from "./resourceTableConfig" ;
7
+ import { lambdaInvokeModal , lambdaStatisticsModal } from "../../modals" ;
8
+
9
+ import { abbreviateFunction } from "../../utils/abbreviateFunction" ;
10
+ import { getLambdaFunctions } from "../../services" ;
11
+ import { getStackResources } from "../../services/stackResources" ;
12
+ import { padString } from "../../utils/padString" ;
11
13
12
14
const contrib = require ( "blessed-contrib" ) ;
13
15
const open = require ( "open" ) ;
@@ -154,14 +156,10 @@ class ResourceTable {
154
156
switchTable ( ) {
155
157
switch ( this . type ) {
156
158
case RESOURCE_TABLE_TYPE . LAMBDA :
157
- this . type = RESOURCE_TABLE_TYPE . ALL_RESOURCES ;
158
- this . table . setLabel ( "<- All Resources ->" ) ;
159
- this . table . options . columnWidth = [ 50 , 30 ] ;
159
+ switchTableConfig ( this , RESOURCE_TABLE_TYPE . ALL_RESOURCES ) ;
160
160
break ;
161
161
case RESOURCE_TABLE_TYPE . ALL_RESOURCES :
162
- this . type = RESOURCE_TABLE_TYPE . LAMBDA ;
163
- this . table . setLabel ( "<- Lambda Functions ->" ) ;
164
- this . table . options . columnWidth = [ 30 , 30 , 10 , 10 , 20 ] ;
162
+ switchTableConfig ( this , RESOURCE_TABLE_TYPE . LAMBDA ) ;
165
163
break ;
166
164
default :
167
165
return 0 ;
@@ -173,9 +171,10 @@ class ResourceTable {
173
171
return this . application . layoutGrid . set ( 0 , 6 , 4 , 6 , contrib . table , {
174
172
keys : true ,
175
173
fg : "green" ,
176
- label : "<- Lambda Functions ->" ,
174
+ label : RESOURCE_TABLE_CONFIG [ RESOURCE_TABLE_TYPE . LAMBDA ] . label ,
177
175
columnSpacing : 1 ,
178
- columnWidth : [ 30 , 30 , 10 , 10 , 20 , 10 ] ,
176
+ columnWidth :
177
+ RESOURCE_TABLE_CONFIG [ RESOURCE_TABLE_TYPE . LAMBDA ] . columnWidth ,
179
178
style : {
180
179
border : {
181
180
fg : "yellow" ,
@@ -206,8 +205,7 @@ class ResourceTable {
206
205
async updateData ( ) {
207
206
const stackResources = await getStackResources (
208
207
this . program . stackName ,
209
- this . cloudformation ,
210
- this . application . setData
208
+ this . cloudformation
211
209
) ;
212
210
213
211
if ( stackResources ) {
0 commit comments