mirror of
				https://github.com/go-gitea/gitea
				synced 2025-10-31 19:38:23 +00:00 
			
		
		
		
	Fix some log and UI problems (#34863)
Remove the misleading error log, fix #34738 Make the "search" input auto-focused, fix #34807
This commit is contained in:
		| @@ -39,7 +39,7 @@ export default defineComponent({ | ||||
|     return { | ||||
|       tab, | ||||
|       repos: [], | ||||
|       reposTotalCount: 0, | ||||
|       reposTotalCount: null, | ||||
|       reposFilter, | ||||
|       archivedFilter, | ||||
|       privateFilter, | ||||
| @@ -113,9 +113,6 @@ export default defineComponent({ | ||||
|     const el = document.querySelector('#dashboard-repo-list'); | ||||
|     this.changeReposFilter(this.reposFilter); | ||||
|     fomanticQuery(el.querySelector('.ui.dropdown')).dropdown(); | ||||
|     nextTick(() => { | ||||
|       this.$refs.search?.focus(); | ||||
|     }); | ||||
|  | ||||
|     this.textArchivedFilterTitles = { | ||||
|       'archived': this.textShowOnlyArchived, | ||||
| @@ -243,12 +240,20 @@ export default defineComponent({ | ||||
|  | ||||
|       let response, json; | ||||
|       try { | ||||
|         const firstLoad = this.reposTotalCount === null; | ||||
|         if (!this.reposTotalCount) { | ||||
|           const totalCountSearchURL = `${this.subUrl}/repo/search?count_only=1&uid=${this.uid}&team_id=${this.teamId}&q=&page=1&mode=`; | ||||
|           response = await GET(totalCountSearchURL); | ||||
|           this.reposTotalCount = parseInt(response.headers.get('X-Total-Count') ?? '0'); | ||||
|         } | ||||
|  | ||||
|         if (firstLoad && this.reposTotalCount) { | ||||
|           nextTick(() => { | ||||
|             // MDN: If there's no focused element, this is the Document.body or Document.documentElement. | ||||
|             if ((document.activeElement === document.body || document.activeElement === document.documentElement)) { | ||||
|               this.$refs.search.focus({preventScroll: true}); | ||||
|             } | ||||
|           }); | ||||
|         } | ||||
|         response = await GET(searchedURL); | ||||
|         json = await response.json(); | ||||
|       } catch { | ||||
| @@ -350,7 +355,7 @@ export default defineComponent({ | ||||
|       <h4 class="ui top attached header tw-flex tw-items-center"> | ||||
|         <div class="tw-flex-1 tw-flex tw-items-center"> | ||||
|           {{ textMyRepos }} | ||||
|           <span class="ui grey label tw-ml-2">{{ reposTotalCount }}</span> | ||||
|           <span v-if="reposTotalCount" class="ui grey label tw-ml-2">{{ reposTotalCount }}</span> | ||||
|         </div> | ||||
|         <a class="tw-flex tw-items-center muted" :href="subUrl + '/repo/create' + (isOrganization ? '?org=' + organizationId : '')" :data-tooltip-content="textNewRepo"> | ||||
|           <svg-icon name="octicon-plus"/> | ||||
| @@ -421,7 +426,7 @@ export default defineComponent({ | ||||
|       </div> | ||||
|       <div v-if="repos.length" class="ui attached table segment tw-rounded-b"> | ||||
|         <ul class="repo-owner-name-list"> | ||||
|           <li class="tw-flex tw-items-center tw-py-2" v-for="repo, index in repos" :class="{'active': index === activeIndex}" :key="repo.id"> | ||||
|           <li class="tw-flex tw-items-center tw-py-2" v-for="(repo, index) in repos" :class="{'active': index === activeIndex}" :key="repo.id"> | ||||
|             <a class="repo-list-link muted" :href="repo.link"> | ||||
|               <svg-icon :name="repoIcon(repo)" :size="16" class="repo-list-icon"/> | ||||
|               <div class="text truncate">{{ repo.full_name }}</div> | ||||
|   | ||||
		Reference in New Issue
	
	Block a user