@nocobase/plugin-client 0.9.2-alpha.4 → 0.9.4-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -214,6 +214,9 @@
214
214
  "Generated automatically if left blank": "Gerado automaticamente se deixado em branco",
215
215
  "Display association fields": "Exibir campos de associação",
216
216
  "Field component": "Componente de campo",
217
+ "Quick upload": "Upload rápido",
218
+ "Select file": "Selecionar arquivo",
219
+ "Allow multiple": "Permitir múltiplos",
217
220
  "Subtable": "Subtabela",
218
221
  "Subform": "Subformulário",
219
222
  "Record picker": "Selecionador de registro",
@@ -230,6 +230,9 @@
230
230
  "Generated automatically if left blank": "留空时,自动生成中间表",
231
231
  "Display association fields": "显示关联表的字段",
232
232
  "Field component": "字段组件",
233
+ "Allow multiple": "允许多选",
234
+ "Quick upload": "快速上传",
235
+ "Select file": "选择文件",
233
236
  "Subtable": "子表格",
234
237
  "Subform": "子表单",
235
238
  "Record picker": "数据选择器",
@@ -503,6 +506,7 @@
503
506
  "Allows to configure interface": "允许配置界面",
504
507
  "Allows to install, activate, disable plugins": "允许安装、激活、禁用插件",
505
508
  "Allows to configure plugins": "允许配置插件",
509
+ "Allows to reload application": "允许重新加载应用",
506
510
  "Action display name": "操作名称",
507
511
  "Allow": "允许",
508
512
  "Data scope": "数据范围",
@@ -990,11 +994,26 @@
990
994
  "quarterPlaceholder": "请选择季度",
991
995
  "monthPlaceholder": "请选择月份",
992
996
  "weekPlaceholder": "请选择周",
993
- "rangePlaceholder": ["开始日期", "结束日期"],
994
- "rangeYearPlaceholder": ["开始年份", "结束年份"],
995
- "rangeMonthPlaceholder": ["开始月份", "结束月份"],
996
- "rangeQuarterPlaceholder": ["开始季度", "结束季度"],
997
- "rangeWeekPlaceholder": ["开始周", "结束周"],
997
+ "rangePlaceholder": [
998
+ "开始日期",
999
+ "结束日期"
1000
+ ],
1001
+ "rangeYearPlaceholder": [
1002
+ "开始年份",
1003
+ "结束年份"
1004
+ ],
1005
+ "rangeMonthPlaceholder": [
1006
+ "开始月份",
1007
+ "结束月份"
1008
+ ],
1009
+ "rangeQuarterPlaceholder": [
1010
+ "开始季度",
1011
+ "结束季度"
1012
+ ],
1013
+ "rangeWeekPlaceholder": [
1014
+ "开始周",
1015
+ "结束周"
1016
+ ],
998
1017
  "locale": "zh_CN",
999
1018
  "today": "今天",
1000
1019
  "now": "此刻",
@@ -1022,9 +1041,21 @@
1022
1041
  "previousCentury": "上一世纪",
1023
1042
  "nextCentury": "下一世纪"
1024
1043
  },
1025
- "timePickerLocale": { "placeholder": "请选择时间", "rangePlaceholder": ["开始时间", "结束时间"] }
1044
+ "timePickerLocale": {
1045
+ "placeholder": "请选择时间",
1046
+ "rangePlaceholder": [
1047
+ "开始时间",
1048
+ "结束时间"
1049
+ ]
1050
+ }
1051
+ },
1052
+ "TimePicker": {
1053
+ "placeholder": "请选择时间",
1054
+ "rangePlaceholder": [
1055
+ "开始时间",
1056
+ "结束时间"
1057
+ ]
1026
1058
  },
1027
- "TimePicker": { "placeholder": "请选择时间", "rangePlaceholder": ["开始时间", "结束时间"] },
1028
1059
  "Calendar": {
1029
1060
  "lang": {
1030
1061
  "placeholder": "请选择日期",
@@ -1032,11 +1063,26 @@
1032
1063
  "quarterPlaceholder": "请选择季度",
1033
1064
  "monthPlaceholder": "请选择月份",
1034
1065
  "weekPlaceholder": "请选择周",
1035
- "rangePlaceholder": ["开始日期", "结束日期"],
1036
- "rangeYearPlaceholder": ["开始年份", "结束年份"],
1037
- "rangeMonthPlaceholder": ["开始月份", "结束月份"],
1038
- "rangeQuarterPlaceholder": ["开始季度", "结束季度"],
1039
- "rangeWeekPlaceholder": ["开始周", "结束周"],
1066
+ "rangePlaceholder": [
1067
+ "开始日期",
1068
+ "结束日期"
1069
+ ],
1070
+ "rangeYearPlaceholder": [
1071
+ "开始年份",
1072
+ "结束年份"
1073
+ ],
1074
+ "rangeMonthPlaceholder": [
1075
+ "开始月份",
1076
+ "结束月份"
1077
+ ],
1078
+ "rangeQuarterPlaceholder": [
1079
+ "开始季度",
1080
+ "结束季度"
1081
+ ],
1082
+ "rangeWeekPlaceholder": [
1083
+ "开始周",
1084
+ "结束周"
1085
+ ],
1040
1086
  "locale": "zh_CN",
1041
1087
  "today": "今天",
1042
1088
  "now": "此刻",
@@ -1064,9 +1110,17 @@
1064
1110
  "previousCentury": "上一世纪",
1065
1111
  "nextCentury": "下一世纪"
1066
1112
  },
1067
- "timePickerLocale": { "placeholder": "请选择时间", "rangePlaceholder": ["开始时间", "结束时间"] }
1113
+ "timePickerLocale": {
1114
+ "placeholder": "请选择时间",
1115
+ "rangePlaceholder": [
1116
+ "开始时间",
1117
+ "结束时间"
1118
+ ]
1119
+ }
1120
+ },
1121
+ "global": {
1122
+ "placeholder": "请选择"
1068
1123
  },
1069
- "global": { "placeholder": "请选择" },
1070
1124
  "Table": {
1071
1125
  "filterTitle": "筛选",
1072
1126
  "filterConfirm": "确定",
@@ -1085,8 +1139,15 @@
1085
1139
  "triggerAsc": "点击升序",
1086
1140
  "cancelSort": "取消排序"
1087
1141
  },
1088
- "Modal": { "okText": "确定", "cancelText": "取消", "justOkText": "知道了" },
1089
- "Popconfirm": { "cancelText": "取消", "okText": "确定" },
1142
+ "Modal": {
1143
+ "okText": "确定",
1144
+ "cancelText": "取消",
1145
+ "justOkText": "知道了"
1146
+ },
1147
+ "Popconfirm": {
1148
+ "cancelText": "取消",
1149
+ "okText": "确定"
1150
+ },
1090
1151
  "Transfer": {
1091
1152
  "searchPlaceholder": "请输入搜索内容",
1092
1153
  "itemUnit": "项",
@@ -1105,10 +1166,21 @@
1105
1166
  "previewFile": "预览文件",
1106
1167
  "downloadFile": "下载文件"
1107
1168
  },
1108
- "Empty": { "description": "暂无数据" },
1109
- "Icon": { "icon": "图标" },
1110
- "Text": { "edit": "编辑", "copy": "复制", "copied": "复制成功", "expand": "展开" },
1111
- "PageHeader": { "back": "返回" },
1169
+ "Empty": {
1170
+ "description": "暂无数据"
1171
+ },
1172
+ "Icon": {
1173
+ "icon": "图标"
1174
+ },
1175
+ "Text": {
1176
+ "edit": "编辑",
1177
+ "copy": "复制",
1178
+ "copied": "复制成功",
1179
+ "expand": "展开"
1180
+ },
1181
+ "PageHeader": {
1182
+ "back": "返回"
1183
+ },
1112
1184
  "Form": {
1113
1185
  "optional": "(可选)",
1114
1186
  "defaultValidateMessages": {
@@ -1154,10 +1226,14 @@
1154
1226
  "max": "最多${max}个${label}",
1155
1227
  "range": "${label}数量须在${min}-${max}之间"
1156
1228
  },
1157
- "pattern": { "mismatch": "${label}与模式不匹配${pattern}" }
1229
+ "pattern": {
1230
+ "mismatch": "${label}与模式不匹配${pattern}"
1231
+ }
1158
1232
  }
1159
1233
  },
1160
- "Image": { "preview": "预览" }
1234
+ "Image": {
1235
+ "preview": "预览"
1236
+ }
1161
1237
  },
1162
1238
  "cronstrue": {
1163
1239
  "atX0SecondsPastTheMinuteGt20": null,
@@ -1210,7 +1286,15 @@
1210
1286
  "commaOnDayX0OfTheMonth": ", 限每月%s",
1211
1287
  "commaEveryX0Years": ", 每隔 %s 年",
1212
1288
  "commaStartingX0": ", %s开始",
1213
- "daysOfTheWeek": ["星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"],
1289
+ "daysOfTheWeek": [
1290
+ "星期日",
1291
+ "星期一",
1292
+ "星期二",
1293
+ "星期三",
1294
+ "星期四",
1295
+ "星期五",
1296
+ "星期六"
1297
+ ],
1214
1298
  "monthsOfTheYear": [
1215
1299
  "一月",
1216
1300
  "二月",
@@ -1254,9 +1338,51 @@
1254
1338
  "suffixMinutesForHourPeriod": "分钟",
1255
1339
  "errorInvalidCron": "不符合 cron 规则的表达式",
1256
1340
  "clearButtonText": "清空",
1257
- "weekDays": ["周日", "周一", "周二", "周三", "周四", "周五", "周六"],
1258
- "months": ["一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月"],
1259
- "altWeekDays": ["周日", "周一", "周二", "周三", "周四", "周五", "周六"],
1260
- "altMonths": ["一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月"]
1341
+ "weekDays": [
1342
+ "周日",
1343
+ "周一",
1344
+ "周二",
1345
+ "周三",
1346
+ "周四",
1347
+ "周五",
1348
+ "周六"
1349
+ ],
1350
+ "months": [
1351
+ "一月",
1352
+ "二月",
1353
+ "三月",
1354
+ "四月",
1355
+ "五月",
1356
+ "六月",
1357
+ "七月",
1358
+ "八月",
1359
+ "九月",
1360
+ "十月",
1361
+ "十一月",
1362
+ "十二月"
1363
+ ],
1364
+ "altWeekDays": [
1365
+ "周日",
1366
+ "周一",
1367
+ "周二",
1368
+ "周三",
1369
+ "周四",
1370
+ "周五",
1371
+ "周六"
1372
+ ],
1373
+ "altMonths": [
1374
+ "一月",
1375
+ "二月",
1376
+ "三月",
1377
+ "四月",
1378
+ "五月",
1379
+ "六月",
1380
+ "七月",
1381
+ "八月",
1382
+ "九月",
1383
+ "十月",
1384
+ "十一月",
1385
+ "十二月"
1386
+ ]
1261
1387
  }
1262
- }
1388
+ }
package/lib/server.js CHANGED
@@ -173,8 +173,18 @@ class ClientPlugin extends _server().Plugin {
173
173
  _this2.app.acl.allow('app', 'getInfo');
174
174
  _this2.app.acl.allow('app', 'getPlugins');
175
175
  _this2.app.acl.allow('plugins', '*', 'public');
176
+ _this2.app.acl.registerSnippet({
177
+ name: 'app',
178
+ actions: ['app:reboot', 'app:clearCache']
179
+ });
176
180
  const dialect = _this2.app.db.sequelize.getDialect();
177
181
  const locales = require('./locale').default;
182
+ const restartMark = (0, _path().resolve)(process.cwd(), 'storage', 'restart');
183
+ _this2.app.on('beforeStart', /*#__PURE__*/_asyncToGenerator(function* () {
184
+ if (_fs().default.existsSync(restartMark)) {
185
+ _fs().default.unlinkSync(restartMark);
186
+ }
187
+ }));
178
188
  _this2.app.resource({
179
189
  name: 'app',
180
190
  actions: {
@@ -243,6 +253,26 @@ class ClientPlugin extends _server().Plugin {
243
253
  }).map(item => item.name);
244
254
  yield next();
245
255
  })();
256
+ },
257
+ clearCache(ctx, next) {
258
+ return _asyncToGenerator(function* () {
259
+ yield ctx.cache.reset();
260
+ yield next();
261
+ })();
262
+ },
263
+ reboot(ctx) {
264
+ const RESTART_CODE = 100;
265
+ process.on('exit', code => {
266
+ if (code === RESTART_CODE && process.env.APP_ENV === 'production') {
267
+ _fs().default.writeFileSync(restartMark, '1');
268
+ console.log('Restart mark created.');
269
+ }
270
+ });
271
+ ctx.app.on('afterStop', () => {
272
+ // Exit with code 100 will restart the process
273
+ process.exit(RESTART_CODE);
274
+ });
275
+ ctx.app.stop();
246
276
  }
247
277
  }
248
278
  });
@@ -311,7 +341,7 @@ class ClientPlugin extends _server().Plugin {
311
341
  }
312
342
  if (process.env.APP_ENV !== 'production' && root) {
313
343
  _this2.app.use( /*#__PURE__*/function () {
314
- var _ref4 = _asyncToGenerator(function* (ctx, next) {
344
+ var _ref5 = _asyncToGenerator(function* (ctx, next) {
315
345
  if (ctx.path.startsWith(_this2.app.resourcer.options.prefix)) {
316
346
  return next();
317
347
  }
@@ -324,7 +354,7 @@ class ClientPlugin extends _server().Plugin {
324
354
  }
325
355
  });
326
356
  return function (_x9, _x10) {
327
- return _ref4.apply(this, arguments);
357
+ return _ref5.apply(this, arguments);
328
358
  };
329
359
  }(), {
330
360
  tag: 'clientStatic',
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@nocobase/plugin-client",
3
- "version": "0.9.2-alpha.4",
3
+ "version": "0.9.4-alpha.1",
4
4
  "main": "lib/index.js",
5
5
  "license": "AGPL-3.0",
6
6
  "dependencies": {
7
- "@nocobase/server": "0.9.2-alpha.4"
7
+ "@nocobase/server": "0.9.4-alpha.1"
8
8
  },
9
9
  "devDependencies": {
10
- "@nocobase/test": "0.9.2-alpha.4"
10
+ "@nocobase/test": "0.9.4-alpha.1"
11
11
  },
12
- "gitHead": "96cb023f353a4fb099dea074c575be65ebab813f"
12
+ "gitHead": "0b4936be557be918dbdf8196dadcbc7eb395906d"
13
13
  }