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>
This commit is contained in:
silverwind 2024-12-08 03:58:18 +01:00 committed by GitHub
parent 96d3a03a08
commit 1518f4ed12
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 59 additions and 37 deletions

View file

@ -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) {