mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +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.path = os.path.dirname(self.def_path)
|
||||
|
||||
self.set_sign_values()
|
||||
self.set_package()
|
||||
|
||||
# properties
|
||||
@property
|
||||
@ -304,7 +304,7 @@ class IntegrationPluginBase(MixinBase, plugin.InvenTreePlugin):
|
||||
"""returns author of plugin - either from plugin settings or git"""
|
||||
name = getattr(self, 'AUTHOR', None)
|
||||
if not name:
|
||||
name = self.commit.get('author')
|
||||
name = self.package.get('author')
|
||||
if not name:
|
||||
name = _('No author found')
|
||||
return name
|
||||
@ -314,7 +314,7 @@ class IntegrationPluginBase(MixinBase, plugin.InvenTreePlugin):
|
||||
"""returns publishing date of plugin - either from plugin settings or git"""
|
||||
name = getattr(self, 'PUBLISH_DATE', None)
|
||||
if not name:
|
||||
name = self.commit.get('date')
|
||||
name = self.package.get('date')
|
||||
else:
|
||||
name = datetime.fromisoformat(str(name))
|
||||
if not name:
|
||||
@ -350,25 +350,25 @@ class IntegrationPluginBase(MixinBase, plugin.InvenTreePlugin):
|
||||
"""get last git commit for plugin"""
|
||||
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"""
|
||||
if self.is_package:
|
||||
# is a package - no signing - no commit
|
||||
commit = {}
|
||||
package = {}
|
||||
else:
|
||||
# fetch git log
|
||||
commit = self.get_plugin_commit()
|
||||
package = self.get_plugin_commit()
|
||||
|
||||
# resolve state
|
||||
sign_state = getattr(GitStatus, str(commit.get('verified')), GitStatus.N)
|
||||
sign_state = getattr(GitStatus, str(package.get('verified')), GitStatus.N)
|
||||
|
||||
# set variables
|
||||
self.commit = commit
|
||||
self.package = package
|
||||
self.sign_state = sign_state
|
||||
|
||||
# process date
|
||||
if self.commit.get('date'):
|
||||
self.commit['date'] = datetime.fromisoformat(self.commit.get('date'))
|
||||
if self.package.get('date'):
|
||||
self.package['date'] = datetime.fromisoformat(self.package.get('date'))
|
||||
|
||||
if sign_state.status == 0:
|
||||
self.sign_color = 'success'
|
||||
|
@ -56,29 +56,29 @@
|
||||
<col width='25'>
|
||||
<tr>
|
||||
<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>
|
||||
<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>
|
||||
<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>
|
||||
<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>
|
||||
<td><span class='text-{{plugin.sign_color}} fas fa-check'></span></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>
|
||||
<td><span class='text-{{plugin.sign_color}} fas fa-key'></span></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>
|
||||
</table>
|
||||
</div>
|
||||
|
Loading…
x
Reference in New Issue
Block a user