Last active
April 20, 2020 19:14
-
-
Save ianballou/46ae8bbf2cd5045ec38d652330bda576 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * @ngdoc object | |
| * @name Bastion.docker-tags.controller:DockerTagDetailsController | |
| * | |
| * @requires $scope | |
| * @requires $location | |
| * @requires DockerTag | |
| * @requires CurrentOrganization | |
| * | |
| * @description | |
| * Provides the functionality for the docker tags details environments list. | |
| */ | |
| angular.module('Bastion.docker-tags').controller('DockerTagEnvironmentsController', | |
| ['$scope', '$location', 'Nutupane', 'DockerTag', 'DockerTagRepositories', 'Repository', 'CurrentOrganization', | |
| function ($scope, $location, Nutupane, DockerTag, DockerTagRepositories, Repository, CurrentOrganization) { | |
| var params = { | |
| 'organization_id': CurrentOrganization, | |
| 'search': $location.search().search || "", | |
| 'sort_by': 'name', | |
| 'sort_order': 'ASC', | |
| 'paged': false | |
| }; | |
| var renderTable = function () { | |
| var newParams = { | |
| 'organization_id': CurrentOrganization, | |
| 'search': $location.search().search || "", | |
| 'sort_by': 'name', | |
| 'sort_order': 'ASC', | |
| 'paged': false | |
| }; | |
| var ids; | |
| var nutupane; | |
| if ($scope.tag.repositories.length > 1) { | |
| /*nutupane = new Nutupane(Repository, params, null, {disableAutoLoad: true}); | |
| ids = _.map($scope.tag.repositories, 'id'); | |
| newParams['skip_view_filter'] = true; | |
| newParams['docker_tag_id'] = $scope.tag.id;*/ | |
| nutupane = new Nutupane(DockerTagRepositories, params, null, {disableAutoLoad: true}); | |
| newParams['id'] = $scope.tag.id; | |
| newParams['archived'] = false; | |
| } else { | |
| nutupane = new Nutupane(DockerTag, params, null, {disableAutoLoad: true}); | |
| ids = _.map($scope.tag.related_tags, 'id'); | |
| newParams['ids[]'] = ids; | |
| } | |
| $scope.table = nutupane.table; | |
| nutupane.setParams(newParams); | |
| $scope.panel.loading = false; | |
| if (!_.isEmpty(ids)) { | |
| nutupane.refresh(); | |
| } | |
| }; | |
| $scope.controllerName = 'katello_docker_tags'; | |
| if ($scope.tag) { | |
| $scope.panel.loading = false; | |
| } | |
| if ($scope.tag && $scope.tag.related_tags) { | |
| renderTable(); | |
| } else { | |
| $scope.tag.$promise.then(renderTable); | |
| } | |
| } | |
| ]); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * @ngdoc service | |
| * @name Bastion.docker-tags.factory:DockerTag | |
| * | |
| * @requires BastionResource | |
| * | |
| * @description | |
| * Provides a BastionResource for Docker Tags | |
| */ | |
| angular.module('Bastion.docker-tags').factory('DockerTagRepositories', | |
| ['BastionResource', 'CurrentOrganization', function (BastionResource, CurrentOrganization) { | |
| return BastionResource('katello/api/v2/docker_tags/:id/repositories/', | |
| {id: '@id', 'organization_id': CurrentOrganization}, | |
| { | |
| autocomplete: {method: 'GET', isArray: true, params: {id: 'auto_complete_search'}}, | |
| 'autocompleteName': {method: 'GET', isArray: false, params: {id: 'auto_complete_name'}, | |
| transformResponse: function (data) { | |
| data = angular.fromJson(data); | |
| return {results: data}; | |
| } | |
| } | |
| } | |
| ); | |
| }] | |
| ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment