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
This commit is contained in:
parent
3a693bd18c
commit
bb71ceeeb2
21 changed files with 223 additions and 211 deletions
|
@ -135,11 +135,11 @@ export function initGlobalCommon() {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function initGlobalDropzone() {
|
export function initGlobalDropzone() {
|
||||||
// Dropzone
|
// Dropzone
|
||||||
for (const el of document.querySelectorAll('.dropzone')) {
|
for (const el of document.querySelectorAll('.dropzone')) {
|
||||||
const $dropzone = $(el);
|
const $dropzone = $(el);
|
||||||
await createDropzone(el, {
|
const _promise = createDropzone(el, {
|
||||||
url: $dropzone.data('upload-url'),
|
url: $dropzone.data('upload-url'),
|
||||||
headers: {'X-Csrf-Token': csrfToken},
|
headers: {'X-Csrf-Token': csrfToken},
|
||||||
maxFiles: $dropzone.data('max-file'),
|
maxFiles: $dropzone.data('max-file'),
|
||||||
|
|
|
@ -2,7 +2,7 @@ import {htmlEscape} from 'escape-goat';
|
||||||
|
|
||||||
const {appSubUrl} = window.config;
|
const {appSubUrl} = window.config;
|
||||||
|
|
||||||
export function initSearchUserBox() {
|
export function initCompSearchUserBox() {
|
||||||
const $searchUserBox = $('#search-user-box');
|
const $searchUserBox = $('#search-user-box');
|
||||||
$searchUserBox.search({
|
$searchUserBox.search({
|
||||||
minCharacters: 2,
|
minCharacters: 2,
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
const {csrfToken} = window.config;
|
const {csrfToken} = window.config;
|
||||||
|
|
||||||
export function initWebHookEditor() {
|
export function initCompWebHookEditor() {
|
||||||
if ($('.new.webhook').length === 0) {
|
if ($('.new.webhook').length === 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,24 +0,0 @@
|
||||||
export function initDiffShowMore() {
|
|
||||||
$('#diff-files, #diff-file-boxes').on('click', '#diff-show-more-files, #diff-show-more-files-stats', (e) => {
|
|
||||||
e.preventDefault();
|
|
||||||
|
|
||||||
if ($(e.target).hasClass('disabled')) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
$('#diff-show-more-files, #diff-show-more-files-stats').addClass('disabled');
|
|
||||||
|
|
||||||
const url = $('#diff-show-more-files, #diff-show-more-files-stats').data('href');
|
|
||||||
$.ajax({
|
|
||||||
type: 'GET',
|
|
||||||
url,
|
|
||||||
}).done((resp) => {
|
|
||||||
if (!resp || resp.html === '' || resp.empty) {
|
|
||||||
$('#diff-show-more-files, #diff-show-more-files-stats').removeClass('disabled');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
$('#diff-too-many-files-stats').remove();
|
|
||||||
$('#diff-files').append($(resp).find('#diff-files li'));
|
|
||||||
$('#diff-incomplete').replaceWith($(resp).find('#diff-file-boxes').children());
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
|
@ -3,7 +3,6 @@ export default async function createDropzone(el, opts) {
|
||||||
import(/* webpackChunkName: "dropzone" */'dropzone'),
|
import(/* webpackChunkName: "dropzone" */'dropzone'),
|
||||||
import(/* webpackChunkName: "dropzone" */'dropzone/dist/dropzone.css'),
|
import(/* webpackChunkName: "dropzone" */'dropzone/dist/dropzone.css'),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
Dropzone.autoDiscover = false;
|
Dropzone.autoDiscover = false;
|
||||||
return new Dropzone(el, opts);
|
return new Dropzone(el, opts);
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@ import Vue from 'vue';
|
||||||
|
|
||||||
import ActivityHeatmap from '../components/ActivityHeatmap.vue';
|
import ActivityHeatmap from '../components/ActivityHeatmap.vue';
|
||||||
|
|
||||||
export default async function initHeatmap() {
|
export default function initHeatmap() {
|
||||||
const el = document.getElementById('user-heatmap');
|
const el = document.getElementById('user-heatmap');
|
||||||
if (!el) return;
|
if (!el) return;
|
||||||
|
|
||||||
|
@ -24,7 +24,7 @@ export default async function initHeatmap() {
|
||||||
|
|
||||||
new View().$mount(el);
|
new View().$mount(el);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error(err);
|
console.error('Heatmap failed to load', err);
|
||||||
el.textContent = 'Heatmap failed to load';
|
el.textContent = 'Heatmap failed to load';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,7 +29,7 @@ function getDefaultSvgBoundsIfUndefined(svgXml, src) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default async function initImageDiff() {
|
export default function initImageDiff() {
|
||||||
function createContext(image1, image2) {
|
function createContext(image1, image2) {
|
||||||
const size1 = {
|
const size1 = {
|
||||||
width: image1 && image1.width || 0,
|
width: image1 && image1.width || 0,
|
||||||
|
|
|
@ -1,40 +0,0 @@
|
||||||
const {csrfToken} = window.config;
|
|
||||||
|
|
||||||
export async function initLastCommitLoader() {
|
|
||||||
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);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
|
@ -40,7 +40,7 @@ async function receiveUpdateCount(event) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function initNotificationCount() {
|
export function initNotificationCount() {
|
||||||
const notificationCount = $('.notification_count');
|
const notificationCount = $('.notification_count');
|
||||||
|
|
||||||
if (!notificationCount.length) {
|
if (!notificationCount.length) {
|
||||||
|
@ -66,7 +66,7 @@ export async function initNotificationCount() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (event.data.type === 'notification-count') {
|
if (event.data.type === 'notification-count') {
|
||||||
receiveUpdateCount(event.data);
|
const _promise = receiveUpdateCount(event.data);
|
||||||
} else if (event.data.type === 'error') {
|
} else if (event.data.type === 'error') {
|
||||||
console.error(event.data);
|
console.error(event.data);
|
||||||
} else if (event.data.type === 'logout') {
|
} else if (event.data.type === 'logout') {
|
||||||
|
|
|
@ -1,6 +1,47 @@
|
||||||
|
const {csrfToken} = window.config;
|
||||||
|
|
||||||
export function initRepoCommitButton() {
|
export function initRepoCommitButton() {
|
||||||
$('.commit-button').on('click', function (e) {
|
$('.commit-button').on('click', function (e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
$(this).parent().find('.commit-body').toggle();
|
$(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);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
|
@ -79,3 +79,28 @@ export function initRepoDiffConversationNav() {
|
||||||
window.location.href = `#${anchor}`;
|
window.location.href = `#${anchor}`;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function initRepoDiffShowMore() {
|
||||||
|
$('#diff-files, #diff-file-boxes').on('click', '#diff-show-more-files, #diff-show-more-files-stats', (e) => {
|
||||||
|
e.preventDefault();
|
||||||
|
|
||||||
|
if ($(e.target).hasClass('disabled')) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
$('#diff-show-more-files, #diff-show-more-files-stats').addClass('disabled');
|
||||||
|
|
||||||
|
const url = $('#diff-show-more-files, #diff-show-more-files-stats').data('href');
|
||||||
|
$.ajax({
|
||||||
|
type: 'GET',
|
||||||
|
url,
|
||||||
|
}).done((resp) => {
|
||||||
|
if (!resp || resp.html === '' || resp.empty) {
|
||||||
|
$('#diff-show-more-files, #diff-show-more-files-stats').removeClass('disabled');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
$('#diff-too-many-files-stats').remove();
|
||||||
|
$('#diff-files').append($(resp).find('#diff-files li'));
|
||||||
|
$('#diff-incomplete').replaceWith($(resp).find('#diff-file-boxes').children());
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
|
@ -24,7 +24,7 @@ function initEditPreviewTab($form) {
|
||||||
_csrf: csrfToken,
|
_csrf: csrfToken,
|
||||||
mode,
|
mode,
|
||||||
context,
|
context,
|
||||||
text: $form.find(`.tab[data-tab="${$tabMenu.data('write')}"] textarea`).val()
|
text: $form.find(`.tab[data-tab="${$tabMenu.data('write')}"] textarea`).val(),
|
||||||
}, (data) => {
|
}, (data) => {
|
||||||
const $previewPanel = $form.find(`.tab[data-tab="${$tabMenu.data('preview')}"]`);
|
const $previewPanel = $form.find(`.tab[data-tab="${$tabMenu.data('preview')}"]`);
|
||||||
$previewPanel.html(data);
|
$previewPanel.html(data);
|
||||||
|
@ -42,7 +42,7 @@ function initEditDiffTab($form) {
|
||||||
$.post($this.data('url'), {
|
$.post($this.data('url'), {
|
||||||
_csrf: csrfToken,
|
_csrf: csrfToken,
|
||||||
context: $this.data('context'),
|
context: $this.data('context'),
|
||||||
content: $form.find(`.tab[data-tab="${$tabMenu.data('write')}"] textarea`).val()
|
content: $form.find(`.tab[data-tab="${$tabMenu.data('write')}"] textarea`).val(),
|
||||||
}, (data) => {
|
}, (data) => {
|
||||||
const $diffPreviewPanel = $form.find(`.tab[data-tab="${$tabMenu.data('diff')}"]`);
|
const $diffPreviewPanel = $form.find(`.tab[data-tab="${$tabMenu.data('diff')}"]`);
|
||||||
$diffPreviewPanel.html(data);
|
$diffPreviewPanel.html(data);
|
||||||
|
@ -75,7 +75,7 @@ function getCursorPosition($e) {
|
||||||
return pos;
|
return pos;
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function initRepoEditor() {
|
export function initRepoEditor() {
|
||||||
initEditorForm();
|
initEditorForm();
|
||||||
|
|
||||||
$('.js-quick-pull-choice-option').on('change', function () {
|
$('.js-quick-pull-choice-option').on('change', function () {
|
||||||
|
@ -134,6 +134,7 @@ export async function initRepoEditor() {
|
||||||
const $editArea = $('.repository.editor textarea#edit_area');
|
const $editArea = $('.repository.editor textarea#edit_area');
|
||||||
if (!$editArea.length) return;
|
if (!$editArea.length) return;
|
||||||
|
|
||||||
|
(async () => {
|
||||||
const editor = await createCodeEditor($editArea[0], $editFilename[0], previewFileModes);
|
const editor = await createCodeEditor($editArea[0], $editFilename[0], previewFileModes);
|
||||||
|
|
||||||
// Using events from https://github.com/codedance/jquery.AreYouSure#advanced-usage
|
// Using events from https://github.com/codedance/jquery.AreYouSure#advanced-usage
|
||||||
|
@ -155,7 +156,7 @@ export async function initRepoEditor() {
|
||||||
change() {
|
change() {
|
||||||
const dirty = $(this).hasClass(dirtyFileClass);
|
const dirty = $(this).hasClass(dirtyFileClass);
|
||||||
$commitButton.prop('disabled', !dirty);
|
$commitButton.prop('disabled', !dirty);
|
||||||
}
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
// Update the editor from query params, if available,
|
// Update the editor from query params, if available,
|
||||||
|
@ -172,9 +173,10 @@ export async function initRepoEditor() {
|
||||||
$('#edit-empty-content-modal').modal({
|
$('#edit-empty-content-modal').modal({
|
||||||
onApprove() {
|
onApprove() {
|
||||||
$('.edit.form').trigger('submit');
|
$('.edit.form').trigger('submit');
|
||||||
}
|
},
|
||||||
}).modal('show');
|
}).modal('show');
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
})();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
export default async function initGitGraph() {
|
export default function initRepoGraphGit() {
|
||||||
const graphContainer = document.getElementById('git-graph-container');
|
const graphContainer = document.getElementById('git-graph-container');
|
||||||
if (!graphContainer) return;
|
if (!graphContainer) return;
|
||||||
|
|
|
@ -104,7 +104,7 @@ function showContentHistoryMenu(issueBaseUrl, $item, commentId) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export function initIssueContentHistory() {
|
export function initRepoIssueContentHistory() {
|
||||||
const issueIndex = $('#issueIndex').val();
|
const issueIndex = $('#issueIndex').val();
|
||||||
const $itemIssue = $('.timeline-item.comment.first');
|
const $itemIssue = $('.timeline-item.comment.first');
|
||||||
if (!issueIndex || !$itemIssue.length) return;
|
if (!issueIndex || !$itemIssue.length) return;
|
|
@ -259,7 +259,7 @@ export function initRepoCommentForm() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
export async function initRepository() {
|
export function initRepository() {
|
||||||
if ($('.repository').length === 0) {
|
if ($('.repository').length === 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -363,7 +363,7 @@ export async function initRepository() {
|
||||||
if ($editContentZone.html().length === 0) {
|
if ($editContentZone.html().length === 0) {
|
||||||
$editContentZone.html($('#edit-content-form').html());
|
$editContentZone.html($('#edit-content-form').html());
|
||||||
$textarea = $editContentZone.find('textarea');
|
$textarea = $editContentZone.find('textarea');
|
||||||
attachTribute($textarea.get(), {mentions: true, emoji: true});
|
await attachTribute($textarea.get(), {mentions: true, emoji: true});
|
||||||
|
|
||||||
let dz;
|
let dz;
|
||||||
const $dropzone = $editContentZone.find('.dropzone');
|
const $dropzone = $editContentZone.find('.dropzone');
|
||||||
|
|
|
@ -8,7 +8,7 @@ const $lfsSettings = $('#lfs_settings');
|
||||||
const $lfsEndpoint = $('#lfs_endpoint');
|
const $lfsEndpoint = $('#lfs_endpoint');
|
||||||
const $items = $('#migrate_items').find('input[type=checkbox]');
|
const $items = $('#migrate_items').find('input[type=checkbox]');
|
||||||
|
|
||||||
export default function initMigration() {
|
export default function initRepoMigration() {
|
||||||
checkAuth();
|
checkAuth();
|
||||||
setLFSSettingsVisibility();
|
setLFSSettingsVisibility();
|
||||||
|
|
|
@ -1,10 +1,6 @@
|
||||||
const {csrfToken} = window.config;
|
const {csrfToken} = window.config;
|
||||||
|
|
||||||
export default async function initProject() {
|
async function initRepoProjectSortable() {
|
||||||
if (!$('.repository.projects').length) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const {Sortable} = await import(/* webpackChunkName: "sortable" */'sortablejs');
|
const {Sortable} = await import(/* webpackChunkName: "sortable" */'sortablejs');
|
||||||
const boardColumns = document.getElementsByClassName('board-column');
|
const boardColumns = document.getElementsByClassName('board-column');
|
||||||
|
|
||||||
|
@ -60,6 +56,16 @@ export default async function initProject() {
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default function initRepoProject() {
|
||||||
|
if (!$('.repository.projects').length) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
(async () => {
|
||||||
|
await initRepoProjectSortable();
|
||||||
|
})();
|
||||||
|
|
||||||
$('.edit-project-board').each(function () {
|
$('.edit-project-board').each(function () {
|
||||||
const projectHeader = $(this).closest('.board-column-header');
|
const projectHeader = $(this).closest('.board-column-header');
|
|
@ -40,10 +40,10 @@ export function initRepoSettingSearchTeamBox() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
export async function initRepoSettingGitHook() {
|
export function initRepoSettingGitHook() {
|
||||||
if ($('.edit.githook').length === 0) return;
|
if ($('.edit.githook').length === 0) return;
|
||||||
const filename = document.querySelector('.hook-filename').textContent;
|
const filename = document.querySelector('.hook-filename').textContent;
|
||||||
await createMonaco($('#content')[0], filename, {language: 'shell'});
|
const _promise = createMonaco($('#content')[0], filename, {language: 'shell'});
|
||||||
}
|
}
|
||||||
|
|
||||||
export function initRepoSettingBranches() {
|
export function initRepoSettingBranches() {
|
||||||
|
|
|
@ -3,7 +3,7 @@ const {appSubUrl, csrfToken, notificationSettings, enableTimeTracking} = window.
|
||||||
|
|
||||||
let updateTimeInterval = null; // holds setInterval id when active
|
let updateTimeInterval = null; // holds setInterval id when active
|
||||||
|
|
||||||
export async function initStopwatch() {
|
export function initStopwatch() {
|
||||||
if (!enableTimeTracking) {
|
if (!enableTimeTracking) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -135,7 +135,7 @@ async function updateStopwatchData(data) {
|
||||||
$('.stopwatch-cancel').attr('action', `${issueUrl}/times/stopwatch/cancel`);
|
$('.stopwatch-cancel').attr('action', `${issueUrl}/times/stopwatch/cancel`);
|
||||||
$('.stopwatch-issue').text(`${repo_owner_name}/${repo_name}#${issue_index}`);
|
$('.stopwatch-issue').text(`${repo_owner_name}/${repo_name}#${issue_index}`);
|
||||||
$('.stopwatch-time').text(prettyMilliseconds(seconds * 1000));
|
$('.stopwatch-time').text(prettyMilliseconds(seconds * 1000));
|
||||||
updateStopwatchTime(seconds);
|
await updateStopwatchTime(seconds);
|
||||||
btnEl.removeClass('hidden');
|
btnEl.removeClass('hidden');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,27 +7,25 @@ import {initDashboardRepoList} from './components/DashboardRepoList.js';
|
||||||
import attachTribute from './features/tribute.js';
|
import attachTribute from './features/tribute.js';
|
||||||
import initGlobalCopyToClipboardListener from './features/clipboard.js';
|
import initGlobalCopyToClipboardListener from './features/clipboard.js';
|
||||||
import initContextPopups from './features/contextpopup.js';
|
import initContextPopups from './features/contextpopup.js';
|
||||||
import initGitGraph from './features/gitgraph.js';
|
import initRepoGraphGit from './features/repo-graph.js';
|
||||||
import initHeatmap from './features/heatmap.js';
|
import initHeatmap from './features/heatmap.js';
|
||||||
import initImageDiff from './features/imagediff.js';
|
import initImageDiff from './features/imagediff.js';
|
||||||
import initMigration from './features/migration.js';
|
import initRepoMigration from './features/repo-migration.js';
|
||||||
import initProject from './features/projects.js';
|
import initRepoProject from './features/repo-projects.js';
|
||||||
import initServiceWorker from './features/serviceworker.js';
|
import initServiceWorker from './features/serviceworker.js';
|
||||||
import initTableSort from './features/tablesort.js';
|
import initTableSort from './features/tablesort.js';
|
||||||
import {initAdminUserListSearchForm} from './features/admin-users.js';
|
import {initAdminUserListSearchForm} from './features/admin-users.js';
|
||||||
import {initMarkupAnchors} from './markup/anchors.js';
|
import {initMarkupAnchors} from './markup/anchors.js';
|
||||||
import {initNotificationCount, initNotificationsTable} from './features/notification.js';
|
import {initNotificationCount, initNotificationsTable} from './features/notification.js';
|
||||||
import {initLastCommitLoader} from './features/lastcommitloader.js';
|
import {initRepoIssueContentHistory} from './features/repo-issue-content.js';
|
||||||
import {initIssueContentHistory} from './features/issue-content-history.js';
|
|
||||||
import {initStopwatch} from './features/stopwatch.js';
|
import {initStopwatch} from './features/stopwatch.js';
|
||||||
import {initDiffShowMore} from './features/diff.js';
|
|
||||||
import {initCommentContent, initMarkupContent} from './markup/content.js';
|
import {initCommentContent, initMarkupContent} from './markup/content.js';
|
||||||
|
|
||||||
import {initUserAuthLinkAccountView, initUserAuthOauth2} from './features/user-auth.js';
|
import {initUserAuthLinkAccountView, initUserAuthOauth2} from './features/user-auth.js';
|
||||||
import {
|
import {
|
||||||
initRepoDiffConversationForm,
|
initRepoDiffConversationForm,
|
||||||
initRepoDiffFileViewToggle,
|
initRepoDiffFileViewToggle,
|
||||||
initRepoDiffReviewButton,
|
initRepoDiffReviewButton, initRepoDiffShowMore,
|
||||||
} from './features/repo-diff.js';
|
} from './features/repo-diff.js';
|
||||||
import {
|
import {
|
||||||
initRepoIssueDue,
|
initRepoIssueDue,
|
||||||
|
@ -38,7 +36,7 @@ import {
|
||||||
initRepoPullRequestMergeInstruction,
|
initRepoPullRequestMergeInstruction,
|
||||||
initRepoPullRequestReview,
|
initRepoPullRequestReview,
|
||||||
} from './features/repo-issue.js';
|
} from './features/repo-issue.js';
|
||||||
import {initRepoCommitButton} from './features/repo-commit.js';
|
import {initRepoCommitButton, initRepoCommitLastCommitLoader} from './features/repo-commit.js';
|
||||||
import {
|
import {
|
||||||
initFootLanguageMenu,
|
initFootLanguageMenu,
|
||||||
initGlobalButtonClickOnEnter,
|
initGlobalButtonClickOnEnter,
|
||||||
|
@ -68,9 +66,9 @@ import {initOrgTeamSearchRepoBox, initOrgTeamSettings} from './features/org-team
|
||||||
import {initUserAuthU2fAuth, initUserAuthU2fRegister} from './features/user-auth-u2f.js';
|
import {initUserAuthU2fAuth, initUserAuthU2fRegister} from './features/user-auth-u2f.js';
|
||||||
import {initRepoRelease, initRepoReleaseEditor} from './features/repo-release.js';
|
import {initRepoRelease, initRepoReleaseEditor} from './features/repo-release.js';
|
||||||
import {initRepoEditor} from './features/repo-editor.js';
|
import {initRepoEditor} from './features/repo-editor.js';
|
||||||
import {initSearchUserBox} from './features/comp/SearchUserBox.js';
|
import {initCompSearchUserBox} from './features/comp/SearchUserBox.js';
|
||||||
import {initInstall} from './features/install.js';
|
import {initInstall} from './features/install.js';
|
||||||
import {initWebHookEditor} from './features/comp/WebHookEditor.js';
|
import {initCompWebHookEditor} from './features/comp/WebHookEditor.js';
|
||||||
import {initCommonIssue} from './features/common-issue.js';
|
import {initCommonIssue} from './features/common-issue.js';
|
||||||
import {initRepoBranchButton} from './features/repo-branch.js';
|
import {initRepoBranchButton} from './features/repo-branch.js';
|
||||||
import {initCommonOrganization} from './features/common-organization.js';
|
import {initCommonOrganization} from './features/common-organization.js';
|
||||||
|
@ -82,85 +80,90 @@ $.fn.tab.settings.silent = true;
|
||||||
|
|
||||||
initVueEnv();
|
initVueEnv();
|
||||||
|
|
||||||
$(document).ready(async () => {
|
$(document).ready(() => {
|
||||||
initGlobalCommon();
|
initGlobalCommon();
|
||||||
initGlobalDropzone();
|
|
||||||
initGlobalLinkActions();
|
|
||||||
initGlobalButtons();
|
|
||||||
initRepoBranchButton();
|
|
||||||
|
|
||||||
initCommonIssue();
|
|
||||||
|
|
||||||
initSearchUserBox();
|
|
||||||
initRepoSettingSearchTeamBox();
|
|
||||||
initOrgTeamSearchRepoBox();
|
|
||||||
|
|
||||||
initGlobalButtonClickOnEnter();
|
initGlobalButtonClickOnEnter();
|
||||||
initMarkupAnchors();
|
initGlobalButtons();
|
||||||
initCommentContent();
|
initGlobalCopyToClipboardListener();
|
||||||
initRepoCommentForm();
|
initGlobalDropzone();
|
||||||
initInstall();
|
|
||||||
initRepoArchiveLinks();
|
|
||||||
initRepository();
|
|
||||||
initMigration();
|
|
||||||
initRepoWikiForm();
|
|
||||||
initRepoEditor();
|
|
||||||
initCommonOrganization();
|
|
||||||
initWebHookEditor();
|
|
||||||
initAdminCommon();
|
|
||||||
initRepoCodeView();
|
|
||||||
initRepoActivityTopAuthorsChart();
|
|
||||||
initDashboardRepoList();
|
|
||||||
initOrgTeamSettings();
|
|
||||||
initGlobalEnterQuickSubmit();
|
initGlobalEnterQuickSubmit();
|
||||||
|
initGlobalFormDirtyLeaveConfirm();
|
||||||
|
initGlobalLinkActions();
|
||||||
|
|
||||||
|
attachTribute(document.querySelectorAll('#content, .emoji-input'));
|
||||||
|
|
||||||
|
initCommonIssue();
|
||||||
|
initCommonOrganization();
|
||||||
|
|
||||||
|
initCompSearchUserBox();
|
||||||
|
initCompWebHookEditor();
|
||||||
|
|
||||||
|
initInstall();
|
||||||
|
|
||||||
initHeadNavbarContentToggle();
|
initHeadNavbarContentToggle();
|
||||||
initFootLanguageMenu();
|
initFootLanguageMenu();
|
||||||
|
|
||||||
|
initCommentContent();
|
||||||
|
initContextPopups();
|
||||||
|
initHeatmap();
|
||||||
|
initImageDiff();
|
||||||
|
initMarkupAnchors();
|
||||||
|
initMarkupContent();
|
||||||
|
initServiceWorker();
|
||||||
|
initSshKeyFormParser();
|
||||||
|
initStopwatch();
|
||||||
|
initTableSort();
|
||||||
|
|
||||||
|
initAdminCommon();
|
||||||
|
initAdminEmails();
|
||||||
|
initAdminUserListSearchForm();
|
||||||
|
|
||||||
|
initDashboardRepoList();
|
||||||
|
|
||||||
|
initNotificationCount();
|
||||||
|
initNotificationsTable();
|
||||||
|
|
||||||
|
initOrgTeamSearchRepoBox();
|
||||||
|
initOrgTeamSettings();
|
||||||
|
|
||||||
|
initRepoActivityTopAuthorsChart();
|
||||||
|
initRepoArchiveLinks();
|
||||||
|
initRepoBranchButton();
|
||||||
|
initRepoCodeView();
|
||||||
|
initRepoCommentForm();
|
||||||
|
initRepoCommitButton();
|
||||||
|
initRepoCommitLastCommitLoader();
|
||||||
|
initRepoDiffConversationForm();
|
||||||
|
initRepoDiffFileViewToggle();
|
||||||
|
initRepoDiffReviewButton();
|
||||||
|
initRepoDiffShowMore();
|
||||||
|
initRepoEditor();
|
||||||
|
initRepoGraphGit();
|
||||||
|
initRepoIssueContentHistory();
|
||||||
|
initRepoIssueDue();
|
||||||
|
initRepoIssueList();
|
||||||
|
initRepoIssueReferenceRepositorySearch();
|
||||||
|
initRepoIssueTimeTracking();
|
||||||
|
initRepoIssueWipTitle();
|
||||||
|
initRepoMigration();
|
||||||
|
initRepoMigrationStatusChecker();
|
||||||
|
initRepoProject();
|
||||||
|
initRepoPullRequestMergeInstruction();
|
||||||
|
initRepoPullRequestReview();
|
||||||
|
initRepoRelease();
|
||||||
|
initRepoReleaseEditor();
|
||||||
|
initRepoSettingGitHook();
|
||||||
|
initRepoSettingSearchTeamBox();
|
||||||
|
initRepoSettingsCollaboration();
|
||||||
|
initRepoTemplateSearch();
|
||||||
initRepoTopicBar();
|
initRepoTopicBar();
|
||||||
|
initRepoWikiForm();
|
||||||
|
initRepository();
|
||||||
|
|
||||||
|
initUserAuthLinkAccountView();
|
||||||
|
initUserAuthOauth2();
|
||||||
initUserAuthU2fAuth();
|
initUserAuthU2fAuth();
|
||||||
initUserAuthU2fRegister();
|
initUserAuthU2fRegister();
|
||||||
initRepoIssueList();
|
|
||||||
initRepoIssueTimeTracking();
|
|
||||||
initRepoIssueDue();
|
|
||||||
initRepoIssueWipTitle();
|
|
||||||
initRepoPullRequestReview();
|
|
||||||
initRepoMigrationStatusChecker();
|
|
||||||
initRepoTemplateSearch();
|
|
||||||
initRepoIssueReferenceRepositorySearch();
|
|
||||||
initContextPopups();
|
|
||||||
initTableSort();
|
|
||||||
initNotificationsTable();
|
|
||||||
initLastCommitLoader();
|
|
||||||
initRepoPullRequestMergeInstruction();
|
|
||||||
initRepoDiffFileViewToggle();
|
|
||||||
initRepoReleaseEditor();
|
|
||||||
initRepoRelease();
|
|
||||||
initDiffShowMore();
|
|
||||||
initIssueContentHistory();
|
|
||||||
initAdminUserListSearchForm();
|
|
||||||
initGlobalCopyToClipboardListener();
|
|
||||||
initUserAuthOauth2();
|
|
||||||
initRepoDiffReviewButton();
|
|
||||||
initRepoCommitButton();
|
|
||||||
initAdminEmails();
|
|
||||||
initGlobalEnterQuickSubmit();
|
|
||||||
initSshKeyFormParser();
|
|
||||||
initGlobalFormDirtyLeaveConfirm();
|
|
||||||
initUserSettings();
|
initUserSettings();
|
||||||
initRepoSettingsCollaboration();
|
|
||||||
initUserAuthLinkAccountView();
|
|
||||||
initRepoDiffConversationForm();
|
|
||||||
|
|
||||||
// parallel init of async loaded features
|
|
||||||
await Promise.all([
|
|
||||||
attachTribute(document.querySelectorAll('#content, .emoji-input')),
|
|
||||||
initGitGraph(),
|
|
||||||
initHeatmap(),
|
|
||||||
initProject(),
|
|
||||||
initServiceWorker(),
|
|
||||||
initNotificationCount(),
|
|
||||||
initStopwatch(),
|
|
||||||
initMarkupContent(),
|
|
||||||
initRepoSettingGitHook(),
|
|
||||||
initImageDiff(),
|
|
||||||
]);
|
|
||||||
});
|
});
|
||||||
|
|
|
@ -2,8 +2,8 @@ import {renderMermaid} from './mermaid.js';
|
||||||
import {initMarkupTasklist} from './tasklist.js';
|
import {initMarkupTasklist} from './tasklist.js';
|
||||||
|
|
||||||
// code that runs for all markup content
|
// code that runs for all markup content
|
||||||
export async function initMarkupContent() {
|
export function initMarkupContent() {
|
||||||
await renderMermaid(document.querySelectorAll('code.language-mermaid'));
|
const _promise = renderMermaid(document.querySelectorAll('code.language-mermaid'));
|
||||||
}
|
}
|
||||||
|
|
||||||
// code that only runs for comments
|
// code that only runs for comments
|
||||||
|
|
Loading…
Reference in a new issue