File tree 4 files changed +28
-21
lines changed
4 files changed +28
-21
lines changed Original file line number Diff line number Diff line change 77
77
<p class="activity meta">
78
78
<i>{{ctx.Locale.Tr "settings.access_token_desc" (HTMLFormat `href="%s/api/swagger" target="_blank"` AppSubUrl) (`href="https://docs.gitea.com/development/oauth2-provider#scopes" target="_blank"`|SafeHTML)}}</i>
79
79
</p>
80
- <div class ="scoped-access-token-mount">
81
- <scoped-access-token-selector
82
- :is-admin ="{{if .IsAdmin}}true{{else}}false{{end }}"
83
- no-access -label="{{ctx.Locale.Tr "settings.permission_no_access "}}"
84
- read- label="{{ctx.Locale.Tr "settings.permission_read "}}"
85
- write-label ="{{ctx.Locale.Tr "settings.permission_write "}}"
86
- ></scoped-access-token-selector >
80
+ <div id ="scoped-access-token-selector"
81
+ data-is-admin="{{if .IsAdmin}}true{{else}}false{{end}}"
82
+ data-no-access-label ="{{ctx.Locale.Tr "settings.permission_no_access" }}"
83
+ data-read -label="{{ctx.Locale.Tr "settings.permission_read "}}"
84
+ data-write- label="{{ctx.Locale.Tr "settings.permission_write "}}"
85
+ data-locale-component-failed-to-load ="{{ctx.Locale.Tr "graphs.component_failed_to_load "}}"
86
+ >
87
87
</div>
88
88
</details>
89
89
<button id="scoped-access-submit" class="ui primary button">
Original file line number Diff line number Diff line change 1
1
<script lang="ts">
2
- import {createApp } from ' vue' ;
3
2
import {hideElem , showElem } from ' ../utils/dom.ts' ;
4
3
5
4
const sfc = {
@@ -73,18 +72,6 @@ const sfc = {
73
72
};
74
73
75
74
export default sfc ;
76
-
77
- /**
78
- * Initialize category toggle sections
79
- */
80
- export function initScopedAccessTokenCategories() {
81
- for (const el of document .querySelectorAll (' .scoped-access-token-mount' )) {
82
- createApp ({})
83
- .component (' scoped-access-token-selector' , sfc )
84
- .mount (el );
85
- }
86
- }
87
-
88
75
</script >
89
76
<template >
90
77
<div v-for =" category in categories" :key =" category" class =" field tw-pl-1 tw-pb-1 access-token-category" >
Original file line number Diff line number Diff line change
1
+ import { createApp } from 'vue' ;
2
+
3
+ export async function initScopedAccessTokenCategories ( ) {
4
+ const el = document . querySelector ( '#scoped-access-token-selector' ) ;
5
+ if ( ! el ) return ;
6
+
7
+ const { default : ScopedAccessTokenSelector } = await import ( /* webpackChunkName: "scoped-access-token-selector" */ '../components/ScopedAccessTokenSelector.vue' ) ;
8
+ try {
9
+ const View = createApp ( ScopedAccessTokenSelector , {
10
+ isAdmin : JSON . parse ( el . getAttribute ( 'data-is-admin' ) ) ,
11
+ noAccessLabel : el . getAttribute ( 'data-no-access-label' ) ,
12
+ readLabel : el . getAttribute ( 'data-read-label' ) ,
13
+ writeLabel : el . getAttribute ( 'data-write-label' ) ,
14
+ } ) ;
15
+ View . mount ( el ) ;
16
+ } catch ( err ) {
17
+ console . error ( 'ScopedAccessTokenSelector failed to load' , err ) ;
18
+ el . textContent = el . getAttribute ( 'data-locale-component-failed-to-load' ) ;
19
+ }
20
+ }
Original file line number Diff line number Diff line change @@ -3,7 +3,6 @@ import './bootstrap.ts';
3
3
import './htmx.ts' ;
4
4
5
5
import { initRepoActivityTopAuthorsChart } from './components/RepoActivityTopAuthors.vue' ;
6
- import { initScopedAccessTokenCategories } from './components/ScopedAccessTokenSelector.vue' ;
7
6
import { initDashboardRepoList } from './components/DashboardRepoList.vue' ;
8
7
9
8
import { initGlobalCopyToClipboardListener } from './features/clipboard.ts' ;
@@ -80,6 +79,7 @@ import {initColorPickers} from './features/colorpicker.ts';
80
79
import { initAdminSelfCheck } from './features/admin/selfcheck.ts' ;
81
80
import { initOAuth2SettingsDisableCheckbox } from './features/oauth2-settings.ts' ;
82
81
import { initGlobalFetchAction } from './features/common-fetch-action.ts' ;
82
+ import { initScopedAccessTokenCategories } from './features/scoped-access-token.ts' ;
83
83
import {
84
84
initFootLanguageMenu ,
85
85
initGlobalDropdown ,
You can’t perform that action at this time.
0 commit comments