diff options
author | silverwind <me@silverwind.io> | 2024-12-08 03:58:18 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-12-08 02:58:18 +0000 |
commit | 1518f4ed123ae5f4f094e7a335b1d1400949265d (patch) | |
tree | 6704b3edf05508edb1051f43ff2bcc59f67c86fc /web_src/js/components/DiffCommitSelector.vue | |
parent | 96d3a03a08d4ac20d2356d6ea84e8c335e9382f2 (diff) | |
download | gitea-1518f4ed123ae5f4f094e7a335b1d1400949265d.tar.gz gitea-1518f4ed123ae5f4f094e7a335b1d1400949265d.zip |
Fix typescript errors in Vue files, fix regression in "Recent Commits" chart (#32649)
- Fix all typescript errors in `.vue` files
- Fix regression from https://github.com/go-gitea/gitea/pull/32329 where
"Recent Commits" chart would not render.
---------
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Diffstat (limited to 'web_src/js/components/DiffCommitSelector.vue')
-rw-r--r-- | web_src/js/components/DiffCommitSelector.vue | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/web_src/js/components/DiffCommitSelector.vue b/web_src/js/components/DiffCommitSelector.vue index c78531cf9f..3a394955ca 100644 --- a/web_src/js/components/DiffCommitSelector.vue +++ b/web_src/js/components/DiffCommitSelector.vue @@ -14,7 +14,7 @@ export default { issueLink: el.getAttribute('data-issuelink'), locale: { filter_changes_by_commit: el.getAttribute('data-filter_changes_by_commit'), - }, + } as Record<string, string>, commits: [], hoverActivated: false, lastReviewCommitSha: null, @@ -41,16 +41,16 @@ export default { this.$el.removeEventListener('keyup', this.onKeyUp); }, methods: { - onBodyClick(event) { + onBodyClick(event: MouseEvent) { // close this menu on click outside of this element when the dropdown is currently visible opened if (this.$el.contains(event.target)) return; if (this.menuVisible) { this.toggleMenu(); } }, - onKeyDown(event) { + onKeyDown(event: KeyboardEvent) { if (!this.menuVisible) return; - const item = document.activeElement; + const item = document.activeElement as HTMLElement; if (!this.$el.contains(item)) return; switch (event.key) { case 'ArrowDown': // select next element @@ -73,7 +73,7 @@ export default { if (commitIdx) this.highlight(this.commits[commitIdx]); } }, - onKeyUp(event) { + onKeyUp(event: KeyboardEvent) { if (!this.menuVisible) return; const item = document.activeElement; if (!this.$el.contains(item)) return; @@ -95,7 +95,7 @@ export default { } }, /** Focus given element */ - focusElem(elem, prevElem) { + focusElem(elem: HTMLElement, prevElem: HTMLElement) { if (elem) { elem.tabIndex = 0; if (prevElem) prevElem.tabIndex = -1; @@ -149,7 +149,7 @@ export default { window.location.assign(`${this.issueLink}/files/${this.lastReviewCommitSha}..${this.commits.at(-1).id}${this.queryParams}`); }, /** Clicking on a single commit opens this specific commit */ - commitClicked(commitId, newWindow = false) { + commitClicked(commitId: string, newWindow = false) { const url = `${this.issueLink}/commits/${commitId}${this.queryParams}`; if (newWindow) { window.open(url); |