chore: 清理 TachyBase 插件,移除临时的多进程通信代码
Reviewed-on: daoyoucloud/tachycode#707
This commit is contained in:
parent
f64a661e05
commit
4784973930
@ -1,36 +0,0 @@
|
|||||||
version: "3"
|
|
||||||
networks:
|
|
||||||
nocobase:
|
|
||||||
driver: bridge
|
|
||||||
services:
|
|
||||||
app:
|
|
||||||
image: nocobase/nocobase:latest
|
|
||||||
networks:
|
|
||||||
- nocobase
|
|
||||||
depends_on:
|
|
||||||
- mariadb
|
|
||||||
environment:
|
|
||||||
- APP_KEY=your-secret-key # Replace it with your own app key
|
|
||||||
- DB_DIALECT=mariadb
|
|
||||||
- DB_HOST=mariadb
|
|
||||||
- DB_DATABASE=nocobase
|
|
||||||
- DB_USER=nocobase
|
|
||||||
- DB_PASSWORD=nocobase
|
|
||||||
- DB_TIMEZONE=+08:00
|
|
||||||
- DB_UNDERSCORED=true
|
|
||||||
volumes:
|
|
||||||
- ./storage:/app/nocobase/storage
|
|
||||||
ports:
|
|
||||||
- "13000:80"
|
|
||||||
mariadb:
|
|
||||||
image: mariadb:latest
|
|
||||||
environment:
|
|
||||||
MYSQL_DATABASE: nocobase
|
|
||||||
MYSQL_USER: nocobase
|
|
||||||
MYSQL_PASSWORD: nocobase
|
|
||||||
MYSQL_ROOT_PASSWORD: nocobase
|
|
||||||
restart: always
|
|
||||||
volumes:
|
|
||||||
- ./storage/db/mariadb:/var/lib/mysql
|
|
||||||
networks:
|
|
||||||
- nocobase
|
|
@ -1,35 +0,0 @@
|
|||||||
version: "3"
|
|
||||||
networks:
|
|
||||||
nocobase:
|
|
||||||
driver: bridge
|
|
||||||
services:
|
|
||||||
app:
|
|
||||||
image: nocobase/nocobase:latest
|
|
||||||
networks:
|
|
||||||
- nocobase
|
|
||||||
depends_on:
|
|
||||||
- mysql
|
|
||||||
environment:
|
|
||||||
- APP_KEY=your-secret-key # Replace it with your own app key
|
|
||||||
- DB_DIALECT=mysql
|
|
||||||
- DB_HOST=mysql
|
|
||||||
- DB_DATABASE=nocobase
|
|
||||||
- DB_USER=root
|
|
||||||
- DB_PASSWORD=nocobase
|
|
||||||
- DB_TIMEZONE=+08:00
|
|
||||||
volumes:
|
|
||||||
- ./storage:/app/nocobase/storage
|
|
||||||
ports:
|
|
||||||
- "13000:80"
|
|
||||||
mysql:
|
|
||||||
image: mysql:latest
|
|
||||||
environment:
|
|
||||||
MYSQL_DATABASE: nocobase
|
|
||||||
MYSQL_USER: nocobase
|
|
||||||
MYSQL_PASSWORD: nocobase
|
|
||||||
MYSQL_ROOT_PASSWORD: nocobase
|
|
||||||
restart: always
|
|
||||||
volumes:
|
|
||||||
- ./storage/db/mysql:/var/lib/mysql
|
|
||||||
networks:
|
|
||||||
- nocobase
|
|
@ -1,34 +0,0 @@
|
|||||||
version: "3"
|
|
||||||
networks:
|
|
||||||
nocobase:
|
|
||||||
driver: bridge
|
|
||||||
services:
|
|
||||||
app:
|
|
||||||
image: nocobase/nocobase:latest
|
|
||||||
networks:
|
|
||||||
- nocobase
|
|
||||||
environment:
|
|
||||||
- APP_KEY=your-secret-key # Replace it with your own app key
|
|
||||||
- DB_DIALECT=postgres
|
|
||||||
- DB_HOST=postgres
|
|
||||||
- DB_DATABASE=nocobase
|
|
||||||
- DB_USER=nocobase
|
|
||||||
- DB_PASSWORD=nocobase
|
|
||||||
volumes:
|
|
||||||
- ./storage:/app/nocobase/storage
|
|
||||||
ports:
|
|
||||||
- "13000:80"
|
|
||||||
depends_on:
|
|
||||||
- postgres
|
|
||||||
postgres:
|
|
||||||
image: postgres:10
|
|
||||||
restart: always
|
|
||||||
command: postgres -c wal_level=logical
|
|
||||||
environment:
|
|
||||||
POSTGRES_USER: nocobase
|
|
||||||
POSTGRES_DB: nocobase
|
|
||||||
POSTGRES_PASSWORD: nocobase
|
|
||||||
volumes:
|
|
||||||
- ./storage/db/postgres:/var/lib/postgresql/data
|
|
||||||
networks:
|
|
||||||
- nocobase
|
|
@ -1,15 +0,0 @@
|
|||||||
version: "3"
|
|
||||||
networks:
|
|
||||||
nocobase:
|
|
||||||
driver: bridge
|
|
||||||
services:
|
|
||||||
app:
|
|
||||||
image: nocobase/nocobase:latest
|
|
||||||
networks:
|
|
||||||
- nocobase
|
|
||||||
environment:
|
|
||||||
- APP_KEY=your-secret-key # Replace it with your own app key
|
|
||||||
volumes:
|
|
||||||
- ./storage:/app/nocobase/storage
|
|
||||||
ports:
|
|
||||||
- "13000:80"
|
|
@ -1,19 +0,0 @@
|
|||||||
# 设置基础镜像
|
|
||||||
FROM node:20.9.0 as builder
|
|
||||||
|
|
||||||
# 在容器中创建/app/nocobase目录
|
|
||||||
WORKDIR /app/nocobase
|
|
||||||
|
|
||||||
# 设置npm和pnpm的registry为https://registry.npmmirror.com
|
|
||||||
RUN npm config set registry https://registry.npmmirror.com && \
|
|
||||||
yarn config set registry https://registry.npmmirror.com
|
|
||||||
|
|
||||||
# 将当前目录中的所有文件复制到容器的/app/nocobase目录下
|
|
||||||
COPY . /app/nocobase
|
|
||||||
|
|
||||||
# 使用 pnpm 安装依赖
|
|
||||||
RUN yarn
|
|
||||||
RUN yarn build
|
|
||||||
|
|
||||||
# 使用 pm2-runtime 执行packages/core/app/lib/index.js文件
|
|
||||||
CMD ["yarn", "pm2-runtime", "packages/core/app/lib/index.js", "--", "start"]
|
|
@ -1,19 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
set -e
|
|
||||||
|
|
||||||
nginx
|
|
||||||
echo 'nginx started';
|
|
||||||
|
|
||||||
cd /app/nocobase && yarn nocobase db:auth --retry=30
|
|
||||||
cd /app/nocobase && yarn nocobase install -s
|
|
||||||
cd /app/nocobase && yarn nocobase upgrade -S
|
|
||||||
cd /app/nocobase && yarn start
|
|
||||||
|
|
||||||
# Run command with node if the first argument contains a "-" or is not a system command. The last
|
|
||||||
# part inside the "{}" is a workaround for the following bug in ash/dash:
|
|
||||||
# https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=874264
|
|
||||||
if [ "${1#-}" != "${1}" ] || [ -z "$(command -v "${1}")" ] || { [ -f "${1}" ] && ! [ -x "${1}" ]; }; then
|
|
||||||
set -- node "$@"
|
|
||||||
fi
|
|
||||||
|
|
||||||
exec "$@"
|
|
@ -1,42 +0,0 @@
|
|||||||
log_format apm '"$time_local" client=$remote_addr '
|
|
||||||
'method=$request_method request="$request" '
|
|
||||||
'request_length=$request_length '
|
|
||||||
'status=$status bytes_sent=$bytes_sent '
|
|
||||||
'body_bytes_sent=$body_bytes_sent '
|
|
||||||
'referer=$http_referer '
|
|
||||||
'user_agent="$http_user_agent" '
|
|
||||||
'upstream_addr=$upstream_addr '
|
|
||||||
'upstream_status=$upstream_status '
|
|
||||||
'request_time=$request_time '
|
|
||||||
'upstream_response_time=$upstream_response_time '
|
|
||||||
'upstream_connect_time=$upstream_connect_time '
|
|
||||||
'upstream_header_time=$upstream_header_time';
|
|
||||||
|
|
||||||
server {
|
|
||||||
listen 80;
|
|
||||||
server_name _;
|
|
||||||
root /app/nocobase/packages/app/client/dist;
|
|
||||||
index index.html;
|
|
||||||
client_max_body_size 20M;
|
|
||||||
|
|
||||||
access_log /var/log/nginx/nocobase.log apm;
|
|
||||||
|
|
||||||
location /storage/uploads/ {
|
|
||||||
alias /app/nocobase/storage/uploads/;
|
|
||||||
autoindex off;
|
|
||||||
}
|
|
||||||
|
|
||||||
location / {
|
|
||||||
root /app/nocobase/packages/app/client/dist;
|
|
||||||
try_files $uri $uri/ /index.html;
|
|
||||||
}
|
|
||||||
|
|
||||||
location ^~ /api/ {
|
|
||||||
proxy_pass http://127.0.0.1:13000/api/;
|
|
||||||
proxy_http_version 1.1;
|
|
||||||
proxy_set_header Upgrade $http_upgrade;
|
|
||||||
proxy_set_header Connection 'upgrade';
|
|
||||||
proxy_set_header Host $host;
|
|
||||||
proxy_cache_bypass $http_upgrade;
|
|
||||||
}
|
|
||||||
}
|
|
@ -11,7 +11,7 @@ if [ ! -f "/app/nocobase/package.json" ]; then
|
|||||||
touch /app/nocobase/node_modules/@nocobase/app/dist/client/index.html
|
touch /app/nocobase/node_modules/@nocobase/app/dist/client/index.html
|
||||||
fi
|
fi
|
||||||
|
|
||||||
cd /app/nocobase && pnpm nocobase create-nginx-conf
|
cd /app/nocobase && pnpm tachybase create-nginx-conf
|
||||||
rm -rf /etc/nginx/sites-enabled/nocobase.conf
|
rm -rf /etc/nginx/sites-enabled/nocobase.conf
|
||||||
ln -s /app/nocobase/storage/nocobase.conf /etc/nginx/sites-enabled/nocobase.conf
|
ln -s /app/nocobase/storage/nocobase.conf /etc/nginx/sites-enabled/nocobase.conf
|
||||||
|
|
||||||
|
@ -27,6 +27,7 @@
|
|||||||
"tag:v": "changeset version",
|
"tag:v": "changeset version",
|
||||||
"tar": "tachybase tar",
|
"tar": "tachybase tar",
|
||||||
"tb": "tachybase",
|
"tb": "tachybase",
|
||||||
|
"tbi": "tachybase install",
|
||||||
"tc": "tachybase test:client",
|
"tc": "tachybase test:client",
|
||||||
"test": "tachybase test",
|
"test": "tachybase test",
|
||||||
"test:client": "tachybase test:client",
|
"test:client": "tachybase test:client",
|
||||||
@ -51,9 +52,9 @@
|
|||||||
"@commitlint/config-conventional": "^16.0.0",
|
"@commitlint/config-conventional": "^16.0.0",
|
||||||
"@commitlint/prompt-cli": "^16.1.0",
|
"@commitlint/prompt-cli": "^16.1.0",
|
||||||
"@nocobase/build": "workspace:*",
|
"@nocobase/build": "workspace:*",
|
||||||
"@nocobase/preset-nocobase": "workspace:*",
|
|
||||||
"@nocobase/test": "workspace:*",
|
"@nocobase/test": "workspace:*",
|
||||||
"@tachybase/cli": "workspace:*",
|
"@tachybase/cli": "workspace:*",
|
||||||
|
"@tachybase/preset-tachybase": "workspace:*",
|
||||||
"@types/react": "^18.2.73",
|
"@types/react": "^18.2.73",
|
||||||
"@types/react-dom": "^18.2.23",
|
"@types/react-dom": "^18.2.23",
|
||||||
"auto-changelog": "^2.4.0",
|
"auto-changelog": "^2.4.0",
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { Application } from '@nocobase/client';
|
import { Application } from '@nocobase/client';
|
||||||
import { NocoBaseClientPresetPlugin } from '@nocobase/preset-nocobase/client';
|
import { TachyBaseClientPresetPlugin } from '@tachybase/preset-tachybase/client';
|
||||||
import devDynamicImport from '../.plugins/index';
|
import devDynamicImport from '../.plugins/index';
|
||||||
|
|
||||||
export const app = new Application({
|
export const app = new Application({
|
||||||
@ -9,7 +9,7 @@ export const app = new Application({
|
|||||||
},
|
},
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
publicPath: window['__nocobase_public_path__'] || process.env.APP_PUBLIC_PATH || '/',
|
publicPath: window['__nocobase_public_path__'] || process.env.APP_PUBLIC_PATH || '/',
|
||||||
plugins: [NocoBaseClientPresetPlugin],
|
plugins: [TachyBaseClientPresetPlugin],
|
||||||
ws: {
|
ws: {
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
url: window['__nocobase_ws_url__'] || process.env.WEBSOCKET_URL || '',
|
url: window['__nocobase_ws_url__'] || process.env.WEBSOCKET_URL || '',
|
||||||
|
@ -12,7 +12,8 @@
|
|||||||
"strict": true,
|
"strict": true,
|
||||||
"paths": {
|
"paths": {
|
||||||
"@/*": ["src/*"],
|
"@/*": ["src/*"],
|
||||||
"@@/*": ["src/.umi/*"]
|
"@@/*": ["src/.umi/*"],
|
||||||
|
"@nocobase/client": ["../../client/src"],
|
||||||
},
|
},
|
||||||
"allowSyntheticDefaultImports": true
|
"allowSyntheticDefaultImports": true
|
||||||
},
|
},
|
||||||
|
@ -12,8 +12,8 @@
|
|||||||
"types": "./lib/index.d.ts",
|
"types": "./lib/index.d.ts",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@nocobase/database": "workspace:*",
|
"@nocobase/database": "workspace:*",
|
||||||
"@nocobase/preset-nocobase": "workspace:*",
|
"@nocobase/server": "workspace:*",
|
||||||
"@nocobase/server": "workspace:*"
|
"@tachybase/preset-tachybase": "workspace:*"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@nocobase/cache": "workspace:*",
|
"@nocobase/cache": "workspace:*",
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import { CacheManagerOptions } from '@nocobase/cache';
|
import { CacheManagerOptions } from '@nocobase/cache';
|
||||||
|
|
||||||
export const cacheManager = {
|
export const cacheManager: CacheManagerOptions = {
|
||||||
defaultStore: process.env.CACHE_DEFAULT_STORE || 'memory',
|
defaultStore: process.env.CACHE_DEFAULT_STORE || 'memory',
|
||||||
stores: {
|
stores: {
|
||||||
memory: {
|
memory: {
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
import { PluginConfiguration } from '@nocobase/server';
|
import { PluginConfiguration } from '@nocobase/server';
|
||||||
|
|
||||||
export default ['nocobase'] as PluginConfiguration[];
|
export default ['tachybase'] as PluginConfiguration[];
|
||||||
|
@ -124,7 +124,7 @@ const external = [
|
|||||||
'china-division',
|
'china-division',
|
||||||
];
|
];
|
||||||
const pluginPrefix = (
|
const pluginPrefix = (
|
||||||
process.env.PLUGIN_PACKAGE_PREFIX || '@nocobase/plugin-,@nocobase/preset-,@nocobase/plugin-pro-,@hera/plugin-'
|
process.env.PLUGIN_PACKAGE_PREFIX || '@nocobase/plugin-,@tachybase/preset-,@nocobase/plugin-pro-,@hera/plugin-'
|
||||||
).split(',');
|
).split(',');
|
||||||
|
|
||||||
const target_dir = 'dist';
|
const target_dir = 'dist';
|
||||||
|
@ -322,7 +322,7 @@ export function initEnv() {
|
|||||||
SOCKET_PATH: 'storage/gateway.sock',
|
SOCKET_PATH: 'storage/gateway.sock',
|
||||||
NODE_MODULES_PATH: resolve(process.cwd(), 'node_modules'),
|
NODE_MODULES_PATH: resolve(process.cwd(), 'node_modules'),
|
||||||
PM2_HOME: resolve(process.cwd(), './storage/.pm2'),
|
PM2_HOME: resolve(process.cwd(), './storage/.pm2'),
|
||||||
PLUGIN_PACKAGE_PREFIX: '@nocobase/plugin-,@nocobase/plugin-sample-,@nocobase/preset-,@hera/plugin-',
|
PLUGIN_PACKAGE_PREFIX: '@nocobase/plugin-,@nocobase/plugin-sample-,@tachybase/preset-,@hera/plugin-',
|
||||||
SERVER_TSCONFIG_PATH: './tsconfig.server.json',
|
SERVER_TSCONFIG_PATH: './tsconfig.server.json',
|
||||||
PLAYWRIGHT_AUTH_FILE: resolve(process.cwd(), 'storage/playwright/.auth/admin.json'),
|
PLAYWRIGHT_AUTH_FILE: resolve(process.cwd(), 'storage/playwright/.auth/admin.json'),
|
||||||
CACHE_DEFAULT_STORE: 'memory',
|
CACHE_DEFAULT_STORE: 'memory',
|
||||||
|
@ -134,7 +134,6 @@ class AppGenerator extends Generator {
|
|||||||
APP_ENV: 'development',
|
APP_ENV: 'development',
|
||||||
DB_DIALECT: dbDialect,
|
DB_DIALECT: dbDialect,
|
||||||
APP_KEY: crypto.randomBytes(256).toString('base64'),
|
APP_KEY: crypto.randomBytes(256).toString('base64'),
|
||||||
// PLUGIN_PACKAGE_PREFIX: `@nocobase/plugin-,@nocobase/preset-,@${this.context.name}/plugin-`,
|
|
||||||
...env,
|
...env,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
@ -184,7 +183,7 @@ class AppGenerator extends Generator {
|
|||||||
console.log('');
|
console.log('');
|
||||||
console.log(chalk.green(`$ cd ${name}`));
|
console.log(chalk.green(`$ cd ${name}`));
|
||||||
console.log(chalk.green(`$ pnpm install`));
|
console.log(chalk.green(`$ pnpm install`));
|
||||||
console.log(chalk.green(`$ pnpm nocobase install`));
|
console.log(chalk.green(`$ pnpm tachybase install`));
|
||||||
console.log(chalk.green(`$ pnpm dev`));
|
console.log(chalk.green(`$ pnpm dev`));
|
||||||
console.log('');
|
console.log('');
|
||||||
}
|
}
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"pm2": "^5.2.0",
|
"pm2": "^5.2.0",
|
||||||
"@nocobase/preset-nocobase": "{{{version}}}",
|
"@tachybase/preset-tachybase": "{{{version}}}",
|
||||||
"@nocobase/build": "{{{version}}}",
|
"@nocobase/build": "{{{version}}}",
|
||||||
"@tachycode/cli": "{{{version}}}",
|
"@tachycode/cli": "{{{version}}}",
|
||||||
{{{dependencies}}}
|
{{{dependencies}}}
|
||||||
|
@ -45,6 +45,7 @@
|
|||||||
"lodash": "^4.17.21",
|
"lodash": "^4.17.21",
|
||||||
"multer": "^1.4.2",
|
"multer": "^1.4.2",
|
||||||
"nanoid": "3.3.4",
|
"nanoid": "3.3.4",
|
||||||
|
"qs": "^6.12.1",
|
||||||
"react": "^18.2.0",
|
"react": "^18.2.0",
|
||||||
"semver": "^7.3.7",
|
"semver": "^7.3.7",
|
||||||
"serve-handler": "^6.1.5",
|
"serve-handler": "^6.1.5",
|
||||||
@ -55,6 +56,7 @@
|
|||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/koa": "^2.13.4",
|
"@types/koa": "^2.13.4",
|
||||||
"@types/lodash": "4.17.0",
|
"@types/lodash": "4.17.0",
|
||||||
|
"@types/qs": "^6.9.14",
|
||||||
"@types/semver": "^7.3.9",
|
"@types/semver": "^7.3.9",
|
||||||
"@types/serve-handler": "^6.1.1",
|
"@types/serve-handler": "^6.1.1",
|
||||||
"@types/ws": "^8.5.5",
|
"@types/ws": "^8.5.5",
|
||||||
|
@ -37,7 +37,7 @@ export class AppCommand extends Command {
|
|||||||
//@ts-ignore
|
//@ts-ignore
|
||||||
const userArgs = this._prepareUserArgs(argv, parseOptions);
|
const userArgs = this._prepareUserArgs(argv, parseOptions);
|
||||||
|
|
||||||
if (userArgs[0] === 'nocobase') {
|
if (userArgs[0] === 'tachybase') {
|
||||||
userArgs.shift();
|
userArgs.shift();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -45,7 +45,6 @@ import { ApplicationVersion } from './helpers/application-version';
|
|||||||
import { Locale } from './locale';
|
import { Locale } from './locale';
|
||||||
import { Plugin } from './plugin';
|
import { Plugin } from './plugin';
|
||||||
import { InstallOptions, PluginManager } from './plugin-manager';
|
import { InstallOptions, PluginManager } from './plugin-manager';
|
||||||
import { createClient } from 'redis';
|
|
||||||
import { nanoid } from 'nanoid';
|
import { nanoid } from 'nanoid';
|
||||||
import _ from 'lodash';
|
import _ from 'lodash';
|
||||||
|
|
||||||
@ -183,11 +182,6 @@ export class Application<StateT = DefaultState, ContextT = DefaultContext> exten
|
|||||||
private _maintainingCommandStatus: MaintainingCommandStatus;
|
private _maintainingCommandStatus: MaintainingCommandStatus;
|
||||||
private _maintainingStatusBeforeCommand: MaintainingCommandStatus | null;
|
private _maintainingStatusBeforeCommand: MaintainingCommandStatus | null;
|
||||||
private _actionCommand: Command;
|
private _actionCommand: Command;
|
||||||
private redisClient = createClient({
|
|
||||||
url: process.env.REDIS_URL ?? 'redis://127.0.0.1:6379',
|
|
||||||
});
|
|
||||||
private redisPubClient = this.redisClient.duplicate();
|
|
||||||
private redisSubClient = this.redisClient.duplicate();
|
|
||||||
static KEY_CORE_APP_PREFIX = 'KEY_CORE_APP_';
|
static KEY_CORE_APP_PREFIX = 'KEY_CORE_APP_';
|
||||||
private currentId = nanoid();
|
private currentId = nanoid();
|
||||||
|
|
||||||
@ -197,20 +191,6 @@ export class Application<StateT = DefaultState, ContextT = DefaultContext> exten
|
|||||||
this.rawOptions = this.name == 'main' ? lodash.cloneDeep(options) : {};
|
this.rawOptions = this.name == 'main' ? lodash.cloneDeep(options) : {};
|
||||||
this.init();
|
this.init();
|
||||||
|
|
||||||
Promise.all([this.redisClient.connect(), this.redisPubClient.connect(), this.redisSubClient.connect()])
|
|
||||||
.then(() => {
|
|
||||||
console.log(`[APPLICATION] ${this.name} redis connected.`);
|
|
||||||
this.redisSubClient.SUBSCRIBE(Application.KEY_CORE_APP_PREFIX + this.name, async (data) => {
|
|
||||||
const payload = JSON.parse(data);
|
|
||||||
if (payload.id !== this.currentId) {
|
|
||||||
this.runAsCLI(payload.argv, payload.options, false);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
})
|
|
||||||
.catch((err) => {
|
|
||||||
console.error(err);
|
|
||||||
});
|
|
||||||
|
|
||||||
this._appSupervisor.addApp(this);
|
this._appSupervisor.addApp(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -603,7 +583,7 @@ export class Application<StateT = DefaultState, ContextT = DefaultContext> exten
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected createCLI() {
|
protected createCLI() {
|
||||||
const command = new AppCommand('nocobase')
|
const command = new AppCommand('tachybase')
|
||||||
.usage('[command] [options]')
|
.usage('[command] [options]')
|
||||||
.hook('preAction', async (_, actionCommand) => {
|
.hook('preAction', async (_, actionCommand) => {
|
||||||
this._actionCommand = actionCommand;
|
this._actionCommand = actionCommand;
|
||||||
@ -715,26 +695,7 @@ export class Application<StateT = DefaultState, ContextT = DefaultContext> exten
|
|||||||
/**
|
/**
|
||||||
* @internal
|
* @internal
|
||||||
*/
|
*/
|
||||||
async runAsCLI(
|
async runAsCLI(argv = process.argv, options?: ParseOptions & { throwError?: boolean; reqId?: string }) {
|
||||||
argv = process.argv,
|
|
||||||
options?: ParseOptions & { throwError?: boolean; reqId?: string },
|
|
||||||
broadcast = true,
|
|
||||||
) {
|
|
||||||
if (broadcast) {
|
|
||||||
if (_.first(argv) === 'pm' || _.first(argv) === 'restart') {
|
|
||||||
console.log('[broadcast]:', argv);
|
|
||||||
setTimeout(() => {
|
|
||||||
this.redisPubClient.PUBLISH(
|
|
||||||
Application.KEY_CORE_APP_PREFIX + this.name,
|
|
||||||
JSON.stringify({
|
|
||||||
id: this.currentId,
|
|
||||||
argv: ['restart'],
|
|
||||||
options: { from: 'user' },
|
|
||||||
}),
|
|
||||||
);
|
|
||||||
}, 2000);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (this.activatedCommand) {
|
if (this.activatedCommand) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -798,7 +759,7 @@ export class Application<StateT = DefaultState, ContextT = DefaultContext> exten
|
|||||||
|
|
||||||
if (options.checkInstall && !(await this.isInstalled())) {
|
if (options.checkInstall && !(await this.isInstalled())) {
|
||||||
throw new ApplicationNotInstall(
|
throw new ApplicationNotInstall(
|
||||||
`Application ${this.name} is not installed, Please run 'pnpm nocobase install' command first`,
|
`Application ${this.name} is not installed, Please run 'pnpm tachybase install' command first`,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -33,7 +33,7 @@ export default (app: Application) => {
|
|||||||
if (!(await app.isInstalled())) {
|
if (!(await app.isInstalled())) {
|
||||||
app['_started'] = true;
|
app['_started'] = true;
|
||||||
throw new ApplicationNotInstall(
|
throw new ApplicationNotInstall(
|
||||||
`Application ${app.name} is not installed, Please run 'pnpm nocobase install' command first`,
|
`Application ${app.name} is not installed, Please run 'pnpm tachybase install' command first`,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
await app.load();
|
await app.load();
|
||||||
|
@ -5,7 +5,6 @@ import { IncomingMessage } from 'http';
|
|||||||
import { AppSupervisor } from '../app-supervisor';
|
import { AppSupervisor } from '../app-supervisor';
|
||||||
import { applyErrorWithArgs, getErrorWithCode } from './errors';
|
import { applyErrorWithArgs, getErrorWithCode } from './errors';
|
||||||
import lodash from 'lodash';
|
import lodash from 'lodash';
|
||||||
import { createClient } from 'redis';
|
|
||||||
import { Logger } from '@nocobase/logger';
|
import { Logger } from '@nocobase/logger';
|
||||||
|
|
||||||
declare class WebSocketWithId extends WebSocket {
|
declare class WebSocketWithId extends WebSocket {
|
||||||
@ -28,11 +27,6 @@ function getPayloadByErrorCode(code, options) {
|
|||||||
export class WSServer {
|
export class WSServer {
|
||||||
wss: WebSocket.Server;
|
wss: WebSocket.Server;
|
||||||
webSocketClients = new Map<string, WebSocketClient>();
|
webSocketClients = new Map<string, WebSocketClient>();
|
||||||
private redisClient = createClient({
|
|
||||||
url: process.env.REDIS_URL ?? 'redis://127.0.0.1:6379',
|
|
||||||
});
|
|
||||||
private redisPubClient = this.redisClient.duplicate();
|
|
||||||
private redisSubClient = this.redisClient.duplicate();
|
|
||||||
static KEY_CORE_MESSAGE = 'KEY_CORE_MESSAGE';
|
static KEY_CORE_MESSAGE = 'KEY_CORE_MESSAGE';
|
||||||
private currentId = nanoid();
|
private currentId = nanoid();
|
||||||
logger: Logger;
|
logger: Logger;
|
||||||
@ -40,20 +34,6 @@ export class WSServer {
|
|||||||
constructor() {
|
constructor() {
|
||||||
this.wss = new WebSocketServer({ noServer: true });
|
this.wss = new WebSocketServer({ noServer: true });
|
||||||
|
|
||||||
Promise.all([this.redisClient.connect(), this.redisPubClient.connect(), this.redisSubClient.connect()])
|
|
||||||
.then(() => {
|
|
||||||
console.log('[WSServer]: redis connected.');
|
|
||||||
this.redisSubClient.SUBSCRIBE(WSServer.KEY_CORE_MESSAGE, async (data) => {
|
|
||||||
const payload = JSON.parse(data);
|
|
||||||
if (payload.id !== this.currentId) {
|
|
||||||
this.sendToConnectionsByTag(payload.tagName, payload.tagValue, payload.sendMessage, false);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
})
|
|
||||||
.catch((err) => {
|
|
||||||
console.error(err);
|
|
||||||
});
|
|
||||||
|
|
||||||
this.wss.on('connection', (ws: WebSocketWithId, request: IncomingMessage) => {
|
this.wss.on('connection', (ws: WebSocketWithId, request: IncomingMessage) => {
|
||||||
const client = this.addNewConnection(ws, request);
|
const client = this.addNewConnection(ws, request);
|
||||||
|
|
||||||
@ -197,18 +177,7 @@ export class WSServer {
|
|||||||
client.ws.send(JSON.stringify(sendMessage));
|
client.ws.send(JSON.stringify(sendMessage));
|
||||||
}
|
}
|
||||||
|
|
||||||
sendToConnectionsByTag(tagName: string, tagValue: string, sendMessage: object, broadcast = true) {
|
sendToConnectionsByTag(tagName: string, tagValue: string, sendMessage: object) {
|
||||||
if (broadcast) {
|
|
||||||
this.redisPubClient.PUBLISH(
|
|
||||||
WSServer.KEY_CORE_MESSAGE,
|
|
||||||
JSON.stringify({
|
|
||||||
id: this.currentId,
|
|
||||||
tagName,
|
|
||||||
tagValue,
|
|
||||||
sendMessage,
|
|
||||||
}),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
this.loopThroughConnections((client: WebSocketClient) => {
|
this.loopThroughConnections((client: WebSocketClient) => {
|
||||||
if (client.tags.includes(`${tagName}#${tagValue}`)) {
|
if (client.tags.includes(`${tagName}#${tagValue}`)) {
|
||||||
this.sendMessageToConnection(client, sendMessage);
|
this.sendMessageToConnection(client, sendMessage);
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
export const APP_NAME = 'nocobase';
|
export const APP_NAME = 'tachybase';
|
||||||
export const DEFAULT_PLUGIN_STORAGE_PATH = 'storage/plugins';
|
export const DEFAULT_PLUGIN_STORAGE_PATH = 'storage/plugins';
|
||||||
export const DEFAULT_PLUGIN_PATH = 'packages/plugins/';
|
export const DEFAULT_PLUGIN_PATH = 'packages/plugins/';
|
||||||
export const pluginPrefix = (
|
export const pluginPrefix = (
|
||||||
process.env.PLUGIN_PACKAGE_PREFIX || '@nocobase/plugin-,@nocobase/preset-,@nocobase/plugin-pro-,@hera/plugin-'
|
process.env.PLUGIN_PACKAGE_PREFIX || '@nocobase/plugin-,@tachybase/preset-,@nocobase/plugin-pro-,@hera/plugin-'
|
||||||
).split(',');
|
).split(',');
|
||||||
export const requireRegex = /require\s*\(['"`](.*?)['"`]\)/g;
|
export const requireRegex = /require\s*\(['"`](.*?)['"`]\)/g;
|
||||||
export const importRegex = /^import(?:['"\s]*([\w*${}\s,]+)from\s*)?['"\s]['"\s](.*[@\w_-]+)['"\s].*/gm;
|
export const importRegex = /^import(?:['"\s]*([\w*${}\s,]+)from\s*)?['"\s]['"\s](.*[@\w_-]+)['"\s].*/gm;
|
||||||
|
@ -136,7 +136,7 @@ export class PluginManager {
|
|||||||
*/
|
*/
|
||||||
static getPluginPkgPrefix() {
|
static getPluginPkgPrefix() {
|
||||||
return (
|
return (
|
||||||
process.env.PLUGIN_PACKAGE_PREFIX || '@nocobase/plugin-,@nocobase/preset-,@nocobase/plugin-pro-,@hera/plugin-'
|
process.env.PLUGIN_PACKAGE_PREFIX || '@nocobase/plugin-,@tachybase/preset-,@nocobase/plugin-pro-,@hera/plugin-'
|
||||||
).split(',');
|
).split(',');
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -629,7 +629,7 @@ export class PluginManager {
|
|||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
await execa('pnpm', ['nocobase', 'postinstall']);
|
await execa('pnpm', ['tachybase', 'postinstall']);
|
||||||
};
|
};
|
||||||
if (options?.force) {
|
if (options?.force) {
|
||||||
await this.repository.destroy({
|
await this.repository.destroy({
|
||||||
@ -671,7 +671,7 @@ export class PluginManager {
|
|||||||
if (options?.removeDir) {
|
if (options?.removeDir) {
|
||||||
await removeDir();
|
await removeDir();
|
||||||
}
|
}
|
||||||
await execa('pnpm', ['nocobase', 'refresh']);
|
await execa('pnpm', ['tachybase', 'refresh']);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -737,7 +737,7 @@ export class PluginManager {
|
|||||||
await this.add(opts['name'] || urlOrName, opts, true);
|
await this.add(opts['name'] || urlOrName, opts, true);
|
||||||
}
|
}
|
||||||
await this.app.emitStartedEvent();
|
await this.app.emitStartedEvent();
|
||||||
await execa('pnpm', ['nocobase', 'postinstall']);
|
await execa('pnpm', ['tachybase', 'postinstall']);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -821,7 +821,7 @@ export class PluginManager {
|
|||||||
if (process.env.IS_DEV_CMD) {
|
if (process.env.IS_DEV_CMD) {
|
||||||
await tsxRerunning();
|
await tsxRerunning();
|
||||||
} else {
|
} else {
|
||||||
await execa('pnpm', ['nocobase', 'pm2-restart'], {
|
await execa('pnpm', ['tachybase', 'pm2-restart'], {
|
||||||
env: process.env,
|
env: process.env,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -1,11 +0,0 @@
|
|||||||
# audit-logs
|
|
||||||
|
|
||||||
English | [中文](./README.zh-CN.md)
|
|
||||||
|
|
||||||
审计日志插件。
|
|
||||||
|
|
||||||
## 安装激活
|
|
||||||
|
|
||||||
内置插件无需手动安装激活。
|
|
||||||
|
|
||||||
## 使用方法
|
|
@ -1,11 +0,0 @@
|
|||||||
# audit-logs
|
|
||||||
|
|
||||||
[English](./README.md) | 中文
|
|
||||||
|
|
||||||
审计日志插件。
|
|
||||||
|
|
||||||
## 安装激活
|
|
||||||
|
|
||||||
内置插件无需手动安装激活。
|
|
||||||
|
|
||||||
## 使用方法
|
|
@ -1,2 +0,0 @@
|
|||||||
export * from './dist/client';
|
|
||||||
export { default } from './dist/client';
|
|
@ -1 +0,0 @@
|
|||||||
module.exports = require('./dist/client/index.js');
|
|
@ -1,30 +0,0 @@
|
|||||||
{
|
|
||||||
"name": "@nocobase/plugin-audit-logs",
|
|
||||||
"displayName": "Audit logs (deprecated)",
|
|
||||||
"version": "0.21.6",
|
|
||||||
"description": "This plugin is deprecated. There will be a new audit log plugin in the future.",
|
|
||||||
"keywords": [
|
|
||||||
"System & security"
|
|
||||||
],
|
|
||||||
"homepage": "https://docs.nocobase.com/handbook/audit-logs",
|
|
||||||
"license": "AGPL-3.0",
|
|
||||||
"main": "./dist/server/index.js",
|
|
||||||
"devDependencies": {
|
|
||||||
"@ant-design/icons": "~5.3.6",
|
|
||||||
"@formily/antd-v5": "1.x",
|
|
||||||
"@nocobase/schema": "workspace:*",
|
|
||||||
"react": "^18.2.0",
|
|
||||||
"react-i18next": "^11.15.1"
|
|
||||||
},
|
|
||||||
"peerDependencies": {
|
|
||||||
"@nocobase/client": "workspace:*",
|
|
||||||
"@nocobase/database": "workspace:*",
|
|
||||||
"@nocobase/server": "workspace:*",
|
|
||||||
"@nocobase/test": "workspace:*",
|
|
||||||
"@nocobase/utils": "workspace:*"
|
|
||||||
},
|
|
||||||
"description.zh-CN": "该插件已废弃,请勿使用,未来将有新的审计日志插件。",
|
|
||||||
"displayName.zh-CN": "审计日志(废弃)",
|
|
||||||
"gitHead": "d0b4efe4be55f8c79a98a331d99d9f8cf99021a1",
|
|
||||||
"homepage.zh-CN": "https://docs-cn.nocobase.com/handbook/audit-logs"
|
|
||||||
}
|
|
@ -1,2 +0,0 @@
|
|||||||
export * from './dist/server';
|
|
||||||
export { default } from './dist/server';
|
|
@ -1 +0,0 @@
|
|||||||
module.exports = require('./dist/server/index.js');
|
|
@ -1,25 +0,0 @@
|
|||||||
import { TableOutlined } from '@ant-design/icons';
|
|
||||||
import { ISchema } from '@nocobase/schema';
|
|
||||||
import { SchemaInitializerItem, useSchemaInitializer, useSchemaInitializerItem } from '@nocobase/client';
|
|
||||||
import React from 'react';
|
|
||||||
import { useTranslation } from 'react-i18next';
|
|
||||||
import { createAuditLogsBlockSchema } from './createAuditLogsBlockSchema';
|
|
||||||
|
|
||||||
export const AuditLogsBlockInitializer = () => {
|
|
||||||
const { insert } = useSchemaInitializer();
|
|
||||||
const { t } = useTranslation();
|
|
||||||
const itemConfig = useSchemaInitializerItem();
|
|
||||||
|
|
||||||
const schema = createAuditLogsBlockSchema();
|
|
||||||
|
|
||||||
return (
|
|
||||||
<SchemaInitializerItem
|
|
||||||
icon={<TableOutlined />}
|
|
||||||
onClick={() => {
|
|
||||||
insert(schema as ISchema);
|
|
||||||
}}
|
|
||||||
title={t('Audit Logs')}
|
|
||||||
{...itemConfig}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
};
|
|
@ -1,17 +0,0 @@
|
|||||||
import { ExtendCollectionsProvider, TableBlockProvider } from '@nocobase/client';
|
|
||||||
import React from 'react';
|
|
||||||
import { useAuditChangesCollection, useAuditLogsCollection, useCollectionsCollection } from './collections';
|
|
||||||
|
|
||||||
export const AuditLogsBlockProvider: React.FC = ({ children, ...restProps }) => {
|
|
||||||
const auditChangesCollection = useAuditChangesCollection();
|
|
||||||
const auditLogsCollection = useAuditLogsCollection();
|
|
||||||
const collectionsCollection = useCollectionsCollection();
|
|
||||||
|
|
||||||
return (
|
|
||||||
<ExtendCollectionsProvider collections={[auditLogsCollection, auditChangesCollection, collectionsCollection]}>
|
|
||||||
<TableBlockProvider name="audit-logs" {...restProps}>
|
|
||||||
{children}
|
|
||||||
</TableBlockProvider>
|
|
||||||
</ExtendCollectionsProvider>
|
|
||||||
);
|
|
||||||
};
|
|
@ -1,27 +0,0 @@
|
|||||||
import { SchemaComponentOptions } from '@nocobase/client';
|
|
||||||
import React from 'react';
|
|
||||||
import { AuditLogsBlockInitializer } from './AuditLogsBlockInitializer';
|
|
||||||
import { AuditLogsBlockProvider } from './AuditLogsBlockProvider';
|
|
||||||
import { AuditLogsField } from './components/AuditLogsField';
|
|
||||||
import { AuditLogsValue } from './components/AuditLogsValue';
|
|
||||||
import { AuditLogsViewActionInitializer } from './components/AuditLogsViewActionInitializer';
|
|
||||||
import { AuditLogs } from './deplicated/AuditLogs';
|
|
||||||
import { AuditLogsTableActionColumnInitializer } from './initializers/AuditLogsTableActionColumnInitializer';
|
|
||||||
|
|
||||||
export const AuditLogsProvider = (props: any) => {
|
|
||||||
return (
|
|
||||||
<SchemaComponentOptions
|
|
||||||
components={{
|
|
||||||
AuditLogs,
|
|
||||||
AuditLogsBlockProvider,
|
|
||||||
AuditLogsBlockInitializer,
|
|
||||||
AuditLogsValue,
|
|
||||||
AuditLogsField,
|
|
||||||
AuditLogsViewActionInitializer,
|
|
||||||
AuditLogsTableActionColumnInitializer,
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
{props.children}
|
|
||||||
</SchemaComponentOptions>
|
|
||||||
);
|
|
||||||
};
|
|
@ -1,77 +0,0 @@
|
|||||||
import { ISchema } from '@nocobase/schema';
|
|
||||||
import { createAuditLogsBlockSchema } from '../createAuditLogsBlockSchema';
|
|
||||||
|
|
||||||
describe('createAuditLogsBlockSchema', () => {
|
|
||||||
let schema: ISchema;
|
|
||||||
|
|
||||||
beforeAll(() => {
|
|
||||||
schema = createAuditLogsBlockSchema();
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should return a valid schema object', () => {
|
|
||||||
expect(schema).toBeDefined();
|
|
||||||
expect(typeof schema).toBe('object');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should have specific top-level properties with expected values', () => {
|
|
||||||
expect(schema).toMatchObject({
|
|
||||||
type: 'void',
|
|
||||||
'x-decorator': 'AuditLogsBlockProvider',
|
|
||||||
'x-acl-action': 'auditLogs:list',
|
|
||||||
'x-toolbar': 'BlockSchemaToolbar',
|
|
||||||
'x-settings': 'blockSettings:table',
|
|
||||||
'x-component': 'CardItem',
|
|
||||||
'x-filter-targets': expect.arrayContaining([]),
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
describe('x-decorator-props section', () => {
|
|
||||||
it('should have a collection named "auditLogs"', () => {
|
|
||||||
expect(schema['x-decorator-props'].collection).toEqual('auditLogs');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should have a list action', () => {
|
|
||||||
expect(schema['x-decorator-props'].action).toEqual('list');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should set pageSize to 20', () => {
|
|
||||||
expect(schema['x-decorator-props'].params.pageSize).toEqual(20);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('contains expected boolean flags', () => {
|
|
||||||
expect(schema['x-decorator-props'].showIndex).toBeTruthy();
|
|
||||||
expect(schema['x-decorator-props'].dragSort).toBeFalsy();
|
|
||||||
expect(schema['x-decorator-props'].disableTemplate).toBeTruthy();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
describe('actions property inside schema.properties', () => {
|
|
||||||
let actions;
|
|
||||||
|
|
||||||
beforeAll(() => {
|
|
||||||
// @ts-ignore
|
|
||||||
actions = schema.properties.actions;
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should be defined and have a specific structure', () => {
|
|
||||||
expect(actions).toBeDefined();
|
|
||||||
expect(actions.type).toBe('void');
|
|
||||||
expect(actions['x-initializer']).toBe('auditLogsTable:configureActions');
|
|
||||||
expect(actions['x-component']).toBe('ActionBar');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('has x-component-props with expected style', () => {
|
|
||||||
expect(actions['x-component-props'].style.marginBottom).toBe('var(--nb-spacing)');
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
describe('properties should include dynamically keyed objects', () => {
|
|
||||||
it('keyed objects should match the expected structure for tables', () => {
|
|
||||||
const propertyKeys = Object.keys(schema.properties).filter((key) => key !== 'actions');
|
|
||||||
propertyKeys.forEach((key) => {
|
|
||||||
expect(schema.properties[key].type).toBe('array');
|
|
||||||
expect(schema.properties[key]['x-component']).toBe('TableV2');
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
@ -1,166 +0,0 @@
|
|||||||
import { useAuditLogsTranslation } from './locale';
|
|
||||||
|
|
||||||
export const useAuditLogsCollection = () => {
|
|
||||||
return {
|
|
||||||
name: 'auditLogs',
|
|
||||||
title: '{{t("Audit logs")}}',
|
|
||||||
fields: [
|
|
||||||
{
|
|
||||||
name: 'createdAt',
|
|
||||||
type: 'date',
|
|
||||||
interface: 'createdAt',
|
|
||||||
uiSchema: {
|
|
||||||
type: 'datetime',
|
|
||||||
title: '{{t("Created at")}}',
|
|
||||||
'x-component': 'DatePicker',
|
|
||||||
'x-component-props': {
|
|
||||||
showTime: true,
|
|
||||||
ellipsis: true,
|
|
||||||
},
|
|
||||||
'x-read-pretty': true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'type',
|
|
||||||
type: 'string',
|
|
||||||
interface: 'select',
|
|
||||||
uiSchema: {
|
|
||||||
type: 'string',
|
|
||||||
title: '{{t("Action type")}}',
|
|
||||||
'x-component': 'Select',
|
|
||||||
'x-component-props': { ellipsis: true },
|
|
||||||
'x-read-pretty': true,
|
|
||||||
enum: [
|
|
||||||
{ label: '{{t("Create record")}}', value: 'create', color: 'lime' },
|
|
||||||
{ label: '{{t("Update record")}}', value: 'update', color: 'gold' },
|
|
||||||
{ label: '{{t("Delete record")}}', value: 'destroy', color: 'magenta' },
|
|
||||||
],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'recordId',
|
|
||||||
type: 'string',
|
|
||||||
interface: 'input',
|
|
||||||
uiSchema: {
|
|
||||||
title: '{{t("Record ID")}}',
|
|
||||||
type: 'string',
|
|
||||||
'x-component': 'Input',
|
|
||||||
'x-component-props': { ellipsis: true },
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
collectionName: 'auditLogs',
|
|
||||||
name: 'collection',
|
|
||||||
type: 'belongsTo',
|
|
||||||
interface: 'm2o',
|
|
||||||
target: 'collections',
|
|
||||||
targetKey: 'name',
|
|
||||||
sourceKey: 'id',
|
|
||||||
foreignKey: 'collectionName',
|
|
||||||
uiSchema: {
|
|
||||||
type: 'object',
|
|
||||||
title: '{{t("Collection")}}',
|
|
||||||
'x-component': 'AssociationField',
|
|
||||||
'x-component-props': { fieldNames: { value: 'name', label: 'title' }, ellipsis: true },
|
|
||||||
'x-read-pretty': true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'user',
|
|
||||||
collectionName: 'auditLogs',
|
|
||||||
type: 'belongsTo',
|
|
||||||
interface: 'createdBy',
|
|
||||||
targetKey: 'id',
|
|
||||||
foreignKey: 'createdById',
|
|
||||||
target: 'users',
|
|
||||||
uiSchema: {
|
|
||||||
type: 'object',
|
|
||||||
title: '{{t("User")}}',
|
|
||||||
'x-component': 'AssociationField',
|
|
||||||
'x-component-props': { fieldNames: { value: 'id', label: 'nickname' }, ellipsis: true },
|
|
||||||
'x-read-pretty': true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'changes',
|
|
||||||
collectionName: 'auditLogs',
|
|
||||||
type: 'hasMany',
|
|
||||||
interface: 'subTable',
|
|
||||||
target: 'auditChanges',
|
|
||||||
foreignKey: 'auditLogId',
|
|
||||||
targetKey: 'id',
|
|
||||||
uiSchema: {
|
|
||||||
type: 'object',
|
|
||||||
title: '{{t("Details of changes", { ns: "audit-logs" })}}',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
],
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
export const useAuditChangesCollection = () => {
|
|
||||||
return {
|
|
||||||
name: 'auditChanges',
|
|
||||||
title: '{{t("Audit Changes")}}',
|
|
||||||
fields: [
|
|
||||||
{
|
|
||||||
name: 'field',
|
|
||||||
type: 'json',
|
|
||||||
interface: 'input',
|
|
||||||
uiSchema: {
|
|
||||||
title: '{{t("Field")}}',
|
|
||||||
'x-component': 'AuditLogsField',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
type: 'json',
|
|
||||||
name: 'before',
|
|
||||||
interface: 'input',
|
|
||||||
uiSchema: {
|
|
||||||
title: '{{t("Before change")}}',
|
|
||||||
'x-component': 'AuditLogsValue',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
type: 'json',
|
|
||||||
name: 'after',
|
|
||||||
interface: 'input',
|
|
||||||
uiSchema: {
|
|
||||||
title: '{{t("After change")}}',
|
|
||||||
'x-component': 'AuditLogsValue',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
],
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
export const useCollectionsCollection = () => {
|
|
||||||
return {
|
|
||||||
name: 'collections',
|
|
||||||
title: '{{t("Collections")}}',
|
|
||||||
fields: [
|
|
||||||
{
|
|
||||||
name: 'name',
|
|
||||||
type: 'string',
|
|
||||||
interface: 'input',
|
|
||||||
uiSchema: {
|
|
||||||
title: '{{t("Collection name")}}',
|
|
||||||
type: 'string',
|
|
||||||
'x-component': 'Input',
|
|
||||||
'x-component-props': { ellipsis: true },
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'title',
|
|
||||||
type: 'string',
|
|
||||||
interface: 'input',
|
|
||||||
uiSchema: {
|
|
||||||
title: '{{t("Collection display name")}}',
|
|
||||||
type: 'string',
|
|
||||||
'x-component': 'Input',
|
|
||||||
'x-component-props': { ellipsis: true },
|
|
||||||
},
|
|
||||||
},
|
|
||||||
],
|
|
||||||
};
|
|
||||||
};
|
|
@ -1,19 +0,0 @@
|
|||||||
import { EllipsisWithTooltip, useCompile } from '@nocobase/client';
|
|
||||||
import React from 'react';
|
|
||||||
import { observer, useField } from '@nocobase/schema';
|
|
||||||
|
|
||||||
export const AuditLogsField = observer(
|
|
||||||
() => {
|
|
||||||
const field = useField<any>();
|
|
||||||
const compile = useCompile();
|
|
||||||
if (!field.value) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return (
|
|
||||||
<EllipsisWithTooltip ellipsis>
|
|
||||||
{field.value?.uiSchema?.title ? compile(field.value?.uiSchema?.title) : field.value.name}
|
|
||||||
</EllipsisWithTooltip>
|
|
||||||
);
|
|
||||||
},
|
|
||||||
{ displayName: 'AuditLogsField' },
|
|
||||||
);
|
|
@ -1,26 +0,0 @@
|
|||||||
import { EllipsisWithTooltip, FormProvider, SchemaComponent, useRecord } from '@nocobase/client';
|
|
||||||
import React from 'react';
|
|
||||||
import { observer, useField } from '@nocobase/schema';
|
|
||||||
|
|
||||||
export const AuditLogsValue = observer(
|
|
||||||
() => {
|
|
||||||
const field = useField<any>();
|
|
||||||
const record = useRecord();
|
|
||||||
if (record.field?.uiSchema) {
|
|
||||||
return (
|
|
||||||
<FormProvider>
|
|
||||||
<SchemaComponent
|
|
||||||
schema={{
|
|
||||||
name: record.field.name,
|
|
||||||
...record.field?.uiSchema,
|
|
||||||
default: field.value,
|
|
||||||
'x-read-pretty': true,
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
</FormProvider>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
return <EllipsisWithTooltip ellipsis>{field.value ? JSON.stringify(field.value) : null}</EllipsisWithTooltip>;
|
|
||||||
},
|
|
||||||
{ displayName: 'AuditLogsValue' },
|
|
||||||
);
|
|
@ -1,341 +0,0 @@
|
|||||||
import { ActionInitializer } from '@nocobase/client';
|
|
||||||
import React from 'react';
|
|
||||||
|
|
||||||
export const AuditLogsViewActionInitializer = () => {
|
|
||||||
const schema = {
|
|
||||||
type: 'void',
|
|
||||||
title: '{{ t("View") }}',
|
|
||||||
'x-action': 'view',
|
|
||||||
// 'x-designer': 'Action.Designer',
|
|
||||||
'x-toolbar': 'ActionSchemaToolbar',
|
|
||||||
'x-settings': 'actionSettings:view',
|
|
||||||
'x-component': 'Action',
|
|
||||||
'x-component-props': {
|
|
||||||
openMode: 'drawer',
|
|
||||||
},
|
|
||||||
properties: {
|
|
||||||
drawer: {
|
|
||||||
type: 'void',
|
|
||||||
title: '{{ t("View record") }}',
|
|
||||||
'x-component': 'Action.Container',
|
|
||||||
'x-component-props': {
|
|
||||||
className: 'nb-action-popup',
|
|
||||||
},
|
|
||||||
properties: {
|
|
||||||
tabs: {
|
|
||||||
type: 'void',
|
|
||||||
'x-component': 'Tabs',
|
|
||||||
'x-component-props': {},
|
|
||||||
properties: {
|
|
||||||
tab1: {
|
|
||||||
type: 'void',
|
|
||||||
title: '{{t("Details")}}',
|
|
||||||
'x-component': 'Tabs.TabPane',
|
|
||||||
'x-designer': 'Tabs.Designer',
|
|
||||||
'x-component-props': {},
|
|
||||||
properties: {
|
|
||||||
grid: {
|
|
||||||
type: 'void',
|
|
||||||
'x-component': 'Grid',
|
|
||||||
properties: {
|
|
||||||
'7ypqrxaqysp': {
|
|
||||||
type: 'void',
|
|
||||||
'x-component': 'Grid.Row',
|
|
||||||
properties: {
|
|
||||||
'1fc2l8dwe7m': {
|
|
||||||
type: 'void',
|
|
||||||
'x-component': 'Grid.Col',
|
|
||||||
properties: {
|
|
||||||
'5ley6xifrsb': {
|
|
||||||
type: 'void',
|
|
||||||
'x-acl-action': 'auditLogs:get',
|
|
||||||
'x-decorator': 'FormBlockProvider',
|
|
||||||
'x-decorator-props': {
|
|
||||||
resource: 'auditLogs',
|
|
||||||
collection: 'auditLogs',
|
|
||||||
readPretty: true,
|
|
||||||
action: 'get',
|
|
||||||
params: {
|
|
||||||
appends: ['collection', 'user', 'changes'],
|
|
||||||
},
|
|
||||||
useParams: '{{ useParamsFromRecord }}',
|
|
||||||
useSourceId: '{{ useSourceIdFromParentRecord }}',
|
|
||||||
},
|
|
||||||
'x-component': 'CardItem',
|
|
||||||
properties: {
|
|
||||||
bv710pbf9w6: {
|
|
||||||
type: 'void',
|
|
||||||
'x-component': 'FormV2',
|
|
||||||
'x-use-component-props': 'useFormBlockProps',
|
|
||||||
'x-read-pretty': true,
|
|
||||||
properties: {
|
|
||||||
grid: {
|
|
||||||
type: 'void',
|
|
||||||
'x-component': 'Grid',
|
|
||||||
properties: {
|
|
||||||
g4c24abnbd9: {
|
|
||||||
type: 'void',
|
|
||||||
'x-component': 'Grid.Row',
|
|
||||||
properties: {
|
|
||||||
fkt9dj5lu1k: {
|
|
||||||
type: 'void',
|
|
||||||
'x-component': 'Grid.Col',
|
|
||||||
properties: {
|
|
||||||
createdAt: {
|
|
||||||
type: 'string',
|
|
||||||
'x-component': 'CollectionField',
|
|
||||||
'x-decorator': 'FormItem',
|
|
||||||
'x-collection-field': 'auditLogs.createdAt',
|
|
||||||
'x-component-props': {},
|
|
||||||
'x-read-pretty': true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
l267bkv423v: {
|
|
||||||
type: 'void',
|
|
||||||
'x-component': 'Grid.Row',
|
|
||||||
properties: {
|
|
||||||
tehaepm5xqy: {
|
|
||||||
type: 'void',
|
|
||||||
'x-component': 'Grid.Col',
|
|
||||||
properties: {
|
|
||||||
type: {
|
|
||||||
type: 'string',
|
|
||||||
'x-component': 'CollectionField',
|
|
||||||
'x-decorator': 'FormItem',
|
|
||||||
'x-collection-field': 'auditLogs.type',
|
|
||||||
'x-component-props': {},
|
|
||||||
'x-read-pretty': true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
zhmn2tkzdh2: {
|
|
||||||
type: 'void',
|
|
||||||
'x-component': 'Grid.Row',
|
|
||||||
properties: {
|
|
||||||
yuwyej17i64: {
|
|
||||||
type: 'void',
|
|
||||||
'x-component': 'Grid.Col',
|
|
||||||
properties: {
|
|
||||||
recordId: {
|
|
||||||
type: 'string',
|
|
||||||
'x-component': 'CollectionField',
|
|
||||||
'x-decorator': 'FormItem',
|
|
||||||
'x-collection-field': 'auditLogs.recordId',
|
|
||||||
'x-component-props': {},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
'6q933ic06mj': {
|
|
||||||
type: 'void',
|
|
||||||
'x-component': 'Grid.Row',
|
|
||||||
properties: {
|
|
||||||
nwtbkqd99zl2: {
|
|
||||||
type: 'void',
|
|
||||||
'x-component': 'Grid.Col',
|
|
||||||
properties: {
|
|
||||||
'collection.title': {
|
|
||||||
type: 'string',
|
|
||||||
'x-component': 'CollectionField',
|
|
||||||
'x-decorator': 'FormItem',
|
|
||||||
'x-collection-field': 'auditLogs.collection.title',
|
|
||||||
'x-component-props': {},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
nwtbkqd99zl1: {
|
|
||||||
type: 'void',
|
|
||||||
'x-component': 'Grid.Col',
|
|
||||||
properties: {
|
|
||||||
'collection.name': {
|
|
||||||
type: 'string',
|
|
||||||
'x-component': 'CollectionField',
|
|
||||||
'x-decorator': 'FormItem',
|
|
||||||
'x-collection-field': 'auditLogs.collection.name',
|
|
||||||
'x-component-props': {},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
xd4kzulndqk: {
|
|
||||||
type: 'void',
|
|
||||||
'x-component': 'Grid.Row',
|
|
||||||
properties: {
|
|
||||||
k3sd72n83zd: {
|
|
||||||
type: 'void',
|
|
||||||
'x-component': 'Grid.Col',
|
|
||||||
properties: {
|
|
||||||
user: {
|
|
||||||
type: 'string',
|
|
||||||
'x-component': 'CollectionField',
|
|
||||||
'x-decorator': 'FormItem',
|
|
||||||
'x-collection-field': 'auditLogs.user',
|
|
||||||
'x-component-props': {},
|
|
||||||
'x-read-pretty': true,
|
|
||||||
properties: {
|
|
||||||
viewer: {
|
|
||||||
type: 'void',
|
|
||||||
title: '{{ t("View record") }}',
|
|
||||||
'x-component': 'RecordPicker.Viewer',
|
|
||||||
'x-component-props': {
|
|
||||||
className: 'nb-action-popup',
|
|
||||||
},
|
|
||||||
properties: {
|
|
||||||
tabs: {
|
|
||||||
type: 'void',
|
|
||||||
'x-component': 'Tabs',
|
|
||||||
'x-component-props': {},
|
|
||||||
'x-initializer': 'TabPaneInitializers',
|
|
||||||
properties: {
|
|
||||||
tab1: {
|
|
||||||
type: 'void',
|
|
||||||
title: '{{t("Details")}}',
|
|
||||||
'x-component': 'Tabs.TabPane',
|
|
||||||
'x-designer': 'Tabs.Designer',
|
|
||||||
'x-component-props': {},
|
|
||||||
properties: {
|
|
||||||
grid: {
|
|
||||||
type: 'void',
|
|
||||||
'x-component': 'Grid',
|
|
||||||
'x-initializer': 'popup:common:addBlock',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
'3lghgclbtcg': {
|
|
||||||
type: 'void',
|
|
||||||
'x-component': 'Grid.Row',
|
|
||||||
properties: {
|
|
||||||
'8l1v1auwlx0': {
|
|
||||||
type: 'void',
|
|
||||||
'x-component': 'Grid.Col',
|
|
||||||
properties: {
|
|
||||||
changes: {
|
|
||||||
type: 'void',
|
|
||||||
'x-component': 'TableField',
|
|
||||||
'x-decorator': 'FormItem',
|
|
||||||
'x-collection-field': 'auditLogs.changes',
|
|
||||||
'x-component-props': {},
|
|
||||||
properties: {
|
|
||||||
block: {
|
|
||||||
type: 'void',
|
|
||||||
'x-decorator': 'TableFieldProvider',
|
|
||||||
'x-acl-action': 'auditChanges:list',
|
|
||||||
'x-decorator-props': {
|
|
||||||
collection: 'auditChanges',
|
|
||||||
association: 'auditLogs.changes',
|
|
||||||
resource: 'auditLogs.changes',
|
|
||||||
action: 'list',
|
|
||||||
params: {
|
|
||||||
paginate: false,
|
|
||||||
},
|
|
||||||
showIndex: true,
|
|
||||||
dragSort: false,
|
|
||||||
},
|
|
||||||
properties: {
|
|
||||||
actions: {
|
|
||||||
type: 'void',
|
|
||||||
'x-component': 'TableField.ActionBar',
|
|
||||||
'x-component-props': {},
|
|
||||||
},
|
|
||||||
changes: {
|
|
||||||
type: 'array',
|
|
||||||
'x-component': 'TableV2',
|
|
||||||
'x-use-component-props': 'useTableFieldProps',
|
|
||||||
'x-component-props': {
|
|
||||||
rowSelection: false,
|
|
||||||
},
|
|
||||||
properties: {
|
|
||||||
'5uvv96u9ict': {
|
|
||||||
type: 'void',
|
|
||||||
'x-decorator': 'TableV2.Column.Decorator',
|
|
||||||
'x-component': 'TableV2.Column',
|
|
||||||
properties: {
|
|
||||||
field: {
|
|
||||||
'x-collection-field': 'auditChanges.field',
|
|
||||||
'x-component': 'CollectionField',
|
|
||||||
'x-read-pretty': true,
|
|
||||||
'x-component-props': {
|
|
||||||
ellipsis: true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
h7a4tgt11gd: {
|
|
||||||
type: 'void',
|
|
||||||
'x-decorator': 'TableV2.Column.Decorator',
|
|
||||||
'x-component': 'TableV2.Column',
|
|
||||||
properties: {
|
|
||||||
before: {
|
|
||||||
'x-collection-field': 'auditChanges.before',
|
|
||||||
'x-component': 'CollectionField',
|
|
||||||
'x-read-pretty': true,
|
|
||||||
'x-component-props': {
|
|
||||||
ellipsis: true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
m275z8rglzx: {
|
|
||||||
type: 'void',
|
|
||||||
'x-decorator': 'TableV2.Column.Decorator',
|
|
||||||
'x-component': 'TableV2.Column',
|
|
||||||
properties: {
|
|
||||||
after: {
|
|
||||||
'x-collection-field': 'auditChanges.after',
|
|
||||||
'x-component': 'CollectionField',
|
|
||||||
'x-read-pretty': true,
|
|
||||||
'x-component-props': {
|
|
||||||
ellipsis: true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
};
|
|
||||||
return <ActionInitializer schema={schema} />;
|
|
||||||
};
|
|
@ -1,71 +0,0 @@
|
|||||||
import { ISchema } from '@nocobase/schema';
|
|
||||||
import { uid } from '@nocobase/utils/client';
|
|
||||||
|
|
||||||
export function createAuditLogsBlockSchema(): ISchema {
|
|
||||||
return {
|
|
||||||
type: 'void',
|
|
||||||
'x-decorator': 'AuditLogsBlockProvider',
|
|
||||||
'x-acl-action': `auditLogs:list`,
|
|
||||||
'x-decorator-props': {
|
|
||||||
collection: 'auditLogs',
|
|
||||||
action: 'list',
|
|
||||||
params: {
|
|
||||||
pageSize: 20,
|
|
||||||
},
|
|
||||||
rowKey: 'id',
|
|
||||||
showIndex: true,
|
|
||||||
dragSort: false,
|
|
||||||
disableTemplate: true,
|
|
||||||
},
|
|
||||||
'x-toolbar': 'BlockSchemaToolbar',
|
|
||||||
'x-settings': 'blockSettings:table',
|
|
||||||
'x-component': 'CardItem',
|
|
||||||
'x-filter-targets': [],
|
|
||||||
properties: {
|
|
||||||
actions: {
|
|
||||||
type: 'void',
|
|
||||||
'x-initializer': 'auditLogsTable:configureActions',
|
|
||||||
'x-component': 'ActionBar',
|
|
||||||
'x-component-props': {
|
|
||||||
style: {
|
|
||||||
marginBottom: 'var(--nb-spacing)',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
properties: {},
|
|
||||||
},
|
|
||||||
[uid()]: {
|
|
||||||
type: 'array',
|
|
||||||
'x-initializer': 'auditLogsTable:configureColumns',
|
|
||||||
'x-component': 'TableV2',
|
|
||||||
'x-use-component-props': 'useTableBlockProps',
|
|
||||||
'x-component-props': {
|
|
||||||
rowKey: 'id',
|
|
||||||
rowSelection: {
|
|
||||||
type: 'checkbox',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
properties: {
|
|
||||||
actions: {
|
|
||||||
type: 'void',
|
|
||||||
title: '{{ t("Actions") }}',
|
|
||||||
'x-action-column': 'actions',
|
|
||||||
'x-decorator': 'TableV2.Column.ActionBar',
|
|
||||||
'x-component': 'TableV2.Column',
|
|
||||||
'x-designer': 'TableV2.ActionColumnDesigner',
|
|
||||||
'x-initializer': 'auditLogsTable:configureItemActions',
|
|
||||||
properties: {
|
|
||||||
[uid()]: {
|
|
||||||
type: 'void',
|
|
||||||
'x-decorator': 'DndContext',
|
|
||||||
'x-component': 'Space',
|
|
||||||
'x-component-props': {
|
|
||||||
split: '|',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
};
|
|
||||||
}
|
|
@ -1,511 +0,0 @@
|
|||||||
import { ArrayTable } from '@formily/antd-v5';
|
|
||||||
import { observer, useField } from '@nocobase/schema';
|
|
||||||
import {
|
|
||||||
ExtendCollectionsProvider,
|
|
||||||
FormProvider,
|
|
||||||
SchemaComponent,
|
|
||||||
TableBlockProvider,
|
|
||||||
useCollection_deprecated,
|
|
||||||
useCompile,
|
|
||||||
useRecord,
|
|
||||||
} from '@nocobase/client';
|
|
||||||
import React, { createContext, useContext } from 'react';
|
|
||||||
import { AuditLogsDesigner } from './AuditLogsDesigner';
|
|
||||||
|
|
||||||
const collection = {
|
|
||||||
name: 'auditLogs',
|
|
||||||
title: '{{t("Audit logs")}}',
|
|
||||||
fields: [
|
|
||||||
{
|
|
||||||
name: 'createdAt',
|
|
||||||
type: 'date',
|
|
||||||
interface: 'createdAt',
|
|
||||||
uiSchema: {
|
|
||||||
type: 'datetime',
|
|
||||||
title: '{{t("Created at")}}',
|
|
||||||
'x-component': 'DatePicker',
|
|
||||||
'x-component-props': {
|
|
||||||
showTime: true,
|
|
||||||
},
|
|
||||||
'x-read-pretty': true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'type',
|
|
||||||
type: 'string',
|
|
||||||
interface: 'select',
|
|
||||||
uiSchema: {
|
|
||||||
type: 'string',
|
|
||||||
title: '{{t("Action type")}}',
|
|
||||||
'x-component': 'Select',
|
|
||||||
'x-read-pretty': true,
|
|
||||||
enum: [
|
|
||||||
{ label: '{{t("Create record")}}', value: 'create', color: 'lime' },
|
|
||||||
{ label: '{{t("Update record")}}', value: 'update', color: 'gold' },
|
|
||||||
{ label: '{{t("Delete record")}}', value: 'destroy', color: 'magenta' },
|
|
||||||
],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
],
|
|
||||||
};
|
|
||||||
|
|
||||||
const Username = observer(
|
|
||||||
() => {
|
|
||||||
const field = useField<any>();
|
|
||||||
return <div>{field?.value?.nickname || field.value?.id}</div>;
|
|
||||||
},
|
|
||||||
{ displayName: 'Username' },
|
|
||||||
);
|
|
||||||
|
|
||||||
const Collection = observer(
|
|
||||||
() => {
|
|
||||||
const field = useField<any>();
|
|
||||||
const { title, name } = field.value || {};
|
|
||||||
const compile = useCompile();
|
|
||||||
return <div>{title ? compile(title) : name}</div>;
|
|
||||||
},
|
|
||||||
{ displayName: 'Collection' },
|
|
||||||
);
|
|
||||||
|
|
||||||
const Field = observer(
|
|
||||||
() => {
|
|
||||||
const field = useField<any>();
|
|
||||||
const compile = useCompile();
|
|
||||||
if (!field.value) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return <div>{field.value?.uiSchema?.title ? compile(field.value?.uiSchema?.title) : field.value.name}</div>;
|
|
||||||
},
|
|
||||||
{ displayName: 'Field' },
|
|
||||||
);
|
|
||||||
|
|
||||||
const Value = observer(
|
|
||||||
() => {
|
|
||||||
const field = useField<any>();
|
|
||||||
const record = ArrayTable.useRecord();
|
|
||||||
if (record.field?.uiSchema) {
|
|
||||||
return (
|
|
||||||
<FormProvider>
|
|
||||||
<SchemaComponent
|
|
||||||
schema={{
|
|
||||||
name: record.field.name,
|
|
||||||
...record.field?.uiSchema,
|
|
||||||
default: field.value,
|
|
||||||
'x-read-pretty': true,
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
</FormProvider>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
return <div>{field.value ? JSON.stringify(field.value) : null}</div>;
|
|
||||||
},
|
|
||||||
{ displayName: 'Value' },
|
|
||||||
);
|
|
||||||
|
|
||||||
const IsAssociationBlock = createContext(null);
|
|
||||||
IsAssociationBlock.displayName = 'IsAssociationBlock';
|
|
||||||
|
|
||||||
export const AuditLogs: any = () => {
|
|
||||||
const isAssoc = useContext(IsAssociationBlock);
|
|
||||||
const ext = {};
|
|
||||||
if (!isAssoc) {
|
|
||||||
ext['column31'] = {
|
|
||||||
type: 'void',
|
|
||||||
'x-component': 'TableV2.Column',
|
|
||||||
title: '{{t("Record ID")}}',
|
|
||||||
properties: {
|
|
||||||
recordId: {
|
|
||||||
'x-component': 'Input',
|
|
||||||
'x-read-pretty': true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
};
|
|
||||||
}
|
|
||||||
return (
|
|
||||||
<SchemaComponent
|
|
||||||
memoized
|
|
||||||
components={{ ArrayTable, Username, Collection, Field, Value }}
|
|
||||||
schema={{
|
|
||||||
type: 'void',
|
|
||||||
name: 'lfm4trkw8j3',
|
|
||||||
'x-component': 'div',
|
|
||||||
properties: {
|
|
||||||
actions: {
|
|
||||||
type: 'void',
|
|
||||||
'x-component': 'ActionBar',
|
|
||||||
'x-component-props': {
|
|
||||||
style: {
|
|
||||||
marginBottom: 16,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
properties: {
|
|
||||||
filter: {
|
|
||||||
type: 'void',
|
|
||||||
title: '{{ t("Filter") }}',
|
|
||||||
'x-action': 'filter',
|
|
||||||
// 'x-designer': 'Filter.Action.Designer',
|
|
||||||
'x-component': 'Filter.Action',
|
|
||||||
'x-use-component-props': 'useFilterActionProps',
|
|
||||||
'x-component-props': {
|
|
||||||
icon: 'FilterOutlined',
|
|
||||||
},
|
|
||||||
'x-align': 'left',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
y84dlntcaup: {
|
|
||||||
type: 'array',
|
|
||||||
'x-component': 'TableV2',
|
|
||||||
'x-use-component-props': 'useTableBlockProps',
|
|
||||||
'x-component-props': {
|
|
||||||
rowKey: 'id',
|
|
||||||
rowSelection: {
|
|
||||||
type: 'checkbox',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
properties: {
|
|
||||||
actions: {
|
|
||||||
type: 'void',
|
|
||||||
title: '{{ t("Actions") }}',
|
|
||||||
'x-action-column': 'actions',
|
|
||||||
'x-decorator': 'TableV2.Column.ActionBar',
|
|
||||||
'x-component': 'TableV2.Column',
|
|
||||||
'x-designer': 'TableV2.ActionColumnDesigner',
|
|
||||||
'x-initializer': 'table:configureItemActions',
|
|
||||||
properties: {
|
|
||||||
actions: {
|
|
||||||
type: 'void',
|
|
||||||
'x-decorator': 'DndContext',
|
|
||||||
'x-component': 'Space',
|
|
||||||
'x-component-props': {
|
|
||||||
split: '|',
|
|
||||||
},
|
|
||||||
properties: {
|
|
||||||
o80rypwmeeg: {
|
|
||||||
type: 'void',
|
|
||||||
title: '{{ t("View") }}',
|
|
||||||
// 'x-designer': 'Action.Designer',
|
|
||||||
'x-toolbar': 'ActionSchemaToolbar',
|
|
||||||
'x-settings': 'actionSettings:view',
|
|
||||||
'x-component': 'Action.Link',
|
|
||||||
'x-component-props': {
|
|
||||||
openMode: 'drawer',
|
|
||||||
},
|
|
||||||
properties: {
|
|
||||||
drawer: {
|
|
||||||
type: 'void',
|
|
||||||
title: '{{ t("View record") }}',
|
|
||||||
'x-component': 'Action.Container',
|
|
||||||
'x-component-props': {
|
|
||||||
className: 'nb-action-popup',
|
|
||||||
},
|
|
||||||
properties: {
|
|
||||||
grid: {
|
|
||||||
type: 'void',
|
|
||||||
'x-component': 'Grid',
|
|
||||||
properties: {
|
|
||||||
tdlav8o9o17: {
|
|
||||||
type: 'void',
|
|
||||||
'x-component': 'Grid.Row',
|
|
||||||
properties: {
|
|
||||||
'7bsnaf47i6g': {
|
|
||||||
type: 'void',
|
|
||||||
'x-component': 'Grid.Col',
|
|
||||||
properties: {
|
|
||||||
'6s2qbihe3tu': {
|
|
||||||
type: 'void',
|
|
||||||
'x-acl-action': 'auditLogs:get',
|
|
||||||
'x-decorator': 'FormBlockProvider',
|
|
||||||
'x-decorator-props': {
|
|
||||||
resource: 'auditLogs',
|
|
||||||
collection: 'auditLogs',
|
|
||||||
readPretty: true,
|
|
||||||
action: 'get',
|
|
||||||
params: {
|
|
||||||
appends: ['collection', 'user', 'changes'],
|
|
||||||
},
|
|
||||||
useParams: '{{ useParamsFromRecord }}',
|
|
||||||
useSourceId: '{{ useSourceIdFromParentRecord }}',
|
|
||||||
},
|
|
||||||
'x-component': 'CardItem',
|
|
||||||
properties: {
|
|
||||||
mevpuonrda0: {
|
|
||||||
type: 'void',
|
|
||||||
'x-component': 'FormV2',
|
|
||||||
'x-use-component-props': 'useFormBlockProps',
|
|
||||||
'x-read-pretty': true,
|
|
||||||
properties: {
|
|
||||||
grid: {
|
|
||||||
type: 'void',
|
|
||||||
'x-component': 'Grid',
|
|
||||||
properties: {
|
|
||||||
row1: {
|
|
||||||
type: 'void',
|
|
||||||
'x-component': 'Grid.Row',
|
|
||||||
properties: {
|
|
||||||
col11: {
|
|
||||||
type: 'void',
|
|
||||||
'x-component': 'Grid.Col',
|
|
||||||
properties: {
|
|
||||||
collection: {
|
|
||||||
type: 'string',
|
|
||||||
title: '{{t("Collection display name")}}',
|
|
||||||
'x-component': 'Collection',
|
|
||||||
'x-decorator': 'FormItem',
|
|
||||||
'x-read-pretty': true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
row2: {
|
|
||||||
type: 'void',
|
|
||||||
'x-component': 'Grid.Row',
|
|
||||||
properties: {
|
|
||||||
col21: {
|
|
||||||
type: 'void',
|
|
||||||
'x-component': 'Grid.Col',
|
|
||||||
properties: {
|
|
||||||
type: {
|
|
||||||
type: 'string',
|
|
||||||
'x-component': 'CollectionField',
|
|
||||||
'x-decorator': 'FormItem',
|
|
||||||
'x-read-pretty': true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
row3: {
|
|
||||||
type: 'void',
|
|
||||||
'x-component': 'Grid.Row',
|
|
||||||
properties: {
|
|
||||||
col31: {
|
|
||||||
type: 'void',
|
|
||||||
'x-component': 'Grid.Col',
|
|
||||||
properties: {
|
|
||||||
createdAt: {
|
|
||||||
type: 'string',
|
|
||||||
'x-component': 'CollectionField',
|
|
||||||
'x-decorator': 'FormItem',
|
|
||||||
'x-read-pretty': true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
row4: {
|
|
||||||
type: 'void',
|
|
||||||
'x-component': 'Grid.Row',
|
|
||||||
properties: {
|
|
||||||
col41: {
|
|
||||||
type: 'void',
|
|
||||||
'x-component': 'Grid.Col',
|
|
||||||
properties: {
|
|
||||||
user: {
|
|
||||||
type: 'string',
|
|
||||||
title: '{{t("User")}}',
|
|
||||||
'x-component': 'Username',
|
|
||||||
'x-decorator': 'FormItem',
|
|
||||||
'x-read-pretty': true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
row5: {
|
|
||||||
type: 'void',
|
|
||||||
'x-component': 'Grid.Row',
|
|
||||||
properties: {
|
|
||||||
col51: {
|
|
||||||
type: 'void',
|
|
||||||
'x-component': 'Grid.Col',
|
|
||||||
properties: {
|
|
||||||
changes: {
|
|
||||||
type: 'array',
|
|
||||||
title: '{{t("Field value changes")}}',
|
|
||||||
'x-decorator': 'FormItem',
|
|
||||||
'x-component': 'ArrayTable',
|
|
||||||
'x-component-props': {
|
|
||||||
pagination: { pageSize: 10 },
|
|
||||||
scroll: { x: '100%' },
|
|
||||||
},
|
|
||||||
items: {
|
|
||||||
type: 'object',
|
|
||||||
properties: {
|
|
||||||
column3: {
|
|
||||||
type: 'void',
|
|
||||||
'x-component': 'ArrayTable.Column',
|
|
||||||
'x-component-props': {
|
|
||||||
width: 200,
|
|
||||||
title: '{{t("Field")}}',
|
|
||||||
},
|
|
||||||
properties: {
|
|
||||||
field: {
|
|
||||||
type: 'string',
|
|
||||||
//'x-decorator': 'Editable',
|
|
||||||
'x-component': 'Field',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
column4: {
|
|
||||||
type: 'void',
|
|
||||||
'x-component': 'ArrayTable.Column',
|
|
||||||
'x-component-props': {
|
|
||||||
width: 200,
|
|
||||||
title: '{{t("Before change")}}',
|
|
||||||
},
|
|
||||||
properties: {
|
|
||||||
before: {
|
|
||||||
type: 'string',
|
|
||||||
'x-decorator': 'FormItem',
|
|
||||||
'x-component': 'Value',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
column5: {
|
|
||||||
type: 'void',
|
|
||||||
'x-component': 'ArrayTable.Column',
|
|
||||||
'x-component-props': {
|
|
||||||
width: 200,
|
|
||||||
title: '{{t("After change")}}',
|
|
||||||
},
|
|
||||||
properties: {
|
|
||||||
after: {
|
|
||||||
type: 'string',
|
|
||||||
'x-decorator': 'FormItem',
|
|
||||||
'x-component': 'Value',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
column1: {
|
|
||||||
type: 'void',
|
|
||||||
'x-decorator': 'TableV2.Column.Decorator',
|
|
||||||
'x-component': 'TableV2.Column',
|
|
||||||
properties: {
|
|
||||||
createdAt: {
|
|
||||||
'x-component': 'CollectionField',
|
|
||||||
'x-read-pretty': true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
column2: {
|
|
||||||
type: 'void',
|
|
||||||
'x-decorator': 'TableV2.Column.Decorator',
|
|
||||||
'x-component': 'TableV2.Column',
|
|
||||||
properties: {
|
|
||||||
type: {
|
|
||||||
'x-component': 'CollectionField',
|
|
||||||
'x-read-pretty': true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
column3: {
|
|
||||||
type: 'void',
|
|
||||||
'x-component': 'TableV2.Column',
|
|
||||||
title: '{{t("Collection display name")}}',
|
|
||||||
properties: {
|
|
||||||
collection: {
|
|
||||||
'x-component': 'Collection',
|
|
||||||
'x-read-pretty': true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
...ext,
|
|
||||||
column4: {
|
|
||||||
type: 'void',
|
|
||||||
'x-component': 'TableV2.Column',
|
|
||||||
title: '{{t("User")}}',
|
|
||||||
properties: {
|
|
||||||
user: {
|
|
||||||
'x-component': 'Username',
|
|
||||||
'x-read-pretty': true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
AuditLogs.Decorator = observer(
|
|
||||||
(props: any) => {
|
|
||||||
const parent = useCollection_deprecated();
|
|
||||||
const record = useRecord();
|
|
||||||
let filter = props?.params?.filter;
|
|
||||||
if (parent.name) {
|
|
||||||
const filterByTk = record?.[parent.filterTargetKey || 'id'];
|
|
||||||
if (filter) {
|
|
||||||
filter = {
|
|
||||||
$and: [
|
|
||||||
filter,
|
|
||||||
{
|
|
||||||
collectionName: parent.name,
|
|
||||||
recordId: `${filterByTk}`,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
};
|
|
||||||
} else {
|
|
||||||
filter = {
|
|
||||||
collectionName: parent.name,
|
|
||||||
recordId: `${filterByTk}`,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
const defaults = {
|
|
||||||
collection: 'auditLogs',
|
|
||||||
resource: 'auditLogs',
|
|
||||||
action: 'list',
|
|
||||||
params: {
|
|
||||||
pageSize: 20,
|
|
||||||
appends: ['collection', 'user'],
|
|
||||||
...props.params,
|
|
||||||
filter,
|
|
||||||
sort: '-createdAt',
|
|
||||||
},
|
|
||||||
rowKey: 'id',
|
|
||||||
showIndex: true,
|
|
||||||
dragSort: false,
|
|
||||||
};
|
|
||||||
return (
|
|
||||||
<IsAssociationBlock.Provider value={!!parent.name}>
|
|
||||||
<ExtendCollectionsProvider collections={[collection]}>
|
|
||||||
<TableBlockProvider {...defaults}>{props.children}</TableBlockProvider>
|
|
||||||
</ExtendCollectionsProvider>
|
|
||||||
</IsAssociationBlock.Provider>
|
|
||||||
);
|
|
||||||
},
|
|
||||||
{ displayName: 'AuditLogs.Decorator' },
|
|
||||||
);
|
|
||||||
|
|
||||||
AuditLogs.Designer = AuditLogsDesigner;
|
|
@ -1,77 +0,0 @@
|
|||||||
import { useField, useFieldSchema } from '@nocobase/schema';
|
|
||||||
import {
|
|
||||||
GeneralSchemaDesigner,
|
|
||||||
SchemaSettingsDataScope,
|
|
||||||
SchemaSettingsDivider,
|
|
||||||
SchemaSettingsRemove,
|
|
||||||
SchemaSettingsSelectItem,
|
|
||||||
useCollection_deprecated,
|
|
||||||
useDesignable,
|
|
||||||
useFormBlockContext,
|
|
||||||
useTableBlockContext,
|
|
||||||
} from '@nocobase/client';
|
|
||||||
import React from 'react';
|
|
||||||
import { useTranslation } from 'react-i18next';
|
|
||||||
|
|
||||||
export const AuditLogsDesigner = () => {
|
|
||||||
const { name, title } = useCollection_deprecated();
|
|
||||||
const field = useField();
|
|
||||||
const fieldSchema = useFieldSchema();
|
|
||||||
const { form } = useFormBlockContext();
|
|
||||||
const { service } = useTableBlockContext();
|
|
||||||
const { t } = useTranslation();
|
|
||||||
const { dn } = useDesignable();
|
|
||||||
return (
|
|
||||||
<GeneralSchemaDesigner title={title || name}>
|
|
||||||
<SchemaSettingsDataScope
|
|
||||||
collectionName={name}
|
|
||||||
defaultFilter={fieldSchema?.['x-decorator-props']?.params?.filter || {}}
|
|
||||||
form={form}
|
|
||||||
onSubmit={({ filter }) => {
|
|
||||||
const params = field.decoratorProps.params || {};
|
|
||||||
params.filter = filter;
|
|
||||||
field.decoratorProps.params = params;
|
|
||||||
fieldSchema['x-decorator-props']['params'] = params;
|
|
||||||
service.run({ ...service.params?.[0], filter, page: 1 });
|
|
||||||
dn.emit('patch', {
|
|
||||||
schema: {
|
|
||||||
['x-uid']: fieldSchema['x-uid'],
|
|
||||||
'x-decorator-props': fieldSchema['x-decorator-props'],
|
|
||||||
},
|
|
||||||
});
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
<SchemaSettingsSelectItem
|
|
||||||
title={t('Records per page')}
|
|
||||||
value={field.decoratorProps?.params?.pageSize || 20}
|
|
||||||
options={[
|
|
||||||
{ label: '10', value: 10 },
|
|
||||||
{ label: '20', value: 20 },
|
|
||||||
{ label: '50', value: 50 },
|
|
||||||
{ label: '100', value: 100 },
|
|
||||||
{ label: '200', value: 200 },
|
|
||||||
]}
|
|
||||||
onChange={(pageSize) => {
|
|
||||||
const params = field.decoratorProps.params || {};
|
|
||||||
params.pageSize = pageSize;
|
|
||||||
field.decoratorProps.params = params;
|
|
||||||
fieldSchema['x-decorator-props']['params'] = params;
|
|
||||||
service.run({ ...service.params?.[0], pageSize, page: 1 });
|
|
||||||
dn.emit('patch', {
|
|
||||||
schema: {
|
|
||||||
['x-uid']: fieldSchema['x-uid'],
|
|
||||||
'x-decorator-props': fieldSchema['x-decorator-props'],
|
|
||||||
},
|
|
||||||
});
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
<SchemaSettingsDivider />
|
|
||||||
<SchemaSettingsRemove
|
|
||||||
removeParentsIfNoChildren
|
|
||||||
breakRemoveOn={{
|
|
||||||
'x-component': 'Grid',
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
</GeneralSchemaDesigner>
|
|
||||||
);
|
|
||||||
};
|
|
@ -1,39 +0,0 @@
|
|||||||
import { Plugin, SchemaInitializerItemType } from '@nocobase/client';
|
|
||||||
import { AuditLogsProvider } from './AuditLogsProvider';
|
|
||||||
import {
|
|
||||||
auditLogsTableActionColumnInitializers,
|
|
||||||
auditLogsTableActionColumnInitializers_deprecated,
|
|
||||||
} from './initializers/AuditLogsTableActionColumnInitializers';
|
|
||||||
import {
|
|
||||||
auditLogsTableActionInitializers,
|
|
||||||
auditLogsTableActionInitializers_deprecated,
|
|
||||||
} from './initializers/AuditLogsTableActionInitializers';
|
|
||||||
import {
|
|
||||||
auditLogsTableColumnInitializers,
|
|
||||||
auditLogsTableColumnInitializers_deprecated,
|
|
||||||
} from './initializers/AuditLogsTableColumnInitializers';
|
|
||||||
export * from './AuditLogsBlockInitializer';
|
|
||||||
export * from './AuditLogsProvider';
|
|
||||||
|
|
||||||
export class AuditLogsPlugin extends Plugin {
|
|
||||||
async load() {
|
|
||||||
this.app.use(AuditLogsProvider);
|
|
||||||
this.app.schemaInitializerManager.add(auditLogsTableActionInitializers_deprecated);
|
|
||||||
this.app.schemaInitializerManager.add(auditLogsTableActionInitializers);
|
|
||||||
this.app.schemaInitializerManager.add(auditLogsTableActionColumnInitializers_deprecated);
|
|
||||||
this.app.schemaInitializerManager.add(auditLogsTableActionColumnInitializers);
|
|
||||||
this.app.schemaInitializerManager.add(auditLogsTableColumnInitializers_deprecated);
|
|
||||||
this.app.schemaInitializerManager.add(auditLogsTableColumnInitializers);
|
|
||||||
|
|
||||||
const blockInitializers = this.app.schemaInitializerManager.get('page:addBlock');
|
|
||||||
const recordBlockInitializers = this.app.schemaInitializerManager.get('popup:common:addBlock');
|
|
||||||
const auditLogs: Omit<SchemaInitializerItemType, 'name'> = {
|
|
||||||
title: '{{t("Audit logs")}}',
|
|
||||||
Component: 'AuditLogsBlockInitializer',
|
|
||||||
};
|
|
||||||
blockInitializers.add('otherBlocks.auditLogs', auditLogs);
|
|
||||||
recordBlockInitializers.add('otherBlocks.auditLogs', auditLogs);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export default AuditLogsPlugin;
|
|
@ -1,27 +0,0 @@
|
|||||||
import { InitializerWithSwitch, useSchemaInitializerItem } from '@nocobase/client';
|
|
||||||
import React from 'react';
|
|
||||||
|
|
||||||
export const AuditLogsTableActionColumnInitializer = () => {
|
|
||||||
const schema = {
|
|
||||||
type: 'void',
|
|
||||||
title: '{{ t("Actions") }}',
|
|
||||||
'x-decorator': 'TableV2.Column.ActionBar',
|
|
||||||
'x-component': 'TableV2.Column',
|
|
||||||
'x-designer': 'TableV2.ActionColumnDesigner',
|
|
||||||
'x-initializer': 'auditLogsTable:configureItemActions',
|
|
||||||
'x-action-column': 'actions',
|
|
||||||
properties: {
|
|
||||||
actions: {
|
|
||||||
type: 'void',
|
|
||||||
'x-decorator': 'DndContext',
|
|
||||||
'x-component': 'Space',
|
|
||||||
'x-component-props': {
|
|
||||||
split: '|',
|
|
||||||
},
|
|
||||||
properties: {},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
};
|
|
||||||
const itemConfig = useSchemaInitializerItem();
|
|
||||||
return <InitializerWithSwitch {...itemConfig} schema={schema} item={itemConfig} type={'x-action-column'} />;
|
|
||||||
};
|
|
@ -1,141 +0,0 @@
|
|||||||
import { MenuOutlined } from '@ant-design/icons';
|
|
||||||
import { useFieldSchema } from '@nocobase/schema';
|
|
||||||
import {
|
|
||||||
CompatibleSchemaInitializer,
|
|
||||||
createDesignable,
|
|
||||||
Resizable,
|
|
||||||
useAPIClient,
|
|
||||||
useDesignable,
|
|
||||||
} from '@nocobase/client';
|
|
||||||
import React from 'react';
|
|
||||||
import { useTranslation } from 'react-i18next';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated
|
|
||||||
*/
|
|
||||||
export const auditLogsTableActionColumnInitializers_deprecated = new CompatibleSchemaInitializer({
|
|
||||||
name: 'AuditLogsTableActionColumnInitializers',
|
|
||||||
insertPosition: 'beforeEnd',
|
|
||||||
Component: (props: any) => <MenuOutlined {...props} style={{ cursor: 'pointer' }} />,
|
|
||||||
useInsert() {
|
|
||||||
const fieldSchema = useFieldSchema();
|
|
||||||
const api = useAPIClient();
|
|
||||||
const { refresh } = useDesignable();
|
|
||||||
const { t } = useTranslation();
|
|
||||||
|
|
||||||
return (schema) => {
|
|
||||||
const spaceSchema = fieldSchema.reduceProperties((buf, schema) => {
|
|
||||||
if (schema['x-component'] === 'Space') {
|
|
||||||
return schema;
|
|
||||||
}
|
|
||||||
return buf;
|
|
||||||
}, null);
|
|
||||||
if (!spaceSchema) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
const dn = createDesignable({
|
|
||||||
t,
|
|
||||||
api,
|
|
||||||
refresh,
|
|
||||||
current: spaceSchema,
|
|
||||||
});
|
|
||||||
dn.loadAPIClientEvents();
|
|
||||||
dn.insertBeforeEnd(schema);
|
|
||||||
};
|
|
||||||
},
|
|
||||||
items: [
|
|
||||||
{
|
|
||||||
name: 'enableActions',
|
|
||||||
type: 'itemGroup',
|
|
||||||
title: '{{t("Enable actions")}}',
|
|
||||||
children: [
|
|
||||||
{
|
|
||||||
name: 'view',
|
|
||||||
type: 'item',
|
|
||||||
title: '{{t("View")}}',
|
|
||||||
Component: 'AuditLogsViewActionInitializer',
|
|
||||||
schema: {
|
|
||||||
'x-component': 'Action.Link',
|
|
||||||
'x-action': 'view',
|
|
||||||
'x-decorator': 'ACLActionProvider',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'divider',
|
|
||||||
type: 'divider',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'columnWidth',
|
|
||||||
type: 'item',
|
|
||||||
title: '{{t("Column width")}}',
|
|
||||||
Component: Resizable,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
});
|
|
||||||
|
|
||||||
export const auditLogsTableActionColumnInitializers = new CompatibleSchemaInitializer(
|
|
||||||
{
|
|
||||||
name: 'auditLogsTable:configureItemActions',
|
|
||||||
insertPosition: 'beforeEnd',
|
|
||||||
Component: (props: any) => <MenuOutlined {...props} style={{ cursor: 'pointer' }} />,
|
|
||||||
useInsert() {
|
|
||||||
const fieldSchema = useFieldSchema();
|
|
||||||
const api = useAPIClient();
|
|
||||||
const { refresh } = useDesignable();
|
|
||||||
const { t } = useTranslation();
|
|
||||||
|
|
||||||
return (schema) => {
|
|
||||||
const spaceSchema = fieldSchema.reduceProperties((buf, schema) => {
|
|
||||||
if (schema['x-component'] === 'Space') {
|
|
||||||
return schema;
|
|
||||||
}
|
|
||||||
return buf;
|
|
||||||
}, null);
|
|
||||||
if (!spaceSchema) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
const dn = createDesignable({
|
|
||||||
t,
|
|
||||||
api,
|
|
||||||
refresh,
|
|
||||||
current: spaceSchema,
|
|
||||||
});
|
|
||||||
dn.loadAPIClientEvents();
|
|
||||||
dn.insertBeforeEnd(schema);
|
|
||||||
};
|
|
||||||
},
|
|
||||||
items: [
|
|
||||||
{
|
|
||||||
name: 'enableActions',
|
|
||||||
type: 'itemGroup',
|
|
||||||
title: '{{t("Enable actions")}}',
|
|
||||||
children: [
|
|
||||||
{
|
|
||||||
name: 'view',
|
|
||||||
type: 'item',
|
|
||||||
title: '{{t("View")}}',
|
|
||||||
Component: 'AuditLogsViewActionInitializer',
|
|
||||||
schema: {
|
|
||||||
'x-component': 'Action.Link',
|
|
||||||
'x-action': 'view',
|
|
||||||
'x-decorator': 'ACLActionProvider',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'divider',
|
|
||||||
type: 'divider',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'columnWidth',
|
|
||||||
type: 'item',
|
|
||||||
title: '{{t("Column width")}}',
|
|
||||||
Component: Resizable,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
auditLogsTableActionColumnInitializers_deprecated,
|
|
||||||
);
|
|
@ -1,76 +0,0 @@
|
|||||||
import { CompatibleSchemaInitializer } from '@nocobase/client';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated
|
|
||||||
* 操作记录表格操作配置
|
|
||||||
*/
|
|
||||||
export const auditLogsTableActionInitializers_deprecated = new CompatibleSchemaInitializer({
|
|
||||||
name: 'AuditLogsTableActionInitializers',
|
|
||||||
title: "{{t('Configure actions')}}",
|
|
||||||
icon: 'SettingOutlined',
|
|
||||||
style: {
|
|
||||||
marginLeft: 8,
|
|
||||||
},
|
|
||||||
items: [
|
|
||||||
{
|
|
||||||
type: 'itemGroup',
|
|
||||||
title: "{{t('Enable actions')}}",
|
|
||||||
name: 'enableActions',
|
|
||||||
children: [
|
|
||||||
{
|
|
||||||
name: 'filter',
|
|
||||||
title: "{{t('Filter')}}",
|
|
||||||
Component: 'FilterActionInitializer',
|
|
||||||
schema: {
|
|
||||||
'x-align': 'left',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'refresh',
|
|
||||||
title: "{{t('Refresh')}}",
|
|
||||||
Component: 'RefreshActionInitializer',
|
|
||||||
schema: {
|
|
||||||
'x-align': 'right',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
],
|
|
||||||
});
|
|
||||||
|
|
||||||
export const auditLogsTableActionInitializers = new CompatibleSchemaInitializer(
|
|
||||||
{
|
|
||||||
name: 'auditLogsTable:configureActions',
|
|
||||||
title: "{{t('Configure actions')}}",
|
|
||||||
icon: 'SettingOutlined',
|
|
||||||
style: {
|
|
||||||
marginLeft: 8,
|
|
||||||
},
|
|
||||||
items: [
|
|
||||||
{
|
|
||||||
type: 'itemGroup',
|
|
||||||
title: "{{t('Enable actions')}}",
|
|
||||||
name: 'enableActions',
|
|
||||||
children: [
|
|
||||||
{
|
|
||||||
name: 'filter',
|
|
||||||
title: "{{t('Filter')}}",
|
|
||||||
Component: 'FilterActionInitializer',
|
|
||||||
schema: {
|
|
||||||
'x-align': 'left',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'refresh',
|
|
||||||
title: "{{t('Refresh')}}",
|
|
||||||
Component: 'RefreshActionInitializer',
|
|
||||||
schema: {
|
|
||||||
'x-align': 'right',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
auditLogsTableActionInitializers_deprecated,
|
|
||||||
);
|
|
@ -1,139 +0,0 @@
|
|||||||
import {
|
|
||||||
CompatibleSchemaInitializer,
|
|
||||||
SchemaInitializerChildren,
|
|
||||||
useAssociatedTableColumnInitializerFields,
|
|
||||||
useCompile,
|
|
||||||
useInheritsTableColumnInitializerFields,
|
|
||||||
useTableColumnInitializerFields,
|
|
||||||
} from '@nocobase/client';
|
|
||||||
import React from 'react';
|
|
||||||
import { useTranslation } from 'react-i18next';
|
|
||||||
|
|
||||||
// 表格列配置
|
|
||||||
const ParentCollectionFields = () => {
|
|
||||||
const inheritFields = useInheritsTableColumnInitializerFields();
|
|
||||||
const { t } = useTranslation();
|
|
||||||
const compile = useCompile();
|
|
||||||
if (!inheritFields?.length) return null;
|
|
||||||
const res = [];
|
|
||||||
inheritFields.forEach((inherit) => {
|
|
||||||
Object.values(inherit)[0].length &&
|
|
||||||
res.push({
|
|
||||||
type: 'itemGroup',
|
|
||||||
divider: true,
|
|
||||||
title: t(`Parent collection fields`) + '(' + compile(`${Object.keys(inherit)[0]}`) + ')',
|
|
||||||
children: Object.values(inherit)[0].filter((v: any) => !v?.field?.isForeignKey),
|
|
||||||
});
|
|
||||||
});
|
|
||||||
return <SchemaInitializerChildren>{res}</SchemaInitializerChildren>;
|
|
||||||
};
|
|
||||||
|
|
||||||
const AssociatedFields = () => {
|
|
||||||
const associatedFields = useAssociatedTableColumnInitializerFields();
|
|
||||||
const { t } = useTranslation();
|
|
||||||
|
|
||||||
if (!associatedFields?.length) return null;
|
|
||||||
const schema: any = [
|
|
||||||
{
|
|
||||||
type: 'itemGroup',
|
|
||||||
divider: true,
|
|
||||||
title: t('Display association fields'),
|
|
||||||
children: associatedFields,
|
|
||||||
},
|
|
||||||
];
|
|
||||||
return <SchemaInitializerChildren>{schema}</SchemaInitializerChildren>;
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated
|
|
||||||
*/
|
|
||||||
export const auditLogsTableColumnInitializers_deprecated = new CompatibleSchemaInitializer({
|
|
||||||
name: 'AuditLogsTableColumnInitializers',
|
|
||||||
insertPosition: 'beforeEnd',
|
|
||||||
icon: 'SettingOutlined',
|
|
||||||
title: '{{t("Configure columns")}}',
|
|
||||||
wrap(s) {
|
|
||||||
if (s['x-action-column']) {
|
|
||||||
return s;
|
|
||||||
}
|
|
||||||
return {
|
|
||||||
type: 'void',
|
|
||||||
'x-decorator': 'TableV2.Column.Decorator',
|
|
||||||
'x-designer': 'TableV2.Column.Designer',
|
|
||||||
'x-component': 'TableV2.Column',
|
|
||||||
properties: {
|
|
||||||
[s.name]: {
|
|
||||||
...s,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
};
|
|
||||||
},
|
|
||||||
items: [
|
|
||||||
{
|
|
||||||
name: 'displayFields',
|
|
||||||
type: 'itemGroup',
|
|
||||||
title: '{{t("Display fields")}}',
|
|
||||||
useChildren: useTableColumnInitializerFields,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'parentCollectionFields',
|
|
||||||
Component: ParentCollectionFields,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'associationFields',
|
|
||||||
Component: AssociatedFields,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'actionColumn',
|
|
||||||
title: '{{t("Action column")}}',
|
|
||||||
Component: 'AuditLogsTableActionColumnInitializer',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
});
|
|
||||||
|
|
||||||
export const auditLogsTableColumnInitializers = new CompatibleSchemaInitializer(
|
|
||||||
{
|
|
||||||
name: 'auditLogsTable:configureColumns',
|
|
||||||
insertPosition: 'beforeEnd',
|
|
||||||
icon: 'SettingOutlined',
|
|
||||||
title: '{{t("Configure columns")}}',
|
|
||||||
wrap(s) {
|
|
||||||
if (s['x-action-column']) {
|
|
||||||
return s;
|
|
||||||
}
|
|
||||||
return {
|
|
||||||
type: 'void',
|
|
||||||
'x-decorator': 'TableV2.Column.Decorator',
|
|
||||||
'x-designer': 'TableV2.Column.Designer',
|
|
||||||
'x-component': 'TableV2.Column',
|
|
||||||
properties: {
|
|
||||||
[s.name]: {
|
|
||||||
...s,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
};
|
|
||||||
},
|
|
||||||
items: [
|
|
||||||
{
|
|
||||||
name: 'displayFields',
|
|
||||||
type: 'itemGroup',
|
|
||||||
title: '{{t("Display fields")}}',
|
|
||||||
useChildren: useTableColumnInitializerFields,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'parentCollectionFields',
|
|
||||||
Component: ParentCollectionFields,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'associationFields',
|
|
||||||
Component: AssociatedFields,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'actionColumn',
|
|
||||||
title: '{{t("Action column")}}',
|
|
||||||
Component: 'AuditLogsTableActionColumnInitializer',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
auditLogsTableColumnInitializers_deprecated,
|
|
||||||
);
|
|
@ -1,12 +0,0 @@
|
|||||||
import { i18n } from '@nocobase/client';
|
|
||||||
import { useTranslation } from 'react-i18next';
|
|
||||||
|
|
||||||
export const NAMESPACE = 'audit-logs';
|
|
||||||
|
|
||||||
export function lang(key: string) {
|
|
||||||
return i18n.t(key, { ns: NAMESPACE });
|
|
||||||
}
|
|
||||||
|
|
||||||
export function useAuditLogsTranslation() {
|
|
||||||
return useTranslation(NAMESPACE);
|
|
||||||
}
|
|
@ -1,303 +0,0 @@
|
|||||||
import { uid } from '@nocobase/schema';
|
|
||||||
|
|
||||||
export const createSchema = () => {
|
|
||||||
const filterSchema = {
|
|
||||||
'x-component': 'Action',
|
|
||||||
'x-component-props': {
|
|
||||||
popover: true,
|
|
||||||
},
|
|
||||||
type: 'void',
|
|
||||||
title: '{{t("Filter")}}',
|
|
||||||
properties: {
|
|
||||||
popover: {
|
|
||||||
type: 'void',
|
|
||||||
'x-decorator': 'Form',
|
|
||||||
'x-decorator-props': {},
|
|
||||||
'x-component': 'Action.Popover',
|
|
||||||
'x-component-props': {
|
|
||||||
trigger: 'click',
|
|
||||||
placement: 'bottomLeft',
|
|
||||||
},
|
|
||||||
properties: {
|
|
||||||
filter: {
|
|
||||||
type: 'object',
|
|
||||||
default: {
|
|
||||||
$and: [{}],
|
|
||||||
},
|
|
||||||
'x-component': 'Filter',
|
|
||||||
'x-component-props': {
|
|
||||||
useDataSource: '{{cm.useFilterDataSource}}',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
footer: {
|
|
||||||
type: 'void',
|
|
||||||
'x-component': 'Action.Popover.Footer',
|
|
||||||
properties: {
|
|
||||||
actions: {
|
|
||||||
type: 'void',
|
|
||||||
'x-component': 'ActionBar',
|
|
||||||
properties: {
|
|
||||||
saveDefault: {
|
|
||||||
type: 'void',
|
|
||||||
'x-component': 'Filter.SaveDefaultValue',
|
|
||||||
'x-component-props': {},
|
|
||||||
},
|
|
||||||
cancel: {
|
|
||||||
type: 'void',
|
|
||||||
title: '{{t("Cancel")}}',
|
|
||||||
'x-component': 'Action',
|
|
||||||
'x-component-props': {
|
|
||||||
useAction: '{{cm.useCancelFilterAction}}',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
submit: {
|
|
||||||
type: 'void',
|
|
||||||
title: '{{t("Submit")}}',
|
|
||||||
'x-component': 'Action',
|
|
||||||
'x-component-props': {
|
|
||||||
type: 'primary',
|
|
||||||
useAction: '{{cm.useFilterAction}}',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
};
|
|
||||||
const schema = {
|
|
||||||
type: 'void',
|
|
||||||
name: 'actionLog',
|
|
||||||
'x-decorator': 'ResourceActionProvider',
|
|
||||||
'x-decorator-props': {
|
|
||||||
collection: 'action_logs',
|
|
||||||
dragSort: false,
|
|
||||||
request: {
|
|
||||||
resource: 'action_logs',
|
|
||||||
action: 'list',
|
|
||||||
params: {
|
|
||||||
pageSize: 20,
|
|
||||||
filter: {},
|
|
||||||
appends: [],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
'x-designer': 'ActionLog.Designer',
|
|
||||||
'x-component': 'CardItem',
|
|
||||||
properties: {
|
|
||||||
actions: {
|
|
||||||
type: 'void',
|
|
||||||
'x-component': 'ActionBar',
|
|
||||||
'x-component-props': {
|
|
||||||
layout: 'one-column',
|
|
||||||
style: {
|
|
||||||
marginBottom: 16,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
properties: {
|
|
||||||
[uid()]: { ...filterSchema },
|
|
||||||
},
|
|
||||||
},
|
|
||||||
table: {
|
|
||||||
type: 'void',
|
|
||||||
'x-component': 'Table.Void',
|
|
||||||
'x-component-props': {
|
|
||||||
rowKey: 'id',
|
|
||||||
useDataSource: '{{cm.useDataSourceFromRAC}}',
|
|
||||||
},
|
|
||||||
properties: {
|
|
||||||
column1: {
|
|
||||||
type: 'void',
|
|
||||||
title: "{{t('Created at')}}",
|
|
||||||
'x-component': 'Table.Column',
|
|
||||||
properties: {
|
|
||||||
created_at: {
|
|
||||||
type: 'string',
|
|
||||||
'x-component': 'DatePicker',
|
|
||||||
'x-read-pretty': true,
|
|
||||||
'x-component-props': {
|
|
||||||
format: 'YYYY-MM-DD HH:mm:ss',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
column2: {
|
|
||||||
type: 'void',
|
|
||||||
title: "{{t('Created by')}}",
|
|
||||||
'x-component': 'Table.Column',
|
|
||||||
properties: {
|
|
||||||
'user.nickname': {
|
|
||||||
type: 'string',
|
|
||||||
'x-component': 'Input',
|
|
||||||
'x-read-pretty': true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
column3: {
|
|
||||||
type: 'void',
|
|
||||||
title: "{{t('Collection display name')}}",
|
|
||||||
'x-component': 'Table.Column',
|
|
||||||
properties: {
|
|
||||||
'collection.title': {
|
|
||||||
type: 'string',
|
|
||||||
'x-component': 'Input',
|
|
||||||
'x-read-pretty': true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
column4: {
|
|
||||||
type: 'void',
|
|
||||||
title: "{{t('Action type')}}",
|
|
||||||
'x-component': 'Table.Column',
|
|
||||||
properties: {
|
|
||||||
type: {
|
|
||||||
type: 'string',
|
|
||||||
'x-component': 'Select',
|
|
||||||
'x-read-pretty': true,
|
|
||||||
enum: [
|
|
||||||
{ label: "{{ t('Add new') }}", value: 'create', color: 'green' },
|
|
||||||
{ label: "{{ t('Update') }}", value: 'update', color: 'blue' },
|
|
||||||
{ label: "{{ t('Delete') }}", value: 'destroy', color: 'red' },
|
|
||||||
],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
[uid()]: {
|
|
||||||
type: 'void',
|
|
||||||
title: "{{t('Actions')}}",
|
|
||||||
'x-component': 'Table.Column',
|
|
||||||
'x-component-props': {
|
|
||||||
width: 60,
|
|
||||||
align: 'center',
|
|
||||||
},
|
|
||||||
properties: {
|
|
||||||
[uid()]: {
|
|
||||||
title: '{{ t("View") }}',
|
|
||||||
type: 'void',
|
|
||||||
'x-action': 'view',
|
|
||||||
'x-component': 'Action.Link',
|
|
||||||
'x-component-props': {
|
|
||||||
openMode: 'drawer',
|
|
||||||
},
|
|
||||||
properties: {
|
|
||||||
drawer: {
|
|
||||||
type: 'void',
|
|
||||||
'x-component': 'Action.Container',
|
|
||||||
'x-component-props': {
|
|
||||||
className: 'nb-action-popup',
|
|
||||||
},
|
|
||||||
title: '{{ t("View record") }}',
|
|
||||||
properties: {
|
|
||||||
created_at: {
|
|
||||||
type: 'string',
|
|
||||||
title: "{{t('Created at')}}",
|
|
||||||
'x-decorator': 'FormItem',
|
|
||||||
'x-component': 'DatePicker',
|
|
||||||
'x-read-pretty': true,
|
|
||||||
'x-component-props': {
|
|
||||||
format: 'YYYY-MM-DD HH:mm:ss',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
'user.nickname': {
|
|
||||||
type: 'string',
|
|
||||||
title: "{{t('Created by')}}",
|
|
||||||
'x-decorator': 'FormItem',
|
|
||||||
'x-component': 'Input',
|
|
||||||
'x-read-pretty': true,
|
|
||||||
},
|
|
||||||
'collection.title': {
|
|
||||||
type: 'string',
|
|
||||||
title: "{{t('Collection display name')}}",
|
|
||||||
'x-decorator': 'FormItem',
|
|
||||||
'x-component': 'Input',
|
|
||||||
'x-read-pretty': true,
|
|
||||||
},
|
|
||||||
type: {
|
|
||||||
type: 'string',
|
|
||||||
title: "{{t('Action type')}}",
|
|
||||||
'x-decorator': 'FormItem',
|
|
||||||
'x-component': 'Select',
|
|
||||||
'x-read-pretty': true,
|
|
||||||
enum: [
|
|
||||||
{
|
|
||||||
label: "{{t('Insert')}}",
|
|
||||||
value: 'create',
|
|
||||||
color: 'green',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: "{{t('Update')}}",
|
|
||||||
value: 'update',
|
|
||||||
color: 'blue',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: "{{t('Delete')}}",
|
|
||||||
value: 'destroy',
|
|
||||||
color: 'red',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
changes: {
|
|
||||||
type: 'array',
|
|
||||||
title: "{{t('Data changes')}}",
|
|
||||||
'x-decorator': 'FormItem',
|
|
||||||
'x-component': 'Table.Array',
|
|
||||||
'x-component-props': {
|
|
||||||
pagination: false,
|
|
||||||
showIndex: true,
|
|
||||||
},
|
|
||||||
items: {
|
|
||||||
type: 'object',
|
|
||||||
properties: {
|
|
||||||
column1: {
|
|
||||||
type: 'void',
|
|
||||||
'x-component': 'Table.Column',
|
|
||||||
'x-component-props': { title: "{{t('Field display name')}}" },
|
|
||||||
properties: {
|
|
||||||
field: {
|
|
||||||
type: 'string',
|
|
||||||
'x-decorator': 'FormilyFormItem',
|
|
||||||
'x-component': 'ActionLog.Field',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
column2: {
|
|
||||||
type: 'void',
|
|
||||||
'x-component': 'Table.Column',
|
|
||||||
'x-component-props': { title: "{{ t('Before change') }}" },
|
|
||||||
properties: {
|
|
||||||
before: {
|
|
||||||
type: 'string',
|
|
||||||
'x-decorator': 'FormilyFormItem',
|
|
||||||
'x-component': 'ActionLog.FieldValue',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
column3: {
|
|
||||||
type: 'void',
|
|
||||||
'x-component': 'Table.Column',
|
|
||||||
'x-component-props': { title: "{{ t('After change') }}" },
|
|
||||||
properties: {
|
|
||||||
after: {
|
|
||||||
type: 'string',
|
|
||||||
'x-decorator': 'FormilyFormItem',
|
|
||||||
'x-component': 'ActionLog.FieldValue',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
};
|
|
||||||
return schema;
|
|
||||||
};
|
|
@ -1,2 +0,0 @@
|
|||||||
export * from './server';
|
|
||||||
export { default } from './server';
|
|
@ -1,3 +0,0 @@
|
|||||||
{
|
|
||||||
"Details of changes": "Details of changes"
|
|
||||||
}
|
|
@ -1,3 +0,0 @@
|
|||||||
{
|
|
||||||
"Details of changes": "Detalles de los cambios"
|
|
||||||
}
|
|
@ -1,3 +0,0 @@
|
|||||||
{
|
|
||||||
"Details of changes": "Détails des changements"
|
|
||||||
}
|
|
@ -1,3 +0,0 @@
|
|||||||
{
|
|
||||||
"Details of changes": "변경 사항 상세 내역"
|
|
||||||
}
|
|
@ -1,3 +0,0 @@
|
|||||||
{
|
|
||||||
"Details of changes": "Detalhes das mudanças"
|
|
||||||
}
|
|
@ -1,3 +0,0 @@
|
|||||||
{
|
|
||||||
"Details of changes": "变更详情"
|
|
||||||
}
|
|
@ -1,117 +0,0 @@
|
|||||||
import Database from '@nocobase/database';
|
|
||||||
import { createMockServer, MockServer } from '@nocobase/test';
|
|
||||||
|
|
||||||
describe('hook', () => {
|
|
||||||
let api: MockServer;
|
|
||||||
let db: Database;
|
|
||||||
|
|
||||||
beforeEach(async () => {
|
|
||||||
api = await createMockServer({
|
|
||||||
plugins: ['audit-logs'],
|
|
||||||
});
|
|
||||||
db = api.db;
|
|
||||||
db.collection({
|
|
||||||
name: 'posts',
|
|
||||||
logging: true,
|
|
||||||
fields: [
|
|
||||||
{
|
|
||||||
type: 'string',
|
|
||||||
name: 'title',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
type: 'string',
|
|
||||||
name: 'status',
|
|
||||||
defaultValue: 'draft',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
});
|
|
||||||
db.collection({
|
|
||||||
name: 'users',
|
|
||||||
logging: false,
|
|
||||||
fields: [
|
|
||||||
{ type: 'string', name: 'nickname' },
|
|
||||||
{ type: 'string', name: 'token' },
|
|
||||||
],
|
|
||||||
});
|
|
||||||
await db.sync();
|
|
||||||
});
|
|
||||||
|
|
||||||
afterEach(async () => {
|
|
||||||
await api.destroy();
|
|
||||||
});
|
|
||||||
|
|
||||||
it('model', async () => {
|
|
||||||
const Post = db.getCollection('posts').model;
|
|
||||||
const post = await Post.create({ title: 't1' });
|
|
||||||
await post.update({ title: 't2' });
|
|
||||||
await post.destroy();
|
|
||||||
const auditLogs = await db.getCollection('auditLogs').repository.find({
|
|
||||||
appends: ['changes'],
|
|
||||||
});
|
|
||||||
expect(auditLogs.length).toBe(3);
|
|
||||||
|
|
||||||
const titleChange = (changes) => {
|
|
||||||
return changes.find((item) => item.field.name === 'title');
|
|
||||||
};
|
|
||||||
|
|
||||||
expect(titleChange(auditLogs[0].changes).before).toBeNull();
|
|
||||||
expect(titleChange(auditLogs[0].changes).after).toBe('t1');
|
|
||||||
|
|
||||||
expect(titleChange(auditLogs[1].changes).before).toBe('t1');
|
|
||||||
expect(titleChange(auditLogs[1].changes).after).toBe('t2');
|
|
||||||
|
|
||||||
expect(titleChange(auditLogs[2].changes).before).toBe('t2');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('repository', async () => {
|
|
||||||
const Post = db.getCollection('posts');
|
|
||||||
const User = db.getCollection('users').model;
|
|
||||||
const user = await User.create({ nickname: 'a', token: 'token1' });
|
|
||||||
const post = await Post.repository.create({
|
|
||||||
values: { title: 't1' },
|
|
||||||
context: {
|
|
||||||
state: {
|
|
||||||
currentUser: user,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
});
|
|
||||||
const AuditLog = db.getCollection('auditLogs');
|
|
||||||
const log = await AuditLog.repository.findOne({
|
|
||||||
appends: ['changes'],
|
|
||||||
});
|
|
||||||
expect(log.toJSON()).toMatchObject({
|
|
||||||
collectionName: 'posts',
|
|
||||||
type: 'create',
|
|
||||||
userId: 1,
|
|
||||||
recordId: `${post.get('id')}`,
|
|
||||||
changes: [
|
|
||||||
{
|
|
||||||
field: {
|
|
||||||
name: 'title',
|
|
||||||
type: 'string',
|
|
||||||
},
|
|
||||||
before: null,
|
|
||||||
after: 't1',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
// it.skip('resource', async () => {
|
|
||||||
// const agent = api.agent();
|
|
||||||
// agent.set('Authorization', `Bearer token1`);
|
|
||||||
// const response = await agent.resource('posts').create({
|
|
||||||
// values: { title: 't1' },
|
|
||||||
// });
|
|
||||||
// await agent.resource('posts').update({
|
|
||||||
// resourceIndex: response.body.data.id,
|
|
||||||
// values: { title: 't2' },
|
|
||||||
// });
|
|
||||||
// await agent.resource('posts').destroy({
|
|
||||||
// resourceIndex: response.body.data.id,
|
|
||||||
// });
|
|
||||||
// const ActionLog = db.getCollection('action_logs').model;
|
|
||||||
// const count = await ActionLog.count();
|
|
||||||
// expect(count).toBe(3);
|
|
||||||
// });
|
|
||||||
});
|
|
@ -1,34 +0,0 @@
|
|||||||
import { defineCollection } from '@nocobase/database';
|
|
||||||
|
|
||||||
export default defineCollection({
|
|
||||||
dumpRules: {
|
|
||||||
group: 'log',
|
|
||||||
},
|
|
||||||
name: 'auditChanges',
|
|
||||||
title: '变动值',
|
|
||||||
createdBy: false,
|
|
||||||
updatedBy: false,
|
|
||||||
createdAt: false,
|
|
||||||
updatedAt: false,
|
|
||||||
shared: true,
|
|
||||||
fields: [
|
|
||||||
{
|
|
||||||
type: 'json',
|
|
||||||
name: 'field',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
type: 'json',
|
|
||||||
name: 'before',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
type: 'json',
|
|
||||||
name: 'after',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
type: 'belongsTo',
|
|
||||||
name: 'log',
|
|
||||||
target: 'auditLogs',
|
|
||||||
foreignKey: 'auditLogId',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
});
|
|
@ -1,51 +0,0 @@
|
|||||||
import { defineCollection } from '@nocobase/database';
|
|
||||||
|
|
||||||
export default defineCollection({
|
|
||||||
dumpRules: {
|
|
||||||
group: 'log',
|
|
||||||
},
|
|
||||||
name: 'auditLogs',
|
|
||||||
createdBy: false,
|
|
||||||
updatedBy: false,
|
|
||||||
updatedAt: false,
|
|
||||||
shared: true,
|
|
||||||
fields: [
|
|
||||||
{
|
|
||||||
type: 'date',
|
|
||||||
name: 'createdAt',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
type: 'string',
|
|
||||||
name: 'type',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
type: 'string',
|
|
||||||
name: 'recordId',
|
|
||||||
index: true,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
type: 'string',
|
|
||||||
name: 'collectionName',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
type: 'belongsTo',
|
|
||||||
name: 'collection',
|
|
||||||
target: 'collections',
|
|
||||||
targetKey: 'name',
|
|
||||||
sourceKey: 'id',
|
|
||||||
foreignKey: 'collectionName',
|
|
||||||
constraints: false,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
type: 'hasMany',
|
|
||||||
name: 'changes',
|
|
||||||
target: 'auditChanges',
|
|
||||||
foreignKey: 'auditLogId',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
type: 'belongsTo',
|
|
||||||
name: 'user',
|
|
||||||
target: 'users',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
});
|
|
@ -1,3 +0,0 @@
|
|||||||
export const LOG_TYPE_CREATE = 'create';
|
|
||||||
export const LOG_TYPE_UPDATE = 'update';
|
|
||||||
export const LOG_TYPE_DESTROY = 'destroy';
|
|
@ -1,45 +0,0 @@
|
|||||||
import { LOG_TYPE_CREATE } from '../constants';
|
|
||||||
|
|
||||||
export async function afterCreate(model, options) {
|
|
||||||
if (options.logging === false) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
const { collection } = model.constructor;
|
|
||||||
if (!collection || !collection.options.logging) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
const transaction = options.transaction;
|
|
||||||
const AuditLog = model.constructor.database.getCollection('auditLogs');
|
|
||||||
const currentUserId = options?.context?.state?.currentUser?.id;
|
|
||||||
try {
|
|
||||||
const changes = [];
|
|
||||||
const changed = model.changed();
|
|
||||||
if (changed) {
|
|
||||||
changed.forEach((key: string) => {
|
|
||||||
const field = collection.findField((field) => {
|
|
||||||
return field.name === key || field.options.field === key;
|
|
||||||
});
|
|
||||||
if (field && !field.options.hidden) {
|
|
||||||
changes.push({
|
|
||||||
field: field.options,
|
|
||||||
after: model.get(key),
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
await AuditLog.repository.create({
|
|
||||||
values: {
|
|
||||||
type: LOG_TYPE_CREATE,
|
|
||||||
collectionName: model.constructor.name,
|
|
||||||
recordId: model.get(model.constructor.primaryKeyAttribute),
|
|
||||||
createdAt: model.get('createdAt'),
|
|
||||||
userId: currentUserId,
|
|
||||||
changes,
|
|
||||||
},
|
|
||||||
transaction,
|
|
||||||
hooks: false,
|
|
||||||
});
|
|
||||||
} catch (error) {
|
|
||||||
// console.error(error);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,43 +0,0 @@
|
|||||||
import { LOG_TYPE_DESTROY } from '../constants';
|
|
||||||
|
|
||||||
export async function afterDestroy(model, options) {
|
|
||||||
const { collection } = model.constructor;
|
|
||||||
if (!collection || !collection.options.logging) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
const transaction = options.transaction;
|
|
||||||
const AuditLog = model.constructor.database.getCollection('auditLogs');
|
|
||||||
const currentUserId = options?.context?.state?.currentUser?.id;
|
|
||||||
try {
|
|
||||||
const changes = [];
|
|
||||||
Object.keys(model.get()).forEach((key: string) => {
|
|
||||||
const field = collection.findField((field) => {
|
|
||||||
return field.name === key || field.options.field === key;
|
|
||||||
});
|
|
||||||
if (field) {
|
|
||||||
changes.push({
|
|
||||||
field: field.options,
|
|
||||||
before: model.get(key),
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
await AuditLog.repository.create({
|
|
||||||
values: {
|
|
||||||
type: LOG_TYPE_DESTROY,
|
|
||||||
collectionName: model.constructor.name,
|
|
||||||
recordId: model.get(model.constructor.primaryKeyAttribute),
|
|
||||||
userId: currentUserId,
|
|
||||||
changes,
|
|
||||||
},
|
|
||||||
transaction,
|
|
||||||
hooks: false,
|
|
||||||
});
|
|
||||||
// if (!options.transaction) {
|
|
||||||
// await transaction.commit();
|
|
||||||
// }
|
|
||||||
} catch (error) {
|
|
||||||
// if (!options.transaction) {
|
|
||||||
// await transaction.rollback();
|
|
||||||
// }
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,52 +0,0 @@
|
|||||||
import { LOG_TYPE_UPDATE } from '../constants';
|
|
||||||
|
|
||||||
export async function afterUpdate(model, options) {
|
|
||||||
const { collection } = model.constructor;
|
|
||||||
if (!collection || !collection.options.logging) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
const changed = model.changed();
|
|
||||||
if (!changed) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
const transaction = options.transaction;
|
|
||||||
const AuditLog = model.constructor.database.getCollection('auditLogs');
|
|
||||||
const currentUserId = options?.context?.state?.currentUser?.id;
|
|
||||||
const changes = [];
|
|
||||||
changed.forEach((key: string) => {
|
|
||||||
const field = collection.findField((field) => {
|
|
||||||
return field.name === key || field.options.field === key;
|
|
||||||
});
|
|
||||||
if (field && !field.options.hidden) {
|
|
||||||
changes.push({
|
|
||||||
field: field.options,
|
|
||||||
after: model.get(key),
|
|
||||||
before: model.previous(key),
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
if (!changes.length) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
await AuditLog.repository.create({
|
|
||||||
values: {
|
|
||||||
type: LOG_TYPE_UPDATE,
|
|
||||||
collectionName: model.constructor.name,
|
|
||||||
recordId: model.get(model.constructor.primaryKeyAttribute),
|
|
||||||
createdAt: model.get('updatedAt'),
|
|
||||||
userId: currentUserId,
|
|
||||||
changes,
|
|
||||||
},
|
|
||||||
transaction,
|
|
||||||
hooks: false,
|
|
||||||
});
|
|
||||||
// if (!options.transaction) {
|
|
||||||
// await transaction.commit();
|
|
||||||
// }
|
|
||||||
} catch (error) {
|
|
||||||
// if (!options.transaction) {
|
|
||||||
// await transaction.rollback();
|
|
||||||
// }
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,3 +0,0 @@
|
|||||||
export * from './after-create';
|
|
||||||
export * from './after-update';
|
|
||||||
export * from './after-destroy';
|
|
@ -1,23 +0,0 @@
|
|||||||
import { Plugin } from '@nocobase/server';
|
|
||||||
import path from 'path';
|
|
||||||
import { afterCreate, afterDestroy, afterUpdate } from './hooks';
|
|
||||||
|
|
||||||
export default class PluginActionLogs extends Plugin {
|
|
||||||
async beforeLoad() {
|
|
||||||
this.db.on('afterCreate', afterCreate);
|
|
||||||
this.db.on('afterUpdate', afterUpdate);
|
|
||||||
this.db.on('afterDestroy', afterDestroy);
|
|
||||||
}
|
|
||||||
|
|
||||||
async load() {
|
|
||||||
await this.importCollections(path.resolve(__dirname, 'collections'));
|
|
||||||
|
|
||||||
this.db.addMigrations({
|
|
||||||
namespace: 'audit-logs',
|
|
||||||
directory: path.resolve(__dirname, './migrations'),
|
|
||||||
context: {
|
|
||||||
plugin: this,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,19 +0,0 @@
|
|||||||
import { Migration } from '@nocobase/server';
|
|
||||||
|
|
||||||
export default class LoggingMigration extends Migration {
|
|
||||||
appVersion = '<0.7.1-alpha.4';
|
|
||||||
async up() {
|
|
||||||
const result = await this.app.version.satisfies('<=0.7.0-alpha.83');
|
|
||||||
if (!result) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
const repository = this.context.db.getRepository('collections');
|
|
||||||
const collections = await repository.find();
|
|
||||||
for (const collection of collections) {
|
|
||||||
if (!collection.get('logging')) {
|
|
||||||
collection.set('logging', true);
|
|
||||||
await collection.save();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,2 +0,0 @@
|
|||||||
/node_modules
|
|
||||||
/src
|
|
@ -1,661 +0,0 @@
|
|||||||
GNU AFFERO GENERAL PUBLIC LICENSE
|
|
||||||
Version 3, 19 November 2007
|
|
||||||
|
|
||||||
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
|
||||||
Everyone is permitted to copy and distribute verbatim copies
|
|
||||||
of this license document, but changing it is not allowed.
|
|
||||||
|
|
||||||
Preamble
|
|
||||||
|
|
||||||
The GNU Affero General Public License is a free, copyleft license for
|
|
||||||
software and other kinds of works, specifically designed to ensure
|
|
||||||
cooperation with the community in the case of network server software.
|
|
||||||
|
|
||||||
The licenses for most software and other practical works are designed
|
|
||||||
to take away your freedom to share and change the works. By contrast,
|
|
||||||
our General Public Licenses are intended to guarantee your freedom to
|
|
||||||
share and change all versions of a program--to make sure it remains free
|
|
||||||
software for all its users.
|
|
||||||
|
|
||||||
When we speak of free software, we are referring to freedom, not
|
|
||||||
price. Our General Public Licenses are designed to make sure that you
|
|
||||||
have the freedom to distribute copies of free software (and charge for
|
|
||||||
them if you wish), that you receive source code or can get it if you
|
|
||||||
want it, that you can change the software or use pieces of it in new
|
|
||||||
free programs, and that you know you can do these things.
|
|
||||||
|
|
||||||
Developers that use our General Public Licenses protect your rights
|
|
||||||
with two steps: (1) assert copyright on the software, and (2) offer
|
|
||||||
you this License which gives you legal permission to copy, distribute
|
|
||||||
and/or modify the software.
|
|
||||||
|
|
||||||
A secondary benefit of defending all users' freedom is that
|
|
||||||
improvements made in alternate versions of the program, if they
|
|
||||||
receive widespread use, become available for other developers to
|
|
||||||
incorporate. Many developers of free software are heartened and
|
|
||||||
encouraged by the resulting cooperation. However, in the case of
|
|
||||||
software used on network servers, this result may fail to come about.
|
|
||||||
The GNU General Public License permits making a modified version and
|
|
||||||
letting the public access it on a server without ever releasing its
|
|
||||||
source code to the public.
|
|
||||||
|
|
||||||
The GNU Affero General Public License is designed specifically to
|
|
||||||
ensure that, in such cases, the modified source code becomes available
|
|
||||||
to the community. It requires the operator of a network server to
|
|
||||||
provide the source code of the modified version running there to the
|
|
||||||
users of that server. Therefore, public use of a modified version, on
|
|
||||||
a publicly accessible server, gives the public access to the source
|
|
||||||
code of the modified version.
|
|
||||||
|
|
||||||
An older license, called the Affero General Public License and
|
|
||||||
published by Affero, was designed to accomplish similar goals. This is
|
|
||||||
a different license, not a version of the Affero GPL, but Affero has
|
|
||||||
released a new version of the Affero GPL which permits relicensing under
|
|
||||||
this license.
|
|
||||||
|
|
||||||
The precise terms and conditions for copying, distribution and
|
|
||||||
modification follow.
|
|
||||||
|
|
||||||
TERMS AND CONDITIONS
|
|
||||||
|
|
||||||
0. Definitions.
|
|
||||||
|
|
||||||
"This License" refers to version 3 of the GNU Affero General Public License.
|
|
||||||
|
|
||||||
"Copyright" also means copyright-like laws that apply to other kinds of
|
|
||||||
works, such as semiconductor masks.
|
|
||||||
|
|
||||||
"The Program" refers to any copyrightable work licensed under this
|
|
||||||
License. Each licensee is addressed as "you". "Licensees" and
|
|
||||||
"recipients" may be individuals or organizations.
|
|
||||||
|
|
||||||
To "modify" a work means to copy from or adapt all or part of the work
|
|
||||||
in a fashion requiring copyright permission, other than the making of an
|
|
||||||
exact copy. The resulting work is called a "modified version" of the
|
|
||||||
earlier work or a work "based on" the earlier work.
|
|
||||||
|
|
||||||
A "covered work" means either the unmodified Program or a work based
|
|
||||||
on the Program.
|
|
||||||
|
|
||||||
To "propagate" a work means to do anything with it that, without
|
|
||||||
permission, would make you directly or secondarily liable for
|
|
||||||
infringement under applicable copyright law, except executing it on a
|
|
||||||
computer or modifying a private copy. Propagation includes copying,
|
|
||||||
distribution (with or without modification), making available to the
|
|
||||||
public, and in some countries other activities as well.
|
|
||||||
|
|
||||||
To "convey" a work means any kind of propagation that enables other
|
|
||||||
parties to make or receive copies. Mere interaction with a user through
|
|
||||||
a computer network, with no transfer of a copy, is not conveying.
|
|
||||||
|
|
||||||
An interactive user interface displays "Appropriate Legal Notices"
|
|
||||||
to the extent that it includes a convenient and prominently visible
|
|
||||||
feature that (1) displays an appropriate copyright notice, and (2)
|
|
||||||
tells the user that there is no warranty for the work (except to the
|
|
||||||
extent that warranties are provided), that licensees may convey the
|
|
||||||
work under this License, and how to view a copy of this License. If
|
|
||||||
the interface presents a list of user commands or options, such as a
|
|
||||||
menu, a prominent item in the list meets this criterion.
|
|
||||||
|
|
||||||
1. Source Code.
|
|
||||||
|
|
||||||
The "source code" for a work means the preferred form of the work
|
|
||||||
for making modifications to it. "Object code" means any non-source
|
|
||||||
form of a work.
|
|
||||||
|
|
||||||
A "Standard Interface" means an interface that either is an official
|
|
||||||
standard defined by a recognized standards body, or, in the case of
|
|
||||||
interfaces specified for a particular programming language, one that
|
|
||||||
is widely used among developers working in that language.
|
|
||||||
|
|
||||||
The "System Libraries" of an executable work include anything, other
|
|
||||||
than the work as a whole, that (a) is included in the normal form of
|
|
||||||
packaging a Major Component, but which is not part of that Major
|
|
||||||
Component, and (b) serves only to enable use of the work with that
|
|
||||||
Major Component, or to implement a Standard Interface for which an
|
|
||||||
implementation is available to the public in source code form. A
|
|
||||||
"Major Component", in this context, means a major essential component
|
|
||||||
(kernel, window system, and so on) of the specific operating system
|
|
||||||
(if any) on which the executable work runs, or a compiler used to
|
|
||||||
produce the work, or an object code interpreter used to run it.
|
|
||||||
|
|
||||||
The "Corresponding Source" for a work in object code form means all
|
|
||||||
the source code needed to generate, install, and (for an executable
|
|
||||||
work) run the object code and to modify the work, including scripts to
|
|
||||||
control those activities. However, it does not include the work's
|
|
||||||
System Libraries, or general-purpose tools or generally available free
|
|
||||||
programs which are used unmodified in performing those activities but
|
|
||||||
which are not part of the work. For example, Corresponding Source
|
|
||||||
includes interface definition files associated with source files for
|
|
||||||
the work, and the source code for shared libraries and dynamically
|
|
||||||
linked subprograms that the work is specifically designed to require,
|
|
||||||
such as by intimate data communication or control flow between those
|
|
||||||
subprograms and other parts of the work.
|
|
||||||
|
|
||||||
The Corresponding Source need not include anything that users
|
|
||||||
can regenerate automatically from other parts of the Corresponding
|
|
||||||
Source.
|
|
||||||
|
|
||||||
The Corresponding Source for a work in source code form is that
|
|
||||||
same work.
|
|
||||||
|
|
||||||
2. Basic Permissions.
|
|
||||||
|
|
||||||
All rights granted under this License are granted for the term of
|
|
||||||
copyright on the Program, and are irrevocable provided the stated
|
|
||||||
conditions are met. This License explicitly affirms your unlimited
|
|
||||||
permission to run the unmodified Program. The output from running a
|
|
||||||
covered work is covered by this License only if the output, given its
|
|
||||||
content, constitutes a covered work. This License acknowledges your
|
|
||||||
rights of fair use or other equivalent, as provided by copyright law.
|
|
||||||
|
|
||||||
You may make, run and propagate covered works that you do not
|
|
||||||
convey, without conditions so long as your license otherwise remains
|
|
||||||
in force. You may convey covered works to others for the sole purpose
|
|
||||||
of having them make modifications exclusively for you, or provide you
|
|
||||||
with facilities for running those works, provided that you comply with
|
|
||||||
the terms of this License in conveying all material for which you do
|
|
||||||
not control copyright. Those thus making or running the covered works
|
|
||||||
for you must do so exclusively on your behalf, under your direction
|
|
||||||
and control, on terms that prohibit them from making any copies of
|
|
||||||
your copyrighted material outside their relationship with you.
|
|
||||||
|
|
||||||
Conveying under any other circumstances is permitted solely under
|
|
||||||
the conditions stated below. Sublicensing is not allowed; section 10
|
|
||||||
makes it unnecessary.
|
|
||||||
|
|
||||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
|
||||||
|
|
||||||
No covered work shall be deemed part of an effective technological
|
|
||||||
measure under any applicable law fulfilling obligations under article
|
|
||||||
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
|
||||||
similar laws prohibiting or restricting circumvention of such
|
|
||||||
measures.
|
|
||||||
|
|
||||||
When you convey a covered work, you waive any legal power to forbid
|
|
||||||
circumvention of technological measures to the extent such circumvention
|
|
||||||
is effected by exercising rights under this License with respect to
|
|
||||||
the covered work, and you disclaim any intention to limit operation or
|
|
||||||
modification of the work as a means of enforcing, against the work's
|
|
||||||
users, your or third parties' legal rights to forbid circumvention of
|
|
||||||
technological measures.
|
|
||||||
|
|
||||||
4. Conveying Verbatim Copies.
|
|
||||||
|
|
||||||
You may convey verbatim copies of the Program's source code as you
|
|
||||||
receive it, in any medium, provided that you conspicuously and
|
|
||||||
appropriately publish on each copy an appropriate copyright notice;
|
|
||||||
keep intact all notices stating that this License and any
|
|
||||||
non-permissive terms added in accord with section 7 apply to the code;
|
|
||||||
keep intact all notices of the absence of any warranty; and give all
|
|
||||||
recipients a copy of this License along with the Program.
|
|
||||||
|
|
||||||
You may charge any price or no price for each copy that you convey,
|
|
||||||
and you may offer support or warranty protection for a fee.
|
|
||||||
|
|
||||||
5. Conveying Modified Source Versions.
|
|
||||||
|
|
||||||
You may convey a work based on the Program, or the modifications to
|
|
||||||
produce it from the Program, in the form of source code under the
|
|
||||||
terms of section 4, provided that you also meet all of these conditions:
|
|
||||||
|
|
||||||
a) The work must carry prominent notices stating that you modified
|
|
||||||
it, and giving a relevant date.
|
|
||||||
|
|
||||||
b) The work must carry prominent notices stating that it is
|
|
||||||
released under this License and any conditions added under section
|
|
||||||
7. This requirement modifies the requirement in section 4 to
|
|
||||||
"keep intact all notices".
|
|
||||||
|
|
||||||
c) You must license the entire work, as a whole, under this
|
|
||||||
License to anyone who comes into possession of a copy. This
|
|
||||||
License will therefore apply, along with any applicable section 7
|
|
||||||
additional terms, to the whole of the work, and all its parts,
|
|
||||||
regardless of how they are packaged. This License gives no
|
|
||||||
permission to license the work in any other way, but it does not
|
|
||||||
invalidate such permission if you have separately received it.
|
|
||||||
|
|
||||||
d) If the work has interactive user interfaces, each must display
|
|
||||||
Appropriate Legal Notices; however, if the Program has interactive
|
|
||||||
interfaces that do not display Appropriate Legal Notices, your
|
|
||||||
work need not make them do so.
|
|
||||||
|
|
||||||
A compilation of a covered work with other separate and independent
|
|
||||||
works, which are not by their nature extensions of the covered work,
|
|
||||||
and which are not combined with it such as to form a larger program,
|
|
||||||
in or on a volume of a storage or distribution medium, is called an
|
|
||||||
"aggregate" if the compilation and its resulting copyright are not
|
|
||||||
used to limit the access or legal rights of the compilation's users
|
|
||||||
beyond what the individual works permit. Inclusion of a covered work
|
|
||||||
in an aggregate does not cause this License to apply to the other
|
|
||||||
parts of the aggregate.
|
|
||||||
|
|
||||||
6. Conveying Non-Source Forms.
|
|
||||||
|
|
||||||
You may convey a covered work in object code form under the terms
|
|
||||||
of sections 4 and 5, provided that you also convey the
|
|
||||||
machine-readable Corresponding Source under the terms of this License,
|
|
||||||
in one of these ways:
|
|
||||||
|
|
||||||
a) Convey the object code in, or embodied in, a physical product
|
|
||||||
(including a physical distribution medium), accompanied by the
|
|
||||||
Corresponding Source fixed on a durable physical medium
|
|
||||||
customarily used for software interchange.
|
|
||||||
|
|
||||||
b) Convey the object code in, or embodied in, a physical product
|
|
||||||
(including a physical distribution medium), accompanied by a
|
|
||||||
written offer, valid for at least three years and valid for as
|
|
||||||
long as you offer spare parts or customer support for that product
|
|
||||||
model, to give anyone who possesses the object code either (1) a
|
|
||||||
copy of the Corresponding Source for all the software in the
|
|
||||||
product that is covered by this License, on a durable physical
|
|
||||||
medium customarily used for software interchange, for a price no
|
|
||||||
more than your reasonable cost of physically performing this
|
|
||||||
conveying of source, or (2) access to copy the
|
|
||||||
Corresponding Source from a network server at no charge.
|
|
||||||
|
|
||||||
c) Convey individual copies of the object code with a copy of the
|
|
||||||
written offer to provide the Corresponding Source. This
|
|
||||||
alternative is allowed only occasionally and noncommercially, and
|
|
||||||
only if you received the object code with such an offer, in accord
|
|
||||||
with subsection 6b.
|
|
||||||
|
|
||||||
d) Convey the object code by offering access from a designated
|
|
||||||
place (gratis or for a charge), and offer equivalent access to the
|
|
||||||
Corresponding Source in the same way through the same place at no
|
|
||||||
further charge. You need not require recipients to copy the
|
|
||||||
Corresponding Source along with the object code. If the place to
|
|
||||||
copy the object code is a network server, the Corresponding Source
|
|
||||||
may be on a different server (operated by you or a third party)
|
|
||||||
that supports equivalent copying facilities, provided you maintain
|
|
||||||
clear directions next to the object code saying where to find the
|
|
||||||
Corresponding Source. Regardless of what server hosts the
|
|
||||||
Corresponding Source, you remain obligated to ensure that it is
|
|
||||||
available for as long as needed to satisfy these requirements.
|
|
||||||
|
|
||||||
e) Convey the object code using peer-to-peer transmission, provided
|
|
||||||
you inform other peers where the object code and Corresponding
|
|
||||||
Source of the work are being offered to the general public at no
|
|
||||||
charge under subsection 6d.
|
|
||||||
|
|
||||||
A separable portion of the object code, whose source code is excluded
|
|
||||||
from the Corresponding Source as a System Library, need not be
|
|
||||||
included in conveying the object code work.
|
|
||||||
|
|
||||||
A "User Product" is either (1) a "consumer product", which means any
|
|
||||||
tangible personal property which is normally used for personal, family,
|
|
||||||
or household purposes, or (2) anything designed or sold for incorporation
|
|
||||||
into a dwelling. In determining whether a product is a consumer product,
|
|
||||||
doubtful cases shall be resolved in favor of coverage. For a particular
|
|
||||||
product received by a particular user, "normally used" refers to a
|
|
||||||
typical or common use of that class of product, regardless of the status
|
|
||||||
of the particular user or of the way in which the particular user
|
|
||||||
actually uses, or expects or is expected to use, the product. A product
|
|
||||||
is a consumer product regardless of whether the product has substantial
|
|
||||||
commercial, industrial or non-consumer uses, unless such uses represent
|
|
||||||
the only significant mode of use of the product.
|
|
||||||
|
|
||||||
"Installation Information" for a User Product means any methods,
|
|
||||||
procedures, authorization keys, or other information required to install
|
|
||||||
and execute modified versions of a covered work in that User Product from
|
|
||||||
a modified version of its Corresponding Source. The information must
|
|
||||||
suffice to ensure that the continued functioning of the modified object
|
|
||||||
code is in no case prevented or interfered with solely because
|
|
||||||
modification has been made.
|
|
||||||
|
|
||||||
If you convey an object code work under this section in, or with, or
|
|
||||||
specifically for use in, a User Product, and the conveying occurs as
|
|
||||||
part of a transaction in which the right of possession and use of the
|
|
||||||
User Product is transferred to the recipient in perpetuity or for a
|
|
||||||
fixed term (regardless of how the transaction is characterized), the
|
|
||||||
Corresponding Source conveyed under this section must be accompanied
|
|
||||||
by the Installation Information. But this requirement does not apply
|
|
||||||
if neither you nor any third party retains the ability to install
|
|
||||||
modified object code on the User Product (for example, the work has
|
|
||||||
been installed in ROM).
|
|
||||||
|
|
||||||
The requirement to provide Installation Information does not include a
|
|
||||||
requirement to continue to provide support service, warranty, or updates
|
|
||||||
for a work that has been modified or installed by the recipient, or for
|
|
||||||
the User Product in which it has been modified or installed. Access to a
|
|
||||||
network may be denied when the modification itself materially and
|
|
||||||
adversely affects the operation of the network or violates the rules and
|
|
||||||
protocols for communication across the network.
|
|
||||||
|
|
||||||
Corresponding Source conveyed, and Installation Information provided,
|
|
||||||
in accord with this section must be in a format that is publicly
|
|
||||||
documented (and with an implementation available to the public in
|
|
||||||
source code form), and must require no special password or key for
|
|
||||||
unpacking, reading or copying.
|
|
||||||
|
|
||||||
7. Additional Terms.
|
|
||||||
|
|
||||||
"Additional permissions" are terms that supplement the terms of this
|
|
||||||
License by making exceptions from one or more of its conditions.
|
|
||||||
Additional permissions that are applicable to the entire Program shall
|
|
||||||
be treated as though they were included in this License, to the extent
|
|
||||||
that they are valid under applicable law. If additional permissions
|
|
||||||
apply only to part of the Program, that part may be used separately
|
|
||||||
under those permissions, but the entire Program remains governed by
|
|
||||||
this License without regard to the additional permissions.
|
|
||||||
|
|
||||||
When you convey a copy of a covered work, you may at your option
|
|
||||||
remove any additional permissions from that copy, or from any part of
|
|
||||||
it. (Additional permissions may be written to require their own
|
|
||||||
removal in certain cases when you modify the work.) You may place
|
|
||||||
additional permissions on material, added by you to a covered work,
|
|
||||||
for which you have or can give appropriate copyright permission.
|
|
||||||
|
|
||||||
Notwithstanding any other provision of this License, for material you
|
|
||||||
add to a covered work, you may (if authorized by the copyright holders of
|
|
||||||
that material) supplement the terms of this License with terms:
|
|
||||||
|
|
||||||
a) Disclaiming warranty or limiting liability differently from the
|
|
||||||
terms of sections 15 and 16 of this License; or
|
|
||||||
|
|
||||||
b) Requiring preservation of specified reasonable legal notices or
|
|
||||||
author attributions in that material or in the Appropriate Legal
|
|
||||||
Notices displayed by works containing it; or
|
|
||||||
|
|
||||||
c) Prohibiting misrepresentation of the origin of that material, or
|
|
||||||
requiring that modified versions of such material be marked in
|
|
||||||
reasonable ways as different from the original version; or
|
|
||||||
|
|
||||||
d) Limiting the use for publicity purposes of names of licensors or
|
|
||||||
authors of the material; or
|
|
||||||
|
|
||||||
e) Declining to grant rights under trademark law for use of some
|
|
||||||
trade names, trademarks, or service marks; or
|
|
||||||
|
|
||||||
f) Requiring indemnification of licensors and authors of that
|
|
||||||
material by anyone who conveys the material (or modified versions of
|
|
||||||
it) with contractual assumptions of liability to the recipient, for
|
|
||||||
any liability that these contractual assumptions directly impose on
|
|
||||||
those licensors and authors.
|
|
||||||
|
|
||||||
All other non-permissive additional terms are considered "further
|
|
||||||
restrictions" within the meaning of section 10. If the Program as you
|
|
||||||
received it, or any part of it, contains a notice stating that it is
|
|
||||||
governed by this License along with a term that is a further
|
|
||||||
restriction, you may remove that term. If a license document contains
|
|
||||||
a further restriction but permits relicensing or conveying under this
|
|
||||||
License, you may add to a covered work material governed by the terms
|
|
||||||
of that license document, provided that the further restriction does
|
|
||||||
not survive such relicensing or conveying.
|
|
||||||
|
|
||||||
If you add terms to a covered work in accord with this section, you
|
|
||||||
must place, in the relevant source files, a statement of the
|
|
||||||
additional terms that apply to those files, or a notice indicating
|
|
||||||
where to find the applicable terms.
|
|
||||||
|
|
||||||
Additional terms, permissive or non-permissive, may be stated in the
|
|
||||||
form of a separately written license, or stated as exceptions;
|
|
||||||
the above requirements apply either way.
|
|
||||||
|
|
||||||
8. Termination.
|
|
||||||
|
|
||||||
You may not propagate or modify a covered work except as expressly
|
|
||||||
provided under this License. Any attempt otherwise to propagate or
|
|
||||||
modify it is void, and will automatically terminate your rights under
|
|
||||||
this License (including any patent licenses granted under the third
|
|
||||||
paragraph of section 11).
|
|
||||||
|
|
||||||
However, if you cease all violation of this License, then your
|
|
||||||
license from a particular copyright holder is reinstated (a)
|
|
||||||
provisionally, unless and until the copyright holder explicitly and
|
|
||||||
finally terminates your license, and (b) permanently, if the copyright
|
|
||||||
holder fails to notify you of the violation by some reasonable means
|
|
||||||
prior to 60 days after the cessation.
|
|
||||||
|
|
||||||
Moreover, your license from a particular copyright holder is
|
|
||||||
reinstated permanently if the copyright holder notifies you of the
|
|
||||||
violation by some reasonable means, this is the first time you have
|
|
||||||
received notice of violation of this License (for any work) from that
|
|
||||||
copyright holder, and you cure the violation prior to 30 days after
|
|
||||||
your receipt of the notice.
|
|
||||||
|
|
||||||
Termination of your rights under this section does not terminate the
|
|
||||||
licenses of parties who have received copies or rights from you under
|
|
||||||
this License. If your rights have been terminated and not permanently
|
|
||||||
reinstated, you do not qualify to receive new licenses for the same
|
|
||||||
material under section 10.
|
|
||||||
|
|
||||||
9. Acceptance Not Required for Having Copies.
|
|
||||||
|
|
||||||
You are not required to accept this License in order to receive or
|
|
||||||
run a copy of the Program. Ancillary propagation of a covered work
|
|
||||||
occurring solely as a consequence of using peer-to-peer transmission
|
|
||||||
to receive a copy likewise does not require acceptance. However,
|
|
||||||
nothing other than this License grants you permission to propagate or
|
|
||||||
modify any covered work. These actions infringe copyright if you do
|
|
||||||
not accept this License. Therefore, by modifying or propagating a
|
|
||||||
covered work, you indicate your acceptance of this License to do so.
|
|
||||||
|
|
||||||
10. Automatic Licensing of Downstream Recipients.
|
|
||||||
|
|
||||||
Each time you convey a covered work, the recipient automatically
|
|
||||||
receives a license from the original licensors, to run, modify and
|
|
||||||
propagate that work, subject to this License. You are not responsible
|
|
||||||
for enforcing compliance by third parties with this License.
|
|
||||||
|
|
||||||
An "entity transaction" is a transaction transferring control of an
|
|
||||||
organization, or substantially all assets of one, or subdividing an
|
|
||||||
organization, or merging organizations. If propagation of a covered
|
|
||||||
work results from an entity transaction, each party to that
|
|
||||||
transaction who receives a copy of the work also receives whatever
|
|
||||||
licenses to the work the party's predecessor in interest had or could
|
|
||||||
give under the previous paragraph, plus a right to possession of the
|
|
||||||
Corresponding Source of the work from the predecessor in interest, if
|
|
||||||
the predecessor has it or can get it with reasonable efforts.
|
|
||||||
|
|
||||||
You may not impose any further restrictions on the exercise of the
|
|
||||||
rights granted or affirmed under this License. For example, you may
|
|
||||||
not impose a license fee, royalty, or other charge for exercise of
|
|
||||||
rights granted under this License, and you may not initiate litigation
|
|
||||||
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
|
||||||
any patent claim is infringed by making, using, selling, offering for
|
|
||||||
sale, or importing the Program or any portion of it.
|
|
||||||
|
|
||||||
11. Patents.
|
|
||||||
|
|
||||||
A "contributor" is a copyright holder who authorizes use under this
|
|
||||||
License of the Program or a work on which the Program is based. The
|
|
||||||
work thus licensed is called the contributor's "contributor version".
|
|
||||||
|
|
||||||
A contributor's "essential patent claims" are all patent claims
|
|
||||||
owned or controlled by the contributor, whether already acquired or
|
|
||||||
hereafter acquired, that would be infringed by some manner, permitted
|
|
||||||
by this License, of making, using, or selling its contributor version,
|
|
||||||
but do not include claims that would be infringed only as a
|
|
||||||
consequence of further modification of the contributor version. For
|
|
||||||
purposes of this definition, "control" includes the right to grant
|
|
||||||
patent sublicenses in a manner consistent with the requirements of
|
|
||||||
this License.
|
|
||||||
|
|
||||||
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
|
||||||
patent license under the contributor's essential patent claims, to
|
|
||||||
make, use, sell, offer for sale, import and otherwise run, modify and
|
|
||||||
propagate the contents of its contributor version.
|
|
||||||
|
|
||||||
In the following three paragraphs, a "patent license" is any express
|
|
||||||
agreement or commitment, however denominated, not to enforce a patent
|
|
||||||
(such as an express permission to practice a patent or covenant not to
|
|
||||||
sue for patent infringement). To "grant" such a patent license to a
|
|
||||||
party means to make such an agreement or commitment not to enforce a
|
|
||||||
patent against the party.
|
|
||||||
|
|
||||||
If you convey a covered work, knowingly relying on a patent license,
|
|
||||||
and the Corresponding Source of the work is not available for anyone
|
|
||||||
to copy, free of charge and under the terms of this License, through a
|
|
||||||
publicly available network server or other readily accessible means,
|
|
||||||
then you must either (1) cause the Corresponding Source to be so
|
|
||||||
available, or (2) arrange to deprive yourself of the benefit of the
|
|
||||||
patent license for this particular work, or (3) arrange, in a manner
|
|
||||||
consistent with the requirements of this License, to extend the patent
|
|
||||||
license to downstream recipients. "Knowingly relying" means you have
|
|
||||||
actual knowledge that, but for the patent license, your conveying the
|
|
||||||
covered work in a country, or your recipient's use of the covered work
|
|
||||||
in a country, would infringe one or more identifiable patents in that
|
|
||||||
country that you have reason to believe are valid.
|
|
||||||
|
|
||||||
If, pursuant to or in connection with a single transaction or
|
|
||||||
arrangement, you convey, or propagate by procuring conveyance of, a
|
|
||||||
covered work, and grant a patent license to some of the parties
|
|
||||||
receiving the covered work authorizing them to use, propagate, modify
|
|
||||||
or convey a specific copy of the covered work, then the patent license
|
|
||||||
you grant is automatically extended to all recipients of the covered
|
|
||||||
work and works based on it.
|
|
||||||
|
|
||||||
A patent license is "discriminatory" if it does not include within
|
|
||||||
the scope of its coverage, prohibits the exercise of, or is
|
|
||||||
conditioned on the non-exercise of one or more of the rights that are
|
|
||||||
specifically granted under this License. You may not convey a covered
|
|
||||||
work if you are a party to an arrangement with a third party that is
|
|
||||||
in the business of distributing software, under which you make payment
|
|
||||||
to the third party based on the extent of your activity of conveying
|
|
||||||
the work, and under which the third party grants, to any of the
|
|
||||||
parties who would receive the covered work from you, a discriminatory
|
|
||||||
patent license (a) in connection with copies of the covered work
|
|
||||||
conveyed by you (or copies made from those copies), or (b) primarily
|
|
||||||
for and in connection with specific products or compilations that
|
|
||||||
contain the covered work, unless you entered into that arrangement,
|
|
||||||
or that patent license was granted, prior to 28 March 2007.
|
|
||||||
|
|
||||||
Nothing in this License shall be construed as excluding or limiting
|
|
||||||
any implied license or other defenses to infringement that may
|
|
||||||
otherwise be available to you under applicable patent law.
|
|
||||||
|
|
||||||
12. No Surrender of Others' Freedom.
|
|
||||||
|
|
||||||
If conditions are imposed on you (whether by court order, agreement or
|
|
||||||
otherwise) that contradict the conditions of this License, they do not
|
|
||||||
excuse you from the conditions of this License. If you cannot convey a
|
|
||||||
covered work so as to satisfy simultaneously your obligations under this
|
|
||||||
License and any other pertinent obligations, then as a consequence you may
|
|
||||||
not convey it at all. For example, if you agree to terms that obligate you
|
|
||||||
to collect a royalty for further conveying from those to whom you convey
|
|
||||||
the Program, the only way you could satisfy both those terms and this
|
|
||||||
License would be to refrain entirely from conveying the Program.
|
|
||||||
|
|
||||||
13. Remote Network Interaction; Use with the GNU General Public License.
|
|
||||||
|
|
||||||
Notwithstanding any other provision of this License, if you modify the
|
|
||||||
Program, your modified version must prominently offer all users
|
|
||||||
interacting with it remotely through a computer network (if your version
|
|
||||||
supports such interaction) an opportunity to receive the Corresponding
|
|
||||||
Source of your version by providing access to the Corresponding Source
|
|
||||||
from a network server at no charge, through some standard or customary
|
|
||||||
means of facilitating copying of software. This Corresponding Source
|
|
||||||
shall include the Corresponding Source for any work covered by version 3
|
|
||||||
of the GNU General Public License that is incorporated pursuant to the
|
|
||||||
following paragraph.
|
|
||||||
|
|
||||||
Notwithstanding any other provision of this License, you have
|
|
||||||
permission to link or combine any covered work with a work licensed
|
|
||||||
under version 3 of the GNU General Public License into a single
|
|
||||||
combined work, and to convey the resulting work. The terms of this
|
|
||||||
License will continue to apply to the part which is the covered work,
|
|
||||||
but the work with which it is combined will remain governed by version
|
|
||||||
3 of the GNU General Public License.
|
|
||||||
|
|
||||||
14. Revised Versions of this License.
|
|
||||||
|
|
||||||
The Free Software Foundation may publish revised and/or new versions of
|
|
||||||
the GNU Affero General Public License from time to time. Such new versions
|
|
||||||
will be similar in spirit to the present version, but may differ in detail to
|
|
||||||
address new problems or concerns.
|
|
||||||
|
|
||||||
Each version is given a distinguishing version number. If the
|
|
||||||
Program specifies that a certain numbered version of the GNU Affero General
|
|
||||||
Public License "or any later version" applies to it, you have the
|
|
||||||
option of following the terms and conditions either of that numbered
|
|
||||||
version or of any later version published by the Free Software
|
|
||||||
Foundation. If the Program does not specify a version number of the
|
|
||||||
GNU Affero General Public License, you may choose any version ever published
|
|
||||||
by the Free Software Foundation.
|
|
||||||
|
|
||||||
If the Program specifies that a proxy can decide which future
|
|
||||||
versions of the GNU Affero General Public License can be used, that proxy's
|
|
||||||
public statement of acceptance of a version permanently authorizes you
|
|
||||||
to choose that version for the Program.
|
|
||||||
|
|
||||||
Later license versions may give you additional or different
|
|
||||||
permissions. However, no additional obligations are imposed on any
|
|
||||||
author or copyright holder as a result of your choosing to follow a
|
|
||||||
later version.
|
|
||||||
|
|
||||||
15. Disclaimer of Warranty.
|
|
||||||
|
|
||||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
|
||||||
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
|
||||||
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
|
||||||
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
|
||||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
|
||||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
|
||||||
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
|
||||||
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
|
||||||
|
|
||||||
16. Limitation of Liability.
|
|
||||||
|
|
||||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
|
||||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
|
||||||
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
|
||||||
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
|
||||||
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
|
||||||
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
|
||||||
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
|
||||||
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
|
||||||
SUCH DAMAGES.
|
|
||||||
|
|
||||||
17. Interpretation of Sections 15 and 16.
|
|
||||||
|
|
||||||
If the disclaimer of warranty and limitation of liability provided
|
|
||||||
above cannot be given local legal effect according to their terms,
|
|
||||||
reviewing courts shall apply local law that most closely approximates
|
|
||||||
an absolute waiver of all civil liability in connection with the
|
|
||||||
Program, unless a warranty or assumption of liability accompanies a
|
|
||||||
copy of the Program in return for a fee.
|
|
||||||
|
|
||||||
END OF TERMS AND CONDITIONS
|
|
||||||
|
|
||||||
How to Apply These Terms to Your New Programs
|
|
||||||
|
|
||||||
If you develop a new program, and you want it to be of the greatest
|
|
||||||
possible use to the public, the best way to achieve this is to make it
|
|
||||||
free software which everyone can redistribute and change under these terms.
|
|
||||||
|
|
||||||
To do so, attach the following notices to the program. It is safest
|
|
||||||
to attach them to the start of each source file to most effectively
|
|
||||||
state the exclusion of warranty; and each file should have at least
|
|
||||||
the "copyright" line and a pointer to where the full notice is found.
|
|
||||||
|
|
||||||
<one line to give the program's name and a brief idea of what it does.>
|
|
||||||
Copyright (C) <year> <name of author>
|
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU Affero General Public License as published
|
|
||||||
by the Free Software Foundation, either version 3 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU Affero General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Affero General Public License
|
|
||||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
Also add information on how to contact you by electronic and paper mail.
|
|
||||||
|
|
||||||
If your software can interact with users remotely through a computer
|
|
||||||
network, you should also make sure that it provides a way for users to
|
|
||||||
get its source. For example, if your program is a web application, its
|
|
||||||
interface could display a "Source" link that leads users to an archive
|
|
||||||
of the code. There are many ways you could offer source, and different
|
|
||||||
solutions will be better for different programs; see section 13 for the
|
|
||||||
specific requirements.
|
|
||||||
|
|
||||||
You should also get your employer (if you work as a programmer) or school,
|
|
||||||
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
|
||||||
For more information on this, and how to apply and follow the GNU AGPL, see
|
|
||||||
<https://www.gnu.org/licenses/>.
|
|
@ -1,9 +0,0 @@
|
|||||||
# ui-routes-storage
|
|
||||||
|
|
||||||
English | [中文](./README.zh-CN.md)
|
|
||||||
|
|
||||||
## 安装激活
|
|
||||||
|
|
||||||
内置插件无需手动安装激活。
|
|
||||||
|
|
||||||
## 使用方法
|
|
@ -1,9 +0,0 @@
|
|||||||
# ui-routes-storage
|
|
||||||
|
|
||||||
[English](./README.md) | 中文
|
|
||||||
|
|
||||||
## 安装激活
|
|
||||||
|
|
||||||
内置插件无需手动安装激活。
|
|
||||||
|
|
||||||
## 使用方法
|
|
@ -1,2 +0,0 @@
|
|||||||
export * from './dist/client';
|
|
||||||
export { default } from './dist/client';
|
|
@ -1 +0,0 @@
|
|||||||
module.exports = require('./dist/client/index.js');
|
|
@ -1,24 +0,0 @@
|
|||||||
{
|
|
||||||
"name": "@nocobase/plugin-ui-routes-storage",
|
|
||||||
"displayName": "ui routes storage",
|
|
||||||
"version": "0.21.6",
|
|
||||||
"description": "manage the routes of nocobase",
|
|
||||||
"keywords": [
|
|
||||||
"System & security"
|
|
||||||
],
|
|
||||||
"license": "AGPL-3.0",
|
|
||||||
"main": "./dist/server/index.js",
|
|
||||||
"devDependencies": {
|
|
||||||
"flat-to-nested": "^1.1.1"
|
|
||||||
},
|
|
||||||
"peerDependencies": {
|
|
||||||
"@nocobase/actions": "workspace:*",
|
|
||||||
"@nocobase/client": "workspace:*",
|
|
||||||
"@nocobase/database": "workspace:*",
|
|
||||||
"@nocobase/server": "workspace:*",
|
|
||||||
"@nocobase/test": "workspace:*"
|
|
||||||
},
|
|
||||||
"description.zh-CN": "管理页面路由。",
|
|
||||||
"displayName.zh-CN": "路由管理",
|
|
||||||
"gitHead": "d0b4efe4be55f8c79a98a331d99d9f8cf99021a1"
|
|
||||||
}
|
|
@ -1,2 +0,0 @@
|
|||||||
export * from './dist/server';
|
|
||||||
export { default } from './dist/server';
|
|
@ -1 +0,0 @@
|
|||||||
module.exports = require('./dist/server/index.js');
|
|
@ -1,7 +0,0 @@
|
|||||||
import { Plugin } from '@nocobase/client';
|
|
||||||
|
|
||||||
class UiRoutesStoragePlugin extends Plugin {
|
|
||||||
async load() { }
|
|
||||||
}
|
|
||||||
|
|
||||||
export default UiRoutesStoragePlugin;
|
|
@ -1,2 +0,0 @@
|
|||||||
export * from './server';
|
|
||||||
export { default } from './server';
|
|
@ -1,18 +0,0 @@
|
|||||||
import { Context, Next } from '@nocobase/actions';
|
|
||||||
import FlatToNested from 'flat-to-nested';
|
|
||||||
|
|
||||||
const flatToNested = new FlatToNested({
|
|
||||||
id: 'key',
|
|
||||||
parent: 'parentKey',
|
|
||||||
children: 'routes',
|
|
||||||
});
|
|
||||||
|
|
||||||
export const getAccessible = async (ctx: Context, next: Next) => {
|
|
||||||
const repository = ctx.db.getRepository('uiRoutes');
|
|
||||||
const routes = await repository.find({
|
|
||||||
sort: ['sort'],
|
|
||||||
});
|
|
||||||
const data = flatToNested.convert(routes.map((route) => route.toJSON()));
|
|
||||||
ctx.body = data?.routes || [];
|
|
||||||
await next();
|
|
||||||
};
|
|
@ -1,43 +0,0 @@
|
|||||||
import { defineCollection } from '@nocobase/database';
|
|
||||||
|
|
||||||
export default defineCollection({
|
|
||||||
dumpRules: 'required',
|
|
||||||
name: 'uiRoutes',
|
|
||||||
model: 'MagicAttributeModel',
|
|
||||||
autoGenId: false,
|
|
||||||
sortable: {
|
|
||||||
name: 'sort',
|
|
||||||
scopeKey: 'parentKey',
|
|
||||||
},
|
|
||||||
shared: true,
|
|
||||||
fields: [
|
|
||||||
{
|
|
||||||
type: 'uid',
|
|
||||||
name: 'key',
|
|
||||||
prefix: 'r_',
|
|
||||||
primaryKey: true,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
type: 'string',
|
|
||||||
name: 'type',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
type: 'hasMany',
|
|
||||||
name: 'routes',
|
|
||||||
target: 'uiRoutes',
|
|
||||||
sourceKey: 'key',
|
|
||||||
foreignKey: 'parentKey',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
type: 'belongsTo',
|
|
||||||
name: 'uiSchema',
|
|
||||||
target: 'uiSchemas',
|
|
||||||
foreignKey: 'uiSchemaUid',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
type: 'json',
|
|
||||||
name: 'options',
|
|
||||||
defaultValue: {},
|
|
||||||
},
|
|
||||||
],
|
|
||||||
});
|
|
@ -1,96 +0,0 @@
|
|||||||
import { MagicAttributeModel } from '@nocobase/database';
|
|
||||||
import { Plugin } from '@nocobase/server';
|
|
||||||
import { resolve } from 'path';
|
|
||||||
import { getAccessible } from './actions/getAccessible';
|
|
||||||
|
|
||||||
export class UiRoutesStoragePlugin extends Plugin {
|
|
||||||
async install() {
|
|
||||||
const repository = this.app.db.getRepository('uiRoutes');
|
|
||||||
const routes = [
|
|
||||||
{
|
|
||||||
type: 'redirect',
|
|
||||||
from: '/',
|
|
||||||
to: '/admin',
|
|
||||||
exact: true,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
type: 'route',
|
|
||||||
uiSchema: {
|
|
||||||
type: 'void',
|
|
||||||
'x-component': 'Menu',
|
|
||||||
'x-designer': 'Menu.Designer',
|
|
||||||
'x-initializer': 'MenuItemInitializers',
|
|
||||||
'x-component-props': {
|
|
||||||
mode: 'mix',
|
|
||||||
theme: 'dark',
|
|
||||||
// defaultSelectedUid: 'u8',
|
|
||||||
onSelect: '{{ onSelect }}',
|
|
||||||
sideMenuRefScopeKey: 'sideMenuRef',
|
|
||||||
},
|
|
||||||
properties: {},
|
|
||||||
},
|
|
||||||
path: '/admin/:name?',
|
|
||||||
component: 'AdminLayout',
|
|
||||||
title: 'NocoBase Admin',
|
|
||||||
routes: [
|
|
||||||
// test...
|
|
||||||
// {
|
|
||||||
// type: 'route',
|
|
||||||
// path: '/admin/workflows/:id',
|
|
||||||
// component: 'WorkflowPage',
|
|
||||||
// },
|
|
||||||
// {
|
|
||||||
// type: 'route',
|
|
||||||
// path: '/admin/block-templates/:key',
|
|
||||||
// component: 'BlockTemplateDetails',
|
|
||||||
// },
|
|
||||||
// {
|
|
||||||
// type: 'route',
|
|
||||||
// path: '/admin/block-templates',
|
|
||||||
// component: 'BlockTemplatePage',
|
|
||||||
// },
|
|
||||||
{
|
|
||||||
type: 'route',
|
|
||||||
path: '/admin/:name?',
|
|
||||||
component: 'RouteSchemaComponent',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
type: 'route',
|
|
||||||
component: 'AuthLayout',
|
|
||||||
routes: [
|
|
||||||
{
|
|
||||||
type: 'route',
|
|
||||||
path: '/signin',
|
|
||||||
component: 'SigninPage',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
type: 'route',
|
|
||||||
path: '/signup',
|
|
||||||
component: 'SignupPage',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
];
|
|
||||||
for (const values of routes) {
|
|
||||||
await repository.create({
|
|
||||||
values,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
async beforeLoad() {
|
|
||||||
this.app.db.registerModels({ MagicAttributeModel });
|
|
||||||
}
|
|
||||||
|
|
||||||
async load() {
|
|
||||||
this.app.resourcer.registerActionHandler('uiRoutes:getAccessible', getAccessible);
|
|
||||||
|
|
||||||
await this.importCollections(resolve(__dirname, './collections'));
|
|
||||||
|
|
||||||
this.app.acl.allow('uiRoutes', 'getAccessible');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export default UiRoutesStoragePlugin;
|
|
@ -1,2 +0,0 @@
|
|||||||
/node_modules
|
|
||||||
/src
|
|
@ -1,661 +0,0 @@
|
|||||||
GNU AFFERO GENERAL PUBLIC LICENSE
|
|
||||||
Version 3, 19 November 2007
|
|
||||||
|
|
||||||
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
|
||||||
Everyone is permitted to copy and distribute verbatim copies
|
|
||||||
of this license document, but changing it is not allowed.
|
|
||||||
|
|
||||||
Preamble
|
|
||||||
|
|
||||||
The GNU Affero General Public License is a free, copyleft license for
|
|
||||||
software and other kinds of works, specifically designed to ensure
|
|
||||||
cooperation with the community in the case of network server software.
|
|
||||||
|
|
||||||
The licenses for most software and other practical works are designed
|
|
||||||
to take away your freedom to share and change the works. By contrast,
|
|
||||||
our General Public Licenses are intended to guarantee your freedom to
|
|
||||||
share and change all versions of a program--to make sure it remains free
|
|
||||||
software for all its users.
|
|
||||||
|
|
||||||
When we speak of free software, we are referring to freedom, not
|
|
||||||
price. Our General Public Licenses are designed to make sure that you
|
|
||||||
have the freedom to distribute copies of free software (and charge for
|
|
||||||
them if you wish), that you receive source code or can get it if you
|
|
||||||
want it, that you can change the software or use pieces of it in new
|
|
||||||
free programs, and that you know you can do these things.
|
|
||||||
|
|
||||||
Developers that use our General Public Licenses protect your rights
|
|
||||||
with two steps: (1) assert copyright on the software, and (2) offer
|
|
||||||
you this License which gives you legal permission to copy, distribute
|
|
||||||
and/or modify the software.
|
|
||||||
|
|
||||||
A secondary benefit of defending all users' freedom is that
|
|
||||||
improvements made in alternate versions of the program, if they
|
|
||||||
receive widespread use, become available for other developers to
|
|
||||||
incorporate. Many developers of free software are heartened and
|
|
||||||
encouraged by the resulting cooperation. However, in the case of
|
|
||||||
software used on network servers, this result may fail to come about.
|
|
||||||
The GNU General Public License permits making a modified version and
|
|
||||||
letting the public access it on a server without ever releasing its
|
|
||||||
source code to the public.
|
|
||||||
|
|
||||||
The GNU Affero General Public License is designed specifically to
|
|
||||||
ensure that, in such cases, the modified source code becomes available
|
|
||||||
to the community. It requires the operator of a network server to
|
|
||||||
provide the source code of the modified version running there to the
|
|
||||||
users of that server. Therefore, public use of a modified version, on
|
|
||||||
a publicly accessible server, gives the public access to the source
|
|
||||||
code of the modified version.
|
|
||||||
|
|
||||||
An older license, called the Affero General Public License and
|
|
||||||
published by Affero, was designed to accomplish similar goals. This is
|
|
||||||
a different license, not a version of the Affero GPL, but Affero has
|
|
||||||
released a new version of the Affero GPL which permits relicensing under
|
|
||||||
this license.
|
|
||||||
|
|
||||||
The precise terms and conditions for copying, distribution and
|
|
||||||
modification follow.
|
|
||||||
|
|
||||||
TERMS AND CONDITIONS
|
|
||||||
|
|
||||||
0. Definitions.
|
|
||||||
|
|
||||||
"This License" refers to version 3 of the GNU Affero General Public License.
|
|
||||||
|
|
||||||
"Copyright" also means copyright-like laws that apply to other kinds of
|
|
||||||
works, such as semiconductor masks.
|
|
||||||
|
|
||||||
"The Program" refers to any copyrightable work licensed under this
|
|
||||||
License. Each licensee is addressed as "you". "Licensees" and
|
|
||||||
"recipients" may be individuals or organizations.
|
|
||||||
|
|
||||||
To "modify" a work means to copy from or adapt all or part of the work
|
|
||||||
in a fashion requiring copyright permission, other than the making of an
|
|
||||||
exact copy. The resulting work is called a "modified version" of the
|
|
||||||
earlier work or a work "based on" the earlier work.
|
|
||||||
|
|
||||||
A "covered work" means either the unmodified Program or a work based
|
|
||||||
on the Program.
|
|
||||||
|
|
||||||
To "propagate" a work means to do anything with it that, without
|
|
||||||
permission, would make you directly or secondarily liable for
|
|
||||||
infringement under applicable copyright law, except executing it on a
|
|
||||||
computer or modifying a private copy. Propagation includes copying,
|
|
||||||
distribution (with or without modification), making available to the
|
|
||||||
public, and in some countries other activities as well.
|
|
||||||
|
|
||||||
To "convey" a work means any kind of propagation that enables other
|
|
||||||
parties to make or receive copies. Mere interaction with a user through
|
|
||||||
a computer network, with no transfer of a copy, is not conveying.
|
|
||||||
|
|
||||||
An interactive user interface displays "Appropriate Legal Notices"
|
|
||||||
to the extent that it includes a convenient and prominently visible
|
|
||||||
feature that (1) displays an appropriate copyright notice, and (2)
|
|
||||||
tells the user that there is no warranty for the work (except to the
|
|
||||||
extent that warranties are provided), that licensees may convey the
|
|
||||||
work under this License, and how to view a copy of this License. If
|
|
||||||
the interface presents a list of user commands or options, such as a
|
|
||||||
menu, a prominent item in the list meets this criterion.
|
|
||||||
|
|
||||||
1. Source Code.
|
|
||||||
|
|
||||||
The "source code" for a work means the preferred form of the work
|
|
||||||
for making modifications to it. "Object code" means any non-source
|
|
||||||
form of a work.
|
|
||||||
|
|
||||||
A "Standard Interface" means an interface that either is an official
|
|
||||||
standard defined by a recognized standards body, or, in the case of
|
|
||||||
interfaces specified for a particular programming language, one that
|
|
||||||
is widely used among developers working in that language.
|
|
||||||
|
|
||||||
The "System Libraries" of an executable work include anything, other
|
|
||||||
than the work as a whole, that (a) is included in the normal form of
|
|
||||||
packaging a Major Component, but which is not part of that Major
|
|
||||||
Component, and (b) serves only to enable use of the work with that
|
|
||||||
Major Component, or to implement a Standard Interface for which an
|
|
||||||
implementation is available to the public in source code form. A
|
|
||||||
"Major Component", in this context, means a major essential component
|
|
||||||
(kernel, window system, and so on) of the specific operating system
|
|
||||||
(if any) on which the executable work runs, or a compiler used to
|
|
||||||
produce the work, or an object code interpreter used to run it.
|
|
||||||
|
|
||||||
The "Corresponding Source" for a work in object code form means all
|
|
||||||
the source code needed to generate, install, and (for an executable
|
|
||||||
work) run the object code and to modify the work, including scripts to
|
|
||||||
control those activities. However, it does not include the work's
|
|
||||||
System Libraries, or general-purpose tools or generally available free
|
|
||||||
programs which are used unmodified in performing those activities but
|
|
||||||
which are not part of the work. For example, Corresponding Source
|
|
||||||
includes interface definition files associated with source files for
|
|
||||||
the work, and the source code for shared libraries and dynamically
|
|
||||||
linked subprograms that the work is specifically designed to require,
|
|
||||||
such as by intimate data communication or control flow between those
|
|
||||||
subprograms and other parts of the work.
|
|
||||||
|
|
||||||
The Corresponding Source need not include anything that users
|
|
||||||
can regenerate automatically from other parts of the Corresponding
|
|
||||||
Source.
|
|
||||||
|
|
||||||
The Corresponding Source for a work in source code form is that
|
|
||||||
same work.
|
|
||||||
|
|
||||||
2. Basic Permissions.
|
|
||||||
|
|
||||||
All rights granted under this License are granted for the term of
|
|
||||||
copyright on the Program, and are irrevocable provided the stated
|
|
||||||
conditions are met. This License explicitly affirms your unlimited
|
|
||||||
permission to run the unmodified Program. The output from running a
|
|
||||||
covered work is covered by this License only if the output, given its
|
|
||||||
content, constitutes a covered work. This License acknowledges your
|
|
||||||
rights of fair use or other equivalent, as provided by copyright law.
|
|
||||||
|
|
||||||
You may make, run and propagate covered works that you do not
|
|
||||||
convey, without conditions so long as your license otherwise remains
|
|
||||||
in force. You may convey covered works to others for the sole purpose
|
|
||||||
of having them make modifications exclusively for you, or provide you
|
|
||||||
with facilities for running those works, provided that you comply with
|
|
||||||
the terms of this License in conveying all material for which you do
|
|
||||||
not control copyright. Those thus making or running the covered works
|
|
||||||
for you must do so exclusively on your behalf, under your direction
|
|
||||||
and control, on terms that prohibit them from making any copies of
|
|
||||||
your copyrighted material outside their relationship with you.
|
|
||||||
|
|
||||||
Conveying under any other circumstances is permitted solely under
|
|
||||||
the conditions stated below. Sublicensing is not allowed; section 10
|
|
||||||
makes it unnecessary.
|
|
||||||
|
|
||||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
|
||||||
|
|
||||||
No covered work shall be deemed part of an effective technological
|
|
||||||
measure under any applicable law fulfilling obligations under article
|
|
||||||
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
|
||||||
similar laws prohibiting or restricting circumvention of such
|
|
||||||
measures.
|
|
||||||
|
|
||||||
When you convey a covered work, you waive any legal power to forbid
|
|
||||||
circumvention of technological measures to the extent such circumvention
|
|
||||||
is effected by exercising rights under this License with respect to
|
|
||||||
the covered work, and you disclaim any intention to limit operation or
|
|
||||||
modification of the work as a means of enforcing, against the work's
|
|
||||||
users, your or third parties' legal rights to forbid circumvention of
|
|
||||||
technological measures.
|
|
||||||
|
|
||||||
4. Conveying Verbatim Copies.
|
|
||||||
|
|
||||||
You may convey verbatim copies of the Program's source code as you
|
|
||||||
receive it, in any medium, provided that you conspicuously and
|
|
||||||
appropriately publish on each copy an appropriate copyright notice;
|
|
||||||
keep intact all notices stating that this License and any
|
|
||||||
non-permissive terms added in accord with section 7 apply to the code;
|
|
||||||
keep intact all notices of the absence of any warranty; and give all
|
|
||||||
recipients a copy of this License along with the Program.
|
|
||||||
|
|
||||||
You may charge any price or no price for each copy that you convey,
|
|
||||||
and you may offer support or warranty protection for a fee.
|
|
||||||
|
|
||||||
5. Conveying Modified Source Versions.
|
|
||||||
|
|
||||||
You may convey a work based on the Program, or the modifications to
|
|
||||||
produce it from the Program, in the form of source code under the
|
|
||||||
terms of section 4, provided that you also meet all of these conditions:
|
|
||||||
|
|
||||||
a) The work must carry prominent notices stating that you modified
|
|
||||||
it, and giving a relevant date.
|
|
||||||
|
|
||||||
b) The work must carry prominent notices stating that it is
|
|
||||||
released under this License and any conditions added under section
|
|
||||||
7. This requirement modifies the requirement in section 4 to
|
|
||||||
"keep intact all notices".
|
|
||||||
|
|
||||||
c) You must license the entire work, as a whole, under this
|
|
||||||
License to anyone who comes into possession of a copy. This
|
|
||||||
License will therefore apply, along with any applicable section 7
|
|
||||||
additional terms, to the whole of the work, and all its parts,
|
|
||||||
regardless of how they are packaged. This License gives no
|
|
||||||
permission to license the work in any other way, but it does not
|
|
||||||
invalidate such permission if you have separately received it.
|
|
||||||
|
|
||||||
d) If the work has interactive user interfaces, each must display
|
|
||||||
Appropriate Legal Notices; however, if the Program has interactive
|
|
||||||
interfaces that do not display Appropriate Legal Notices, your
|
|
||||||
work need not make them do so.
|
|
||||||
|
|
||||||
A compilation of a covered work with other separate and independent
|
|
||||||
works, which are not by their nature extensions of the covered work,
|
|
||||||
and which are not combined with it such as to form a larger program,
|
|
||||||
in or on a volume of a storage or distribution medium, is called an
|
|
||||||
"aggregate" if the compilation and its resulting copyright are not
|
|
||||||
used to limit the access or legal rights of the compilation's users
|
|
||||||
beyond what the individual works permit. Inclusion of a covered work
|
|
||||||
in an aggregate does not cause this License to apply to the other
|
|
||||||
parts of the aggregate.
|
|
||||||
|
|
||||||
6. Conveying Non-Source Forms.
|
|
||||||
|
|
||||||
You may convey a covered work in object code form under the terms
|
|
||||||
of sections 4 and 5, provided that you also convey the
|
|
||||||
machine-readable Corresponding Source under the terms of this License,
|
|
||||||
in one of these ways:
|
|
||||||
|
|
||||||
a) Convey the object code in, or embodied in, a physical product
|
|
||||||
(including a physical distribution medium), accompanied by the
|
|
||||||
Corresponding Source fixed on a durable physical medium
|
|
||||||
customarily used for software interchange.
|
|
||||||
|
|
||||||
b) Convey the object code in, or embodied in, a physical product
|
|
||||||
(including a physical distribution medium), accompanied by a
|
|
||||||
written offer, valid for at least three years and valid for as
|
|
||||||
long as you offer spare parts or customer support for that product
|
|
||||||
model, to give anyone who possesses the object code either (1) a
|
|
||||||
copy of the Corresponding Source for all the software in the
|
|
||||||
product that is covered by this License, on a durable physical
|
|
||||||
medium customarily used for software interchange, for a price no
|
|
||||||
more than your reasonable cost of physically performing this
|
|
||||||
conveying of source, or (2) access to copy the
|
|
||||||
Corresponding Source from a network server at no charge.
|
|
||||||
|
|
||||||
c) Convey individual copies of the object code with a copy of the
|
|
||||||
written offer to provide the Corresponding Source. This
|
|
||||||
alternative is allowed only occasionally and noncommercially, and
|
|
||||||
only if you received the object code with such an offer, in accord
|
|
||||||
with subsection 6b.
|
|
||||||
|
|
||||||
d) Convey the object code by offering access from a designated
|
|
||||||
place (gratis or for a charge), and offer equivalent access to the
|
|
||||||
Corresponding Source in the same way through the same place at no
|
|
||||||
further charge. You need not require recipients to copy the
|
|
||||||
Corresponding Source along with the object code. If the place to
|
|
||||||
copy the object code is a network server, the Corresponding Source
|
|
||||||
may be on a different server (operated by you or a third party)
|
|
||||||
that supports equivalent copying facilities, provided you maintain
|
|
||||||
clear directions next to the object code saying where to find the
|
|
||||||
Corresponding Source. Regardless of what server hosts the
|
|
||||||
Corresponding Source, you remain obligated to ensure that it is
|
|
||||||
available for as long as needed to satisfy these requirements.
|
|
||||||
|
|
||||||
e) Convey the object code using peer-to-peer transmission, provided
|
|
||||||
you inform other peers where the object code and Corresponding
|
|
||||||
Source of the work are being offered to the general public at no
|
|
||||||
charge under subsection 6d.
|
|
||||||
|
|
||||||
A separable portion of the object code, whose source code is excluded
|
|
||||||
from the Corresponding Source as a System Library, need not be
|
|
||||||
included in conveying the object code work.
|
|
||||||
|
|
||||||
A "User Product" is either (1) a "consumer product", which means any
|
|
||||||
tangible personal property which is normally used for personal, family,
|
|
||||||
or household purposes, or (2) anything designed or sold for incorporation
|
|
||||||
into a dwelling. In determining whether a product is a consumer product,
|
|
||||||
doubtful cases shall be resolved in favor of coverage. For a particular
|
|
||||||
product received by a particular user, "normally used" refers to a
|
|
||||||
typical or common use of that class of product, regardless of the status
|
|
||||||
of the particular user or of the way in which the particular user
|
|
||||||
actually uses, or expects or is expected to use, the product. A product
|
|
||||||
is a consumer product regardless of whether the product has substantial
|
|
||||||
commercial, industrial or non-consumer uses, unless such uses represent
|
|
||||||
the only significant mode of use of the product.
|
|
||||||
|
|
||||||
"Installation Information" for a User Product means any methods,
|
|
||||||
procedures, authorization keys, or other information required to install
|
|
||||||
and execute modified versions of a covered work in that User Product from
|
|
||||||
a modified version of its Corresponding Source. The information must
|
|
||||||
suffice to ensure that the continued functioning of the modified object
|
|
||||||
code is in no case prevented or interfered with solely because
|
|
||||||
modification has been made.
|
|
||||||
|
|
||||||
If you convey an object code work under this section in, or with, or
|
|
||||||
specifically for use in, a User Product, and the conveying occurs as
|
|
||||||
part of a transaction in which the right of possession and use of the
|
|
||||||
User Product is transferred to the recipient in perpetuity or for a
|
|
||||||
fixed term (regardless of how the transaction is characterized), the
|
|
||||||
Corresponding Source conveyed under this section must be accompanied
|
|
||||||
by the Installation Information. But this requirement does not apply
|
|
||||||
if neither you nor any third party retains the ability to install
|
|
||||||
modified object code on the User Product (for example, the work has
|
|
||||||
been installed in ROM).
|
|
||||||
|
|
||||||
The requirement to provide Installation Information does not include a
|
|
||||||
requirement to continue to provide support service, warranty, or updates
|
|
||||||
for a work that has been modified or installed by the recipient, or for
|
|
||||||
the User Product in which it has been modified or installed. Access to a
|
|
||||||
network may be denied when the modification itself materially and
|
|
||||||
adversely affects the operation of the network or violates the rules and
|
|
||||||
protocols for communication across the network.
|
|
||||||
|
|
||||||
Corresponding Source conveyed, and Installation Information provided,
|
|
||||||
in accord with this section must be in a format that is publicly
|
|
||||||
documented (and with an implementation available to the public in
|
|
||||||
source code form), and must require no special password or key for
|
|
||||||
unpacking, reading or copying.
|
|
||||||
|
|
||||||
7. Additional Terms.
|
|
||||||
|
|
||||||
"Additional permissions" are terms that supplement the terms of this
|
|
||||||
License by making exceptions from one or more of its conditions.
|
|
||||||
Additional permissions that are applicable to the entire Program shall
|
|
||||||
be treated as though they were included in this License, to the extent
|
|
||||||
that they are valid under applicable law. If additional permissions
|
|
||||||
apply only to part of the Program, that part may be used separately
|
|
||||||
under those permissions, but the entire Program remains governed by
|
|
||||||
this License without regard to the additional permissions.
|
|
||||||
|
|
||||||
When you convey a copy of a covered work, you may at your option
|
|
||||||
remove any additional permissions from that copy, or from any part of
|
|
||||||
it. (Additional permissions may be written to require their own
|
|
||||||
removal in certain cases when you modify the work.) You may place
|
|
||||||
additional permissions on material, added by you to a covered work,
|
|
||||||
for which you have or can give appropriate copyright permission.
|
|
||||||
|
|
||||||
Notwithstanding any other provision of this License, for material you
|
|
||||||
add to a covered work, you may (if authorized by the copyright holders of
|
|
||||||
that material) supplement the terms of this License with terms:
|
|
||||||
|
|
||||||
a) Disclaiming warranty or limiting liability differently from the
|
|
||||||
terms of sections 15 and 16 of this License; or
|
|
||||||
|
|
||||||
b) Requiring preservation of specified reasonable legal notices or
|
|
||||||
author attributions in that material or in the Appropriate Legal
|
|
||||||
Notices displayed by works containing it; or
|
|
||||||
|
|
||||||
c) Prohibiting misrepresentation of the origin of that material, or
|
|
||||||
requiring that modified versions of such material be marked in
|
|
||||||
reasonable ways as different from the original version; or
|
|
||||||
|
|
||||||
d) Limiting the use for publicity purposes of names of licensors or
|
|
||||||
authors of the material; or
|
|
||||||
|
|
||||||
e) Declining to grant rights under trademark law for use of some
|
|
||||||
trade names, trademarks, or service marks; or
|
|
||||||
|
|
||||||
f) Requiring indemnification of licensors and authors of that
|
|
||||||
material by anyone who conveys the material (or modified versions of
|
|
||||||
it) with contractual assumptions of liability to the recipient, for
|
|
||||||
any liability that these contractual assumptions directly impose on
|
|
||||||
those licensors and authors.
|
|
||||||
|
|
||||||
All other non-permissive additional terms are considered "further
|
|
||||||
restrictions" within the meaning of section 10. If the Program as you
|
|
||||||
received it, or any part of it, contains a notice stating that it is
|
|
||||||
governed by this License along with a term that is a further
|
|
||||||
restriction, you may remove that term. If a license document contains
|
|
||||||
a further restriction but permits relicensing or conveying under this
|
|
||||||
License, you may add to a covered work material governed by the terms
|
|
||||||
of that license document, provided that the further restriction does
|
|
||||||
not survive such relicensing or conveying.
|
|
||||||
|
|
||||||
If you add terms to a covered work in accord with this section, you
|
|
||||||
must place, in the relevant source files, a statement of the
|
|
||||||
additional terms that apply to those files, or a notice indicating
|
|
||||||
where to find the applicable terms.
|
|
||||||
|
|
||||||
Additional terms, permissive or non-permissive, may be stated in the
|
|
||||||
form of a separately written license, or stated as exceptions;
|
|
||||||
the above requirements apply either way.
|
|
||||||
|
|
||||||
8. Termination.
|
|
||||||
|
|
||||||
You may not propagate or modify a covered work except as expressly
|
|
||||||
provided under this License. Any attempt otherwise to propagate or
|
|
||||||
modify it is void, and will automatically terminate your rights under
|
|
||||||
this License (including any patent licenses granted under the third
|
|
||||||
paragraph of section 11).
|
|
||||||
|
|
||||||
However, if you cease all violation of this License, then your
|
|
||||||
license from a particular copyright holder is reinstated (a)
|
|
||||||
provisionally, unless and until the copyright holder explicitly and
|
|
||||||
finally terminates your license, and (b) permanently, if the copyright
|
|
||||||
holder fails to notify you of the violation by some reasonable means
|
|
||||||
prior to 60 days after the cessation.
|
|
||||||
|
|
||||||
Moreover, your license from a particular copyright holder is
|
|
||||||
reinstated permanently if the copyright holder notifies you of the
|
|
||||||
violation by some reasonable means, this is the first time you have
|
|
||||||
received notice of violation of this License (for any work) from that
|
|
||||||
copyright holder, and you cure the violation prior to 30 days after
|
|
||||||
your receipt of the notice.
|
|
||||||
|
|
||||||
Termination of your rights under this section does not terminate the
|
|
||||||
licenses of parties who have received copies or rights from you under
|
|
||||||
this License. If your rights have been terminated and not permanently
|
|
||||||
reinstated, you do not qualify to receive new licenses for the same
|
|
||||||
material under section 10.
|
|
||||||
|
|
||||||
9. Acceptance Not Required for Having Copies.
|
|
||||||
|
|
||||||
You are not required to accept this License in order to receive or
|
|
||||||
run a copy of the Program. Ancillary propagation of a covered work
|
|
||||||
occurring solely as a consequence of using peer-to-peer transmission
|
|
||||||
to receive a copy likewise does not require acceptance. However,
|
|
||||||
nothing other than this License grants you permission to propagate or
|
|
||||||
modify any covered work. These actions infringe copyright if you do
|
|
||||||
not accept this License. Therefore, by modifying or propagating a
|
|
||||||
covered work, you indicate your acceptance of this License to do so.
|
|
||||||
|
|
||||||
10. Automatic Licensing of Downstream Recipients.
|
|
||||||
|
|
||||||
Each time you convey a covered work, the recipient automatically
|
|
||||||
receives a license from the original licensors, to run, modify and
|
|
||||||
propagate that work, subject to this License. You are not responsible
|
|
||||||
for enforcing compliance by third parties with this License.
|
|
||||||
|
|
||||||
An "entity transaction" is a transaction transferring control of an
|
|
||||||
organization, or substantially all assets of one, or subdividing an
|
|
||||||
organization, or merging organizations. If propagation of a covered
|
|
||||||
work results from an entity transaction, each party to that
|
|
||||||
transaction who receives a copy of the work also receives whatever
|
|
||||||
licenses to the work the party's predecessor in interest had or could
|
|
||||||
give under the previous paragraph, plus a right to possession of the
|
|
||||||
Corresponding Source of the work from the predecessor in interest, if
|
|
||||||
the predecessor has it or can get it with reasonable efforts.
|
|
||||||
|
|
||||||
You may not impose any further restrictions on the exercise of the
|
|
||||||
rights granted or affirmed under this License. For example, you may
|
|
||||||
not impose a license fee, royalty, or other charge for exercise of
|
|
||||||
rights granted under this License, and you may not initiate litigation
|
|
||||||
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
|
||||||
any patent claim is infringed by making, using, selling, offering for
|
|
||||||
sale, or importing the Program or any portion of it.
|
|
||||||
|
|
||||||
11. Patents.
|
|
||||||
|
|
||||||
A "contributor" is a copyright holder who authorizes use under this
|
|
||||||
License of the Program or a work on which the Program is based. The
|
|
||||||
work thus licensed is called the contributor's "contributor version".
|
|
||||||
|
|
||||||
A contributor's "essential patent claims" are all patent claims
|
|
||||||
owned or controlled by the contributor, whether already acquired or
|
|
||||||
hereafter acquired, that would be infringed by some manner, permitted
|
|
||||||
by this License, of making, using, or selling its contributor version,
|
|
||||||
but do not include claims that would be infringed only as a
|
|
||||||
consequence of further modification of the contributor version. For
|
|
||||||
purposes of this definition, "control" includes the right to grant
|
|
||||||
patent sublicenses in a manner consistent with the requirements of
|
|
||||||
this License.
|
|
||||||
|
|
||||||
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
|
||||||
patent license under the contributor's essential patent claims, to
|
|
||||||
make, use, sell, offer for sale, import and otherwise run, modify and
|
|
||||||
propagate the contents of its contributor version.
|
|
||||||
|
|
||||||
In the following three paragraphs, a "patent license" is any express
|
|
||||||
agreement or commitment, however denominated, not to enforce a patent
|
|
||||||
(such as an express permission to practice a patent or covenant not to
|
|
||||||
sue for patent infringement). To "grant" such a patent license to a
|
|
||||||
party means to make such an agreement or commitment not to enforce a
|
|
||||||
patent against the party.
|
|
||||||
|
|
||||||
If you convey a covered work, knowingly relying on a patent license,
|
|
||||||
and the Corresponding Source of the work is not available for anyone
|
|
||||||
to copy, free of charge and under the terms of this License, through a
|
|
||||||
publicly available network server or other readily accessible means,
|
|
||||||
then you must either (1) cause the Corresponding Source to be so
|
|
||||||
available, or (2) arrange to deprive yourself of the benefit of the
|
|
||||||
patent license for this particular work, or (3) arrange, in a manner
|
|
||||||
consistent with the requirements of this License, to extend the patent
|
|
||||||
license to downstream recipients. "Knowingly relying" means you have
|
|
||||||
actual knowledge that, but for the patent license, your conveying the
|
|
||||||
covered work in a country, or your recipient's use of the covered work
|
|
||||||
in a country, would infringe one or more identifiable patents in that
|
|
||||||
country that you have reason to believe are valid.
|
|
||||||
|
|
||||||
If, pursuant to or in connection with a single transaction or
|
|
||||||
arrangement, you convey, or propagate by procuring conveyance of, a
|
|
||||||
covered work, and grant a patent license to some of the parties
|
|
||||||
receiving the covered work authorizing them to use, propagate, modify
|
|
||||||
or convey a specific copy of the covered work, then the patent license
|
|
||||||
you grant is automatically extended to all recipients of the covered
|
|
||||||
work and works based on it.
|
|
||||||
|
|
||||||
A patent license is "discriminatory" if it does not include within
|
|
||||||
the scope of its coverage, prohibits the exercise of, or is
|
|
||||||
conditioned on the non-exercise of one or more of the rights that are
|
|
||||||
specifically granted under this License. You may not convey a covered
|
|
||||||
work if you are a party to an arrangement with a third party that is
|
|
||||||
in the business of distributing software, under which you make payment
|
|
||||||
to the third party based on the extent of your activity of conveying
|
|
||||||
the work, and under which the third party grants, to any of the
|
|
||||||
parties who would receive the covered work from you, a discriminatory
|
|
||||||
patent license (a) in connection with copies of the covered work
|
|
||||||
conveyed by you (or copies made from those copies), or (b) primarily
|
|
||||||
for and in connection with specific products or compilations that
|
|
||||||
contain the covered work, unless you entered into that arrangement,
|
|
||||||
or that patent license was granted, prior to 28 March 2007.
|
|
||||||
|
|
||||||
Nothing in this License shall be construed as excluding or limiting
|
|
||||||
any implied license or other defenses to infringement that may
|
|
||||||
otherwise be available to you under applicable patent law.
|
|
||||||
|
|
||||||
12. No Surrender of Others' Freedom.
|
|
||||||
|
|
||||||
If conditions are imposed on you (whether by court order, agreement or
|
|
||||||
otherwise) that contradict the conditions of this License, they do not
|
|
||||||
excuse you from the conditions of this License. If you cannot convey a
|
|
||||||
covered work so as to satisfy simultaneously your obligations under this
|
|
||||||
License and any other pertinent obligations, then as a consequence you may
|
|
||||||
not convey it at all. For example, if you agree to terms that obligate you
|
|
||||||
to collect a royalty for further conveying from those to whom you convey
|
|
||||||
the Program, the only way you could satisfy both those terms and this
|
|
||||||
License would be to refrain entirely from conveying the Program.
|
|
||||||
|
|
||||||
13. Remote Network Interaction; Use with the GNU General Public License.
|
|
||||||
|
|
||||||
Notwithstanding any other provision of this License, if you modify the
|
|
||||||
Program, your modified version must prominently offer all users
|
|
||||||
interacting with it remotely through a computer network (if your version
|
|
||||||
supports such interaction) an opportunity to receive the Corresponding
|
|
||||||
Source of your version by providing access to the Corresponding Source
|
|
||||||
from a network server at no charge, through some standard or customary
|
|
||||||
means of facilitating copying of software. This Corresponding Source
|
|
||||||
shall include the Corresponding Source for any work covered by version 3
|
|
||||||
of the GNU General Public License that is incorporated pursuant to the
|
|
||||||
following paragraph.
|
|
||||||
|
|
||||||
Notwithstanding any other provision of this License, you have
|
|
||||||
permission to link or combine any covered work with a work licensed
|
|
||||||
under version 3 of the GNU General Public License into a single
|
|
||||||
combined work, and to convey the resulting work. The terms of this
|
|
||||||
License will continue to apply to the part which is the covered work,
|
|
||||||
but the work with which it is combined will remain governed by version
|
|
||||||
3 of the GNU General Public License.
|
|
||||||
|
|
||||||
14. Revised Versions of this License.
|
|
||||||
|
|
||||||
The Free Software Foundation may publish revised and/or new versions of
|
|
||||||
the GNU Affero General Public License from time to time. Such new versions
|
|
||||||
will be similar in spirit to the present version, but may differ in detail to
|
|
||||||
address new problems or concerns.
|
|
||||||
|
|
||||||
Each version is given a distinguishing version number. If the
|
|
||||||
Program specifies that a certain numbered version of the GNU Affero General
|
|
||||||
Public License "or any later version" applies to it, you have the
|
|
||||||
option of following the terms and conditions either of that numbered
|
|
||||||
version or of any later version published by the Free Software
|
|
||||||
Foundation. If the Program does not specify a version number of the
|
|
||||||
GNU Affero General Public License, you may choose any version ever published
|
|
||||||
by the Free Software Foundation.
|
|
||||||
|
|
||||||
If the Program specifies that a proxy can decide which future
|
|
||||||
versions of the GNU Affero General Public License can be used, that proxy's
|
|
||||||
public statement of acceptance of a version permanently authorizes you
|
|
||||||
to choose that version for the Program.
|
|
||||||
|
|
||||||
Later license versions may give you additional or different
|
|
||||||
permissions. However, no additional obligations are imposed on any
|
|
||||||
author or copyright holder as a result of your choosing to follow a
|
|
||||||
later version.
|
|
||||||
|
|
||||||
15. Disclaimer of Warranty.
|
|
||||||
|
|
||||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
|
||||||
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
|
||||||
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
|
||||||
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
|
||||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
|
||||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
|
||||||
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
|
||||||
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
|
||||||
|
|
||||||
16. Limitation of Liability.
|
|
||||||
|
|
||||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
|
||||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
|
||||||
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
|
||||||
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
|
||||||
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
|
||||||
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
|
||||||
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
|
||||||
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
|
||||||
SUCH DAMAGES.
|
|
||||||
|
|
||||||
17. Interpretation of Sections 15 and 16.
|
|
||||||
|
|
||||||
If the disclaimer of warranty and limitation of liability provided
|
|
||||||
above cannot be given local legal effect according to their terms,
|
|
||||||
reviewing courts shall apply local law that most closely approximates
|
|
||||||
an absolute waiver of all civil liability in connection with the
|
|
||||||
Program, unless a warranty or assumption of liability accompanies a
|
|
||||||
copy of the Program in return for a fee.
|
|
||||||
|
|
||||||
END OF TERMS AND CONDITIONS
|
|
||||||
|
|
||||||
How to Apply These Terms to Your New Programs
|
|
||||||
|
|
||||||
If you develop a new program, and you want it to be of the greatest
|
|
||||||
possible use to the public, the best way to achieve this is to make it
|
|
||||||
free software which everyone can redistribute and change under these terms.
|
|
||||||
|
|
||||||
To do so, attach the following notices to the program. It is safest
|
|
||||||
to attach them to the start of each source file to most effectively
|
|
||||||
state the exclusion of warranty; and each file should have at least
|
|
||||||
the "copyright" line and a pointer to where the full notice is found.
|
|
||||||
|
|
||||||
<one line to give the program's name and a brief idea of what it does.>
|
|
||||||
Copyright (C) <year> <name of author>
|
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU Affero General Public License as published
|
|
||||||
by the Free Software Foundation, either version 3 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU Affero General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Affero General Public License
|
|
||||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
Also add information on how to contact you by electronic and paper mail.
|
|
||||||
|
|
||||||
If your software can interact with users remotely through a computer
|
|
||||||
network, you should also make sure that it provides a way for users to
|
|
||||||
get its source. For example, if your program is a web application, its
|
|
||||||
interface could display a "Source" link that leads users to an archive
|
|
||||||
of the code. There are many ways you could offer source, and different
|
|
||||||
solutions will be better for different programs; see section 13 for the
|
|
||||||
specific requirements.
|
|
||||||
|
|
||||||
You should also get your employer (if you work as a programmer) or school,
|
|
||||||
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
|
||||||
For more information on this, and how to apply and follow the GNU AGPL, see
|
|
||||||
<https://www.gnu.org/licenses/>.
|
|
@ -1 +0,0 @@
|
|||||||
export { default } from './server';
|
|
@ -1,16 +0,0 @@
|
|||||||
import { Migration } from '@nocobase/server';
|
|
||||||
|
|
||||||
export default class SetAuditPluginAsLocalMigration extends Migration {
|
|
||||||
on = 'beforeLoad';
|
|
||||||
appVersion = '<0.13.0-alpha.5';
|
|
||||||
async up() {
|
|
||||||
await this.pm.repository.update({
|
|
||||||
values: {
|
|
||||||
builtIn: false,
|
|
||||||
},
|
|
||||||
filter: {
|
|
||||||
name: 'audit-logs',
|
|
||||||
},
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,16 +0,0 @@
|
|||||||
import { Migration } from '@nocobase/server';
|
|
||||||
|
|
||||||
export default class extends Migration {
|
|
||||||
on = 'beforeLoad';
|
|
||||||
appVersion = '<0.14.0-alpha.8';
|
|
||||||
async up() {
|
|
||||||
await this.pm.repository.update({
|
|
||||||
values: {
|
|
||||||
builtIn: false,
|
|
||||||
},
|
|
||||||
filter: {
|
|
||||||
name: 'charts',
|
|
||||||
},
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,18 +0,0 @@
|
|||||||
import { Migration } from '@nocobase/server';
|
|
||||||
|
|
||||||
export default class extends Migration {
|
|
||||||
on = 'beforeLoad'; // 'beforeLoad' or 'afterLoad'
|
|
||||||
appVersion = '<0.18.0-alpha.10';
|
|
||||||
|
|
||||||
async up() {
|
|
||||||
await this.pm.repository.update({
|
|
||||||
values: {
|
|
||||||
name: 'backup-restore',
|
|
||||||
packageName: '@nocobase/plugin-backup-restore',
|
|
||||||
},
|
|
||||||
filter: {
|
|
||||||
name: 'duplicator',
|
|
||||||
},
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,14 +0,0 @@
|
|||||||
import { Migration } from '@nocobase/server';
|
|
||||||
|
|
||||||
export default class extends Migration {
|
|
||||||
on = 'beforeLoad'; // 'beforeLoad' or 'afterLoad'
|
|
||||||
appVersion = '<0.18.0-alpha.10';
|
|
||||||
|
|
||||||
async up() {
|
|
||||||
await this.pm.repository.destroy({
|
|
||||||
filter: {
|
|
||||||
name: ['ui-routes-storage', 'math-formula-field', 'excel-formula-field'],
|
|
||||||
},
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,14 +0,0 @@
|
|||||||
import { Migration } from '@nocobase/server';
|
|
||||||
|
|
||||||
export default class extends Migration {
|
|
||||||
on = 'afterSync'; // 'beforeLoad' or 'afterLoad'
|
|
||||||
appVersion = '<0.19.0-alpha.4';
|
|
||||||
|
|
||||||
async up() {
|
|
||||||
await this.pm.repository.destroy({
|
|
||||||
filter: {
|
|
||||||
name: ['sample-hello'],
|
|
||||||
},
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,17 +0,0 @@
|
|||||||
import { Migration } from '@nocobase/server';
|
|
||||||
|
|
||||||
export default class extends Migration {
|
|
||||||
on = 'afterLoad'; // 'beforeLoad' or 'afterLoad'
|
|
||||||
appVersion = '<0.20.0-alpha.6';
|
|
||||||
|
|
||||||
async up() {
|
|
||||||
await this.pm.repository.update({
|
|
||||||
values: {
|
|
||||||
builtIn: false,
|
|
||||||
},
|
|
||||||
filter: {
|
|
||||||
name: 'sms-auth',
|
|
||||||
},
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,14 +0,0 @@
|
|||||||
import { Migration } from '@nocobase/server';
|
|
||||||
|
|
||||||
export default class extends Migration {
|
|
||||||
on = 'beforeLoad'; // 'beforeLoad' or 'afterLoad'
|
|
||||||
appVersion = '<0.20.0-alpha.7';
|
|
||||||
|
|
||||||
async up() {
|
|
||||||
await this.pm.repository.destroy({
|
|
||||||
filter: {
|
|
||||||
packageName: '@nocobase/plugin-workflow-form-trigger',
|
|
||||||
},
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,12 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "@nocobase/preset-nocobase",
|
"name": "@tachybase/preset-tachybase",
|
||||||
"version": "0.21.6",
|
"version": "0.21.6",
|
||||||
"repository": {
|
"license": "Apache-2.0",
|
||||||
"type": "git",
|
|
||||||
"url": "git+https://github.com/nocobase/nocobase.git",
|
|
||||||
"directory": "packages/presets/nocobase"
|
|
||||||
},
|
|
||||||
"license": "AGPL-3.0",
|
|
||||||
"main": "./lib/server/index.js",
|
"main": "./lib/server/index.js",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@nocobase/client": "workspace:*",
|
"@nocobase/client": "workspace:*",
|
||||||
@ -17,7 +12,6 @@
|
|||||||
"@nocobase/plugin-action-print": "workspace:*",
|
"@nocobase/plugin-action-print": "workspace:*",
|
||||||
"@nocobase/plugin-api-doc": "workspace:*",
|
"@nocobase/plugin-api-doc": "workspace:*",
|
||||||
"@nocobase/plugin-api-keys": "workspace:*",
|
"@nocobase/plugin-api-keys": "workspace:*",
|
||||||
"@nocobase/plugin-audit-logs": "workspace:*",
|
|
||||||
"@nocobase/plugin-auth": "workspace:*",
|
"@nocobase/plugin-auth": "workspace:*",
|
||||||
"@nocobase/plugin-backup-restore": "workspace:*",
|
"@nocobase/plugin-backup-restore": "workspace:*",
|
||||||
"@nocobase/plugin-calendar": "workspace:*",
|
"@nocobase/plugin-calendar": "workspace:*",
|
||||||
@ -70,5 +64,7 @@
|
|||||||
"cronstrue": "^2.11.0",
|
"cronstrue": "^2.11.0",
|
||||||
"lodash": "4.17.21"
|
"lodash": "4.17.21"
|
||||||
},
|
},
|
||||||
"gitHead": "d0b4efe4be55f8c79a98a331d99d9f8cf99021a1"
|
"devDependencies": {
|
||||||
|
"@types/lodash": "^4.17.0"
|
||||||
|
}
|
||||||
}
|
}
|
@ -13,7 +13,7 @@ function getBasename(app: Application) {
|
|||||||
return match ? match[0] : publicPath;
|
return match ? match[0] : publicPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class NocoBaseClientPresetPlugin extends Plugin {
|
export class TachyBaseClientPresetPlugin extends Plugin {
|
||||||
async afterAdd() {
|
async afterAdd() {
|
||||||
this.router.setType('browser');
|
this.router.setType('browser');
|
||||||
this.router.setBasename(getBasename(this.app));
|
this.router.setBasename(getBasename(this.app));
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user