1
- import Vue from 'vue' ;
1
+ import { createApp , nextTick } from 'vue' ;
2
2
import $ from 'jquery' ;
3
3
import { initVueSvg , vueDelimiters } from './VueComponentLoader.js' ;
4
4
import { initTooltip } from '../modules/tippy.js' ;
5
5
6
6
const { appSubUrl, assetUrlPrefix, pageData} = window . config ;
7
7
8
- function initVueComponents ( ) {
9
- Vue . component ( 'repo-search' , {
8
+ function initVueComponents ( app ) {
9
+ app . component ( 'repo-search' , {
10
10
delimiters : vueDelimiters ,
11
11
props : {
12
12
searchLimit : {
@@ -138,13 +138,14 @@ function initVueComponents() {
138
138
} ,
139
139
140
140
mounted ( ) {
141
+ const el = document . getElementById ( 'dashboard-repo-list' ) ;
141
142
this . changeReposFilter ( this . reposFilter ) ;
142
- for ( const el of this . $ el. querySelectorAll ( '.tooltip' ) ) {
143
- initTooltip ( el ) ;
143
+ for ( const elTooltip of el . querySelectorAll ( '.tooltip' ) ) {
144
+ initTooltip ( elTooltip ) ;
144
145
}
145
- $ ( this . $ el) . find ( '.dropdown' ) . dropdown ( ) ;
146
+ $ ( el ) . find ( '.dropdown' ) . dropdown ( ) ;
146
147
this . setCheckboxes ( ) ;
147
- Vue . nextTick ( ( ) => {
148
+ nextTick ( ( ) => {
148
149
this . $refs . search . focus ( ) ;
149
150
} ) ;
150
151
} ,
@@ -192,7 +193,7 @@ function initVueComponents() {
192
193
this . reposFilter = filter ;
193
194
this . repos = [ ] ;
194
195
this . page = 1 ;
195
- Vue . set ( this . counts , `${ filter } :${ this . archivedFilter } :${ this . privateFilter } ` , 0 ) ;
196
+ this . counts [ `${ filter } :${ this . archivedFilter } :${ this . privateFilter } ` ] = 0 ;
196
197
this . searchRepos ( ) ;
197
198
} ,
198
199
@@ -261,7 +262,7 @@ function initVueComponents() {
261
262
this . page = 1 ;
262
263
this . repos = [ ] ;
263
264
this . setCheckboxes ( ) ;
264
- Vue . set ( this . counts , `${ this . reposFilter } :${ this . archivedFilter } :${ this . privateFilter } ` , 0 ) ;
265
+ this . counts [ `${ this . reposFilter } :${ this . archivedFilter } :${ this . privateFilter } ` ] = 0 ;
265
266
this . searchRepos ( ) ;
266
267
} ,
267
268
@@ -283,7 +284,7 @@ function initVueComponents() {
283
284
this . page = 1 ;
284
285
this . repos = [ ] ;
285
286
this . setCheckboxes ( ) ;
286
- Vue . set ( this . counts , `${ this . reposFilter } :${ this . archivedFilter } :${ this . privateFilter } ` , 0 ) ;
287
+ this . counts [ `${ this . reposFilter } :${ this . archivedFilter } :${ this . privateFilter } ` ] = 0 ;
287
288
this . searchRepos ( ) ;
288
289
} ,
289
290
@@ -297,7 +298,7 @@ function initVueComponents() {
297
298
this . page = 1 ;
298
299
}
299
300
this . repos = [ ] ;
300
- Vue . set ( this . counts , `${ this . reposFilter } :${ this . archivedFilter } :${ this . privateFilter } ` , 0 ) ;
301
+ this . counts [ `${ this . reposFilter } :${ this . archivedFilter } :${ this . privateFilter } ` ] = 0 ;
301
302
this . searchRepos ( ) ;
302
303
} ,
303
304
@@ -331,7 +332,7 @@ function initVueComponents() {
331
332
if ( searchedQuery === '' && searchedMode === '' && this . archivedFilter === 'both' ) {
332
333
this . reposTotalCount = count ;
333
334
}
334
- Vue . set ( this . counts , `${ this . reposFilter } :${ this . archivedFilter } :${ this . privateFilter } ` , count ) ;
335
+ this . counts [ `${ this . reposFilter } :${ this . archivedFilter } :${ this . privateFilter } ` ] = count ;
335
336
this . finalPage = Math . ceil ( count / this . searchLimit ) ;
336
337
this . updateHistory ( ) ;
337
338
this . isLoading = false ;
@@ -352,27 +353,28 @@ function initVueComponents() {
352
353
}
353
354
return 'octicon-repo' ;
354
355
}
355
- }
356
+ } ,
357
+
358
+ template : document . getElementById ( 'dashboard-repo-list-template' ) ,
356
359
} ) ;
357
360
}
358
361
359
-
360
362
export function initDashboardRepoList ( ) {
361
363
const el = document . getElementById ( 'dashboard-repo-list' ) ;
362
364
const dashboardRepoListData = pageData . dashboardRepoList || null ;
363
365
if ( ! el || ! dashboardRepoListData ) return ;
364
366
365
- initVueSvg ( ) ;
366
- initVueComponents ( ) ;
367
- new Vue ( {
368
- el,
367
+ const app = createApp ( {
369
368
delimiters : vueDelimiters ,
370
- data : ( ) => {
369
+ data ( ) {
371
370
return {
372
371
searchLimit : dashboardRepoListData . searchLimit || 0 ,
373
372
subUrl : appSubUrl ,
374
373
uid : dashboardRepoListData . uid || 0 ,
375
374
} ;
376
375
} ,
377
376
} ) ;
377
+ initVueSvg ( app ) ;
378
+ initVueComponents ( app ) ;
379
+ app . mount ( el ) ;
378
380
}
0 commit comments