Merge pull request #517 from YunoHost/tool-vite

Switch from vue-cli to vite
This commit is contained in:
Alexandre Aubin 2023-04-04 13:21:48 +02:00 committed by GitHub
commit c2cba173b8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
31 changed files with 464 additions and 7391 deletions

View file

@ -1,6 +1,7 @@
module.exports = { module.exports = {
root: true, root: true,
env: { env: {
es2021: true,
node: true node: true
}, },
extends: [ extends: [
@ -8,9 +9,6 @@ module.exports = {
'eslint:recommended', 'eslint:recommended',
'standard' 'standard'
], ],
parserOptions: {
parser: '@babel/eslint-parser'
},
rules: { rules: {
'vue/max-attributes-per-line': [ 'vue/max-attributes-per-line': [
'error', 'error',

View file

@ -1,5 +0,0 @@
module.exports = {
presets: [
'@vue/cli-plugin-babel/preset'
]
}

View file

@ -6,14 +6,14 @@
<meta name="viewport" content="width=device-width,initial-scale=1.0"> <meta name="viewport" content="width=device-width,initial-scale=1.0">
<meta name="format-detection" content="telephone=no" /> <meta name="format-detection" content="telephone=no" />
<meta name="robots" content="noindex, nofollow"> <meta name="robots" content="noindex, nofollow">
<link rel="icon" href="<%= BASE_URL %>favicon.png"> <link rel="icon" href="/favicon.png">
<title>YunoHost Admin</title> <title>YunoHost Admin</title>
</head> </head>
<body> <body>
<noscript> <noscript>
<strong>We're sorry but <%= htmlWebpackPlugin.options.title %> doesn't work properly without JavaScript enabled. Please enable it to continue.</strong> <strong>We're sorry but YunoHost Admin doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
</noscript> </noscript>
<div id="app"></div> <div id="app"></div>
<!-- built files will be auto injected --> <script type="module" src="/src/main.js"></script>
</body> </body>
</html> </html>

7474
app/package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -5,17 +5,15 @@
"description": "YunoHost Admin web interface", "description": "YunoHost Admin web interface",
"author": "Yunohost", "author": "Yunohost",
"scripts": { "scripts": {
"serve": "./node_modules/@vue/cli-service/bin/vue-cli-service.js serve", "dev": "vite",
"build": "./node_modules/@vue/cli-service/bin/vue-cli-service.js build", "build": "vite build",
"lint": "./node_modules/@vue/cli-service/bin/vue-cli-service.js lint --no-fix", "lint": "eslint --ext .js,.vue src",
"i18n": "./node_modules/@vue/cli-service/bin/vue-cli-service.js i18n:report --src './src/**/*.?(js|vue)' --locales './src/i18n/locales/*.json'", "lint-fix": "lint --fix"
"i18n:en": "./node_modules/@vue/cli-service/bin/vue-cli-service.js i18n:report --src './src/**/*.?(js|vue)' --locales './src/i18n/locales/en.json'"
}, },
"dependencies": { "dependencies": {
"@fontsource/fira-code": "^4.5.13", "@fontsource/fira-code": "^4.5.13",
"@fontsource/firago": "^4.5.3", "@fontsource/firago": "^4.5.3",
"bootstrap-vue": "^2.22.0", "bootstrap-vue": "^2.22.0",
"core-js": "^3.29.1",
"date-fns": "^2.29.3", "date-fns": "^2.29.3",
"fork-awesome": "^1.2.0", "fork-awesome": "^1.2.0",
"simple-evaluate": "^1.4.6", "simple-evaluate": "^1.4.6",
@ -27,23 +25,15 @@
"vuex": "^3.6.2" "vuex": "^3.6.2"
}, },
"devDependencies": { "devDependencies": {
"@babel/eslint-parser": "^7.21.3", "@vitejs/plugin-vue2": "^2.2.0",
"@vue/cli-plugin-babel": "^5.0.8",
"@vue/cli-plugin-eslint": "^5.0.8",
"@vue/cli-plugin-router": "^5.0.8",
"@vue/cli-plugin-vuex": "^5.0.8",
"@vue/cli-service": "^5.0.8",
"bootstrap": "^4.6.0", "bootstrap": "^4.6.0",
"eslint": "^8.36.0", "eslint": "^8.36.0",
"eslint-plugin-vue": "^9.10.0", "eslint-plugin-vue": "^9.10.0",
"popper.js": "^1.16.0", "popper.js": "^1.16.0",
"portal-vue": "^2.1.7", "portal-vue": "^2.1.7",
"sass": "^1.60.0", "sass": "^1.60.0",
"sass-loader": "^13.2.1",
"sass-resources-loader": "^2.2.5",
"standard": "^17.0.0", "standard": "^17.0.0",
"vue-cli-plugin-bootstrap-vue": "^0.8.2", "vite": "^4.2.1"
"vue-cli-plugin-i18n": "^2.3.1"
}, },
"browserslist": [ "browserslist": [
"> 1%", "> 1%",

View file

@ -78,10 +78,7 @@ export async function handleError (request, response, errorData) {
* @param {APIError} error * @param {APIError} error
*/ */
export function onUnhandledAPIError (error) { export function onUnhandledAPIError (error) {
// In 'development', Babel seems to also catch the error so there's no need to log it twice. error.log()
if (process.env.NODE_ENV !== 'development') {
error.log()
}
store.dispatch('HANDLE_ERROR', error) store.dispatch('HANDLE_ERROR', error)
} }

View file

@ -1,3 +1,12 @@
// helper module to expose custom and vuelidate validators. // helper module to expose custom and vuelidate validators.
export * from './customValidators' export * from './customValidators'
export * from 'vuelidate/lib/validators' export {
between,
helpers,
integer,
maxValue,
minLength,
minValue,
required,
sameAs
} from 'vuelidate/lib/validators'

View file

@ -49,9 +49,7 @@ function loadLocaleMessages (locale) {
if (loadedLanguages.includes(locale)) { if (loadedLanguages.includes(locale)) {
return Promise.resolve(locale) return Promise.resolve(locale)
} }
return import( return import(`@/i18n/locales/${locale}.json`).then(messages => {
/* webpackChunkName: "lc/lang-[request]" */ `@/i18n/locales/${locale}`
).then(messages => {
i18n.setLocaleMessage(locale, messages.default) i18n.setLocaleMessage(locale, messages.default)
loadedLanguages.push(locale) loadedLanguages.push(locale)
return locale return locale
@ -63,12 +61,9 @@ function loadLocaleMessages (locale) {
*/ */
async function loadDateFnsLocale (locale) { async function loadDateFnsLocale (locale) {
const dateFnsLocaleName = supportedLocales[locale].dateFnsLocale || locale const dateFnsLocaleName = supportedLocales[locale].dateFnsLocale || locale
return import( dateFnsLocale = (await import(
/* webpackChunkName: "lc/datefns-[request]" */ `../../node_modules/date-fns/esm/locale/${dateFnsLocaleName}/index.js`
`date-fns/locale/${dateFnsLocaleName}/index.js` )).default
).then(locale => {
dateFnsLocale = locale.default
})
} }
/** /**

View file

@ -54,12 +54,12 @@ Vue.prototype.$askMdConfirmation = function (markdown, props, ok = false) {
} }
// Register global components // Register global components
const requireComponent = require.context('@/components/globals', true, /\.(js|vue)$/i) const globalComponentsModules = import.meta.glob([
// For each matching file name... '@/components/globals/*.vue',
requireComponent.keys().forEach((fileName) => { '@/components/globals/*/*.vue'
// Get the component ], { eager: true })
const component = requireComponent(fileName).default Object.values(globalComponentsModules).forEach((module) => {
// Globally register the component const component = module.default
Vue.component(component.name, component) Vue.component(component.name, component)
}) })

View file

@ -7,7 +7,7 @@ Vue.use(VueRouter)
const router = new VueRouter({ const router = new VueRouter({
// mode: 'history', // this allow all routes to be real ones (without '#') // mode: 'history', // this allow all routes to be real ones (without '#')
base: process.env.BASE_URL, base: import.meta.env.BASE_URL,
routes, routes,
scrollBehavior (to, from, savedPosition) { scrollBehavior (to, from, savedPosition) {

View file

@ -6,11 +6,11 @@
// Simple views are normally imported and will be included into the main webpack entry. // Simple views are normally imported and will be included into the main webpack entry.
// Others will be chunked by webpack so they can be lazy loaded. // Others will be chunked by webpack so they can be lazy loaded.
// Webpack chunk syntax is: // Webpack chunk syntax is:
// `() => import(/* webpackChunkName: "views/:nameOfWantedFile" */ '@/views/:ViewComponent')` // `() => import('@/views/:ViewComponent.vue')`
import Home from '@/views/Home' import Home from '@/views/Home.vue'
import Login from '@/views/Login' import Login from '@/views/Login.vue'
import ToolList from '@/views/tool/ToolList' import ToolList from '@/views/tool/ToolList.vue'
const routes = [ const routes = [
{ {
@ -38,7 +38,7 @@ const routes = [
{ {
name: 'post-install', name: 'post-install',
path: '/postinstall', path: '/postinstall',
component: () => import(/* webpackChunkName: "views/post-install" */ '@/views/PostInstall'), component: () => import('@/views/PostInstall.vue'),
meta: { meta: {
noAuth: true, noAuth: true,
args: { trad: 'postinstall.title' } args: { trad: 'postinstall.title' }
@ -51,7 +51,7 @@ const routes = [
{ {
name: 'user-list', name: 'user-list',
path: '/users', path: '/users',
component: () => import(/* webpackChunkName: "views/user/list" */ '@/views/user/UserList'), component: () => import('@/views/user/UserList.vue'),
meta: { meta: {
args: { trad: 'users' }, args: { trad: 'users' },
breadcrumb: ['user-list'] breadcrumb: ['user-list']
@ -60,7 +60,7 @@ const routes = [
{ {
name: 'user-create', name: 'user-create',
path: '/users/create', path: '/users/create',
component: () => import(/* webpackChunkName: "views/user/create" */ '@/views/user/UserCreate'), component: () => import('@/views/user/UserCreate.vue'),
meta: { meta: {
args: { trad: 'users_new' }, args: { trad: 'users_new' },
breadcrumb: ['user-list', 'user-create'] breadcrumb: ['user-list', 'user-create']
@ -69,7 +69,7 @@ const routes = [
{ {
name: 'user-import', name: 'user-import',
path: '/users/import', path: '/users/import',
component: () => import(/* webpackChunkName: "views/user/import" */ '@/views/user/UserImport'), component: () => import('@/views/user/UserImport.vue'),
props: true, props: true,
meta: { meta: {
args: { trad: 'users_import' }, args: { trad: 'users_import' },
@ -79,7 +79,7 @@ const routes = [
{ {
name: 'user-info', name: 'user-info',
path: '/users/:name', path: '/users/:name',
component: () => import(/* webpackChunkName: "views/user/info" */ '@/views/user/UserInfo'), component: () => import('@/views/user/UserInfo.vue'),
props: true, props: true,
meta: { meta: {
args: { param: 'name' }, args: { param: 'name' },
@ -89,7 +89,7 @@ const routes = [
{ {
name: 'user-edit', name: 'user-edit',
path: '/users/:name/edit', path: '/users/:name/edit',
component: () => import(/* webpackChunkName: "views/user/edit" */ '@/views/user/UserEdit'), component: () => import('@/views/user/UserEdit.vue'),
props: true, props: true,
meta: { meta: {
args: { param: 'name', trad: 'user_username_edit' }, args: { param: 'name', trad: 'user_username_edit' },
@ -103,7 +103,7 @@ const routes = [
{ {
name: 'group-list', name: 'group-list',
path: '/groups', path: '/groups',
component: () => import(/* webpackChunkName: "views/group/list" */ '@/views/group/GroupList'), component: () => import('@/views/group/GroupList.vue'),
meta: { meta: {
args: { trad: 'groups_and_permissions' }, args: { trad: 'groups_and_permissions' },
breadcrumb: ['user-list', 'group-list'] breadcrumb: ['user-list', 'group-list']
@ -112,7 +112,7 @@ const routes = [
{ {
name: 'group-create', name: 'group-create',
path: '/groups/create', path: '/groups/create',
component: () => import(/* webpackChunkName: "views/group/create" */ '@/views/group/GroupCreate'), component: () => import('@/views/group/GroupCreate.vue'),
meta: { meta: {
args: { trad: 'group_new' }, args: { trad: 'group_new' },
breadcrumb: ['user-list', 'group-list', 'group-create'] breadcrumb: ['user-list', 'group-list', 'group-create']
@ -125,7 +125,7 @@ const routes = [
{ {
name: 'domain-list', name: 'domain-list',
path: '/domains', path: '/domains',
component: () => import(/* webpackChunkName: "views/domain/list" */ '@/views/domain/DomainList'), component: () => import('@/views/domain/DomainList.vue'),
meta: { meta: {
args: { trad: 'domains' }, args: { trad: 'domains' },
breadcrumb: ['domain-list'] breadcrumb: ['domain-list']
@ -134,7 +134,7 @@ const routes = [
{ {
name: 'domain-add', name: 'domain-add',
path: '/domains/add', path: '/domains/add',
component: () => import(/* webpackChunkName: "views/domain/add" */ '@/views/domain/DomainAdd'), component: () => import('@/views/domain/DomainAdd.vue'),
meta: { meta: {
args: { trad: 'domain_add' }, args: { trad: 'domain_add' },
breadcrumb: ['domain-list', 'domain-add'] breadcrumb: ['domain-list', 'domain-add']
@ -142,13 +142,13 @@ const routes = [
}, },
{ {
path: '/domains/:name', path: '/domains/:name',
component: () => import(/* webpackChunkName: "views/domain/info" */ '@/views/domain/DomainInfo'), component: () => import('@/views/domain/DomainInfo.vue'),
props: true, props: true,
children: [ children: [
{ {
name: 'domain-info', name: 'domain-info',
path: ':tabId?', path: ':tabId?',
component: () => import(/* webpackChunkName: "components/configPanel" */ '@/components/ConfigPanel'), component: () => import('@/components/ConfigPanel.vue'),
props: true, props: true,
meta: { meta: {
routerParams: ['name'], // Override router key params to avoid view recreation at tab change. routerParams: ['name'], // Override router key params to avoid view recreation at tab change.
@ -165,7 +165,7 @@ const routes = [
{ {
name: 'app-list', name: 'app-list',
path: '/apps', path: '/apps',
component: () => import(/* webpackChunkName: "views/apps/list" */ '@/views/app/AppList'), component: () => import('@/views/app/AppList.vue'),
meta: { meta: {
args: { trad: 'applications' }, args: { trad: 'applications' },
breadcrumb: ['app-list'] breadcrumb: ['app-list']
@ -174,7 +174,7 @@ const routes = [
{ {
name: 'app-catalog', name: 'app-catalog',
path: '/apps/catalog', path: '/apps/catalog',
component: () => import(/* webpackChunkName: "views/apps/catalog" */ '@/views/app/AppCatalog'), component: () => import('@/views/app/AppCatalog.vue'),
props: route => route.query, props: route => route.query,
meta: { meta: {
args: { trad: 'catalog' }, args: { trad: 'catalog' },
@ -184,7 +184,7 @@ const routes = [
{ {
name: 'app-install', name: 'app-install',
path: '/apps/install/:id', path: '/apps/install/:id',
component: () => import(/* webpackChunkName: "views/apps/install" */ '@/views/app/AppInstall'), component: () => import('@/views/app/AppInstall.vue'),
props: true, props: true,
meta: { meta: {
args: { trad: 'install_name', param: 'id' }, args: { trad: 'install_name', param: 'id' },
@ -194,7 +194,7 @@ const routes = [
{ {
name: 'app-install-custom', name: 'app-install-custom',
path: '/apps/install-custom/:id', path: '/apps/install-custom/:id',
component: () => import(/* webpackChunkName: "views/apps/install" */ '@/views/app/AppInstall'), component: () => import('@/views/app/AppInstall.vue'),
props: true, props: true,
meta: { meta: {
args: { trad: 'install_name', param: 'id' }, args: { trad: 'install_name', param: 'id' },
@ -203,13 +203,13 @@ const routes = [
}, },
{ {
path: '/apps/:id', path: '/apps/:id',
component: () => import(/* webpackChunkName: "views/apps/info" */ '@/views/app/AppInfo'), component: () => import('@/views/app/AppInfo.vue'),
props: true, props: true,
children: [ children: [
{ {
name: 'app-info', name: 'app-info',
path: ':tabId?', path: ':tabId?',
component: () => import(/* webpackChunkName: "components/configPanel" */ '@/components/ConfigPanel'), component: () => import('@/components/ConfigPanel.vue'),
props: true, props: true,
meta: { meta: {
routerParams: ['id'], // Override router key params to avoid view recreation at tab change. routerParams: ['id'], // Override router key params to avoid view recreation at tab change.
@ -226,7 +226,7 @@ const routes = [
{ {
name: 'update', name: 'update',
path: '/update', path: '/update',
component: () => import(/* webpackChunkName: "views/update" */ '@/views/update/SystemUpdate'), component: () => import('@/views/update/SystemUpdate.vue'),
meta: { meta: {
args: { trad: 'system_update' }, args: { trad: 'system_update' },
breadcrumb: ['update'] breadcrumb: ['update']
@ -239,7 +239,7 @@ const routes = [
{ {
name: 'service-list', name: 'service-list',
path: '/services', path: '/services',
component: () => import(/* webpackChunkName: "views/service/list" */ '@/views/service/ServiceList'), component: () => import('@/views/service/ServiceList.vue'),
meta: { meta: {
args: { trad: 'services' }, args: { trad: 'services' },
breadcrumb: ['tool-list', 'service-list'] breadcrumb: ['tool-list', 'service-list']
@ -248,7 +248,7 @@ const routes = [
{ {
name: 'service-info', name: 'service-info',
path: '/services/:name', path: '/services/:name',
component: () => import(/* webpackChunkName: "views/service/info" */ '@/views/service/ServiceInfo'), component: () => import('@/views/service/ServiceInfo.vue'),
props: true, props: true,
meta: { meta: {
args: { param: 'name' }, args: { param: 'name' },
@ -271,7 +271,7 @@ const routes = [
{ {
name: 'tool-logs', name: 'tool-logs',
path: '/tools/logs', path: '/tools/logs',
component: () => import(/* webpackChunkName: "views/tools/logs" */ '@/views/tool/ToolLogs'), component: () => import('@/views/tool/ToolLogs.vue'),
meta: { meta: {
args: { trad: 'logs' }, args: { trad: 'logs' },
breadcrumb: ['tool-list', 'tool-logs'] breadcrumb: ['tool-list', 'tool-logs']
@ -280,7 +280,7 @@ const routes = [
{ {
name: 'tool-log', name: 'tool-log',
path: '/tools/logs/:name', path: '/tools/logs/:name',
component: () => import(/* webpackChunkName: "views/tools/log" */ '@/views/tool/ToolLog'), component: () => import('@/views/tool/ToolLog.vue'),
props: true, props: true,
meta: { meta: {
args: { param: 'name' }, args: { param: 'name' },
@ -290,7 +290,7 @@ const routes = [
{ {
name: 'tool-migrations', name: 'tool-migrations',
path: '/tools/migrations', path: '/tools/migrations',
component: () => import(/* webpackChunkName: "views/tools/migrations" */ '@/views/tool/ToolMigrations'), component: () => import('@/views/tool/ToolMigrations.vue'),
meta: { meta: {
args: { trad: 'migrations' }, args: { trad: 'migrations' },
breadcrumb: ['tool-list', 'tool-migrations'] breadcrumb: ['tool-list', 'tool-migrations']
@ -299,7 +299,7 @@ const routes = [
{ {
name: 'tool-firewall', name: 'tool-firewall',
path: '/tools/firewall', path: '/tools/firewall',
component: () => import(/* webpackChunkName: "views/tools/firewall" */ '@/views/tool/ToolFirewall'), component: () => import('@/views/tool/ToolFirewall.vue'),
meta: { meta: {
args: { trad: 'firewall' }, args: { trad: 'firewall' },
breadcrumb: ['tool-list', 'tool-firewall'] breadcrumb: ['tool-list', 'tool-firewall']
@ -308,7 +308,7 @@ const routes = [
{ {
name: 'tool-webadmin', name: 'tool-webadmin',
path: '/tools/webadmin', path: '/tools/webadmin',
component: () => import(/* webpackChunkName: "views/tools/webadmin" */ '@/views/tool/ToolWebadmin'), component: () => import('@/views/tool/ToolWebadmin.vue'),
meta: { meta: {
args: { trad: 'tools_webadmin_settings' }, args: { trad: 'tools_webadmin_settings' },
breadcrumb: ['tool-list', 'tool-webadmin'] breadcrumb: ['tool-list', 'tool-webadmin']
@ -316,12 +316,12 @@ const routes = [
}, },
{ {
path: '/tools/settings', path: '/tools/settings',
component: () => import(/* webpackChunkName: "views/tools/settings" */ '@/views/tool/ToolSettings'), component: () => import('@/views/tool/ToolSettings.vue'),
children: [ children: [
{ {
name: 'tool-settings', name: 'tool-settings',
path: ':tabId?', path: ':tabId?',
component: () => import(/* webpackChunkName: "components/configPanel" */ '@/components/ConfigPanel'), component: () => import('@/components/ConfigPanel.vue'),
props: true, props: true,
meta: { meta: {
routerParams: [], routerParams: [],
@ -334,7 +334,7 @@ const routes = [
{ {
name: 'tool-power', name: 'tool-power',
path: '/tools/power', path: '/tools/power',
component: () => import(/* webpackChunkName: "views/tools/power" */ '@/views/tool/ToolPower'), component: () => import('@/views/tool/ToolPower.vue'),
meta: { meta: {
args: { trad: 'tools_shutdown_reboot' }, args: { trad: 'tools_shutdown_reboot' },
breadcrumb: ['tool-list', 'tool-power'] breadcrumb: ['tool-list', 'tool-power']
@ -347,7 +347,7 @@ const routes = [
{ {
name: 'diagnosis', name: 'diagnosis',
path: '/diagnosis', path: '/diagnosis',
component: () => import(/* webpackChunkName: "views/diagnosis" */ '@/views/diagnosis/Diagnosis'), component: () => import('@/views/diagnosis/Diagnosis.vue'),
meta: { meta: {
args: { trad: 'diagnosis' }, args: { trad: 'diagnosis' },
breadcrumb: ['diagnosis'] breadcrumb: ['diagnosis']
@ -360,7 +360,7 @@ const routes = [
{ {
name: 'backup', name: 'backup',
path: '/backup', path: '/backup',
component: () => import(/* webpackChunkName: "views/backup/backup" */ '@/views/backup/Backup'), component: () => import('@/views/backup/Backup.vue'),
meta: { meta: {
args: { trad: 'backup' }, args: { trad: 'backup' },
breadcrumb: ['backup'] breadcrumb: ['backup']
@ -369,7 +369,7 @@ const routes = [
{ {
name: 'backup-list', name: 'backup-list',
path: '/backup/:id', path: '/backup/:id',
component: () => import(/* webpackChunkName: "views/backup/list" */ '@/views/backup/BackupList'), component: () => import('@/views/backup/BackupList.vue'),
props: true, props: true,
meta: { meta: {
args: { param: 'id' }, args: { param: 'id' },
@ -379,7 +379,7 @@ const routes = [
{ {
name: 'backup-info', name: 'backup-info',
path: '/backup/:id/info/:name', path: '/backup/:id/info/:name',
component: () => import(/* webpackChunkName: "views/backup/info" */ '@/views/backup/BackupInfo'), component: () => import('@/views/backup/BackupInfo.vue'),
props: true, props: true,
meta: { meta: {
args: { param: 'name' }, args: { param: 'name' },
@ -389,7 +389,7 @@ const routes = [
{ {
name: 'backup-create', name: 'backup-create',
path: '/backup/:id/create', path: '/backup/:id/create',
component: () => import(/* webpackChunkName: "views/backup/create" */ '@/views/backup/BackupCreate'), component: () => import('@/views/backup/BackupCreate.vue'),
props: true, props: true,
meta: { meta: {
args: { trad: 'backup_create' }, args: { trad: 'backup_create' },

View file

@ -85,7 +85,7 @@ import { validationMixin } from 'vuelidate'
import api from '@/api' import api from '@/api'
import { DomainForm } from '@/views/_partials' import { DomainForm } from '@/views/_partials'
import Login from '@/views/Login' import Login from '@/views/Login.vue'
import { alphalownum_, required, minLength, name, sameAs } from '@/helpers/validators' import { alphalownum_, required, minLength, name, sameAs } from '@/helpers/validators'
export default { export default {

View file

@ -53,7 +53,7 @@
import { mapGetters } from 'vuex' import { mapGetters } from 'vuex'
import { validationMixin } from 'vuelidate' import { validationMixin } from 'vuelidate'
import AdressInputSelect from '@/components/AdressInputSelect' import AdressInputSelect from '@/components/AdressInputSelect.vue'
import { formatFormDataValue } from '@/helpers/yunohostArguments' import { formatFormDataValue } from '@/helpers/yunohostArguments'
import { required, domain, dynDomain } from '@/helpers/validators' import { required, domain, dynDomain } from '@/helpers/validators'

View file

@ -52,7 +52,7 @@
</template> </template>
<script> <script>
import MessageListGroup from '@/components/MessageListGroup' import MessageListGroup from '@/components/MessageListGroup.vue'
export default { export default {
name: 'ErrorDisplay', name: 'ErrorDisplay',

View file

@ -70,8 +70,8 @@
<script> <script>
import { mapGetters } from 'vuex' import { mapGetters } from 'vuex'
import QueryHeader from '@/components/QueryHeader' import QueryHeader from '@/components/QueryHeader.vue'
import MessageListGroup from '@/components/MessageListGroup' import MessageListGroup from '@/components/MessageListGroup.vue'
export default { export default {
name: 'HistoryConsole', name: 'HistoryConsole',

View file

@ -38,7 +38,7 @@
import { mapGetters } from 'vuex' import { mapGetters } from 'vuex'
import api from '@/api' import api from '@/api'
import LoginView from '@/views/Login' import LoginView from '@/views/Login.vue'
export default { export default {

View file

@ -21,7 +21,7 @@
<script> <script>
import { mapGetters } from 'vuex' import { mapGetters } from 'vuex'
import { ErrorDisplay, WarningDisplay, WaitingDisplay, ReconnectingDisplay } from '@/views/_partials' import { ErrorDisplay, WarningDisplay, WaitingDisplay, ReconnectingDisplay } from '@/views/_partials'
import QueryHeader from '@/components/QueryHeader' import QueryHeader from '@/components/QueryHeader.vue'
export default { export default {
name: 'ViewLockOverlay', name: 'ViewLockOverlay',

View file

@ -24,7 +24,7 @@
</template> </template>
<script> <script>
import MessageListGroup from '@/components/MessageListGroup' import MessageListGroup from '@/components/MessageListGroup.vue'
export default { export default {
name: 'WaitingDisplay', name: 'WaitingDisplay',

View file

@ -1,9 +1,9 @@
export { default as ErrorDisplay } from './ErrorDisplay' export { default as ErrorDisplay } from './ErrorDisplay.vue'
export { default as WarningDisplay } from './WarningDisplay' export { default as WarningDisplay } from './WarningDisplay.vue'
export { default as WaitingDisplay } from './WaitingDisplay' export { default as WaitingDisplay } from './WaitingDisplay.vue'
export { default as ReconnectingDisplay } from './ReconnectingDisplay' export { default as ReconnectingDisplay } from './ReconnectingDisplay.vue'
export { default as HistoryConsole } from './HistoryConsole' export { default as HistoryConsole } from './HistoryConsole.vue'
export { default as ViewLockOverlay } from './ViewLockOverlay' export { default as ViewLockOverlay } from './ViewLockOverlay.vue'
export { default as DomainForm } from './DomainForm' export { default as DomainForm } from './DomainForm.vue'

View file

@ -165,7 +165,7 @@
<script> <script>
import { validationMixin } from 'vuelidate' import { validationMixin } from 'vuelidate'
import CardDeckFeed from '@/components/CardDeckFeed' import CardDeckFeed from '@/components/CardDeckFeed.vue'
import { required, appRepoUrl } from '@/helpers/validators' import { required, appRepoUrl } from '@/helpers/validators'
import { randint } from '@/helpers/commons' import { randint } from '@/helpers/commons'

View file

@ -283,7 +283,7 @@ import {
formatI18nField, formatI18nField,
formatYunoHostConfigPanels formatYunoHostConfigPanels
} from '@/helpers/yunohostArguments' } from '@/helpers/yunohostArguments'
import ConfigPanels from '@/components/ConfigPanels' import ConfigPanels from '@/components/ConfigPanels.vue'
export default { export default {
name: 'AppInfo', name: 'AppInfo',

View file

@ -164,7 +164,7 @@ import {
formatI18nField, formatI18nField,
formatFormData formatFormData
} from '@/helpers/yunohostArguments' } from '@/helpers/yunohostArguments'
import CardCollapse from '@/components/CardCollapse' import CardCollapse from '@/components/CardCollapse.vue'
export default { export default {
name: 'AppInstall', name: 'AppInstall',

View file

@ -95,7 +95,7 @@ import {
formatFormData, formatFormData,
formatYunoHostConfigPanels formatYunoHostConfigPanels
} from '@/helpers/yunohostArguments' } from '@/helpers/yunohostArguments'
import ConfigPanels from '@/components/ConfigPanels' import ConfigPanels from '@/components/ConfigPanels.vue'
import DomainDns from './DomainDns.vue' import DomainDns from './DomainDns.vue'

View file

@ -41,7 +41,7 @@
<script> <script>
import { mapGetters } from 'vuex' import { mapGetters } from 'vuex'
import RecursiveListGroup from '@/components/RecursiveListGroup' import RecursiveListGroup from '@/components/RecursiveListGroup.vue'
export default { export default {

View file

@ -109,7 +109,7 @@ import Vue from 'vue'
import api from '@/api' import api from '@/api'
import { isEmptyValue } from '@/helpers/commons' import { isEmptyValue } from '@/helpers/commons'
import TagsSelectizeItem from '@/components/globals/formItems/TagsSelectizeItem' import TagsSelectizeItem from '@/components/globals/formItems/TagsSelectizeItem.vue'
// TODO add global search with type (search by: group, user, permission) // TODO add global search with type (search by: group, user, permission)
// TODO add vuex store update on inputs ? // TODO add vuex store update on inputs ?

View file

@ -13,7 +13,7 @@ import {
formatFormData, formatFormData,
formatYunoHostConfigPanels formatYunoHostConfigPanels
} from '@/helpers/yunohostArguments' } from '@/helpers/yunohostArguments'
import ConfigPanels from '@/components/ConfigPanels' import ConfigPanels from '@/components/ConfigPanels.vue'
export default { export default {

View file

@ -84,7 +84,7 @@ export default {
const availableLocales = this.$store.getters.availableLocales const availableLocales = this.$store.getters.availableLocales
this.fields.locale.props.choices = availableLocales this.fields.locale.props.choices = availableLocales
this.fields.fallbackLocale.props.choices = availableLocales this.fields.fallbackLocale.props.choices = availableLocales
if (process.env.NODE_ENV === 'development') { if (import.meta.env.DEV) {
this.fields.experimental = { this.fields.experimental = {
id: 'experimental', id: 'experimental',
label: this.$i18n.t('tools_webadmin.experimental'), label: this.$i18n.t('tools_webadmin.experimental'),

View file

@ -114,7 +114,7 @@
import api from '@/api' import api from '@/api'
import { mapGetters } from 'vuex' import { mapGetters } from 'vuex'
import CardCollapse from '@/components/CardCollapse' import CardCollapse from '@/components/CardCollapse.vue'
export default { export default {
name: 'SystemUpdate', name: 'SystemUpdate',

View file

@ -101,7 +101,7 @@ import {
name, required, minLength, emailLocalPart, sameAs, integer, minValue, emailForward name, required, minLength, emailLocalPart, sameAs, integer, minValue, emailForward
} from '@/helpers/validators' } from '@/helpers/validators'
import AdressInputSelect from '@/components/AdressInputSelect' import AdressInputSelect from '@/components/AdressInputSelect.vue'
export default { export default {

85
app/vite.config.js Normal file
View file

@ -0,0 +1,85 @@
import { fileURLToPath, URL } from 'url';
import { defineConfig, loadEnv } from 'vite'
import fs from 'fs'
import vue from '@vitejs/plugin-vue2'
export default defineConfig(({ command, mode }) => {
// Load env file based on `mode` in the current working directory.
// Set the third parameter to '' to load all env regardless of the `VITE_` prefix.
const env = loadEnv(mode, process.cwd())
const config = {
define: {
// fake process.env for some deps
'process.env': {}
},
resolve:{
alias:[
// this is required for the SCSS modules imports with `~` (node_modules)
{ find: /^~(.*)$/, replacement: '$1' },
{ find: '@', replacement: fileURLToPath(new URL('./src', import.meta.url)) },
]
},
css: {
preprocessorOptions: {
scss: {
// To auto inject scss variables into componentns scope
additionalData: `
@import "@/scss/_variables.scss";
`
}
}
},
plugins: [
vue()
],
build: {
rollupOptions: {
output: {
manualChunks: (id) => {
// Circular import problems, this will merge vue/vuex/etc. and api together
if (!id.includes('node_modules') && id.includes('api/')) {
return 'core';
}
}
}
}
}
}
if (mode === 'production') {
return {
...config,
base: '/yunohost/admin',
}
} else if (mode === 'development') {
return {
...config,
server: {
port: 8080,
host: env.VITE_IP,
https: {
// Use already created cert from yunohost instance
key: fs.readFileSync('/etc/yunohost/certs/yunohost.org/key.pem'),
cert: fs.readFileSync('/etc/yunohost/certs/yunohost.org/crt.pem'),
},
fs: {
// Needed for special ynh-dev context where node_modules is symlinked
allow: [
'/ynh-dev/yunohost-admin/app',
'/var/cache/ynh-dev/yunohost-admin/node_modules'
]
},
proxy: {
'/yunohost': {
target: `https://${env.VITE_IP}`,
ws: true,
logLevel: 'info',
secure: false,
},
},
}
}
}
})

View file

@ -1,90 +0,0 @@
const webpack = require('webpack')
const fs = require('fs')
const dateFnsLocales = [
'ar',
'ar-DZ', // for `kab`
'bn', // for 'bn_BD'
'ca', // for 'ca' & 'oc'
'cs',
'da',
'de',
'el',
'en-GB', // for 'en' & 'ne'
'eo',
'es',
'eu',
'fa-IR',
'fi',
'fr', // for 'fr' & 'br'
'gl',
'he',
'hi',
'hu',
'id',
'it',
'lt',
'mk',
'nb', // for 'nb_NO'
'nl',
'oc',
'pl',
'pt',
'pt-BR',
'ru',
'sl',
'sv',
'tr',
'uk',
'zh_CN' // for 'zh_Hans'
]
module.exports = {
configureWebpack: {
plugins: [
// Will limit the available locales so webpack won't generate chunks for every
// locales found in `date-fns/locales/` but only those listed.
new webpack.ContextReplacementPlugin(
/date-fns[/\\]/,
new RegExp(`[/\\\\](${dateFnsLocales.join('|')})[/\\\\]index.js$`)
)
]
},
pluginOptions: {
i18n: {
locale: 'en',
fallbackLocale: 'en',
localeDir: 'src/i18n/locales',
enableInSFC: false
}
},
css: {
loaderOptions: {
sass: {
additionalData: '@import "@/scss/_variables.scss";'
}
}
},
publicPath: '/yunohost/admin',
devServer: process.env.NODE_ENV === 'development'
? {
public: fs.readFileSync('/etc/yunohost/current_host', 'utf8'),
https: false,
allowedHosts: 'all',
proxy: {
'^/yunohost': {
target: `http://${process.env.VUE_APP_IP}`,
ws: true,
logLevel: 'info'
}
},
static: {
watch: {
ignored: /node_modules/,
aggregateTimeout: 300,
poll: 1000
}
}
}
: {}
}