Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Side by Side Diff: gm/rebaseline_server/static/live-loader.js

Issue 487853004: rebaseline_server: allow users to generate SKP diff patches on a shared instance (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: add TODOs for Stephan Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « gm/rebaseline_server/static/constants.js ('k') | gm/rebaseline_server/static/live-view.html » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Loader: 2 * Loader:
3 * Reads GM result reports written out by results.py, and imports 3 * Reads GM result reports written out by results.py, and imports
4 * them into $scope.extraColumnHeaders and $scope.imagePairs . 4 * them into $scope.extraColumnHeaders and $scope.imagePairs .
5 */ 5 */
6 var Loader = angular.module( 6 var Loader = angular.module(
7 'Loader', 7 'Loader',
8 ['ConstantsModule'] 8 ['ConstantsModule']
9 ); 9 );
10 10
(...skipping 758 matching lines...) Expand 10 before | Expand all | Expand 10 after
769 769
770 770
771 // 771 //
772 // Operations for sending info back to the server. 772 // Operations for sending info back to the server.
773 // 773 //
774 774
775 /** 775 /**
776 * Tell the server that the actual results of these particular tests 776 * Tell the server that the actual results of these particular tests
777 * are acceptable. 777 * are acceptable.
778 * 778 *
779 * TODO(epoger): This assumes that the original expectations are in 779 * This assumes that the original expectations are in imageSetA, and the
780 * imageSetA, and the actuals are in imageSetB. 780 * new expectations are in imageSetB. That's fine, because the server
781 * mandates that anyway (it will swap the sets if the user requests them
782 * in the opposite order).
781 * 783 *
782 * @param imagePairsSubset an array of test results, most likely a subset of 784 * @param imagePairsSubset an array of test results, most likely a subset of
783 * $scope.imagePairs (perhaps with some modifications) 785 * $scope.imagePairs (perhaps with some modifications)
784 */ 786 */
785 $scope.submitApprovals = function(imagePairsSubset) { 787 $scope.submitApprovals = function(imagePairsSubset) {
786 $scope.submitPending = true; 788 $scope.submitPending = true;
789 $scope.diffResults = "";
787 790
788 // Convert bug text field to null or 1-item array. 791 // Convert bug text field to null or 1-item array.
789 var bugs = null; 792 var bugs = null;
790 var bugNumber = parseInt($scope.submitAdvancedSettings['bug']); 793 var bugNumber = parseInt($scope.submitAdvancedSettings['bug']);
791 if (!isNaN(bugNumber)) { 794 if (!isNaN(bugNumber)) {
792 bugs = [bugNumber]; 795 bugs = [bugNumber];
793 } 796 }
794 797
795 // TODO(epoger): This is a suboptimal way to prevent users from
796 // rebaselining failures in alternative renderModes, but it does work.
797 // For a better solution, see
798 // https://code.google.com/p/skia/issues/detail?id=1748 ('gm: add new
799 // result type, RenderModeMismatch')
800 var encounteredComparisonConfig = false;
801
802 var updatedExpectations = []; 798 var updatedExpectations = [];
803 for (var i = 0; i < imagePairsSubset.length; i++) { 799 for (var i = 0; i < imagePairsSubset.length; i++) {
804 var imagePair = imagePairsSubset[i]; 800 var imagePair = imagePairsSubset[i];
805 var updatedExpectation = {}; 801 var updatedExpectation = {};
806 updatedExpectation[constants.KEY__IMAGEPAIRS__EXPECTATIONS] = 802 updatedExpectation[constants.KEY__IMAGEPAIRS__EXPECTATIONS] =
807 imagePair[constants.KEY__IMAGEPAIRS__EXPECTATIONS]; 803 imagePair[constants.KEY__IMAGEPAIRS__EXPECTATIONS];
808 updatedExpectation[constants.KEY__IMAGEPAIRS__EXTRACOLUMNS] = 804 updatedExpectation[constants.KEY__IMAGEPAIRS__EXTRACOLUMNS] =
809 imagePair[constants.KEY__IMAGEPAIRS__EXTRACOLUMNS]; 805 imagePair[constants.KEY__IMAGEPAIRS__EXTRACOLUMNS];
806 updatedExpectation[constants.KEY__IMAGEPAIRS__SOURCE_JSON_FILE] =
807 imagePair[constants.KEY__IMAGEPAIRS__SOURCE_JSON_FILE];
810 // IMAGE_B_URL contains the actual image (which is now the expectation) 808 // IMAGE_B_URL contains the actual image (which is now the expectation)
811 updatedExpectation[constants.KEY__IMAGEPAIRS__IMAGE_B_URL] = 809 updatedExpectation[constants.KEY__IMAGEPAIRS__IMAGE_B_URL] =
812 imagePair[constants.KEY__IMAGEPAIRS__IMAGE_B_URL]; 810 imagePair[constants.KEY__IMAGEPAIRS__IMAGE_B_URL];
813 if (0 == updatedExpectation[constants.KEY__IMAGEPAIRS__EXTRACOLUMNS]
814 [constants.KEY__EXTRACOLUMNS__CONFIG]
815 .indexOf('comparison-')) {
816 encounteredComparisonConfig = true;
817 }
818 811
819 // Advanced settings... 812 // Advanced settings...
820 if (null == updatedExpectation[constants.KEY__IMAGEPAIRS__EXPECTATIONS]) { 813 if (null == updatedExpectation[constants.KEY__IMAGEPAIRS__EXPECTATIONS]) {
821 updatedExpectation[constants.KEY__IMAGEPAIRS__EXPECTATIONS] = {}; 814 updatedExpectation[constants.KEY__IMAGEPAIRS__EXPECTATIONS] = {};
822 } 815 }
823 updatedExpectation[constants.KEY__IMAGEPAIRS__EXPECTATIONS] 816 updatedExpectation[constants.KEY__IMAGEPAIRS__EXPECTATIONS]
824 [constants.KEY__EXPECTATIONS__REVIEWED] = 817 [constants.KEY__EXPECTATIONS__REVIEWED] =
825 $scope.submitAdvancedSettings[ 818 $scope.submitAdvancedSettings[
826 constants.KEY__EXPECTATIONS__REVIEWED]; 819 constants.KEY__EXPECTATIONS__REVIEWED];
827 if (true == $scope.submitAdvancedSettings[ 820 if (true == $scope.submitAdvancedSettings[
828 constants.KEY__EXPECTATIONS__IGNOREFAILURE]) { 821 constants.KEY__EXPECTATIONS__IGNOREFAILURE]) {
829 // if it's false, don't send it at all (just keep the default) 822 // if it's false, don't send it at all (just keep the default)
830 updatedExpectation[constants.KEY__IMAGEPAIRS__EXPECTATIONS] 823 updatedExpectation[constants.KEY__IMAGEPAIRS__EXPECTATIONS]
831 [constants.KEY__EXPECTATIONS__IGNOREFAILURE] = true; 824 [constants.KEY__EXPECTATIONS__IGNOREFAILURE] = true;
832 } 825 }
833 updatedExpectation[constants.KEY__IMAGEPAIRS__EXPECTATIONS] 826 updatedExpectation[constants.KEY__IMAGEPAIRS__EXPECTATIONS]
834 [constants.KEY__EXPECTATIONS__BUGS] = bugs; 827 [constants.KEY__EXPECTATIONS__BUGS] = bugs;
835 828
836 updatedExpectations.push(updatedExpectation); 829 updatedExpectations.push(updatedExpectation);
837 } 830 }
838 if (encounteredComparisonConfig) {
839 alert("Approval failed -- you cannot approve results with config " +
840 "type comparison-*");
841 $scope.submitPending = false;
842 return;
843 }
844 var modificationData = {}; 831 var modificationData = {};
845 modificationData[constants.KEY__EDITS__MODIFICATIONS] = 832 modificationData[constants.KEY__LIVE_EDITS__MODIFICATIONS] =
846 updatedExpectations; 833 updatedExpectations;
847 modificationData[constants.KEY__EDITS__OLD_RESULTS_HASH] = 834 modificationData[constants.KEY__LIVE_EDITS__SET_A_DESCRIPTIONS] =
848 $scope.header[constants.KEY__HEADER__DATAHASH]; 835 $scope.header[constants.KEY__HEADER__SET_A_DESCRIPTIONS];
849 modificationData[constants.KEY__EDITS__OLD_RESULTS_TYPE] = 836 modificationData[constants.KEY__LIVE_EDITS__SET_B_DESCRIPTIONS] =
850 $scope.header[constants.KEY__HEADER__TYPE]; 837 $scope.header[constants.KEY__HEADER__SET_B_DESCRIPTIONS];
851 $http({ 838 $http({
852 method: "POST", 839 method: "POST",
853 url: "/edits", 840 url: "/live-edits",
854 data: modificationData 841 data: modificationData
855 }).success(function(data, status, headers, config) { 842 }).success(function(data, status, headers, config) {
856 var imagePairIndicesToMove = []; 843 $scope.diffResults = data;
857 for (var i = 0; i < imagePairsSubset.length; i++) { 844 $scope.submitPending = false;
858 imagePairIndicesToMove.push(imagePairsSubset[i].index);
859 }
860 $scope.moveImagePairsToTab(imagePairIndicesToMove,
861 "HackToMakeSureThisImagePairDisappears");
862 $scope.updateResults();
863 alert("New baselines submitted successfully!\n\n" +
864 "You still need to commit the updated expectations files on " +
865 "the server side to the Skia repo.\n\n" +
866 "When you click OK, your web UI will reload; after that " +
867 "completes, you will see the updated data (once the server has " +
868 "finished loading the update results into memory!) and you can " +
869 "submit more baselines if you want.");
870 // I don't know why, but if I just call reload() here it doesn't work.
871 // Making a timer call it fixes the problem.
872 $timeout(function(){location.reload();}, 1);
873 }).error(function(data, status, headers, config) { 845 }).error(function(data, status, headers, config) {
874 alert("There was an error submitting your baselines.\n\n" + 846 alert("There was an error submitting your baselines.\n\n" +
875 "Please see server-side log for details."); 847 "Please see server-side log for details.");
876 $scope.submitPending = false; 848 $scope.submitPending = false;
877 }); 849 });
878 }; 850 };
879 851
880 852
881 // 853 //
882 // Operations we use to mimic Set semantics, in such a way that 854 // Operations we use to mimic Set semantics, in such a way that
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
1035 * 1007 *
1036 * TODO(epoger): It might be nice to tint the color when it's not completely 1008 * TODO(epoger): It might be nice to tint the color when it's not completely
1037 * black or completely white. 1009 * black or completely white.
1038 */ 1010 */
1039 $scope.brightnessStringToHexColor = function(brightnessString) { 1011 $scope.brightnessStringToHexColor = function(brightnessString) {
1040 var v = parseInt(brightnessString); 1012 var v = parseInt(brightnessString);
1041 return $scope.hexColorString(v, v, v); 1013 return $scope.hexColorString(v, v, v);
1042 }; 1014 };
1043 } 1015 }
1044 ); 1016 );
OLDNEW
« no previous file with comments | « gm/rebaseline_server/static/constants.js ('k') | gm/rebaseline_server/static/live-view.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698