@api-client/ui 0.0.5 → 0.0.8
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/demo/elements/http/http-assertions.html +3 -0
- package/demo/elements/http/http-assertions.ts +1 -1
- package/demo/elements/http/http-flows.html +23 -0
- package/demo/elements/http/http-flows.ts +92 -0
- package/demo/elements/http/index.html +3 -0
- package/demo/pages/http-project/main.ts +5 -6
- package/dist/bindings/base/StoreBindings.js +4 -4
- package/dist/bindings/base/StoreBindings.js.map +1 -1
- package/dist/define/dialog/delete-cookie-action-dialog.d.ts +10 -0
- package/dist/define/dialog/delete-cookie-action-dialog.d.ts.map +1 -0
- package/dist/define/dialog/delete-cookie-action-dialog.js +14 -0
- package/dist/define/dialog/delete-cookie-action-dialog.js.map +1 -0
- package/dist/define/dialog/set-cookie-action-dialog.d.ts +10 -0
- package/dist/define/dialog/set-cookie-action-dialog.d.ts.map +1 -0
- package/dist/define/dialog/set-cookie-action-dialog.js +14 -0
- package/dist/define/dialog/set-cookie-action-dialog.js.map +1 -0
- package/dist/define/http/http-assertions.d.ts +1 -1
- package/dist/define/http/http-assertions.d.ts.map +1 -1
- package/dist/define/http/http-assertions.js +3 -3
- package/dist/define/http/http-assertions.js.map +1 -1
- package/dist/define/http/http-flows.d.ts +10 -0
- package/dist/define/http/http-flows.d.ts.map +1 -0
- package/dist/define/http/http-flows.js +13 -0
- package/dist/define/http/http-flows.js.map +1 -0
- package/dist/define/ui/ui-divider.d.ts +4 -1
- package/dist/define/ui/ui-divider.d.ts.map +1 -1
- package/dist/define/ui/ui-divider.js +11 -2
- package/dist/define/ui/ui-divider.js.map +1 -1
- package/dist/elements/ApiElement.d.ts +4 -0
- package/dist/elements/ApiElement.d.ts.map +1 -1
- package/dist/elements/ApiElement.js +6 -0
- package/dist/elements/ApiElement.js.map +1 -1
- package/dist/elements/amf/ApiAuthorizationEditor.element.js +1 -1
- package/dist/elements/amf/ApiAuthorizationEditor.element.js.map +1 -1
- package/dist/elements/amf/ApiOperationDocument.element.d.ts.map +1 -1
- package/dist/elements/amf/ApiOperationDocument.element.js +2 -1
- package/dist/elements/amf/ApiOperationDocument.element.js.map +1 -1
- package/dist/elements/amf/ApiRequest.element.js +1 -1
- package/dist/elements/amf/ApiRequest.element.js.map +1 -1
- package/dist/elements/amf/ApiRequestEditor.element.d.ts +0 -1
- package/dist/elements/amf/ApiRequestEditor.element.d.ts.map +1 -1
- package/dist/elements/amf/ApiRequestEditor.element.js +0 -3
- package/dist/elements/amf/ApiRequestEditor.element.js.map +1 -1
- package/dist/elements/authorization/ui/Authorization.d.ts +2 -1
- package/dist/elements/authorization/ui/Authorization.d.ts.map +1 -1
- package/dist/elements/authorization/ui/Authorization.js +0 -3
- package/dist/elements/authorization/ui/Authorization.js.map +1 -1
- package/dist/elements/dialog/DeleteCookieAction.element.d.ts +20 -0
- package/dist/elements/dialog/DeleteCookieAction.element.d.ts.map +1 -0
- package/dist/elements/dialog/DeleteCookieAction.element.js +93 -0
- package/dist/elements/dialog/DeleteCookieAction.element.js.map +1 -0
- package/dist/elements/dialog/DeleteCookieAction.styles.d.ts +3 -0
- package/dist/elements/dialog/DeleteCookieAction.styles.d.ts.map +1 -0
- package/dist/elements/dialog/DeleteCookieAction.styles.js +13 -0
- package/dist/elements/dialog/DeleteCookieAction.styles.js.map +1 -0
- package/dist/elements/dialog/Rename.d.ts +7 -6
- package/dist/elements/dialog/Rename.d.ts.map +1 -1
- package/dist/elements/dialog/Rename.js +7 -6
- package/dist/elements/dialog/Rename.js.map +1 -1
- package/dist/elements/dialog/SetCookieAction.element.d.ts +22 -0
- package/dist/elements/dialog/SetCookieAction.element.d.ts.map +1 -0
- package/dist/elements/dialog/SetCookieAction.element.js +173 -0
- package/dist/elements/dialog/SetCookieAction.element.js.map +1 -0
- package/dist/elements/environment/EnvironmentEditor.d.ts +24 -3
- package/dist/elements/environment/EnvironmentEditor.d.ts.map +1 -1
- package/dist/elements/environment/EnvironmentEditor.js +69 -23
- package/dist/elements/environment/EnvironmentEditor.js.map +1 -1
- package/dist/elements/environment/EnvironmentEditor.styles.d.ts.map +1 -1
- package/dist/elements/environment/EnvironmentEditor.styles.js +5 -0
- package/dist/elements/environment/EnvironmentEditor.styles.js.map +1 -1
- package/dist/elements/environment/ServerEditor.d.ts +3 -3
- package/dist/elements/environment/ServerEditor.d.ts.map +1 -1
- package/dist/elements/environment/ServerEditor.js +3 -6
- package/dist/elements/environment/ServerEditor.js.map +1 -1
- package/dist/elements/environment/VariablesEditor.d.ts +0 -1
- package/dist/elements/environment/VariablesEditor.d.ts.map +1 -1
- package/dist/elements/environment/VariablesEditor.js +3 -6
- package/dist/elements/environment/VariablesEditor.js.map +1 -1
- package/dist/elements/highlight/Prism.styles.d.ts.map +1 -1
- package/dist/elements/highlight/Prism.styles.js +12 -5
- package/dist/elements/highlight/Prism.styles.js.map +1 -1
- package/dist/elements/http/BodyEditor.d.ts +0 -4
- package/dist/elements/http/BodyEditor.d.ts.map +1 -1
- package/dist/elements/http/BodyEditor.js +10 -16
- package/dist/elements/http/BodyEditor.js.map +1 -1
- package/dist/elements/http/BodyMultipartEditor.d.ts +3 -16
- package/dist/elements/http/BodyMultipartEditor.d.ts.map +1 -1
- package/dist/elements/http/BodyMultipartEditor.js +3 -19
- package/dist/elements/http/BodyMultipartEditor.js.map +1 -1
- package/dist/elements/http/BodyTextEditor.d.ts +0 -1
- package/dist/elements/http/BodyTextEditor.d.ts.map +1 -1
- package/dist/elements/http/BodyTextEditor.js +0 -3
- package/dist/elements/http/BodyTextEditor.js.map +1 -1
- package/dist/elements/http/BodyUrlEncodedEditor.d.ts +3 -3
- package/dist/elements/http/BodyUrlEncodedEditor.d.ts.map +1 -1
- package/dist/elements/http/BodyUrlEncodedEditor.js +3 -5
- package/dist/elements/http/BodyUrlEncodedEditor.js.map +1 -1
- package/dist/elements/http/HeadersForm.d.ts +0 -4
- package/dist/elements/http/HeadersForm.d.ts.map +1 -1
- package/dist/elements/http/HeadersForm.js +0 -6
- package/dist/elements/http/HeadersForm.js.map +1 -1
- package/dist/elements/http/HttpAssertions.element.d.ts +55 -0
- package/dist/elements/http/HttpAssertions.element.d.ts.map +1 -0
- package/dist/elements/http/HttpAssertions.element.js +264 -0
- package/dist/elements/http/HttpAssertions.element.js.map +1 -0
- package/dist/elements/http/HttpAssertions.styles.d.ts.map +1 -1
- package/dist/elements/http/HttpAssertions.styles.js +7 -156
- package/dist/elements/http/HttpAssertions.styles.js.map +1 -1
- package/dist/elements/http/HttpFlows.common.d.ts +3 -0
- package/dist/elements/http/HttpFlows.common.d.ts.map +1 -0
- package/dist/elements/http/HttpFlows.common.js +181 -0
- package/dist/elements/http/HttpFlows.common.js.map +1 -0
- package/dist/elements/http/HttpFlows.element.d.ts +97 -0
- package/dist/elements/http/HttpFlows.element.d.ts.map +1 -0
- package/dist/elements/http/HttpFlows.element.js +684 -0
- package/dist/elements/http/HttpFlows.element.js.map +1 -0
- package/dist/elements/http/HttpFlows.styles.d.ts +3 -0
- package/dist/elements/http/HttpFlows.styles.d.ts.map +1 -0
- package/dist/elements/http/HttpFlows.styles.js +28 -0
- package/dist/elements/http/HttpFlows.styles.js.map +1 -0
- package/dist/elements/http/HttpFlowsUi.d.ts +172 -0
- package/dist/elements/http/HttpFlowsUi.d.ts.map +1 -0
- package/dist/elements/http/HttpFlowsUi.js +1256 -0
- package/dist/elements/http/HttpFlowsUi.js.map +1 -0
- package/dist/elements/http/RequestConfigElement.d.ts +0 -1
- package/dist/elements/http/RequestConfigElement.d.ts.map +1 -1
- package/dist/elements/http/RequestConfigElement.js +8 -11
- package/dist/elements/http/RequestConfigElement.js.map +1 -1
- package/dist/elements/http/RequestEditor.d.ts +10 -10
- package/dist/elements/http/RequestEditor.d.ts.map +1 -1
- package/dist/elements/http/RequestEditor.js +62 -23
- package/dist/elements/http/RequestEditor.js.map +1 -1
- package/dist/elements/http/UrlInput.d.ts +3 -3
- package/dist/elements/http/UrlInput.d.ts.map +1 -1
- package/dist/elements/http/UrlInput.js +2 -2
- package/dist/elements/http/UrlInput.js.map +1 -1
- package/dist/elements/http/UrlParamsForm.d.ts +0 -1
- package/dist/elements/http/UrlParamsForm.d.ts.map +1 -1
- package/dist/elements/http/UrlParamsForm.js +0 -3
- package/dist/elements/http/UrlParamsForm.js.map +1 -1
- package/dist/elements/layout/SplitView.styles.d.ts.map +1 -1
- package/dist/elements/layout/SplitView.styles.js +1 -0
- package/dist/elements/layout/SplitView.styles.js.map +1 -1
- package/dist/elements/navigation/AppNavigationItem.styles.d.ts.map +1 -1
- package/dist/elements/navigation/AppNavigationItem.styles.js +2 -0
- package/dist/elements/navigation/AppNavigationItem.styles.js.map +1 -1
- package/dist/elements/project/HttpProjectRequest.d.ts +2 -1
- package/dist/elements/project/HttpProjectRequest.d.ts.map +1 -1
- package/dist/elements/project/HttpProjectRequest.js +14 -5
- package/dist/elements/project/HttpProjectRequest.js.map +1 -1
- package/dist/elements/project/ProjectRunner.d.ts +0 -1
- package/dist/elements/project/ProjectRunner.d.ts.map +1 -1
- package/dist/elements/project/ProjectRunner.js +1 -4
- package/dist/elements/project/ProjectRunner.js.map +1 -1
- package/dist/elements/schema-design/AssociationFormElement.d.ts +0 -1
- package/dist/elements/schema-design/AssociationFormElement.d.ts.map +1 -1
- package/dist/elements/schema-design/AssociationFormElement.js +2 -5
- package/dist/elements/schema-design/AssociationFormElement.js.map +1 -1
- package/dist/elements/schema-design/DataEntityEditorElement.d.ts +2 -2
- package/dist/elements/schema-design/DataEntityEditorElement.d.ts.map +1 -1
- package/dist/elements/schema-design/DataEntityEditorElement.js +5 -5
- package/dist/elements/schema-design/DataEntityEditorElement.js.map +1 -1
- package/dist/elements/schema-design/DataSchemaDocument.d.ts +0 -1
- package/dist/elements/schema-design/DataSchemaDocument.d.ts.map +1 -1
- package/dist/elements/schema-design/DataSchemaDocument.js +4 -7
- package/dist/elements/schema-design/DataSchemaDocument.js.map +1 -1
- package/dist/elements/schema-design/EntityFormElement.d.ts +0 -1
- package/dist/elements/schema-design/EntityFormElement.d.ts.map +1 -1
- package/dist/elements/schema-design/EntityFormElement.js +4 -7
- package/dist/elements/schema-design/EntityFormElement.js.map +1 -1
- package/dist/elements/schema-design/PropertyFormElement.d.ts +1 -2
- package/dist/elements/schema-design/PropertyFormElement.d.ts.map +1 -1
- package/dist/elements/schema-design/PropertyFormElement.js +8 -11
- package/dist/elements/schema-design/PropertyFormElement.js.map +1 -1
- package/dist/pages/ApplicationScreen.d.ts +1 -1
- package/dist/pages/ApplicationScreen.d.ts.map +1 -1
- package/dist/pages/ApplicationScreen.js +1 -1
- package/dist/pages/ApplicationScreen.js.map +1 -1
- package/dist/pages/api-client/ApiClient.styles.d.ts.map +1 -1
- package/dist/pages/api-client/ApiClient.styles.js +22 -3
- package/dist/pages/api-client/ApiClient.styles.js.map +1 -1
- package/dist/pages/api-client/Authenticate.screen.d.ts +2 -0
- package/dist/pages/api-client/Authenticate.screen.d.ts.map +1 -1
- package/dist/pages/api-client/Authenticate.screen.js +19 -3
- package/dist/pages/api-client/Authenticate.screen.js.map +1 -1
- package/dist/pages/api-client/StoreConfig.screen.d.ts.map +1 -1
- package/dist/pages/api-client/StoreConfig.screen.js +4 -2
- package/dist/pages/api-client/StoreConfig.screen.js.map +1 -1
- package/dist/pages/api-client/StoreConfig.styles.d.ts.map +1 -1
- package/dist/pages/api-client/StoreConfig.styles.js +5 -0
- package/dist/pages/api-client/StoreConfig.styles.js.map +1 -1
- package/dist/pages/api-client/pages/Files.page.d.ts +1 -0
- package/dist/pages/api-client/pages/Files.page.d.ts.map +1 -1
- package/dist/pages/api-client/pages/Files.page.js +2 -1
- package/dist/pages/api-client/pages/Files.page.js.map +1 -1
- package/dist/pages/http-project/HttpProject.screen.d.ts +0 -8
- package/dist/pages/http-project/HttpProject.screen.d.ts.map +1 -1
- package/dist/pages/http-project/HttpProject.screen.js +14 -15
- package/dist/pages/http-project/HttpProject.screen.js.map +1 -1
- package/dist/pages/http-project/types.d.ts +8 -6
- package/dist/pages/http-project/types.d.ts.map +1 -1
- package/dist/pages/http-project/types.js.map +1 -1
- package/dist/styles/m3/surface.module.d.ts.map +1 -1
- package/dist/styles/m3/surface.module.js +11 -27
- package/dist/styles/m3/surface.module.js.map +1 -1
- package/dist/ui/UiElement.d.ts +4 -0
- package/dist/ui/UiElement.d.ts.map +1 -1
- package/dist/ui/UiElement.js +6 -0
- package/dist/ui/UiElement.js.map +1 -1
- package/dist/ui/button/SegmentedButton.styles.d.ts.map +1 -1
- package/dist/ui/button/SegmentedButton.styles.js +3 -1
- package/dist/ui/button/SegmentedButton.styles.js.map +1 -1
- package/dist/ui/dialog/UiDialog.d.ts +3 -0
- package/dist/ui/dialog/UiDialog.d.ts.map +1 -1
- package/dist/ui/dialog/UiDialog.js +3 -0
- package/dist/ui/dialog/UiDialog.js.map +1 -1
- package/dist/ui/effects/ripple.d.ts.map +1 -1
- package/dist/ui/effects/ripple.js +5 -1
- package/dist/ui/effects/ripple.js.map +1 -1
- package/dist/ui/icons/Icons.d.ts +3 -2
- package/dist/ui/icons/Icons.d.ts.map +1 -1
- package/dist/ui/icons/Icons.js +2 -1
- package/dist/ui/icons/Icons.js.map +1 -1
- package/dist/ui/input/CheckedElement.d.ts +1 -1
- package/dist/ui/input/CheckedElement.d.ts.map +1 -1
- package/dist/ui/input/CheckedElement.js +3 -3
- package/dist/ui/input/CheckedElement.js.map +1 -1
- package/dist/ui/input/Input.js +1 -1
- package/dist/ui/input/Input.js.map +1 -1
- package/dist/ui/list/{DividerElement.d.ts → UiDivider.element.d.ts} +6 -6
- package/dist/ui/list/UiDivider.element.d.ts.map +1 -0
- package/dist/ui/list/UiDivider.element.js +39 -0
- package/dist/ui/list/UiDivider.element.js.map +1 -0
- package/dist/ui/list/UiDivider.styles.d.ts +3 -0
- package/dist/ui/list/UiDivider.styles.d.ts.map +1 -0
- package/dist/ui/list/UiDivider.styles.js +49 -0
- package/dist/ui/list/UiDivider.styles.js.map +1 -0
- package/dist/ui/tabs/UiTabs.d.ts +13 -1
- package/dist/ui/tabs/UiTabs.d.ts.map +1 -1
- package/dist/ui/tabs/UiTabs.js +42 -13
- package/dist/ui/tabs/UiTabs.js.map +1 -1
- package/package.json +1 -1
- package/src/bindings/base/StoreBindings.ts +4 -4
- package/src/define/dialog/delete-cookie-action-dialog.ts +16 -0
- package/src/define/dialog/set-cookie-action-dialog.ts +16 -0
- package/src/define/http/http-assertions.ts +3 -3
- package/src/define/http/http-flows.ts +15 -0
- package/src/define/ui/ui-divider.ts +7 -2
- package/src/elements/ApiElement.ts +7 -0
- package/src/elements/amf/ApiAuthorizationEditor.element.ts +1 -1
- package/src/elements/amf/ApiOperationDocument.element.ts +2 -1
- package/src/elements/amf/ApiRequest.element.ts +1 -1
- package/src/elements/amf/ApiRequestEditor.element.ts +0 -4
- package/src/elements/authorization/ui/Authorization.ts +3 -5
- package/src/elements/dialog/DeleteCookieAction.element.ts +100 -0
- package/src/elements/dialog/DeleteCookieAction.styles.ts +14 -0
- package/src/elements/dialog/Rename.ts +8 -7
- package/src/elements/dialog/SetCookieAction.element.ts +183 -0
- package/src/elements/environment/EnvironmentEditor.styles.ts +5 -0
- package/src/elements/environment/EnvironmentEditor.ts +81 -22
- package/src/elements/environment/ServerEditor.ts +4 -8
- package/src/elements/environment/VariablesEditor.ts +3 -7
- package/src/elements/highlight/Prism.styles.ts +12 -5
- package/src/elements/http/BodyEditor.ts +10 -17
- package/src/elements/http/BodyMultipartEditor.ts +3 -20
- package/src/elements/http/BodyTextEditor.ts +0 -4
- package/src/elements/http/BodyUrlEncodedEditor.ts +5 -8
- package/src/elements/http/HeadersForm.ts +2 -9
- package/src/elements/http/HttpAssertions.element.ts +286 -0
- package/src/elements/http/HttpAssertions.styles.ts +7 -156
- package/src/elements/http/HttpFlows.common.ts +181 -0
- package/src/elements/http/HttpFlows.element.ts +722 -0
- package/src/elements/http/HttpFlows.styles.ts +29 -0
- package/src/elements/http/HttpFlowsUi.ts +1327 -0
- package/src/elements/http/RequestConfigElement.ts +10 -14
- package/src/elements/http/RequestEditor.ts +77 -35
- package/src/elements/http/UrlInput.ts +6 -6
- package/src/elements/http/UrlParamsForm.ts +2 -6
- package/src/elements/layout/SplitView.styles.ts +1 -0
- package/src/elements/navigation/AppNavigationItem.styles.ts +2 -0
- package/src/elements/project/HttpProjectRequest.ts +16 -5
- package/src/elements/project/ProjectRunner.ts +3 -7
- package/src/elements/schema-design/AssociationFormElement.ts +4 -8
- package/src/elements/schema-design/DataEntityEditorElement.ts +8 -8
- package/src/elements/schema-design/DataSchemaDocument.ts +5 -9
- package/src/elements/schema-design/EntityFormElement.ts +6 -10
- package/src/elements/schema-design/PropertyFormElement.ts +11 -15
- package/src/pages/ApplicationScreen.ts +1 -1
- package/src/pages/api-client/ApiClient.styles.ts +22 -3
- package/src/pages/api-client/Authenticate.screen.ts +19 -3
- package/src/pages/api-client/StoreConfig.screen.ts +4 -2
- package/src/pages/api-client/StoreConfig.styles.ts +5 -0
- package/src/pages/api-client/pages/Files.page.ts +2 -1
- package/src/pages/http-project/HttpProject.screen.ts +14 -26
- package/src/pages/http-project/types.ts +8 -6
- package/src/styles/m3/surface.module.ts +11 -27
- package/src/styles/m3/theme.css +36 -0
- package/src/styles/m3/tokens.css +11 -0
- package/src/ui/UiElement.ts +7 -0
- package/src/ui/button/SegmentedButton.styles.ts +3 -1
- package/src/ui/dialog/UiDialog.ts +3 -0
- package/src/ui/effects/ripple.ts +6 -1
- package/src/ui/icons/Icons.ts +3 -2
- package/src/ui/input/CheckedElement.ts +3 -3
- package/src/ui/input/Input.ts +1 -1
- package/src/ui/list/UiDivider.element.ts +41 -0
- package/src/ui/list/UiDivider.styles.ts +49 -0
- package/src/ui/tabs/UiTabs.ts +55 -13
- package/test/amf/authorization/OAuth2Method.test.ts +1 -1
- package/test/elements/http/HttpAssertions.test.ts +5 -6
- package/test/elements/http/HttpFlows.test.ts +485 -0
- package/dist/elements/http/HttpAssertions.d.ts +0 -114
- package/dist/elements/http/HttpAssertions.d.ts.map +0 -1
- package/dist/elements/http/HttpAssertions.js +0 -1146
- package/dist/elements/http/HttpAssertions.js.map +0 -1
- package/dist/elements/http/internals.d.ts +0 -150
- package/dist/elements/http/internals.d.ts.map +0 -1
- package/dist/elements/http/internals.js +0 -150
- package/dist/elements/http/internals.js.map +0 -1
- package/dist/ui/list/DividerElement.d.ts.map +0 -1
- package/dist/ui/list/DividerElement.js +0 -82
- package/dist/ui/list/DividerElement.js.map +0 -1
- package/src/elements/http/HttpAssertions.ts +0 -1187
- package/src/elements/http/internals.ts +0 -151
- package/src/http-client/docs/Files.md +0 -28
- package/src/ui/list/DividerElement.ts +0 -84
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EnvironmentEditor.d.ts","sourceRoot":"","sources":["../../../src/elements/environment/EnvironmentEditor.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"EnvironmentEditor.d.ts","sourceRoot":"","sources":["../../../src/elements/environment/EnvironmentEditor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,cAAc,EAAE,SAAS,EAAE,MAAM,KAAK,CAAC;AAEtD,OAAO,EAAE,YAAY,EAAe,OAAO,EAAU,SAAS,EAAE,qBAAqB,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAC;AAE1K,OAAO,UAAU,MAAM,kBAAkB,CAAC;AAS1C,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,2CAA2C,CAAC;AACnD,OAAO,8CAA8C,CAAC;AACtD,OAAO,4BAA4B,CAAC;AACpC,OAAO,kCAAkC,CAAC;AAC1C,OAAO,8BAA8B,CAAC;AACtC,OAAO,mCAAmC,CAAC;AAC3C,OAAO,8BAA8B,CAAC;AACtC,OAAO,+BAA+B,CAAC;AACvC,OAAO,4BAA4B,CAAC;AACpC,OAAO,2BAA2B,CAAC;AACnC,OAAO,mDAAmD,CAAC;AAC3D,OAAO,oDAAoD,CAAC;AAC5D,OAAO,kD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qB,GAAG,cAAc;IAahF,SAAS,CAAC,uBAAuB,CAAC,IAAI,EAAE,qBAAqB,GAAG,cAAc;IAa9E,SAAS,CAAC,wBAAwB,CAAC,IAAI,EAAE,qBAAqB,GAAG,cAAc;IAc/E,SAAS,CAAC,uBAAuB,CAAC,IAAI,EAAE,qBAAqB,GAAG,cAAc;IAc9E,SAAS,CAAC,qBAAqB,CAAC,IAAI,EAAE,qBAAqB,GAAG,cAAc;IAa5E,SAAS,CAAC,yBAAyB,CAAC,IAAI,EAAE,qBAAqB,GAAG,cAAc;IAahF,SAAS,CAAC,UAAU,IAAI,cAAc;CASvC"}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { __decorate } from "tslib";
|
|
2
|
-
|
|
3
|
-
import { LitElement, html } from 'lit';
|
|
2
|
+
import { html } from 'lit';
|
|
4
3
|
import { property, state } from 'lit/decorators.js';
|
|
5
4
|
import { Environment, Server, RequestAuthorization } from '@api-client/core/build/browser.js';
|
|
6
5
|
import { live } from 'lit/directives/live.js';
|
|
6
|
+
import ApiElement from '../ApiElement.js';
|
|
7
7
|
import { Events } from '../../events/Events.js';
|
|
8
8
|
import elementStyles from './EnvironmentEditor.styles.js';
|
|
9
|
+
import { authTypeToLabel } from '../authorization/AuthLabels.js';
|
|
9
10
|
import '../../define/environment/server-editor.js';
|
|
10
11
|
import '../../define/environment/variables-editor.js';
|
|
11
12
|
import '../../define/ui/ui-icon.js';
|
|
@@ -14,21 +15,30 @@ import '../../define/ui/ui-switch.js';
|
|
|
14
15
|
import '../../define/ui/ui-icon-button.js';
|
|
15
16
|
import '../../define/ui/ui-button.js';
|
|
16
17
|
import '../../define/ui/ui-divider.js';
|
|
17
|
-
import
|
|
18
|
+
import '../../define/ui/ui-tabs.js';
|
|
19
|
+
import '../../define/ui/ui-tab.js';
|
|
20
|
+
import '../../define/authorization/basic-authorization.js';
|
|
21
|
+
import '../../define/authorization/bearer-authorization.js';
|
|
22
|
+
import '../../define/authorization/ntlm-authorization.js';
|
|
23
|
+
import '../../define/authorization/apikey-authorization.js';
|
|
24
|
+
import '../../define/authorization/oauth2-authorization.js';
|
|
25
|
+
import '../../define/authorization/oidc-authorization.js';
|
|
26
|
+
import '../../define/authorization/cc-authorization.js';
|
|
18
27
|
/**
|
|
19
28
|
* An element that renders a form to set up an environment.
|
|
20
29
|
*/
|
|
21
|
-
export default class EnvironmentEditor extends
|
|
30
|
+
export default class EnvironmentEditor extends ApiElement {
|
|
31
|
+
static get styles() {
|
|
32
|
+
return [elementStyles];
|
|
33
|
+
}
|
|
22
34
|
constructor() {
|
|
23
|
-
super(
|
|
35
|
+
super();
|
|
24
36
|
/**
|
|
25
37
|
* The environment schema to edit.
|
|
26
38
|
*/
|
|
27
39
|
this.environment = new Environment().toJSON();
|
|
28
40
|
this.encapsulateHelp = false;
|
|
29
|
-
|
|
30
|
-
static get styles() {
|
|
31
|
-
return [elementStyles];
|
|
41
|
+
this.selected = 'server';
|
|
32
42
|
}
|
|
33
43
|
updateName(value) {
|
|
34
44
|
this.environment.info.name = value;
|
|
@@ -55,9 +65,6 @@ export default class EnvironmentEditor extends LitElement {
|
|
|
55
65
|
node.generateValue();
|
|
56
66
|
}
|
|
57
67
|
}
|
|
58
|
-
notifyChange() {
|
|
59
|
-
this.dispatchEvent(new Event('change'));
|
|
60
|
-
}
|
|
61
68
|
handleServerChange(e) {
|
|
62
69
|
const editor = e.target;
|
|
63
70
|
const value = editor.getSchema();
|
|
@@ -165,21 +172,32 @@ export default class EnvironmentEditor extends LitElement {
|
|
|
165
172
|
this.notifyChange();
|
|
166
173
|
this.requestUpdate();
|
|
167
174
|
}
|
|
175
|
+
handleTabSelection(e) {
|
|
176
|
+
const { item } = e.detail;
|
|
177
|
+
const { page } = item.dataset;
|
|
178
|
+
if (!page) {
|
|
179
|
+
return;
|
|
180
|
+
}
|
|
181
|
+
this.selected = page;
|
|
182
|
+
}
|
|
168
183
|
render() {
|
|
169
184
|
return html `
|
|
170
185
|
${this.renderHeader()}
|
|
171
186
|
${this.renderEnvironmentEditor()}
|
|
172
|
-
|
|
173
|
-
${this.
|
|
174
|
-
<ui-divider></ui-divider>
|
|
175
|
-
${this.renderVariables()}
|
|
176
|
-
<ui-divider></ui-divider>
|
|
177
|
-
${this.renderAuthorization()}
|
|
187
|
+
${this.renderTabs()}
|
|
188
|
+
${this.renderPage()}
|
|
178
189
|
`;
|
|
179
190
|
}
|
|
180
191
|
renderHeader() {
|
|
181
192
|
return html `<div class="section-title">Environment</div>`;
|
|
182
193
|
}
|
|
194
|
+
renderPage() {
|
|
195
|
+
switch (this.selected) {
|
|
196
|
+
case 'authorization': return this.renderAuthorization();
|
|
197
|
+
case 'variables': return this.renderVariables();
|
|
198
|
+
default: return this.renderServerTemplate();
|
|
199
|
+
}
|
|
200
|
+
}
|
|
183
201
|
renderEnvironmentEditor() {
|
|
184
202
|
return html `
|
|
185
203
|
<section aria-label="Environment configuration">
|
|
@@ -242,7 +260,7 @@ export default class EnvironmentEditor extends LitElement {
|
|
|
242
260
|
renderServerTemplate() {
|
|
243
261
|
const { server } = this.environment;
|
|
244
262
|
return html `
|
|
245
|
-
<section aria-label="Server information">
|
|
263
|
+
<section aria-label="Server information" id="server" class="editor-container">
|
|
246
264
|
${server ? this.renderServerEditor(server) : this.renderNoServer()}
|
|
247
265
|
</section>
|
|
248
266
|
`;
|
|
@@ -270,7 +288,7 @@ export default class EnvironmentEditor extends LitElement {
|
|
|
270
288
|
}
|
|
271
289
|
renderVariables() {
|
|
272
290
|
return html `
|
|
273
|
-
<section aria-label="Variables">
|
|
291
|
+
<section aria-label="Variables" id="variables" class="editor-container">
|
|
274
292
|
${this.renderVariablesEditor()}
|
|
275
293
|
</section>
|
|
276
294
|
`;
|
|
@@ -282,10 +300,12 @@ export default class EnvironmentEditor extends LitElement {
|
|
|
282
300
|
renderAuthorization() {
|
|
283
301
|
const { authorization = [] } = this.environment;
|
|
284
302
|
return html `
|
|
285
|
-
<
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
303
|
+
<section id="authorization" aria-label="Authorization" class="editor-container">
|
|
304
|
+
<div class="section-title">Authorization</div>
|
|
305
|
+
<p class="auth-info">The authorization is applied to all requests in the current folder when the request is executed.</p>
|
|
306
|
+
${this.renderAuthorizationActions(authorization)}
|
|
307
|
+
${this.renderAuthorizationList(authorization)}
|
|
308
|
+
</section>
|
|
289
309
|
`;
|
|
290
310
|
}
|
|
291
311
|
renderAuthorizationActions(current = []) {
|
|
@@ -370,6 +390,8 @@ export default class EnvironmentEditor extends LitElement {
|
|
|
370
390
|
<basic-authorization
|
|
371
391
|
.authorization="${auth}"
|
|
372
392
|
class="auth-panel"
|
|
393
|
+
canDelete
|
|
394
|
+
canToggle
|
|
373
395
|
@change="${this.handleAuthChange}"
|
|
374
396
|
@delete="${this.handleAuthDelete}"
|
|
375
397
|
></basic-authorization>
|
|
@@ -380,6 +402,8 @@ export default class EnvironmentEditor extends LitElement {
|
|
|
380
402
|
<bearer-authorization
|
|
381
403
|
.authorization="${auth}"
|
|
382
404
|
class="auth-panel"
|
|
405
|
+
canDelete
|
|
406
|
+
canToggle
|
|
383
407
|
@change="${this.handleAuthChange}"
|
|
384
408
|
@delete="${this.handleAuthDelete}"
|
|
385
409
|
></bearer-authorization>
|
|
@@ -390,6 +414,8 @@ export default class EnvironmentEditor extends LitElement {
|
|
|
390
414
|
<ntlm-authorization
|
|
391
415
|
.authorization="${auth}"
|
|
392
416
|
class="auth-panel"
|
|
417
|
+
canDelete
|
|
418
|
+
canToggle
|
|
393
419
|
@change="${this.handleAuthChange}"
|
|
394
420
|
@delete="${this.handleAuthDelete}"
|
|
395
421
|
></ntlm-authorization>
|
|
@@ -400,6 +426,8 @@ export default class EnvironmentEditor extends LitElement {
|
|
|
400
426
|
<oauth2-authorization
|
|
401
427
|
.authorization="${auth}"
|
|
402
428
|
class="auth-panel"
|
|
429
|
+
canDelete
|
|
430
|
+
canToggle
|
|
403
431
|
@change="${this.handleAuthChange}"
|
|
404
432
|
@delete="${this.handleAuthDelete}"
|
|
405
433
|
.defaultRedirectUri="${this.oauth2RedirectUri}"
|
|
@@ -411,6 +439,8 @@ export default class EnvironmentEditor extends LitElement {
|
|
|
411
439
|
<oidc-authorization
|
|
412
440
|
.authorization="${auth}"
|
|
413
441
|
class="auth-panel"
|
|
442
|
+
canDelete
|
|
443
|
+
canToggle
|
|
414
444
|
@change="${this.handleAuthChange}"
|
|
415
445
|
@delete="${this.handleAuthDelete}"
|
|
416
446
|
.defaultRedirectUri="${this.oauth2RedirectUri}"
|
|
@@ -422,6 +452,8 @@ export default class EnvironmentEditor extends LitElement {
|
|
|
422
452
|
<cc-authorization
|
|
423
453
|
.authorization="${auth}"
|
|
424
454
|
class="auth-panel"
|
|
455
|
+
canDelete
|
|
456
|
+
canToggle
|
|
425
457
|
@change="${this.handleAuthChange}"
|
|
426
458
|
@delete="${this.handleAuthDelete}"
|
|
427
459
|
></cc-authorization>
|
|
@@ -432,11 +464,22 @@ export default class EnvironmentEditor extends LitElement {
|
|
|
432
464
|
<apikey-authorization
|
|
433
465
|
.authorization="${auth}"
|
|
434
466
|
class="auth-panel"
|
|
467
|
+
canDelete
|
|
468
|
+
canToggle
|
|
435
469
|
@change="${this.handleAuthChange}"
|
|
436
470
|
@delete="${this.handleAuthDelete}"
|
|
437
471
|
></apikey-authorization>
|
|
438
472
|
`;
|
|
439
473
|
}
|
|
474
|
+
renderTabs() {
|
|
475
|
+
return html `
|
|
476
|
+
<ui-tabs .selected="${this.selected}" @select="${this.handleTabSelection}">
|
|
477
|
+
<ui-tab aria-controls="server" data-page="server">Server</ui-tab>
|
|
478
|
+
<ui-tab aria-controls="variables" data-page="variables">Variables</ui-tab>
|
|
479
|
+
<ui-tab aria-controls="authorization" data-page="authorization">Authorization</ui-tab>
|
|
480
|
+
</ui-tabs>
|
|
481
|
+
`;
|
|
482
|
+
}
|
|
440
483
|
}
|
|
441
484
|
__decorate([
|
|
442
485
|
property({ type: Object })
|
|
@@ -447,4 +490,7 @@ __decorate([
|
|
|
447
490
|
__decorate([
|
|
448
491
|
state()
|
|
449
492
|
], EnvironmentEditor.prototype, "encapsulateHelp", void 0);
|
|
493
|
+
__decorate([
|
|
494
|
+
property({ type: String })
|
|
495
|
+
], EnvironmentEditor.prototype, "selected", void 0);
|
|
450
496
|
//# sourceMappingURL=EnvironmentEditor.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EnvironmentEditor.js","sourceRoot":"","sources":["../../../src/elements/environment/EnvironmentEditor.ts"],"names":[],"mappings":";AAAA,2CAA2C;AAC3C,OAAO,EAAE,UAAU,EAAE,IAAI,EAA6B,MAAM,KAAK,CAAC;AAClE,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAgB,WAAW,EAAW,MAAM,EAAuD,oBAAoB,EAAE,MAAM,mCAAmC,CAAC;AAC1K,OAAO,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;AAG9C,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAEhD,OAAO,aAAa,MAAM,+BAA+B,CAAC;AAE1D,OAAO,2CAA2C,CAAC;AACnD,OAAO,8CAA8C,CAAC;AACtD,OAAO,4BAA4B,CAAC;AACpC,OAAO,kCAAkC,CAAC;AAC1C,OAAO,8BAA8B,CAAC;AACtC,OAAO,mCAAmC,CAAC;AAC3C,OAAO,8BAA8B,CAAC;AACtC,OAAO,+BAA+B,CAAC;AACvC,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AAGjE;;GAEG;AACH,MAAM,CAAC,OAAO,OAAO,iBAAkB,SAAQ,UAAU;IAAzD;;QAKE;;WAEG;QACyB,gBAAW,GAAiB,IAAI,WAAW,EAAE,CAAC,MAAM,EAAE,CAAC;QAS1E,oBAAe,GAAG,KAAK,CAAC;IAobnC,CAAC;IApcC,MAAM,KAAc,MAAM;QACxB,OAAO,CAAC,aAAa,CAAC,CAAC;IACzB,CAAC;IAg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MAAM,EAAE,CAAC;4DAA4B;AAE9C;IAAR,KAAK,EAAE;0DAAyB","sourcesContent":["/* eslint-disable class-methods-use-this */\nimport { LitElement, html, TemplateResult, CSSResult } from 'lit';\nimport { property, state } from 'lit/decorators.js';\nimport { IEnvironment, Environment, IServer, Server, IProperty, IRequestAuthorization, AuthorizationType, RequestAuthorization } from '@api-client/core/build/browser.js';\nimport { live } from 'lit/directives/live.js';\nimport ServerEditor from './ServerEditor.js';\nimport VariablesEditor from './VariablesEditor.js';\nimport { Events } from '../../events/Events.js';\nimport Input from '../../ui/input/Input.js';\nimport elementStyles from './EnvironmentEditor.styles.js';\nimport SwitchElement from '../../ui/input/SwitchElement.js';\nimport '../../define/environment/server-editor.js';\nimport '../../define/environment/variables-editor.js';\nimport '../../define/ui/ui-icon.js';\nimport '../../define/ui/ui-text-field.js';\nimport '../../define/ui/ui-switch.js';\nimport '../../define/ui/ui-icon-button.js';\nimport '../../define/ui/ui-button.js';\nimport '../../define/ui/ui-divider.js';\nimport { authTypeToLabel } from '../authorization/AuthLabels.js';\nimport { Authorization } from '../authorization/ui/Authorization.js';\n\n/**\n * An element that renders a form to set up an environment.\n */\nexport default class EnvironmentEditor extends LitElement {\n static override get styles(): CSSResult[] {\n return [elementStyles];\n }\n\n /**\n * The environment schema to edit.\n */\n @property({ type: Object }) environment: IEnvironment = new Environment().toJSON();\n\n /**\n * Redirect URL for the OAuth2 authorization.\n * If can be also set by dispatching `oauth2-redirect-url-changed`\n * with `value` property on the `detail` object.\n */\n @property({ type: String }) oauth2RedirectUri?: string;\n\n @state() encapsulateHelp = false;\n\n updateName(value: string): void {\n this.environment.info.name = value;\n this.notifyChange();\n Events.HttpProject.State.nameChanged(this.environment.key, this.environment.kind, this);\n }\n\n updateEncapsulated(value: boolean): void {\n this.environment.encapsulated = value;\n this.notifyChange();\n }\n\n deleteServer(): void {\n this.environment.server = undefined;\n this.requestUpdate();\n this.notifyChange();\n }\n\n updateVariables(value?: IProperty[]): void {\n if (value) {\n this.environment.variables = value;\n }\n this.notifyChange();\n // when modifying variables they won't be reflected in the server editor.\n const node = this.shadowRoot?.querySelector('server-editor');\n if (node) {\n node.generateValue();\n }\n }\n\n protected notifyChange(): void {\n this.dispatchEvent(new Event('change'));\n }\n\n protected handleServerChange(e: Event): void {\n const editor = e.target as ServerEditor;\n const value = editor.getSchema();\n this.environment.server = value;\n this.notifyChange();\n }\n\n protected handleVariableChange(e: Event): void {\n const editor = e.target as VariablesEditor;\n const { variables } = editor;\n this.updateVariables(variables);\n }\n\n protected _createServerHandler(): void {\n const server = new Server();\n this.environment.server = server.toJSON();\n this.requestUpdate();\n }\n\n protected handleEncapsulatedChange(e: Event): void {\n const input = e.target as SwitchElement;\n this.updateEncapsulated(input.checked);\n }\n\n protected handleNameChange(e: Event): void {\n const input = e.target as Input;\n this.updateName(input.value);\n input.checkValidity();\n }\n\n protected handleToggleHelp(): void {\n this.encapsulateHelp = !this.encapsulateHelp;\n }\n\n protected handleServerDelete(): void {\n this.deleteServer();\n }\n\n protected handleAuthAdd(e: CustomEvent): void {\n const target = e.detail.item as HTMLElement | undefined;\n if (!target) {\n return;\n }\n const selected = target.dataset.type as AuthorizationType | undefined;\n if (!selected) {\n return;\n }\n this.addAuthorization(selected);\n }\n\n /**\n * Adds a new authorization object to the request for the given type.\n * \n * @returns The created instance of the authorization.\n */\n addAuthorization(type: AuthorizationType): RequestAuthorization {\n const cnf = RequestAuthorization.fromTypedConfig(type, {}, false);\n cnf.enabled = true;\n if (!this.environment.authorization) {\n this.environment.authorization = [];\n }\n this.environment.authorization.push(cnf.toJSON());\n this.notifyChange();\n this.requestUpdate();\n return cnf;\n }\n\n protected handleAuthChange(e: Event): void {\n const editor = e.target as Authorization;\n const { authorization } = editor;\n this.updateAuthorization(authorization as IRequestAuthorization, editor.checkValidity());\n }\n\n protected handleAuthDelete(e: Event): void {\n const editor = e.target as Authorization;\n const { authorization } = editor;\n if (!authorization) {\n return;\n }\n this.removeAuthorization(authorization.type)\n }\n\n /**\n * Updates authorization schema on the editor.\n * @param schema The new schema to replace the old one\n * @param isValid Whether the schema is valid.\n */\n updateAuthorization(schema: IRequestAuthorization, isValid: boolean): void {\n const { authorization } = this.environment;\n if (!authorization) {\n return;\n }\n const index = authorization.findIndex(i => i.type === schema.type);\n if (index === -1) {\n return;\n }\n // eslint-disable-next-line no-param-reassign\n schema.valid = isValid;\n authorization[index] = schema;\n this.notifyChange();\n }\n\n /**\n * Removes authorization schema from the editor.\n * @param type The authorization type to remove.\n */\n removeAuthorization(type: string): void {\n const { authorization } = this.environment;\n if (!authorization) {\n return;\n }\n const index = authorization.findIndex(i => i.type === type);\n if (index === -1) {\n return;\n }\n authorization.splice(index, 1);\n this.notifyChange();\n this.requestUpdate();\n }\n\n protected override render(): TemplateResult {\n return html`\n ${this.renderHeader()}\n ${this.renderEnvironmentEditor()}\n <ui-divider></ui-divider>\n ${this.renderServerTemplate()}\n <ui-divider></ui-divider>\n ${this.renderVariables()}\n <ui-divider></ui-divider>\n ${this.renderAuthorization()}\n `;\n }\n\n protected renderHeader(): TemplateResult {\n return html`<div class=\"section-title\">Environment</div>`;\n }\n\n protected renderEnvironmentEditor(): TemplateResult {\n return html`\n <section aria-label=\"Environment configuration\">\n ${this.renderNameInput()}\n ${this.renderEncapsulate()}\n </section>\n `;\n }\n\n protected renderNameInput(): TemplateResult {\n const { environment } = this;\n return html`\n <div class=\"form-item\">\n <ui-text-field\n name=\"name\"\n label=\"Environment name\"\n required\n .value=\"${live(environment.info.name || '')}\"\n @change=\"${this.handleNameChange}\"\n ></ui-text-field>\n </div>`;\n }\n\n protected renderEncapsulate(): TemplateResult {\n const { encapsulateHelp } = this;\n return html`\n <div class=\"encapsulate-item\">\n ${this.renderEncapsulateInput()}\n ${this.renderEncapsulateInfoToggle()}\n </div>\n ${encapsulateHelp ? html`\n <div class=\"help-banner\">\n By default when running requests in a folder the application reads all environments\n up to the project root. The variables are then combined into a single object.\n When <i>encapsulated</i> is enabled, the program stops reading environments above the folder\n the environment is defined.\n </div>\n ` : ''}\n `;\n }\n\n protected renderEncapsulateInput(): TemplateResult {\n const { environment } = this;\n return html`\n <label>\n <ui-switch\n name=\"encapsulated\"\n .checked=\"${environment.encapsulated || false}\"\n @change=\"${this.handleEncapsulatedChange}\"\n aria-label=\"Encapsulate the environment\"\n ></ui-switch>\n Encapsulate the environment\n </label>\n `;\n }\n\n protected renderEncapsulateInfoToggle(): TemplateResult {\n return html`\n <ui-icon-button aria-label=\"Show or hide help topic\" @click=\"${this.handleToggleHelp}\">\n <ui-icon icon=\"info\" role=\"presentation\"></ui-icon>\n </ui-icon-button>\n `;\n }\n\n protected renderServerTemplate(): TemplateResult {\n const { server } = this.environment;\n return html`\n <section aria-label=\"Server information\">\n ${server ? this.renderServerEditor(server) : this.renderNoServer()}\n </section>\n `;\n }\n\n protected renderNoServer(): TemplateResult {\n return html`\n <div class=\"section-title\">Server</div>\n <p class=\"empty-info\">No server defined.</p>\n <ui-button type=\"tonal\" @click=\"${this._createServerHandler}\">Create server</ui-button>\n `;\n }\n\n protected renderServerEditor(server: IServer): TemplateResult {\n const { uri, basePath, description, protocol } = server;\n return html`\n <server-editor \n .uri=\"${uri}\" \n .basePath=\"${basePath}\" \n .description=\"${description}\" \n .protocol=\"${protocol}\" \n .variables=\"${this.environment.variables}\"\n @change=\"${this.handleServerChange}\"\n @delete=\"${this.handleServerDelete}\"\n ></server-editor>\n `;\n }\n\n protected renderVariables(): TemplateResult {\n return html`\n <section aria-label=\"Variables\">\n ${this.renderVariablesEditor()}\n </section>\n `;\n }\n\n protected renderVariablesEditor(): TemplateResult {\n const { variables } = this.environment;\n return html`<variables-editor .variables=\"${variables}\" @change=\"${this.handleVariableChange}\"></variables-editor>`;\n }\n\n protected renderAuthorization(): TemplateResult {\n const { authorization = [] } = this.environment;\n return html`\n <div class=\"section-title\">Authorization</div>\n <p class=\"auth-info\">The authorization is applied to all requests in the current folder when the request is executed.</p>\n ${this.renderAuthorizationActions(authorization)}\n ${this.renderAuthorizationList(authorization)}\n `;\n }\n\n protected renderAuthorizationActions(current: IRequestAuthorization[] = []): TemplateResult {\n const all = ['basic', 'oauth 2', 'open id', 'bearer', 'api key', 'ntlm', 'client certificate'];\n const toRender: string[] = all.filter(type => !current.some(i => i.type === type));\n return html`\n <ui-dropdown-list\n verticalAlign=\"top\"\n @select=\"${this.handleAuthAdd}\"\n class=\"auth-dropdown\"\n closeOnOutsideClick\n >\n <ui-button \n type=\"tonal\" \n title=\"Add authorization option\" \n aria-label=\"Opens a menu to select authorization option\"\n ?disabled=\"${!toRender.length}\"\n >\n <ui-icon icon=\"arrowDropDown\" slot=\"icon\" role=\"presentation\"></ui-icon>\n Add\n </ui-button>\n <ui-list slot=\"dropdown\" role=\"menu\">\n ${this.renderAuthorizationOptions(toRender)}\n </ui-list>\n </ui-dropdown-list>\n `;\n }\n\n protected renderAuthorizationOptions(available: string[]): TemplateResult {\n return html`\n ${available.map(type => html`\n <ui-list-item role=\"menuitem\" data-type=\"${type}\">\n ${authTypeToLabel(type)}\n </ui-list-item>\n `)}\n `;\n }\n\n protected renderAuthorizationList(authorization: IRequestAuthorization[] = []): TemplateResult[] {\n if (!Array.isArray(authorization) || !authorization.length) {\n return [this.renderEmptyAuthorization()];\n }\n return authorization.map((item, index) => {\n let content: TemplateResult | undefined;\n switch (item.type) {\n case 'basic': content = this.renderBasicAuthorization(item); break;\n case 'bearer': content = this.renderBearerAuthorization(item); break;\n case 'ntlm': content = this.renderNtlmAuthorization(item); break;\n case 'oauth 2': content = this.renderOauthAuthorization(item); break;\n case 'open id': content = this.renderOidcAuthorization(item); break;\n case 'client certificate': content = this.renderCCAuthorization(item); break;\n case 'api key': content = this.renderApiKeyAuthorization(item); break;\n default:\n }\n if (content) {\n const isLast = authorization.length === index + 1;\n return html`\n ${content}\n ${!isLast ? html`<ui-divider></ui-divider>` : ''}\n `;\n }\n return html``;\n });\n }\n\n protected renderEmptyAuthorization(): TemplateResult {\n return html``;\n }\n\n protected renderBasicAuthorization(auth: IRequestAuthorization): TemplateResult {\n return html`\n <basic-authorization\n .authorization=\"${auth}\"\n class=\"auth-panel\"\n @change=\"${this.handleAuthChange}\"\n @delete=\"${this.handleAuthDelete}\"\n ></basic-authorization>\n `;\n }\n\n protected renderBearerAuthorization(auth: IRequestAuthorization): TemplateResult {\n return html`\n <bearer-authorization\n .authorization=\"${auth}\"\n class=\"auth-panel\"\n @change=\"${this.handleAuthChange}\"\n @delete=\"${this.handleAuthDelete}\"\n ></bearer-authorization>\n `;\n }\n\n protected renderNtlmAuthorization(auth: IRequestAuthorization): TemplateResult {\n return html`\n <ntlm-authorization\n .authorization=\"${auth}\"\n class=\"auth-panel\"\n @change=\"${this.handleAuthChange}\"\n @delete=\"${this.handleAuthDelete}\"\n ></ntlm-authorization>\n `;\n }\n\n protected renderOauthAuthorization(auth: IRequestAuthorization): TemplateResult {\n return html`\n <oauth2-authorization\n .authorization=\"${auth}\"\n class=\"auth-panel\"\n @change=\"${this.handleAuthChange}\"\n @delete=\"${this.handleAuthDelete}\"\n .defaultRedirectUri=\"${this.oauth2RedirectUri}\"\n ></oauth2-authorization>\n `;\n }\n\n protected renderOidcAuthorization(auth: IRequestAuthorization): TemplateResult {\n return html`\n <oidc-authorization\n .authorization=\"${auth}\"\n class=\"auth-panel\"\n @change=\"${this.handleAuthChange}\"\n @delete=\"${this.handleAuthDelete}\"\n .defaultRedirectUri=\"${this.oauth2RedirectUri}\"\n ></oidc-authorization>\n `;\n }\n\n protected renderCCAuthorization(auth: IRequestAuthorization): TemplateResult {\n return html`\n <cc-authorization\n .authorization=\"${auth}\"\n class=\"auth-panel\"\n @change=\"${this.handleAuthChange}\"\n @delete=\"${this.handleAuthDelete}\"\n ></cc-authorization>\n `;\n }\n\n protected renderApiKeyAuthorization(auth: IRequestAuthorization): TemplateResult {\n return html`\n <apikey-authorization\n .authorization=\"${auth}\"\n class=\"auth-panel\"\n @change=\"${this.handleAuthChange}\"\n @delete=\"${this.handleAuthDelete}\"\n ></apikey-authorization>\n `;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"EnvironmentEditor.js","sourceRoot":"","sources":["../../../src/elements/environment/EnvironmentEditor.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAA6B,MAAM,KAAK,CAAC;AACtD,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAgB,WAAW,EAAW,MAAM,EAAuD,oBAAoB,EAAE,MAAM,mCAAmC,CAAC;AAC1K,OAAO,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;AAC9C,OAAO,UAAU,MAAM,kBAAkB,CAAC;AAG1C,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAEhD,OAAO,aAAa,MAAM,+BAA+B,CAAC;AAE1D,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AAGjE,OAAO,2CAA2C,CAAC;AACnD,OAAO,8CAA8C,CAAC;AACtD,OAAO,4BAA4B,CAAC;AACpC,OAAO,kCAAkC,CAAC;AAC1C,OAAO,8BAA8B,CAAC;AACtC,OAAO,mCAAmC,CAAC;AAC3C,OAAO,8BAA8B,CAAC;AACtC,OAAO,+BAA+B,CAAC;AACvC,OAAO,4BAA4B,CAAC;AACpC,OAAO,2BAA2B,CAAC;AACnC,OAAO,mDAAmD,CAAC;AAC3D,OAAO,oDAAoD,CAAC;AAC5D,OAAO,kDAAkD,CAAC;AAC1D,OAAO,oDAAoD,CAAC;AAC5D,OAAO,oDAAoD,CAAC;AAC5D,OAAO,kDAAkD,CAAC;AAC1D,OAAO,gDAAgD,CAAC;AAIxD;;GAEG;AACH,MAAM,CAAC,OAAO,OAAO,iBAAkB,SAAQ,UAAU;IACvD,MAAM,KAAc,MAAM;QACxB,OAAO,CAAC,aAAa,CAAC,CAAC;IACzB,CAAC;IAsBD;QACE,KAAK,EAAE,CAAC;QArBV;;WAEG;QACyB,gBAAW,GAAiB,IAAI,WAAW,EAAE,CA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AI,CAAC,gBAAgB;iBACrB,IAAI,CAAC,gBAAgB;6BACT,IAAI,CAAC,iBAAiB;;KAE9C,CAAC;IACJ,CAAC;IAES,qBAAqB,CAAC,IAA2B;QACzD,OAAO,IAAI,CAAA;;wBAES,IAAI;;;;iBAIX,IAAI,CAAC,gBAAgB;iBACrB,IAAI,CAAC,gBAAgB;;KAEjC,CAAC;IACJ,CAAC;IAES,yBAAyB,CAAC,IAA2B;QAC7D,OAAO,IAAI,CAAA;;wBAES,IAAI;;;;iBAIX,IAAI,CAAC,gBAAgB;iBACrB,IAAI,CAAC,gBAAgB;;KAEjC,CAAC;IACJ,CAAC;IAES,UAAU;QAClB,OAAO,IAAI,CAAA;0BACW,IAAI,CAAC,QAAQ,cAAc,IAAI,CAAC,kBAAkB;;;;;KAKvE,CAAC;IACJ,CAAC;CACF;AA5e6B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;sDAAwD;AAQvD;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;4DAA4B;AAE9C;IAAR,KAAK,EAAE;0DAA0B;AAKN;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;mDAAsB","sourcesContent":["import { html, TemplateResult, CSSResult } from 'lit';\nimport { property, state } from 'lit/decorators.js';\nimport { IEnvironment, Environment, IServer, Server, IProperty, IRequestAuthorization, AuthorizationType, RequestAuthorization } from '@api-client/core/build/browser.js';\nimport { live } from 'lit/directives/live.js';\nimport ApiElement from '../ApiElement.js';\nimport ServerEditor from './ServerEditor.js';\nimport VariablesEditor from './VariablesEditor.js';\nimport { Events } from '../../events/Events.js';\nimport Input from '../../ui/input/Input.js';\nimport elementStyles from './EnvironmentEditor.styles.js';\nimport SwitchElement from '../../ui/input/SwitchElement.js';\nimport { authTypeToLabel } from '../authorization/AuthLabels.js';\nimport { Authorization } from '../authorization/ui/Authorization.js';\nimport { TabSelectionDetail } from '../../ui/tabs/UiTabs.js';\nimport '../../define/environment/server-editor.js';\nimport '../../define/environment/variables-editor.js';\nimport '../../define/ui/ui-icon.js';\nimport '../../define/ui/ui-text-field.js';\nimport '../../define/ui/ui-switch.js';\nimport '../../define/ui/ui-icon-button.js';\nimport '../../define/ui/ui-button.js';\nimport '../../define/ui/ui-divider.js';\nimport '../../define/ui/ui-tabs.js';\nimport '../../define/ui/ui-tab.js';\nimport '../../define/authorization/basic-authorization.js';\nimport '../../define/authorization/bearer-authorization.js';\nimport '../../define/authorization/ntlm-authorization.js';\nimport '../../define/authorization/apikey-authorization.js';\nimport '../../define/authorization/oauth2-authorization.js';\nimport '../../define/authorization/oidc-authorization.js';\nimport '../../define/authorization/cc-authorization.js';\n\ntype EditorPage = 'server' | 'variables' | 'authorization';\n\n/**\n * An element that renders a form to set up an environment.\n */\nexport default class EnvironmentEditor extends ApiElement {\n static override get styles(): CSSResult[] {\n return [elementStyles];\n }\n\n /**\n * The environment schema to edit.\n */\n @property({ type: Object }) environment: IEnvironment = new Environment().toJSON();\n\n /**\n * Redirect URL for the OAuth2 authorization.\n * If can be also set by dispatching `oauth2-redirect-url-changed`\n * with `value` property on the `detail` object.\n * @attribute\n */\n @property({ type: String }) oauth2RedirectUri?: string;\n\n @state() encapsulateHelp: boolean;\n\n /**\n * @attribute\n */\n @property({ type: String }) selected: EditorPage;\n\n constructor() {\n super();\n this.encapsulateHelp = false;\n this.selected = 'server';\n }\n\n updateName(value: string): void {\n this.environment.info.name = value;\n this.notifyChange();\n Events.HttpProject.State.nameChanged(this.environment.key, this.environment.kind, this);\n }\n\n updateEncapsulated(value: boolean): void {\n this.environment.encapsulated = value;\n this.notifyChange();\n }\n\n deleteServer(): void {\n this.environment.server = undefined;\n this.requestUpdate();\n this.notifyChange();\n }\n\n updateVariables(value?: IProperty[]): void {\n if (value) {\n this.environment.variables = value;\n }\n this.notifyChange();\n // when modifying variables they won't be reflected in the server editor.\n const node = this.shadowRoot?.querySelector('server-editor');\n if (node) {\n node.generateValue();\n }\n }\n\n protected handleServerChange(e: Event): void {\n const editor = e.target as ServerEditor;\n const value = editor.getSchema();\n this.environment.server = value;\n this.notifyChange();\n }\n\n protected handleVariableChange(e: Event): void {\n const editor = e.target as VariablesEditor;\n const { variables } = editor;\n this.updateVariables(variables);\n }\n\n protected _createServerHandler(): void {\n const server = new Server();\n this.environment.server = server.toJSON();\n this.requestUpdate();\n }\n\n protected handleEncapsulatedChange(e: Event): void {\n const input = e.target as SwitchElement;\n this.updateEncapsulated(input.checked);\n }\n\n protected handleNameChange(e: Event): void {\n const input = e.target as Input;\n this.updateName(input.value);\n input.checkValidity();\n }\n\n protected handleToggleHelp(): void {\n this.encapsulateHelp = !this.encapsulateHelp;\n }\n\n protected handleServerDelete(): void {\n this.deleteServer();\n }\n\n protected handleAuthAdd(e: CustomEvent): void {\n const target = e.detail.item as HTMLElement | undefined;\n if (!target) {\n return;\n }\n const selected = target.dataset.type as AuthorizationType | undefined;\n if (!selected) {\n return;\n }\n this.addAuthorization(selected);\n }\n\n /**\n * Adds a new authorization object to the request for the given type.\n * \n * @returns The created instance of the authorization.\n */\n addAuthorization(type: AuthorizationType): RequestAuthorization {\n const cnf = RequestAuthorization.fromTypedConfig(type, {}, false);\n cnf.enabled = true;\n if (!this.environment.authorization) {\n this.environment.authorization = [];\n }\n this.environment.authorization.push(cnf.toJSON());\n this.notifyChange();\n this.requestUpdate();\n return cnf;\n }\n\n protected handleAuthChange(e: Event): void {\n const editor = e.target as Authorization;\n const { authorization } = editor;\n this.updateAuthorization(authorization as IRequestAuthorization, editor.checkValidity());\n }\n\n protected handleAuthDelete(e: Event): void {\n const editor = e.target as Authorization;\n const { authorization } = editor;\n if (!authorization) {\n return;\n }\n this.removeAuthorization(authorization.type)\n }\n\n /**\n * Updates authorization schema on the editor.\n * @param schema The new schema to replace the old one\n * @param isValid Whether the schema is valid.\n */\n updateAuthorization(schema: IRequestAuthorization, isValid: boolean): void {\n const { authorization } = this.environment;\n if (!authorization) {\n return;\n }\n const index = authorization.findIndex(i => i.type === schema.type);\n if (index === -1) {\n return;\n }\n // eslint-disable-next-line no-param-reassign\n schema.valid = isValid;\n authorization[index] = schema;\n this.notifyChange();\n }\n\n /**\n * Removes authorization schema from the editor.\n * @param type The authorization type to remove.\n */\n removeAuthorization(type: string): void {\n const { authorization } = this.environment;\n if (!authorization) {\n return;\n }\n const index = authorization.findIndex(i => i.type === type);\n if (index === -1) {\n return;\n }\n authorization.splice(index, 1);\n this.notifyChange();\n this.requestUpdate();\n }\n\n protected handleTabSelection(e: CustomEvent<TabSelectionDetail>): void {\n const { item } = e.detail;\n const { page } = item.dataset;\n if (!page) {\n return;\n }\n this.selected = page as EditorPage;\n }\n\n protected override render(): TemplateResult {\n return html`\n ${this.renderHeader()}\n ${this.renderEnvironmentEditor()}\n ${this.renderTabs()}\n ${this.renderPage()}\n `;\n }\n\n protected renderHeader(): TemplateResult {\n return html`<div class=\"section-title\">Environment</div>`;\n }\n\n protected renderPage(): TemplateResult {\n switch (this.selected) {\n case 'authorization': return this.renderAuthorization();\n case 'variables': return this.renderVariables();\n default: return this.renderServerTemplate();\n }\n }\n\n protected renderEnvironmentEditor(): TemplateResult {\n return html`\n <section aria-label=\"Environment configuration\">\n ${this.renderNameInput()}\n ${this.renderEncapsulate()}\n </section>\n `;\n }\n\n protected renderNameInput(): TemplateResult {\n const { environment } = this;\n return html`\n <div class=\"form-item\">\n <ui-text-field\n name=\"name\"\n label=\"Environment name\"\n required\n .value=\"${live(environment.info.name || '')}\"\n @change=\"${this.handleNameChange}\"\n ></ui-text-field>\n </div>`;\n }\n\n protected renderEncapsulate(): TemplateResult {\n const { encapsulateHelp } = this;\n return html`\n <div class=\"encapsulate-item\">\n ${this.renderEncapsulateInput()}\n ${this.renderEncapsulateInfoToggle()}\n </div>\n ${encapsulateHelp ? html`\n <div class=\"help-banner\">\n By default when running requests in a folder the application reads all environments\n up to the project root. The variables are then combined into a single object.\n When <i>encapsulated</i> is enabled, the program stops reading environments above the folder\n the environment is defined.\n </div>\n ` : ''}\n `;\n }\n\n protected renderEncapsulateInput(): TemplateResult {\n const { environment } = this;\n return html`\n <label>\n <ui-switch\n name=\"encapsulated\"\n .checked=\"${environment.encapsulated || false}\"\n @change=\"${this.handleEncapsulatedChange}\"\n aria-label=\"Encapsulate the environment\"\n ></ui-switch>\n Encapsulate the environment\n </label>\n `;\n }\n\n protected renderEncapsulateInfoToggle(): TemplateResult {\n return html`\n <ui-icon-button aria-label=\"Show or hide help topic\" @click=\"${this.handleToggleHelp}\">\n <ui-icon icon=\"info\" role=\"presentation\"></ui-icon>\n </ui-icon-button>\n `;\n }\n\n protected renderServerTemplate(): TemplateResult {\n const { server } = this.environment;\n return html`\n <section aria-label=\"Server information\" id=\"server\" class=\"editor-container\">\n ${server ? this.renderServerEditor(server) : this.renderNoServer()}\n </section>\n `;\n }\n\n protected renderNoServer(): TemplateResult {\n return html`\n <div class=\"section-title\">Server</div>\n <p class=\"empty-info\">No server defined.</p>\n <ui-button type=\"tonal\" @click=\"${this._createServerHandler}\">Create server</ui-button>\n `;\n }\n\n protected renderServerEditor(server: IServer): TemplateResult {\n const { uri, basePath, description, protocol } = server;\n return html`\n <server-editor \n .uri=\"${uri}\" \n .basePath=\"${basePath}\" \n .description=\"${description}\" \n .protocol=\"${protocol}\" \n .variables=\"${this.environment.variables}\"\n @change=\"${this.handleServerChange}\"\n @delete=\"${this.handleServerDelete}\"\n ></server-editor>\n `;\n }\n\n protected renderVariables(): TemplateResult {\n return html`\n <section aria-label=\"Variables\" id=\"variables\" class=\"editor-container\">\n ${this.renderVariablesEditor()}\n </section>\n `;\n }\n\n protected renderVariablesEditor(): TemplateResult {\n const { variables } = this.environment;\n return html`<variables-editor .variables=\"${variables}\" @change=\"${this.handleVariableChange}\"></variables-editor>`;\n }\n\n protected renderAuthorization(): TemplateResult {\n const { authorization = [] } = this.environment;\n return html`\n <section id=\"authorization\" aria-label=\"Authorization\" class=\"editor-container\">\n <div class=\"section-title\">Authorization</div>\n <p class=\"auth-info\">The authorization is applied to all requests in the current folder when the request is executed.</p>\n ${this.renderAuthorizationActions(authorization)}\n ${this.renderAuthorizationList(authorization)}\n </section>\n `;\n }\n\n protected renderAuthorizationActions(current: IRequestAuthorization[] = []): TemplateResult {\n const all = ['basic', 'oauth 2', 'open id', 'bearer', 'api key', 'ntlm', 'client certificate'];\n const toRender: string[] = all.filter(type => !current.some(i => i.type === type));\n return html`\n <ui-dropdown-list\n verticalAlign=\"top\"\n @select=\"${this.handleAuthAdd}\"\n class=\"auth-dropdown\"\n closeOnOutsideClick\n >\n <ui-button \n type=\"tonal\" \n title=\"Add authorization option\" \n aria-label=\"Opens a menu to select authorization option\"\n ?disabled=\"${!toRender.length}\"\n >\n <ui-icon icon=\"arrowDropDown\" slot=\"icon\" role=\"presentation\"></ui-icon>\n Add\n </ui-button>\n <ui-list slot=\"dropdown\" role=\"menu\">\n ${this.renderAuthorizationOptions(toRender)}\n </ui-list>\n </ui-dropdown-list>\n `;\n }\n\n protected renderAuthorizationOptions(available: string[]): TemplateResult {\n return html`\n ${available.map(type => html`\n <ui-list-item role=\"menuitem\" data-type=\"${type}\">\n ${authTypeToLabel(type)}\n </ui-list-item>\n `)}\n `;\n }\n\n protected renderAuthorizationList(authorization: IRequestAuthorization[] = []): TemplateResult[] {\n if (!Array.isArray(authorization) || !authorization.length) {\n return [this.renderEmptyAuthorization()];\n }\n return authorization.map((item, index) => {\n let content: TemplateResult | undefined;\n switch (item.type) {\n case 'basic': content = this.renderBasicAuthorization(item); break;\n case 'bearer': content = this.renderBearerAuthorization(item); break;\n case 'ntlm': content = this.renderNtlmAuthorization(item); break;\n case 'oauth 2': content = this.renderOauthAuthorization(item); break;\n case 'open id': content = this.renderOidcAuthorization(item); break;\n case 'client certificate': content = this.renderCCAuthorization(item); break;\n case 'api key': content = this.renderApiKeyAuthorization(item); break;\n default:\n }\n if (content) {\n const isLast = authorization.length === index + 1;\n return html`\n ${content}\n ${!isLast ? html`<ui-divider></ui-divider>` : ''}\n `;\n }\n return html``;\n });\n }\n\n protected renderEmptyAuthorization(): TemplateResult {\n return html``;\n }\n\n protected renderBasicAuthorization(auth: IRequestAuthorization): TemplateResult {\n return html`\n <basic-authorization\n .authorization=\"${auth}\"\n class=\"auth-panel\"\n canDelete\n canToggle\n @change=\"${this.handleAuthChange}\"\n @delete=\"${this.handleAuthDelete}\"\n ></basic-authorization>\n `;\n }\n\n protected renderBearerAuthorization(auth: IRequestAuthorization): TemplateResult {\n return html`\n <bearer-authorization\n .authorization=\"${auth}\"\n class=\"auth-panel\"\n canDelete\n canToggle\n @change=\"${this.handleAuthChange}\"\n @delete=\"${this.handleAuthDelete}\"\n ></bearer-authorization>\n `;\n }\n\n protected renderNtlmAuthorization(auth: IRequestAuthorization): TemplateResult {\n return html`\n <ntlm-authorization\n .authorization=\"${auth}\"\n class=\"auth-panel\"\n canDelete\n canToggle\n @change=\"${this.handleAuthChange}\"\n @delete=\"${this.handleAuthDelete}\"\n ></ntlm-authorization>\n `;\n }\n\n protected renderOauthAuthorization(auth: IRequestAuthorization): TemplateResult {\n return html`\n <oauth2-authorization\n .authorization=\"${auth}\"\n class=\"auth-panel\"\n canDelete\n canToggle\n @change=\"${this.handleAuthChange}\"\n @delete=\"${this.handleAuthDelete}\"\n .defaultRedirectUri=\"${this.oauth2RedirectUri}\"\n ></oauth2-authorization>\n `;\n }\n\n protected renderOidcAuthorization(auth: IRequestAuthorization): TemplateResult {\n return html`\n <oidc-authorization\n .authorization=\"${auth}\"\n class=\"auth-panel\"\n canDelete\n canToggle\n @change=\"${this.handleAuthChange}\"\n @delete=\"${this.handleAuthDelete}\"\n .defaultRedirectUri=\"${this.oauth2RedirectUri}\"\n ></oidc-authorization>\n `;\n }\n\n protected renderCCAuthorization(auth: IRequestAuthorization): TemplateResult {\n return html`\n <cc-authorization\n .authorization=\"${auth}\"\n class=\"auth-panel\"\n canDelete\n canToggle\n @change=\"${this.handleAuthChange}\"\n @delete=\"${this.handleAuthDelete}\"\n ></cc-authorization>\n `;\n }\n\n protected renderApiKeyAuthorization(auth: IRequestAuthorization): TemplateResult {\n return html`\n <apikey-authorization\n .authorization=\"${auth}\"\n class=\"auth-panel\"\n canDelete\n canToggle\n @change=\"${this.handleAuthChange}\"\n @delete=\"${this.handleAuthDelete}\"\n ></apikey-authorization>\n `;\n }\n\n protected renderTabs(): TemplateResult {\n return html`\n <ui-tabs .selected=\"${this.selected}\" @select=\"${this.handleTabSelection}\">\n <ui-tab aria-controls=\"server\" data-page=\"server\">Server</ui-tab>\n <ui-tab aria-controls=\"variables\" data-page=\"variables\">Variables</ui-tab>\n <ui-tab aria-controls=\"authorization\" data-page=\"authorization\">Authorization</ui-tab>\n </ui-tabs>\n `;\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EnvironmentEditor.styles.d.ts","sourceRoot":"","sources":["../../../src/elements/environment/EnvironmentEditor.styles.ts"],"names":[],"mappings":";AAEA,
|
|
1
|
+
{"version":3,"file":"EnvironmentEditor.styles.d.ts","sourceRoot":"","sources":["../../../src/elements/environment/EnvironmentEditor.styles.ts"],"names":[],"mappings":";AAEA,wBA8EE"}
|
|
@@ -2,6 +2,7 @@ import { css } from 'lit';
|
|
|
2
2
|
export default css `
|
|
3
3
|
:host {
|
|
4
4
|
display: block;
|
|
5
|
+
max-width: 900px;
|
|
5
6
|
}
|
|
6
7
|
|
|
7
8
|
ui-text-field {
|
|
@@ -18,7 +19,11 @@ ui-text-field {
|
|
|
18
19
|
line-height: var(--md-sys-typescale-title-large-height);
|
|
19
20
|
text-transform: var(--md-sys-typescale-title-large-text-transform);
|
|
20
21
|
text-decoration: var(--md-sys-typescale-title-large-text-decoration);
|
|
22
|
+
|
|
23
|
+
display: flex;
|
|
24
|
+
align-items: center;
|
|
21
25
|
margin-bottom: 20px;
|
|
26
|
+
height: 48px;
|
|
22
27
|
}
|
|
23
28
|
|
|
24
29
|
.form-item,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EnvironmentEditor.styles.js","sourceRoot":"","sources":["../../../src/elements/environment/EnvironmentEditor.styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAE1B,eAAe,GAAG,CAAA
|
|
1
|
+
{"version":3,"file":"EnvironmentEditor.styles.js","sourceRoot":"","sources":["../../../src/elements/environment/EnvironmentEditor.styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAE1B,eAAe,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8EjB,CAAC","sourcesContent":["import { css } from 'lit';\n\nexport default css`\n:host {\n display: block;\n max-width: 900px;\n}\n\nui-text-field {\n margin: 0;\n width: 100%;\n}\n\n.section-title {\n font-family: var(--md-sys-typescale-title-large-font-family-name);\n font-style: var(--md-sys-typescale-title-large-font-family-style);\n font-weight: var(--md-sys-typescale-title-large-font-weight);\n font-size: var(--md-sys-typescale-title-large-font-size);\n letter-spacing: var(--md-sys-typescale-title-large-tracking);\n line-height: var(--md-sys-typescale-title-large-height);\n text-transform: var(--md-sys-typescale-title-large-text-transform);\n text-decoration: var(--md-sys-typescale-title-large-text-decoration);\n \n display: flex;\n align-items: center;\n margin-bottom: 20px;\n height: 48px;\n}\n\n.form-item,\n.encapsulate-item {\n margin-bottom: 20px;\n}\n\n.encapsulate-item {\n display: flex;\n align-items: center;\n}\n\n.encapsulate-item label {\n font-family: var(--md-sys-typescale-label-large-font-family-name);\n font-style: var(--md-sys-typescale-label-large-font-family-style);\n font-weight: var(--md-sys-typescale-label-large-font-weight);\n font-size: var(--md-sys-typescale-label-large-font-size);\n letter-spacing: var(--md-sys-typescale-label-large-tracking);\n line-height: var(--md-sys-typescale-label-large-height);\n text-transform: var(--md-sys-typescale-label-large-text-transform);\n text-decoration: var(--md-sys-typescale-label-large-text-decoration);\n}\n\n.empty-info,\n.help-banner {\n font-family: var(--md-sys-typescale-body-large-font-family-name);\n font-style: var(--md-sys-typescale-body-large-font-family-style);\n font-weight: var(--md-sys-typescale-body-large-font-weight);\n font-size: var(--md-sys-typescale-body-large-font-size);\n letter-spacing: var(--md-sys-typescale-body-large-tracking);\n line-height: var(--md-sys-typescale-body-large-height);\n text-transform: var(--md-sys-typescale-body-large-text-transform);\n text-decoration: var(--md-sys-typescale-body-large-text-decoration);\n}\n\n.auth-info {\n font-family: var(--md-sys-typescale-body-small-font-family-name);\n font-style: var(--md-sys-typescale-body-small-font-family-style);\n font-weight: var(--md-sys-typescale-body-small-font-weight);\n font-size: var(--md-sys-typescale-body-small-font-size);\n letter-spacing: var(--md-sys-typescale-body-small-tracking);\n line-height: var(--md-sys-typescale-body-small-height);\n text-transform: var(--md-sys-typescale-body-small-text-transform);\n text-decoration: var(--md-sys-typescale-body-small-text-decoration);\n}\n\nui-switch {\n margin-right: 12px;\n}\n\nui-divider {\n margin: 40px 0;\n}\n`;\n"]}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { TemplateResult, CSSResult, PropertyValues } from 'lit';
|
|
2
2
|
import { IServer, Server, IProperty } from '@api-client/core/build/browser.js';
|
|
3
|
+
import ApiElement from '../ApiElement.js';
|
|
3
4
|
import '../../define/ui/ui-text-field.js';
|
|
4
5
|
import '../../define/ui/ui-icon.js';
|
|
5
6
|
import '../../define/ui/ui-icon-button.js';
|
|
@@ -10,7 +11,7 @@ export declare const DefaultProtocols: string[];
|
|
|
10
11
|
* @fires change - When a value change.
|
|
11
12
|
* @fires delete - When the user requested server definition delete.
|
|
12
13
|
*/
|
|
13
|
-
export default class ServerEditor extends
|
|
14
|
+
export default class ServerEditor extends ApiElement {
|
|
14
15
|
static get styles(): CSSResult[];
|
|
15
16
|
/**
|
|
16
17
|
* The base URI of the server.
|
|
@@ -77,7 +78,6 @@ export default class ServerEditor extends LitElement {
|
|
|
77
78
|
protected handleUriChange(e: Event): void;
|
|
78
79
|
protected handleBasePathChange(e: Event): void;
|
|
79
80
|
protected handleProtocolChange(e: Event): void;
|
|
80
|
-
protected notifyChange(): void;
|
|
81
81
|
protected handleDelete(): void;
|
|
82
82
|
render(): TemplateResult;
|
|
83
83
|
protected renderHeader(): TemplateResult;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ServerEditor.d.ts","sourceRoot":"","sources":["../../../src/elements/environment/ServerEditor.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ServerEditor.d.ts","sourceRoot":"","sources":["../../../src/elements/environment/ServerEditor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,cAAc,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,KAAK,CAAC;AAGtE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,mCAAmC,CAAC;AAG/E,OAAO,UAAU,MAAM,kBAAkB,CAAC;AAC1C,OAAO,kCAAkC,CAAC;AAC1C,OAAO,4BAA4B,CAAC;AACpC,OAAO,mCAAmC,CAAC;AAE3C,eAAO,MAAM,gBAAgB,UAAsB,CAAC;AAEpD;;;;;GAKG;AACH,MAAM,CAAC,OAAO,OAAO,YAAa,SAAQ,UAAU;IAClD,WAAoB,MAAM,IAAI,SAAS,EAAE,CAExC;IAED;;;;;;;;;OASG;IACyB,GAAG,CAAC,EAAE,MAAM,CAAC;IAEzC;;;;;OAKG;IACyB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAE9C;;;;;OAKG;IACyB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAE9C;;;;OAIG;IACyB,WAAW,CAAC,EAAE,MAAM,CAAC;IAEjD;;;OAGG;IACwB,SAAS,CAAC,EAAE,SAAS,EAAE,CAAC;IAEnD;;OAEG;IACH,SAAS,CAAC,aAAa,CAAC,EAAE,MAAM,CAAC;IAEjC;;OAEG;IACH,SAAS,CAAC,cAAc,SAAgB;IAER,SAAS,CAAC,aAAa,CAAC,EAAE,gBAAgB,CAAC;cAExD,UAAU,CAAC,EAAE,EAAE,cAAc,CAAC,IAAI,CAAC,GAAG,IAAI;IAO7D;;;;OAIG;IACH,aAAa,IAAI,IAAI;IAKrB,SAAS,CAAC,UAAU,IAAI,IAAI;IAM5B,SAAS,CAAC,YAAY,IAAI,IAAI;IAQ9B;;OAEG;IACH,SAAS,IAAI,OAAO;IAKpB;;OAEG;IACH,cAAc,CAAC,KAAK,EAAE,KAAK,GAAG,UAAU,GAAG,UAAU,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI;IAK3E,SAAS,CAAC,eAAe,CAAC,CAAC,EAAE,KAAK,GAAG,IAAI;IAMzC,SAAS,CAAC,oBAAoB,CAAC,CAAC,EAAE,KAAK,GAAG,IAAI;IAM9C,SAAS,CAAC,oBAAoB,CAAC,CAAC,EAAE,KAAK,GAAG,IAAI;IAM9C,SAAS,CAAC,YAAY,IAAI,IAAI;IAIrB,MAAM,IAAI,cAAc;IAYjC,SAAS,CAAC,YAAY,IAAI,cAAc;IASxC,SAAS,CAAC,cAAc,IAAI,cAAc;IAc1C,SAAS,CAAC,mBAAmB,IAAI,cAAc;IAa/C,SAAS,CAAC,mBAAmB,IAAI,cAAc;IAY/C,SAAS,CAAC,WAAW,IAAI,cAAc,GAAG,MAAM;IAahD,SAAS,CAAC,kBAAkB,IAAI,cAAc;CAO/C"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { __decorate } from "tslib";
|
|
2
|
-
|
|
3
|
-
import { LitElement, html } from 'lit';
|
|
2
|
+
import { html } from 'lit';
|
|
4
3
|
import { property, query } from 'lit/decorators.js';
|
|
5
4
|
import { live } from 'lit/directives/live.js';
|
|
6
5
|
import { Server } from '@api-client/core/build/browser.js';
|
|
7
6
|
import elementStyles from './ServerEditor.styles.js';
|
|
7
|
+
import ApiElement from '../ApiElement.js';
|
|
8
8
|
import '../../define/ui/ui-text-field.js';
|
|
9
9
|
import '../../define/ui/ui-icon.js';
|
|
10
10
|
import '../../define/ui/ui-icon-button.js';
|
|
@@ -15,7 +15,7 @@ export const DefaultProtocols = ['http:', 'https:'];
|
|
|
15
15
|
* @fires change - When a value change.
|
|
16
16
|
* @fires delete - When the user requested server definition delete.
|
|
17
17
|
*/
|
|
18
|
-
export default class ServerEditor extends
|
|
18
|
+
export default class ServerEditor extends ApiElement {
|
|
19
19
|
constructor() {
|
|
20
20
|
super(...arguments);
|
|
21
21
|
/**
|
|
@@ -82,9 +82,6 @@ export default class ServerEditor extends LitElement {
|
|
|
82
82
|
this.updateProperty('protocol', input.value);
|
|
83
83
|
input.checkValidity();
|
|
84
84
|
}
|
|
85
|
-
notifyChange() {
|
|
86
|
-
this.dispatchEvent(new Event('change'));
|
|
87
|
-
}
|
|
88
85
|
handleDelete() {
|
|
89
86
|
this.dispatchEvent(new Event('delete'));
|
|
90
87
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ServerEditor.js","sourceRoot":"","sources":["../../../src/elements/environment/ServerEditor.ts"],"names":[],"mappings":";AAAA,2CAA2C;AAC3C,OAAO,EAAE,UAAU,EAAE,IAAI,EAA6C,MAAM,KAAK,CAAC;AAClF,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;AAC9C,OAAO,EAAW,MAAM,EAAa,MAAM,mCAAmC,CAAC;AAC/E,OAAO,aAAa,MAAM,0BAA0B,CAAC;AAErD,OAAO,kCAAkC,CAAC;AAC1C,OAAO,4BAA4B,CAAC;AACpC,OAAO,mCAAmC,CAAC;AAE3C,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;AAEpD;;;;;GAKG;AACH,MAAM,CAAC,OAAO,OAAO,YAAa,SAAQ,UAAU;IAApD;;QAmDE;;WAEG;QACO,mBAAc,GAAG,IAAI,MAAM,EAAE,CAAC;IA6J1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AEnB,IAAI,CAAC,eAAe;;;KAGlC,CAAC;IACJ,CAAC;IAES,mBAAmB;QAC3B,OAAO,IAAI,CAAA;;;;kBAIG,IAAI,CAAC,IAAI,CAAC,QAAQ,IAAI,EAAE,CAAC;iBAC1B,gBAAgB;;mBAEd,IAAI,CAAC,oBAAoB;;WAEjC,CAAC;IACV,CAAC;IAES,mBAAmB;QAC3B,OAAO,IAAI,CAAA;;;;kBAIG,IAAI,CAAC,IAAI,CAAC,QAAQ,IAAI,EAAE,CAAC;;mBAExB,IAAI,CAAC,oBAAoB;;WAEjC,CAAC;IACV,CAAC;IAES,WAAW;QACnB,MAAM,EAAE,aAAa,EAAE,GAAG,IAAI,CAAC;QAC/B,IAAI,CAAC,aAAa,EAAE;YAClB,OAAO,EAAE,CAAC;SACX;QACD,OAAO,IAAI,CAAA;;;QAGP,aAAa;;KAEhB,CAAC;IACJ,CAAC;IAES,kBAAkB;QAC1B,OAAO,IAAI,CAAA;8DAC+C,IAAI,CAAC,YAAY;;;KAG1E,CAAC;IACJ,CAAC;CACF;AApM6B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;yCAAc;AAQb;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;8CAAmB;AAQlB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;8CAAmB;AAOlB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;iDAAsB;AAMtB;IAA1B,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;+CAAyB;AAYnB;IAA/B,KAAK,CAAC,gBAAgB,EAAE,KAAK,CAAC;mDAA4C","sourcesContent":["/* eslint-disable class-methods-use-this */\nimport { LitElement, html, TemplateResult, CSSResult, PropertyValues } from 'lit';\nimport { property, query } from 'lit/decorators.js';\nimport { live } from 'lit/directives/live.js';\nimport { IServer, Server, IProperty } from '@api-client/core/build/browser.js';\nimport elementStyles from './ServerEditor.styles.js';\nimport Input from '../../ui/input/Input.js';\nimport '../../define/ui/ui-text-field.js';\nimport '../../define/ui/ui-icon.js';\nimport '../../define/ui/ui-icon-button.js';\n\nexport const DefaultProtocols = ['http:', 'https:'];\n\n/**\n * An element to render a view for a server definition with a form to edit it.\n * \n * @fires change - When a value change.\n * @fires delete - When the user requested server definition delete.\n */\nexport default class ServerEditor extends LitElement {\n static override get styles(): CSSResult[] {\n return [elementStyles];\n }\n\n /**\n * The base URI of the server.\n * \n * Note, the URL can contain URI templates (e.g. `http://{host}.api.com/v1`)\n * In this case the variable is replaced with the system or project variables.\n * \n * For simplicity, the `uri` can be the full base URI with protocol, host, and the `basePath`\n * \n * @attribute\n */\n @property({ type: String }) uri?: string;\n\n /**\n * Usually included in the `uri`. When the `uri` is missing a protocol \n * this is then used.\n * \n * @attribute\n */\n @property({ type: String }) protocol?: string;\n\n /**\n * The base path for the server. It starts with the `/`.\n * When set, it is appended to the `uri` value.\n * \n * @attribute\n */\n @property({ type: String }) basePath?: string;\n\n /**\n * Optional description of the server.\n * \n * @attribute\n */\n @property({ type: String }) description?: string;\n\n /**\n * Optional list of variables to set on the environment.\n * When set it evaluates the final URI value against these properties.\n */\n @property({ type: Array }) variables?: IProperty[];\n\n /**\n * The computed value of the full URI from the values.\n */\n protected valueInternal?: string;\n\n /**\n * The server logic used with computations.\n */\n protected serverInternal = new Server();\n\n @query('#protocolInput', false) protected protocolInput?: HTMLInputElement;\n\n protected override willUpdate(cp: PropertyValues<this>): void {\n if (cp.has('uri') || cp.has('protocol') || cp.has('basePath') || cp.has('description')) {\n this.setupValue();\n }\n super.willUpdate(cp);\n }\n\n /**\n * Updates the value of the generated base URI.\n * This can be called from the outside of the component to force computation.\n * This is helpful when deep-updating variables.\n */\n generateValue(): void {\n this.setupValue();\n this.requestUpdate();\n }\n\n protected setupValue(): void {\n const { serverInternal } = this;\n this.updateServer();\n this.valueInternal = serverInternal.readUri(this.variables);\n }\n\n protected updateServer(): void {\n const { serverInternal, uri = '', protocol, basePath, description } = this;\n serverInternal.uri = uri;\n serverInternal.protocol = protocol;\n serverInternal.basePath = basePath;\n serverInternal.description = description;\n }\n\n /**\n * Creates a schema for the current values.\n */\n getSchema(): IServer {\n this.updateServer();\n return this.serverInternal.toJSON();\n }\n\n /**\n * Updates name/value of a parameter on a specific index.\n */\n updateProperty(field: 'uri' | 'basePath' | 'protocol', value: string): void {\n this[field] = value;\n this.notifyChange();\n }\n\n protected handleUriChange(e: Event): void {\n const input = e.target as Input;\n this.updateProperty('uri', input.value);\n input.checkValidity();\n }\n\n protected handleBasePathChange(e: Event): void {\n const input = e.target as Input;\n this.updateProperty('basePath', input.value);\n input.checkValidity();\n }\n\n protected handleProtocolChange(e: Event): void {\n const input = e.target as Input;\n this.updateProperty('protocol', input.value);\n input.checkValidity();\n }\n\n protected notifyChange(): void {\n this.dispatchEvent(new Event('change'));\n }\n\n protected handleDelete(): void {\n this.dispatchEvent(new Event('delete'));\n }\n\n override render(): TemplateResult {\n return html`\n ${this.renderHeader()}\n <form>\n ${this.renderUriInput()}\n ${this.renderProtocolInput()}\n ${this.renderBasePathInput()}\n </form>\n ${this.renderValue()}\n `;\n }\n\n protected renderHeader(): TemplateResult {\n return html`\n <div class=\"header\">\n <div class=\"section-title\">Server</div>\n ${this.renderDeleteButton()}\n </div>\n `;\n }\n\n protected renderUriInput(): TemplateResult {\n return html`\n <div class=\"form-item\">\n <ui-text-field\n required\n name=\"uri\" \n .value=\"${live(this.uri || '')}\"\n label=\"URI\"\n @change=\"${this.handleUriChange}\"\n ></ui-text-field>\n </div>\n `;\n }\n\n protected renderProtocolInput(): TemplateResult {\n return html`\n <div class=\"form-item\">\n <ui-text-field\n name=\"protocol\"\n .value=\"${live(this.protocol || '')}\"\n .list=\"${DefaultProtocols}\"\n label=\"Protocol (optional)\"\n @change=\"${this.handleProtocolChange}\"\n ></ui-text-field>\n </div>`;\n }\n\n protected renderBasePathInput(): TemplateResult {\n return html`\n <div class=\"form-item\">\n <ui-text-field\n name=\"basePath\"\n .value=\"${live(this.basePath || '')}\"\n label=\"Base path (optional)\"\n @change=\"${this.handleBasePathChange}\"\n ></ui-text-field>\n </div>`;\n }\n\n protected renderValue(): TemplateResult | string {\n const { valueInternal } = this;\n if (!valueInternal) {\n return '';\n }\n return html`\n <div class=\"uri-label\">Server URI</div>\n <div class=\"value-preview\">\n ${valueInternal}\n </div>\n `;\n }\n\n protected renderDeleteButton(): TemplateResult {\n return html`\n <ui-icon-button aria-label=\"Remove this server\" @click=\"${this.handleDelete}\">\n <ui-icon icon=\"deleteOutline\" role=\"presentation\"></ui-icon>\n </ui-icon-button>\n `;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"ServerEditor.js","sourceRoot":"","sources":["../../../src/elements/environment/ServerEditor.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAA6C,MAAM,KAAK,CAAC;AACtE,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;AAC9C,OAAO,EAAW,MAAM,EAAa,MAAM,mCAAmC,CAAC;AAC/E,OAAO,aAAa,MAAM,0BAA0B,CAAC;AAErD,OAAO,UAAU,MAAM,kBAAkB,CAAC;AAC1C,OAAO,kCAAkC,CAAC;AAC1C,OAAO,4BAA4B,CAAC;AACpC,OAAO,mCAAmC,CAAC;AAE3C,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;AAEpD;;;;;GAKG;AACH,MAAM,CAAC,OAAO,OAAO,YAAa,SAAQ,UAAU;IAApD;;QAmDE;;WAEG;QACO,mBAAc,GAAG,IAAI,MAAM,EAAE,CAAC;IAyJ1C,CAAC;IA9MC,MAAM,KAAc,MAAM;QACxB,OAAO,CAAC,aAAa,CAAC,CAAC;IACzB,CAAC;IAuDkB,UAAU,CAAC,EAAwB;QACpD,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V,CAAC;IAES,mBAAmB;QAC3B,OAAO,IAAI,CAAA;;;;kBAIG,IAAI,CAAC,IAAI,CAAC,QAAQ,IAAI,EAAE,CAAC;;mBAExB,IAAI,CAAC,oBAAoB;;WAEjC,CAAC;IACV,CAAC;IAES,WAAW;QACnB,MAAM,EAAE,aAAa,EAAE,GAAG,IAAI,CAAC;QAC/B,IAAI,CAAC,aAAa,EAAE;YAClB,OAAO,EAAE,CAAC;SACX;QACD,OAAO,IAAI,CAAA;;;QAGP,aAAa;;KAEhB,CAAC;IACJ,CAAC;IAES,kBAAkB;QAC1B,OAAO,IAAI,CAAA;8DAC+C,IAAI,CAAC,YAAY;;;KAG1E,CAAC;IACJ,CAAC;CACF;AAhM6B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;yCAAc;AAQb;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;8CAAmB;AAQlB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;8CAAmB;AAOlB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;iDAAsB;AAMtB;IAA1B,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;+CAAyB;AAYnB;IAA/B,KAAK,CAAC,gBAAgB,EAAE,KAAK,CAAC;mDAA4C","sourcesContent":["import { html, TemplateResult, CSSResult, PropertyValues } from 'lit';\nimport { property, query } from 'lit/decorators.js';\nimport { live } from 'lit/directives/live.js';\nimport { IServer, Server, IProperty } from '@api-client/core/build/browser.js';\nimport elementStyles from './ServerEditor.styles.js';\nimport Input from '../../ui/input/Input.js';\nimport ApiElement from '../ApiElement.js';\nimport '../../define/ui/ui-text-field.js';\nimport '../../define/ui/ui-icon.js';\nimport '../../define/ui/ui-icon-button.js';\n\nexport const DefaultProtocols = ['http:', 'https:'];\n\n/**\n * An element to render a view for a server definition with a form to edit it.\n * \n * @fires change - When a value change.\n * @fires delete - When the user requested server definition delete.\n */\nexport default class ServerEditor extends ApiElement {\n static override get styles(): CSSResult[] {\n return [elementStyles];\n }\n\n /**\n * The base URI of the server.\n * \n * Note, the URL can contain URI templates (e.g. `http://{host}.api.com/v1`)\n * In this case the variable is replaced with the system or project variables.\n * \n * For simplicity, the `uri` can be the full base URI with protocol, host, and the `basePath`\n * \n * @attribute\n */\n @property({ type: String }) uri?: string;\n\n /**\n * Usually included in the `uri`. When the `uri` is missing a protocol \n * this is then used.\n * \n * @attribute\n */\n @property({ type: String }) protocol?: string;\n\n /**\n * The base path for the server. It starts with the `/`.\n * When set, it is appended to the `uri` value.\n * \n * @attribute\n */\n @property({ type: String }) basePath?: string;\n\n /**\n * Optional description of the server.\n * \n * @attribute\n */\n @property({ type: String }) description?: string;\n\n /**\n * Optional list of variables to set on the environment.\n * When set it evaluates the final URI value against these properties.\n */\n @property({ type: Array }) variables?: IProperty[];\n\n /**\n * The computed value of the full URI from the values.\n */\n protected valueInternal?: string;\n\n /**\n * The server logic used with computations.\n */\n protected serverInternal = new Server();\n\n @query('#protocolInput', false) protected protocolInput?: HTMLInputElement;\n\n protected override willUpdate(cp: PropertyValues<this>): void {\n if (cp.has('uri') || cp.has('protocol') || cp.has('basePath') || cp.has('description')) {\n this.setupValue();\n }\n super.willUpdate(cp);\n }\n\n /**\n * Updates the value of the generated base URI.\n * This can be called from the outside of the component to force computation.\n * This is helpful when deep-updating variables.\n */\n generateValue(): void {\n this.setupValue();\n this.requestUpdate();\n }\n\n protected setupValue(): void {\n const { serverInternal } = this;\n this.updateServer();\n this.valueInternal = serverInternal.readUri(this.variables);\n }\n\n protected updateServer(): void {\n const { serverInternal, uri = '', protocol, basePath, description } = this;\n serverInternal.uri = uri;\n serverInternal.protocol = protocol;\n serverInternal.basePath = basePath;\n serverInternal.description = description;\n }\n\n /**\n * Creates a schema for the current values.\n */\n getSchema(): IServer {\n this.updateServer();\n return this.serverInternal.toJSON();\n }\n\n /**\n * Updates name/value of a parameter on a specific index.\n */\n updateProperty(field: 'uri' | 'basePath' | 'protocol', value: string): void {\n this[field] = value;\n this.notifyChange();\n }\n\n protected handleUriChange(e: Event): void {\n const input = e.target as Input;\n this.updateProperty('uri', input.value);\n input.checkValidity();\n }\n\n protected handleBasePathChange(e: Event): void {\n const input = e.target as Input;\n this.updateProperty('basePath', input.value);\n input.checkValidity();\n }\n\n protected handleProtocolChange(e: Event): void {\n const input = e.target as Input;\n this.updateProperty('protocol', input.value);\n input.checkValidity();\n }\n \n protected handleDelete(): void {\n this.dispatchEvent(new Event('delete'));\n }\n\n override render(): TemplateResult {\n return html`\n ${this.renderHeader()}\n <form>\n ${this.renderUriInput()}\n ${this.renderProtocolInput()}\n ${this.renderBasePathInput()}\n </form>\n ${this.renderValue()}\n `;\n }\n\n protected renderHeader(): TemplateResult {\n return html`\n <div class=\"header\">\n <div class=\"section-title\">Server</div>\n ${this.renderDeleteButton()}\n </div>\n `;\n }\n\n protected renderUriInput(): TemplateResult {\n return html`\n <div class=\"form-item\">\n <ui-text-field\n required\n name=\"uri\" \n .value=\"${live(this.uri || '')}\"\n label=\"URI\"\n @change=\"${this.handleUriChange}\"\n ></ui-text-field>\n </div>\n `;\n }\n\n protected renderProtocolInput(): TemplateResult {\n return html`\n <div class=\"form-item\">\n <ui-text-field\n name=\"protocol\"\n .value=\"${live(this.protocol || '')}\"\n .list=\"${DefaultProtocols}\"\n label=\"Protocol (optional)\"\n @change=\"${this.handleProtocolChange}\"\n ></ui-text-field>\n </div>`;\n }\n\n protected renderBasePathInput(): TemplateResult {\n return html`\n <div class=\"form-item\">\n <ui-text-field\n name=\"basePath\"\n .value=\"${live(this.basePath || '')}\"\n label=\"Base path (optional)\"\n @change=\"${this.handleBasePathChange}\"\n ></ui-text-field>\n </div>`;\n }\n\n protected renderValue(): TemplateResult | string {\n const { valueInternal } = this;\n if (!valueInternal) {\n return '';\n }\n return html`\n <div class=\"uri-label\">Server URI</div>\n <div class=\"value-preview\">\n ${valueInternal}\n </div>\n `;\n }\n\n protected renderDeleteButton(): TemplateResult {\n return html`\n <ui-icon-button aria-label=\"Remove this server\" @click=\"${this.handleDelete}\">\n <ui-icon icon=\"deleteOutline\" role=\"presentation\"></ui-icon>\n </ui-icon-button>\n `;\n }\n}\n"]}
|
|
@@ -35,7 +35,6 @@ export default class VariablesEditor extends ApiElement {
|
|
|
35
35
|
* Toggles enabled state of a parameter.
|
|
36
36
|
*/
|
|
37
37
|
toggleProperty(index: number, enabled: boolean): void;
|
|
38
|
-
protected notifyChanged(): void;
|
|
39
38
|
protected handleAddVariable(): void;
|
|
40
39
|
protected ensureEditorInView(): Promise<void>;
|
|
41
40
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VariablesEditor.d.ts","sourceRoot":"","sources":["../../../src/elements/environment/VariablesEditor.ts"],"names":[],"mappings":"AACA,OAAO,EAAQ,cAAc,EAAE,SAAS,EAAE,MAAM,KAAK,CAAC;AAGtD,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,mCAAmC,CAAC;AAIxE,OAAO,UAAU,MAAM,kBAAkB,CAAC;AAI1C,OAAO,4BAA4B,CAAC;AACpC,OAAO,4BAA4B,CAAC;AACpC,OAAO,iCAAiC,CAAC;AACzC,OAAO,8BAA8B,CAAC;AACtC,OAAO,mCAAmC,CAAC;AAE3C;;GAEG;AACH,MAAM,CAAC,OAAO,OAAO,eAAgB,SAAQ,UAAU;IACrD,WAAoB,MAAM,IAAI,SAAS,EAAE,CAExC;IAED;;;;OAIG;IACwB,SAAS,CAAC,EAAE,SAAS,EAAE,CAAC;IAEnD;;OAEG;IAC0B,YAAY,UAAS;IAEzC,SAAS,CAAC,cAAc,CAAC,EAAE,MAAM,CAAC;IAEzB,SAAS,CAAC,MAAM,CAAC,EAAE,WAAW,CAAC;IAEjD;;OAEG;IACH,cAAc,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,EAAE,KAAK,EAA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,GAAG,cAAc;IAczD,SAAS,CAAC,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,cAAc;IAc1D,SAAS,CAAC,eAAe,CAAC,IAAI,EAAE,SAAS,GAAG,QAAQ,EAAE,KAAK,EAAE,MAAM,GAAG,cAAc;IAoBpF,SAAS,CAAC,gBAAgB,CAAC,IAAI,EAAE,SAAS,GAAG,QAAQ,EAAE,KAAK,EAAE,MAAM,GAAG,cAAc;CAiBtF"}
|
|
@@ -36,7 +36,7 @@ export default class VariablesEditor extends ApiElement {
|
|
|
36
36
|
return;
|
|
37
37
|
}
|
|
38
38
|
variables[index][field] = value;
|
|
39
|
-
this.
|
|
39
|
+
this.notifyChange();
|
|
40
40
|
}
|
|
41
41
|
/**
|
|
42
42
|
* Removes a parameter from an index.
|
|
@@ -47,7 +47,7 @@ export default class VariablesEditor extends ApiElement {
|
|
|
47
47
|
return;
|
|
48
48
|
}
|
|
49
49
|
variables.splice(index, 1);
|
|
50
|
-
this.
|
|
50
|
+
this.notifyChange();
|
|
51
51
|
this.requestUpdate();
|
|
52
52
|
}
|
|
53
53
|
/**
|
|
@@ -63,10 +63,7 @@ export default class VariablesEditor extends ApiElement {
|
|
|
63
63
|
return;
|
|
64
64
|
}
|
|
65
65
|
variable.enabled = enabled;
|
|
66
|
-
this.
|
|
67
|
-
}
|
|
68
|
-
notifyChanged() {
|
|
69
|
-
this.dispatchEvent(new Event('change'));
|
|
66
|
+
this.notifyChange();
|
|
70
67
|
}
|
|
71
68
|
handleAddVariable() {
|
|
72
69
|
if (!this.variables) {
|