diff options
author | Michael Wood <michael.g.wood@intel.com> | 2016-05-26 16:12:23 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2016-06-15 08:35:04 +0100 |
commit | caae3b6206dc31690f0c6638daaa7bb072c69042 (patch) | |
tree | 780fc9c4e430f93e1b1ae8d522ee921e82515876 /bitbake/lib/toaster/toastergui/views.py | |
parent | b2a68f55110b39aaf0b0d47bf533251a59a40a41 (diff) | |
download | poky-caae3b6206dc31690f0c6638daaa7bb072c69042.tar.gz |
bitbake: toaster: port Installed packages table to ToasterTable
(Bitbake rev: 2418c092abd9a503becf5e786125f8cdddd8652c)
Signed-off-by: Michael Wood <michael.g.wood@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/toaster/toastergui/views.py')
-rwxr-xr-x | bitbake/lib/toaster/toastergui/views.py | 169 |
1 files changed, 0 insertions, 169 deletions
diff --git a/bitbake/lib/toaster/toastergui/views.py b/bitbake/lib/toaster/toastergui/views.py index 35ab63a22e..88bc39a166 100755 --- a/bitbake/lib/toaster/toastergui/views.py +++ b/bitbake/lib/toaster/toastergui/views.py | |||
@@ -681,175 +681,6 @@ def recipe_packages(request, build_id, recipe_id): | |||
681 | _set_parameters_values(pagesize, orderby, request) | 681 | _set_parameters_values(pagesize, orderby, request) |
682 | return response | 682 | return response |
683 | 683 | ||
684 | def target_common( request, build_id, target_id, variant ): | ||
685 | template = "target.html" | ||
686 | default_orderby = 'name:+' | ||
687 | |||
688 | (pagesize, orderby) = _get_parameters_values(request, 25, default_orderby) | ||
689 | mandatory_parameters = { 'count': pagesize, 'page' : 1, 'orderby': orderby } | ||
690 | retval = _verify_parameters( request.GET, mandatory_parameters ) | ||
691 | if retval: | ||
692 | return _redirect_parameters( | ||
693 | variant, request.GET, mandatory_parameters, | ||
694 | build_id = build_id, target_id = target_id ) | ||
695 | ( filter_string, search_term, ordering_string ) = _search_tuple( request, Package ) | ||
696 | |||
697 | # FUTURE: get rid of nested sub-queries replacing with ManyToMany field | ||
698 | queryset = Package.objects.filter( | ||
699 | size__gte = 0, | ||
700 | id__in = Target_Installed_Package.objects.filter( | ||
701 | target_id=target_id ).values( 'package_id' )) | ||
702 | packages_sum = queryset.aggregate( Sum( 'installed_size' )) | ||
703 | queryset = _get_queryset( | ||
704 | Package, queryset, filter_string, search_term, ordering_string, 'name' ) | ||
705 | queryset = queryset.select_related("recipe", "recipe__layer_version", "recipe__layer_version__layer") | ||
706 | packages = _build_page_range( Paginator(queryset, pagesize), request.GET.get( 'page', 1 )) | ||
707 | |||
708 | build = Build.objects.get( pk = build_id ) | ||
709 | |||
710 | # bring in package dependencies | ||
711 | for p in packages.object_list: | ||
712 | p.runtime_dependencies = p.package_dependencies_source.filter( | ||
713 | target_id = target_id, dep_type=Package_Dependency.TYPE_TRDEPENDS ).select_related("depends_on") | ||
714 | p.reverse_runtime_dependencies = p.package_dependencies_target.filter( | ||
715 | target_id = target_id, dep_type=Package_Dependency.TYPE_TRDEPENDS ).select_related("package") | ||
716 | tc_package = { | ||
717 | 'name' : 'Package', | ||
718 | 'qhelp' : 'Packaged output resulting from building a recipe included in this image', | ||
719 | 'orderfield' : _get_toggle_order( request, "name" ), | ||
720 | 'ordericon' : _get_toggle_order_icon( request, "name" ), | ||
721 | } | ||
722 | tc_packageVersion = { | ||
723 | 'name' : 'Package version', | ||
724 | 'qhelp' : 'The package version and revision', | ||
725 | } | ||
726 | tc_size = { | ||
727 | 'name' : 'Size', | ||
728 | 'qhelp' : 'The size of the package', | ||
729 | 'orderfield' : _get_toggle_order( request, "size", True ), | ||
730 | 'ordericon' : _get_toggle_order_icon( request, "size" ), | ||
731 | 'orderkey' : 'size', | ||
732 | 'clclass' : 'size', | ||
733 | 'dclass' : 'span2', | ||
734 | } | ||
735 | if ( variant == 'target' ): | ||
736 | tc_size[ "hidden" ] = 0 | ||
737 | else: | ||
738 | tc_size[ "hidden" ] = 1 | ||
739 | tc_sizePercentage = { | ||
740 | 'name' : 'Size over total (%)', | ||
741 | 'qhelp' : 'Proportion of the overall size represented by this package', | ||
742 | 'clclass' : 'size_over_total', | ||
743 | 'hidden' : 1, | ||
744 | } | ||
745 | tc_license = { | ||
746 | 'name' : 'License', | ||
747 | 'qhelp' : 'The license under which the package is distributed. Separate license names u\ | ||
748 | sing | (pipe) means there is a choice between licenses. Separate license names using & (ampersand) m\ | ||
749 | eans multiple licenses exist that cover different parts of the source', | ||
750 | 'orderfield' : _get_toggle_order( request, "license" ), | ||
751 | 'ordericon' : _get_toggle_order_icon( request, "license" ), | ||
752 | 'orderkey' : 'license', | ||
753 | 'clclass' : 'license', | ||
754 | } | ||
755 | if ( variant == 'target' ): | ||
756 | tc_license[ "hidden" ] = 1 | ||
757 | else: | ||
758 | tc_license[ "hidden" ] = 0 | ||
759 | tc_dependencies = { | ||
760 | 'name' : 'Dependencies', | ||
761 | 'qhelp' : "Package runtime dependencies (other packages)", | ||
762 | 'clclass' : 'depends', | ||
763 | } | ||
764 | if ( variant == 'target' ): | ||
765 | tc_dependencies[ "hidden" ] = 0 | ||
766 | else: | ||
767 | tc_dependencies[ "hidden" ] = 1 | ||
768 | tc_rdependencies = { | ||
769 | 'name' : 'Reverse dependencies', | ||
770 | 'qhelp' : 'Package run-time reverse dependencies (i.e. which other packages depend on this package', | ||
771 | 'clclass' : 'brought_in_by', | ||
772 | } | ||
773 | if ( variant == 'target' ): | ||
774 | tc_rdependencies[ "hidden" ] = 0 | ||
775 | else: | ||
776 | tc_rdependencies[ "hidden" ] = 1 | ||
777 | tc_recipe = { | ||
778 | 'name' : 'Recipe', | ||
779 | 'qhelp' : 'The name of the recipe building the package', | ||
780 | 'orderfield' : _get_toggle_order( request, "recipe__name" ), | ||
781 | 'ordericon' : _get_toggle_order_icon( request, "recipe__name" ), | ||
782 | 'orderkey' : "recipe__name", | ||
783 | 'clclass' : 'recipe_name', | ||
784 | 'hidden' : 0, | ||
785 | } | ||
786 | tc_recipeVersion = { | ||
787 | 'name' : 'Recipe version', | ||
788 | 'qhelp' : 'Version and revision of the recipe building the package', | ||
789 | 'clclass' : 'recipe_version', | ||
790 | 'hidden' : 1, | ||
791 | } | ||
792 | tc_layer = { | ||
793 | 'name' : 'Layer', | ||
794 | 'qhelp' : 'The name of the layer providing the recipe that builds the package', | ||
795 | 'orderfield' : _get_toggle_order( request, "recipe__layer_version__layer__name" ), | ||
796 | 'ordericon' : _get_toggle_order_icon( request, "recipe__layer_version__layer__name" ), | ||
797 | 'orderkey' : "recipe__layer_version__layer__name", | ||
798 | 'clclass' : 'layer_name', | ||
799 | 'hidden' : 1, | ||
800 | } | ||
801 | tc_layerBranch = { | ||
802 | 'name' : 'Layer branch', | ||
803 | 'qhelp' : 'The Git branch of the layer providing the recipe that builds the package', | ||
804 | 'orderfield' : _get_toggle_order( request, "recipe__layer_version__branch" ), | ||
805 | 'ordericon' : _get_toggle_order_icon( request, "recipe__layer_version__branch" ), | ||
806 | 'orderkey' : "recipe__layer_version__branch", | ||
807 | 'clclass' : 'layer_branch', | ||
808 | 'hidden' : 1, | ||
809 | } | ||
810 | tc_layerCommit = { | ||
811 | 'name' : 'Layer commit', | ||
812 | 'qhelp' : 'The Git commit of the layer providing the recipe that builds the package', | ||
813 | 'clclass' : 'layer_commit', | ||
814 | 'hidden' : 1, | ||
815 | } | ||
816 | |||
817 | context = { | ||
818 | 'objectname': variant, | ||
819 | 'build' : build, | ||
820 | 'project' : build.project, | ||
821 | 'target' : Target.objects.filter( pk = target_id )[ 0 ], | ||
822 | 'objects' : packages, | ||
823 | 'packages_sum' : packages_sum[ 'installed_size__sum' ], | ||
824 | 'object_search_display': "packages included", | ||
825 | 'default_orderby' : default_orderby, | ||
826 | 'tablecols' : [ | ||
827 | tc_package, | ||
828 | tc_packageVersion, | ||
829 | tc_license, | ||
830 | tc_size, | ||
831 | tc_sizePercentage, | ||
832 | tc_dependencies, | ||
833 | tc_rdependencies, | ||
834 | tc_recipe, | ||
835 | tc_recipeVersion, | ||
836 | tc_layer, | ||
837 | tc_layerBranch, | ||
838 | tc_layerCommit, | ||
839 | ] | ||
840 | } | ||
841 | |||
842 | |||
843 | response = render(request, template, context) | ||
844 | _set_parameters_values(pagesize, orderby, request) | ||
845 | return response | ||
846 | |||
847 | def target( request, build_id, target_id ): | ||
848 | return( target_common( request, build_id, target_id, "target" )) | ||
849 | |||
850 | def targetpkg( request, build_id, target_id ): | ||
851 | return( target_common( request, build_id, target_id, "targetpkg" )) | ||
852 | |||
853 | from django.core.serializers.json import DjangoJSONEncoder | 684 | from django.core.serializers.json import DjangoJSONEncoder |
854 | from django.http import HttpResponse | 685 | from django.http import HttpResponse |
855 | def xhr_dirinfo(request, build_id, target_id): | 686 | def xhr_dirinfo(request, build_id, target_id): |