forked from openshift/origin-web-console
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathimagestream.js
69 lines (63 loc) · 2.23 KB
/
imagestream.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
'use strict';
/**
* @ngdoc function
* @name openshiftConsole.controller:ImageController
* @description
* Controller of the openshiftConsole
*/
angular.module('openshiftConsole')
.controller('ImageStreamController', function ($scope, $routeParams, DataService, ProjectsService, $filter, ImageStreamsService) {
$scope.projectName = $routeParams.project;
$scope.imageStream = null;
$scope.tags = [];
$scope.tagShowOlder = {};
$scope.alerts = {};
$scope.renderOptions = $scope.renderOptions || {};
$scope.renderOptions.hideFilterWidget = true;
$scope.breadcrumbs = [
{
title: "Image Streams",
link: "project/" + $routeParams.project + "/browse/images"
},
{
title: $routeParams.imagestream
}
];
$scope.emptyMessage = "Loading...";
var watches = [];
ProjectsService
.get($routeParams.project)
.then(_.spread(function(project, context) {
$scope.project = project;
DataService.get("imagestreams", $routeParams.imagestream, context).then(
// success
function(imageStream) {
$scope.loaded = true;
$scope.imageStream = imageStream;
$scope.emptyMessage = "No tags to show";
// If we found the item successfully, watch for changes on it
watches.push(DataService.watchObject("imagestreams", $routeParams.imagestream, context, function(imageStream, action) {
if (action === "DELETED") {
$scope.alerts["deleted"] = {
type: "warning",
message: "This image stream has been deleted."
};
}
$scope.imageStream = imageStream;
$scope.tags = _.toArray(ImageStreamsService.tagsByName($scope.imageStream));
}));
},
// failure
function(e) {
$scope.loaded = true;
$scope.alerts["load"] = {
type: "error",
message: "The image stream details could not be loaded.",
details: "Reason: " + $filter('getErrorDetails')(e)
};
});
$scope.$on('$destroy', function(){
DataService.unwatchAll(watches);
});
}));
});