rebaseline_server: add download link for SKP diff patchfile
authorepoger <epoger@google.com>
Wed, 20 Aug 2014 17:55:27 +0000 (10:55 -0700)
committerCommit bot <commit-bot@chromium.org>
Wed, 20 Aug 2014 17:55:27 +0000 (10:55 -0700)
BUG=skia:1918
NOTREECHECKS=true
NOTRY=true
R=stephana@google.com
TBR=stephana
(SkipBuildbotRuns)

Author: epoger@google.com

Review URL: https://codereview.chromium.org/489183002

gm/rebaseline_server/static/live-loader.js
gm/rebaseline_server/static/live-view.html

index 30d05061be6fa9dd4ab9b2a7a9e9d375de66553d..ab15aee41a984c782481f3a68e09d96579b7b4a7 100644 (file)
@@ -8,6 +8,12 @@ var Loader = angular.module(
     ['ConstantsModule']
 );
 
+// This configuration is needed to allow downloads of the diff patch.
+// See https://github.com/angular/angular.js/issues/3889
+Loader.config(['$compileProvider', function($compileProvider) {
+  $compileProvider.aHrefSanitizationWhitelist(/^\s*(https?|ftp|file|blob):/);
+}]);
+
 Loader.directive(
   'resultsUpdatedCallbackDirective',
   ['$timeout',
@@ -841,6 +847,8 @@ Loader.controller(
         data: modificationData
       }).success(function(data, status, headers, config) {
         $scope.diffResults = data;
+        var blob = new Blob([$scope.diffResults], {type: 'text/plain'});
+        $scope.diffResultsBlobUrl = window.URL.createObjectURL(blob);
         $scope.submitPending = false;
       }).error(function(data, status, headers, config) {
         alert("There was an error submitting your baselines.\n\n" +
index 6c158a6e7ec3d8b8a7c5c3373a3a70ec777b9f61..1662adf89cb9e1fb01657abdf3790f3c1a3a970c 100644 (file)
           Here is the patch to apply to your local checkout:
           <br>
           <textarea rows="8" cols="50">{{diffResults}}</textarea>
+          <br>
+          <a download="patch.txt" ng-href="{{diffResultsBlobUrl}}">
+            Click here to download that patch as a text file.
+          </a>
         </div>
       </div>