@nocobase/plugin-charts 0.9.1-alpha.2 → 0.9.2-alpha.2

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.
Files changed (43) hide show
  1. package/lib/client/ChartBlockEngine.js +17 -71
  2. package/lib/client/ChartBlockEngineDesigner.js +13 -73
  3. package/lib/client/ChartBlockInitializer.js +16 -72
  4. package/lib/client/ChartQueryBlockInitializer.js +18 -65
  5. package/lib/client/ChartQueryMetadataProvider.js +1 -28
  6. package/lib/client/DataSetPreviewTable.js +14 -28
  7. package/lib/client/Icons.js +3 -19
  8. package/lib/client/chartRenderComponents/index.js +0 -6
  9. package/lib/client/hooks/index.js +4 -18
  10. package/lib/client/index.js +0 -33
  11. package/lib/client/locale/index.js +2 -11
  12. package/lib/client/locale/pt-BR.d.ts +23 -0
  13. package/lib/client/locale/pt-BR.js +29 -0
  14. package/lib/client/select/CustomSelect.js +9 -47
  15. package/lib/client/select/ReadPretty.js +3 -30
  16. package/lib/client/select/index.js +0 -4
  17. package/lib/client/select/shared.js +4 -24
  18. package/lib/client/settings/AddNewQuery.js +22 -81
  19. package/lib/client/settings/ConfigureFields.js +0 -12
  20. package/lib/client/settings/QueriesTable.js +5 -36
  21. package/lib/client/settings/queryTypes.js +0 -7
  22. package/lib/client/settings/schemas/chartsQueries.js +12 -37
  23. package/lib/client/templates/AreaTemplate.js +0 -5
  24. package/lib/client/templates/BarTemplate.js +0 -5
  25. package/lib/client/templates/ColumnTemplate.js +0 -5
  26. package/lib/client/templates/FunnelTemplate.js +0 -5
  27. package/lib/client/templates/LineTemplate.js +4 -7
  28. package/lib/client/templates/PieTemplate.js +0 -5
  29. package/lib/client/templates/RadarTemplate.js +0 -5
  30. package/lib/client/templates/ScatterTemplate.js +0 -5
  31. package/lib/client/templates/index.js +2 -10
  32. package/lib/client/utils.js +0 -16
  33. package/lib/index.js +0 -2
  34. package/lib/server/actions/chartsQueries.js +16 -31
  35. package/lib/server/collections/chartsQueries.js +2 -5
  36. package/lib/server/index.js +0 -2
  37. package/lib/server/plugin.js +0 -36
  38. package/lib/server/query.js +5 -25
  39. package/package.json +5 -5
  40. package/src/client/DataSetPreviewTable.tsx +8 -1
  41. package/src/client/locale/pt-BR.ts +23 -0
  42. package/src/server/actions/chartsQueries.ts +11 -6
  43. package/src/server/collections/chartsQueries.ts +2 -0
@@ -4,12 +4,17 @@ import { query } from '../query';
4
4
  export const getData = async (ctx, next) => {
5
5
  const { filterByTk } = ctx.action.params;
6
6
  const r = ctx.db.getRepository('chartsQueries');
7
- const instance = await r.findOne({ filterByTk });
8
- const result = await query[instance.type](instance.options, { db: ctx.db, skipError: true });
9
- if (typeof result === 'string') {
10
- ctx.body = JSON5.parse(result);
11
- } else {
12
- ctx.body = result;
7
+ try {
8
+ const instance = await r.findOne({ filterByTk });
9
+ const result = await query[instance.type](instance.options, { db: ctx.db, skipError: true });
10
+ if (typeof result === 'string') {
11
+ ctx.body = JSON5.parse(result);
12
+ } else {
13
+ ctx.body = result;
14
+ }
15
+ } catch (error) {
16
+ ctx.body = [];
17
+ ctx.logger.info('chartsQueries', error);
13
18
  }
14
19
  return next();
15
20
  };
@@ -1,6 +1,8 @@
1
1
  import { defineCollection } from '@nocobase/database';
2
2
 
3
3
  export default defineCollection({
4
+ namespace: 'charts.chartsQueries',
5
+ duplicator: 'optional',
4
6
  name: 'chartsQueries',
5
7
  fields: [
6
8
  {