File tree 3 files changed +27
-25
lines changed
site/src/components/DeploySettingsLayout 3 files changed +27
-25
lines changed Original file line number Diff line number Diff line change @@ -12,7 +12,7 @@ import {
12
12
OptionValue ,
13
13
} from "components/DeploySettingsLayout/Option" ;
14
14
import { FC } from "react" ;
15
- import { intervalToDuration , formatDuration } from "date-fns " ;
15
+ import { optionValue } from "./optionValue " ;
16
16
17
17
const OptionsTable : FC < {
18
18
options : DeploymentOption [ ] ;
@@ -60,29 +60,6 @@ const OptionsTable: FC<{
60
60
) ;
61
61
} ;
62
62
63
- // optionValue is a helper function to format the value of a specific deployment options
64
- export function optionValue ( option : DeploymentOption ) {
65
- switch ( option . name ) {
66
- case "Max Token Lifetime" :
67
- case "Session Duration" :
68
- // intervalToDuration takes ms, so convert nanoseconds to ms
69
- return formatDuration (
70
- intervalToDuration ( { start : 0 , end : ( option . value as number ) / 1e6 } ) ,
71
- ) ;
72
- case "Strict-Transport-Security" :
73
- if ( option . value === 0 ) {
74
- return "Disabled" ;
75
- }
76
- return ( option . value as number ) . toString ( ) + "s" ;
77
- case "OIDC Group Mapping" :
78
- return Object . entries ( option . value as Record < string , string > ) . map (
79
- ( [ key , value ] ) => `"${ key } "->"${ value } "` ,
80
- ) ;
81
- default :
82
- return option . value ;
83
- }
84
- }
85
-
86
63
const useStyles = makeStyles ( ( theme ) => ( {
87
64
table : {
88
65
"& td" : {
Original file line number Diff line number Diff line change 1
- import { optionValue } from "./OptionsTable " ;
1
+ import { optionValue } from "./optionValue " ;
2
2
import { DeploymentOption } from "api/types" ;
3
3
4
4
const defaultOption : DeploymentOption = {
Original file line number Diff line number Diff line change
1
+ import { DeploymentOption } from "api/types" ;
2
+ import { intervalToDuration , formatDuration } from "date-fns" ;
3
+
4
+ // optionValue is a helper function to format the value of a specific deployment options
5
+ export function optionValue ( option : DeploymentOption ) {
6
+ switch ( option . name ) {
7
+ case "Max Token Lifetime" :
8
+ case "Session Duration" :
9
+ // intervalToDuration takes ms, so convert nanoseconds to ms
10
+ return formatDuration (
11
+ intervalToDuration ( { start : 0 , end : ( option . value as number ) / 1e6 } ) ,
12
+ ) ;
13
+ case "Strict-Transport-Security" :
14
+ if ( option . value === 0 ) {
15
+ return "Disabled" ;
16
+ }
17
+ return ( option . value as number ) . toString ( ) + "s" ;
18
+ case "OIDC Group Mapping" :
19
+ return Object . entries ( option . value as Record < string , string > ) . map (
20
+ ( [ key , value ] ) => `"${ key } "->"${ value } "` ,
21
+ ) ;
22
+ default :
23
+ return option . value ;
24
+ }
25
+ }
You can’t perform that action at this time.
0 commit comments