Skip to content

Commit 32589a2

Browse files
committed
fix
1 parent d32eb07 commit 32589a2

File tree

3 files changed

+23
-17
lines changed

3 files changed

+23
-17
lines changed

templates/user/dashboard/dashboard.tmpl

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,11 @@
55
<div class="flex-container-main">
66
{{template "base/alert" .}}
77
{{template "user/heatmap" .}}
8-
{{template "user/dashboard/guide" .}}
9-
{{template "user/dashboard/feeds" .}}
8+
{{if .Feeds}}
9+
{{template "user/dashboard/feeds" .}}
10+
{{else}}
11+
{{template "user/dashboard/guide" .}}
12+
{{end}}
1013
</div>
1114
{{template "user/dashboard/repolist" .}}
1215
</div>
Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
1-
{{if not .Feeds}}
2-
<div class="ui center segment tw-py-8">
3-
<img width="30" height="30" src="{{AssetUrlPrefix}}/img/logo.svg" alt="{{ctx.Locale.Tr "logo"}}" aria-hidden="true">
4-
<h2>{{ctx.Locale.Tr "guide.welcome"}}</h2>
5-
<p>{{ctx.Locale.Tr "guide.welcome_desc"}}</p>
6-
</div>
7-
{{end}}
8-
1+
<div class="ui center segment tw-py-8">
2+
<img width="30" height="30" src="{{AssetUrlPrefix}}/img/logo.svg" alt="{{ctx.Locale.Tr "logo"}}" aria-hidden="true">
3+
<h2>{{ctx.Locale.Tr "guide.welcome"}}</h2>
4+
<p>{{ctx.Locale.Tr "guide.welcome_desc"}}</p>
5+
</div>

web_src/js/components/DashboardRepoList.vue

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,12 @@ const sfc = {
9191
}${this.privateFilter === 'private' ? '&is_private=true' : ''}${this.privateFilter === 'public' ? '&is_private=false' : ''
9292
}`;
9393
},
94+
isRepoEmpty() {
95+
return !this.isLoading && !this.reposTotalCount;
96+
},
97+
isOrgEmpty() {
98+
return !this.isLoading && !this.organizations.length;
99+
},
94100
repoTypeCount() {
95101
return this.counts[`${this.reposFilter}:${this.archivedFilter}:${this.privateFilter}`];
96102
},
@@ -243,7 +249,7 @@ const sfc = {
243249
if (!this.reposTotalCount) {
244250
const totalCountSearchURL = `${this.subUrl}/repo/search?count_only=1&uid=${this.uid}&team_id=${this.teamId}&q=&page=1&mode=`;
245251
response = await GET(totalCountSearchURL);
246-
this.reposTotalCount = response.headers.get('X-Total-Count') ?? '?';
252+
this.reposTotalCount = parseInt(response.headers.get('X-Total-Count') ?? '0');
247253
}
248254
249255
response = await GET(searchedURL);
@@ -264,7 +270,7 @@ const sfc = {
264270
locale_latest_commit_status_state: webSearchRepo.locale_latest_commit_status,
265271
};
266272
});
267-
const count = response.headers.get('X-Total-Count');
273+
const count = parseInt(response.headers.get('X-Total-Count'));
268274
if (searchedQuery === '' && searchedMode === '' && this.archivedFilter === 'both') {
269275
this.reposTotalCount = count;
270276
}
@@ -363,8 +369,8 @@ export default sfc; // activate the IDE's Vue plugin
363369
<svg-icon name="octicon-plus"/>
364370
</a>
365371
</h4>
366-
<div v-if="isLoading" class="ui attached segment" :class="{'is-loading': isLoading}"/>
367-
<div v-if="!isLoading && !repos.length" class="ui attached segment empty-placeholder">
372+
<div v-if="isLoading && !reposTotalCount" class="ui attached segment" :class="{'is-loading': isLoading}"/>
373+
<div v-if="isRepoEmpty" class="ui attached segment empty-placeholder">
368374
<svg-icon name="octicon-no-entry" :size="48" class-name="repo-list-icon"/>
369375
<h2>{{ textNoRepo }}</h2>
370376
<p>
@@ -378,10 +384,10 @@ export default sfc; // activate the IDE's Vue plugin
378384
</a>
379385
</p>
380386
</div>
381-
<div v-if="repos.length" class="ui attached segment repos-search">
387+
<div v-if="reposTotalCount" class="ui attached segment repos-search">
382388
<div class="ui small fluid action left icon input">
383389
<input type="search" spellcheck="false" maxlength="255" @input="changeReposFilter(reposFilter)" v-model="searchQuery" ref="search" @keydown="reposFilterKeyControl" :placeholder="textSearchRepos">
384-
<i class="icon loading-icon-3px"><svg-icon name="octicon-search" :size="16"/></i>
390+
<i class="icon loading-icon-3px" :class="{'is-loading': isLoading}"><svg-icon name="octicon-search" :size="16"/></i>
385391
<div class="ui dropdown icon button" :title="textFilter">
386392
<svg-icon name="octicon-filter" :size="16"/>
387393
<div class="menu">
@@ -492,7 +498,7 @@ export default sfc; // activate the IDE's Vue plugin
492498
</a>
493499
</h4>
494500
<div v-if="isLoading" class="ui attached segment" :class="{'is-loading': isLoading}"/>
495-
<div v-if="!isLoading && !organizations.length" class="ui attached segment empty-placeholder">
501+
<div v-if="isOrgEmpty" class="ui attached segment empty-placeholder">
496502
<svg-icon name="octicon-no-entry" :size="48" class-name="repo-list-icon"/>
497503
<h2>{{ textNoOrg }}</h2>
498504
<p v-if="canCreateOrganization">

0 commit comments

Comments
 (0)