@truedat/core 6.11.0 → 6.12.0

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@truedat/core",
3
- "version": "6.11.0",
3
+ "version": "6.12.0",
4
4
  "description": "Truedat Web Core",
5
5
  "sideEffects": false,
6
6
  "jsnext:main": "src/index.js",
@@ -118,5 +118,5 @@
118
118
  "react-dom": ">= 16.8.6 < 17",
119
119
  "semantic-ui-react": ">= 2.0.3 < 2.2"
120
120
  },
121
- "gitHead": "a0abea9b17d4d6fad4a2f4073c20749e20da35fb"
121
+ "gitHead": "a182d4660919ab242d3150ef4a51641815913a39"
122
122
  }
@@ -1,12 +1,19 @@
1
1
  import React from "react";
2
2
  import { useAuthorized } from "../hooks";
3
- import { AI_SANDBOX, RESOURCE_MAPPINGS, PROMPTS, PROVIDERS } from "../routes";
3
+ import {
4
+ ACTIONS,
5
+ AI_SANDBOX,
6
+ RESOURCE_MAPPINGS,
7
+ PROMPTS,
8
+ PROVIDERS,
9
+ } from "../routes";
4
10
  import Submenu from "./Submenu";
5
11
 
6
12
  export const ITEMS = [
7
13
  { name: "resource_mappings", routes: [RESOURCE_MAPPINGS] },
8
14
  { name: "prompts", routes: [PROMPTS] },
9
15
  { name: "providers", routes: [PROVIDERS] },
16
+ { name: "actions", routes: [ACTIONS] },
10
17
  { name: "ai_sandbox", routes: [AI_SANDBOX] },
11
18
  ];
12
19
 
@@ -25,6 +25,7 @@ export const TemplateSelector = ({
25
25
  required,
26
26
  selectedValue,
27
27
  templates,
28
+ label,
28
29
  placeholder,
29
30
  hideLabel = false,
30
31
  disabled,
@@ -42,7 +43,7 @@ export const TemplateSelector = ({
42
43
  <Form.Field required={required}>
43
44
  {hideLabel ? null : (
44
45
  <label>
45
- <FormattedMessage id="template.selector.label" />
46
+ {label ? label : <FormattedMessage id="template.selector.label" />}
46
47
  {!selectedValue && required ? (
47
48
  <Label pointing="left">
48
49
  <FormattedMessage id="template.form.validation.empty_required" />
@@ -80,6 +81,7 @@ TemplateSelector.propTypes = {
80
81
  required: PropTypes.bool,
81
82
  selectedValue: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
82
83
  templates: PropTypes.array,
84
+ label: PropTypes.string,
83
85
  placeholder: PropTypes.string,
84
86
  hideLabel: PropTypes.bool,
85
87
  disabled: PropTypes.bool,
@@ -40,6 +40,22 @@ describe("<TemplateSelector />", () => {
40
40
  expect(onLoad.mock.calls.length).toBe(1);
41
41
  });
42
42
 
43
+ it("custom label", async () => {
44
+ const renderOpts = { mocks: [multipleTemplatesMock(variables)] };
45
+ const onLoad = jest.fn();
46
+ const newProps = {
47
+ ...props,
48
+ label: "foo_label",
49
+ };
50
+ const { queryByText } = render(
51
+ <TemplateSelector {...newProps} onLoad={onLoad} />,
52
+ renderOpts
53
+ );
54
+ await waitForElementToBeRemoved(() => queryByText(/loading/i));
55
+ expect(queryByText("template1")).toBeInTheDocument();
56
+ expect(queryByText("foo_label")).toBeInTheDocument();
57
+ });
58
+
43
59
  it("matches the latest snapshot when required", async () => {
44
60
  const renderOpts = { mocks: [multipleTemplatesMock(variables)] };
45
61
  const { container, queryByText } = render(
@@ -367,6 +367,12 @@ exports[`<SideMenu /> matches the latest snapshot 1`] = `
367
367
  >
368
368
  providers
369
369
  </a>
370
+ <a
371
+ class="link item"
372
+ href="/actions"
373
+ >
374
+ actions
375
+ </a>
370
376
  <a
371
377
  class="link item"
372
378
  href="/aiSandbox"
package/src/routes.js CHANGED
@@ -1,6 +1,10 @@
1
1
  import _ from "lodash/fp";
2
2
  import { compile } from "path-to-regexp";
3
3
 
4
+ export const ACTIONS = "/actions";
5
+ export const ACTION = "/actions/:id";
6
+ export const ACTION_NEW = "/actions/new";
7
+ export const ACTION_EDIT = "/actions/:id/edit";
4
8
  export const AI_SANDBOX = "/aiSandbox";
5
9
  export const CALLBACK = "/callback";
6
10
  export const BUCKETS_VIEW = "/buckets/:propertyPath";
@@ -256,6 +260,10 @@ export const USER_EDIT = "/users/:id/edit";
256
260
  export const USER_EDIT_PASSWORD = "/users/:id/password";
257
261
 
258
262
  const routes = {
263
+ ACTIONS,
264
+ ACTION,
265
+ ACTION_NEW,
266
+ ACTION_EDIT,
259
267
  AI_SANDBOX,
260
268
  CALLBACK,
261
269
  BUCKETS_VIEW,