2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-06-17 12:35:46 +00:00

refactor sign_color to property

This commit is contained in:
Matthias
2021-09-23 01:13:40 +02:00
parent 3ac3004cd0
commit 261537dc43
2 changed files with 16 additions and 9 deletions

View File

@ -164,8 +164,10 @@ 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):
return key in self._mixins
@ -179,3 +181,13 @@ class IntegrationPlugin(MixinBase, plugin.InvenTreePlugin):
def get_plugin_commit(self):
path = inspect.getfile(self.__class__)
return get_git_log(path)
def set_sign_values(self):
if self.sign_state == 0:
self.sign_color = 'success'
elif self.sign_state == 1:
self.sign_color = 'warning'
else:
self.sign_color = 'danger'