Sha256: b26c90f7b1be8a0c8eb8a4249c35386883e1fa4f2324b84a6b0b153e3dd6c6c8
Contents?: true
Size: 1.94 KB
Versions: 16
Compression:
Stored size: 1.94 KB
Contents
/** * @ngdoc object * @name Bastion.products.controller:ProductDetailsController * * @requires $scope * @requires $state * @requires Product * @requires ApiErrorHandler * * @description * Provides the functionality for the product details action pane. */ angular.module('Bastion.products').controller('ProductDetailsController', ['$scope', '$state', 'Product', 'ApiErrorHandler', function ($scope, $state, Product, ApiErrorHandler) { $scope.successMessages = []; $scope.errorMessages = []; $scope.panel = { error: false, loading: true }; if ($scope.product) { $scope.panel.loading = false; } $scope.product = Product.get({id: $scope.$stateParams.productId}, function () { $scope.panel.loading = false; }, function (response) { $scope.panel.loading = false; ApiErrorHandler.handleGETRequestErrors(response, $scope); }); $scope.removeProduct = function (product) { var id = product.id; product.$delete(function (data) { $scope.removeRow(id); $scope.$emit('productDelete', data.id); $scope.transitionTo('products.index'); }); }; $scope.productDeletable = function(product) { return $scope.getReadOnlyReason(product) === null; }; $scope.getReadOnlyReason = function (product) { var readOnlyReason = null; if (product.$resolved) { if (product.redhat) { readOnlyReason = 'redhat'; } else if ($scope.denied('destroy_products', product)) { readOnlyReason = 'permissions'; } else if (product['published_content_view_ids'].length > 0) { readOnlyReason = 'published'; } } return readOnlyReason; }; }] );
Version data entries
16 entries across 16 versions & 1 rubygems