@looker/api-explorer 0.9.38 → 0.9.40

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 (35) hide show
  1. package/CHANGELOG.md +36 -1
  2. package/dist/bundle.js +1 -1
  3. package/dist/bundle.js.map +1 -1
  4. package/lib/components/DocMethodSummary/utils.d.ts +1 -1
  5. package/lib/components/DocMethodSummary/utils.js +3 -0
  6. package/lib/components/DocMethodSummary/utils.js.map +1 -1
  7. package/lib/components/SelectorContainer/SdkLanguageSelector.js +3 -0
  8. package/lib/components/SelectorContainer/SdkLanguageSelector.js.map +1 -1
  9. package/lib/esm/components/DocMethodSummary/utils.js +3 -0
  10. package/lib/esm/components/DocMethodSummary/utils.js.map +1 -1
  11. package/lib/esm/components/SelectorContainer/SdkLanguageSelector.js +2 -0
  12. package/lib/esm/components/SelectorContainer/SdkLanguageSelector.js.map +1 -1
  13. package/lib/esm/scenes/MethodScene/MethodScene.js +1 -1
  14. package/lib/esm/scenes/MethodScene/MethodScene.js.map +1 -1
  15. package/lib/esm/scenes/MethodTagScene/MethodTagScene.js +2 -1
  16. package/lib/esm/scenes/MethodTagScene/MethodTagScene.js.map +1 -1
  17. package/lib/esm/scenes/TypeTagScene/TypeTagScene.js +2 -1
  18. package/lib/esm/scenes/TypeTagScene/TypeTagScene.js.map +1 -1
  19. package/lib/scenes/MethodScene/MethodScene.js +1 -1
  20. package/lib/scenes/MethodScene/MethodScene.js.map +1 -1
  21. package/lib/scenes/MethodTagScene/MethodTagScene.js +1 -0
  22. package/lib/scenes/MethodTagScene/MethodTagScene.js.map +1 -1
  23. package/lib/scenes/TypeTagScene/TypeTagScene.js +1 -0
  24. package/lib/scenes/TypeTagScene/TypeTagScene.js.map +1 -1
  25. package/package.json +9 -9
  26. package/src/components/DocMethodSummary/DocSummaryStatus.spec.tsx +1 -1
  27. package/src/components/DocMethodSummary/utils.spec.tsx +1 -0
  28. package/src/components/DocMethodSummary/utils.tsx +2 -0
  29. package/src/components/DocStatus/DocStatus.spec.tsx +1 -1
  30. package/src/components/SelectorContainer/SdkLanguageSelector.tsx +2 -0
  31. package/src/scenes/MethodScene/MethodScene.tsx +1 -1
  32. package/src/scenes/MethodTagScene/MethodTagScene.spec.tsx +10 -7
  33. package/src/scenes/MethodTagScene/MethodTagScene.tsx +2 -1
  34. package/src/scenes/TypeTagScene/TypeTagScene.spec.tsx +14 -8
  35. package/src/scenes/TypeTagScene/TypeTagScene.tsx +2 -1
@@ -33,7 +33,7 @@ import { DocSummaryStatus } from './DocSummaryStatus'
33
33
  describe('DocMethodSummaryStatus', () => {
34
34
  test.each`
35
35
  status | method | expectedLabel | expectedContent
36
- ${'beta'} | ${api40.methods.workspace} | ${'beta item'} | ${'This beta item is under development and subject to change.'}
36
+ ${'beta'} | ${api40.methods.invalidate_tokens} | ${'beta item'} | ${'This beta item is under development and subject to change.'}
37
37
  ${'stable'} | ${api.methods.login} | ${'stable item'} | ${'This item is considered stable for this API version.'}
38
38
  ${'deprecated'} | ${api.methods.backup_configuration} | ${'deprecated item'} | ${'This item has been deprecated and will be removed in the future.'}
39
39
  `(
@@ -28,6 +28,7 @@ import { pickTooltipContent } from './utils'
28
28
  describe('DocMethodSummary utils', () => {
29
29
  test.each`
30
30
  status | expected
31
+ ${'alpha'} | ${'This alpha item is either for internal use, or not fully developed and may be significantly changed or completely removed in future releases.'}
31
32
  ${'beta'} | ${'This beta item is under development and subject to change.'}
32
33
  ${'experimental'} | ${'This experimental item is not fully developed and may be significantly changed or completely removed in future releases.'}
33
34
  ${'deprecated'} | ${'This item has been deprecated and will be removed in the future.'}
@@ -68,6 +68,8 @@ export const pickStatus = (status: string) => {
68
68
  */
69
69
  export const pickTooltipContent = (status: string) => {
70
70
  switch (status.toLowerCase()) {
71
+ case 'alpha':
72
+ return 'This alpha item is either for internal use, or not fully developed and may be significantly changed or completely removed in future releases.'
71
73
  case 'beta':
72
74
  return 'This beta item is under development and subject to change.'
73
75
  case 'experimental':
@@ -32,7 +32,7 @@ import { DocStatus } from './DocStatus'
32
32
 
33
33
  describe('DocStatus', () => {
34
34
  test('it renders a badge with the status and a tooltip on hover', async () => {
35
- renderWithTheme(<DocStatus method={api40.methods.create_dashboard} />)
35
+ renderWithTheme(<DocStatus method={api40.methods.invalidate_tokens} />)
36
36
  const badge = screen.getByText('BETA')
37
37
  fireEvent.mouseOver(badge)
38
38
  await waitFor(() => {
@@ -27,6 +27,7 @@ import type { FC } from 'react'
27
27
  import React, { useEffect, useState } from 'react'
28
28
  import { Select } from '@looker/components'
29
29
  import { useSelector } from 'react-redux'
30
+ import { useLocation } from 'react-router-dom'
30
31
  import { selectSdkLanguage } from '../../state'
31
32
  import { allAlias, useNavigation } from '../../utils'
32
33
  import { allSdkLanguageOptions } from './utils'
@@ -35,6 +36,7 @@ import { allSdkLanguageOptions } from './utils'
35
36
  * Allows the user to select their preferred SDK language
36
37
  */
37
38
  export const SdkLanguageSelector: FC = () => {
39
+ const location = useLocation()
38
40
  const { navigate } = useNavigation()
39
41
  const selectedSdkLanguage = useSelector(selectSdkLanguage)
40
42
  const [language, setLanguage] = useState(selectedSdkLanguage)
@@ -119,7 +119,7 @@ export const MethodScene: FC<MethodSceneProps> = ({ api }) => {
119
119
  }, [adaptor, setOn])
120
120
 
121
121
  useEffect(() => {
122
- if (method.responses && errorCode) {
122
+ if (method?.responses && errorCode) {
123
123
  if (docResponsesRef.current) {
124
124
  window.setTimeout(() => {
125
125
  docResponsesRef.current!.scrollIntoView()
@@ -41,7 +41,9 @@ jest.mock('react-router-dom', () => {
41
41
  ...ReactRouterDOM,
42
42
  useHistory: () => ({
43
43
  push: mockHistoryPush,
44
- location,
44
+ location: {
45
+ pathname: '/4.0/methods/Look',
46
+ },
45
47
  }),
46
48
  }
47
49
  })
@@ -54,7 +56,7 @@ describe('MethodTagScene', () => {
54
56
  <Route path="/:specKey/methods/:methodTag">
55
57
  <MethodTagScene api={api} />
56
58
  </Route>,
57
- ['/3.1/methods/ColorCollection']
59
+ ['/4.0/methods/ColorCollection']
58
60
  )
59
61
  expect(
60
62
  screen.getAllByRole('button', {
@@ -68,7 +70,7 @@ describe('MethodTagScene', () => {
68
70
  screen.getByText('/color_collections/standard').closest('a')
69
71
  ).toHaveAttribute(
70
72
  'href',
71
- '/3.1/methods/ColorCollection/color_collections_standard'
73
+ '/4.0/methods/ColorCollection/color_collections_standard'
72
74
  )
73
75
  })
74
76
 
@@ -78,7 +80,7 @@ describe('MethodTagScene', () => {
78
80
  <Route path="/:specKey/methods/:methodTag">
79
81
  <MethodTagScene api={api} />
80
82
  </Route>,
81
- ['/3.1/methods/ApiAuth']
83
+ ['/4.0/methods/ApiAuth']
82
84
  )
83
85
  expect(
84
86
  screen.getAllByRole('button', {
@@ -88,17 +90,18 @@ describe('MethodTagScene', () => {
88
90
  })
89
91
 
90
92
  test('it pushes filter to URL on toggle', async () => {
93
+ const site = '/4.0/methods/Look'
91
94
  renderWithRouterAndReduxProvider(
92
95
  <Route path="/:specKey/methods/:methodTag">
93
96
  <MethodTagScene api={api} />
94
97
  </Route>,
95
- ['/3.1/methods/Look']
98
+ [site]
96
99
  )
97
100
  /** Filter by GET operation */
98
101
  userEvent.click(screen.getByRole('button', { name: 'GET' }))
99
102
  await waitFor(() => {
100
103
  expect(mockHistoryPush).toHaveBeenCalledWith({
101
- pathname: location.pathname,
104
+ pathname: site,
102
105
  search: 't=get',
103
106
  })
104
107
  })
@@ -107,7 +110,7 @@ describe('MethodTagScene', () => {
107
110
  await waitFor(() => {
108
111
  // eslint-disable-next-line jest-dom/prefer-in-document
109
112
  expect(mockHistoryPush).toHaveBeenCalledWith({
110
- pathname: location.pathname,
113
+ pathname: site,
111
114
  search: 't=delete',
112
115
  })
113
116
  })
@@ -25,7 +25,7 @@
25
25
  */
26
26
  import type { FC } from 'react'
27
27
  import React, { useEffect, useState } from 'react'
28
- import { useHistory, useParams } from 'react-router-dom'
28
+ import { useHistory, useLocation, useParams } from 'react-router-dom'
29
29
  import { Grid, ButtonToggle, ButtonItem } from '@looker/components'
30
30
  import type { ApiModel } from '@looker/sdk-codegen'
31
31
  import { useSelector } from 'react-redux'
@@ -46,6 +46,7 @@ interface MethodTagSceneParams {
46
46
 
47
47
  export const MethodTagScene: FC<MethodTagSceneProps> = ({ api }) => {
48
48
  const { specKey, methodTag } = useParams<MethodTagSceneParams>()
49
+ const location = useLocation()
49
50
  const history = useHistory()
50
51
  const methods = api.tags[methodTag]
51
52
  const { navigate, buildPathWithGlobalParams, navigateWithGlobalParams } =
@@ -35,28 +35,33 @@ import { TypeTagScene } from './TypeTagScene'
35
35
  const opBtnNames = /ALL|SPECIFICATION|WRITE|REQUEST|ENUMERATED/
36
36
 
37
37
  const path = '/:specKey/types/:typeTag'
38
-
39
38
  const mockHistoryPush = jest.fn()
40
39
  jest.mock('react-router-dom', () => {
41
40
  const ReactRouterDOM = jest.requireActual('react-router-dom')
42
41
  return {
43
42
  ...ReactRouterDOM,
43
+ useLocation: () => ({
44
+ pathname: '/4.0/types/Look',
45
+ }),
44
46
  useHistory: () => ({
45
47
  push: mockHistoryPush,
46
- location,
48
+ location: {
49
+ pathname: '/4.0/types/Look',
50
+ },
47
51
  }),
48
52
  }
49
53
  })
50
54
 
51
55
  describe('TypeTagScene', () => {
52
56
  Element.prototype.scrollTo = jest.fn()
57
+ // const mockHistoryPush: jest.Mock = useHistory as jest.Mock
53
58
 
54
59
  test('it renders type buttons and all methods for a given type tag', () => {
55
60
  renderWithRouterAndReduxProvider(
56
61
  <Route path={path}>
57
62
  <TypeTagScene api={api} />
58
63
  </Route>,
59
- ['/3.1/types/Dashboard']
64
+ ['/4.0/types/Dashboard']
60
65
  )
61
66
  expect(
62
67
  screen.getAllByRole('button', {
@@ -68,7 +73,7 @@ describe('TypeTagScene', () => {
68
73
  )
69
74
  expect(screen.getByText('DashboardBase').closest('a')).toHaveAttribute(
70
75
  'href',
71
- '/3.1/types/Dashboard/DashboardBase'
76
+ '/4.0/types/Dashboard/DashboardBase'
72
77
  )
73
78
  })
74
79
 
@@ -77,7 +82,7 @@ describe('TypeTagScene', () => {
77
82
  <Route path={path}>
78
83
  <TypeTagScene api={api} />
79
84
  </Route>,
80
- ['/3.1/types/DataAction']
85
+ ['/4.0/types/DataAction']
81
86
  )
82
87
  expect(
83
88
  screen.getAllByRole('button', {
@@ -87,17 +92,18 @@ describe('TypeTagScene', () => {
87
92
  })
88
93
 
89
94
  test('it pushes filter to URL on toggle', async () => {
95
+ const site = '/4.0/types/Look'
90
96
  renderWithRouterAndReduxProvider(
91
97
  <Route path={path}>
92
98
  <TypeTagScene api={api} />
93
99
  </Route>,
94
- ['/3.1/types/Look']
100
+ [site]
95
101
  )
96
102
  /** Filter by SPECIFICATION */
97
103
  userEvent.click(screen.getByRole('button', { name: 'SPECIFICATION' }))
98
104
  await waitFor(() => {
99
105
  expect(mockHistoryPush).toHaveBeenCalledWith({
100
- pathname: location.pathname,
106
+ pathname: site,
101
107
  search: 't=specification',
102
108
  })
103
109
  })
@@ -105,7 +111,7 @@ describe('TypeTagScene', () => {
105
111
  userEvent.click(screen.getByRole('button', { name: 'REQUEST' }))
106
112
  await waitFor(() => {
107
113
  expect(mockHistoryPush).toHaveBeenCalledWith({
108
- pathname: location.pathname,
114
+ pathname: site,
109
115
  search: 't=request',
110
116
  })
111
117
  })
@@ -27,7 +27,7 @@ import type { FC } from 'react'
27
27
  import React, { useEffect, useState } from 'react'
28
28
  import { Grid, ButtonToggle, ButtonItem } from '@looker/components'
29
29
  import type { ApiModel } from '@looker/sdk-codegen'
30
- import { useParams } from 'react-router-dom'
30
+ import { useLocation, useParams } from 'react-router-dom'
31
31
  import { useSelector } from 'react-redux'
32
32
  import { ApixSection, DocTitle, DocTypeSummary, Link } from '../../components'
33
33
  import { buildTypePath, isValidFilter, useNavigation } from '../../utils'
@@ -46,6 +46,7 @@ interface TypeTagSceneParams {
46
46
 
47
47
  export const TypeTagScene: FC<TypeTagSceneProps> = ({ api }) => {
48
48
  const { specKey, typeTag } = useParams<TypeTagSceneParams>()
49
+ const location = useLocation()
49
50
  const { navigate, buildPathWithGlobalParams, navigateWithGlobalParams } =
50
51
  useNavigation()
51
52
  const selectedTagFilter = useSelector(selectTagFilter)