diff options
Diffstat (limited to 'lib/toaster/toastergui/tables.py')
-rw-r--r-- | lib/toaster/toastergui/tables.py | 162 |
1 files changed, 83 insertions, 79 deletions
diff --git a/lib/toaster/toastergui/tables.py b/lib/toaster/toastergui/tables.py index 2bbef637a..a0eb69591 100644 --- a/lib/toaster/toastergui/tables.py +++ b/lib/toaster/toastergui/tables.py @@ -118,7 +118,7 @@ class LayersTable(ToasterTable): </a> {% if data.get_vcs_link_url %} <a target="_blank" href="{{ data.get_vcs_link_url }}"> - <i class="icon-share get-info"></i> + <span class="glyphicon glyphicon-new-window"></span> </a> {% endif %} ''' @@ -135,7 +135,7 @@ class LayersTable(ToasterTable): </a> {% if data.dirpath and data.get_vcs_dirpath_link_url %} <a target="_blank" href="{{ data.get_vcs_dirpath_link_url }}"> - <i class="icon-share get-info"></i> + <span class="glyphicon glyphicon-new-window"></span> </a> {% endif %}''' @@ -166,8 +166,8 @@ class LayersTable(ToasterTable): deps_template = ''' {% with ods=data.dependencies.all%} {% if ods.count %} - <a class="btn" title="<a href='{% url "layerdetails" extra.pid data.id %}'>{{data.layer.name}}</a> dependencies" - data-content="<ul class='unstyled'> + <a class="btn btn-default" title="<a href='{% url "layerdetails" extra.pid data.id %}'>{{data.layer.name}}</a> dependencies" + data-content="<ul class='list-unstyled'> {% for i in ods%} <li><a href='{% url "layerdetails" extra.pid i.depends_on.pk %}'>{{i.depends_on.layer.name}}</a></li> {% endfor %} @@ -196,7 +196,7 @@ class MachinesTable(ToasterTable): def __init__(self, *args, **kwargs): super(MachinesTable, self).__init__(*args, **kwargs) - self.empty_state = "No machines maybe you need to do a build?" + self.empty_state = "Toaster has no machine information for this project. Sadly, machine information cannot be obtained from builds, so this page will remain empty." self.title = "Compatible machines" self.default_orderby = "name" @@ -264,7 +264,7 @@ class MachinesTable(ToasterTable): field_name="layer_version__get_vcs_reference") machine_file_template = '''<code>conf/machine/{{data.name}}.conf</code> - <a href="{{data.get_vcs_machine_file_link_url}}" target="_blank"><i class="icon-share get-info"></i></a>''' + <a href="{{data.get_vcs_machine_file_link_url}}" target="_blank"><span class="glyphicon glyphicon-new-window"></i></a>''' self.add_column(title="Machine file", hidden=True, @@ -307,7 +307,11 @@ class LayerMachinesTable(MachinesTable): self.add_column(title="Description", field_name="description") - select_btn_template = '<a href="{% url "project" extra.pid %}?setMachine={{data.name}}" class="btn btn-block select-machine-btn" {% if extra.in_prj == 0%}disabled="disabled"{%endif%}>Select machine</a>' + select_btn_template = ''' + <a href="{% url "project" extra.pid %}?setMachine={{data.name}}" + class="btn btn-default btn-block select-machine-btn + {% if extra.in_prj == 0%}disabled{%endif%}">Select machine</a> + ''' self.add_column(title="Select machine", static_data_name="add-del-layers", @@ -319,10 +323,10 @@ class RecipesTable(ToasterTable): def __init__(self, *args, **kwargs): super(RecipesTable, self).__init__(*args, **kwargs) - self.empty_state = "Toaster has no recipe information. To generate recipe information you can configure a layer source then run a build." + self.empty_state = "Toaster has no recipe information. To generate recipe information you need to run a build." build_col = { 'title' : "Build", - 'help_text' : "Add or delete recipes to and from your project", + 'help_text' : "Before building a recipe, you might need to add the corresponding layer to your project", 'hideable' : False, 'filter_name' : "in_current_project", 'static_data_name' : "add-del-layers", @@ -383,7 +387,7 @@ class RecipesTable(ToasterTable): recipe_file_template = ''' <code>{{data.file_path}}</code> <a href="{{data.get_vcs_recipe_file_link_url}}" target="_blank"> - <i class="icon-share get-info"></i> + <span class="glyphicon glyphicon-new-window"></i> </a> ''' @@ -454,7 +458,11 @@ class LayerRecipesTable(RecipesTable): self.add_column(title="Description", field_name="get_description_or_summary") - build_recipe_template ='<button class="btn btn-block build-recipe-btn" data-recipe-name="{{data.name}}" {%if extra.in_prj == 0 %}disabled="disabled"{%endif%}>Build recipe</button>' + build_recipe_template = ''' + <a class="btn btn-default btn-block build-recipe-btn + {% if extra.in_prj == 0 %}disabled{% endif %}" + data-recipe-name="{{data.name}}">Build recipe</a> + ''' self.add_column(title="Build recipe", static_data_name="add-del-layers", @@ -497,7 +505,8 @@ class CustomImagesTable(ToasterTable): recipe_file_template = ''' {% if data.get_base_recipe_file %} <code>{{data.name}}_{{data.version}}.bb</code> - <a href="{% url 'customrecipedownload' extra.pid data.pk %}" class="icon-download-alt get-help" title="Download recipe file"></a> + <a href="{% url 'customrecipedownload' extra.pid data.pk %}" + class="glyphicon glyphicon-download-alt get-help" title="Download recipe file"></a> {% endif %}''' self.add_column(title="Recipe file", @@ -505,18 +514,20 @@ class CustomImagesTable(ToasterTable): static_data_template=recipe_file_template) approx_packages_template = ''' + {% if data.get_all_packages.count > 0 %} <a href="{% url 'customrecipe' extra.pid data.id %}"> {{data.get_all_packages.count}} - </a>''' + </a> + {% endif %}''' - self.add_column(title="Approx packages", + self.add_column(title="Packages", static_data_name='approx_packages', static_data_template=approx_packages_template) build_btn_template = ''' <button data-recipe-name="{{data.name}}" - class="btn btn-block build-recipe-btn" style="margin-top: 5px;" > + class="btn btn-default btn-block build-recipe-btn"> Build </button>''' @@ -704,7 +715,8 @@ class PackagesTable(ToasterTable): self.add_column(title="License", field_name="license", - orderable=True) + orderable=True, + hidden=True) self.add_column(title="Dependencies", @@ -847,26 +859,22 @@ class ProjectsTable(ToasterTable): last_activity_on_template = ''' {% load project_url_tag %} <span data-project-field="updated"> - <a href="{% project_url data %}"> {{data.updated | date:"d/m/y H:i"}} - </a> </span> ''' release_template = ''' <span data-project-field="release"> {% if data.release %} - <a href="{% url 'project' data.id %}#project-details"> - {{data.release.name}} - </a> + {{data.release.name}} {% elif data.is_default %} - <span class="muted">Not applicable</span> - <i class="icon-question-sign get-help hover-help" - data-original-title="This project does not have a release set. + <span class="text-muted">Not applicable</span> + <span class="glyphicon glyphicon-question-sign get-help hover-help" + title="This project does not have a release set. It simply collects information about the builds you start from the command line while Toaster is running" style="visibility: hidden;"> - </i> + </span> {% else %} No release available {% endif %} @@ -876,16 +884,14 @@ class ProjectsTable(ToasterTable): machine_template = ''' <span data-project-field="machine"> {% if data.is_default %} - <span class="muted">Not applicable</span> - <i class="icon-question-sign get-help hover-help" - data-original-title="This project does not have a machine + <span class="text-muted">Not applicable</span> + <span class="glyphicon glyphicon-question-sign get-help hover-help" + title="This project does not have a machine set. It simply collects information about the builds you start from the command line while Toaster is running" - style="visibility: hidden;"></i> + style="visibility: hidden;"></span> {% else %} - <a href="{% url 'project' data.id %}#machine-distro"> - {{data.get_current_machine_name}} - </a> + {{data.get_current_machine_name}} {% endif %} </span> ''' @@ -895,20 +901,16 @@ class ProjectsTable(ToasterTable): <a href="{% url 'projectbuilds' data.id %}"> {{data.get_number_of_builds}} </a> - {% else %} - <span class="muted">0</span> {% endif %} ''' last_build_outcome_template = ''' {% if data.get_number_of_builds > 0 %} - <a href="{% url 'builddashboard' data.get_last_build_id %}"> - {% if data.get_last_outcome == extra.Build.SUCCEEDED %} - <i class="icon-ok-sign success"></i> - {% elif data.get_last_outcome == extra.Build.FAILED %} - <i class="icon-minus-sign error"></i> - {% endif %} - </a> + {% if data.get_last_outcome == extra.Build.SUCCEEDED %} + <span class="glyphicon glyphicon-ok-circle"></span> + {% elif data.get_last_outcome == extra.Build.FAILED %} + <span class="glyphicon glyphicon-minus-sign"></span> + {% endif %} {% endif %} ''' @@ -922,7 +924,7 @@ class ProjectsTable(ToasterTable): errors_template = ''' {% if data.get_number_of_builds > 0 and data.get_last_errors > 0 %} - <a class="errors.count error" + <a class="errors.count text-danger" href="{% url "builddashboard" data.get_last_build_id %}#errors"> {{data.get_last_errors}} error{{data.get_last_errors | pluralize}} </a> @@ -931,7 +933,7 @@ class ProjectsTable(ToasterTable): warnings_template = ''' {% if data.get_number_of_builds > 0 and data.get_last_warnings > 0 %} - <a class="warnings.count warning" + <a class="warnings.count text-warning" href="{% url "builddashboard" data.get_last_build_id %}#warnings"> {{data.get_last_warnings}} warning{{data.get_last_warnings | pluralize}} </a> @@ -940,9 +942,7 @@ class ProjectsTable(ToasterTable): image_files_template = ''' {% if data.get_number_of_builds > 0 and data.get_last_outcome == extra.Build.SUCCEEDED %} - <a href="{% url "builddashboard" data.get_last_build_id %}#images"> - {{data.get_last_build_extensions}} - </a> + {{data.get_last_build_extensions}} {% endif %} ''' @@ -978,7 +978,7 @@ class ProjectsTable(ToasterTable): static_data_name='machine', static_data_template=machine_template) - self.add_column(title='Number of builds', + self.add_column(title='Builds', help_text='The number of builds which have been run \ for the project', hideable=False, @@ -1108,19 +1108,17 @@ class BuildsTable(ToasterTable): def setup_columns(self, *args, **kwargs): outcome_template = ''' - <a href="{% url "builddashboard" data.id %}"> - {% if data.outcome == data.SUCCEEDED %} - <i class="icon-ok-sign success"></i> - {% elif data.outcome == data.FAILED %} - <i class="icon-minus-sign error"></i> - {% endif %} - </a> + {% if data.outcome == data.SUCCEEDED %} + <span class="glyphicon glyphicon-ok-circle"></span> + {% elif data.outcome == data.FAILED %} + <span class="glyphicon glyphicon-minus-sign"></span> + {% endif %} {% if data.cooker_log_path %} <a href="{% url "build_artifact" data.id "cookerlog" data.id %}"> - <i class="icon-download-alt get-help" - data-original-title="Download build log"></i> + <span class="glyphicon glyphicon-download-alt get-help" + data-original-title="Download build log"></span> </a> {% endif %} ''' @@ -1135,45 +1133,39 @@ class BuildsTable(ToasterTable): ''' machine_template = ''' - <a href="{% url "builddashboard" data.id %}"> - {{data.machine}} - </a> + {{data.machine}} ''' started_on_template = ''' - <a href="{% url "builddashboard" data.id %}"> - {{data.started_on | date:"d/m/y H:i"}} - </a> + {{data.started_on | date:"d/m/y H:i"}} ''' completed_on_template = ''' - <a href="{% url "builddashboard" data.id %}"> - {{data.completed_on | date:"d/m/y H:i"}} - </a> + {{data.completed_on | date:"d/m/y H:i"}} ''' failed_tasks_template = ''' {% if data.failed_tasks.count == 1 %} - <a href="{% url "task" data.id data.failed_tasks.0.id %}"> - <span class="error"> - {{data.failed_tasks.0.recipe.name}}.{{data.failed_tasks.0.task_name}} + <a class="text-danger" href="{% url "task" data.id data.failed_tasks.0.id %}"> + <span> + {{data.failed_tasks.0.recipe.name}} {{data.failed_tasks.0.task_name}} </span> </a> <a href="{% url "build_artifact" data.id "tasklogfile" data.failed_tasks.0.id %}"> - <i class="icon-download-alt" - data-original-title="Download task log file"> - </i> + <span class="glyphicon glyphicon-download-alt get-help" + title="Download task log file"> + </span> </a> {% elif data.failed_tasks.count > 1 %} <a href="{% url "tasks" data.id %}?filter=outcome%3A{{extra.Task.OUTCOME_FAILED}}"> - <span class="error">{{data.failed_tasks.count}} tasks</span> + <span class="text-danger">{{data.failed_tasks.count}} tasks</span> </a> {% endif %} ''' errors_template = ''' {% if data.errors_no %} - <a class="errors.count error" href="{% url "builddashboard" data.id %}#errors"> + <a class="errors.count text-danger" href="{% url "builddashboard" data.id %}#errors"> {{data.errors_no}} error{{data.errors_no|pluralize}} </a> {% endif %} @@ -1181,7 +1173,7 @@ class BuildsTable(ToasterTable): warnings_template = ''' {% if data.warnings_no %} - <a class="warnings.count warning" href="{% url "builddashboard" data.id %}#warnings"> + <a class="warnings.count text-warning" href="{% url "builddashboard" data.id %}#warnings"> {{data.warnings_no}} warning{{data.warnings_no|pluralize}} </a> {% endif %} @@ -1196,9 +1188,7 @@ class BuildsTable(ToasterTable): image_files_template = ''' {% if data.outcome == extra.Build.SUCCEEDED %} - <a href="{% url "builddashboard" data.id %}#images"> {{data.get_image_file_extensions}} - </a> {% endif %} ''' @@ -1416,10 +1406,10 @@ class AllBuildsTable(BuildsTable): {{data.project.name}} </a> {% if data.project.is_default %} - <i class="icon-question-sign get-help hover-help" title="" + <span class="glyphicon glyphicon-question-sign get-help hover-help" title="" data-original-title="This project shows information about the builds you start from the command line while Toaster is - running" style="visibility: hidden;"></i> + running" style="visibility: hidden;"></span> {% endif %} ''' @@ -1469,7 +1459,6 @@ class ProjectBuildsTable(BuildsTable): """ self.project_id = kwargs['pid'] super(ProjectBuildsTable, self).setup_queryset(*args, **kwargs) - project = Project.objects.get(pk=self.project_id) self.queryset = self.queryset.filter(project=project) @@ -1483,8 +1472,23 @@ class ProjectBuildsTable(BuildsTable): self.project_id = kwargs['pid'] context = super(ProjectBuildsTable, self).get_context_data(**kwargs) + empty_state_template = ''' + This project has no builds. + <a href="{% url 'projectimagerecipes' data.pid %}"> + Choose a recipe to build</a> + ''' + context['empty_state'] = self.render_static_data(empty_state_template, + kwargs) + project = Project.objects.get(pk=self.project_id) context['mru'] = Build.get_recent(project) context['project'] = project + self.setup_queryset(**kwargs) + if self.queryset.count() == 0 and \ + project.build_set.filter(outcome=Build.IN_PROGRESS).count() > 0: + context['build_in_progress_none_completed'] = True + else: + context['build_in_progress_none_completed'] = False + return context |