/// <reference path="../../includes.ts"/>
/// <reference path="developerPlugin.ts"/>
/// <reference path="dataManagerModel.ts"/>
/// <reference path="dataManagerHelper.ts"/>
module Developer {
	export var KubeTaskController = controller("KubeTaskController", ["$scope", "$location", "$routeParams", "DataModel", "$templateCache", ($scope, $location, $routeParams, DataModel, $templateCache) => {
		$scope.model = DataModel;	
        $scope.subTabConfig = Developer.createCurrentSubNavBar($scope, $location, $routeParams); 
		$scope.model.data = [{_key: 2, name: "南京市-玄武区", labels:{system: 34, batch: 2}, status: 1, process:75},
		                {_key: 4, name: "南京市-雨花区", labels:{system: 14, batch: 1}, status: 0, process:0},
		                {_key: 5, name: "南京市-六合区", labels:{system: 76, batch: 1}, status: 2, process:100},
		                {_key: 6, name: "南京市-浦口区", labels:{system: 76, batch: 1}, status: 3, process:97}];

		$scope.tableConfig = {
		  	data: 'model.data',     
			showSelectionCheckbox: false,
			enableRowClickSelection: false,
			multiSelect: true,     
			selectedItems: [],     
			filterOptions: {
			filterText: $location.search()["q"] || ''
			},
		 	columnDefs: [{
		      	field: "_key",
		      	displayName: '编码',
		      	customSortField: (field) =>{
		        	return field.id;           
		      	}         
		    },
		    {
		      	field: "name",
		      	displayName: '市-区/县'       
		    },
		    { 
		      	field: "systemName",
		      	displayName: '系统名称'         
		    },
		    {
		      	field: "labels",
		      	displayName: '数据标签',
		      	cellTemplate: $templateCache.get("dataLabelsTemplate.html")      
		    },     
		    {
		    	field: "status",
		      	displayName: '迁移状态',
		      	cellTemplate: $templateCache.get("taskStatus.html")     
		    },
		    {
		    	field: "process",
		      	displayName: '迁移进度',
		      	cellTemplate: $templateCache.get("taskProcess.html") 		      	      
		    },
		    {
		    	field: "entity",
		      	displayName: '操作',
		      	cellTemplate: $templateCache.get("taskEdit.html")  		      	      
		    }           
		]};


		$scope.$on("deleteRow", (event, data) =>{
			console.log("删除任务");
		});		
	}]);
}
