diff --git a/CHANGELOG.md b/CHANGELOG.md index a70d134..dece1ca 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ ### Features * Valid cells (i.e., those without any errors or warnings) are no longer colored green as this information wasn't important to display. The green coloring could actually detract from the ease of locating invalid cells. [#58](https://github.com/biocore/Keemei/issues/58) +* Users are notified when a sheet is completely valid (i.e., no cells have errors or warnings) via a pop-up box. [#57](https://github.com/biocore/Keemei/issues/57) ## Version 2 Initial alpha release. diff --git a/src/Base.gs b/src/Base.gs index 44e66fb..e7603d8 100644 --- a/src/Base.gs +++ b/src/Base.gs @@ -43,6 +43,11 @@ function validate() { validateColumns_(sheet, state); setStatus_(range, state); + + if (isValidState_(state)) { + var ui = SpreadsheetApp.getUi(); + ui.alert("Valid spreadsheet", "All's well! Your spreadsheet is valid.", ui.ButtonSet.OK); + } }; function clear() { diff --git a/src/State.gs b/src/State.gs index 0e8a222..e90c60a 100644 --- a/src/State.gs +++ b/src/State.gs @@ -3,6 +3,20 @@ function setStatus_(range, state) { range.setNotes(state.notes); }; +function isValidState_(state) { + var valid = true; + for (var i = 0; i < state.colors.length; i++) { + for (var j = 0; j < state.colors[i].length; j++) { + var color = state.colors[i][j]; + if (color == Status.ERROR || color == Status.WARNING) { + valid = false; + break; + } + } + } + return valid; +}; + function initializeState_(range) { colors = initializeGrid_(range, Status.RESET); notes = initializeGrid_(range, "");