-
-
Notifications
You must be signed in to change notification settings - Fork 5.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve async/await usage, and sort init calls in
index.js
(#17386)
* clean up async/await, and sort init calls in `index.js * use `const _promise` to indicate that we do not need await an async function
- Loading branch information
1 parent
3a693bd
commit bb71cee
Showing
21 changed files
with
214 additions
and
202 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,47 @@ | ||
const {csrfToken} = window.config; | ||
|
||
export function initRepoCommitButton() { | ||
$('.commit-button').on('click', function (e) { | ||
e.preventDefault(); | ||
$(this).parent().find('.commit-body').toggle(); | ||
}); | ||
} | ||
|
||
export function initRepoCommitLastCommitLoader() { | ||
const entryMap = {}; | ||
|
||
const entries = $('table#repo-files-table tr.notready') | ||
.map((_, v) => { | ||
entryMap[$(v).attr('data-entryname')] = $(v); | ||
return $(v).attr('data-entryname'); | ||
}) | ||
.get(); | ||
|
||
if (entries.length === 0) { | ||
return; | ||
} | ||
|
||
const lastCommitLoaderURL = $('table#repo-files-table').data('lastCommitLoaderUrl'); | ||
|
||
if (entries.length > 200) { | ||
$.post(lastCommitLoaderURL, { | ||
_csrf: csrfToken, | ||
}, (data) => { | ||
$('table#repo-files-table').replaceWith(data); | ||
}); | ||
return; | ||
} | ||
|
||
$.post(lastCommitLoaderURL, { | ||
_csrf: csrfToken, | ||
'f': entries, | ||
}, (data) => { | ||
$(data).find('tr').each((_, row) => { | ||
if (row.className === 'commit-list') { | ||
$('table#repo-files-table .commit-list').replaceWith(row); | ||
return; | ||
} | ||
entryMap[$(row).attr('data-entryname')].replaceWith(row); | ||
}); | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
web_src/js/features/gitgraph.js → web_src/js/features/repo-graph.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.