<commit_before>(function(){
	'use strict';

	angular
		.module('shipyard.images')
		.controller('ImagesController', ImagesController);

	ImagesController.$inject = ['images', 'ImagesService', '$state', '$timeout'];
	function ImagesController(images, ImagesService, $state, $timeout) {
            var vm = this;
            vm.images = images;
            vm.pulling = false;
            vm.selectedImage = null;
            vm.refresh = refresh;
            vm.removeImage = removeImage;
            vm.pullImage = pullImage;
            vm.pullImageName = "";
            vm.showRemoveImageDialog = showRemoveImageDialog;
            vm.showPullImageDialog = showPullImageDialog;

            function showRemoveImageDialog(image) {
                vm.selectedImage = image;
                $('.ui.small.remove.modal').modal('show');
            }

            function showPullImageDialog(image) {
                $('.ui.small.pull.modal').modal('show');
            }

            function refresh() {
                ImagesService.list()
                    .then(function(data) {
                        console.log(data.length);
                        vm.images = data; 
                    }, function(data) {
                        vm.error = data;
                    });
                vm.error = "";
            }

            function removeImage() {
                ImagesService.remove(vm.selectedImage)
                    .then(function(data) {
                        vm.refresh(); 
                    }, function(data) {
                        vm.error = data;
                    });
                vm.error = "";
            }

            function pullImage() {
                vm.pulling = true;
                // this is to prevent errors in the console since we
                // get a stream like response back
                oboe({
                    url: '/images/create?fromImage=' + vm.pullImageName,
                    method: "POST"
                })
                .done(function() {
                    vm.refresh();
                    vm.pulling = false;
                    vm.pullImageName = "";
                })
                .fail(function(err) {
                    vm.error = err;
                });
            }
	}
})();<commit_msg>images: workaround for image pull race<commit_after>(function(){
	'use strict';

	angular
		.module('shipyard.images')
		.controller('ImagesController', ImagesController);

	ImagesController.$inject = ['images', 'ImagesService', '$state', '$timeout'];
	function ImagesController(images, ImagesService, $state, $timeout) {
            var vm = this;
            vm.images = images;
            vm.pulling = false;
            vm.selectedImage = null;
            vm.refresh = refresh;
            vm.removeImage = removeImage;
            vm.pullImage = pullImage;
            vm.pullImageName = "";
            vm.showRemoveImageDialog = showRemoveImageDialog;
            vm.showPullImageDialog = showPullImageDialog;

            function showRemoveImageDialog(image) {
                vm.selectedImage = image;
                $('.ui.small.remove.modal').modal('show');
            }

            function showPullImageDialog(image) {
                $('.ui.small.pull.modal').modal('show');
            }

            function refresh() {
                ImagesService.list()
                    .then(function(data) {
                        vm.images = data; 
                    }, function(data) {
                        vm.error = data;
                    });
                vm.error = "";
            }

            function removeImage() {
                ImagesService.remove(vm.selectedImage)
                    .then(function(data) {
                        vm.refresh();
                    }, function(data) {
                        vm.error = data;
                    });
                vm.error = "";
            }

            function pullImage() {
                vm.pulling = true;
                // this is to prevent errors in the console since we
                // get a stream like response back
                oboe({
                    url: '/images/create?fromImage=' + vm.pullImageName,
                    method: "POST"
                })
                .done(function() {
                    setTimeout(vm.refresh, 2000)
                    vm.pulling = false;
                    vm.pullImageName = "";
                })
                .fail(function(err) {
                    vm.error = err;
                });
            }
	}
})();
{'fraction_non_alphanumeric': 0.11055276381909548, 'fraction_numerical': 0.0008739348918505571, 'mean_word_length': 1.1462728551336145, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3307402', 'n_tokens_mistral': 1130, 'n_tokens_neox': 1033, 'n_words': 203}