Index: Tools/GardeningServer/model/ct-commit-log.html |
diff --git a/Tools/GardeningServer/model/ct-commit-log.html b/Tools/GardeningServer/model/ct-commit-log.html |
deleted file mode 100644 |
index f0c02dd38a19ac17183cb1f42eabe2990cfb2914..0000000000000000000000000000000000000000 |
--- a/Tools/GardeningServer/model/ct-commit-log.html |
+++ /dev/null |
@@ -1,75 +0,0 @@ |
-<!-- |
-Copyright 2014 The Chromium Authors. All rights reserved. |
-Use of this source code is governed by a BSD-style license that can be |
-found in the LICENSE file. |
---> |
- |
-<link rel="import" href="../lib/net.html"> |
-<link rel='import' href='ct-commit.html'> |
-<link rel='import' href='ct-repositories.html'> |
- |
-<script> |
-function CTCommitLog() { |
- this.commits = {}; |
- this.lastRevision = {}; |
- this._repositories = new CTRepositories(); |
- |
- this._repositories.names.forEach(function(name) { |
- this.commits[name] = {}; |
- }.bind(this)); |
-} |
- |
-CTCommitLog.prototype.update = function() { |
- var requests = []; |
- Object.keys(this._repositories.repositories, (function(name, repository) { |
- var responseHandler = this._handleResponse.bind(this, repository.repositoryUrl, repository.name); |
- // FIXME: Turn net.js into net.html and import it at the top of this file. |
- requests.push(net.ajax({url: repository.dataUrl}).then(responseHandler)); |
- }.bind(this))); |
- return Promise.all(requests); |
-} |
- |
-CTCommitLog.prototype._handleResponse = function(repositoryUrl, repository, json) { |
- // FIXME: Fix googlesource to not do this outdated JSON XSS mitigation. |
- json = json.substring(')]}\n'.length); |
- JSON.parse(json).log.forEach(function(entry) { |
- var author = entry.author.email; |
- var message = entry.message; |
- var revision = CTCommit.findRevision(message); |
- |
- // Check for existing commit for that revision, and possibly complete it. |
- // We update the existing commit instead of creating a new one so that the |
- // data-binding properly updates all the <ct-commit>'s. |
- var existingCommit = this.commits[repository][revision]; |
- if (existingCommit && !existingCommit.isComplete) { |
- existingCommit.complete(author, message, revision); |
- } else { |
- var commit = CTCommit.create(author, message, repositoryUrl, repository); |
- this.commits[repository][commit.revision] = commit; |
- } |
- }.bind(this)); |
- |
- this._updateLastRevision(repository); |
-} |
- |
-CTCommitLog.prototype._updateLastRevision = function(repository) { |
- var sortedCommits = Object.keys(this.commits[repository]).sort(); |
- this.lastRevision[repository] = sortedCommits.last(); |
-} |
- |
-CTCommitLog.prototype.range = function(repository, revisions) { |
- var commits = []; |
- revisions.forEach(function(revision) { |
- var commit = this.commits[repository][revision]; |
- if (!commit) { |
- var url = this._repositories.repositories[repository].repositoryUrl; |
- var commit = CTCommit.createIncomplete(url, revision, repository); |
- this.commits[repository][revision] = commit; |
- } |
- |
- if (commit) |
- commits.push(commit); |
- }.bind(this)); |
- return commits; |
-} |
-</script> |