Complete API token authz UI flows
This commit is contained in:
+27
-19
@@ -928,33 +928,29 @@ func (u *ui) handleApprovalAndAPIClicks(gtx layout.Context) {
|
||||
}
|
||||
|
||||
func (u *ui) handleApprovalClicks(gtx layout.Context) {
|
||||
for u.allowApproval.Clicked(gtx) {
|
||||
for u.allowApprovalOnce.Clicked(gtx) {
|
||||
u.runAction("allow API request", func() error {
|
||||
outcome := apiapproval.OutcomeAllowOnce
|
||||
if u.approvalPermanent.Value {
|
||||
outcome = apiapproval.OutcomeAllowPermanent
|
||||
}
|
||||
err := u.resolvePendingApproval(outcome)
|
||||
u.approvalPermanent.Value = false
|
||||
return err
|
||||
return u.resolvePendingApproval(apiapproval.OutcomeAllowOnce)
|
||||
})
|
||||
}
|
||||
for u.denyApproval.Clicked(gtx) {
|
||||
for u.allowApprovalPermanent.Clicked(gtx) {
|
||||
u.runAction("allow API request permanently", func() error {
|
||||
return u.resolvePendingApproval(apiapproval.OutcomeAllowPermanent)
|
||||
})
|
||||
}
|
||||
for u.denyApprovalOnce.Clicked(gtx) {
|
||||
u.runAction("deny API request", func() error {
|
||||
outcome := apiapproval.OutcomeDenyOnce
|
||||
if u.approvalPermanent.Value {
|
||||
outcome = apiapproval.OutcomeDenyPermanent
|
||||
}
|
||||
err := u.resolvePendingApproval(outcome)
|
||||
u.approvalPermanent.Value = false
|
||||
return err
|
||||
return u.resolvePendingApproval(apiapproval.OutcomeDenyOnce)
|
||||
})
|
||||
}
|
||||
for u.denyApprovalPermanent.Clicked(gtx) {
|
||||
u.runAction("deny API request permanently", func() error {
|
||||
return u.resolvePendingApproval(apiapproval.OutcomeDenyPermanent)
|
||||
})
|
||||
}
|
||||
for u.cancelApproval.Clicked(gtx) {
|
||||
u.runAction("cancel API request", func() error {
|
||||
err := u.resolvePendingApproval(apiapproval.OutcomeCancel)
|
||||
u.approvalPermanent.Value = false
|
||||
return err
|
||||
return u.resolvePendingApproval(apiapproval.OutcomeCancel)
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -996,6 +992,12 @@ func (u *ui) handleAPIPolicyClicks(gtx layout.Context) {
|
||||
for u.addAPIPolicyRule.Clicked(gtx) {
|
||||
u.runAction("add API policy rule", u.addAPIPolicyRuleAction)
|
||||
}
|
||||
for u.saveAPIPolicyRule.Clicked(gtx) {
|
||||
u.runAction("save API policy rule", u.saveAPIPolicyRuleAction)
|
||||
}
|
||||
for u.cancelAPIPolicyEdit.Clicked(gtx) {
|
||||
u.runAction("cancel API policy edit", u.cancelAPIPolicyEditAction)
|
||||
}
|
||||
for u.useCurrentGroupForPolicy.Clicked(gtx) {
|
||||
u.runAction("use current group for API policy", u.useCurrentGroupForPolicyAction)
|
||||
}
|
||||
@@ -1005,6 +1007,12 @@ func (u *ui) handleAPIPolicyClicks(gtx layout.Context) {
|
||||
for u.clearAPIPolicyTarget.Clicked(gtx) {
|
||||
u.runAction("clear API policy target", u.clearAPIPolicyTargetAction)
|
||||
}
|
||||
for i := range u.apiPolicyEdits {
|
||||
for u.apiPolicyEdits[i].Clicked(gtx) {
|
||||
index := i
|
||||
u.runAction("edit API policy rule", func() error { return u.editAPIPolicyRuleAction(index) })
|
||||
}
|
||||
}
|
||||
for i := range u.apiPolicyRemoves {
|
||||
for u.apiPolicyRemoves[i].Clicked(gtx) {
|
||||
index := i
|
||||
|
||||
Reference in New Issue
Block a user