diff options
author | Nick Coutsos <[email protected]> | 2021-11-13 19:26:44 -0500 |
---|---|---|
committer | Nick Coutsos <[email protected]> | 2021-11-13 19:26:44 -0500 |
commit | 7207529cc23bba88d1d24e53d56163dc11afb6c3 (patch) | |
tree | b89b04b0365ab8a3cc2fce67df94aa86370dfba3 | |
parent | ccd6c89d86a6faccf1d72205ac16cd56065814ac (diff) | |
download | keymap-editor-7207529cc23bba88d1d24e53d56163dc11afb6c3.tar.gz keymap-editor-7207529cc23bba88d1d24e53d56163dc11afb6c3.zip |
Lint and display warnings client-side
-rw-r--r-- | application/components/github/picker.vue | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/application/components/github/picker.vue b/application/components/github/picker.vue index d7027f9..7f40a7f 100644 --- a/application/components/github/picker.vue +++ b/application/components/github/picker.vue @@ -37,6 +37,12 @@ :otherRepoOrBranchAvailable="repositoryChoices.length > 0 || branchChoices.length > 0" @dismiss="clearSelection" /> + <validation-errors + v-if="loadKeyboardWarnings" + title="Warning" + :errors="loadKeyboardWarnings" + @dismiss="loadKeyboardWarnings = null" + /> </span> </loader> </template> @@ -64,7 +70,8 @@ export default { branches: [], loadingBranches: false, loadingKeyboard: false, - loadKeyboardError: null + loadKeyboardError: null, + loadKeyboardWarnings: null } }, created() { @@ -158,12 +165,26 @@ export default { const response = await github.fetchLayoutAndKeymap(repository, branch) this.loadingKeyboard = false + this.lintKeyboard(response) this.$emit('select', { github: { repository, branch }, ...response }) }, + lintKeyboard({ layout }) { + const noKeyHasPosition = layout.every(key => ( + key.row === undefined && + key.col === undefined + )) + + if (noKeyHasPosition) { + this.loadKeyboardWarnings = [ + 'Layout in info.json has no row/col definitions. Generated keymap files will not be nicely formatted.' + ] + } + }, clearSelection() { this.branchName = null this.loadKeyboardError = null + this.loadKeyboardWarnings = null } }, computed: { |