aboutsummaryrefslogtreecommitdiffstats
path: root/web_src/js/components/DashboardRepoList.vue
diff options
context:
space:
mode:
authorsilverwind <me@silverwind.io>2024-12-08 03:58:18 +0100
committerGitHub <noreply@github.com>2024-12-08 02:58:18 +0000
commit1518f4ed123ae5f4f094e7a335b1d1400949265d (patch)
tree6704b3edf05508edb1051f43ff2bcc59f67c86fc /web_src/js/components/DashboardRepoList.vue
parent96d3a03a08d4ac20d2356d6ea84e8c335e9382f2 (diff)
downloadgitea-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/DashboardRepoList.vue')
-rw-r--r--web_src/js/components/DashboardRepoList.vue17
1 files changed, 13 insertions, 4 deletions
diff --git a/web_src/js/components/DashboardRepoList.vue b/web_src/js/components/DashboardRepoList.vue
index 3d3ac2fc69..41793d60ed 100644
--- a/web_src/js/components/DashboardRepoList.vue
+++ b/web_src/js/components/DashboardRepoList.vue
@@ -6,8 +6,17 @@ import {fomanticQuery} from '../modules/fomantic/base.ts';
const {appSubUrl, assetUrlPrefix, pageData} = window.config;
+type CommitStatus = 'pending' | 'success' | 'error' | 'failure' | 'warning';
+
+type CommitStatusMap = {
+ [status in CommitStatus]: {
+ name: string,
+ color: string,
+ };
+};
+
// make sure this matches templates/repo/commit_status.tmpl
-const commitStatus = {
+const commitStatus: CommitStatusMap = {
pending: {name: 'octicon-dot-fill', color: 'yellow'},
success: {name: 'octicon-check', color: 'green'},
error: {name: 'gitea-exclamation', color: 'red'},
@@ -281,18 +290,18 @@ const sfc = {
return 'octicon-repo';
},
- statusIcon(status) {
+ statusIcon(status: CommitStatus) {
return commitStatus[status].name;
},
- statusColor(status) {
+ statusColor(status: CommitStatus) {
return commitStatus[status].color;
},
reposFilterKeyControl(e) {
switch (e.key) {
case 'Enter':
- document.querySelector('.repo-owner-name-list li.active a')?.click();
+ document.querySelector<HTMLAnchorElement>('.repo-owner-name-list li.active a')?.click();
break;
case 'ArrowUp':
if (this.activeIndex > 0) {