datajunction-ui 0.0.1-a44.dev5 → 0.0.1-a45

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": "datajunction-ui",
3
- "version": "0.0.1-a44.dev5",
3
+ "version": "0.0.1a45",
4
4
  "description": "DataJunction Metrics Platform UI",
5
5
  "module": "src/index.tsx",
6
6
  "repository": {
@@ -68,6 +68,9 @@ export const NodeQueryField = ({ djClient, value }) => {
68
68
  }),
69
69
  ]}
70
70
  value={value}
71
+ placeholder={
72
+ 'SELECT\n\tprimary_key,\n\tmeasure1,\n\tmeasure2,\n\tforeign_key_for_dimension1,\n\tforeign_key_for_dimension2\nFROM source.source_node\nWHERE ...'
73
+ }
71
74
  options={{
72
75
  theme: 'default',
73
76
  lineNumbers: true,
@@ -33,7 +33,7 @@ describe('<AddMaterializationPopover />', () => {
33
33
  job_class: 'SparkSqlMaterializationJob',
34
34
  },
35
35
  {
36
- name: 'druid_cube',
36
+ name: 'druid_metrics_cube',
37
37
  label: 'Druid Cube',
38
38
  description:
39
39
  'Used to materialize a cube to Druid for low-latency access to a set of metrics and dimensions. While the logical cube definition is at the level of metrics and dimensions, a materialized Druid cube will reference measures and dimensions, with rollup configured on the measures where appropriate.',
@@ -613,6 +613,51 @@ export const DataJunctionAPI = {
613
613
  );
614
614
  return { status: response.status, json: await response.json() };
615
615
  },
616
+
617
+ addComplexDimensionLink: async function (
618
+ nodeName,
619
+ dimensionNode,
620
+ joinOn,
621
+ joinType = null,
622
+ joinCardinality = null,
623
+ role = null,
624
+ ) {
625
+ const response = await fetch(`${DJ_URL}/nodes/${nodeName}/link`, {
626
+ method: 'POST',
627
+ headers: {
628
+ 'Content-Type': 'application/json',
629
+ },
630
+ body: JSON.stringify({
631
+ dimensionNode: dimensionNode,
632
+ joinType: joinType,
633
+ joinOn: joinOn,
634
+ joinCardinality: joinCardinality,
635
+ role: role,
636
+ }),
637
+ credentials: 'include',
638
+ });
639
+ return { status: response.status, json: await response.json() };
640
+ },
641
+
642
+ removeComplexDimensionLink: async function (
643
+ nodeName,
644
+ dimensionNode,
645
+ role = null,
646
+ ) {
647
+ const response = await fetch(`${DJ_URL}/nodes/${nodeName}/link`, {
648
+ method: 'DELETE',
649
+ headers: {
650
+ 'Content-Type': 'application/json',
651
+ },
652
+ body: JSON.stringify({
653
+ dimensionNode: dimensionNode,
654
+ role: role,
655
+ }),
656
+ credentials: 'include',
657
+ });
658
+ return { status: response.status, json: await response.json() };
659
+ },
660
+
616
661
  deactivate: async function (nodeName) {
617
662
  const response = await fetch(`${DJ_URL}/nodes/${nodeName}`, {
618
663
  method: 'DELETE',
@@ -656,6 +656,46 @@ describe('DataJunctionAPI', () => {
656
656
  );
657
657
  });
658
658
 
659
+ it('calls add and remove complex dimension link correctly', async () => {
660
+ const nodeName = 'default.transform1';
661
+ const dimensionNode = 'default.dimension1';
662
+ const joinOn = 'blah';
663
+ fetch.mockResponseOnce(JSON.stringify({}));
664
+ await DataJunctionAPI.removeComplexDimensionLink(nodeName, dimensionNode);
665
+ expect(fetch).toHaveBeenCalledWith(`${DJ_URL}/nodes/${nodeName}/link`, {
666
+ credentials: 'include',
667
+ headers: {
668
+ 'Content-Type': 'application/json',
669
+ },
670
+ body: JSON.stringify({
671
+ dimensionNode: dimensionNode,
672
+ role: null,
673
+ }),
674
+ method: 'DELETE',
675
+ });
676
+
677
+ fetch.mockResponseOnce(JSON.stringify({}));
678
+ await DataJunctionAPI.addComplexDimensionLink(
679
+ nodeName,
680
+ dimensionNode,
681
+ joinOn,
682
+ );
683
+ expect(fetch).toHaveBeenCalledWith(`${DJ_URL}/nodes/${nodeName}/link`, {
684
+ credentials: 'include',
685
+ headers: {
686
+ 'Content-Type': 'application/json',
687
+ },
688
+ body: JSON.stringify({
689
+ dimensionNode: dimensionNode,
690
+ joinType: null,
691
+ joinOn: joinOn,
692
+ joinCardinality: null,
693
+ role: null,
694
+ }),
695
+ method: 'POST',
696
+ });
697
+ });
698
+
659
699
  it('calls deactivate correctly', async () => {
660
700
  const nodeName = 'default.transform1';
661
701
  fetch.mockResponseOnce(JSON.stringify({}));