@looker/api-explorer 0.9.36 → 0.9.38
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/CHANGELOG.md +49 -1
- package/dist/bundle.js +1 -1
- package/dist/bundle.js.map +1 -1
- package/e2e/MethodScene.spec.ts +80 -0
- package/e2e/diffScene.spec.ts +28 -20
- package/e2e/e2e.spec.ts +45 -7
- package/lib/ApiExplorer.js +17 -6
- package/lib/ApiExplorer.js.map +1 -1
- package/lib/components/DocMarkdown/DocMarkdown.js +3 -1
- package/lib/components/DocMarkdown/DocMarkdown.js.map +1 -1
- package/lib/components/DocSDKs/DocDeclarations.js +10 -15
- package/lib/components/DocSDKs/DocDeclarations.js.map +1 -1
- package/lib/components/SelectorContainer/ApiSpecSelector.js +3 -1
- package/lib/components/SelectorContainer/ApiSpecSelector.js.map +1 -1
- package/lib/components/SelectorContainer/SdkLanguageSelector.js +20 -21
- package/lib/components/SelectorContainer/SdkLanguageSelector.js.map +1 -1
- package/lib/components/SelectorContainer/SelectorContainer.js +4 -1
- package/lib/components/SelectorContainer/SelectorContainer.js.map +1 -1
- package/lib/components/SelectorContainer/utils.d.ts +2 -0
- package/lib/components/SelectorContainer/utils.js +32 -0
- package/lib/components/SelectorContainer/utils.js.map +1 -0
- package/lib/components/SideNav/SideNav.js +20 -9
- package/lib/components/SideNav/SideNav.js.map +1 -1
- package/lib/components/SideNav/SideNavMethods.js +7 -6
- package/lib/components/SideNav/SideNavMethods.js.map +1 -1
- package/lib/components/SideNav/SideNavTypes.js +5 -4
- package/lib/components/SideNav/SideNavTypes.js.map +1 -1
- package/lib/components/index.d.ts +0 -1
- package/lib/components/index.js +0 -8
- package/lib/components/index.js.map +1 -1
- package/lib/esm/ApiExplorer.js +19 -8
- package/lib/esm/ApiExplorer.js.map +1 -1
- package/lib/esm/components/DocMarkdown/DocMarkdown.js +3 -1
- package/lib/esm/components/DocMarkdown/DocMarkdown.js.map +1 -1
- package/lib/esm/components/DocSDKs/DocDeclarations.js +9 -14
- package/lib/esm/components/DocSDKs/DocDeclarations.js.map +1 -1
- package/lib/esm/components/SelectorContainer/ApiSpecSelector.js +3 -1
- package/lib/esm/components/SelectorContainer/ApiSpecSelector.js.map +1 -1
- package/lib/esm/components/SelectorContainer/SdkLanguageSelector.js +16 -18
- package/lib/esm/components/SelectorContainer/SdkLanguageSelector.js.map +1 -1
- package/lib/esm/components/SelectorContainer/SelectorContainer.js +5 -2
- package/lib/esm/components/SelectorContainer/SelectorContainer.js.map +1 -1
- package/lib/esm/components/SelectorContainer/utils.js +22 -0
- package/lib/esm/components/SelectorContainer/utils.js.map +1 -0
- package/lib/esm/components/SideNav/SideNav.js +20 -10
- package/lib/esm/components/SideNav/SideNav.js.map +1 -1
- package/lib/esm/components/SideNav/SideNavMethods.js +8 -7
- package/lib/esm/components/SideNav/SideNavMethods.js.map +1 -1
- package/lib/esm/components/SideNav/SideNavTypes.js +6 -5
- package/lib/esm/components/SideNav/SideNavTypes.js.map +1 -1
- package/lib/esm/components/index.js +0 -1
- package/lib/esm/components/index.js.map +1 -1
- package/lib/esm/routes/AppRouter.js +6 -4
- package/lib/esm/routes/AppRouter.js.map +1 -1
- package/lib/esm/scenes/DiffScene/DiffScene.js +9 -7
- package/lib/esm/scenes/DiffScene/DiffScene.js.map +1 -1
- package/lib/esm/scenes/DiffScene/DocDiff/DiffItem.js +3 -1
- package/lib/esm/scenes/DiffScene/DocDiff/DiffItem.js.map +1 -1
- package/lib/esm/scenes/DiffScene/DocDiff/DocDiff.js +4 -4
- package/lib/esm/scenes/DiffScene/DocDiff/DocDiff.js.map +1 -1
- package/lib/esm/scenes/ErrorDetailScene/ErrorDetailScene.js +31 -0
- package/lib/esm/scenes/ErrorDetailScene/ErrorDetailScene.js.map +1 -0
- package/lib/esm/scenes/ErrorDetailScene/index.js +2 -0
- package/lib/esm/scenes/ErrorDetailScene/index.js.map +1 -0
- package/lib/esm/scenes/MethodScene/MethodScene.js +28 -9
- package/lib/esm/scenes/MethodScene/MethodScene.js.map +1 -1
- package/lib/esm/{components → scenes/MethodScene/components}/DocResponses/DocResponseTypes.js +1 -1
- package/lib/esm/scenes/MethodScene/components/DocResponses/DocResponseTypes.js.map +1 -0
- package/lib/esm/scenes/MethodScene/components/DocResponses/DocResponses.js +73 -0
- package/lib/esm/scenes/MethodScene/components/DocResponses/DocResponses.js.map +1 -0
- package/lib/esm/{components → scenes/MethodScene/components}/DocResponses/index.js +0 -0
- package/lib/esm/scenes/MethodScene/components/DocResponses/index.js.map +1 -0
- package/lib/esm/{components → scenes/MethodScene/components}/DocResponses/utils.js +0 -0
- package/lib/esm/scenes/MethodScene/components/DocResponses/utils.js.map +1 -0
- package/lib/esm/scenes/MethodScene/components/index.js +1 -0
- package/lib/esm/scenes/MethodScene/components/index.js.map +1 -1
- package/lib/esm/scenes/MethodTagScene/MethodTagScene.js +38 -11
- package/lib/esm/scenes/MethodTagScene/MethodTagScene.js.map +1 -1
- package/lib/esm/scenes/TypeScene/TypeScene.js +3 -1
- package/lib/esm/scenes/TypeScene/TypeScene.js.map +1 -1
- package/lib/esm/scenes/TypeTagScene/TypeTagScene.js +37 -10
- package/lib/esm/scenes/TypeTagScene/TypeTagScene.js.map +1 -1
- package/lib/esm/scenes/index.js +1 -0
- package/lib/esm/scenes/index.js.map +1 -1
- package/lib/esm/scenes/utils/hooks/index.js +2 -0
- package/lib/esm/scenes/utils/hooks/index.js.map +1 -0
- package/lib/esm/scenes/utils/hooks/tagStoreSync.js +37 -0
- package/lib/esm/scenes/utils/hooks/tagStoreSync.js.map +1 -0
- package/lib/esm/scenes/utils/index.js +2 -0
- package/lib/esm/scenes/utils/index.js.map +1 -0
- package/lib/esm/state/settings/selectors.js +1 -0
- package/lib/esm/state/settings/selectors.js.map +1 -1
- package/lib/esm/state/settings/slice.js +6 -1
- package/lib/esm/state/settings/slice.js.map +1 -1
- package/lib/esm/utils/hooks/globalStoreSync.js +53 -0
- package/lib/esm/utils/hooks/globalStoreSync.js.map +1 -0
- package/lib/esm/utils/hooks/index.js +4 -0
- package/lib/esm/utils/hooks/index.js.map +1 -0
- package/lib/esm/utils/hooks/navigation.js +72 -0
- package/lib/esm/utils/hooks/navigation.js.map +1 -0
- package/lib/esm/utils/hooks/useQuery.js +9 -0
- package/lib/esm/utils/hooks/useQuery.js.map +1 -0
- package/lib/esm/utils/index.js +2 -1
- package/lib/esm/utils/index.js.map +1 -1
- package/lib/esm/utils/path.js +21 -0
- package/lib/esm/utils/path.js.map +1 -1
- package/lib/esm/utils/sdkLanguage.js +42 -0
- package/lib/esm/utils/sdkLanguage.js.map +1 -0
- package/lib/routes/AppRouter.d.ts +1 -2
- package/lib/routes/AppRouter.js +5 -3
- package/lib/routes/AppRouter.js.map +1 -1
- package/lib/scenes/DiffScene/DiffScene.d.ts +0 -2
- package/lib/scenes/DiffScene/DiffScene.js +8 -6
- package/lib/scenes/DiffScene/DiffScene.js.map +1 -1
- package/lib/scenes/DiffScene/DocDiff/DiffItem.js +3 -1
- package/lib/scenes/DiffScene/DocDiff/DiffItem.js.map +1 -1
- package/lib/scenes/DiffScene/DocDiff/DocDiff.js +4 -4
- package/lib/scenes/DiffScene/DocDiff/DocDiff.js.map +1 -1
- package/lib/scenes/ErrorDetailScene/ErrorDetailScene.d.ts +7 -0
- package/lib/scenes/ErrorDetailScene/ErrorDetailScene.js +47 -0
- package/lib/scenes/ErrorDetailScene/ErrorDetailScene.js.map +1 -0
- package/lib/scenes/ErrorDetailScene/index.d.ts +1 -0
- package/lib/scenes/ErrorDetailScene/index.js +14 -0
- package/lib/{components/DocResponses → scenes/ErrorDetailScene}/index.js.map +1 -1
- package/lib/scenes/MethodScene/MethodScene.js +23 -4
- package/lib/scenes/MethodScene/MethodScene.js.map +1 -1
- package/lib/{components → scenes/MethodScene/components}/DocResponses/DocResponseTypes.d.ts +2 -2
- package/lib/{components → scenes/MethodScene/components}/DocResponses/DocResponseTypes.js +2 -2
- package/lib/scenes/MethodScene/components/DocResponses/DocResponseTypes.js.map +1 -0
- package/lib/scenes/MethodScene/components/DocResponses/DocResponses.d.ts +9 -0
- package/lib/scenes/MethodScene/components/DocResponses/DocResponses.js +93 -0
- package/lib/scenes/MethodScene/components/DocResponses/DocResponses.js.map +1 -0
- package/lib/{components → scenes/MethodScene/components}/DocResponses/index.d.ts +0 -0
- package/lib/{components → scenes/MethodScene/components}/DocResponses/index.js +0 -0
- package/lib/scenes/MethodScene/components/DocResponses/index.js.map +1 -0
- package/lib/{components → scenes/MethodScene/components}/DocResponses/utils.d.ts +0 -0
- package/lib/{components → scenes/MethodScene/components}/DocResponses/utils.js +0 -0
- package/lib/scenes/MethodScene/components/DocResponses/utils.js.map +1 -0
- package/lib/scenes/MethodScene/components/index.d.ts +1 -0
- package/lib/scenes/MethodScene/components/index.js +8 -0
- package/lib/scenes/MethodScene/components/index.js.map +1 -1
- package/lib/scenes/MethodTagScene/MethodTagScene.js +42 -12
- package/lib/scenes/MethodTagScene/MethodTagScene.js.map +1 -1
- package/lib/scenes/TypeScene/TypeScene.js +3 -1
- package/lib/scenes/TypeScene/TypeScene.js.map +1 -1
- package/lib/scenes/TypeTagScene/TypeTagScene.js +41 -11
- package/lib/scenes/TypeTagScene/TypeTagScene.js.map +1 -1
- package/lib/scenes/index.d.ts +1 -0
- package/lib/scenes/index.js +8 -0
- package/lib/scenes/index.js.map +1 -1
- package/lib/scenes/utils/hooks/index.d.ts +1 -0
- package/lib/scenes/utils/hooks/index.js +14 -0
- package/lib/scenes/utils/hooks/index.js.map +1 -0
- package/lib/scenes/utils/hooks/tagStoreSync.d.ts +1 -0
- package/lib/scenes/utils/hooks/tagStoreSync.js +51 -0
- package/lib/scenes/utils/hooks/tagStoreSync.js.map +1 -0
- package/lib/scenes/utils/index.d.ts +1 -0
- package/lib/scenes/utils/index.js +14 -0
- package/lib/scenes/utils/index.js.map +1 -0
- package/lib/state/settings/selectors.d.ts +2 -1
- package/lib/state/settings/selectors.js +5 -1
- package/lib/state/settings/selectors.js.map +1 -1
- package/lib/state/settings/slice.d.ts +7 -1
- package/lib/state/settings/slice.js +6 -1
- package/lib/state/settings/slice.js.map +1 -1
- package/lib/test-data/index.d.ts +1 -0
- package/lib/test-data/index.js +14 -0
- package/lib/test-data/index.js.map +1 -1
- package/lib/test-data/sdkLanguages.d.ts +10 -0
- package/lib/test-data/sdkLanguages.js +19 -0
- package/lib/test-data/sdkLanguages.js.map +1 -0
- package/lib/utils/hooks/globalStoreSync.d.ts +1 -0
- package/lib/utils/hooks/globalStoreSync.js +67 -0
- package/lib/utils/hooks/globalStoreSync.js.map +1 -0
- package/lib/utils/hooks/index.d.ts +3 -0
- package/lib/utils/hooks/index.js +30 -0
- package/lib/utils/hooks/index.js.map +1 -0
- package/lib/utils/hooks/navigation.d.ts +11 -0
- package/lib/utils/hooks/navigation.js +83 -0
- package/lib/utils/hooks/navigation.js.map +1 -0
- package/lib/utils/hooks/useQuery.d.ts +1 -0
- package/lib/utils/hooks/useQuery.js +20 -0
- package/lib/utils/hooks/useQuery.js.map +1 -0
- package/lib/utils/index.d.ts +2 -1
- package/lib/utils/index.js +29 -1
- package/lib/utils/index.js.map +1 -1
- package/lib/utils/path.d.ts +4 -0
- package/lib/utils/path.js +32 -1
- package/lib/utils/path.js.map +1 -1
- package/lib/utils/sdkLanguage.d.ts +6 -0
- package/lib/utils/sdkLanguage.js +59 -0
- package/lib/utils/sdkLanguage.js.map +1 -0
- package/package.json +14 -14
- package/src/ApiExplorer.tsx +13 -8
- package/src/components/DocMarkdown/DocMarkdown.tsx +1 -1
- package/src/components/DocSDKs/DocDeclarations.tsx +11 -22
- package/src/components/DocSDKs/DocSDKs.spec.tsx +4 -1
- package/src/components/Header/Header.spec.tsx +1 -1
- package/src/components/SelectorContainer/ApiSpecSelector.tsx +1 -1
- package/src/components/SelectorContainer/SdkLanguageSelector.spec.tsx +60 -33
- package/src/components/SelectorContainer/SdkLanguageSelector.tsx +15 -22
- package/src/components/SelectorContainer/SelectorContainer.spec.tsx +1 -1
- package/src/components/SelectorContainer/SelectorContainer.tsx +18 -15
- package/src/{utils/hooks.ts → components/SelectorContainer/utils.ts} +13 -21
- package/src/components/SideNav/SideNav.tsx +26 -14
- package/src/components/SideNav/SideNavMethods.spec.tsx +6 -8
- package/src/components/SideNav/SideNavMethods.tsx +8 -12
- package/src/components/SideNav/SideNavTypes.tsx +5 -10
- package/src/components/index.ts +0 -1
- package/src/routes/AppRouter.tsx +7 -5
- package/src/scenes/DiffScene/DiffScene.tsx +8 -8
- package/src/scenes/DiffScene/DocDiff/DiffItem.tsx +1 -1
- package/src/scenes/DiffScene/DocDiff/DocDiff.spec.tsx +73 -2
- package/src/scenes/DiffScene/DocDiff/DocDiff.tsx +4 -4
- package/src/scenes/ErrorDetailScene/ErrorDetailScene.tsx +72 -0
- package/src/scenes/ErrorDetailScene/index.ts +26 -0
- package/src/scenes/MethodScene/MethodScene.tsx +21 -7
- package/src/{components → scenes/MethodScene/components}/DocResponses/DocResponseTypes.tsx +3 -6
- package/src/scenes/MethodScene/components/DocResponses/DocResponses.spec.tsx +153 -0
- package/src/scenes/MethodScene/components/DocResponses/DocResponses.tsx +103 -0
- package/src/{components → scenes/MethodScene/components}/DocResponses/index.ts +0 -0
- package/src/{components → scenes/MethodScene/components}/DocResponses/utils.spec.ts +1 -1
- package/src/{components → scenes/MethodScene/components}/DocResponses/utils.ts +0 -0
- package/src/scenes/MethodScene/components/index.ts +1 -0
- package/src/scenes/MethodTagScene/MethodTagScene.spec.tsx +25 -14
- package/src/scenes/MethodTagScene/MethodTagScene.tsx +42 -11
- package/src/scenes/TypeScene/TypeScene.tsx +1 -1
- package/src/scenes/TypeTagScene/TypeTagScene.spec.tsx +21 -11
- package/src/scenes/TypeTagScene/TypeTagScene.tsx +44 -11
- package/src/scenes/index.ts +1 -0
- package/src/scenes/utils/hooks/index.ts +27 -0
- package/src/scenes/utils/hooks/tagStoreSync.spec.ts +102 -0
- package/src/scenes/utils/hooks/tagStoreSync.ts +68 -0
- package/src/scenes/utils/index.ts +27 -0
- package/src/state/settings/selectors.spec.ts +5 -1
- package/src/state/settings/selectors.ts +3 -0
- package/src/state/settings/slice.ts +6 -0
- package/src/test-data/index.ts +1 -0
- package/src/test-data/sdkLanguages.ts +36 -0
- package/src/utils/hooks/globalStoreSync.spec.tsx +146 -0
- package/src/utils/hooks/globalStoreSync.ts +77 -0
- package/src/utils/hooks/index.ts +28 -0
- package/src/utils/hooks/navigation.spec.ts +118 -0
- package/src/utils/hooks/navigation.ts +121 -0
- package/src/utils/hooks/useQuery.ts +36 -0
- package/src/utils/index.ts +2 -1
- package/src/utils/path.spec.ts +67 -1
- package/src/utils/path.ts +35 -0
- package/src/utils/sdkLanguage.spec.ts +69 -0
- package/src/utils/sdkLanguage.ts +63 -0
- package/lib/components/DocResponses/DocResponseTypes.js.map +0 -1
- package/lib/components/DocResponses/DocResponses.d.ts +0 -8
- package/lib/components/DocResponses/DocResponses.js +0 -46
- package/lib/components/DocResponses/DocResponses.js.map +0 -1
- package/lib/components/DocResponses/utils.js.map +0 -1
- package/lib/esm/components/DocResponses/DocResponseTypes.js.map +0 -1
- package/lib/esm/components/DocResponses/DocResponses.js +0 -30
- package/lib/esm/components/DocResponses/DocResponses.js.map +0 -1
- package/lib/esm/components/DocResponses/index.js.map +0 -1
- package/lib/esm/components/DocResponses/utils.js.map +0 -1
- package/lib/esm/utils/hooks.js +0 -26
- package/lib/esm/utils/hooks.js.map +0 -1
- package/lib/utils/hooks.d.ts +0 -3
- package/lib/utils/hooks.js +0 -36
- package/lib/utils/hooks.js.map +0 -1
- package/src/components/DocResponses/DocResponses.spec.tsx +0 -60
- package/src/components/DocResponses/DocResponses.tsx +0 -69
- package/src/utils/hooks.spec.ts +0 -78
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/scenes/MethodScene/MethodScene.tsx"],"names":["React","useState","useEffect","Aside","Button","ButtonOutline","Space","useToggle","ExtendComponentsThemeProvider","Beaker","useHistory","useParams","RunIt","RunItFormKey","typeRefs","useSelector","getApixAdaptor","useNavigation","ApixSection","DocActivityType","DocMarkdown","DocRateLimited","DocReferences","DocResponses","DocSDKs","DocSdkUsage","DocSource","DocStatus","DocTitle","DocSchema","selectSdkLanguage","DocOperation","DocRequestBody","showRunIt","adaptor","data","localStorageGetItem","MethodScene","api","history","navigate","sdkLanguage","specKey","methodTag","methodName","value","toggle","setOn","method","setMethod","methods","seeTypes","customTypes","RunItButton","foundMethod","tags","checkRunIt","show","error","console","runItToggle","summary","description","responses","schema","colors","background","key","text","link","critical","operationId"],"mappings":";;;;AA2BA,OAAOA,KAAP,IAAgBC,QAAhB,EAA0BC,SAA1B,QAA2C,OAA3C;AACA,SACEC,KADF,EAEEC,MAFF,EAGEC,aAHF,EAIEC,KAJF,EAKEC,SALF,EAMEC,6BANF,QAOO,oBAPP;AAQA,SAASC,MAAT,QAAuB,eAAvB;AACA,SAASC,UAAT,EAAqBC,SAArB,QAAsC,kBAAtC;AACA,SAASC,KAAT,EAAgBC,YAAhB,QAAoC,gBAApC;AAEA,SAASC,QAAT,QAAyB,qBAAzB;AACA,SAASC,WAAT,QAA4B,aAA5B;AAGA,SAASC,cAAT,EAAyBC,aAAzB,QAA8C,aAA9C;AACA,SACEC,WADF,EAEEC,eAFF,EAGEC,WAHF,EAIEC,cAJF,EAKEC,aALF,EAMEC,YANF,EAOEC,OAPF,EAQEC,WARF,EASEC,SATF,EAUEC,SAVF,EAWEC,QAXF,EAYEC,SAZF,QAaO,kBAbP;AAcA,SAASC,iBAAT,QAAkC,aAAlC;AACA,SAASC,YAAT,EAAuBC,cAAvB,QAA6C,cAA7C;;AAYA,IAAMC,SAAS;AAAA,+BAAG,WAAOC,OAAP,EAAwC;AACxD,QAAMC,IAAI,SAASD,OAAO,CAACE,mBAAR,CAA4BvB,YAA5B,CAAnB;AACA,WAAO,CAAC,CAACsB,IAAT;AACD,GAHc;;AAAA,kBAATF,SAAS;AAAA;AAAA;AAAA,GAAf;;AAKA,OAAO,IAAMI,WA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S,IAAA,GAAG,EAAEJ,GAAd;AAAmB,IAAA,MAAM,EAAEU;AAA3B,IAfF,EAgBE,oBAAC,cAAD;AAAgB,IAAA,GAAG,EAAEV,GAArB;AAA0B,IAAA,MAAM,EAAEU;AAAlC,IAhBF,EAiBE,oBAAC,WAAD;AAAa,IAAA,MAAM,EAAEA;AAArB,IAjBF,EAkBE,oBAAC,aAAD;AAAe,IAAA,SAAS,EAAEG,QAA1B;AAAoC,IAAA,GAAG,EAAEb,GAAzC;AAA8C,IAAA,OAAO,EAAEI;AAAvD,IAlBF,EAmBE,oBAAC,YAAD;AAAc,IAAA,GAAG,EAAEJ,GAAnB;AAAwB,IAAA,SAAS,EAAEU,MAAM,CAACe;AAA1C,IAnBF,EAoBE,oBAAC,SAAD;AAAW,IAAA,MAAM,EAAEf,MAAM,CAACgB;AAA1B,IApBF,CAFJ,EAyBGnB,KAAK,IACJ,oBAAC,KAAD;AAAO,IAAA,KAAK,EAAC;AAAb,KACE,oBAAC,6BAAD;AACE,IAAA,mBAAmB,EAAE;AACnBoB,MAAAA,MAAM,EAAE;AACNC,QAAAA,UAAU,EAAE,SADN;AAENC,QAAAA,GAAG,EAAE,SAFC;AAGNC,QAAAA,IAAI,EAAE,MAHA;AAINC,QAAAA,IAAI,EAAE,SAJA;AAKNC,QAAAA,QAAQ,EAAE;AALJ;AADW;AADvB,KAWE,oBAAC,KAAD;AACE,IAAA,OAAO,EAAEpC,OADX;AAEE,IAAA,GAAG,EAAEc,MAAM,CAACuB,WAFd;AAGE,IAAA,WAAW,EAAE9B,WAHf;AAIE,IAAA,GAAG,EAAEH,GAJP;AAKE,IAAA,MAAM,EAAEU;AALV,IAXF,CADF,CA1BJ,CADF;AAmDD,CAtGM","sourcesContent":["/*\n\n MIT License\n\n Copyright (c) 2021 Looker Data Sciences, Inc.\n\n Permission is hereby granted, free of charge, to any person obtaining a copy\n of this software and associated documentation files (the \"Software\"), to deal\n in the Software without restriction, including without limitation the rights\n to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n copies of the Software, and to permit persons to whom the Software is\n furnished to do so, subject to the following conditions:\n\n The above copyright notice and this permission notice shall be included in all\n copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n SOFTWARE.\n\n */\n\nimport type { FC } from 'react'\nimport React, { useState, useEffect } from 'react'\nimport {\n Aside,\n Button,\n ButtonOutline,\n Space,\n useToggle,\n ExtendComponentsThemeProvider,\n} from '@looker/components'\nimport { Beaker } from '@looker/icons'\nimport { useHistory, useParams } from 'react-router-dom'\nimport { RunIt, RunItFormKey } from '@looker/run-it'\nimport type { ApiModel } from '@looker/sdk-codegen'\nimport { typeRefs } from '@looker/sdk-codegen'\nimport { useSelector } from 'react-redux'\nimport type { IEnvironmentAdaptor } from '@looker/extension-utils'\n\nimport { getApixAdaptor, useNavigation } from '../../utils'\nimport {\n ApixSection,\n DocActivityType,\n DocMarkdown,\n DocRateLimited,\n DocReferences,\n DocResponses,\n DocSDKs,\n DocSdkUsage,\n DocSource,\n DocStatus,\n DocTitle,\n DocSchema,\n} from '../../components'\nimport { selectSdkLanguage } from '../../state'\nimport { DocOperation, DocRequestBody } from './components'\n\ninterface MethodSceneProps {\n api: ApiModel\n}\n\ninterface MethodSceneParams {\n methodName: string\n methodTag: string\n specKey: string\n}\n\nconst showRunIt = async (adaptor: IEnvironmentAdaptor) => {\n const data = await adaptor.localStorageGetItem(RunItFormKey)\n return !!data\n}\n\nexport const MethodScene: FC<MethodSceneProps> = ({ api }) => {\n const adaptor = getApixAdaptor()\n const history = useHistory()\n const navigate = useNavigation()\n const sdkLanguage = useSelector(selectSdkLanguage)\n const { specKey, methodTag, methodName } = useParams<MethodSceneParams>()\n const { value, toggle, setOn } = useToggle()\n const [method, setMethod] = useState(api.methods[methodName])\n const seeTypes = typeRefs(api, method?.customTypes)\n\n const RunItButton = value ? Button : ButtonOutline\n\n useEffect(() => {\n const foundMethod = api.methods[methodName]\n if (foundMethod) {\n setMethod(api.methods[methodName])\n } else {\n // Invalid method\n if (api.tags[methodTag]) {\n // Found tag though\n navigate(`/${specKey}/methods/${methodTag}`)\n } else {\n navigate(`/${specKey}/methods`)\n }\n }\n }, [api, history, methodName, methodTag, specKey])\n\n useEffect(() => {\n const checkRunIt = async () => {\n try {\n const show = await showRunIt(adaptor)\n if (show) {\n setOn()\n }\n } catch (error) {\n console.error(error)\n }\n }\n checkRunIt()\n }, [adaptor, setOn])\n\n const runItToggle = (\n <RunItButton\n color={value ? 'key' : 'neutral'}\n iconBefore={<Beaker />}\n onClick={toggle}\n >\n Run It\n </RunItButton>\n )\n\n return (\n <>\n {method && (\n <ApixSection>\n <Space between>\n <Space>\n <DocTitle>{method.summary}</DocTitle>\n <DocSource method={method} />\n </Space>\n {runItToggle}\n </Space>\n <Space mb=\"large\" gap=\"small\">\n <DocStatus method={method} />\n <DocActivityType method={method} />\n <DocRateLimited method={method} />\n </Space>\n <DocOperation method={method} />\n <DocMarkdown source={method.description} specKey={specKey} />\n <DocSDKs api={api} method={method} />\n <DocRequestBody api={api} method={method} />\n <DocSdkUsage method={method} />\n <DocReferences typesUsed={seeTypes} api={api} specKey={specKey} />\n <DocResponses api={api} responses={method.responses} />\n <DocSchema object={method.schema} />\n </ApixSection>\n )}\n {value && (\n <Aside width=\"50rem\">\n <ExtendComponentsThemeProvider\n themeCustomizations={{\n colors: {\n background: '#262D33',\n key: '#8AB4F8',\n text: '#fff',\n link: '#8AB4F8',\n critical: '#FF877C',\n },\n }}\n >\n <RunIt\n adaptor={adaptor}\n key={method.operationId}\n sdkLanguage={sdkLanguage}\n api={api}\n method={method}\n />\n </ExtendComponentsThemeProvider>\n </Aside>\n )}\n </>\n )\n}\n"],"file":"MethodScene.js"}
|
|
1
|
+
{"version":3,"sources":["../../../../src/scenes/MethodScene/MethodScene.tsx"],"names":["React","useState","useEffect","useRef","Aside","Button","ButtonOutline","Space","useToggle","ExtendComponentsThemeProvider","Span","Beaker","useHistory","useParams","RunIt","RunItFormKey","typeRefs","useSelector","getApixAdaptor","useNavigation","useQuery","ApixSection","DocActivityType","DocMarkdown","DocRateLimited","DocReferences","DocSDKs","DocSdkUsage","DocSource","DocStatus","DocTitle","DocSchema","selectSdkLanguage","DocOperation","DocRequestBody","DocResponses","showRunIt","adaptor","data","localStorageGetItem","MethodScene","api","history","navigate","sdkLanguage","specKey","methodTag","methodName","value","toggle","setOn","method","setMethod","methods","seeTypes","customTypes","query","errorCode","get","undefined","RunItButton","docResponsesRef","foundMethod","tags","checkRunIt","show","error","console","responses","current","window","setTimeout","scrollIntoView","runItToggle","summary","description","schema","colors","background","key","text","link","critical","operationId"],"mappings":";;;;AA2BA,OAAOA,KAAP,IAAgBC,QAAhB,EAA0BC,SAA1B,EAAqCC,MAArC,QAAmD,OAAnD;AACA,SACEC,KADF,EAEEC,MAFF,EAGEC,aAHF,EAIEC,KAJF,EAKEC,SALF,EAMEC,6BANF,EAOEC,IAPF,QAQO,oBARP;AASA,SAASC,MAAT,QAAuB,eAAvB;AACA,SAASC,UAAT,EAAqBC,SAArB,QAAsC,kBAAtC;AACA,SAASC,KAAT,EAAgBC,YAAhB,QAAoC,gBAApC;AAEA,SAASC,QAAT,QAAyB,qBAAzB;AACA,SAASC,WAAT,QAA4B,aAA5B;AAGA,SAASC,cAAT,EAAyBC,aAAzB,EAAwCC,QAAxC,QAAwD,aAAxD;AACA,SACEC,WADF,EAEEC,eAFF,EAGEC,WAHF,EAIEC,cA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,GAAzC;AAA8C,IAAA,OAAO,EAAEI;AAAvD,IAlBF,EAmBE,oBAAC,IAAD;AAAM,IAAA,GAAG,EAAEgB;AAAX,KACE,oBAAC,YAAD;AAAc,IAAA,GAAG,EAAEpB,GAAnB;AAAwB,IAAA,MAAM,EAAEU,MAAhC;AAAwC,IAAA,SAAS,EAAEM;AAAnD,IADF,CAnBF,EAsBE,oBAAC,SAAD;AAAW,IAAA,MAAM,EAAEN,MAAM,CAACyB;AAA1B,IAtBF,CAFJ,EA2BG5B,KAAK,IACJ,oBAAC,KAAD;AAAO,IAAA,KAAK,EAAC;AAAb,KACE,oBAAC,6BAAD;AACE,IAAA,mBAAmB,EAAE;AACnB6B,MAAAA,MAAM,EAAE;AACNC,QAAAA,UAAU,EAAE,SADN;AAENC,QAAAA,GAAG,EAAE,SAFC;AAGNC,QAAAA,IAAI,EAAE,MAHA;AAINC,QAAAA,IAAI,EAAE,SAJA;AAKNC,QAAAA,QAAQ,EAAE;AALJ;AADW;AADvB,KAWE,oBAAC,KAAD;AACE,IAAA,OAAO,EAAE7C,OADX;AAEE,IAAA,GAAG,EAAEc,MAAM,CAACgC,WAFd;AAGE,IAAA,WAAW,EAAEvC,WAHf;AAIE,IAAA,GAAG,EAAEH,GAJP;AAKE,IAAA,MAAM,EAAEU;AALV,IAXF,CADF,CA5BJ,CADF;AAqDD,CApHM","sourcesContent":["/*\n\n MIT License\n\n Copyright (c) 2021 Looker Data Sciences, Inc.\n\n Permission is hereby granted, free of charge, to any person obtaining a copy\n of this software and associated documentation files (the \"Software\"), to deal\n in the Software without restriction, including without limitation the rights\n to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n copies of the Software, and to permit persons to whom the Software is\n furnished to do so, subject to the following conditions:\n\n The above copyright notice and this permission notice shall be included in all\n copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n SOFTWARE.\n\n */\n\nimport type { FC } from 'react'\nimport React, { useState, useEffect, useRef } from 'react'\nimport {\n Aside,\n Button,\n ButtonOutline,\n Space,\n useToggle,\n ExtendComponentsThemeProvider,\n Span,\n} from '@looker/components'\nimport { Beaker } from '@looker/icons'\nimport { useHistory, useParams } from 'react-router-dom'\nimport { RunIt, RunItFormKey } from '@looker/run-it'\nimport type { ApiModel } from '@looker/sdk-codegen'\nimport { typeRefs } from '@looker/sdk-codegen'\nimport { useSelector } from 'react-redux'\nimport type { IEnvironmentAdaptor } from '@looker/extension-utils'\n\nimport { getApixAdaptor, useNavigation, useQuery } from '../../utils'\nimport {\n ApixSection,\n DocActivityType,\n DocMarkdown,\n DocRateLimited,\n DocReferences,\n DocSDKs,\n DocSdkUsage,\n DocSource,\n DocStatus,\n DocTitle,\n DocSchema,\n} from '../../components'\nimport { selectSdkLanguage } from '../../state'\nimport { DocOperation, DocRequestBody, DocResponses } from './components'\n\ninterface MethodSceneProps {\n api: ApiModel\n}\n\ninterface MethodSceneParams {\n methodName: string\n methodTag: string\n specKey: string\n}\n\nconst showRunIt = async (adaptor: IEnvironmentAdaptor) => {\n const data = await adaptor.localStorageGetItem(RunItFormKey)\n return !!data\n}\n\nexport const MethodScene: FC<MethodSceneProps> = ({ api }) => {\n const adaptor = getApixAdaptor()\n const history = useHistory()\n const { navigate } = useNavigation()\n const sdkLanguage = useSelector(selectSdkLanguage)\n const { specKey, methodTag, methodName } = useParams<MethodSceneParams>()\n const { value, toggle, setOn } = useToggle()\n const [method, setMethod] = useState(api.methods[methodName])\n const seeTypes = typeRefs(api, method?.customTypes)\n const query = useQuery()\n const errorCode = query.get('e') ?? undefined\n const RunItButton = value ? Button : ButtonOutline\n const docResponsesRef = useRef<HTMLElement>(null)\n\n useEffect(() => {\n const foundMethod = api.methods[methodName]\n if (foundMethod) {\n setMethod(api.methods[methodName])\n } else {\n // Invalid method\n if (api.tags[methodTag]) {\n // Found tag though\n navigate(`/${specKey}/methods/${methodTag}`)\n } else {\n navigate(`/${specKey}/methods`)\n }\n }\n }, [api, history, methodName, methodTag, specKey])\n\n useEffect(() => {\n const checkRunIt = async () => {\n try {\n const show = await showRunIt(adaptor)\n if (show) {\n setOn()\n }\n } catch (error) {\n console.error(error)\n }\n }\n checkRunIt()\n }, [adaptor, setOn])\n\n useEffect(() => {\n if (method.responses && errorCode) {\n if (docResponsesRef.current) {\n window.setTimeout(() => {\n docResponsesRef.current!.scrollIntoView()\n }, 300)\n }\n }\n }, [method])\n\n const runItToggle = (\n <RunItButton\n color={value ? 'key' : 'neutral'}\n iconBefore={<Beaker />}\n onClick={toggle}\n >\n Run It\n </RunItButton>\n )\n\n return (\n <>\n {method && (\n <ApixSection>\n <Space between>\n <Space>\n <DocTitle>{method.summary}</DocTitle>\n <DocSource method={method} />\n </Space>\n {runItToggle}\n </Space>\n <Space mb=\"large\" gap=\"small\">\n <DocStatus method={method} />\n <DocActivityType method={method} />\n <DocRateLimited method={method} />\n </Space>\n <DocOperation method={method} />\n <DocMarkdown source={method.description} specKey={specKey} />\n <DocSDKs api={api} method={method} />\n <DocRequestBody api={api} method={method} />\n <DocSdkUsage method={method} />\n <DocReferences typesUsed={seeTypes} api={api} specKey={specKey} />\n <Span ref={docResponsesRef}>\n <DocResponses api={api} method={method} errorCode={errorCode} />\n </Span>\n <DocSchema object={method.schema} />\n </ApixSection>\n )}\n {value && (\n <Aside width=\"50rem\">\n <ExtendComponentsThemeProvider\n themeCustomizations={{\n colors: {\n background: '#262D33',\n key: '#8AB4F8',\n text: '#fff',\n link: '#8AB4F8',\n critical: '#FF877C',\n },\n }}\n >\n <RunIt\n adaptor={adaptor}\n key={method.operationId}\n sdkLanguage={sdkLanguage}\n api={api}\n method={method}\n />\n </ExtendComponentsThemeProvider>\n </Aside>\n )}\n </>\n )\n}\n"],"file":"MethodScene.js"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../src/scenes/MethodScene/components/DocResponses/DocResponseTypes.tsx"],"names":["React","useState","useEffect","ButtonToggle","ButtonItem","ExploreType","DocResponseTypes","api","responses","mediaTypes","Object","keys","selectedMediaType","setSelectedMediaType","resps","setResps","map","mediaType","overflow","type"],"mappings":"AA0BA,OAAOA,KAAP,IAAgBC,QAAhB,EAA0BC,SAA1B,QAA2C,OAA3C;AACA,SAASC,YAAT,EAAuBC,UAAvB,QAAyC,oBAAzC;AAOA,SAASC,WAAT,QAA4B,wBAA5B;AAaA,OAAO,IAAMC,gBAAgB,GAAG,QAA+C;AAAA,MAA9C;AAAEC,IAAAA,GAAF;AAAOC,IAAAA;AAAP,GAA8C;AAC7E,MAAMC,UAAU,GAAGC,MAAM,CAACC,IAAP,CAAYH,SAAZ,CAAnB;AACA,MAAM,CAACI,iBAAD,EAAoBC,oBAApB,IAA4CZ,QAAQ,CAACQ,UAAU,CAAC,CAAD,CAAX,CAA1D;AACA,MAAM,CAACK,KAAD,EAAQC,QAAR,IAAoBd,QAAQ,CAACO,SAAD,CAAlC;AAEAN,EAAAA,SAAS,CAAC,MAAM;AAEdW,IAAAA,oBAAoB,CAACJ,UAAU,CAAC,CAAD,CAAX,CAApB;AACAM,IAAAA,QAAQ,CAACP,SAAD,CAAR;AACD,GAJQ,EAIN,CAACA,SAAD,EAAYC,UAAZ,CAJM,CAAT;AAOA,SACE,0CACE,oBAAC,YAAD;AACE,IAAA,KAAK,EAAEG,iBADT;AAEE,IAAA,QAAQ,EAAEC,oBAFZ;AAGE,IAAA,EAAE,EAAC,OAHL;AAIE,IAAA,EAAE,EAAC;AAJL,KAMGJ,UAAU,CAACO,GAAX,CAAgBC,SAAD,IACd,oBAAC,UAAD;AAAY,IAAA,GAAG,EAAEA;AAAjB,KAA6BA,SAA7B,CADD,CANH,CADF,EAWE;AAAK,IAAA,KAAK,EAAE;AAAEC,MAAAA,QAAQ,EAAE;AAAZ;AAAZ,KACE,oBAAC,WAAD;AACE,IAAA,GAAG,EAAEX,GADP;AAEE,IAAA,GAAG,EAAEK,iBAFP;AAGE,IAAA,IAAI,EAAEE,KAAK,CAACF,iBAAD,CAAL,CAAyBO,IAHjC;AAIE,IAAA,IAAI,EAAE,IAJR;AAKE,IAAA,QAAQ,EAAE;AALZ,IADF,CAXF,CADF;AAuBD,CAnCM","sourcesContent":["/*\n\n MIT License\n\n Copyright (c) 2021 Looker Data Sciences, Inc.\n\n Permission is hereby granted, free of charge, to any person obtaining a copy\n of this software and associated documentation files (the \"Software\"), to deal\n in the Software without restriction, including without limitation the rights\n to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n copies of the Software, and to permit persons to whom the Software is\n furnished to do so, subject to the following conditions:\n\n The above copyright notice and this permission notice shall be included in all\n copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n SOFTWARE.\n\n */\n\nimport React, { useState, useEffect } from 'react'\nimport { ButtonToggle, ButtonItem } from '@looker/components'\nimport type {\n ApiModel,\n KeyedCollection,\n IMethodResponse,\n} from '@looker/sdk-codegen'\n\nimport { ExploreType } from '../../../../components'\n\ninterface DocResponseTypesProps {\n api: ApiModel\n /** responses to render */\n responses: KeyedCollection<IMethodResponse>\n}\n\n/**\n * Given a collection of media types (keys) and responses (values) for a response code, generate a group of buttons for\n * toggling media type and render the response\n * @param response\n */\nexport const DocResponseTypes = ({ api, responses }: DocResponseTypesProps) => {\n const mediaTypes = Object.keys(responses)\n const [selectedMediaType, setSelectedMediaType] = useState(mediaTypes[0])\n const [resps, setResps] = useState(responses)\n\n useEffect(() => {\n /** When new responses are passed, update the default selected media type */\n setSelectedMediaType(mediaTypes[0])\n setResps(responses)\n }, [responses, mediaTypes])\n\n // TODO: Account for endpoints with no responses (e.g. delete a custom cmd)\n return (\n <>\n <ButtonToggle\n value={selectedMediaType}\n onChange={setSelectedMediaType}\n mt=\"large\"\n mb=\"large\"\n >\n {mediaTypes.map((mediaType) => (\n <ButtonItem key={mediaType}>{mediaType}</ButtonItem>\n ))}\n </ButtonToggle>\n <div style={{ overflow: 'auto' }}>\n <ExploreType\n api={api}\n key={selectedMediaType}\n type={resps[selectedMediaType].type}\n link={true}\n maxDepth={2}\n />\n </div>\n </>\n )\n}\n"],"file":"DocResponseTypes.js"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
2
|
+
|
|
3
|
+
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
4
|
+
|
|
5
|
+
import React, { useEffect, useState } from 'react';
|
|
6
|
+
import { Tabs2, Tab2 } from '@looker/components';
|
|
7
|
+
import { CollapserCard } from '@looker/run-it';
|
|
8
|
+
import { ErrorDoc } from '@looker/sdk-rtl';
|
|
9
|
+
import { apiErrorDisplayFetch, ExtMarkdown, getEnvAdaptor } from '@looker/extension-utils';
|
|
10
|
+
import { DocResponseTypes } from './DocResponseTypes';
|
|
11
|
+
import { buildResponseTree } from './utils';
|
|
12
|
+
export var DocResponses = _ref => {
|
|
13
|
+
var {
|
|
14
|
+
api,
|
|
15
|
+
method,
|
|
16
|
+
errorCode
|
|
17
|
+
} = _ref;
|
|
18
|
+
var [errorContent, setErrorContent] = useState('');
|
|
19
|
+
var responses = method.responses;
|
|
20
|
+
var responseTree = buildResponseTree(responses);
|
|
21
|
+
var tabNames = Object.keys(responseTree);
|
|
22
|
+
var defaultTabId = tabNames[0];
|
|
23
|
+
|
|
24
|
+
if (errorCode) {
|
|
25
|
+
var pattern = new RegExp("".concat(errorCode, ": \\w+"));
|
|
26
|
+
tabNames.forEach(el => {
|
|
27
|
+
if (pattern.test(el)) {
|
|
28
|
+
defaultTabId = el;
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
useEffect(() => {
|
|
34
|
+
if (!errorCode) return;
|
|
35
|
+
|
|
36
|
+
var getErrorContent = function () {
|
|
37
|
+
var _ref2 = _asyncToGenerator(function* () {
|
|
38
|
+
var docUrl = "/err/4.0/".concat(errorCode, "/").concat(method.httpMethod.toLocaleLowerCase()).concat(method.endpoint);
|
|
39
|
+
var adaptor = getEnvAdaptor();
|
|
40
|
+
var errDoc = new ErrorDoc(adaptor.sdk, apiErrorDisplayFetch);
|
|
41
|
+
var content = yield errDoc.content(docUrl);
|
|
42
|
+
setErrorContent(content);
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
return function getErrorContent() {
|
|
46
|
+
return _ref2.apply(this, arguments);
|
|
47
|
+
};
|
|
48
|
+
}();
|
|
49
|
+
|
|
50
|
+
getErrorContent();
|
|
51
|
+
}, [errorCode]);
|
|
52
|
+
if (responses.length === 0) return React.createElement(React.Fragment, null);
|
|
53
|
+
return React.createElement(CollapserCard, {
|
|
54
|
+
heading: "Response Models",
|
|
55
|
+
id: "response models"
|
|
56
|
+
}, React.createElement(Tabs2, {
|
|
57
|
+
defaultTabId: defaultTabId
|
|
58
|
+
}, Object.entries(responseTree).map(_ref3 => {
|
|
59
|
+
var [statusCode, response] = _ref3;
|
|
60
|
+
var errorTab = errorCode && statusCode === defaultTabId;
|
|
61
|
+
return React.createElement(Tab2, {
|
|
62
|
+
key: statusCode,
|
|
63
|
+
id: statusCode,
|
|
64
|
+
label: statusCode
|
|
65
|
+
}, React.createElement(DocResponseTypes, {
|
|
66
|
+
api: api,
|
|
67
|
+
responses: response
|
|
68
|
+
}), errorContent && errorTab && React.createElement(ExtMarkdown, {
|
|
69
|
+
source: errorContent
|
|
70
|
+
}));
|
|
71
|
+
})));
|
|
72
|
+
};
|
|
73
|
+
//# sourceMappingURL=DocResponses.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../src/scenes/MethodScene/components/DocResponses/DocResponses.tsx"],"names":["React","useEffect","useState","Tabs2","Tab2","CollapserCard","ErrorDoc","apiErrorDisplayFetch","ExtMarkdown","getEnvAdaptor","DocResponseTypes","buildResponseTree","DocResponses","api","method","errorCode","errorContent","setErrorContent","responses","responseTree","tabNames","Object","keys","defaultTabId","pattern","RegExp","forEach","el","test","getErrorContent","docUrl","httpMethod","toLocaleLowerCase","endpoint","adaptor","errDoc","sdk","content","length","entries","map","statusCode","response","errorTab"],"mappings":";;;;AA0BA,OAAOA,KAAP,IAAgBC,SAAhB,EAA2BC,QAA3B,QAA2C,OAA3C;AACA,SAASC,KAAT,EAAgBC,IAAhB,QAA4B,oBAA5B;AAEA,SAASC,aAAT,QAA8B,gBAA9B;AACA,SAASC,QAAT,QAAyB,iBAAzB;AACA,SACEC,oBADF,EAEEC,WAFF,EAGEC,aAHF,QAIO,yBAJP;AAMA,SAASC,gBAAT,QAAiC,oBA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eAAe;AAChB,GAbQ,EAaN,CAACd,SAAD,CAbM,CAAT;AAeA,MAAIG,SAAS,CAACoB,MAAV,KAAqB,CAAzB,EAA4B,OAAO,yCAAP;AAE5B,SACE,oBAAC,aAAD;AAAe,IAAA,OAAO,EAAC,iBAAvB;AAAyC,IAAA,EAAE,EAAC;AAA5C,KACE,oBAAC,KAAD;AAAO,IAAA,YAAY,EAAEf;AAArB,KACGF,MAAM,CAACkB,OAAP,CAAepB,YAAf,EAA6BqB,GAA7B,CAAiC,SAA4B;AAAA,QAA3B,CAACC,UAAD,EAAaC,QAAb,CAA2B;AAC5D,QAAMC,QAAQ,GAAG5B,SAAS,IAAI0B,UAAU,KAAKlB,YAA7C;AACA,WACE,oBAAC,IAAD;AAAM,MAAA,GAAG,EAAEkB,UAAX;AAAuB,MAAA,EAAE,EAAEA,UAA3B;AAAuC,MAAA,KAAK,EAAEA;AAA9C,OACE,oBAAC,gBAAD;AAAkB,MAAA,GAAG,EAAE5B,GAAvB;AAA4B,MAAA,SAAS,EAAE6B;AAAvC,MADF,EAEG1B,YAAY,IAAI2B,QAAhB,IACC,oBAAC,WAAD;AAAa,MAAA,MAAM,EAAE3B;AAArB,MAHJ,CADF;AAQD,GAVA,CADH,CADF,CADF;AAiBD,CApDM","sourcesContent":["/*\n\n MIT License\n\n Copyright (c) 2021 Looker Data Sciences, Inc.\n\n Permission is hereby granted, free of charge, to any person obtaining a copy\n of this software and associated documentation files (the \"Software\"), to deal\n in the Software without restriction, including without limitation the rights\n to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n copies of the Software, and to permit persons to whom the Software is\n furnished to do so, subject to the following conditions:\n\n The above copyright notice and this permission notice shall be included in all\n copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n SOFTWARE.\n\n */\n\nimport React, { useEffect, useState } from 'react'\nimport { Tabs2, Tab2 } from '@looker/components'\nimport type { ApiModel, IMethod } from '@looker/sdk-codegen'\nimport { CollapserCard } from '@looker/run-it'\nimport { ErrorDoc } from '@looker/sdk-rtl'\nimport {\n apiErrorDisplayFetch,\n ExtMarkdown,\n getEnvAdaptor,\n} from '@looker/extension-utils'\n\nimport { DocResponseTypes } from './DocResponseTypes'\nimport { buildResponseTree } from './utils'\n\ninterface DocResponsesProps {\n api: ApiModel\n method: IMethod\n /** error code to display */\n errorCode?: string\n}\n\n/**\n * Renders a tab list and tab panels for different method response types\n */\nexport const DocResponses = ({ api, method, errorCode }: DocResponsesProps) => {\n const [errorContent, setErrorContent] = useState('')\n const responses = method.responses\n\n const responseTree = buildResponseTree(responses)\n const tabNames = Object.keys(responseTree)\n\n let defaultTabId = tabNames[0]\n\n if (errorCode) {\n const pattern = new RegExp(`${errorCode}: \\\\w+`)\n tabNames.forEach((el) => {\n if (pattern.test(el)) {\n defaultTabId = el\n }\n })\n }\n\n useEffect(() => {\n if (!errorCode) return\n\n const getErrorContent = async () => {\n const docUrl = `/err/4.0/${errorCode}/${method.httpMethod.toLocaleLowerCase()}${\n method.endpoint\n }`\n const adaptor = getEnvAdaptor()\n const errDoc = new ErrorDoc(adaptor.sdk, apiErrorDisplayFetch)\n const content = await errDoc.content(docUrl)\n setErrorContent(content)\n }\n getErrorContent()\n }, [errorCode])\n\n if (responses.length === 0) return <></>\n\n return (\n <CollapserCard heading=\"Response Models\" id=\"response models\">\n <Tabs2 defaultTabId={defaultTabId}>\n {Object.entries(responseTree).map(([statusCode, response]) => {\n const errorTab = errorCode && statusCode === defaultTabId\n return (\n <Tab2 key={statusCode} id={statusCode} label={statusCode}>\n <DocResponseTypes api={api} responses={response} />\n {errorContent && errorTab && (\n <ExtMarkdown source={errorContent} />\n )}\n </Tab2>\n )\n })}\n </Tabs2>\n </CollapserCard>\n )\n}\n"],"file":"DocResponses.js"}
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../src/scenes/MethodScene/components/DocResponses/index.ts"],"names":["DocResponses"],"mappings":"AAyBA,SAASA,YAAT,QAA6B,gBAA7B","sourcesContent":["/*\n\n MIT License\n\n Copyright (c) 2021 Looker Data Sciences, Inc.\n\n Permission is hereby granted, free of charge, to any person obtaining a copy\n of this software and associated documentation files (the \"Software\"), to deal\n in the Software without restriction, including without limitation the rights\n to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n copies of the Software, and to permit persons to whom the Software is\n furnished to do so, subject to the following conditions:\n\n The above copyright notice and this permission notice shall be included in all\n copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n SOFTWARE.\n\n */\nexport { DocResponses } from './DocResponses'\n"],"file":"index.js"}
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../src/scenes/MethodScene/components/DocResponses/utils.ts"],"names":["buildResponseTree","responses","tree","Object","values","forEach","response","node","statusCode","description","mediaType"],"mappings":"AAiCA,OAAO,IAAMA,iBAAiB,GAC5BC,SAD+B,IAEuB;AACtD,MAAMC,IAAI,GAAG,EAAb;AACAC,EAAAA,MAAM,CAACC,MAAP,CAAcH,SAAd,EAAyBI,OAAzB,CAAkCC,QAAD,IAAc;AAC7C,QAAMC,IAAI,aAAMD,QAAQ,CAACE,UAAf,eAA8BF,QAAQ,CAACG,WAAvC,CAAV;AACA,QAAI,EAAEF,IAAI,IAAIL,IAAV,CAAJ,EAAqBA,IAAI,CAACK,IAAD,CAAJ,GAAa,EAAb;AACrBL,IAAAA,IAAI,CAACK,IAAD,CAAJ,CAAWD,QAAQ,CAACI,SAApB,IAAiCJ,QAAjC;AACD,GAJD;AAKA,SAAOJ,IAAP;AACD,CAVM","sourcesContent":["/*\n\n MIT License\n\n Copyright (c) 2021 Looker Data Sciences, Inc.\n\n Permission is hereby granted, free of charge, to any person obtaining a copy\n of this software and associated documentation files (the \"Software\"), to deal\n in the Software without restriction, including without limitation the rights\n to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n copies of the Software, and to permit persons to whom the Software is\n furnished to do so, subject to the following conditions:\n\n The above copyright notice and this permission notice shall be included in all\n copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n SOFTWARE.\n\n */\n\nimport type { IMethodResponse, KeyedCollection } from '@looker/sdk-codegen'\n\n/**\n * Given an array of method responses, group them by statusCode. The value of each status code is a collection of\n * media types (keys) and responses (values)\n * @param responses An array of method responses\n */\nexport const buildResponseTree = (\n responses: IMethodResponse[]\n): KeyedCollection<KeyedCollection<IMethodResponse>> => {\n const tree = {}\n Object.values(responses).forEach((response) => {\n const node = `${response.statusCode}: ${response.description}`\n if (!(node in tree)) tree[node] = {}\n tree[node][response.mediaType] = response\n })\n return tree\n}\n"],"file":"utils.js"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/scenes/MethodScene/components/index.ts"],"names":["DocOperation","DocRequestBody"],"mappings":"AAyBA,SAASA,YAAT,QAA6B,gBAA7B;AACA,SAASC,cAAT,QAA+B,kBAA/B","sourcesContent":["/*\n\n MIT License\n\n Copyright (c) 2021 Looker Data Sciences, Inc.\n\n Permission is hereby granted, free of charge, to any person obtaining a copy\n of this software and associated documentation files (the \"Software\"), to deal\n in the Software without restriction, including without limitation the rights\n to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n copies of the Software, and to permit persons to whom the Software is\n furnished to do so, subject to the following conditions:\n\n The above copyright notice and this permission notice shall be included in all\n copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n SOFTWARE.\n\n */\nexport { DocOperation } from './DocOperation'\nexport { DocRequestBody } from './DocRequestBody'\n"],"file":"index.js"}
|
|
1
|
+
{"version":3,"sources":["../../../../../src/scenes/MethodScene/components/index.ts"],"names":["DocOperation","DocRequestBody","DocResponses"],"mappings":"AAyBA,SAASA,YAAT,QAA6B,gBAA7B;AACA,SAASC,cAAT,QAA+B,kBAA/B;AACA,SAASC,YAAT,QAA6B,gBAA7B","sourcesContent":["/*\n\n MIT License\n\n Copyright (c) 2021 Looker Data Sciences, Inc.\n\n Permission is hereby granted, free of charge, to any person obtaining a copy\n of this software and associated documentation files (the \"Software\"), to deal\n in the Software without restriction, including without limitation the rights\n to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n copies of the Software, and to permit persons to whom the Software is\n furnished to do so, subject to the following conditions:\n\n The above copyright notice and this permission notice shall be included in all\n copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n SOFTWARE.\n\n */\nexport { DocOperation } from './DocOperation'\nexport { DocRequestBody } from './DocRequestBody'\nexport { DocResponses } from './DocResponses'\n"],"file":"index.js"}
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import React, { useEffect, useState } from 'react';
|
|
2
2
|
import { useHistory, useParams } from 'react-router-dom';
|
|
3
3
|
import { Grid, ButtonToggle, ButtonItem } from '@looker/components';
|
|
4
|
+
import { useSelector } from 'react-redux';
|
|
4
5
|
import { ApixSection, DocTitle, DocMethodSummary, Link } from '../../components';
|
|
5
|
-
import { buildMethodPath, useNavigation } from '../../utils';
|
|
6
|
+
import { buildMethodPath, isValidFilter, useNavigation } from '../../utils';
|
|
7
|
+
import { selectTagFilter, useSettingActions } from '../../state';
|
|
8
|
+
import { useTagStoreSync } from '../utils';
|
|
6
9
|
import { getOperations } from './utils';
|
|
7
10
|
export var MethodTagScene = _ref => {
|
|
8
11
|
var {
|
|
@@ -13,15 +16,39 @@ export var MethodTagScene = _ref => {
|
|
|
13
16
|
methodTag
|
|
14
17
|
} = useParams();
|
|
15
18
|
var history = useHistory();
|
|
16
|
-
var navigate = useNavigation();
|
|
17
|
-
var [value, setValue] = useState('ALL');
|
|
18
|
-
useEffect(() => {
|
|
19
|
-
setValue('ALL');
|
|
20
|
-
}, [methodTag]);
|
|
21
19
|
var methods = api.tags[methodTag];
|
|
20
|
+
var {
|
|
21
|
+
navigate,
|
|
22
|
+
buildPathWithGlobalParams,
|
|
23
|
+
navigateWithGlobalParams
|
|
24
|
+
} = useNavigation();
|
|
25
|
+
var selectedTagFilter = useSelector(selectTagFilter);
|
|
26
|
+
var {
|
|
27
|
+
setTagFilterAction
|
|
28
|
+
} = useSettingActions();
|
|
29
|
+
var [tagFilter, setTagFilter] = useState(selectedTagFilter);
|
|
30
|
+
useTagStoreSync();
|
|
31
|
+
|
|
32
|
+
var handleChange = filter => {
|
|
33
|
+
navigate(location.pathname, {
|
|
34
|
+
t: filter === 'ALL' ? null : filter.toLowerCase()
|
|
35
|
+
});
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
useEffect(() => {
|
|
39
|
+
var searchParams = new URLSearchParams(location.search);
|
|
40
|
+
var verbParam = searchParams.get('t') || 'ALL';
|
|
41
|
+
verbParam = isValidFilter(location.pathname, verbParam) ? verbParam.toUpperCase() : 'ALL';
|
|
42
|
+
setTagFilterAction({
|
|
43
|
+
tagFilter: verbParam
|
|
44
|
+
});
|
|
45
|
+
}, [location.search]);
|
|
46
|
+
useEffect(() => {
|
|
47
|
+
setTagFilter(selectedTagFilter);
|
|
48
|
+
}, [selectedTagFilter]);
|
|
22
49
|
useEffect(() => {
|
|
23
50
|
if (!methods) {
|
|
24
|
-
|
|
51
|
+
navigateWithGlobalParams("/".concat(specKey, "/methods"));
|
|
25
52
|
}
|
|
26
53
|
}, [history, methods]);
|
|
27
54
|
|
|
@@ -34,8 +61,8 @@ export var MethodTagScene = _ref => {
|
|
|
34
61
|
return React.createElement(ApixSection, null, React.createElement(DocTitle, null, "".concat(tag.name, ": ").concat(tag.description)), React.createElement(ButtonToggle, {
|
|
35
62
|
mb: "small",
|
|
36
63
|
mt: "xlarge",
|
|
37
|
-
value:
|
|
38
|
-
onChange:
|
|
64
|
+
value: tagFilter,
|
|
65
|
+
onChange: handleChange
|
|
39
66
|
}, React.createElement(ButtonItem, {
|
|
40
67
|
key: "ALL",
|
|
41
68
|
px: "large",
|
|
@@ -44,9 +71,9 @@ export var MethodTagScene = _ref => {
|
|
|
44
71
|
key: op,
|
|
45
72
|
px: "large",
|
|
46
73
|
py: "xsmall"
|
|
47
|
-
}, op))), Object.values(methods).map((method, index) => (
|
|
74
|
+
}, op))), Object.values(methods).map((method, index) => (selectedTagFilter === 'ALL' || selectedTagFilter === method.httpMethod) && React.createElement(Link, {
|
|
48
75
|
key: index,
|
|
49
|
-
to: buildMethodPath(specKey, tag.name, method.name)
|
|
76
|
+
to: buildPathWithGlobalParams(buildMethodPath(specKey, tag.name, method.name))
|
|
50
77
|
}, React.createElement(Grid, {
|
|
51
78
|
columns: 1,
|
|
52
79
|
py: "xsmall"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/scenes/MethodTagScene/MethodTagScene.tsx"],"names":["React","useEffect","useState","useHistory","useParams","Grid","ButtonToggle","ButtonItem","ApixSection","DocTitle","DocMethodSummary","Link","buildMethodPath","useNavigation","getOperations","MethodTagScene","api","specKey","methodTag","history","navigate","
|
|
1
|
+
{"version":3,"sources":["../../../../src/scenes/MethodTagScene/MethodTagScene.tsx"],"names":["React","useEffect","useState","useHistory","useParams","Grid","ButtonToggle","ButtonItem","useSelector","ApixSection","DocTitle","DocMethodSummary","Link","buildMethodPath","isValidFilter","useNavigation","selectTagFilter","useSettingActions","useTagStoreSync","getOperations","MethodTagScene","api","specKey","methodTag","history","methods","tags","navigate","buildPathWithGlobalParams","navigateWithGlobalParams","selectedTagFilter","setTagFilterAction","tagFilter","setTagFilter","handleChange","filter","location","pathname","t","toLowerCase","searchParams","URLSearchParams","search","verbParam","get","toUpperCase","tag","Object","values","spec","find","name","operations","description","map","op","method","index","httpMethod"],"mappings":"AA0BA,OAAOA,KAAP,IAAgBC,SAAhB,EAA2BC,QAA3B,QAA2C,OAA3C;AACA,SAASC,UAAT,EAAqBC,SAArB,QAAsC,kBAAtC;AACA,SAASC,IAAT,EAAeC,YAAf,EAA6BC,UAA7B,QAA+C,oBAA/C;AAEA,SAASC,WAAT,QAA4B,aAA5B;AACA,SAASC,WAAT,EAAsBC,QAAtB,EAAgCC,gBAAhC,EAAkDC,IAAlD,QAA8D,kBAA9D;AACA,SAASC,eAAT,EAA0BC,aAA1B,EAAyCC,aAAzC,QAA8D,aAA9D;AACA,SAASC,eAAT,EAA0BC,iBAA1B,QAAmD,aAAnD;AACA,SAASC,eAAT,QAAgC,UAAhC;AACA,SAASC,aAAT,QAA8B,SAA9B;AAWA,OAAO,IAAMC,cAAuC,GAAG,QAAa;AAAA,MAAZ;AAAEC,IAAAA;AAAF,GAAY;AAClE,MAAM;AAAEC,IAAAA,OAAF;AAAWC,IAAAA;AAAX,MAAyBnB,SAAS,EAAxC;AACA,MAAMoB,OAAO,GAAGrB,UAAU,EAA1B;AACA,MAAMsB,OAAO,GAAGJ,GAAG,CAACK,IAAJ,CAASH,SAAT,CAAhB;AACA,MAAM;AAAEI,IAAAA,QAAF;AAAYC,IAAAA,yBAAZ;AAAuCC,IAAAA;AAAvC,MACJd,aAAa,EADf;AAEA,MAAMe,iBAAiB,GAAGtB,WAAW,CAACQ,eAAD,CAArC;AACA,MAAM;AAAEe,IAAAA;AAAF,MAAyBd,iBAAiB,EAAhD;AACA,MAAM,CAACe,SAAD,EAAYC,YAAZ,IAA4B/B,QAAQ,CAA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OAAD,CAAhC;AAEA,SACE,oBAAC,WAAD,QACE,oBAAC,QAAD,kBAAcqB,GAAG,CAACK,IAAlB,eAA2BL,GAAG,CAACO,WAA/B,EADF,EAEE,oBAAC,YAAD;AACE,IAAA,EAAE,EAAC,OADL;AAEE,IAAA,EAAE,EAAC,QAFL;AAGE,IAAA,KAAK,EAAErB,SAHT;AAIE,IAAA,QAAQ,EAAEE;AAJZ,KAME,oBAAC,UAAD;AAAY,IAAA,GAAG,EAAC,KAAhB;AAAsB,IAAA,EAAE,EAAC,OAAzB;AAAiC,IAAA,EAAE,EAAC;AAApC,WANF,EASGkB,UAAU,CAACE,GAAX,CAAgBC,EAAD,IACd,oBAAC,UAAD;AAAY,IAAA,GAAG,EAAEA,EAAjB;AAAqB,IAAA,EAAE,EAAC,OAAxB;AAAgC,IAAA,EAAE,EAAC;AAAnC,KACGA,EADH,CADD,CATH,CAFF,EAiBGR,MAAM,CAACC,MAAP,CAAcvB,OAAd,EAAuB6B,GAAvB,CACC,CAACE,MAAD,EAASC,KAAT,KACE,CAAC3B,iBAAiB,KAAK,KAAtB,IACCA,iBAAiB,KAAK0B,MAAM,CAACE,UAD/B,KAEE,oBAAC,IAAD;AACE,IAAA,GAAG,EAAED,KADP;AAEE,IAAA,EAAE,EAAE7B,yBAAyB,CAC3Bf,eAAe,CAACS,OAAD,EAAUwB,GAAG,CAACK,IAAd,EAAoBK,MAAM,CAACL,IAA3B,CADY;AAF/B,KAME,oBAAC,IAAD;AAAM,IAAA,OAAO,EAAE,CAAf;AAAkB,IAAA,EAAE,EAAC;AAArB,KACE,oBAAC,gBAAD;AAAkB,IAAA,GAAG,EAAEM,KAAvB;AAA8B,IAAA,MAAM,EAAED;AAAtC,IADF,CANF,CAJL,CAjBH,CADF;AAoCD,CAjFM","sourcesContent":["/*\n\n MIT License\n\n Copyright (c) 2021 Looker Data Sciences, Inc.\n\n Permission is hereby granted, free of charge, to any person obtaining a copy\n of this software and associated documentation files (the \"Software\"), to deal\n in the Software without restriction, including without limitation the rights\n to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n copies of the Software, and to permit persons to whom the Software is\n furnished to do so, subject to the following conditions:\n\n The above copyright notice and this permission notice shall be included in all\n copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n SOFTWARE.\n\n */\nimport type { FC } from 'react'\nimport React, { useEffect, useState } from 'react'\nimport { useHistory, useParams } from 'react-router-dom'\nimport { Grid, ButtonToggle, ButtonItem } from '@looker/components'\nimport type { ApiModel } from '@looker/sdk-codegen'\nimport { useSelector } from 'react-redux'\nimport { ApixSection, DocTitle, DocMethodSummary, Link } from '../../components'\nimport { buildMethodPath, isValidFilter, useNavigation } from '../../utils'\nimport { selectTagFilter, useSettingActions } from '../../state'\nimport { useTagStoreSync } from '../utils'\nimport { getOperations } from './utils'\n\ninterface MethodTagSceneProps {\n api: ApiModel\n}\n\ninterface MethodTagSceneParams {\n specKey: string\n methodTag: string\n}\n\nexport const MethodTagScene: FC<MethodTagSceneProps> = ({ api }) => {\n const { specKey, methodTag } = useParams<MethodTagSceneParams>()\n const history = useHistory()\n const methods = api.tags[methodTag]\n const { navigate, buildPathWithGlobalParams, navigateWithGlobalParams } =\n useNavigation()\n const selectedTagFilter = useSelector(selectTagFilter)\n const { setTagFilterAction } = useSettingActions()\n const [tagFilter, setTagFilter] = useState(selectedTagFilter)\n useTagStoreSync()\n\n const handleChange = (filter: string) => {\n navigate(location.pathname, {\n t: filter === 'ALL' ? null : filter.toLowerCase(),\n })\n }\n\n useEffect(() => {\n const searchParams = new URLSearchParams(location.search)\n let verbParam = searchParams.get('t') || 'ALL'\n verbParam = isValidFilter(location.pathname, verbParam)\n ? verbParam.toUpperCase()\n : 'ALL'\n setTagFilterAction({\n tagFilter: verbParam,\n })\n }, [location.search])\n\n useEffect(() => {\n setTagFilter(selectedTagFilter)\n }, [selectedTagFilter])\n\n useEffect(() => {\n if (!methods) {\n navigateWithGlobalParams(`/${specKey}/methods`)\n }\n }, [history, methods])\n if (!methods) {\n return <></>\n }\n const tag = Object.values(api.spec.tags!).find(\n (tag) => tag.name === methodTag\n )!\n const operations = getOperations(methods)\n\n return (\n <ApixSection>\n <DocTitle>{`${tag.name}: ${tag.description}`}</DocTitle>\n <ButtonToggle\n mb=\"small\"\n mt=\"xlarge\"\n value={tagFilter}\n onChange={handleChange}\n >\n <ButtonItem key=\"ALL\" px=\"large\" py=\"xsmall\">\n ALL\n </ButtonItem>\n {operations.map((op) => (\n <ButtonItem key={op} px=\"large\" py=\"xsmall\">\n {op}\n </ButtonItem>\n ))}\n </ButtonToggle>\n {Object.values(methods).map(\n (method, index) =>\n (selectedTagFilter === 'ALL' ||\n selectedTagFilter === method.httpMethod) && (\n <Link\n key={index}\n to={buildPathWithGlobalParams(\n buildMethodPath(specKey, tag.name, method.name)\n )}\n >\n <Grid columns={1} py=\"xsmall\">\n <DocMethodSummary key={index} method={method} />\n </Grid>\n </Link>\n )\n )}\n </ApixSection>\n )\n}\n"],"file":"MethodTagScene.js"}
|
|
@@ -15,7 +15,9 @@ export var TypeScene = _ref => {
|
|
|
15
15
|
} = useParams();
|
|
16
16
|
var type = api.types[typeName];
|
|
17
17
|
var history = useHistory();
|
|
18
|
-
var
|
|
18
|
+
var {
|
|
19
|
+
navigate
|
|
20
|
+
} = useNavigation();
|
|
19
21
|
var typesUsed = typeRefs(api, type === null || type === void 0 ? void 0 : type.customTypes);
|
|
20
22
|
var methodsUsedBy = methodRefs(api, type === null || type === void 0 ? void 0 : type.methodRefs);
|
|
21
23
|
var typesUsedBy = typeRefs(api, type === null || type === void 0 ? void 0 : type.parentTypes);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/scenes/TypeScene/TypeScene.tsx"],"names":["React","useEffect","typeRefs","methodRefs","useHistory","useParams","Space","Box","ApixSection","DocReferences","DocSDKs","DocSource","DocTitle","ExploreType","DocSchema","useNavigation","TypeScene","api","specKey","typeTag","typeName","type","types","history","navigate","typesUsed","customTypes","methodsUsedBy","typesUsedBy","parentTypes","route","typeTags","name","schema"],"mappings":"AA2BA,OAAOA,KAAP,IAAgBC,SAAhB,QAAiC,OAAjC;AAEA,SAASC,QAAT,EAAmBC,UAAnB,QAAqC,qBAArC;AACA,SAASC,UAAT,EAAqBC,SAArB,QAAsC,kBAAtC;AACA,SAASC,KAAT,EAAgBC,GAAhB,QAA2B,oBAA3B;AAEA,SACEC,WADF,EAEEC,aAFF,EAGEC,OAHF,EAIEC,SAJF,EAKEC,QALF,EAMEC,WANF,EAOEC,SAPF,QAQO,kBARP;AASA,SAASC,aAAT,QAA8B,aAA9B;AAYA,OAAO,IAAMC,SAA2B,GAAG,QAAa;AAAA,MAAZ;AAAEC,IAAAA;AAAF,GAAY;AACtD,MAAM;AAAEC,IAAAA,OAAF;AAAWC,IAAAA,OAAX;AAAoBC,IAAAA;AAApB,MAAiCf,SAAS,EAAhD;AACA,MAAMgB,IAAI,GAAGJ,GAAG,CAACK,KAAJ,CAAUF,QAAV,CAAb;AACA,MAAMG,OAAO,GAAGnB,UAAU,EAA1B;AACA,
|
|
1
|
+
{"version":3,"sources":["../../../../src/scenes/TypeScene/TypeScene.tsx"],"names":["React","useEffect","typeRefs","methodRefs","useHistory","useParams","Space","Box","ApixSection","DocReferences","DocSDKs","DocSource","DocTitle","ExploreType","DocSchema","useNavigation","TypeScene","api","specKey","typeTag","typeName","type","types","history","navigate","typesUsed","customTypes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AAD,CAAR;AACD;AACF,GAPQ,EAON,CAACP,OAAD,EAAUL,OAAV,EAAmBG,IAAnB,CAPM,CAAT;AASA,SACE,0CACGA,IAAI,IACH,oBAAC,WAAD,QACE,oBAAC,KAAD,QACE,oBAAC,QAAD,QAAWA,IAAI,CAACW,IAAhB,CADF,EAEE,oBAAC,SAAD;AAAW,IAAA,IAAI,EAAEX;AAAjB,IAFF,CADF,EAKE,oBAAC,GAAD;AAAK,IAAA,EAAE,EAAC;AAAR,KACE,oBAAC,WAAD;AAAa,IAAA,GAAG,EAAEJ,GAAlB;AAAuB,IAAA,IAAI,EAAEI;AAA7B,IADF,CALF,EAQE,oBAAC,aAAD;AACE,IAAA,SAAS,EAAEI,SADb;AAEE,IAAA,WAAW,EAAEG,WAFf;AAGE,IAAA,aAAa,EAAED,aAHjB;AAIE,IAAA,GAAG,EAAEV,GAJP;AAKE,IAAA,OAAO,EAAEC;AALX,IARF,EAeE,oBAAC,OAAD;AAAS,IAAA,IAAI,EAAEG,IAAf;AAAqB,IAAA,GAAG,EAAEJ;AAA1B,IAfF,EAgBE,oBAAC,SAAD;AAAW,IAAA,MAAM,EAAEI,IAAI,CAACY;AAAxB,IAhBF,CAFJ,CADF;AAwBD,CAzCM","sourcesContent":["/*\n\n MIT License\n\n Copyright (c) 2021 Looker Data Sciences, Inc.\n\n Permission is hereby granted, free of charge, to any person obtaining a copy\n of this software and associated documentation files (the \"Software\"), to deal\n in the Software without restriction, including without limitation the rights\n to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n copies of the Software, and to permit persons to whom the Software is\n furnished to do so, subject to the following conditions:\n\n The above copyright notice and this permission notice shall be included in all\n copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n SOFTWARE.\n\n */\n\nimport type { FC } from 'react'\nimport React, { useEffect } from 'react'\nimport type { ApiModel } from '@looker/sdk-codegen'\nimport { typeRefs, methodRefs } from '@looker/sdk-codegen'\nimport { useHistory, useParams } from 'react-router-dom'\nimport { Space, Box } from '@looker/components'\n\nimport {\n ApixSection,\n DocReferences,\n DocSDKs,\n DocSource,\n DocTitle,\n ExploreType,\n DocSchema,\n} from '../../components'\nimport { useNavigation } from '../../utils'\n\ninterface DocTypeProps {\n api: ApiModel\n}\n\ninterface DocTypeParams {\n specKey: string\n typeTag: string\n typeName: string\n}\n\nexport const TypeScene: FC<DocTypeProps> = ({ api }) => {\n const { specKey, typeTag, typeName } = useParams<DocTypeParams>()\n const type = api.types[typeName]\n const history = useHistory()\n const { navigate } = useNavigation()\n const typesUsed = typeRefs(api, type?.customTypes)\n const methodsUsedBy = methodRefs(api, type?.methodRefs)\n const typesUsedBy = typeRefs(api, type?.parentTypes)\n useEffect(() => {\n if (!type) {\n const route = api.typeTags[typeTag]\n ? `/${specKey}/types/${typeTag}`\n : `/${specKey}/types`\n navigate(route)\n }\n }, [history, specKey, type])\n\n return (\n <>\n {type && (\n <ApixSection>\n <Space>\n <DocTitle>{type.name}</DocTitle>\n <DocSource type={type} />\n </Space>\n <Box pb=\"xlarge\">\n <ExploreType api={api} type={type} />\n </Box>\n <DocReferences\n typesUsed={typesUsed}\n typesUsedBy={typesUsedBy}\n methodsUsedBy={methodsUsedBy}\n api={api}\n specKey={specKey}\n />\n <DocSDKs type={type} api={api} />\n <DocSchema object={type.schema} />\n </ApixSection>\n )}\n </>\n )\n}\n"],"file":"TypeScene.js"}
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import React, { useEffect, useState } from 'react';
|
|
2
2
|
import { Grid, ButtonToggle, ButtonItem } from '@looker/components';
|
|
3
3
|
import { useParams } from 'react-router-dom';
|
|
4
|
+
import { useSelector } from 'react-redux';
|
|
4
5
|
import { ApixSection, DocTitle, DocTypeSummary, Link } from '../../components';
|
|
5
|
-
import { buildTypePath, useNavigation } from '../../utils';
|
|
6
|
+
import { buildTypePath, isValidFilter, useNavigation } from '../../utils';
|
|
7
|
+
import { selectTagFilter, useSettingActions } from '../../state';
|
|
8
|
+
import { useTagStoreSync } from '../utils';
|
|
6
9
|
import { getMetaTypes } from './utils';
|
|
7
10
|
export var TypeTagScene = _ref => {
|
|
8
11
|
var {
|
|
@@ -12,17 +15,41 @@ export var TypeTagScene = _ref => {
|
|
|
12
15
|
specKey,
|
|
13
16
|
typeTag
|
|
14
17
|
} = useParams();
|
|
15
|
-
var
|
|
16
|
-
|
|
18
|
+
var {
|
|
19
|
+
navigate,
|
|
20
|
+
buildPathWithGlobalParams,
|
|
21
|
+
navigateWithGlobalParams
|
|
22
|
+
} = useNavigation();
|
|
23
|
+
var selectedTagFilter = useSelector(selectTagFilter);
|
|
24
|
+
var {
|
|
25
|
+
setTagFilterAction
|
|
26
|
+
} = useSettingActions();
|
|
27
|
+
var [tagFilter, setTagFilter] = useState(selectedTagFilter);
|
|
28
|
+
useTagStoreSync();
|
|
29
|
+
|
|
30
|
+
var handleChange = filter => {
|
|
31
|
+
navigate(location.pathname, {
|
|
32
|
+
t: filter === 'ALL' ? null : filter.toLowerCase()
|
|
33
|
+
});
|
|
34
|
+
};
|
|
35
|
+
|
|
17
36
|
useEffect(() => {
|
|
18
|
-
|
|
19
|
-
|
|
37
|
+
var searchParams = new URLSearchParams(location.search);
|
|
38
|
+
var verbParam = searchParams.get('t') || 'ALL';
|
|
39
|
+
verbParam = isValidFilter(location.pathname, verbParam) ? verbParam.toUpperCase() : 'ALL';
|
|
40
|
+
setTagFilterAction({
|
|
41
|
+
tagFilter: verbParam
|
|
42
|
+
});
|
|
43
|
+
}, [location.search]);
|
|
20
44
|
var types = api.typeTags[typeTag];
|
|
21
45
|
useEffect(() => {
|
|
22
46
|
if (!types) {
|
|
23
|
-
|
|
47
|
+
navigateWithGlobalParams("/".concat(specKey, "/types"));
|
|
24
48
|
}
|
|
25
49
|
}, [types]);
|
|
50
|
+
useEffect(() => {
|
|
51
|
+
setTagFilter(selectedTagFilter);
|
|
52
|
+
}, [selectedTagFilter]);
|
|
26
53
|
|
|
27
54
|
if (!types) {
|
|
28
55
|
return React.createElement(React.Fragment, null);
|
|
@@ -33,8 +60,8 @@ export var TypeTagScene = _ref => {
|
|
|
33
60
|
return React.createElement(ApixSection, null, React.createElement(DocTitle, null, "".concat(tag.name, ": ").concat(tag.description)), React.createElement(ButtonToggle, {
|
|
34
61
|
mb: "small",
|
|
35
62
|
mt: "xlarge",
|
|
36
|
-
value:
|
|
37
|
-
onChange:
|
|
63
|
+
value: tagFilter,
|
|
64
|
+
onChange: handleChange
|
|
38
65
|
}, React.createElement(ButtonItem, {
|
|
39
66
|
key: "ALL",
|
|
40
67
|
px: "large",
|
|
@@ -43,9 +70,9 @@ export var TypeTagScene = _ref => {
|
|
|
43
70
|
key: op,
|
|
44
71
|
px: "large",
|
|
45
72
|
py: "xsmall"
|
|
46
|
-
}, op))), Object.values(types).map((type, index) => (
|
|
73
|
+
}, op))), Object.values(types).map((type, index) => (selectedTagFilter === 'ALL' || selectedTagFilter === type.metaType.toString().toUpperCase()) && React.createElement(Link, {
|
|
47
74
|
key: index,
|
|
48
|
-
to: buildTypePath(specKey, tag.name, type.name)
|
|
75
|
+
to: buildPathWithGlobalParams(buildTypePath(specKey, tag.name, type.name))
|
|
49
76
|
}, React.createElement(Grid, {
|
|
50
77
|
columns: 1,
|
|
51
78
|
py: "xsmall"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/scenes/TypeTagScene/TypeTagScene.tsx"],"names":["React","useEffect","useState","Grid","ButtonToggle","ButtonItem","useParams","ApixSection","DocTitle","DocTypeSummary","Link","buildTypePath","useNavigation","getMetaTypes","TypeTagScene","api","specKey","typeTag","navigate","
|
|
1
|
+
{"version":3,"sources":["../../../../src/scenes/TypeTagScene/TypeTagScene.tsx"],"names":["React","useEffect","useState","Grid","ButtonToggle","ButtonItem","useParams","useSelector","ApixSection","DocTitle","DocTypeSummary","Link","buildTypePath","isValidFilter","useNavigation","selectTagFilter","useSettingActions","useTagStoreSync","getMetaTypes","TypeTagScene","api","specKey","typeTag","navigate","buildPathWithGlobalParams","navigateWithGlobalParams","selectedTagFilter","setTagFilterAction","tagFilter","setTagFilter","handleChange","filter","location","pathname","t","toLowerCase","searchParams","URLSearchParams","search","verbParam","get","toUpperCase","types","typeTags","tag","Object","values","spec","tags","find","name","metaTypes","description","map","op","type","index","metaType","toString"],"mappings":"AA0BA,OAAOA,KAAP,IAAgBC,SAAhB,EAA2BC,QAA3B,QAA2C,OAA3C;AACA,SAASC,IAAT,EAAeC,YAAf,EAA6BC,UAA7B,QAA+C,oBAA/C;AAEA,SAASC,SAAT,QAA0B,kBAA1B;AACA,SAASC,WAAT,QAA4B,aAA5B;AACA,SAASC,WAAT,EAAsBC,QAAtB,EAAgCC,cAAhC,EAAgDC,IAAhD,QAA4D,kBAA5D;AACA,SAASC,aAAT,EAAwBC,aAAxB,EAAuCC,aAAvC,QAA4D,aAA5D;AACA,SAASC,eAAT,EAA0BC,iBAA1B,QAAmD,aAAnD;AACA,SAASC,eAAT,QAAgC,UAAhC;AACA,SAASC,YAAT,QAA6B,SAA7B;AAWA,OAAO,IAAMC,YAAmC,GAAG,QAAa;AAAA,MAAZ;AAAEC,IAAAA;AAAF,GAAY;AAC9D,MAAM;AAAEC,IAAAA,OAAF;AAAWC,IAAAA;AAAX,MAAuBhB,SAAS,EAAtC;AACA,MAAM;AAAEiB,IAAAA,QAAF;AAAYC,IAAAA,yBAAZ;AAAuCC,IAAAA;AAAvC,MACJX,aAAa,EADf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,oBAAC,cAAD;AAAgB,IAAA,GAAG,EAAEM,KAArB;AAA4B,IAAA,IAAI,EAAED;AAAlC,IADF,CANF,CAJL,CAjBH,CADF;AAoCD,CA/EM","sourcesContent":["/*\n\n MIT License\n\n Copyright (c) 2021 Looker Data Sciences, Inc.\n\n Permission is hereby granted, free of charge, to any person obtaining a copy\n of this software and associated documentation files (the \"Software\"), to deal\n in the Software without restriction, including without limitation the rights\n to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n copies of the Software, and to permit persons to whom the Software is\n furnished to do so, subject to the following conditions:\n\n The above copyright notice and this permission notice shall be included in all\n copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n SOFTWARE.\n\n */\nimport type { FC } from 'react'\nimport React, { useEffect, useState } from 'react'\nimport { Grid, ButtonToggle, ButtonItem } from '@looker/components'\nimport type { ApiModel } from '@looker/sdk-codegen'\nimport { useParams } from 'react-router-dom'\nimport { useSelector } from 'react-redux'\nimport { ApixSection, DocTitle, DocTypeSummary, Link } from '../../components'\nimport { buildTypePath, isValidFilter, useNavigation } from '../../utils'\nimport { selectTagFilter, useSettingActions } from '../../state'\nimport { useTagStoreSync } from '../utils'\nimport { getMetaTypes } from './utils'\n\ninterface TypeTagSceneProps {\n api: ApiModel\n}\n\ninterface TypeTagSceneParams {\n specKey: string\n typeTag: string\n}\n\nexport const TypeTagScene: FC<TypeTagSceneProps> = ({ api }) => {\n const { specKey, typeTag } = useParams<TypeTagSceneParams>()\n const { navigate, buildPathWithGlobalParams, navigateWithGlobalParams } =\n useNavigation()\n const selectedTagFilter = useSelector(selectTagFilter)\n const { setTagFilterAction } = useSettingActions()\n const [tagFilter, setTagFilter] = useState(selectedTagFilter)\n useTagStoreSync()\n\n const handleChange = (filter: string) => {\n navigate(location.pathname, {\n t: filter === 'ALL' ? null : filter.toLowerCase(),\n })\n }\n\n useEffect(() => {\n const searchParams = new URLSearchParams(location.search)\n let verbParam = searchParams.get('t') || 'ALL'\n verbParam = isValidFilter(location.pathname, verbParam)\n ? verbParam.toUpperCase()\n : 'ALL'\n setTagFilterAction({\n tagFilter: verbParam,\n })\n }, [location.search])\n\n const types = api.typeTags[typeTag]\n useEffect(() => {\n if (!types) {\n navigateWithGlobalParams(`/${specKey}/types`)\n }\n }, [types])\n\n useEffect(() => {\n setTagFilter(selectedTagFilter)\n }, [selectedTagFilter])\n\n if (!types) {\n return <></>\n }\n\n const tag = Object.values(api.spec.tags!).find((tag) => tag.name === typeTag)!\n const metaTypes = getMetaTypes(types)\n return (\n <ApixSection>\n <DocTitle>{`${tag.name}: ${tag.description}`}</DocTitle>\n <ButtonToggle\n mb=\"small\"\n mt=\"xlarge\"\n value={tagFilter}\n onChange={handleChange}\n >\n <ButtonItem key=\"ALL\" px=\"large\" py=\"xsmall\">\n ALL\n </ButtonItem>\n {metaTypes.map((op) => (\n <ButtonItem key={op} px=\"large\" py=\"xsmall\">\n {op}\n </ButtonItem>\n ))}\n </ButtonToggle>\n {Object.values(types).map(\n (type, index) =>\n (selectedTagFilter === 'ALL' ||\n selectedTagFilter === type.metaType.toString().toUpperCase()) && (\n <Link\n key={index}\n to={buildPathWithGlobalParams(\n buildTypePath(specKey, tag.name, type.name)\n )}\n >\n <Grid columns={1} py=\"xsmall\">\n <DocTypeSummary key={index} type={type} />\n </Grid>\n </Link>\n )\n )}\n </ApixSection>\n )\n}\n"],"file":"TypeTagScene.js"}
|
package/lib/esm/scenes/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/scenes/index.ts"],"names":["HomeScene","MethodScene","TypeScene","MethodTagScene","TypeTagScene"],"mappings":"AAyBA,SAASA,SAAT,QAA0B,aAA1B;AACA,SAASC,WAAT,QAA4B,eAA5B;AACA,SAASC,SAAT,QAA0B,aAA1B;AACA,SAASC,cAAT,QAA+B,kBAA/B;AACA,SAASC,YAAT,QAA6B,gBAA7B","sourcesContent":["/*\n\n MIT License\n\n Copyright (c) 2021 Looker Data Sciences, Inc.\n\n Permission is hereby granted, free of charge, to any person obtaining a copy\n of this software and associated documentation files (the \"Software\"), to deal\n in the Software without restriction, including without limitation the rights\n to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n copies of the Software, and to permit persons to whom the Software is\n furnished to do so, subject to the following conditions:\n\n The above copyright notice and this permission notice shall be included in all\n copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n SOFTWARE.\n\n */\nexport { HomeScene } from './HomeScene'\nexport { MethodScene } from './MethodScene'\nexport { TypeScene } from './TypeScene'\nexport { MethodTagScene } from './MethodTagScene'\nexport { TypeTagScene } from './TypeTagScene'\n"],"file":"index.js"}
|
|
1
|
+
{"version":3,"sources":["../../../src/scenes/index.ts"],"names":["ErrorDetailScene","HomeScene","MethodScene","TypeScene","MethodTagScene","TypeTagScene"],"mappings":"AAyBA,SAASA,gBAAT,QAAiC,oBAAjC;AACA,SAASC,SAAT,QAA0B,aAA1B;AACA,SAASC,WAAT,QAA4B,eAA5B;AACA,SAASC,SAAT,QAA0B,aAA1B;AACA,SAASC,cAAT,QAA+B,kBAA/B;AACA,SAASC,YAAT,QAA6B,gBAA7B","sourcesContent":["/*\n\n MIT License\n\n Copyright (c) 2021 Looker Data Sciences, Inc.\n\n Permission is hereby granted, free of charge, to any person obtaining a copy\n of this software and associated documentation files (the \"Software\"), to deal\n in the Software without restriction, including without limitation the rights\n to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n copies of the Software, and to permit persons to whom the Software is\n furnished to do so, subject to the following conditions:\n\n The above copyright notice and this permission notice shall be included in all\n copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n SOFTWARE.\n\n */\nexport { ErrorDetailScene } from './ErrorDetailScene'\nexport { HomeScene } from './HomeScene'\nexport { MethodScene } from './MethodScene'\nexport { TypeScene } from './TypeScene'\nexport { MethodTagScene } from './MethodTagScene'\nexport { TypeTagScene } from './TypeTagScene'\n"],"file":"index.js"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../src/scenes/utils/hooks/index.ts"],"names":["useTagStoreSync"],"mappings":"AA0BA,SAASA,eAAT,QAAgC,gBAAhC","sourcesContent":["/*\n\n MIT License\n\n Copyright (c) 2021 Looker Data Sciences, Inc.\n\n Permission is hereby granted, free of charge, to any person obtaining a copy\n of this software and associated documentation files (the \"Software\"), to deal\n in the Software without restriction, including without limitation the rights\n to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n copies of the Software, and to permit persons to whom the Software is\n furnished to do so, subject to the following conditions:\n\n The above copyright notice and this permission notice shall be included in all\n copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n SOFTWARE.\n\n */\n\nexport { useTagStoreSync } from './tagStoreSync'\n"],"file":"index.js"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { useLocation } from 'react-router-dom';
|
|
2
|
+
import { useSelector } from 'react-redux';
|
|
3
|
+
import { useEffect } from 'react';
|
|
4
|
+
import { selectTagFilter, useSettingActions, useSettingStoreState } from '../../../state';
|
|
5
|
+
import { isValidFilter, useNavigation } from '../../../utils';
|
|
6
|
+
export var useTagStoreSync = () => {
|
|
7
|
+
var location = useLocation();
|
|
8
|
+
var {
|
|
9
|
+
navigate
|
|
10
|
+
} = useNavigation();
|
|
11
|
+
var {
|
|
12
|
+
setTagFilterAction
|
|
13
|
+
} = useSettingActions();
|
|
14
|
+
var {
|
|
15
|
+
initialized
|
|
16
|
+
} = useSettingStoreState();
|
|
17
|
+
var selectedTagFilter = useSelector(selectTagFilter);
|
|
18
|
+
useEffect(() => {
|
|
19
|
+
if (initialized) {
|
|
20
|
+
var params = new URLSearchParams(location.search);
|
|
21
|
+
var verbParam = params.get('t') || 'ALL';
|
|
22
|
+
var validVerbParam = isValidFilter(location.pathname, verbParam);
|
|
23
|
+
|
|
24
|
+
if (validVerbParam) {
|
|
25
|
+
setTagFilterAction({
|
|
26
|
+
tagFilter: verbParam.toUpperCase()
|
|
27
|
+
});
|
|
28
|
+
} else {
|
|
29
|
+
var verb = isValidFilter(location.pathname, selectedTagFilter) ? selectedTagFilter : 'ALL';
|
|
30
|
+
navigate(location.pathname, {
|
|
31
|
+
t: verb === 'ALL' ? null : verb.toLowerCase()
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}, [initialized]);
|
|
36
|
+
};
|
|
37
|
+
//# sourceMappingURL=tagStoreSync.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../src/scenes/utils/hooks/tagStoreSync.ts"],"names":["useLocation","useSelector","useEffect","selectTagFilter","useSettingActions","useSettingStoreState","isValidFilter","useNavigation","useTagStoreSync","location","navigate","setTagFilterAction","initialized","selectedTagFilter","params","URLSearchParams","search","verbParam","get","validVerbParam","pathname","tagFilter","toUpperCase","verb","t","toLowerCase"],"mappings":"AAyBA,SAASA,WAAT,QAA4B,kBAA5B;AACA,SAASC,WAAT,QAA4B,aAA5B;AACA,SAASC,SAAT,QAA0B,OAA1B;AACA,SACEC,eADF,EAEEC,iBAFF,EAGEC,oBAHF,QAIO,gBAJP;AAKA,SAASC,aAAT,EAAwBC,aAAxB,QAA6C,gBAA7C;AAOA,OAAO,IAAMC,eAAe,GAAG,MAAM;AACnC,MAAMC,QAAQ,GAAGT,WAAW,EAA5B;AACA,MAAM;AAAEU,IAAAA;AAAF,MAAeH,aAAa,EAAlC;AACA,MAAM;AAAEI,IAAAA;AAAF,MAAyBP,iBAAiB,EAAhD;AACA,MAAM;AAAEQ,IAAAA;AAAF,MAAkBP,oBAAoB,EAA5C;AACA,MAAMQ,iBAAiB,GAAGZ,WAAW,CAACE,eAAD,CAArC;AAEAD,EAAAA,SAAS,CAAC,MAAM;AACd,QAAIU,WAAJ,EAAiB;AACf,UAAME,MAAM,GAAG,IAAIC,eAAJ,CAAoBN,QAAQ,CAACO,MAA7B,CAAf;AAGA,UAAMC,SAAS,GAAGH,MAAM,CAACI,GAAP,CAAW,GAAX,KAAmB,KAArC;AACA,UAAMC,cAAc,GAAGb,aAAa,CAACG,QAAQ,CAACW,QAAV,EAAoBH,SAApB,CAApC;;AACA,UAAIE,cAAJ,EAAoB;AAClBR,QAAAA,kBAAkB,CAAC;AAAEU,UAAAA,SAAS,EAAEJ,SAAS,CAACK,WAAV;AAAb,SAAD,CAAlB;AACD,OAFD,MAEO;AAEL,YAAMC,IAAI,GAAGjB,aAAa,CAACG,QAAQ,CAACW,QAAV,EAAoBP,iBAApB,CAAb,GACTA,iBADS,GAET,KAFJ;AAGAH,QAAAA,QAAQ,CAACD,QAAQ,CAACW,QAAV,EAAoB;AAC1BI,UAAAA,CAAC,EAAED,IAAI,KAAK,KAAT,GAAiB,IAAjB,GAAwBA,IAAI,CAACE,WAAL;AADD,SAApB,CAAR;AAGD;AACF;AACF,GAnBQ,EAmBN,CAACb,WAAD,CAnBM,CAAT;AAoBD,CA3BM","sourcesContent":["/*\n\n MIT License\n\n Copyright (c) 2022 Looker Data Sciences, Inc.\n\n Permission is hereby granted, free of charge, to any person obtaining a copy\n of this software and associated documentation files (the \"Software\"), to deal\n in the Software without restriction, including without limitation the rights\n to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n copies of the Software, and to permit persons to whom the Software is\n furnished to do so, subject to the following conditions:\n\n The above copyright notice and this permission notice shall be included in all\n copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n SOFTWARE.\n\n */\nimport { useLocation } from 'react-router-dom'\nimport { useSelector } from 'react-redux'\nimport { useEffect } from 'react'\nimport {\n selectTagFilter,\n useSettingActions,\n useSettingStoreState,\n} from '../../../state'\nimport { isValidFilter, useNavigation } from '../../../utils'\n\n/**\n * Hook for syncing tag scene URL params with the Redux store\n *\n * Tag scene specific search parameters: 't'\n */\nexport const useTagStoreSync = () => {\n const location = useLocation()\n const { navigate } = useNavigation()\n const { setTagFilterAction } = useSettingActions()\n const { initialized } = useSettingStoreState()\n const selectedTagFilter = useSelector(selectTagFilter)\n\n useEffect(() => {\n if (initialized) {\n const params = new URLSearchParams(location.search)\n\n // syncing verb filter on tag scene page\n const verbParam = params.get('t') || 'ALL'\n const validVerbParam = isValidFilter(location.pathname, verbParam)\n if (validVerbParam) {\n setTagFilterAction({ tagFilter: verbParam.toUpperCase() })\n } else {\n // must confirm store tag filter param is valid for tag type before updating\n const verb = isValidFilter(location.pathname, selectedTagFilter)\n ? selectedTagFilter\n : 'ALL'\n navigate(location.pathname, {\n t: verb === 'ALL' ? null : verb.toLowerCase(),\n })\n }\n }\n }, [initialized])\n}\n"],"file":"tagStoreSync.js"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/scenes/utils/index.ts"],"names":["useTagStoreSync"],"mappings":"AA0BA,SAASA,eAAT,QAAgC,SAAhC","sourcesContent":["/*\n\n MIT License\n\n Copyright (c) 2021 Looker Data Sciences, Inc.\n\n Permission is hereby granted, free of charge, to any person obtaining a copy\n of this software and associated documentation files (the \"Software\"), to deal\n in the Software without restriction, including without limitation the rights\n to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n copies of the Software, and to permit persons to whom the Software is\n furnished to do so, subject to the following conditions:\n\n The above copyright notice and this permission notice shall be included in all\n copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n SOFTWARE.\n\n */\n\nexport { useTagStoreSync } from './hooks'\n"],"file":"index.js"}
|
|
@@ -3,5 +3,6 @@ var selectSettingsState = state => state.settings;
|
|
|
3
3
|
export var selectSdkLanguage = state => selectSettingsState(state).sdkLanguage;
|
|
4
4
|
export var selectSearchPattern = state => selectSettingsState(state).searchPattern;
|
|
5
5
|
export var selectSearchCriteria = state => selectSettingsState(state).searchCriteria;
|
|
6
|
+
export var selectTagFilter = state => selectSettingsState(state).tagFilter;
|
|
6
7
|
export var isInitialized = state => selectSettingsState(state).initialized;
|
|
7
8
|
//# sourceMappingURL=selectors.js.map
|