Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
  • Loading branch information
sahinakkaya committed Feb 24, 2024
1 parent c2c675e commit f8771d5
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 6 deletions.
1 change: 0 additions & 1 deletion routers/web/repo/recent_commits.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ func RecentCommits(ctx *context.Context) {

ctx.Data["PageIsActivity"] = true
ctx.Data["PageIsRecentCommits"] = true
ctx.PageData["repoLink"] = ctx.Repo.RepoLink

ctx.HTML(http.StatusOK, tplRecentCommits)
}
Expand Down
1 change: 1 addition & 0 deletions templates/repo/recent_commits.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
data-locale-loading-title-failed="{{ctx.Locale.Tr "graphs.component_loading_failed" (ctx.Locale.Tr "graphs.recent_commits.what")}}"
data-locale-loading-info="{{ctx.Locale.Tr "graphs.component_loading_info"}}"
data-locale-component-failed-to-load="{{ctx.Locale.Tr "graphs.component_failed_to_load"}}"
data-repo-link="{{ctx.Repo.RepoLink}}"
>
</div>
{{end}}
9 changes: 5 additions & 4 deletions web_src/js/components/RepoRecentCommits.vue
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ import {chartJsColors} from '../utils/color.js';
import {sleep} from '../utils.js';
import 'chartjs-adapter-dayjs-4/dist/chartjs-adapter-dayjs-4.esm';
const {pageData} = window.config;
Chart.defaults.color = chartJsColors.text;
Chart.defaults.borderColor = chartJsColors.border;
Expand All @@ -37,11 +35,14 @@ export default {
type: Object,
required: true
},
repoLink: {
type: String,
required: true
}
},
data: () => ({
isLoading: false,
errorText: '',
repoLink: pageData.repoLink || [],
data: [],
}),
mounted() {
Expand All @@ -53,7 +54,7 @@ export default {
try {
let response;
do {
response = await GET(`${this.repoLink}/activity/recent-commits/data`);
response = await GET(`${repoLink}/activity/recent-commits/data`);
if (response.status === 202) {
await sleep(1000); // wait for 1 second before retrying
}
Expand Down
3 changes: 2 additions & 1 deletion web_src/js/features/recent-commits.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ export async function initRepoRecentCommits() {
loadingTitle: el.getAttribute('data-locale-loading-title'),
loadingTitleFailed: el.getAttribute('data-locale-loading-title-failed'),
loadingInfo: el.getAttribute('data-locale-loading-info'),
}
},
repoLink: el.getAttribute('data-repo-link')
});
View.mount(el);
} catch (err) {
Expand Down

0 comments on commit f8771d5

Please sign in to comment.