mirror of
https://github.com/opencloud-eu/opencloud.git
synced 2026-04-03 23:32:02 -04:00
change: remove the settings ui
ownCloud Web recently transitioned to Vue3. The settings ui is still written in Vue2. Since it's pretty much unused we won't take the efforts of upgrading it to Vue3.
This commit is contained in:
9
changelog/unreleased/change-remove-settings-ui.md
Normal file
9
changelog/unreleased/change-remove-settings-ui.md
Normal file
@@ -0,0 +1,9 @@
|
||||
Change: Remove the settings ui
|
||||
|
||||
With ownCloud Web having transitioned to Vue 3 recently, we would have had to port the settings ui as well. The decision was made
|
||||
to discontinue the settings ui instead. As a result all traces of the settings ui have been removed.
|
||||
|
||||
The only user facing setting that ever existed in the settings service is now integrated into the `account` page of
|
||||
ownCloud Web (click on top right user menu, then on your username to reach the account page).
|
||||
|
||||
https://github.com/owncloud/ocis/pull/5463
|
||||
@@ -53,8 +53,6 @@ policies:
|
||||
backend: http://localhost:9120
|
||||
- endpoint: /api/v0/settings
|
||||
backend: http://localhost:9190
|
||||
- endpoint: /settings.js
|
||||
backend: http://localhost:9190
|
||||
- name: oc10
|
||||
routes:
|
||||
- endpoint: "/"
|
||||
|
||||
@@ -53,8 +53,6 @@ policies:
|
||||
backend: http://localhost:9120
|
||||
- endpoint: /api/v0/settings
|
||||
backend: http://localhost:9190
|
||||
- endpoint: /settings.js
|
||||
backend: http://localhost:9190
|
||||
# oCIS Hello specific routes
|
||||
- endpoint: "/api/v0/greet"
|
||||
backend: http://ocis-hello:9105
|
||||
|
||||
@@ -14,16 +14,8 @@ When using oCIS, the requirement to store settings arises. This extension provid
|
||||
for other extensions to register new settings within oCIS. It is responsible for storing the respective
|
||||
settings values as well.
|
||||
|
||||
For ease of use, this extension provides an ocis-web extension which allows users to change their settings values.
|
||||
Please refer to the [ocis-web extension docs]({{< ref "../../ocis/development/extensions/#external-ownCloud-Web-apps" >}})
|
||||
for running ocis-web extensions.
|
||||
|
||||
{{< mermaid class="text-center">}}
|
||||
graph TD
|
||||
subgraph ow[ocis-web]
|
||||
ows[ocis-web-settings]
|
||||
owc[ocis-web-core]
|
||||
end
|
||||
ows ---|"listSettingsBundles(),<br>saveSettingsValue(value)"| os[ocis-settings]
|
||||
owc ---|"listSettingsValues()"| sdk[oC SDK]
|
||||
sdk --- sdks{ocis-settings<br>available?}
|
||||
@@ -36,15 +28,9 @@ The diagram shows how the settings service integrates into oCIS:
|
||||
|
||||
**Settings management:**
|
||||
- oCIS extensions can register *settings bundles* with the ocis-settings service.
|
||||
- The settings frontend can be plugged into ocis-web, showing forms for changing *settings values* as a user.
|
||||
The forms are generated from the registered *settings bundles*.
|
||||
|
||||
**Settings usage:**
|
||||
- Extensions can query ocis-settings for *settings values* of a user.
|
||||
- The ownCloud SDK, used as a data abstraction layer for ocis-web, will query ocis-settings for *settings values* of a user,
|
||||
if it's available. The SDK uses sensible defaults when ocis-settings is not part of the setup.
|
||||
|
||||
For compatibility with ownCloud 10, a migration of ownCloud 10 settings into the storage of ocis-settings will be available.
|
||||
|
||||
## Table of Contents
|
||||
|
||||
|
||||
@@ -21,7 +21,6 @@ In the context of this extension and oCIS in general, we are using the following
|
||||
- Application level settings
|
||||
- e.g. default language
|
||||
- Can be modified at runtime without restarting the service
|
||||
- Typically modified in the UI
|
||||
|
||||
### Preferences
|
||||
|
||||
@@ -38,5 +37,4 @@ In the context of this extension and oCIS in general, we are using the following
|
||||
|
||||
- Manifestation of a setting for a specific user
|
||||
- E.g. used for customization (at runtime) in `ocis-web`
|
||||
- `ocis-web-settings` extension for modifying settings values is provided by this service
|
||||
- Can be queried and modified by other oCIS extensions
|
||||
|
||||
@@ -10,7 +10,7 @@ geekdocFilePath: releasing.md
|
||||
|
||||
## Requirements
|
||||
|
||||
You need a working installation of [the Go programming language](https://golang.org/), [the Node runtime](https://nodejs.org/) and [the pnpm package manager](https://pnpm.io) installed to build the assets for a working release.
|
||||
You need a working installation of [the Go programming language](https://golang.org/).
|
||||
|
||||
## Releasing
|
||||
|
||||
|
||||
@@ -1,76 +0,0 @@
|
||||
---
|
||||
title: "Tests"
|
||||
weight: 90
|
||||
geekdocRepo: https://github.com/owncloud/ocis
|
||||
geekdocEditPath: edit/master/docs/services/settings
|
||||
geekdocFilePath: tests.md
|
||||
---
|
||||
|
||||
{{< toc >}}
|
||||
|
||||
## Requirements
|
||||
|
||||
You need a working installation of [the Go programming language](https://golang.org/), [the Node runtime](https://nodejs.org/) and [the pnpm package manager](https://pnpm.io/) installed to run the acceptance tests. You may also want to use [Docker](https://www.docker.com/) to start the necessary services in their respective containers.
|
||||
|
||||
## Acceptance Tests
|
||||
|
||||
Make sure you've cloned the [web frontend repo](https://github.com/owncloud/web/) and the [infinite scale repo](https://github.com/owncloud/ocis/) next to each other. If your file/folder structure is different, you'll have to change the paths below accordingly.
|
||||
|
||||
### In the web repo
|
||||
|
||||
#### **Optional:** Build web to test local changes
|
||||
|
||||
Install dependencies and bundle the frontend with a watcher by running
|
||||
|
||||
```bash
|
||||
pnpm install && pnpm build:w
|
||||
```
|
||||
|
||||
If you skip the step above, the currently bundled frontend from the oCIS binary will be used.
|
||||
|
||||
#### Dockerized acceptance test services
|
||||
|
||||
Start the necessary acceptance test services by using Docker (Compose):
|
||||
|
||||
```bash
|
||||
docker compose up selenium middleware-ocis vnc
|
||||
```
|
||||
|
||||
### In the oCIS repo
|
||||
|
||||
#### **Optional:** Build settings UI to test local changes
|
||||
|
||||
Navigate into the settings service via `cd ../settings/` and install dependencies and build the bundled settings UI with a watcher by running
|
||||
|
||||
```bash
|
||||
pnpm install && pnpm watch
|
||||
```
|
||||
|
||||
#### Start oCIS from binary
|
||||
|
||||
Navigate into the oCIS directory inside the oCIS repository and build the oCIS binary by running
|
||||
|
||||
```bash
|
||||
make clean build
|
||||
```
|
||||
|
||||
Then, start oCIS from the binary via
|
||||
|
||||
```bash
|
||||
ocis init
|
||||
OCIS_URL=https://host.docker.internal:9200 OCIS_INSECURE=true PROXY_ENABLE_BASIC_AUTH=true WEB_UI_CONFIG=../../web/dev/docker/ocis.web.config.json ./bin/ocis server
|
||||
```
|
||||
|
||||
If you've built the web bundle locally in its repository, you also need to reference the bundle output in the command above: `WEB_ASSET_PATH=../../web/dist`
|
||||
|
||||
If you've built the settings UI bundle locally, you also need to reference the bundle output in the command above: `SETTINGS_ASSET_PATH=../settings/assets/`
|
||||
|
||||
#### Run settings acceptance tests
|
||||
|
||||
If you want visual feedback on the test run, visit http://host.docker.internal:6080/ in your browser and connect to the VNC client.
|
||||
|
||||
Navigate into the settings service via `cd ../settings/` and start the acceptance tests by running
|
||||
|
||||
```bash
|
||||
SERVER_HOST=https://host.docker.internal:9200 BACKEND_HOST=https://host.docker.internal:9200 RUN_ON_OCIS=true NODE_TLS_REJECT_UNAUTHORIZED=0 WEB_PATH=../../web WEB_UI_CONFIG=../../web/tests/drone/config-ocis.json MIDDLEWARE_HOST=http://host.docker.internal:3000 ./ui/tests/run-acceptance-test.sh ./ui/tests/acceptance/features/
|
||||
```
|
||||
@@ -8,8 +8,7 @@ geekdocFilePath: values.md
|
||||
---
|
||||
|
||||
A **Settings Value** is the value an authenticated user has chosen for a specific setting, defined in a
|
||||
*settings bundle*. For choosing settings values as a user the sole entry point is the ocis-web extension
|
||||
provided by this service.
|
||||
*settings bundle*.
|
||||
|
||||
## Identifying settings values
|
||||
|
||||
@@ -68,8 +67,7 @@ a JWT, providing it in the HTTP header as `x-access-token`. That UUID is then us
|
||||
```
|
||||
|
||||
## gRPC endpoints
|
||||
The obvious way of modifying settings is the ocis-web extension, as described earlier. However, services can
|
||||
use the respective gRPC endpoints of the `ValueService` to query and modify *settings values* as well.
|
||||
Services can use gRPC endpoints of the `ValueService` to query and modify *settings values*.
|
||||
The gRPC endpoints require the same identifier attributes as described above, so for making a request to
|
||||
the `ValueService` you will have to make sure that the accountUuid of the authenticated user is available in
|
||||
your service at the time of the request.
|
||||
|
||||
@@ -193,11 +193,6 @@ func DefaultPolicies() []config.Policy {
|
||||
Endpoint: "/api/v0/settings",
|
||||
Service: "com.owncloud.web.settings",
|
||||
},
|
||||
{
|
||||
Endpoint: "/settings.js",
|
||||
Service: "com.owncloud.web.settings",
|
||||
Unprotected: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
module.exports = {
|
||||
"env": {
|
||||
"browser": true,
|
||||
"es6": true,
|
||||
"amd": true
|
||||
},
|
||||
"extends": [
|
||||
"standard",
|
||||
"eslint:recommended",
|
||||
"plugin:vue/essential"
|
||||
],
|
||||
"parserOptions": {
|
||||
"sourceType": "module"
|
||||
},
|
||||
"rules": {
|
||||
'unused-imports/no-unused-imports': 'error'
|
||||
},
|
||||
plugins: ['unused-imports']
|
||||
}
|
||||
17
services/settings/.gitignore
vendored
17
services/settings/.gitignore
vendored
@@ -1,17 +0,0 @@
|
||||
# yarn2 with Zero-Installs: https://yarnpkg.com/features/zero-installs
|
||||
#.yarn/*
|
||||
#!.yarn/cache
|
||||
#!.yarn/patches
|
||||
#!.yarn/plugins
|
||||
#!.yarn/releases
|
||||
#!.yarn/sdks
|
||||
#!.yarn/versions
|
||||
|
||||
# yarn2 not using Zero-Installs: https://yarnpkg.com/features/zero-installs
|
||||
.yarn/*
|
||||
!.yarn/patches
|
||||
!.yarn/releases
|
||||
!.yarn/plugins
|
||||
!.yarn/sdks
|
||||
!.yarn/versions
|
||||
.pnp.*
|
||||
@@ -1,3 +0,0 @@
|
||||
auto-install-peers=true
|
||||
|
||||
hoist-pattern[]=*babel*
|
||||
@@ -3,11 +3,6 @@ NAME := settings
|
||||
|
||||
include ../../.make/recursion.mk
|
||||
|
||||
.PHONY: test-acceptance-webui
|
||||
test-acceptance-webui:
|
||||
./ui/tests/run-acceptance-test.sh $(FEATURE_PATH)
|
||||
|
||||
|
||||
############ tooling ############
|
||||
ifneq (, $(shell command -v go 2> /dev/null)) # suppress `command not found warnings` for non go targets in CI
|
||||
include ../../.bingo/Variables.mk
|
||||
@@ -23,9 +18,6 @@ include ../../.make/release.mk
|
||||
############ docs generate ############
|
||||
include ../../.make/docs.mk
|
||||
|
||||
############ l10n ############
|
||||
include ../../.make/l10n.mk
|
||||
|
||||
.PHONY: docs-generate
|
||||
docs-generate: config-docs-generate \
|
||||
grpc-docs-generate
|
||||
@@ -37,17 +29,7 @@ include ../../.make/generate.mk
|
||||
ci-go-generate: protobuf # CI runs ci-node-generate automatically before this target
|
||||
|
||||
.PHONY: ci-node-generate
|
||||
ci-node-generate: pnpm-build
|
||||
|
||||
.PHONY: pnpm-build
|
||||
pnpm-build: node_modules
|
||||
pnpm lint
|
||||
pnpm test
|
||||
pnpm build
|
||||
|
||||
.PHONY: node_modules
|
||||
node_modules:
|
||||
pnpm install
|
||||
ci-node-generate:
|
||||
|
||||
############ protobuf ############
|
||||
include ../../.make/protobuf.mk
|
||||
@@ -57,10 +39,7 @@ protobuf: buf-generate
|
||||
|
||||
############ licenses ############
|
||||
.PHONY: ci-node-check-licenses
|
||||
ci-node-check-licenses: node_modules
|
||||
pnpm licenses:check
|
||||
ci-node-check-licenses:
|
||||
|
||||
.PHONY: ci-node-save-licenses
|
||||
ci-node-save-licenses: node_modules
|
||||
pnpm licenses:csv
|
||||
pnpm licenses:save
|
||||
ci-node-save-licenses:
|
||||
|
||||
@@ -1,25 +0,0 @@
|
||||
module.exports = function (api) {
|
||||
api.cache(true)
|
||||
|
||||
const presets = [
|
||||
[
|
||||
'@babel/preset-env',
|
||||
{
|
||||
useBuiltIns: 'usage',
|
||||
corejs: '3'
|
||||
}
|
||||
]
|
||||
]
|
||||
const plugins = [
|
||||
'@babel/plugin-syntax-dynamic-import',
|
||||
'@babel/plugin-proposal-class-properties',
|
||||
'@babel/plugin-proposal-object-rest-spread',
|
||||
'@babel/plugin-transform-runtime',
|
||||
'@babel/plugin-proposal-export-default-from'
|
||||
]
|
||||
|
||||
return {
|
||||
presets,
|
||||
plugins
|
||||
}
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
[main]
|
||||
host = https://www.transifex.com
|
||||
|
||||
[o:owncloud-org:p:owncloud:r:ocis-settings]
|
||||
file_filter = locale/<lang>/LC_MESSAGES/app.po
|
||||
minimum_perc = 0
|
||||
source_file = template.pot
|
||||
source_lang = en
|
||||
type = PO
|
||||
File diff suppressed because one or more lines are too long
@@ -1,9 +0,0 @@
|
||||
const path = require('path')
|
||||
const TEST_INFRA_DIRECTORY = process.env.TEST_INFRA_DIRECTORY
|
||||
|
||||
const config = require(path.join(TEST_INFRA_DIRECTORY, 'nightwatch.conf.js'))
|
||||
|
||||
config.page_objects_path = [TEST_INFRA_DIRECTORY + '/pageObjects', 'ui/tests/acceptance/pageobjects']
|
||||
config.custom_commands_path = TEST_INFRA_DIRECTORY + '/customCommands'
|
||||
|
||||
module.exports = config
|
||||
@@ -1,97 +0,0 @@
|
||||
{
|
||||
"name": "ocis-settings",
|
||||
"version": "0.0.0",
|
||||
"private": true,
|
||||
"description": "",
|
||||
"homepage": "https://github.com/owncloud/ocis-settings#readme",
|
||||
"bugs": {
|
||||
"url": "https://github.com/owncloud/ocis/issues",
|
||||
"email": "support@owncloud.com"
|
||||
},
|
||||
"repository": "https://github.com/owncloud/ocis-settings.git",
|
||||
"license": "Apache-2.0",
|
||||
"author": "ownCloud GmbH <devops@owncloud.com>",
|
||||
"scripts": {
|
||||
"acceptance-tests": "cucumber-js --retry 1 --require-module @babel/register --require-module @babel/polyfill --require ${TEST_INFRA_DIRECTORY}/setup.js --require ui/tests/acceptance/stepDefinitions --require ${TEST_INFRA_DIRECTORY}/stepDefinitions --format @cucumber/pretty-formatter -t \"${TEST_TAGS:-not @skip and not @skipOnOC10}\"",
|
||||
"build": "rollup -c",
|
||||
"generate-api": "node node_modules/swagger-vue-generator/bin/generate-api.js --package-version v0 --source pkg/proto/v0/settings.swagger.json --moduleName settings --destination ui/client/settings/index.js",
|
||||
"licenses:check": "license-checker-rseidelsohn --summary --relativeLicensePath --onlyAllow 'Python-2.0;Apache*;Apache License, Version 2.0;Apache-2.0;Apache 2.0;Artistic-2.0;BSD;BSD-3-Clause;CC-BY-3.0;CC-BY-4.0;CC0-1.0;ISC;MIT;MPL-2.0;Public Domain;Unicode-TOU;Unlicense;WTFPL' --excludePackages 'ocis-settings@0.0.0;owncloud-design-system@13.1.0'",
|
||||
"licenses:csv": "license-checker-rseidelsohn --relativeLicensePath --csv --out ../../third-party-licenses/node/settings/third-party-licenses.csv",
|
||||
"licenses:save": "license-checker-rseidelsohn --relativeLicensePath --out /dev/null --files ../../third-party-licenses/node/settings/third-party-licenses",
|
||||
"lint": "eslint 'ui/**/*.{js,ts,vue}' --color",
|
||||
"test": "echo 'Not implemented'",
|
||||
"watch": "rollup -c -w"
|
||||
},
|
||||
"browserslist": [
|
||||
"last 2 versions",
|
||||
"> .2%",
|
||||
"not dead",
|
||||
"not Explorer > 0",
|
||||
"not ExplorerMobile > 0",
|
||||
"not BlackBerry > 0",
|
||||
"not OperaMini all",
|
||||
"not OperaMobile > 0"
|
||||
],
|
||||
"dependencies": {
|
||||
"axios": "^0.27.2",
|
||||
"core-js": "^3.23.3",
|
||||
"debounce": "^1.2.1",
|
||||
"lodash-es": "^4.17.21",
|
||||
"qs": "^6.11.0",
|
||||
"vue": "^2.6.10",
|
||||
"vuex": "^3.6.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.18.6",
|
||||
"@babel/plugin-proposal-class-properties": "^7.7.4",
|
||||
"@babel/plugin-proposal-export-default-from": "^7.16.7",
|
||||
"@babel/plugin-proposal-object-rest-spread": "^7.15.6",
|
||||
"@babel/plugin-syntax-dynamic-import": "^7.7.4",
|
||||
"@babel/plugin-transform-runtime": "^7.19.6",
|
||||
"@babel/polyfill": "^7.12.1",
|
||||
"@babel/preset-env": "^7.18.6",
|
||||
"@babel/register": "^7.17.7",
|
||||
"@babel/runtime": "^7.19.4",
|
||||
"@cucumber/cucumber": "^7.3.2",
|
||||
"@cucumber/pretty-formatter": "^1.0.0",
|
||||
"@erquhart/rollup-plugin-node-builtins": "^2.1.5",
|
||||
"@rollup/plugin-commonjs": "^17.1.0",
|
||||
"@rollup/plugin-json": "^4.0.1",
|
||||
"@rollup/plugin-replace": "^4.0.0",
|
||||
"archiver": "^5.3.0",
|
||||
"chromedriver": "^93.0.1",
|
||||
"cross-env": "^7.0.3",
|
||||
"easygettext": "^2.7.0",
|
||||
"eslint": "^8.19.0",
|
||||
"eslint-config-standard": "^17.0.0",
|
||||
"eslint-plugin-import": "^2.26.0",
|
||||
"eslint-plugin-n": "^15.2.4",
|
||||
"eslint-plugin-node": "11.1.0",
|
||||
"eslint-plugin-promise": "^6.0.0",
|
||||
"eslint-plugin-unused-imports": "^2.0.0",
|
||||
"eslint-plugin-vue": "^9.1.1",
|
||||
"fs-extra": "^10.0.0",
|
||||
"join-path": "^1.1.1",
|
||||
"ldapjs": "^2.3.2",
|
||||
"license-checker-rseidelsohn": "^3.1.0",
|
||||
"lodash": "^4.17.21",
|
||||
"nightwatch": "1.7.11",
|
||||
"nightwatch-api": "3.0.2",
|
||||
"node-fetch": "^2.6.7",
|
||||
"rollup": "^2.75.7",
|
||||
"rollup-plugin-babel": "^4.3.3",
|
||||
"rollup-plugin-eslint": "^7.0.0",
|
||||
"rollup-plugin-filesize": "^9.1.2",
|
||||
"rollup-plugin-node-globals": "^1.4.0",
|
||||
"rollup-plugin-node-resolve": "^5.2.0",
|
||||
"rollup-plugin-terser": "^7.0.2",
|
||||
"rollup-plugin-vue": "^5.1.9",
|
||||
"swagger-vue-generator": "^1.0.6",
|
||||
"url-search-params-polyfill": "^8.1.1",
|
||||
"vue-template-compiler": "^2.6.11",
|
||||
"xml-js": "^1.6.11"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"owncloud-design-system": "^13.1.0"
|
||||
}
|
||||
}
|
||||
@@ -1,50 +0,0 @@
|
||||
package assets
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/owncloud/ocis/v2/ocis-pkg/assetsfs"
|
||||
"github.com/owncloud/ocis/v2/ocis-pkg/log"
|
||||
"github.com/owncloud/ocis/v2/services/settings"
|
||||
"github.com/owncloud/ocis/v2/services/settings/pkg/config"
|
||||
)
|
||||
|
||||
// New returns a new http filesystem to serve assets.
|
||||
func New(opts ...Option) http.FileSystem {
|
||||
options := newOptions(opts...)
|
||||
return assetsfs.New(settings.Assets, options.Config.Asset.Path, options.Logger)
|
||||
}
|
||||
|
||||
// Option defines a single option function.
|
||||
type Option func(o *Options)
|
||||
|
||||
// Options defines the available options for this package.
|
||||
type Options struct {
|
||||
Logger log.Logger
|
||||
Config *config.Config
|
||||
}
|
||||
|
||||
// newOptions initializes the available default options.
|
||||
func newOptions(opts ...Option) Options {
|
||||
opt := Options{}
|
||||
|
||||
for _, o := range opts {
|
||||
o(&opt)
|
||||
}
|
||||
|
||||
return opt
|
||||
}
|
||||
|
||||
// Logger provides a function to set the logger option.
|
||||
func Logger(val log.Logger) Option {
|
||||
return func(o *Options) {
|
||||
o.Logger = val
|
||||
}
|
||||
}
|
||||
|
||||
// Config provides a function to set the config option.
|
||||
func Config(val *config.Config) Option {
|
||||
return func(o *Options) {
|
||||
o.Config = val
|
||||
}
|
||||
}
|
||||
@@ -27,7 +27,6 @@ type Config struct {
|
||||
|
||||
AdminUserID string `yaml:"admin_user_id" env:"OCIS_ADMIN_USER_ID;SETTINGS_ADMIN_USER_ID" desc:"ID of the user that should receive admin privileges."`
|
||||
|
||||
Asset Asset `yaml:"asset"`
|
||||
TokenManager *TokenManager `yaml:"token_manager"`
|
||||
|
||||
SetupDefaultAssignments bool `yaml:"set_default_assignments" env:"SETTINGS_SETUP_DEFAULT_ASSIGNMENTS;ACCOUNTS_DEMO_USERS_AND_GROUPS" desc:"The default role assignments the demo users should be setup."`
|
||||
@@ -35,11 +34,6 @@ type Config struct {
|
||||
Context context.Context `yaml:"-"`
|
||||
}
|
||||
|
||||
// Asset defines the available asset configuration.
|
||||
type Asset struct {
|
||||
Path string `yaml:"path" env:"SETTINGS_ASSET_PATH" desc:"Serve settings Web UI assets from a path on the filesystem instead of the builtin assets. Can be used for development and customization."`
|
||||
}
|
||||
|
||||
// Metadata configures the metadata store to use
|
||||
type Metadata struct {
|
||||
GatewayAddress string `yaml:"gateway_addr" env:"STORAGE_GATEWAY_GRPC_ADDR" desc:"GRPC address of the STORAGE-SYSTEM service."`
|
||||
|
||||
@@ -32,7 +32,6 @@ func DefaultConfig() *config.Config {
|
||||
Addr: "127.0.0.1:9190",
|
||||
Namespace: "com.owncloud.web",
|
||||
Root: "/",
|
||||
CacheTTL: 604800, // 7 days
|
||||
CORS: config.CORS{
|
||||
AllowedOrigins: []string{"*"},
|
||||
AllowedMethods: []string{"GET", "POST", "PUT", "PATCH", "DELETE", "OPTIONS"},
|
||||
@@ -44,11 +43,8 @@ func DefaultConfig() *config.Config {
|
||||
Addr: "127.0.0.1:9191",
|
||||
Namespace: "com.owncloud.api",
|
||||
},
|
||||
StoreType: "metadata", // use metadata or filesystem
|
||||
DataPath: path.Join(defaults.BaseDataPath(), "settings"),
|
||||
Asset: config.Asset{
|
||||
Path: "",
|
||||
},
|
||||
StoreType: "metadata", // use metadata or filesystem
|
||||
DataPath: path.Join(defaults.BaseDataPath(), "settings"),
|
||||
SetupDefaultAssignments: false,
|
||||
Metadata: config.Metadata{
|
||||
GatewayAddress: "127.0.0.1:9215", // system storage
|
||||
|
||||
@@ -8,7 +8,6 @@ type HTTP struct {
|
||||
TLS shared.HTTPServiceTLS `yaml:"tls"`
|
||||
Namespace string `yaml:"-"`
|
||||
Root string `yaml:"root" env:"SETTINGS_HTTP_ROOT" desc:"Subdirectory that serves as the root for this HTTP service."`
|
||||
CacheTTL int `yaml:"cache_ttl" env:"SETTINGS_CACHE_TTL" desc:"Browser cache control max-age value in seconds for settings Web UI assets."`
|
||||
CORS CORS `yaml:"cors"`
|
||||
}
|
||||
|
||||
|
||||
@@ -12,7 +12,6 @@ import (
|
||||
ohttp "github.com/owncloud/ocis/v2/ocis-pkg/service/http"
|
||||
"github.com/owncloud/ocis/v2/ocis-pkg/version"
|
||||
settingssvc "github.com/owncloud/ocis/v2/protogen/gen/ocis/services/settings/v0"
|
||||
"github.com/owncloud/ocis/v2/services/settings/pkg/assets"
|
||||
svc "github.com/owncloud/ocis/v2/services/settings/pkg/service/v0"
|
||||
"go-micro.dev/v4"
|
||||
)
|
||||
@@ -73,15 +72,6 @@ func Server(opts ...Option) (ohttp.Service, error) {
|
||||
options.Logger,
|
||||
))
|
||||
|
||||
mux.Use(middleware.Static(
|
||||
options.Config.HTTP.Root,
|
||||
assets.New(
|
||||
assets.Logger(options.Logger),
|
||||
assets.Config(options.Config),
|
||||
),
|
||||
options.Config.HTTP.CacheTTL,
|
||||
))
|
||||
|
||||
mux.Route(options.Config.HTTP.Root, func(r chi.Router) {
|
||||
settingssvc.RegisterBundleServiceWeb(r, handle)
|
||||
settingssvc.RegisterValueServiceWeb(r, handle)
|
||||
|
||||
9625
services/settings/pnpm-lock.yaml
generated
9625
services/settings/pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
@@ -1,5 +1,2 @@
|
||||
# backend
|
||||
-r '^(cmd|pkg)/.*\.go$' -R '^node_modules/' -s -- sh -c 'make bin/ocis-settings-debug && bin/ocis-settings-debug --log-level debug server --debug-pprof --debug-zpages --asset-path assets/'
|
||||
|
||||
# frontend
|
||||
-r '^ui/.*\.(vue|js)$' -R '^node_modules/' -- sh -c 'pnpm build && make generate'
|
||||
|
||||
@@ -1,52 +0,0 @@
|
||||
import vue from 'rollup-plugin-vue'
|
||||
import { terser } from 'rollup-plugin-terser'
|
||||
import replace from '@rollup/plugin-replace'
|
||||
import filesize from 'rollup-plugin-filesize'
|
||||
import resolve from 'rollup-plugin-node-resolve'
|
||||
import commonjs from '@rollup/plugin-commonjs'
|
||||
import babel from 'rollup-plugin-babel'
|
||||
import json from '@rollup/plugin-json'
|
||||
import builtins from '@erquhart/rollup-plugin-node-builtins'
|
||||
import globals from 'rollup-plugin-node-globals'
|
||||
|
||||
const production = !process.env.ROLLUP_WATCH
|
||||
|
||||
// We can't really do much about circular dependencies in node_modules
|
||||
function onwarn (warning) {
|
||||
if (warning.code !== 'CIRCULAR_DEPENDENCY') {
|
||||
console.error(`(!) ${warning.message}`)
|
||||
}
|
||||
}
|
||||
|
||||
export default {
|
||||
input: 'ui/app.js',
|
||||
output: {
|
||||
file: 'assets/settings.js',
|
||||
format: 'amd',
|
||||
sourcemap: !production
|
||||
},
|
||||
onwarn,
|
||||
plugins: [
|
||||
vue(),
|
||||
replace({
|
||||
'process.env.NODE_ENV': JSON.stringify('production')
|
||||
}),
|
||||
resolve({
|
||||
mainFields: ['browser', 'jsnext', 'module', 'main'],
|
||||
include: 'node_modules/**',
|
||||
preferBuiltins: true
|
||||
}),
|
||||
babel({
|
||||
exclude: 'node_modules/**',
|
||||
runtimeHelpers: true
|
||||
}),
|
||||
commonjs({
|
||||
include: 'node_modules/**'
|
||||
}),
|
||||
json(),
|
||||
globals(),
|
||||
builtins(),
|
||||
production && terser(),
|
||||
production && filesize()
|
||||
]
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
package settings
|
||||
|
||||
import (
|
||||
"embed"
|
||||
)
|
||||
|
||||
//go:generate make generate
|
||||
//go:embed assets/*
|
||||
var Assets embed.FS
|
||||
@@ -1,43 +0,0 @@
|
||||
import SettingsApp from './components/SettingsApp.vue'
|
||||
import store from './store'
|
||||
import translations from './../l10n/translations.json'
|
||||
|
||||
// just a dummy function to trick gettext tools
|
||||
function $gettext (msg) {
|
||||
return msg
|
||||
}
|
||||
|
||||
const appInfo = {
|
||||
name: $gettext('Settings'),
|
||||
id: 'settings',
|
||||
icon: 'settings-4',
|
||||
isFileEditor: false
|
||||
}
|
||||
|
||||
const routes = [
|
||||
{
|
||||
name: 'settings',
|
||||
path: '/:extension?',
|
||||
component: SettingsApp
|
||||
}
|
||||
]
|
||||
|
||||
const navItems = [
|
||||
{
|
||||
name: $gettext('Settings'),
|
||||
icon: appInfo.icon,
|
||||
route: {
|
||||
name: 'settings',
|
||||
path: `/${appInfo.id}/`
|
||||
},
|
||||
menu: 'user'
|
||||
}
|
||||
]
|
||||
|
||||
export default {
|
||||
appInfo,
|
||||
store,
|
||||
routes,
|
||||
navItems,
|
||||
translations
|
||||
}
|
||||
@@ -1,719 +0,0 @@
|
||||
/* eslint-disable */
|
||||
import axios from 'axios'
|
||||
import qs from 'qs'
|
||||
let domain = ''
|
||||
export const getDomain = () => {
|
||||
return domain
|
||||
}
|
||||
export const setDomain = ($domain) => {
|
||||
domain = $domain
|
||||
}
|
||||
export const request = (method, url, body, queryParameters, form, config) => {
|
||||
method = method.toLowerCase()
|
||||
let keys = Object.keys(queryParameters)
|
||||
let queryUrl = url
|
||||
if (keys.length > 0) {
|
||||
queryUrl = url + '?' + qs.stringify(queryParameters)
|
||||
}
|
||||
// let queryUrl = url+(keys.length > 0 ? '?' + (keys.map(key => key + '=' + encodeURIComponent(queryParameters[key])).join('&')) : '')
|
||||
if (body) {
|
||||
return axios[method](queryUrl, body, config)
|
||||
} else if (method === 'get') {
|
||||
return axios[method](queryUrl, config)
|
||||
} else {
|
||||
return axios[method](queryUrl, qs.stringify(form), config)
|
||||
}
|
||||
}
|
||||
/*==========================================================
|
||||
*
|
||||
==========================================================*/
|
||||
/**
|
||||
*
|
||||
* request: RoleService_AssignRoleToUser
|
||||
* url: RoleService_AssignRoleToUserURL
|
||||
* method: RoleService_AssignRoleToUser_TYPE
|
||||
* raw_url: RoleService_AssignRoleToUser_RAW_URL
|
||||
* @param body -
|
||||
*/
|
||||
export const RoleService_AssignRoleToUser = function(parameters = {}) {
|
||||
const domain = parameters.$domain ? parameters.$domain : getDomain()
|
||||
const config = parameters.$config
|
||||
let path = '/api/v0/settings/assignments-add'
|
||||
let body
|
||||
let queryParameters = {}
|
||||
let form = {}
|
||||
if (parameters['body'] !== undefined) {
|
||||
body = parameters['body']
|
||||
}
|
||||
if (parameters['body'] === undefined) {
|
||||
return Promise.reject(new Error('Missing required parameter: body'))
|
||||
}
|
||||
if (parameters.$queryParameters) {
|
||||
Object.keys(parameters.$queryParameters).forEach(function(parameterName) {
|
||||
queryParameters[parameterName] = parameters.$queryParameters[parameterName]
|
||||
});
|
||||
}
|
||||
return request('post', domain + path, body, queryParameters, form, config)
|
||||
}
|
||||
export const RoleService_AssignRoleToUser_RAW_URL = function() {
|
||||
return '/api/v0/settings/assignments-add'
|
||||
}
|
||||
export const RoleService_AssignRoleToUser_TYPE = function() {
|
||||
return 'post'
|
||||
}
|
||||
export const RoleService_AssignRoleToUserURL = function(parameters = {}) {
|
||||
let queryParameters = {}
|
||||
const domain = parameters.$domain ? parameters.$domain : getDomain()
|
||||
let path = '/api/v0/settings/assignments-add'
|
||||
if (parameters.$queryParameters) {
|
||||
Object.keys(parameters.$queryParameters).forEach(function(parameterName) {
|
||||
queryParameters[parameterName] = parameters.$queryParameters[parameterName]
|
||||
})
|
||||
}
|
||||
let keys = Object.keys(queryParameters)
|
||||
return domain + path + (keys.length > 0 ? '?' + (keys.map(key => key + '=' + encodeURIComponent(queryParameters[key])).join('&')) : '')
|
||||
}
|
||||
/**
|
||||
*
|
||||
* request: RoleService_ListRoleAssignments
|
||||
* url: RoleService_ListRoleAssignmentsURL
|
||||
* method: RoleService_ListRoleAssignments_TYPE
|
||||
* raw_url: RoleService_ListRoleAssignments_RAW_URL
|
||||
* @param body -
|
||||
*/
|
||||
export const RoleService_ListRoleAssignments = function(parameters = {}) {
|
||||
const domain = parameters.$domain ? parameters.$domain : getDomain()
|
||||
const config = parameters.$config
|
||||
let path = '/api/v0/settings/assignments-list'
|
||||
let body
|
||||
let queryParameters = {}
|
||||
let form = {}
|
||||
if (parameters['body'] !== undefined) {
|
||||
body = parameters['body']
|
||||
}
|
||||
if (parameters['body'] === undefined) {
|
||||
return Promise.reject(new Error('Missing required parameter: body'))
|
||||
}
|
||||
if (parameters.$queryParameters) {
|
||||
Object.keys(parameters.$queryParameters).forEach(function(parameterName) {
|
||||
queryParameters[parameterName] = parameters.$queryParameters[parameterName]
|
||||
});
|
||||
}
|
||||
return request('post', domain + path, body, queryParameters, form, config)
|
||||
}
|
||||
export const RoleService_ListRoleAssignments_RAW_URL = function() {
|
||||
return '/api/v0/settings/assignments-list'
|
||||
}
|
||||
export const RoleService_ListRoleAssignments_TYPE = function() {
|
||||
return 'post'
|
||||
}
|
||||
export const RoleService_ListRoleAssignmentsURL = function(parameters = {}) {
|
||||
let queryParameters = {}
|
||||
const domain = parameters.$domain ? parameters.$domain : getDomain()
|
||||
let path = '/api/v0/settings/assignments-list'
|
||||
if (parameters.$queryParameters) {
|
||||
Object.keys(parameters.$queryParameters).forEach(function(parameterName) {
|
||||
queryParameters[parameterName] = parameters.$queryParameters[parameterName]
|
||||
})
|
||||
}
|
||||
let keys = Object.keys(queryParameters)
|
||||
return domain + path + (keys.length > 0 ? '?' + (keys.map(key => key + '=' + encodeURIComponent(queryParameters[key])).join('&')) : '')
|
||||
}
|
||||
/**
|
||||
*
|
||||
* request: RoleService_RemoveRoleFromUser
|
||||
* url: RoleService_RemoveRoleFromUserURL
|
||||
* method: RoleService_RemoveRoleFromUser_TYPE
|
||||
* raw_url: RoleService_RemoveRoleFromUser_RAW_URL
|
||||
* @param body -
|
||||
*/
|
||||
export const RoleService_RemoveRoleFromUser = function(parameters = {}) {
|
||||
const domain = parameters.$domain ? parameters.$domain : getDomain()
|
||||
const config = parameters.$config
|
||||
let path = '/api/v0/settings/assignments-remove'
|
||||
let body
|
||||
let queryParameters = {}
|
||||
let form = {}
|
||||
if (parameters['body'] !== undefined) {
|
||||
body = parameters['body']
|
||||
}
|
||||
if (parameters['body'] === undefined) {
|
||||
return Promise.reject(new Error('Missing required parameter: body'))
|
||||
}
|
||||
if (parameters.$queryParameters) {
|
||||
Object.keys(parameters.$queryParameters).forEach(function(parameterName) {
|
||||
queryParameters[parameterName] = parameters.$queryParameters[parameterName]
|
||||
});
|
||||
}
|
||||
return request('post', domain + path, body, queryParameters, form, config)
|
||||
}
|
||||
export const RoleService_RemoveRoleFromUser_RAW_URL = function() {
|
||||
return '/api/v0/settings/assignments-remove'
|
||||
}
|
||||
export const RoleService_RemoveRoleFromUser_TYPE = function() {
|
||||
return 'post'
|
||||
}
|
||||
export const RoleService_RemoveRoleFromUserURL = function(parameters = {}) {
|
||||
let queryParameters = {}
|
||||
const domain = parameters.$domain ? parameters.$domain : getDomain()
|
||||
let path = '/api/v0/settings/assignments-remove'
|
||||
if (parameters.$queryParameters) {
|
||||
Object.keys(parameters.$queryParameters).forEach(function(parameterName) {
|
||||
queryParameters[parameterName] = parameters.$queryParameters[parameterName]
|
||||
})
|
||||
}
|
||||
let keys = Object.keys(queryParameters)
|
||||
return domain + path + (keys.length > 0 ? '?' + (keys.map(key => key + '=' + encodeURIComponent(queryParameters[key])).join('&')) : '')
|
||||
}
|
||||
/**
|
||||
*
|
||||
* request: BundleService_GetBundle
|
||||
* url: BundleService_GetBundleURL
|
||||
* method: BundleService_GetBundle_TYPE
|
||||
* raw_url: BundleService_GetBundle_RAW_URL
|
||||
* @param body -
|
||||
*/
|
||||
export const BundleService_GetBundle = function(parameters = {}) {
|
||||
const domain = parameters.$domain ? parameters.$domain : getDomain()
|
||||
const config = parameters.$config
|
||||
let path = '/api/v0/settings/bundle-get'
|
||||
let body
|
||||
let queryParameters = {}
|
||||
let form = {}
|
||||
if (parameters['body'] !== undefined) {
|
||||
body = parameters['body']
|
||||
}
|
||||
if (parameters['body'] === undefined) {
|
||||
return Promise.reject(new Error('Missing required parameter: body'))
|
||||
}
|
||||
if (parameters.$queryParameters) {
|
||||
Object.keys(parameters.$queryParameters).forEach(function(parameterName) {
|
||||
queryParameters[parameterName] = parameters.$queryParameters[parameterName]
|
||||
});
|
||||
}
|
||||
return request('post', domain + path, body, queryParameters, form, config)
|
||||
}
|
||||
export const BundleService_GetBundle_RAW_URL = function() {
|
||||
return '/api/v0/settings/bundle-get'
|
||||
}
|
||||
export const BundleService_GetBundle_TYPE = function() {
|
||||
return 'post'
|
||||
}
|
||||
export const BundleService_GetBundleURL = function(parameters = {}) {
|
||||
let queryParameters = {}
|
||||
const domain = parameters.$domain ? parameters.$domain : getDomain()
|
||||
let path = '/api/v0/settings/bundle-get'
|
||||
if (parameters.$queryParameters) {
|
||||
Object.keys(parameters.$queryParameters).forEach(function(parameterName) {
|
||||
queryParameters[parameterName] = parameters.$queryParameters[parameterName]
|
||||
})
|
||||
}
|
||||
let keys = Object.keys(queryParameters)
|
||||
return domain + path + (keys.length > 0 ? '?' + (keys.map(key => key + '=' + encodeURIComponent(queryParameters[key])).join('&')) : '')
|
||||
}
|
||||
/**
|
||||
*
|
||||
* request: BundleService_SaveBundle
|
||||
* url: BundleService_SaveBundleURL
|
||||
* method: BundleService_SaveBundle_TYPE
|
||||
* raw_url: BundleService_SaveBundle_RAW_URL
|
||||
* @param body -
|
||||
*/
|
||||
export const BundleService_SaveBundle = function(parameters = {}) {
|
||||
const domain = parameters.$domain ? parameters.$domain : getDomain()
|
||||
const config = parameters.$config
|
||||
let path = '/api/v0/settings/bundle-save'
|
||||
let body
|
||||
let queryParameters = {}
|
||||
let form = {}
|
||||
if (parameters['body'] !== undefined) {
|
||||
body = parameters['body']
|
||||
}
|
||||
if (parameters['body'] === undefined) {
|
||||
return Promise.reject(new Error('Missing required parameter: body'))
|
||||
}
|
||||
if (parameters.$queryParameters) {
|
||||
Object.keys(parameters.$queryParameters).forEach(function(parameterName) {
|
||||
queryParameters[parameterName] = parameters.$queryParameters[parameterName]
|
||||
});
|
||||
}
|
||||
return request('post', domain + path, body, queryParameters, form, config)
|
||||
}
|
||||
export const BundleService_SaveBundle_RAW_URL = function() {
|
||||
return '/api/v0/settings/bundle-save'
|
||||
}
|
||||
export const BundleService_SaveBundle_TYPE = function() {
|
||||
return 'post'
|
||||
}
|
||||
export const BundleService_SaveBundleURL = function(parameters = {}) {
|
||||
let queryParameters = {}
|
||||
const domain = parameters.$domain ? parameters.$domain : getDomain()
|
||||
let path = '/api/v0/settings/bundle-save'
|
||||
if (parameters.$queryParameters) {
|
||||
Object.keys(parameters.$queryParameters).forEach(function(parameterName) {
|
||||
queryParameters[parameterName] = parameters.$queryParameters[parameterName]
|
||||
})
|
||||
}
|
||||
let keys = Object.keys(queryParameters)
|
||||
return domain + path + (keys.length > 0 ? '?' + (keys.map(key => key + '=' + encodeURIComponent(queryParameters[key])).join('&')) : '')
|
||||
}
|
||||
/**
|
||||
*
|
||||
* request: BundleService_AddSettingToBundle
|
||||
* url: BundleService_AddSettingToBundleURL
|
||||
* method: BundleService_AddSettingToBundle_TYPE
|
||||
* raw_url: BundleService_AddSettingToBundle_RAW_URL
|
||||
* @param body -
|
||||
*/
|
||||
export const BundleService_AddSettingToBundle = function(parameters = {}) {
|
||||
const domain = parameters.$domain ? parameters.$domain : getDomain()
|
||||
const config = parameters.$config
|
||||
let path = '/api/v0/settings/bundles-add-setting'
|
||||
let body
|
||||
let queryParameters = {}
|
||||
let form = {}
|
||||
if (parameters['body'] !== undefined) {
|
||||
body = parameters['body']
|
||||
}
|
||||
if (parameters['body'] === undefined) {
|
||||
return Promise.reject(new Error('Missing required parameter: body'))
|
||||
}
|
||||
if (parameters.$queryParameters) {
|
||||
Object.keys(parameters.$queryParameters).forEach(function(parameterName) {
|
||||
queryParameters[parameterName] = parameters.$queryParameters[parameterName]
|
||||
});
|
||||
}
|
||||
return request('post', domain + path, body, queryParameters, form, config)
|
||||
}
|
||||
export const BundleService_AddSettingToBundle_RAW_URL = function() {
|
||||
return '/api/v0/settings/bundles-add-setting'
|
||||
}
|
||||
export const BundleService_AddSettingToBundle_TYPE = function() {
|
||||
return 'post'
|
||||
}
|
||||
export const BundleService_AddSettingToBundleURL = function(parameters = {}) {
|
||||
let queryParameters = {}
|
||||
const domain = parameters.$domain ? parameters.$domain : getDomain()
|
||||
let path = '/api/v0/settings/bundles-add-setting'
|
||||
if (parameters.$queryParameters) {
|
||||
Object.keys(parameters.$queryParameters).forEach(function(parameterName) {
|
||||
queryParameters[parameterName] = parameters.$queryParameters[parameterName]
|
||||
})
|
||||
}
|
||||
let keys = Object.keys(queryParameters)
|
||||
return domain + path + (keys.length > 0 ? '?' + (keys.map(key => key + '=' + encodeURIComponent(queryParameters[key])).join('&')) : '')
|
||||
}
|
||||
/**
|
||||
*
|
||||
* request: BundleService_ListBundles
|
||||
* url: BundleService_ListBundlesURL
|
||||
* method: BundleService_ListBundles_TYPE
|
||||
* raw_url: BundleService_ListBundles_RAW_URL
|
||||
* @param body -
|
||||
*/
|
||||
export const BundleService_ListBundles = function(parameters = {}) {
|
||||
const domain = parameters.$domain ? parameters.$domain : getDomain()
|
||||
const config = parameters.$config
|
||||
let path = '/api/v0/settings/bundles-list'
|
||||
let body
|
||||
let queryParameters = {}
|
||||
let form = {}
|
||||
if (parameters['body'] !== undefined) {
|
||||
body = parameters['body']
|
||||
}
|
||||
if (parameters['body'] === undefined) {
|
||||
return Promise.reject(new Error('Missing required parameter: body'))
|
||||
}
|
||||
if (parameters.$queryParameters) {
|
||||
Object.keys(parameters.$queryParameters).forEach(function(parameterName) {
|
||||
queryParameters[parameterName] = parameters.$queryParameters[parameterName]
|
||||
});
|
||||
}
|
||||
return request('post', domain + path, body, queryParameters, form, config)
|
||||
}
|
||||
export const BundleService_ListBundles_RAW_URL = function() {
|
||||
return '/api/v0/settings/bundles-list'
|
||||
}
|
||||
export const BundleService_ListBundles_TYPE = function() {
|
||||
return 'post'
|
||||
}
|
||||
export const BundleService_ListBundlesURL = function(parameters = {}) {
|
||||
let queryParameters = {}
|
||||
const domain = parameters.$domain ? parameters.$domain : getDomain()
|
||||
let path = '/api/v0/settings/bundles-list'
|
||||
if (parameters.$queryParameters) {
|
||||
Object.keys(parameters.$queryParameters).forEach(function(parameterName) {
|
||||
queryParameters[parameterName] = parameters.$queryParameters[parameterName]
|
||||
})
|
||||
}
|
||||
let keys = Object.keys(queryParameters)
|
||||
return domain + path + (keys.length > 0 ? '?' + (keys.map(key => key + '=' + encodeURIComponent(queryParameters[key])).join('&')) : '')
|
||||
}
|
||||
/**
|
||||
*
|
||||
* request: BundleService_RemoveSettingFromBundle
|
||||
* url: BundleService_RemoveSettingFromBundleURL
|
||||
* method: BundleService_RemoveSettingFromBundle_TYPE
|
||||
* raw_url: BundleService_RemoveSettingFromBundle_RAW_URL
|
||||
* @param body -
|
||||
*/
|
||||
export const BundleService_RemoveSettingFromBundle = function(parameters = {}) {
|
||||
const domain = parameters.$domain ? parameters.$domain : getDomain()
|
||||
const config = parameters.$config
|
||||
let path = '/api/v0/settings/bundles-remove-setting'
|
||||
let body
|
||||
let queryParameters = {}
|
||||
let form = {}
|
||||
if (parameters['body'] !== undefined) {
|
||||
body = parameters['body']
|
||||
}
|
||||
if (parameters['body'] === undefined) {
|
||||
return Promise.reject(new Error('Missing required parameter: body'))
|
||||
}
|
||||
if (parameters.$queryParameters) {
|
||||
Object.keys(parameters.$queryParameters).forEach(function(parameterName) {
|
||||
queryParameters[parameterName] = parameters.$queryParameters[parameterName]
|
||||
});
|
||||
}
|
||||
return request('post', domain + path, body, queryParameters, form, config)
|
||||
}
|
||||
export const BundleService_RemoveSettingFromBundle_RAW_URL = function() {
|
||||
return '/api/v0/settings/bundles-remove-setting'
|
||||
}
|
||||
export const BundleService_RemoveSettingFromBundle_TYPE = function() {
|
||||
return 'post'
|
||||
}
|
||||
export const BundleService_RemoveSettingFromBundleURL = function(parameters = {}) {
|
||||
let queryParameters = {}
|
||||
const domain = parameters.$domain ? parameters.$domain : getDomain()
|
||||
let path = '/api/v0/settings/bundles-remove-setting'
|
||||
if (parameters.$queryParameters) {
|
||||
Object.keys(parameters.$queryParameters).forEach(function(parameterName) {
|
||||
queryParameters[parameterName] = parameters.$queryParameters[parameterName]
|
||||
})
|
||||
}
|
||||
let keys = Object.keys(queryParameters)
|
||||
return domain + path + (keys.length > 0 ? '?' + (keys.map(key => key + '=' + encodeURIComponent(queryParameters[key])).join('&')) : '')
|
||||
}
|
||||
/**
|
||||
*
|
||||
* request: PermissionService_GetPermissionByID
|
||||
* url: PermissionService_GetPermissionByIDURL
|
||||
* method: PermissionService_GetPermissionByID_TYPE
|
||||
* raw_url: PermissionService_GetPermissionByID_RAW_URL
|
||||
* @param body -
|
||||
*/
|
||||
export const PermissionService_GetPermissionByID = function(parameters = {}) {
|
||||
const domain = parameters.$domain ? parameters.$domain : getDomain()
|
||||
const config = parameters.$config
|
||||
let path = '/api/v0/settings/permissions-get-by-id'
|
||||
let body
|
||||
let queryParameters = {}
|
||||
let form = {}
|
||||
if (parameters['body'] !== undefined) {
|
||||
body = parameters['body']
|
||||
}
|
||||
if (parameters['body'] === undefined) {
|
||||
return Promise.reject(new Error('Missing required parameter: body'))
|
||||
}
|
||||
if (parameters.$queryParameters) {
|
||||
Object.keys(parameters.$queryParameters).forEach(function(parameterName) {
|
||||
queryParameters[parameterName] = parameters.$queryParameters[parameterName]
|
||||
});
|
||||
}
|
||||
return request('post', domain + path, body, queryParameters, form, config)
|
||||
}
|
||||
export const PermissionService_GetPermissionByID_RAW_URL = function() {
|
||||
return '/api/v0/settings/permissions-get-by-id'
|
||||
}
|
||||
export const PermissionService_GetPermissionByID_TYPE = function() {
|
||||
return 'post'
|
||||
}
|
||||
export const PermissionService_GetPermissionByIDURL = function(parameters = {}) {
|
||||
let queryParameters = {}
|
||||
const domain = parameters.$domain ? parameters.$domain : getDomain()
|
||||
let path = '/api/v0/settings/permissions-get-by-id'
|
||||
if (parameters.$queryParameters) {
|
||||
Object.keys(parameters.$queryParameters).forEach(function(parameterName) {
|
||||
queryParameters[parameterName] = parameters.$queryParameters[parameterName]
|
||||
})
|
||||
}
|
||||
let keys = Object.keys(queryParameters)
|
||||
return domain + path + (keys.length > 0 ? '?' + (keys.map(key => key + '=' + encodeURIComponent(queryParameters[key])).join('&')) : '')
|
||||
}
|
||||
/**
|
||||
*
|
||||
* request: PermissionService_ListPermissionsByResource
|
||||
* url: PermissionService_ListPermissionsByResourceURL
|
||||
* method: PermissionService_ListPermissionsByResource_TYPE
|
||||
* raw_url: PermissionService_ListPermissionsByResource_RAW_URL
|
||||
* @param body -
|
||||
*/
|
||||
export const PermissionService_ListPermissionsByResource = function(parameters = {}) {
|
||||
const domain = parameters.$domain ? parameters.$domain : getDomain()
|
||||
const config = parameters.$config
|
||||
let path = '/api/v0/settings/permissions-list-by-resource'
|
||||
let body
|
||||
let queryParameters = {}
|
||||
let form = {}
|
||||
if (parameters['body'] !== undefined) {
|
||||
body = parameters['body']
|
||||
}
|
||||
if (parameters['body'] === undefined) {
|
||||
return Promise.reject(new Error('Missing required parameter: body'))
|
||||
}
|
||||
if (parameters.$queryParameters) {
|
||||
Object.keys(parameters.$queryParameters).forEach(function(parameterName) {
|
||||
queryParameters[parameterName] = parameters.$queryParameters[parameterName]
|
||||
});
|
||||
}
|
||||
return request('post', domain + path, body, queryParameters, form, config)
|
||||
}
|
||||
export const PermissionService_ListPermissionsByResource_RAW_URL = function() {
|
||||
return '/api/v0/settings/permissions-list-by-resource'
|
||||
}
|
||||
export const PermissionService_ListPermissionsByResource_TYPE = function() {
|
||||
return 'post'
|
||||
}
|
||||
export const PermissionService_ListPermissionsByResourceURL = function(parameters = {}) {
|
||||
let queryParameters = {}
|
||||
const domain = parameters.$domain ? parameters.$domain : getDomain()
|
||||
let path = '/api/v0/settings/permissions-list-by-resource'
|
||||
if (parameters.$queryParameters) {
|
||||
Object.keys(parameters.$queryParameters).forEach(function(parameterName) {
|
||||
queryParameters[parameterName] = parameters.$queryParameters[parameterName]
|
||||
})
|
||||
}
|
||||
let keys = Object.keys(queryParameters)
|
||||
return domain + path + (keys.length > 0 ? '?' + (keys.map(key => key + '=' + encodeURIComponent(queryParameters[key])).join('&')) : '')
|
||||
}
|
||||
/**
|
||||
*
|
||||
* request: RoleService_ListRoles
|
||||
* url: RoleService_ListRolesURL
|
||||
* method: RoleService_ListRoles_TYPE
|
||||
* raw_url: RoleService_ListRoles_RAW_URL
|
||||
* @param body -
|
||||
*/
|
||||
export const RoleService_ListRoles = function(parameters = {}) {
|
||||
const domain = parameters.$domain ? parameters.$domain : getDomain()
|
||||
const config = parameters.$config
|
||||
let path = '/api/v0/settings/roles-list'
|
||||
let body
|
||||
let queryParameters = {}
|
||||
let form = {}
|
||||
if (parameters['body'] !== undefined) {
|
||||
body = parameters['body']
|
||||
}
|
||||
if (parameters['body'] === undefined) {
|
||||
return Promise.reject(new Error('Missing required parameter: body'))
|
||||
}
|
||||
if (parameters.$queryParameters) {
|
||||
Object.keys(parameters.$queryParameters).forEach(function(parameterName) {
|
||||
queryParameters[parameterName] = parameters.$queryParameters[parameterName]
|
||||
});
|
||||
}
|
||||
return request('post', domain + path, body, queryParameters, form, config)
|
||||
}
|
||||
export const RoleService_ListRoles_RAW_URL = function() {
|
||||
return '/api/v0/settings/roles-list'
|
||||
}
|
||||
export const RoleService_ListRoles_TYPE = function() {
|
||||
return 'post'
|
||||
}
|
||||
export const RoleService_ListRolesURL = function(parameters = {}) {
|
||||
let queryParameters = {}
|
||||
const domain = parameters.$domain ? parameters.$domain : getDomain()
|
||||
let path = '/api/v0/settings/roles-list'
|
||||
if (parameters.$queryParameters) {
|
||||
Object.keys(parameters.$queryParameters).forEach(function(parameterName) {
|
||||
queryParameters[parameterName] = parameters.$queryParameters[parameterName]
|
||||
})
|
||||
}
|
||||
let keys = Object.keys(queryParameters)
|
||||
return domain + path + (keys.length > 0 ? '?' + (keys.map(key => key + '=' + encodeURIComponent(queryParameters[key])).join('&')) : '')
|
||||
}
|
||||
/**
|
||||
*
|
||||
* request: ValueService_GetValue
|
||||
* url: ValueService_GetValueURL
|
||||
* method: ValueService_GetValue_TYPE
|
||||
* raw_url: ValueService_GetValue_RAW_URL
|
||||
* @param body -
|
||||
*/
|
||||
export const ValueService_GetValue = function(parameters = {}) {
|
||||
const domain = parameters.$domain ? parameters.$domain : getDomain()
|
||||
const config = parameters.$config
|
||||
let path = '/api/v0/settings/values-get'
|
||||
let body
|
||||
let queryParameters = {}
|
||||
let form = {}
|
||||
if (parameters['body'] !== undefined) {
|
||||
body = parameters['body']
|
||||
}
|
||||
if (parameters['body'] === undefined) {
|
||||
return Promise.reject(new Error('Missing required parameter: body'))
|
||||
}
|
||||
if (parameters.$queryParameters) {
|
||||
Object.keys(parameters.$queryParameters).forEach(function(parameterName) {
|
||||
queryParameters[parameterName] = parameters.$queryParameters[parameterName]
|
||||
});
|
||||
}
|
||||
return request('post', domain + path, body, queryParameters, form, config)
|
||||
}
|
||||
export const ValueService_GetValue_RAW_URL = function() {
|
||||
return '/api/v0/settings/values-get'
|
||||
}
|
||||
export const ValueService_GetValue_TYPE = function() {
|
||||
return 'post'
|
||||
}
|
||||
export const ValueService_GetValueURL = function(parameters = {}) {
|
||||
let queryParameters = {}
|
||||
const domain = parameters.$domain ? parameters.$domain : getDomain()
|
||||
let path = '/api/v0/settings/values-get'
|
||||
if (parameters.$queryParameters) {
|
||||
Object.keys(parameters.$queryParameters).forEach(function(parameterName) {
|
||||
queryParameters[parameterName] = parameters.$queryParameters[parameterName]
|
||||
})
|
||||
}
|
||||
let keys = Object.keys(queryParameters)
|
||||
return domain + path + (keys.length > 0 ? '?' + (keys.map(key => key + '=' + encodeURIComponent(queryParameters[key])).join('&')) : '')
|
||||
}
|
||||
/**
|
||||
*
|
||||
* request: ValueService_GetValueByUniqueIdentifiers
|
||||
* url: ValueService_GetValueByUniqueIdentifiersURL
|
||||
* method: ValueService_GetValueByUniqueIdentifiers_TYPE
|
||||
* raw_url: ValueService_GetValueByUniqueIdentifiers_RAW_URL
|
||||
* @param body -
|
||||
*/
|
||||
export const ValueService_GetValueByUniqueIdentifiers = function(parameters = {}) {
|
||||
const domain = parameters.$domain ? parameters.$domain : getDomain()
|
||||
const config = parameters.$config
|
||||
let path = '/api/v0/settings/values-get-by-unique-identifiers'
|
||||
let body
|
||||
let queryParameters = {}
|
||||
let form = {}
|
||||
if (parameters['body'] !== undefined) {
|
||||
body = parameters['body']
|
||||
}
|
||||
if (parameters['body'] === undefined) {
|
||||
return Promise.reject(new Error('Missing required parameter: body'))
|
||||
}
|
||||
if (parameters.$queryParameters) {
|
||||
Object.keys(parameters.$queryParameters).forEach(function(parameterName) {
|
||||
queryParameters[parameterName] = parameters.$queryParameters[parameterName]
|
||||
});
|
||||
}
|
||||
return request('post', domain + path, body, queryParameters, form, config)
|
||||
}
|
||||
export const ValueService_GetValueByUniqueIdentifiers_RAW_URL = function() {
|
||||
return '/api/v0/settings/values-get-by-unique-identifiers'
|
||||
}
|
||||
export const ValueService_GetValueByUniqueIdentifiers_TYPE = function() {
|
||||
return 'post'
|
||||
}
|
||||
export const ValueService_GetValueByUniqueIdentifiersURL = function(parameters = {}) {
|
||||
let queryParameters = {}
|
||||
const domain = parameters.$domain ? parameters.$domain : getDomain()
|
||||
let path = '/api/v0/settings/values-get-by-unique-identifiers'
|
||||
if (parameters.$queryParameters) {
|
||||
Object.keys(parameters.$queryParameters).forEach(function(parameterName) {
|
||||
queryParameters[parameterName] = parameters.$queryParameters[parameterName]
|
||||
})
|
||||
}
|
||||
let keys = Object.keys(queryParameters)
|
||||
return domain + path + (keys.length > 0 ? '?' + (keys.map(key => key + '=' + encodeURIComponent(queryParameters[key])).join('&')) : '')
|
||||
}
|
||||
/**
|
||||
*
|
||||
* request: ValueService_ListValues
|
||||
* url: ValueService_ListValuesURL
|
||||
* method: ValueService_ListValues_TYPE
|
||||
* raw_url: ValueService_ListValues_RAW_URL
|
||||
* @param body -
|
||||
*/
|
||||
export const ValueService_ListValues = function(parameters = {}) {
|
||||
const domain = parameters.$domain ? parameters.$domain : getDomain()
|
||||
const config = parameters.$config
|
||||
let path = '/api/v0/settings/values-list'
|
||||
let body
|
||||
let queryParameters = {}
|
||||
let form = {}
|
||||
if (parameters['body'] !== undefined) {
|
||||
body = parameters['body']
|
||||
}
|
||||
if (parameters['body'] === undefined) {
|
||||
return Promise.reject(new Error('Missing required parameter: body'))
|
||||
}
|
||||
if (parameters.$queryParameters) {
|
||||
Object.keys(parameters.$queryParameters).forEach(function(parameterName) {
|
||||
queryParameters[parameterName] = parameters.$queryParameters[parameterName]
|
||||
});
|
||||
}
|
||||
return request('post', domain + path, body, queryParameters, form, config)
|
||||
}
|
||||
export const ValueService_ListValues_RAW_URL = function() {
|
||||
return '/api/v0/settings/values-list'
|
||||
}
|
||||
export const ValueService_ListValues_TYPE = function() {
|
||||
return 'post'
|
||||
}
|
||||
export const ValueService_ListValuesURL = function(parameters = {}) {
|
||||
let queryParameters = {}
|
||||
const domain = parameters.$domain ? parameters.$domain : getDomain()
|
||||
let path = '/api/v0/settings/values-list'
|
||||
if (parameters.$queryParameters) {
|
||||
Object.keys(parameters.$queryParameters).forEach(function(parameterName) {
|
||||
queryParameters[parameterName] = parameters.$queryParameters[parameterName]
|
||||
})
|
||||
}
|
||||
let keys = Object.keys(queryParameters)
|
||||
return domain + path + (keys.length > 0 ? '?' + (keys.map(key => key + '=' + encodeURIComponent(queryParameters[key])).join('&')) : '')
|
||||
}
|
||||
/**
|
||||
*
|
||||
* request: ValueService_SaveValue
|
||||
* url: ValueService_SaveValueURL
|
||||
* method: ValueService_SaveValue_TYPE
|
||||
* raw_url: ValueService_SaveValue_RAW_URL
|
||||
* @param body -
|
||||
*/
|
||||
export const ValueService_SaveValue = function(parameters = {}) {
|
||||
const domain = parameters.$domain ? parameters.$domain : getDomain()
|
||||
const config = parameters.$config
|
||||
let path = '/api/v0/settings/values-save'
|
||||
let body
|
||||
let queryParameters = {}
|
||||
let form = {}
|
||||
if (parameters['body'] !== undefined) {
|
||||
body = parameters['body']
|
||||
}
|
||||
if (parameters['body'] === undefined) {
|
||||
return Promise.reject(new Error('Missing required parameter: body'))
|
||||
}
|
||||
if (parameters.$queryParameters) {
|
||||
Object.keys(parameters.$queryParameters).forEach(function(parameterName) {
|
||||
queryParameters[parameterName] = parameters.$queryParameters[parameterName]
|
||||
});
|
||||
}
|
||||
return request('post', domain + path, body, queryParameters, form, config)
|
||||
}
|
||||
export const ValueService_SaveValue_RAW_URL = function() {
|
||||
return '/api/v0/settings/values-save'
|
||||
}
|
||||
export const ValueService_SaveValue_TYPE = function() {
|
||||
return 'post'
|
||||
}
|
||||
export const ValueService_SaveValueURL = function(parameters = {}) {
|
||||
let queryParameters = {}
|
||||
const domain = parameters.$domain ? parameters.$domain : getDomain()
|
||||
let path = '/api/v0/settings/values-save'
|
||||
if (parameters.$queryParameters) {
|
||||
Object.keys(parameters.$queryParameters).forEach(function(parameterName) {
|
||||
queryParameters[parameterName] = parameters.$queryParameters[parameterName]
|
||||
})
|
||||
}
|
||||
let keys = Object.keys(queryParameters)
|
||||
return domain + path + (keys.length > 0 ? '?' + (keys.map(key => key + '=' + encodeURIComponent(queryParameters[key])).join('&')) : '')
|
||||
}
|
||||
@@ -1,158 +0,0 @@
|
||||
<template>
|
||||
<div class="oc-p">
|
||||
<main class="oc-flex oc-flex-column" id="settings-app">
|
||||
<template v-if="initialized">
|
||||
<oc-alert v-if="extensions.length === 0" variation="primary" no-close>
|
||||
<p class="oc-flex oc-flex-middle">
|
||||
<oc-icon name="information" class="oc-mr-s" />
|
||||
<translate>No settings available</translate>
|
||||
</p>
|
||||
</oc-alert>
|
||||
<template v-else>
|
||||
<template v-if="selectedExtensionName">
|
||||
<div class="oc-flex oc-flex-between oc-flex-middle">
|
||||
<h1 class="oc-page-title">
|
||||
{{ selectedExtensionName }}
|
||||
</h1>
|
||||
</div>
|
||||
<hr />
|
||||
</template>
|
||||
<template v-if="settingsValuesLoaded">
|
||||
<settings-bundle
|
||||
v-for="bundle in selectedBundles"
|
||||
:key="'bundle-' + bundle.id"
|
||||
:bundle="bundle"
|
||||
class="oc-mt"
|
||||
/>
|
||||
</template>
|
||||
<div class="oc-mt" v-else>
|
||||
<oc-loader :aria-label="$gettext('Loading personal settings')" />
|
||||
<oc-alert :aria-hidden="true" variation="primary" no-close>
|
||||
<p v-translate>Loading personal settings...</p>
|
||||
</oc-alert>
|
||||
</div>
|
||||
</template>
|
||||
</template>
|
||||
<oc-loader v-else />
|
||||
</main>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { mapActions, mapGetters, mapMutations } from 'vuex'
|
||||
import SettingsBundle from './SettingsBundle.vue'
|
||||
|
||||
export default {
|
||||
name: 'SettingsApp',
|
||||
components: { SettingsBundle },
|
||||
data () {
|
||||
return {
|
||||
loading: true,
|
||||
selectedExtension: undefined
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
...mapGetters(['settingsValuesLoaded', 'getNavItems']),
|
||||
...mapGetters('Settings', [
|
||||
'extensions',
|
||||
'initialized',
|
||||
'getBundlesByExtension'
|
||||
]),
|
||||
extensionRouteParam () {
|
||||
return this.$route.params.extension
|
||||
},
|
||||
selectedExtensionName () {
|
||||
return this.getExtensionName(this.selectedExtension)
|
||||
},
|
||||
selectedBundles () {
|
||||
if (this.selectedExtension) {
|
||||
return this.getBundlesByExtension(this.selectedExtension)
|
||||
}
|
||||
return []
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
...mapActions('Settings', ['initialize']),
|
||||
...mapMutations(['ADD_NAV_ITEM']),
|
||||
resetSelectedExtension () {
|
||||
if (this.extensions.length > 0) {
|
||||
if (
|
||||
this.extensionRouteParam &&
|
||||
this.extensions.includes(this.extensionRouteParam)
|
||||
) {
|
||||
this.selectedExtension = this.extensionRouteParam
|
||||
} else {
|
||||
this.selectedExtension = this.extensions[0]
|
||||
}
|
||||
}
|
||||
},
|
||||
resetMenuItems () {
|
||||
this.extensions.forEach((extension) => {
|
||||
/*
|
||||
* TODO:
|
||||
* a) set up a map with possible extensions and icons?
|
||||
* or b) let extensions register app info like displayName + icon?
|
||||
* https://github.com/owncloud/ocis/settings/issues/27
|
||||
*/
|
||||
const navItem = {
|
||||
name: this.getExtensionName(extension),
|
||||
icon: this.getExtensionIcon(extension),
|
||||
route: {
|
||||
name: 'settings',
|
||||
path: `/settings/${extension}`
|
||||
},
|
||||
menu: 'user'
|
||||
}
|
||||
this.ADD_NAV_ITEM({
|
||||
extension: 'settings',
|
||||
navItem
|
||||
})
|
||||
})
|
||||
},
|
||||
getExtensionName (extension) {
|
||||
extension = extension || ''
|
||||
switch (extension) {
|
||||
case 'ocis-accounts':
|
||||
return this.$gettext('Account')
|
||||
case 'ocis-hello':
|
||||
return this.$gettext('Hello')
|
||||
default: {
|
||||
const shortenedName = extension.replace('ocis-', '')
|
||||
return shortenedName.charAt(0).toUpperCase() + shortenedName.slice(1)
|
||||
}
|
||||
}
|
||||
},
|
||||
getExtensionIcon (extension) {
|
||||
extension = extension || ''
|
||||
switch (extension) {
|
||||
case 'ocis-accounts':
|
||||
return 'team'
|
||||
case 'ocis-hello':
|
||||
return 'tag_faces'
|
||||
default:
|
||||
return 'application'
|
||||
}
|
||||
}
|
||||
},
|
||||
created () {
|
||||
this.initialize()
|
||||
},
|
||||
watch: {
|
||||
'$language.current': {
|
||||
handler () {
|
||||
this.resetMenuItems()
|
||||
}
|
||||
},
|
||||
initialized: {
|
||||
handler () {
|
||||
this.resetMenuItems()
|
||||
this.resetSelectedExtension()
|
||||
},
|
||||
immediate: true
|
||||
},
|
||||
extensionRouteParam () {
|
||||
this.resetSelectedExtension()
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -1,80 +0,0 @@
|
||||
<template>
|
||||
<div class="oc-width-1-1 oc-width-2-3@m oc-width-1-2@l oc-width-1-3@xl">
|
||||
<h2 class="oc-mb-s">
|
||||
<translate>{{ bundle.displayName }}</translate>
|
||||
</h2>
|
||||
<oc-grid gutter="small">
|
||||
<template>
|
||||
<div
|
||||
class="oc-width-1-1"
|
||||
v-for="setting in bundle.settings"
|
||||
:key="setting.id"
|
||||
>
|
||||
<label class="oc-label" :for="setting.id">{{
|
||||
setting.displayName
|
||||
}}</label>
|
||||
<div
|
||||
class="oc-position-relative"
|
||||
:is="getSettingComponent(setting)"
|
||||
:id="setting.id"
|
||||
:bundle="bundle"
|
||||
:setting="setting"
|
||||
:persisted-value="getValue(setting)"
|
||||
@onSave="onSaveValue"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
</oc-grid>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import assign from 'lodash-es/assign'
|
||||
import { mapGetters, mapActions } from 'vuex'
|
||||
import SettingBoolean from './settings/SettingBoolean.vue'
|
||||
import SettingMultiChoice from './settings/SettingMultiChoice.vue'
|
||||
import SettingNumber from './settings/SettingNumber.vue'
|
||||
import SettingSingleChoice from './settings/SettingSingleChoice.vue'
|
||||
import SettingString from './settings/SettingString.vue'
|
||||
import SettingUnknown from './settings/SettingUnknown.vue'
|
||||
export default {
|
||||
name: 'SettingsBundle',
|
||||
props: {
|
||||
bundle: {
|
||||
type: Object,
|
||||
required: true
|
||||
}
|
||||
},
|
||||
computed: mapGetters(['getSettingsValue']),
|
||||
methods: {
|
||||
...mapActions('Settings', ['saveValue']),
|
||||
getSettingComponent (setting) {
|
||||
return 'Setting' + setting.type[0].toUpperCase() + setting.type.slice(1)
|
||||
},
|
||||
getValue (setting) {
|
||||
return this.getSettingsValue({ settingId: setting.id })
|
||||
},
|
||||
async onSaveValue ({ bundle, setting, payload }) {
|
||||
payload = assign({}, payload, {
|
||||
bundleId: bundle.id,
|
||||
settingId: setting.id,
|
||||
accountUuid: 'me',
|
||||
resource: setting.resource
|
||||
})
|
||||
await this.saveValue({
|
||||
bundle,
|
||||
setting,
|
||||
payload
|
||||
})
|
||||
}
|
||||
},
|
||||
components: {
|
||||
SettingBoolean,
|
||||
SettingMultiChoice,
|
||||
SettingNumber,
|
||||
SettingSingleChoice,
|
||||
SettingString,
|
||||
SettingUnknown
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -1,55 +0,0 @@
|
||||
<template>
|
||||
<div>
|
||||
<oc-checkbox v-model="value" :label="setting.boolValue.label" @change="applyValue" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import isNil from 'lodash-es/isNil'
|
||||
export default {
|
||||
name: 'SettingBoolean',
|
||||
props: {
|
||||
bundle: {
|
||||
type: Object,
|
||||
required: true
|
||||
},
|
||||
setting: {
|
||||
type: Object,
|
||||
required: true
|
||||
},
|
||||
persistedValue: {
|
||||
type: Object,
|
||||
required: false
|
||||
}
|
||||
},
|
||||
data () {
|
||||
return {
|
||||
value: null
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
async applyValue () {
|
||||
const payload = {
|
||||
boolValue: this.value
|
||||
}
|
||||
if (!isNil(this.persistedValue)) {
|
||||
payload.id = this.persistedValue.id
|
||||
}
|
||||
await this.$emit('onSave', {
|
||||
bundle: this.bundle,
|
||||
setting: this.setting,
|
||||
payload
|
||||
})
|
||||
// TODO: show a spinner while the request for saving the value is running!
|
||||
}
|
||||
},
|
||||
mounted () {
|
||||
if (!isNil(this.persistedValue)) {
|
||||
this.value = this.persistedValue.boolValue
|
||||
}
|
||||
if (isNil(this.value) && !isNil(this.setting.boolValue.default)) {
|
||||
this.value = this.setting.boolValue.default
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -1,107 +0,0 @@
|
||||
<template>
|
||||
<oc-select
|
||||
:clearable="false"
|
||||
:options="displayOptions"
|
||||
:model-value="selectedOption"
|
||||
@update:modelValue="onSelectedOption"
|
||||
multiple
|
||||
/>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import isNil from 'lodash-es/isNil'
|
||||
export default {
|
||||
name: 'SettingMultiChoice',
|
||||
props: {
|
||||
bundle: {
|
||||
type: Object,
|
||||
required: true
|
||||
},
|
||||
setting: {
|
||||
type: Object,
|
||||
required: true
|
||||
},
|
||||
persistedValue: {
|
||||
type: Object,
|
||||
required: false
|
||||
}
|
||||
},
|
||||
data () {
|
||||
return {
|
||||
selectedOptions: []
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
displayOptions () {
|
||||
return this.setting.multiChoiceValue.options.map(val => val.displayValue)
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
async onSelectedOption (event) {
|
||||
this.selectedOptions = event
|
||||
const values = []
|
||||
if (!isNil(this.selectedOptions)) {
|
||||
this.selectedOptions.forEach(displayValue => {
|
||||
const option = this.setting.multiChoiceValue.options.find(val => val.displayValue === displayValue)
|
||||
|
||||
if (option.value.intValue) {
|
||||
values.push({ intValue: option.value.intValue })
|
||||
}
|
||||
if (option.value.stringValue) {
|
||||
values.push({ stringValue: option.value.stringValue })
|
||||
}
|
||||
})
|
||||
}
|
||||
const payload = {
|
||||
listValue: {
|
||||
values
|
||||
}
|
||||
}
|
||||
if (!isNil(this.persistedValue)) {
|
||||
payload.id = this.persistedValue.id
|
||||
}
|
||||
await this.$emit('onSave', {
|
||||
bundle: this.bundle,
|
||||
setting: this.setting,
|
||||
payload
|
||||
})
|
||||
// TODO: show a spinner while the request for saving the value is running!
|
||||
}
|
||||
},
|
||||
mounted () {
|
||||
if (!isNil(this.persistedValue) && !isNil(this.persistedValue.listValue)) {
|
||||
const selectedValues = []
|
||||
if (this.persistedValue.listValue.values) {
|
||||
this.persistedValue.listValue.values.forEach(value => {
|
||||
if (value.intValue) {
|
||||
selectedValues.push(value.intValue)
|
||||
}
|
||||
if (value.stringValue) {
|
||||
selectedValues.push(value.stringValue)
|
||||
}
|
||||
})
|
||||
}
|
||||
if (selectedValues.length === 0) {
|
||||
this.selectedOptions = []
|
||||
} else {
|
||||
this.selectedOptions = this.setting.multiChoiceValue.options.filter(option => {
|
||||
if (option.value.intValue) {
|
||||
return selectedValues.includes(option.value.intValue)
|
||||
}
|
||||
if (option.value.stringValue) {
|
||||
return selectedValues.includes(option.value.stringValue)
|
||||
}
|
||||
return false
|
||||
}).map(val => val.displayValue)
|
||||
}
|
||||
}
|
||||
// TODO: load the settings value of the authenticated user and set it in `selectedOptions`
|
||||
// if not set, yet, apply defaults from settings bundle definition
|
||||
if (this.selectedOptions === null) {
|
||||
this.selectedOptions = this.setting.multiChoiceValue.options
|
||||
.filter(option => option.default)
|
||||
.map(val => val.displayValue)
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -1,97 +0,0 @@
|
||||
<template>
|
||||
<oc-grid flex>
|
||||
<div class="oc-width-expand">
|
||||
<oc-text-input
|
||||
type="number"
|
||||
v-model="value"
|
||||
v-bind="inputAttributes"
|
||||
:placeholder="setting.intValue.placeholder"
|
||||
:label="setting.description"
|
||||
@keydown.enter="applyValue"
|
||||
@keydown.esc="cancel"
|
||||
/>
|
||||
</div>
|
||||
<div v-if="isChanged">
|
||||
<oc-button @click="cancel" class="oc-ml-s">
|
||||
<translate>Cancel</translate>
|
||||
</oc-button>
|
||||
<oc-button @click="applyValue" class="oc-ml-s" variation="primary">
|
||||
<translate>Save</translate>
|
||||
</oc-button>
|
||||
</div>
|
||||
</oc-grid>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import isNil from 'lodash-es/isNil'
|
||||
export default {
|
||||
name: 'SettingNumber',
|
||||
props: {
|
||||
bundle: {
|
||||
type: Object,
|
||||
required: true
|
||||
},
|
||||
setting: {
|
||||
type: Object,
|
||||
required: true
|
||||
},
|
||||
persistedValue: {
|
||||
type: Object,
|
||||
required: false
|
||||
}
|
||||
},
|
||||
data () {
|
||||
return {
|
||||
initialValue: null,
|
||||
value: null
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
isChanged () {
|
||||
return this.initialValue !== this.value
|
||||
},
|
||||
inputAttributes () {
|
||||
const attributes = {}
|
||||
if (!isNil(this.setting.intValue.min)) {
|
||||
attributes.min = this.setting.intValue.min
|
||||
}
|
||||
if (!isNil(this.setting.intValue.max)) {
|
||||
attributes.max = this.setting.intValue.max
|
||||
}
|
||||
if (!isNil(this.setting.intValue.step)) {
|
||||
attributes.step = this.setting.intValue.step
|
||||
}
|
||||
return attributes
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
cancel () {
|
||||
this.value = this.initialValue
|
||||
},
|
||||
async applyValue () {
|
||||
const payload = {
|
||||
intValue: this.value
|
||||
}
|
||||
if (!isNil(this.persistedValue)) {
|
||||
payload.id = this.persistedValue.id
|
||||
}
|
||||
await this.$emit('onSave', {
|
||||
bundle: this.bundle,
|
||||
setting: this.setting,
|
||||
payload
|
||||
})
|
||||
// TODO: show a spinner while the request for saving the value is running!
|
||||
this.initialValue = this.value
|
||||
}
|
||||
},
|
||||
mounted () {
|
||||
if (!isNil(this.persistedValue)) {
|
||||
this.value = this.persistedValue.intValue
|
||||
}
|
||||
if (isNil(this.value) && !isNil(this.setting.intValue.default)) {
|
||||
this.value = this.setting.intValue.default
|
||||
}
|
||||
this.initialValue = this.value
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -1,93 +0,0 @@
|
||||
<template>
|
||||
<div>
|
||||
<oc-select
|
||||
:clearable="false"
|
||||
:options="displayOptions"
|
||||
:model-value="selectedOption"
|
||||
@update:modelValue="onSelectedOption"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import isNil from 'lodash-es/isNil'
|
||||
export default {
|
||||
name: 'SettingSingleChoice',
|
||||
props: {
|
||||
bundle: {
|
||||
type: Object,
|
||||
required: true
|
||||
},
|
||||
setting: {
|
||||
type: Object,
|
||||
required: true
|
||||
},
|
||||
persistedValue: {
|
||||
type: Object,
|
||||
required: false
|
||||
}
|
||||
},
|
||||
data () {
|
||||
return {
|
||||
selectedOption: null
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
displayOptions () {
|
||||
return this.setting.singleChoiceValue.options.map(val => val.displayValue)
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
async onSelectedOption (event) {
|
||||
this.selectedOption = event
|
||||
const values = []
|
||||
if (!isNil(this.selectedOption)) {
|
||||
const option = this.setting.singleChoiceValue.options.find(val => val.displayValue === this.selectedOption)
|
||||
|
||||
if (option.value.intValue) {
|
||||
values.push({ intValue: option.value.intValue })
|
||||
}
|
||||
if (option.value.stringValue) {
|
||||
values.push({ stringValue: option.value.stringValue })
|
||||
}
|
||||
}
|
||||
const payload = {
|
||||
listValue: {
|
||||
values
|
||||
}
|
||||
}
|
||||
if (!isNil(this.persistedValue)) {
|
||||
payload.id = this.persistedValue.id
|
||||
}
|
||||
await this.$emit('onSave', {
|
||||
bundle: this.bundle,
|
||||
setting: this.setting,
|
||||
payload
|
||||
})
|
||||
// TODO: show a spinner while the request for saving the value is running!
|
||||
}
|
||||
},
|
||||
mounted () {
|
||||
if (!isNil(this.persistedValue) && !isNil(this.persistedValue.listValue)) {
|
||||
const selected = this.persistedValue.listValue.values[0]
|
||||
const filtered = this.setting.singleChoiceValue.options.filter(option => {
|
||||
if (selected.intValue) {
|
||||
return option.value.intValue === selected.intValue
|
||||
} else {
|
||||
return option.value.stringValue === selected.stringValue
|
||||
}
|
||||
})
|
||||
if (filtered.length > 0) {
|
||||
this.selectedOption = filtered[0].displayValue
|
||||
}
|
||||
}
|
||||
// if not set, yet, apply default from settings bundle definition
|
||||
if (isNil(this.selectedOption)) {
|
||||
const defaults = this.setting.singleChoiceValue.options.filter(option => option.default)
|
||||
if (defaults.length === 1) {
|
||||
this.selectedOption = defaults[0].displayValue
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -1,82 +0,0 @@
|
||||
<template>
|
||||
<oc-grid flex>
|
||||
<div class="oc-width-expand">
|
||||
<oc-text-input
|
||||
v-model="value"
|
||||
:placeholder="setting.stringValue.placeholder"
|
||||
:label="setting.description"
|
||||
@keydown.enter="applyValue"
|
||||
@keydown.esc="cancel"
|
||||
/>
|
||||
</div>
|
||||
<div v-if="isChanged">
|
||||
<oc-button @click="cancel" class="oc-ml-s">
|
||||
<translate>Cancel</translate>
|
||||
</oc-button>
|
||||
<oc-button @click="applyValue" class="oc-ml-s" variation="primary">
|
||||
<translate>Save</translate>
|
||||
</oc-button>
|
||||
</div>
|
||||
</oc-grid>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import isNil from 'lodash-es/isNil'
|
||||
export default {
|
||||
name: 'SettingString',
|
||||
props: {
|
||||
bundle: {
|
||||
type: Object,
|
||||
required: true
|
||||
},
|
||||
setting: {
|
||||
type: Object,
|
||||
required: true
|
||||
},
|
||||
persistedValue: {
|
||||
type: Object,
|
||||
required: false
|
||||
}
|
||||
},
|
||||
data () {
|
||||
return {
|
||||
initialValue: null,
|
||||
value: null
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
isChanged () {
|
||||
return this.initialValue !== this.value
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
async applyValue () {
|
||||
const payload = {
|
||||
stringValue: this.value
|
||||
}
|
||||
if (!isNil(this.persistedValue)) {
|
||||
payload.id = this.persistedValue.id
|
||||
}
|
||||
await this.$emit('onSave', {
|
||||
bundle: this.bundle,
|
||||
setting: this.setting,
|
||||
payload
|
||||
})
|
||||
// TODO: show a spinner while the request for saving the value is running!
|
||||
this.initialValue = this.value
|
||||
},
|
||||
cancel () {
|
||||
this.value = this.initialValue
|
||||
}
|
||||
},
|
||||
mounted () {
|
||||
if (!isNil(this.persistedValue)) {
|
||||
this.value = this.persistedValue.stringValue
|
||||
}
|
||||
if (isNil(this.value) && !isNil(this.setting.stringValue.default)) {
|
||||
this.value = this.setting.stringValue.default
|
||||
}
|
||||
this.initialValue = this.value
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -1,25 +0,0 @@
|
||||
<template>
|
||||
<div>
|
||||
<translate :translate-params="{ type: setting.type }">Settings type not implemented: %{type}</translate>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'SettingUnknown',
|
||||
props: {
|
||||
bundle: {
|
||||
type: Object,
|
||||
required: true
|
||||
},
|
||||
setting: {
|
||||
type: Object,
|
||||
required: true
|
||||
},
|
||||
persistedValue: {
|
||||
type: Object,
|
||||
required: false
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -1,14 +0,0 @@
|
||||
/**
|
||||
* This file contains strings that should be synced to transifex but not exist in the UI directly,
|
||||
* moreover, they get loaded for example by API requests
|
||||
*/
|
||||
|
||||
// just a dummy function to trick gettext tools
|
||||
function $gettext (msg) {
|
||||
return msg
|
||||
}
|
||||
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const dictionary = [
|
||||
$gettext('Language')
|
||||
]
|
||||
@@ -1,125 +0,0 @@
|
||||
import {
|
||||
// eslint-disable-next-line camelcase
|
||||
BundleService_ListBundles,
|
||||
// eslint-disable-next-line camelcase
|
||||
ValueService_SaveValue
|
||||
} from '../client/settings'
|
||||
import axios from 'axios'
|
||||
import keyBy from 'lodash-es/keyBy'
|
||||
|
||||
const state = {
|
||||
initialized: false,
|
||||
bundles: {}
|
||||
}
|
||||
|
||||
const getters = {
|
||||
initialized: state => state.initialized,
|
||||
extensions: state => {
|
||||
return [...new Set(Object.values(state.bundles).map(bundle => bundle.extension))].sort()
|
||||
},
|
||||
getBundlesByExtension: state => extension => {
|
||||
return Object.values(state.bundles)
|
||||
.filter(bundle => bundle.extension === extension)
|
||||
.sort((b1, b2) => {
|
||||
return b1.name.localeCompare(b2.name)
|
||||
})
|
||||
},
|
||||
getServerForJsClient: (state, getters, rootState, rootGetters) => rootGetters.configuration.server.replace(/\/$/, '')
|
||||
}
|
||||
|
||||
const mutations = {
|
||||
SET_INITIALIZED (state, value) {
|
||||
state.initialized = value
|
||||
},
|
||||
SET_BUNDLES (state, bundles) {
|
||||
state.bundles = keyBy(bundles, 'id')
|
||||
}
|
||||
}
|
||||
|
||||
const actions = {
|
||||
async initialize ({ commit, dispatch }) {
|
||||
await dispatch('fetchBundles')
|
||||
commit('SET_INITIALIZED', true)
|
||||
},
|
||||
|
||||
async fetchBundles ({ commit, dispatch, getters, rootGetters }) {
|
||||
injectAuthToken(rootGetters)
|
||||
try {
|
||||
const response = await BundleService_ListBundles({
|
||||
$domain: getters.getServerForJsClient,
|
||||
body: {}
|
||||
})
|
||||
if (response.status === 201) {
|
||||
// the settings markup has implicit typing. inject an explicit type variable here
|
||||
const bundles = response.data.bundles
|
||||
if (bundles) {
|
||||
bundles.forEach(bundle => {
|
||||
bundle.settings.forEach(setting => {
|
||||
if (setting.intValue) {
|
||||
setting.type = 'number'
|
||||
} else if (setting.stringValue) {
|
||||
setting.type = 'string'
|
||||
} else if (setting.boolValue) {
|
||||
setting.type = 'boolean'
|
||||
} else if (setting.singleChoiceValue) {
|
||||
setting.type = 'singleChoice'
|
||||
} else if (setting.multiChoiceValue) {
|
||||
setting.type = 'multiChoice'
|
||||
} else {
|
||||
setting.type = 'unknown'
|
||||
}
|
||||
})
|
||||
})
|
||||
commit('SET_BUNDLES', bundles)
|
||||
} else {
|
||||
commit('SET_BUNDLES', [])
|
||||
}
|
||||
}
|
||||
} catch (err) {
|
||||
dispatch('showMessage', {
|
||||
title: 'Failed to fetch bundles.',
|
||||
status: 'danger'
|
||||
}, { root: true })
|
||||
}
|
||||
},
|
||||
|
||||
async saveValue ({ commit, dispatch, getters, rootGetters }, { setting, payload }) {
|
||||
injectAuthToken(rootGetters)
|
||||
try {
|
||||
const response = await ValueService_SaveValue({
|
||||
$domain: getters.getServerForJsClient,
|
||||
body: {
|
||||
value: payload
|
||||
}
|
||||
})
|
||||
if (response.status === 201 && response.data.value) {
|
||||
commit('SET_SETTINGS_VALUE', response.data.value, { root: true })
|
||||
}
|
||||
} catch (e) {
|
||||
dispatch('showMessage', {
|
||||
title: `Failed to save »${setting.displayName}«.`,
|
||||
status: 'danger'
|
||||
}, { root: true })
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export default {
|
||||
namespaced: true,
|
||||
state,
|
||||
getters,
|
||||
actions,
|
||||
mutations
|
||||
}
|
||||
|
||||
function injectAuthToken (rootGetters) {
|
||||
axios.interceptors.request.use(config => {
|
||||
if (typeof config.headers.Authorization === 'undefined') {
|
||||
const token = rootGetters['runtime/auth/accessToken']
|
||||
if (token) {
|
||||
config.headers.Authorization = `Bearer ${token}`
|
||||
}
|
||||
}
|
||||
return config
|
||||
})
|
||||
}
|
||||
@@ -53,8 +53,6 @@ policies:
|
||||
backend: http://localhost:9120
|
||||
- endpoint: /api/v0/settings
|
||||
backend: http://localhost:9190
|
||||
- endpoint: /settings.js
|
||||
backend: http://localhost:9190
|
||||
- name: oc10
|
||||
routes:
|
||||
- endpoint: "/"
|
||||
|
||||
Reference in New Issue
Block a user