mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
refactor of sign state set function
This commit is contained in:
parent
8285bfe1a3
commit
24421ee814
@ -179,8 +179,6 @@ class IntegrationPlugin(MixinBase, plugin.InvenTreePlugin):
|
||||
def __init__(self):
|
||||
self.add_mixin('base')
|
||||
|
||||
self.commit = self.get_plugin_commit()
|
||||
self.sign_state = 0
|
||||
self.set_sign_values()
|
||||
|
||||
def mixin(self, key):
|
||||
@ -197,11 +195,18 @@ class IntegrationPlugin(MixinBase, plugin.InvenTreePlugin):
|
||||
return get_git_log(path)
|
||||
|
||||
def set_sign_values(self):
|
||||
if self.sign_state == 0:
|
||||
# fetch git log
|
||||
commit = self.get_plugin_commit()
|
||||
# resolve state
|
||||
sign_state = getattr(GitStatus, commit['verified'], GitStatus.E)
|
||||
|
||||
# set variables
|
||||
self.commit = commit
|
||||
self.sign_state = sign_state
|
||||
|
||||
if sign_state.status == 0:
|
||||
self.sign_color = 'success'
|
||||
|
||||
elif self.sign_state == 1:
|
||||
elif sign_state.status == 1:
|
||||
self.sign_color = 'warning'
|
||||
|
||||
else:
|
||||
self.sign_color = 'danger'
|
||||
|
Loading…
Reference in New Issue
Block a user