mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
refactor sign_color to property
This commit is contained in:
parent
3ac3004cd0
commit
261537dc43
@ -164,8 +164,10 @@ class IntegrationPlugin(MixinBase, plugin.InvenTreePlugin):
|
|||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.add_mixin('base')
|
self.add_mixin('base')
|
||||||
|
|
||||||
self.commit = self.get_plugin_commit()
|
self.commit = self.get_plugin_commit()
|
||||||
self.sign_state = 0
|
self.sign_state = 0
|
||||||
|
self.set_sign_values()
|
||||||
|
|
||||||
def mixin(self, key):
|
def mixin(self, key):
|
||||||
return key in self._mixins
|
return key in self._mixins
|
||||||
@ -179,3 +181,13 @@ class IntegrationPlugin(MixinBase, plugin.InvenTreePlugin):
|
|||||||
def get_plugin_commit(self):
|
def get_plugin_commit(self):
|
||||||
path = inspect.getfile(self.__class__)
|
path = inspect.getfile(self.__class__)
|
||||||
return get_git_log(path)
|
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'
|
||||||
|
@ -37,20 +37,15 @@
|
|||||||
<td><span class='fas fa-envelope'></span></td>
|
<td><span class='fas fa-envelope'></span></td>
|
||||||
<td>{% trans "Commit Message" %}</td><td>{{ plugin.commit.message }}{% include "clip.html" %}</td>
|
<td>{% trans "Commit Message" %}</td><td>{{ plugin.commit.message }}{% include "clip.html" %}</td>
|
||||||
</tr>
|
</tr>
|
||||||
{% if plugin.sign_state == 0 %}
|
|
||||||
{% define 'success' as sign_color %}
|
|
||||||
{% else %}
|
|
||||||
{% define 'danger' as sign_color %}
|
|
||||||
{% endif %}
|
|
||||||
<tr>
|
<tr>
|
||||||
<td><span class='text-{{sign_color}} fas fa-check'></span></td>
|
<td><span class='text-{{plugin.sign_color}} fas fa-check'></span></td>
|
||||||
<td>{% trans "Commit verified" %}</td>
|
<td>{% trans "Commit verified" %}</td>
|
||||||
<td class="bg-{{sign_color}}">{{ plugin.commit.verified }}</td>
|
<td class="bg-{{plugin.sign_color}}">{{ plugin.commit.verified }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td><span class='text-{{sign_color}} fas fa-key'></span></td>
|
<td><span class='text-{{plugin.sign_color}} fas fa-key'></span></td>
|
||||||
<td>{% trans "Commit Sign Key" %}</td>
|
<td>{% trans "Commit Sign Key" %}</td>
|
||||||
<td class="bg-{{sign_color}}">{{ plugin.commit.key }}{% include "clip.html" %}</td>
|
<td class="bg-{{plugin.sign_color}}">{{ plugin.commit.key }}{% include "clip.html" %}</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
Reference in New Issue
Block a user