1
1
# initialize product and category selectors ----
2
2
3
- general_opts <- reactiveValues()
3
+ # general_opts <- reactiveValues()
4
4
rv <- reactiveValues()
5
5
6
6
output $ selcats <- renderUI({
7
- curprod <- which(names(prod_opt_list ) == general_opts $ selprod )
8
- curcat <- mod_prod_cat $ cat [curprod ]
9
- shiny :: selectInput(" selcat" , " Product Category" ,
10
- choices = unique(mod_prod_cat $ cat ),
11
- selected = curcat )
7
+ # curprod <- which(names(prod_opt_list) == general_opts$selprod)
8
+ # curcat <- mod_prod_cat$cat[curprod]
9
+ shiny :: selectInput(
10
+ " selcat" , " Product Category" ,
11
+ choices = unique(mod_prod_cat $ cat ),
12
+ selected = unique(mod_prod_cat $ cat )[1 ]
13
+ )
12
14
})
13
15
14
16
output $ selprods <- renderUI({
15
- shiny :: selectInput(" selprod" ,
16
- label = shiny :: span(" Product Name\u 2000" ,
17
- shiny :: actionLink(" help_product" ,
18
- shiny :: icon(" question-circle" ))),
19
- choices = mod_prod_list [mod_prod_cat $ cat == (input $ selcat )],
20
- selected = general_opts $ selprod )
17
+ shiny :: selectInput(
18
+ " selprod" ,
19
+ label = shiny :: span(
20
+ " Product Name\u 2000" ,
21
+ shiny :: actionLink(" help_product" , shiny :: icon(" question-circle" ))
22
+ ),
23
+ choices = mod_prod_list [mod_prod_cat $ cat == (input $ selcat )],
24
+ selected = mod_prod_list [mod_prod_cat $ cat == (input $ selcat )][1 ]
25
+ )
21
26
})
22
27
23
28
output $ selvers <- renderUI({
24
29
req(input $ selprod )
25
- shiny :: selectInput(" selver" ,
26
- label = shiny :: span(" Version\u 2000" ,
27
- shiny :: actionLink(" help_version" ,
28
- shiny :: icon(" question-circle" ))),
29
- choices = names(prod_opt_list [[input $ selprod ]]),
30
- selected = general_opts $ selver )
30
+ shiny :: selectInput(
31
+ " selver" ,
32
+ label = shiny :: span(
33
+ " Version\u 2000" ,
34
+ shiny :: actionLink(" help_version" , shiny :: icon(" question-circle" ))
35
+ ),
36
+ choices = names(prod_opt_list [[input $ selprod ]]),
37
+ selected = rev(names(prod_opt_list [[input $ selprod ]]))[1 ]
38
+ )
31
39
})
32
40
33
41
shiny :: observeEvent(input $ prodinfo , {
@@ -45,10 +53,12 @@ observe({
45
53
46
54
curlayers <- prod_opt_list [[curprod ]][[input $ selver ]]$ bandnames
47
55
curlabels <- prod_opt_list [[curprod ]][[input $ selver ]]$ band_fullnames
48
- shiny :: updateCheckboxGroupInput(session , " sel_layers" ,
49
- choiceNames = curlabels ,
50
- choiceValues = curlayers ,
51
- selected = general_opts $ curlayers )
56
+ shiny :: updateCheckboxGroupInput(
57
+ session , " sel_layers" ,
58
+ choiceNames = curlabels ,
59
+ choiceValues = curlayers ,
60
+ selected = NULL
61
+ )
52
62
53
63
# shiny::isolate(general_opts$curlayers) <- ""
54
64
@@ -60,10 +70,12 @@ observe({
60
70
qalabels <- " No Quality layers available"
61
71
}
62
72
63
- shiny :: updateCheckboxGroupInput(session , " sel_qual" ,
64
- choiceNames = qalabels ,
65
- choiceValues = qalayers ,
66
- selected = general_opts $ curqual )
73
+ shiny :: updateCheckboxGroupInput(
74
+ session , " sel_qual" ,
75
+ choiceNames = qalabels ,
76
+ choiceValues = qalayers ,
77
+ selected = NULL
78
+ )
67
79
68
80
# shiny::isolate(general_opts$curqual) <- ""
69
81
@@ -90,10 +102,12 @@ observe({
90
102
indlayers <- NA
91
103
indlabels <- " No Indexes available"
92
104
}
93
- shiny :: updateCheckboxGroupInput(session , " sel_ind" ,
94
- choiceNames = indlabels ,
95
- choiceValues = indlayers ,
96
- selected = general_opts $ curindexes )
105
+ shiny :: updateCheckboxGroupInput(
106
+ session , " sel_ind" ,
107
+ choiceNames = indlabels ,
108
+ choiceValues = indlayers ,
109
+ selected = NULL
110
+ )
97
111
98
112
# shiny::isolate(general_opts$curindexes) <- ""
99
113
})
@@ -209,6 +223,7 @@ shiny::observe({
209
223
shiny :: observe({
210
224
shiny :: req(input $ selprod )
211
225
shiny :: req(input $ selver )
226
+ shiny :: req(input $ selver %in% names(prod_opt_list [[input $ selprod ]]))
212
227
indexes <- MODIStsp_get_prodlayers(input $ selprod , input $ selver )$ indexes_bandnames
213
228
if (is.null(indexes )) {
214
229
shinyjs :: disable(" addindex" )
0 commit comments