-
Notifications
You must be signed in to change notification settings - Fork 939
chore: Make deployment admin page show better durations #6856
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Also fix group mappings
// We have to add in the 25 leap days for the frontend to show the | ||
// "100 years" correctly. | ||
Default: ((100 * 365 * time.Hour * 24) + (25 * time.Hour * 24)).String(), | ||
Value: &c.MaxTokenLifetime, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In apikey.go
, we check to see if --max-token-lifetime
is unset. I think we'll have to adjust this logic now that we aren't using time.Duration(math.MaxInt64)
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oof, I hate this maxint buisness. We should have just used 0 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can bring back in "unset" if we need later.
I think we need to regenerate |
// optionValue is a helper function to format the value of a specific deployment options | ||
function optionValue(option: DeploymentOption): string[] | string | unknown { | ||
switch (option.name) { | ||
case "Max Token Lifetime": |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's up with this empty case?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't case blocks fall through to each other? These two cases are handled the same.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
:D I had to google that - you're right.
Down the road, I wonder if we should type DeploymentOption.flag
as something other than string
(like we should return an enum). Then we could have an object lookup on the FE, like:
const deploymentOptionFormats: { [key: FlagEnum]: (option: DeploymentOption) => string[] | string | unknown } = {
flagName1: (option) => {
// format and return
},
....
}
// in the JSX
<OptionValue>{deploymentOptionFormats[option.flag](option)}</OptionValue>
This would give us some additional type safety. Not something to worry about in this PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 Totally makes sense. I didn't know the "typescript" way to do this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Everything looks great - thanks for tackling this.
Also fix group mappings
fixes: #6834
After