Tesla has won its case against ex-employee Martin Tripp, who was sacked for hacking and transferring the company's data to third parties.