File tree Expand file tree Collapse file tree 4 files changed +28
-21
lines changed
Expand file tree Collapse file tree 4 files changed +28
-21
lines changed Original file line number Diff line number Diff line change 7777 <p class="activity meta">
7878 <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>
7979 </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+ >
8787 </div>
8888 </details>
8989 <button id="scoped-access-submit" class="ui primary button">
Original file line number Diff line number Diff line change 11<script >
2- import {createApp } from ' vue' ;
32import {hideElem , showElem } from ' ../utils/dom.js' ;
43
54const sfc = {
@@ -73,18 +72,6 @@ const sfc = {
7372};
7473
7574export default sfc ;
76-
77- /**
78- * Initialize category toggle sections
79- */
80- export function initScopedAccessTokenCategories () {
81- for (const el of document .getElementsByClassName (' scoped-access-token-mount' )) {
82- createApp ({})
83- .component (' scoped-access-token-selector' , sfc)
84- .mount (el);
85- }
86- }
87-
8875 </script >
8976<template >
9077 <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 22import './bootstrap.js' ;
33
44import { initRepoActivityTopAuthorsChart } from './components/RepoActivityTopAuthors.vue' ;
5- import { initScopedAccessTokenCategories } from './components/ScopedAccessTokenSelector.vue' ;
65import { initDashboardRepoList } from './components/DashboardRepoList.vue' ;
76
87import { initGlobalCopyToClipboardListener } from './features/clipboard.js' ;
@@ -88,6 +87,7 @@ import {initDirAuto} from './modules/dirauto.js';
8887import { initRepositorySearch } from './features/repo-search.js' ;
8988import { initColorPickers } from './features/colorpicker.js' ;
9089import { initAdminSelfCheck } from './features/admin/selfcheck.js' ;
90+ import { initScopedAccessTokenCategories } from './features/scoped-access-token.js' ;
9191
9292// Init Gitea's Fomantic settings
9393initGiteaFomantic ( ) ;
You can’t perform that action at this time.
0 commit comments