Add ability to disable settings/reports during compile time

This commit is contained in:
Maxim Filippov 2019-09-14 22:17:24 +00:00
parent eeb68bafee
commit c2a33da65c
5 changed files with 49 additions and 25 deletions

View File

@ -4,11 +4,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
## [Unreleased]
## [1.1.0] - 2019-09-15
### Added
- add ability to configure new settings (UploadS3 bucket namespace, Rate limit for Activity pub routes, Email notifications settings, MRF Vocabulary, user bio and name length and others)
- add ability to disable certain features (settings/reports)
- add sign in via PleromaFE
### Changed

View File

@ -6,6 +6,20 @@
Admin UI for pleroma instance owners
## Usage
### Development
To run AdminFE locally execute `yarn dev`
### Build
To compile everything for production run `yarn build:prod`.
#### Disabling features
You can disable certain AdminFE features, like reports or settings by modifying `config/prod.env.js` env variable `DISABLED_FEATURES`, e.g. if you want to compile AdminFE without "Setting" you'll need to set it to: `DISABLED_FEATURES: '["settings"]'`.
## Changelog
Detailed changes for each release are documented in the [CHANGELOG](./CHANGELOG.md).

View File

@ -1,5 +1,6 @@
module.exports = {
NODE_ENV: '"development"',
ENV_CONFIG: '"dev"',
DISABLED_FEATURES: '[""]',
ASSETS_PUBLIC_PATH: '/'
}

View File

@ -2,5 +2,6 @@ module.exports = {
NODE_ENV: '"production"',
ENV_CONFIG: '"prod"',
BASE_API: '"https://api-prod"',
DISABLED_FEATURES: '[""]',
ASSETS_PUBLIC_PATH: '/pleroma/admin/'
}

View File

@ -6,6 +6,35 @@ Vue.use(Router)
/* Layout */
import Layout from '@/views/layout/Layout'
const disabledFeatures = process.env.DISABLED_FEATURES || []
const settingsDisabled = disabledFeatures.includes('settings')
const settings = {
path: '/settings',
component: Layout,
children: [
{
path: 'index',
component: () => import('@/views/settings/index'),
name: 'Settings',
meta: { title: 'settings', icon: 'settings', noCache: true }
}
]
}
const reportsDisabled = disabledFeatures.includes('reports')
const reports = {
path: '/reports',
component: Layout,
children: [
{
path: 'index',
component: () => import('@/views/reports/index'),
name: 'Reports',
meta: { title: 'reports', icon: 'documentation', noCache: true }
}
]
}
export const constantRouterMap = [
{
path: '/redirect',
@ -69,30 +98,8 @@ export const asyncRouterMap = [
}
]
},
{
path: '/reports',
component: Layout,
children: [
{
path: 'index',
component: () => import('@/views/reports/index'),
name: 'Reports',
meta: { title: 'reports', icon: 'documentation', noCache: true }
}
]
},
{
path: '/settings',
component: Layout,
children: [
{
path: 'index',
component: () => import('@/views/settings/index'),
name: 'Settings',
meta: { title: 'settings', icon: 'settings', noCache: true }
}
]
},
...(settingsDisabled ? [] : [settings]),
...(reportsDisabled ? [] : [reports]),
{
path: '/users/:id',
component: Layout,