1
- import $ from 'jquery' ;
2
1
import { hideElem , showElem } from '../utils/dom.js' ;
3
2
import { GET , POST } from '../modules/fetch.js' ;
4
3
5
4
const { appSubUrl} = window . config ;
6
5
7
6
export function initRepoMigrationStatusChecker ( ) {
8
- const $ repoMigrating = $ ( '# repo_migrating') ;
9
- if ( ! $ repoMigrating. length ) return ;
7
+ const repoMigrating = document . getElementById ( ' repo_migrating') ;
8
+ if ( ! repoMigrating ) return ;
10
9
11
- $ ( '# repo_migrating_retry') . on ( 'click' , doMigrationRetry ) ;
10
+ document . getElementById ( ' repo_migrating_retry') . addEventListener ( 'click' , doMigrationRetry ) ;
12
11
13
- const task = $ repoMigrating. attr ( 'data-migrating-task-id' ) ;
12
+ const task = repoMigrating . getAttribute ( 'data-migrating-task-id' ) ;
14
13
15
- // returns true if the refresh still need to be called after a while
14
+ // returns true if the refresh still needs to be called after a while
16
15
const refresh = async ( ) => {
17
16
const res = await GET ( `${ appSubUrl } /user/task/${ task } ` ) ;
18
17
if ( res . status !== 200 ) return true ; // continue to refresh if network error occurs
@@ -21,7 +20,7 @@ export function initRepoMigrationStatusChecker() {
21
20
22
21
// for all status
23
22
if ( data . message ) {
24
- $ ( '# repo_migrating_progress_message') . text ( data . message ) ;
23
+ document . getElementById ( ' repo_migrating_progress_message') . textContent = data . message ;
25
24
}
26
25
27
26
// TaskStatusFinished
@@ -37,7 +36,7 @@ export function initRepoMigrationStatusChecker() {
37
36
showElem ( '#repo_migrating_retry' ) ;
38
37
showElem ( '#repo_migrating_failed' ) ;
39
38
showElem ( '#repo_migrating_failed_image' ) ;
40
- $ ( '# repo_migrating_failed_error') . text ( data . message ) ;
39
+ document . getElementById ( ' repo_migrating_failed_error') . textContent = data . message ;
41
40
return false ;
42
41
}
43
42
@@ -59,6 +58,6 @@ export function initRepoMigrationStatusChecker() {
59
58
}
60
59
61
60
async function doMigrationRetry ( e ) {
62
- await POST ( $ ( e . target ) . attr ( 'data-migrating-task-retry-url' ) ) ;
61
+ await POST ( e . target . getAttribute ( 'data-migrating-task-retry-url' ) ) ;
63
62
window . location . reload ( ) ;
64
63
}
0 commit comments