Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove jQuery from repo migrate page #29219

Merged
merged 3 commits into from
Feb 17, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions web_src/js/features/repo-migrate.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
import $ from 'jquery';
import {hideElem, showElem} from '../utils/dom.js';
import {GET, POST} from '../modules/fetch.js';

const {appSubUrl} = window.config;

export function initRepoMigrationStatusChecker() {
const $repoMigrating = $('#repo_migrating');
if (!$repoMigrating.length) return;
const repoMigrating = document.getElementById('repo_migrating');
if (!repoMigrating) return;

$('#repo_migrating_retry').on('click', doMigrationRetry);
document.getElementById('repo_migrating_retry').addEventListener('click', doMigrationRetry);

const task = $repoMigrating.attr('data-migrating-task-id');
const task = repoMigrating.getAttribute('data-migrating-task-id');

// returns true if the refresh still need to be called after a while
// returns true if the refresh still needs to be called after a while
const refresh = async () => {
const res = await GET(`${appSubUrl}/user/task/${task}`);
if (res.status !== 200) return true; // continue to refresh if network error occurs
Expand All @@ -21,7 +20,7 @@ export function initRepoMigrationStatusChecker() {

// for all status
if (data.message) {
$('#repo_migrating_progress_message').text(data.message);
document.getElementById('repo_migrating_progress_message').textContent = data.message;
}

// TaskStatusFinished
Expand All @@ -37,7 +36,7 @@ export function initRepoMigrationStatusChecker() {
showElem('#repo_migrating_retry');
showElem('#repo_migrating_failed');
showElem('#repo_migrating_failed_image');
$('#repo_migrating_failed_error').text(data.message);
document.getElementById('repo_migrating_failed_error').textContent = data.message;
return false;
}

Expand All @@ -59,6 +58,7 @@ export function initRepoMigrationStatusChecker() {
}

async function doMigrationRetry(e) {
await POST($(e.target).attr('data-migrating-task-retry-url'));
const retryUrl = e.target.getAttribute('data-migrating-task-retry-url');
await POST(retryUrl);
window.location.reload();
yardenshoham marked this conversation as resolved.
Show resolved Hide resolved
}
Loading