]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/commitdiff
toaster: make locale packages uneditable in custom image page
authorElliot Smith <elliot.smith@intel.com>
Thu, 21 Jan 2016 17:11:11 +0000 (17:11 +0000)
committerbrian avery <avery.brian@gmail.com>
Mon, 8 Feb 2016 20:48:14 +0000 (12:48 -0800)
When the packages associated with a custom image recipe are
shown in the customrecipe editing page, locale packages are
shown in the same way as all other packages. This gives the false
impression that these packages can be removed, when in fact
they are automatically added due to the IMAGE_LINGUAS build
variable.

Modify the customrecipe page so that locale packages cannot be
removed, and provide some help text explaining why.

[YOCTO #8927]

Signed-off-by: Elliot Smith <elliot.smith@intel.com>
Signed-off-by: brian avery <avery.brian@gmail.com>
lib/toaster/orm/models.py
lib/toaster/toastergui/static/css/default.css
lib/toaster/toastergui/tables.py
lib/toaster/toastergui/templates/pkg_add_rm_btn.html

index 1cf997cfe52549ded011307c303b8e3e56dc4e63..b70fa18feb3346b0b47693771da2068ce2517370 100644 (file)
@@ -749,6 +749,20 @@ class Package(models.Model):
     section = models.CharField(max_length=80, blank=True)
     license = models.CharField(max_length=80, blank=True)
 
+    @property
+    def is_locale_package(self):
+        """ Returns True if this package is identifiable as a locale package """
+        if self.name.find('locale') != -1:
+            return True
+        return False
+
+    @property
+    def is_packagegroup(self):
+        """ Returns True is this package is identifiable as a packagegroup """
+        if self.name.find('packagegroup') != -1:
+            return True
+        return False
+
 class CustomImagePackage(Package):
     # CustomImageRecipe fields to track pacakges appended,
     # included and excluded from a CustomImageRecipe
index bc8a97bedc0e644c4eee44342a9211a1555053fd..b674a9de8ebb264a8adf19ca8c5e5feb52ac9353 100644 (file)
@@ -153,6 +153,9 @@ select { width: auto; }
 /* make tables Chrome-happy (me, not so much) */
 table { table-layout: fixed; word-wrap: break-word; }
 
+table p { margin-bottom: 0 }
+.table td { vertical-align: middle; }
+
 /* styles for the new build button */
 .new-build .btn-primary { padding: 4px 30px; }
 .new-build .alert { margin-top: 10px; }
index b73f459b2caa337a6295052d84624634066d53cd..b906718b66554e58fcc20b6954a19cb2d4bf8427 100644 (file)
@@ -765,12 +765,27 @@ class SelectPackagesTable(PackagesTable):
     def setup_columns(self, *args, **kwargs):
         super(SelectPackagesTable, self).setup_columns(*args, **kwargs)
 
+        add_remove_template = '''
+        {% if data.is_locale_package %}
+          <p class="text-center">
+            <span class="muted">Locale package</span>
+            <i class="icon-question-sign get-help hover-help" title=""
+               data-original-title="This package is included in your image
+               because the locale is specified in the IMAGE_LINGUAS variable"
+               style="visibility: hidden;">
+            </i>
+          </p>
+        {% else %}
+          {% include "pkg_add_rm_btn.html" %}
+        {% endif %}
+        '''
+
         self.add_column(title="Add | Remove",
                         hideable=False,
                         help_text="Use the add and remove buttons to modify "
                         "the package content of your custom image",
                         static_data_name="add_rm_pkg_btn",
-                        static_data_template='{% include "pkg_add_rm_btn.html" %}',
+                        static_data_template=add_remove_template,
                         filter_name='in_current_image_filter')
 
     def setup_filters(self, *args, **kwargs):
index 493456f85564059c53387ac75295b2e937aa2beb..0d4429962e1c8d3f4d7db9bab7b0a243c1743fa6 100644 (file)
@@ -7,7 +7,7 @@
       ">
     <i class="icon-trash no-tooltip"></i>
     Remove package
-  </a>
+  </button>
   <button class="btn btn-block add-rm-package-btn" data-directive="add" data-package="{{data.pk}}" data-package-url="{% url 'xhr_customrecipe_packages' extra.recipe_id data.pk %}" data-name="{{data.name}}" style="
       {% if data.pk in extra.current_packages %}
       display:none