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/). The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
## [Unreleased] ## [1.1.0] - 2019-09-15
### Added ### 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 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 - add sign in via PleromaFE
### Changed ### Changed

View file

@ -6,6 +6,20 @@
Admin UI for pleroma instance owners 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 ## Changelog
Detailed changes for each release are documented in the [CHANGELOG](./CHANGELOG.md). Detailed changes for each release are documented in the [CHANGELOG](./CHANGELOG.md).

View file

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

View file

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

View file

@ -6,6 +6,35 @@ Vue.use(Router)
/* Layout */ /* Layout */
import Layout from '@/views/layout/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 = [ export const constantRouterMap = [
{ {
path: '/redirect', path: '/redirect',
@ -69,30 +98,8 @@ export const asyncRouterMap = [
} }
] ]
}, },
{ ...(settingsDisabled ? [] : [settings]),
path: '/reports', ...(reportsDisabled ? [] : [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 }
}
]
},
{ {
path: '/users/:id', path: '/users/:id',
component: Layout, component: Layout,