From 57da6e488ff0402afe10deffa66cb898ec68ce48 Mon Sep 17 00:00:00 2001 From: Jinzhu Date: Fri, 13 Oct 2017 13:44:39 +0800 Subject: [PATCH] Use override attrs API to transition resource's attributes --- transition.go | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/transition.go b/transition.go index c2a7123..8fd0d81 100644 --- a/transition.go +++ b/transition.go @@ -222,9 +222,20 @@ func (transition *Transition) ConfigureQorResource(res resource.Resourcer) { meta.Permission = roles.Deny(roles.Update, roles.Anyone).Deny(roles.Create, roles.Anyone) } - res.IndexAttrs(res.IndexAttrs(), "-StateChangeLogs") - res.ShowAttrs(res.ShowAttrs(), "-StateChangeLogs", false) - res.NewAttrs(res.NewAttrs(), "-StateChangeLogs") - res.EditAttrs(res.EditAttrs(), "-StateChangeLogs") + res.OverrideIndexAttrs(func() { + res.IndexAttrs(res.IndexAttrs(), "-StateChangeLogs") + }) + + res.OverrideShowAttrs(func() { + res.ShowAttrs(res.ShowAttrs(), "-StateChangeLogs") + }) + + res.OverrideNewAttrs(func() { + res.NewAttrs(res.NewAttrs(), "-StateChangeLogs") + }) + + res.OverrideEditAttrs(func() { + res.EditAttrs(res.EditAttrs(), "-StateChangeLogs") + }) } }