mirror of
https://github.com/inventree/InvenTree.git
synced 2025-04-30 04:26:44 +00:00
naming refactor
This commit is contained in:
parent
cb30188623
commit
c085a86891
@ -280,7 +280,7 @@ class IntegrationPluginBase(MixinBase, plugin.InvenTreePlugin):
|
|||||||
self.def_path = inspect.getfile(self.__class__)
|
self.def_path = inspect.getfile(self.__class__)
|
||||||
self.path = os.path.dirname(self.def_path)
|
self.path = os.path.dirname(self.def_path)
|
||||||
|
|
||||||
self.set_sign_values()
|
self.set_package()
|
||||||
|
|
||||||
# properties
|
# properties
|
||||||
@property
|
@property
|
||||||
@ -304,7 +304,7 @@ class IntegrationPluginBase(MixinBase, plugin.InvenTreePlugin):
|
|||||||
"""returns author of plugin - either from plugin settings or git"""
|
"""returns author of plugin - either from plugin settings or git"""
|
||||||
name = getattr(self, 'AUTHOR', None)
|
name = getattr(self, 'AUTHOR', None)
|
||||||
if not name:
|
if not name:
|
||||||
name = self.commit.get('author')
|
name = self.package.get('author')
|
||||||
if not name:
|
if not name:
|
||||||
name = _('No author found')
|
name = _('No author found')
|
||||||
return name
|
return name
|
||||||
@ -314,7 +314,7 @@ class IntegrationPluginBase(MixinBase, plugin.InvenTreePlugin):
|
|||||||
"""returns publishing date of plugin - either from plugin settings or git"""
|
"""returns publishing date of plugin - either from plugin settings or git"""
|
||||||
name = getattr(self, 'PUBLISH_DATE', None)
|
name = getattr(self, 'PUBLISH_DATE', None)
|
||||||
if not name:
|
if not name:
|
||||||
name = self.commit.get('date')
|
name = self.package.get('date')
|
||||||
else:
|
else:
|
||||||
name = datetime.fromisoformat(str(name))
|
name = datetime.fromisoformat(str(name))
|
||||||
if not name:
|
if not name:
|
||||||
@ -350,25 +350,25 @@ class IntegrationPluginBase(MixinBase, plugin.InvenTreePlugin):
|
|||||||
"""get last git commit for plugin"""
|
"""get last git commit for plugin"""
|
||||||
return get_git_log(self.def_path)
|
return get_git_log(self.def_path)
|
||||||
|
|
||||||
def set_sign_values(self):
|
def set_package(self):
|
||||||
"""add the last commit of the plugins class file into plugins context"""
|
"""add the last commit of the plugins class file into plugins context"""
|
||||||
if self.is_package:
|
if self.is_package:
|
||||||
# is a package - no signing - no commit
|
# is a package - no signing - no commit
|
||||||
commit = {}
|
package = {}
|
||||||
else:
|
else:
|
||||||
# fetch git log
|
# fetch git log
|
||||||
commit = self.get_plugin_commit()
|
package = self.get_plugin_commit()
|
||||||
|
|
||||||
# resolve state
|
# resolve state
|
||||||
sign_state = getattr(GitStatus, str(commit.get('verified')), GitStatus.N)
|
sign_state = getattr(GitStatus, str(package.get('verified')), GitStatus.N)
|
||||||
|
|
||||||
# set variables
|
# set variables
|
||||||
self.commit = commit
|
self.package = package
|
||||||
self.sign_state = sign_state
|
self.sign_state = sign_state
|
||||||
|
|
||||||
# process date
|
# process date
|
||||||
if self.commit.get('date'):
|
if self.package.get('date'):
|
||||||
self.commit['date'] = datetime.fromisoformat(self.commit.get('date'))
|
self.package['date'] = datetime.fromisoformat(self.package.get('date'))
|
||||||
|
|
||||||
if sign_state.status == 0:
|
if sign_state.status == 0:
|
||||||
self.sign_color = 'success'
|
self.sign_color = 'success'
|
||||||
|
@ -56,29 +56,29 @@
|
|||||||
<col width='25'>
|
<col width='25'>
|
||||||
<tr>
|
<tr>
|
||||||
<td><span class='fas fa-user'></span></td>
|
<td><span class='fas fa-user'></span></td>
|
||||||
<td>{% trans "Commit Author" %}</td><td>{{ plugin.commit.author }} - {{ plugin.commit.mail }}{% include "clip.html" %}</td>
|
<td>{% trans "Commit Author" %}</td><td>{{ plugin.package.author }} - {{ plugin.package.mail }}{% include "clip.html" %}</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td><span class='fas fa-calendar-alt'></span></td>
|
<td><span class='fas fa-calendar-alt'></span></td>
|
||||||
<td>{% trans "Commit Date" %}</td><td>{{ plugin.commit.date }}{% include "clip.html" %}</td>
|
<td>{% trans "Commit Date" %}</td><td>{{ plugin.package.date }}{% include "clip.html" %}</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td><span class='fas fa-code-branch'></span></td>
|
<td><span class='fas fa-code-branch'></span></td>
|
||||||
<td>{% trans "Commit Hash" %}</td><td>{{ plugin.commit.hash }}{% include "clip.html" %}</td>
|
<td>{% trans "Commit Hash" %}</td><td>{{ plugin.package.hash }}{% include "clip.html" %}</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<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.package.message }}{% include "clip.html" %}</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td><span class='text-{{plugin.sign_color}} fas fa-check'></span></td>
|
<td><span class='text-{{plugin.sign_color}} fas fa-check'></span></td>
|
||||||
<td>{% trans "Commit Sign Status" %}</td>
|
<td>{% trans "Commit Sign Status" %}</td>
|
||||||
<td class="bg-{{plugin.sign_color}}">{% if plugin.commit.verified %}{{ plugin.commit.verified }}: {% endif%}{{ plugin.sign_state.msg }}</td>
|
<td class="bg-{{plugin.sign_color}}">{% if plugin.package.verified %}{{ plugin.package.verified }}: {% endif%}{{ plugin.sign_state.msg }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td><span class='text-{{plugin.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-{{plugin.sign_color}}">{{ plugin.commit.key }}{% include "clip.html" %}</td>
|
<td class="bg-{{plugin.sign_color}}">{{ plugin.package.key }}{% include "clip.html" %}</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user