Remove old controller code

This commit is contained in:
Joseph Schorr 2015-06-29 12:40:18 +03:00
parent 3342f2392d
commit 892548f5d7
3 changed files with 0 additions and 275 deletions

View file

@ -78,129 +78,4 @@
}, 100);
};
}
function OldImageViewCtrl($scope, $routeParams, $rootScope, $timeout, ApiService, ImageMetadataService) {
var namespace = $routeParams.namespace;
var name = $routeParams.name;
var imageid = $routeParams.image;
$scope.getFormattedCommand = ImageMetadataService.getFormattedCommand;
$scope.parseDate = function(dateString) {
return Date.parse(dateString);
};
$scope.getFolder = function(filepath) {
var index = filepath.lastIndexOf('/');
if (index < 0) {
return '';
}
return filepath.substr(0, index + 1);
};
$scope.getFolders = function(filepath) {
var index = filepath.lastIndexOf('/');
if (index < 0) {
return '';
}
return filepath.substr(0, index).split('/');
};
$scope.getFilename = function(filepath) {
var index = filepath.lastIndexOf('/');
if (index < 0) {
return filepath;
}
return filepath.substr(index + 1);
};
$scope.setFolderFilter = function(folderPath, index) {
var parts = folderPath.split('/');
parts = parts.slice(0, index + 1);
$scope.setFilter(parts.join('/'));
};
$scope.setFilter = function(filter) {
$scope.search = {};
$scope.search['$'] = filter;
document.getElementById('change-filter').value = filter;
};
$scope.initializeTree = function() {
if ($scope.tree) { return; }
$scope.tree = new ImageFileChangeTree($scope.image, $scope.combinedChanges);
$timeout(function() {
$scope.tree.draw('changes-tree-container');
}, 10);
};
var fetchRepository = function() {
var params = {
'repository': namespace + '/' + name
};
ApiService.getRepoAsResource(params).get(function(repo) {
$scope.repo = repo;
});
};
var fetchImage = function() {
var params = {
'repository': namespace + '/' + name,
'image_id': imageid
};
$scope.image = ApiService.getImageAsResource(params).get(function(image) {
if (!$scope.repo) {
$scope.repo = {
'name': name,
'namespace': namespace,
'is_public': true
};
}
$rootScope.title = 'View Image - ' + image.id;
$rootScope.description = 'Viewing docker image ' + image.id + ' under repository ' + namespace + '/' + name +
': Image changes tree and list view';
// Fetch the image's changes.
fetchChanges();
return image;
});
};
var fetchChanges = function() {
var params = {
'repository': namespace + '/' + name,
'image_id': imageid
};
ApiService.getImageChanges(null, params).then(function(changes) {
var combinedChanges = [];
var addCombinedChanges = function(c, kind) {
for (var i = 0; i < c.length; ++i) {
combinedChanges.push({
'kind': kind,
'file': c[i]
});
}
};
addCombinedChanges(changes.added, 'added');
addCombinedChanges(changes.removed, 'removed');
addCombinedChanges(changes.changed, 'changed');
$scope.combinedChanges = combinedChanges;
$scope.imageChanges = changes;
});
};
// Fetch the repository.
fetchRepository();
// Fetch the image.
fetchImage();
}
})();

View file

@ -97,89 +97,4 @@
});
};
}
function OldOrgViewCtrl($rootScope, $scope, ApiService, $routeParams, CreateService) {
var orgname = $routeParams.orgname;
$scope.TEAM_PATTERN = TEAM_PATTERN;
$rootScope.title = 'Loading...';
$scope.setRole = function(role, teamname) {
var previousRole = $scope.organization.teams[teamname].role;
$scope.organization.teams[teamname].role = role;
var params = {
'orgname': orgname,
'teamname': teamname
};
var data = $scope.organization.teams[teamname];
ApiService.updateOrganizationTeam(data, params).then(function(resp) {
}, function(resp) {
$scope.organization.teams[teamname].role = previousRole;
$scope.roleError = resp.data || '';
$('#cannotChangeTeamModal').modal({});
});
};
$scope.createTeam = function(teamname) {
if (!teamname) {
return;
}
if ($scope.organization.teams[teamname]) {
$('#team-' + teamname).removeClass('highlight');
setTimeout(function() {
$('#team-' + teamname).addClass('highlight');
}, 10);
return;
}
CreateService.createOrganizationTeam(ApiService, orgname, teamname, function(created) {
$scope.organization.teams[teamname] = created;
});
};
$scope.askDeleteTeam = function(teamname) {
$scope.currentDeleteTeam = teamname;
$('#confirmdeleteModal').modal({});
};
$scope.deleteTeam = function() {
$('#confirmdeleteModal').modal('hide');
if (!$scope.currentDeleteTeam) { return; }
var teamname = $scope.currentDeleteTeam;
var params = {
'orgname': orgname,
'teamname': teamname
};
var errorHandler = ApiService.errorDisplay('Cannot delete team', function() {
$scope.currentDeleteTeam = null;
});
ApiService.deleteOrganizationTeam(null, params).then(function() {
delete $scope.organization.teams[teamname];
$scope.currentDeleteTeam = null;
}, errorHandler);
};
var loadOrganization = function() {
$scope.orgResource = ApiService.getOrganizationAsResource({'orgname': orgname}).get(function(org) {
$scope.organization = org;
$rootScope.title = orgname;
$rootScope.description = 'Viewing organization ' + orgname;
$('.info-icon').popover({
'trigger': 'hover',
'html': true
});
});
};
// Load the organization.
loadOrganization();
}
})();

View file

@ -100,69 +100,4 @@
});
};
}
function OldRepoListCtrl($scope, $sanitize, Restangular, UserService, ApiService) {
$scope.namespace = null;
$scope.page = 1;
$scope.publicPageCount = null;
// Monitor changes in the user.
UserService.updateUserIn($scope, function() {
loadMyRepos($scope.namespace);
});
// Monitor changes in the namespace.
$scope.$watch('namespace', function(namespace) {
loadMyRepos(namespace);
});
$scope.movePublicPage = function(increment) {
if ($scope.publicPageCount == null) {
return;
}
$scope.page += increment;
if ($scope.page < 1) {
$scope.page = 1;
}
if ($scope.page > $scope.publicPageCount) {
$scope.page = $scope.publicPageCount;
}
loadPublicRepos();
};
var loadMyRepos = function(namespace) {
if (!$scope.user || $scope.user.anonymous || !namespace) {
return;
}
var options = {'public': false, 'sort': true, 'namespace': namespace};
$scope.user_repositories = ApiService.listReposAsResource().withOptions(options).get(function(resp) {
return resp.repositories;
});
};
var loadPublicRepos = function() {
var options = {
'public': true,
'private': false,
'sort': true,
'limit': 10,
'page': $scope.page,
'count': $scope.page == 1
};
$scope.public_repositories = ApiService.listReposAsResource().withOptions(options).get(function(resp) {
if (resp.count) {
$scope.publicPageCount = Math.ceil(resp.count / 10);
}
return resp.repositories;
});
};
loadPublicRepos();
}
})();