From: Elliot Smith
Date: Tue, 23 Feb 2016 12:17:04 +0000 (+0000)
Subject: toaster: show suffix for image files and basename for artifact files
X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=8084dcdc283b4dc170f066c202f89d56ce1abbef;p=thirdparty%2Fopenembedded%2Fopenembedded-core-contrib.git
toaster: show suffix for image files and basename for artifact files
The build dashboard doesn't show image and artifact files correctly,
as it shows the full filename for images and the filename plus
path relative to DEPLOY_DIR for artifacts.
Instead, show just the suffix for image files, and the basename
for artifact files.
Signed-off-by: Elliot Smith
Signed-off-by: Richard Purdie
---
diff --git a/lib/toaster/orm/models.py b/lib/toaster/orm/models.py
index ab6940feafc..93b5df3d4ec 100644
--- a/lib/toaster/orm/models.py
+++ b/lib/toaster/orm/models.py
@@ -550,6 +550,8 @@ class BuildArtifact(models.Model):
return self.file_name
+ def get_basename(self):
+ return os.path.basename(self.file_name)
def is_available(self):
return self.build.buildrequest.environment.has_artifact(self.file_name)
@@ -588,6 +590,12 @@ class Target_Image_File(models.Model):
file_name = models.FilePathField(max_length=254)
file_size = models.IntegerField()
+ @property
+ def suffix(self):
+ filename, suffix = os.path.splitext(self.file_name)
+ suffix = suffix.lstrip('.')
+ return suffix
+
class Target_File(models.Model):
ITYPE_REGULAR = 1
ITYPE_DIRECTORY = 2
diff --git a/lib/toaster/toastergui/templates/builddashboard.html b/lib/toaster/toastergui/templates/builddashboard.html
index 7857abaaac7..a0da71ea4c0 100644
--- a/lib/toaster/toastergui/templates/builddashboard.html
+++ b/lib/toaster/toastergui/templates/builddashboard.html
@@ -110,7 +110,7 @@
- {% else %}
+ {% else %}
@@ -125,18 +125,18 @@
- {% for i in target.imageFiles %}
- {% if build.project %}
-