@api-client/ui 0.0.5 → 0.0.7
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/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/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,1187 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
IHttpAssertion, DataSteps, FlowSourceEnum, FlowRequestDataEnum,
|
|
3
|
-
FlowResponseDataEnum, TransformationSteps, HttpAssertions as CoreAssertions, AmfNamespace
|
|
4
|
-
} from "@api-client/core/build/browser.js";
|
|
5
|
-
import { html, nothing, TemplateResult } from "lit";
|
|
6
|
-
import { property } from "lit/decorators.js";
|
|
7
|
-
import { ifDefined } from "lit/directives/if-defined.js";
|
|
8
|
-
import { live } from "lit/directives/live.js";
|
|
9
|
-
import { IHttpStep } from "@api-client/core/build/src/models/http-actions/HttpStep.js";
|
|
10
|
-
import ApiElement from "../ApiElement.js";
|
|
11
|
-
import SwitchElement from "../../ui/input/SwitchElement.js";
|
|
12
|
-
import UiChip from "../../ui/chip/UiChip.js";
|
|
13
|
-
import Input from "../../ui/input/Input.js";
|
|
14
|
-
import UiDialog, { UiDialogClosingReason } from "../../ui/dialog/UiDialog.js";
|
|
15
|
-
import '../../define/ui/ui-button.js';
|
|
16
|
-
import '../../define/ui/ui-icon-button.js';
|
|
17
|
-
import '../../define/ui/ui-switch.js';
|
|
18
|
-
import '../../define/ui/ui-icon.js';
|
|
19
|
-
import '../../define/ui/ui-text-field.js';
|
|
20
|
-
import '../../define/ui/ui-chip.js';
|
|
21
|
-
import '../../define/ui/ui-dialog.js';
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* @fires change When the model change
|
|
25
|
-
*/
|
|
26
|
-
export default class HttpAssertions extends ApiElement {
|
|
27
|
-
/**
|
|
28
|
-
* The list of assertions.
|
|
29
|
-
* This is a live list. All changes are propagated in the model.
|
|
30
|
-
*/
|
|
31
|
-
@property({ type: Array }) model: IHttpAssertion[] = [];
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* Adds a new empty assertion to the model.
|
|
35
|
-
* Note, this function won't notify the parent element
|
|
36
|
-
* about the change as empty rules can be discarded.
|
|
37
|
-
*/
|
|
38
|
-
addAssertion(): void {
|
|
39
|
-
const { model } = this;
|
|
40
|
-
model.push({
|
|
41
|
-
enabled: true,
|
|
42
|
-
steps: [],
|
|
43
|
-
});
|
|
44
|
-
this.requestUpdate();
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
/**
|
|
48
|
-
* Removes an assertion at specified index.
|
|
49
|
-
* @param index The index of the assertion in the `model` to remove.
|
|
50
|
-
*/
|
|
51
|
-
removeAssertion(index: number): void {
|
|
52
|
-
const { model } = this;
|
|
53
|
-
if (!model[index]) {
|
|
54
|
-
throw new RangeError(`Invalid index: ${index}`);
|
|
55
|
-
}
|
|
56
|
-
model.splice(index, 1);
|
|
57
|
-
this.requestUpdate();
|
|
58
|
-
this.notifyChange();
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
/**
|
|
62
|
-
* Toggles the enabled state of the assertion.
|
|
63
|
-
* @param index The index of the assertion on the `model` array
|
|
64
|
-
* @param value The `enabled` value.
|
|
65
|
-
*/
|
|
66
|
-
toggleAssertion(index: number, value: boolean): void {
|
|
67
|
-
const { model } = this;
|
|
68
|
-
if (!model[index]) {
|
|
69
|
-
throw new RangeError(`Invalid index: ${index}`);
|
|
70
|
-
}
|
|
71
|
-
model[index].enabled = value;
|
|
72
|
-
this.requestUpdate();
|
|
73
|
-
this.notifyChange();
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
protected notifyChange(): void {
|
|
77
|
-
this.dispatchEvent(new Event('change'));
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
protected handleAdd(): void {
|
|
81
|
-
this.addAssertion();
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
protected handleRemove(e: Event): void {
|
|
85
|
-
const node = e.currentTarget as HTMLElement;
|
|
86
|
-
const index = Number(node.dataset.index);
|
|
87
|
-
if (Number.isNaN(index)) {
|
|
88
|
-
return;
|
|
89
|
-
}
|
|
90
|
-
this.removeAssertion(index);
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
protected handleToggle(e: Event): void {
|
|
94
|
-
const node = e.currentTarget as SwitchElement;
|
|
95
|
-
const index = Number(node.dataset.index);
|
|
96
|
-
if (Number.isNaN(index)) {
|
|
97
|
-
return;
|
|
98
|
-
}
|
|
99
|
-
this.toggleAssertion(index, node.checked);
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
protected handleRemoveStep(e: Event): void {
|
|
103
|
-
const target = e.currentTarget as HTMLElement;
|
|
104
|
-
const assertionIndex = Number(target.dataset.index);
|
|
105
|
-
const stepIndex = Number(target.dataset.stepIndex);
|
|
106
|
-
if (Number.isNaN(assertionIndex) || Number.isNaN(stepIndex)) {
|
|
107
|
-
return;
|
|
108
|
-
}
|
|
109
|
-
const assertion = this.model[assertionIndex];
|
|
110
|
-
if (!assertion) {
|
|
111
|
-
return;
|
|
112
|
-
}
|
|
113
|
-
assertion.steps.splice(stepIndex, 1);
|
|
114
|
-
this.notifyChange();
|
|
115
|
-
this.requestUpdate();
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
protected draggedChip?: UiChip;
|
|
119
|
-
|
|
120
|
-
protected isValidDropTarget(dataTransfer?: DataTransfer | null): boolean {
|
|
121
|
-
if (!dataTransfer) {
|
|
122
|
-
return false;
|
|
123
|
-
}
|
|
124
|
-
const { types } = dataTransfer;
|
|
125
|
-
return types.includes('assertion/group') && types.includes('assertion/kind');
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
protected handleDragStart(e: DragEvent): void {
|
|
129
|
-
const { dataTransfer } = e;
|
|
130
|
-
if (!dataTransfer) {
|
|
131
|
-
return;
|
|
132
|
-
}
|
|
133
|
-
const chip = e.target as UiChip;
|
|
134
|
-
const { group, kind, source, data, variant } = chip.dataset;
|
|
135
|
-
if (!group || !kind) {
|
|
136
|
-
return;
|
|
137
|
-
}
|
|
138
|
-
const copy = chip.cloneNode(true) as UiChip;
|
|
139
|
-
copy.style.position = 'absolute';
|
|
140
|
-
copy.style.top = `-100px`;
|
|
141
|
-
this.draggedChip = copy;
|
|
142
|
-
document.body.appendChild(copy);
|
|
143
|
-
dataTransfer.setDragImage(copy, 0, 0);
|
|
144
|
-
dataTransfer.setData('assertion/group', group);
|
|
145
|
-
dataTransfer.setData('assertion/kind', kind);
|
|
146
|
-
if (source) {
|
|
147
|
-
dataTransfer.setData('assertion/source', source);
|
|
148
|
-
}
|
|
149
|
-
if (data) {
|
|
150
|
-
dataTransfer.setData('assertion/data', data);
|
|
151
|
-
}
|
|
152
|
-
if (variant) {
|
|
153
|
-
dataTransfer.setData('assertion/variant', variant);
|
|
154
|
-
}
|
|
155
|
-
chip.blur();
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
protected handleDragEnd(e: DragEvent): void {
|
|
159
|
-
const { draggedChip } = this;
|
|
160
|
-
if (!draggedChip) {
|
|
161
|
-
return;
|
|
162
|
-
}
|
|
163
|
-
e.preventDefault();
|
|
164
|
-
draggedChip.parentElement?.removeChild(draggedChip);
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
protected handleTargetDragOver(e: DragEvent): void {
|
|
168
|
-
const { draggedChip } = this;
|
|
169
|
-
if (!draggedChip || e.defaultPrevented || !this.isValidDropTarget(e.dataTransfer)) {
|
|
170
|
-
return;
|
|
171
|
-
}
|
|
172
|
-
e.preventDefault();
|
|
173
|
-
const target = e.currentTarget as HTMLElement;
|
|
174
|
-
target.classList.add('dragover');
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
protected handleTargetDragLeave(e: DragEvent): void {
|
|
178
|
-
if (e.defaultPrevented || !this.isValidDropTarget(e.dataTransfer)) {
|
|
179
|
-
return;
|
|
180
|
-
}
|
|
181
|
-
const target = e.currentTarget as HTMLElement;
|
|
182
|
-
target.classList.remove('dragover');
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
protected handleDrop(e: DragEvent): void {
|
|
186
|
-
const { dataTransfer } = e;
|
|
187
|
-
if (!dataTransfer || e.defaultPrevented || !this.isValidDropTarget(dataTransfer)) {
|
|
188
|
-
return;
|
|
189
|
-
}
|
|
190
|
-
e.preventDefault();
|
|
191
|
-
this.resetDragIndices();
|
|
192
|
-
const { index, stepIndex } = (e.target as HTMLElement).dataset;
|
|
193
|
-
const typedAssertionIndex = Number(index);
|
|
194
|
-
if (Number.isNaN(typedAssertionIndex)) {
|
|
195
|
-
return;
|
|
196
|
-
}
|
|
197
|
-
let typedStepIndex: number | undefined;
|
|
198
|
-
if (stepIndex) {
|
|
199
|
-
const tmp = Number(stepIndex);
|
|
200
|
-
if (!Number.isNaN(tmp)) {
|
|
201
|
-
typedStepIndex = tmp;
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
this.processDrop(dataTransfer, typedAssertionIndex, typedStepIndex);
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
protected resetDragIndices(): void {
|
|
208
|
-
const nodes = (this.shadowRoot as ShadowRoot).querySelectorAll('.dragover');
|
|
209
|
-
Array.from(nodes).forEach(n => n.classList.remove('dragover'));
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
protected processDrop(dataTransfer: DataTransfer, assertionIndex: number, stepIndex?: number): void {
|
|
213
|
-
const group = dataTransfer.getData('assertion/group');
|
|
214
|
-
if (!group) {
|
|
215
|
-
return;
|
|
216
|
-
}
|
|
217
|
-
if (group === 'data-source') {
|
|
218
|
-
this.processDataSourceDrop(dataTransfer, assertionIndex, stepIndex);
|
|
219
|
-
} else if (group === 'transformation') {
|
|
220
|
-
this.processTransformationDrop(dataTransfer, assertionIndex, stepIndex);
|
|
221
|
-
} else if (group === 'assertion') {
|
|
222
|
-
this.processAssertionDrop(dataTransfer, assertionIndex, stepIndex);
|
|
223
|
-
}
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
protected processDataSourceDrop(dataTransfer: DataTransfer, assertionIndex: number, stepIndex?: number): void {
|
|
227
|
-
const item = this.model[assertionIndex];
|
|
228
|
-
if (!item) {
|
|
229
|
-
return;
|
|
230
|
-
}
|
|
231
|
-
const source = dataTransfer.getData('assertion/source') as FlowSourceEnum;
|
|
232
|
-
const data = dataTransfer.getData('assertion/data') as FlowRequestDataEnum | FlowResponseDataEnum;
|
|
233
|
-
const step = new DataSteps.ReadDataSourceStep(source, data).toJSON();
|
|
234
|
-
if (stepIndex === undefined) {
|
|
235
|
-
item.steps.push(step);
|
|
236
|
-
} else if (stepIndex === -1) {
|
|
237
|
-
item.steps.unshift(step);
|
|
238
|
-
} else {
|
|
239
|
-
item.steps.splice(stepIndex, 0, step);
|
|
240
|
-
}
|
|
241
|
-
this.requestUpdate();
|
|
242
|
-
this.notifyChange();
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
protected processTransformationDrop(dataTransfer: DataTransfer, assertionIndex: number, stepIndex?: number): void {
|
|
246
|
-
const item = this.model[assertionIndex];
|
|
247
|
-
if (!item) {
|
|
248
|
-
return;
|
|
249
|
-
}
|
|
250
|
-
let step: IHttpStep | undefined;
|
|
251
|
-
const kind = dataTransfer.getData('assertion/kind');
|
|
252
|
-
if (kind === DataSteps.ReadValueStepKind) {
|
|
253
|
-
step = new DataSteps.ReadValueStep().toJSON();
|
|
254
|
-
} else if (kind === TransformationSteps.AsNumberStepKind) {
|
|
255
|
-
step = new TransformationSteps.AsNumberStep().toJSON();
|
|
256
|
-
} else if (kind === TransformationSteps.RoundStepKind) {
|
|
257
|
-
step = new TransformationSteps.RoundStep().toJSON();
|
|
258
|
-
} else if (kind === TransformationSteps.AsLowerCaseStepKind) {
|
|
259
|
-
step = new TransformationSteps.AsLowerCaseStep().toJSON();
|
|
260
|
-
} else if (kind === TransformationSteps.AsUpperCaseStepKind) {
|
|
261
|
-
step = new TransformationSteps.AsUpperCaseStep().toJSON();
|
|
262
|
-
} else if (kind === TransformationSteps.TrimStepKind) {
|
|
263
|
-
step = new TransformationSteps.TrimStep().toJSON();
|
|
264
|
-
} else if (kind === TransformationSteps.SubstringStepKind) {
|
|
265
|
-
step = new TransformationSteps.SubstringStep().toJSON();
|
|
266
|
-
}
|
|
267
|
-
if (!step) {
|
|
268
|
-
return;
|
|
269
|
-
}
|
|
270
|
-
if (stepIndex === undefined) {
|
|
271
|
-
item.steps.push(step);
|
|
272
|
-
} else if (stepIndex === -1) {
|
|
273
|
-
item.steps.unshift(step);
|
|
274
|
-
} else {
|
|
275
|
-
item.steps.splice(stepIndex, 0, step);
|
|
276
|
-
}
|
|
277
|
-
this.requestUpdate();
|
|
278
|
-
this.notifyChange();
|
|
279
|
-
}
|
|
280
|
-
|
|
281
|
-
protected processAssertionDrop(dataTransfer: DataTransfer, assertionIndex: number, stepIndex?: number): void {
|
|
282
|
-
const item = this.model[assertionIndex];
|
|
283
|
-
if (!item) {
|
|
284
|
-
return;
|
|
285
|
-
}
|
|
286
|
-
let step: IHttpStep | undefined;
|
|
287
|
-
const kind = dataTransfer.getData('assertion/kind');
|
|
288
|
-
if (kind === CoreAssertions.EqualAssertionKind) {
|
|
289
|
-
step = new CoreAssertions.EqualAssertion().toJSON();
|
|
290
|
-
} else if (kind === CoreAssertions.NotEqualAssertionKind) {
|
|
291
|
-
step = new CoreAssertions.NotEqualAssertion().toJSON();
|
|
292
|
-
} else if (kind === CoreAssertions.GreaterThanAssertionKind) {
|
|
293
|
-
const instance = new CoreAssertions.GreaterThanAssertion();
|
|
294
|
-
if (dataTransfer.getData('assertion/variant') === 'equal') {
|
|
295
|
-
instance.equal = true;
|
|
296
|
-
}
|
|
297
|
-
step = instance.toJSON();
|
|
298
|
-
} else if (kind === CoreAssertions.LessThanAssertionKind) {
|
|
299
|
-
const instance = new CoreAssertions.LessThanAssertion();
|
|
300
|
-
if (dataTransfer.getData('assertion/variant') === 'equal') {
|
|
301
|
-
instance.equal = true;
|
|
302
|
-
}
|
|
303
|
-
step = instance.toJSON();
|
|
304
|
-
} else if (kind === CoreAssertions.IncludesAssertionKind) {
|
|
305
|
-
step = new CoreAssertions.IncludesAssertion().toJSON();
|
|
306
|
-
} else if (kind === CoreAssertions.NotIncludesAssertionKind) {
|
|
307
|
-
step = new CoreAssertions.NotIncludesAssertion().toJSON();
|
|
308
|
-
} else if (kind === CoreAssertions.MatchesAssertionKind) {
|
|
309
|
-
step = new CoreAssertions.MatchesAssertion().toJSON();
|
|
310
|
-
} else if (kind === CoreAssertions.OkAssertionKind) {
|
|
311
|
-
step = new CoreAssertions.OkAssertion().toJSON();
|
|
312
|
-
} else if (kind === CoreAssertions.NotOkAssertionKind) {
|
|
313
|
-
step = new CoreAssertions.NotOkAssertion().toJSON();
|
|
314
|
-
} else if (kind === CoreAssertions.ToBeAssertionKind) {
|
|
315
|
-
step = new CoreAssertions.ToBeAssertion().toJSON();
|
|
316
|
-
} else if (kind === CoreAssertions.NotToBeAssertionKind) {
|
|
317
|
-
step = new CoreAssertions.NotToBeAssertion().toJSON();
|
|
318
|
-
}
|
|
319
|
-
if (!step) {
|
|
320
|
-
return;
|
|
321
|
-
}
|
|
322
|
-
if (stepIndex === undefined) {
|
|
323
|
-
item.steps.push(step);
|
|
324
|
-
} else if (stepIndex === -1) {
|
|
325
|
-
item.steps.unshift(step);
|
|
326
|
-
} else {
|
|
327
|
-
item.steps.splice(stepIndex, 0, step);
|
|
328
|
-
}
|
|
329
|
-
this.requestUpdate();
|
|
330
|
-
this.notifyChange();
|
|
331
|
-
}
|
|
332
|
-
|
|
333
|
-
protected handleReadValueStepChange(e: Event): void {
|
|
334
|
-
const step = this.stepFromChangeEvent(e) as DataSteps.IReadValueStep | undefined;
|
|
335
|
-
if (!step) {
|
|
336
|
-
return;
|
|
337
|
-
}
|
|
338
|
-
const input = e.target as Input;
|
|
339
|
-
input.checkValidity();
|
|
340
|
-
step.path = input.value;
|
|
341
|
-
this.requestUpdate();
|
|
342
|
-
this.notifyChange();
|
|
343
|
-
}
|
|
344
|
-
|
|
345
|
-
protected handleRoundPrecisionChange(e: Event): void {
|
|
346
|
-
const step = this.stepFromChangeEvent(e) as TransformationSteps.IRoundStep | undefined;
|
|
347
|
-
if (!step) {
|
|
348
|
-
return;
|
|
349
|
-
}
|
|
350
|
-
const input = e.target as Input;
|
|
351
|
-
input.checkValidity();
|
|
352
|
-
step.precision = input.valueAsNumber;
|
|
353
|
-
this.requestUpdate();
|
|
354
|
-
this.notifyChange();
|
|
355
|
-
}
|
|
356
|
-
|
|
357
|
-
protected handleSubstringStartChange(e: Event): void {
|
|
358
|
-
const step = this.stepFromChangeEvent(e) as TransformationSteps.ISubstringStep | undefined;
|
|
359
|
-
if (!step) {
|
|
360
|
-
return;
|
|
361
|
-
}
|
|
362
|
-
const input = e.target as Input;
|
|
363
|
-
input.checkValidity();
|
|
364
|
-
step.start = input.valueAsNumber;
|
|
365
|
-
this.requestUpdate();
|
|
366
|
-
this.notifyChange();
|
|
367
|
-
}
|
|
368
|
-
|
|
369
|
-
protected handleSubstringEndChange(e: Event): void {
|
|
370
|
-
const step = this.stepFromChangeEvent(e) as TransformationSteps.ISubstringStep | undefined;
|
|
371
|
-
if (!step) {
|
|
372
|
-
return;
|
|
373
|
-
}
|
|
374
|
-
const input = e.target as Input;
|
|
375
|
-
input.checkValidity();
|
|
376
|
-
step.end = input.valueAsNumber;
|
|
377
|
-
this.requestUpdate();
|
|
378
|
-
this.notifyChange();
|
|
379
|
-
}
|
|
380
|
-
|
|
381
|
-
protected handleEqualAssertionValueChange(e: Event): void {
|
|
382
|
-
const input = e.target as Input;
|
|
383
|
-
input.checkValidity();
|
|
384
|
-
const assertionIndex = Number(input.dataset.assertionIndex);
|
|
385
|
-
const stepIndex = Number(input.dataset.stepIndex);
|
|
386
|
-
if (Number.isNaN(assertionIndex) || Number.isNaN(stepIndex)) {
|
|
387
|
-
return;
|
|
388
|
-
}
|
|
389
|
-
const assertion = this.model[assertionIndex];
|
|
390
|
-
if (!assertion) {
|
|
391
|
-
return;
|
|
392
|
-
}
|
|
393
|
-
const step = assertion.steps[stepIndex] as CoreAssertions.IEqualAssertion | undefined;
|
|
394
|
-
if (!step) {
|
|
395
|
-
return;
|
|
396
|
-
}
|
|
397
|
-
step.value = input.value;
|
|
398
|
-
step.dataType = this.detectInputDataType(assertion.steps.slice(0, stepIndex));
|
|
399
|
-
this.requestUpdate();
|
|
400
|
-
this.notifyChange();
|
|
401
|
-
}
|
|
402
|
-
|
|
403
|
-
protected handleGreaterThanAssertionValueChange(e: Event): void {
|
|
404
|
-
const step = this.stepFromChangeEvent(e) as CoreAssertions.IGreaterThanAssertion | undefined;
|
|
405
|
-
if (!step) {
|
|
406
|
-
return;
|
|
407
|
-
}
|
|
408
|
-
const input = e.target as Input;
|
|
409
|
-
input.checkValidity();
|
|
410
|
-
step.value = Number(input.value);
|
|
411
|
-
this.requestUpdate();
|
|
412
|
-
this.notifyChange();
|
|
413
|
-
}
|
|
414
|
-
|
|
415
|
-
protected handleLessThanAssertionValueChange(e: Event): void {
|
|
416
|
-
const step = this.stepFromChangeEvent(e) as CoreAssertions.ILessThanAssertion | undefined;
|
|
417
|
-
if (!step) {
|
|
418
|
-
return;
|
|
419
|
-
}
|
|
420
|
-
const input = e.target as Input;
|
|
421
|
-
input.checkValidity();
|
|
422
|
-
step.value = Number(input.value);
|
|
423
|
-
this.requestUpdate();
|
|
424
|
-
this.notifyChange();
|
|
425
|
-
}
|
|
426
|
-
|
|
427
|
-
protected handleIncludesAssertionValueChange(e: Event): void {
|
|
428
|
-
const step = this.stepFromChangeEvent(e) as CoreAssertions.IIncludesAssertion | undefined;
|
|
429
|
-
if (!step) {
|
|
430
|
-
return;
|
|
431
|
-
}
|
|
432
|
-
const input = e.target as Input;
|
|
433
|
-
input.checkValidity();
|
|
434
|
-
step.value = input.value;
|
|
435
|
-
this.requestUpdate();
|
|
436
|
-
this.notifyChange();
|
|
437
|
-
}
|
|
438
|
-
|
|
439
|
-
protected handleMatchesAssertionValueChange(e: Event): void {
|
|
440
|
-
const step = this.stepFromChangeEvent(e) as CoreAssertions.IMatchesAssertion | undefined;
|
|
441
|
-
if (!step) {
|
|
442
|
-
return;
|
|
443
|
-
}
|
|
444
|
-
const input = e.target as Input;
|
|
445
|
-
step.value = input.value;
|
|
446
|
-
this.requestUpdate();
|
|
447
|
-
this.notifyChange();
|
|
448
|
-
}
|
|
449
|
-
|
|
450
|
-
protected validateRegexPattern(e: Event): void {
|
|
451
|
-
const input = e.target as Input;
|
|
452
|
-
try {
|
|
453
|
-
RegExp(input.value);
|
|
454
|
-
input.setCustomValidity('');
|
|
455
|
-
} catch (_) {
|
|
456
|
-
input.setCustomValidity('Pattern is invalid');
|
|
457
|
-
}
|
|
458
|
-
input.reportValidity();
|
|
459
|
-
}
|
|
460
|
-
|
|
461
|
-
protected stepFromChangeEvent(e: Event): IHttpStep | undefined {
|
|
462
|
-
const input = e.target as Input;
|
|
463
|
-
input.checkValidity();
|
|
464
|
-
const assertionIndex = Number(input.dataset.assertionIndex);
|
|
465
|
-
const stepIndex = Number(input.dataset.stepIndex);
|
|
466
|
-
if (Number.isNaN(assertionIndex) || Number.isNaN(stepIndex)) {
|
|
467
|
-
return undefined;
|
|
468
|
-
}
|
|
469
|
-
const assertion = this.model[assertionIndex];
|
|
470
|
-
if (!assertion) {
|
|
471
|
-
return undefined;
|
|
472
|
-
}
|
|
473
|
-
return assertion.steps[stepIndex];
|
|
474
|
-
}
|
|
475
|
-
|
|
476
|
-
/**
|
|
477
|
-
* Detects the correct data type for the step value based on previous steps.
|
|
478
|
-
*
|
|
479
|
-
* @param steps The steps before the current step
|
|
480
|
-
* @returns The data type for the step in the AMF namespace.
|
|
481
|
-
*/
|
|
482
|
-
protected detectInputDataType(steps: IHttpStep[]): string {
|
|
483
|
-
// we reverse the list so we move from the last step.
|
|
484
|
-
const reversed = [...steps].reverse();
|
|
485
|
-
for (const step of reversed) {
|
|
486
|
-
if (step.kind === TransformationSteps.AsNumberStepKind) {
|
|
487
|
-
return AmfNamespace.aml.vocabularies.shapes.number;
|
|
488
|
-
}
|
|
489
|
-
if (step.kind === DataSteps.ReadDataSourceStepKind) {
|
|
490
|
-
const typed = step as DataSteps.IReadDataSourceStep;
|
|
491
|
-
if (typed.data === FlowResponseDataEnum.status) {
|
|
492
|
-
return AmfNamespace.aml.vocabularies.shapes.number;
|
|
493
|
-
}
|
|
494
|
-
}
|
|
495
|
-
}
|
|
496
|
-
return AmfNamespace.w3.xmlSchema.string;
|
|
497
|
-
}
|
|
498
|
-
|
|
499
|
-
protected handleRenameAssertion(e: Event): void {
|
|
500
|
-
const target = e.currentTarget as HTMLElement;
|
|
501
|
-
const assertionIndex = Number(target.dataset.assertionIndex);
|
|
502
|
-
if (Number.isNaN(assertionIndex)) {
|
|
503
|
-
return;
|
|
504
|
-
}
|
|
505
|
-
const assertion = this.model[assertionIndex];
|
|
506
|
-
if (!assertion) {
|
|
507
|
-
return;
|
|
508
|
-
}
|
|
509
|
-
const { description } = assertion;
|
|
510
|
-
const dialog = this.shadowRoot?.querySelector('.rename-dialog') as UiDialog | null;
|
|
511
|
-
if (!dialog) {
|
|
512
|
-
return;
|
|
513
|
-
}
|
|
514
|
-
const input = dialog.querySelector('ui-text-field') as Input;
|
|
515
|
-
input.value = description || '';
|
|
516
|
-
dialog.open = true;
|
|
517
|
-
dialog.dataset.assertionIndex = target.dataset.assertionIndex;
|
|
518
|
-
}
|
|
519
|
-
|
|
520
|
-
protected handleRenameDialogResult(e: CustomEvent<UiDialogClosingReason>): void {
|
|
521
|
-
if (e.detail.cancelled) {
|
|
522
|
-
return;
|
|
523
|
-
}
|
|
524
|
-
const dialog = e.currentTarget as UiDialog;
|
|
525
|
-
const assertionIndex = Number(dialog.dataset.assertionIndex);
|
|
526
|
-
if (Number.isNaN(assertionIndex)) {
|
|
527
|
-
return;
|
|
528
|
-
}
|
|
529
|
-
const assertion = this.model[assertionIndex];
|
|
530
|
-
if (!assertion) {
|
|
531
|
-
return;
|
|
532
|
-
}
|
|
533
|
-
const input = dialog.querySelector('ui-text-field') as Input;
|
|
534
|
-
assertion.description = input.value;
|
|
535
|
-
this.requestUpdate();
|
|
536
|
-
this.notifyChange();
|
|
537
|
-
input.value = '';
|
|
538
|
-
delete dialog.dataset.assertionIndex;
|
|
539
|
-
}
|
|
540
|
-
|
|
541
|
-
protected override render(): TemplateResult {
|
|
542
|
-
return html`
|
|
543
|
-
${this.renderActionButtons()}
|
|
544
|
-
<div class="container">
|
|
545
|
-
${this.renderEditor()}
|
|
546
|
-
${this.renderAssertions()}
|
|
547
|
-
</div>
|
|
548
|
-
${this.renderRenameAssertionDialog()}
|
|
549
|
-
`;
|
|
550
|
-
}
|
|
551
|
-
|
|
552
|
-
protected renderActionButtons(): TemplateResult {
|
|
553
|
-
return html`
|
|
554
|
-
<div class="editor-actions">
|
|
555
|
-
<ui-button type="tonal" @click="${this.handleAdd}" class="add-button">Add</ui-button>
|
|
556
|
-
</div>
|
|
557
|
-
`;
|
|
558
|
-
}
|
|
559
|
-
|
|
560
|
-
protected renderAssertions(): TemplateResult {
|
|
561
|
-
return html`
|
|
562
|
-
<section aria-label="Assertion options" class="options">
|
|
563
|
-
${this.renderDataSourceOptions()}
|
|
564
|
-
${this.renderTransformationOptions()}
|
|
565
|
-
${this.renderAssertionOptions()}
|
|
566
|
-
</section>
|
|
567
|
-
`;
|
|
568
|
-
}
|
|
569
|
-
|
|
570
|
-
protected renderStepChip(label: string, group: string, kind: string, variant?: string): TemplateResult {
|
|
571
|
-
return html`
|
|
572
|
-
<ui-chip
|
|
573
|
-
draggable="true"
|
|
574
|
-
data-group="${group}"
|
|
575
|
-
data-kind="${kind}"
|
|
576
|
-
data-variant="${ifDefined(variant)}"
|
|
577
|
-
@dragstart="${this.handleDragStart}"
|
|
578
|
-
@dragend="${this.handleDragEnd}"
|
|
579
|
-
>${label}</ui-chip>
|
|
580
|
-
`;
|
|
581
|
-
}
|
|
582
|
-
|
|
583
|
-
protected renderDataSourceChip(label: string, group: string, kind: string, source: FlowSourceEnum, data: FlowRequestDataEnum | FlowResponseDataEnum): TemplateResult {
|
|
584
|
-
return html`
|
|
585
|
-
<ui-chip
|
|
586
|
-
draggable="true"
|
|
587
|
-
data-group="${group}"
|
|
588
|
-
data-kind="${kind}"
|
|
589
|
-
data-source="${source}"
|
|
590
|
-
data-data="${data}"
|
|
591
|
-
@dragstart="${this.handleDragStart}"
|
|
592
|
-
@dragend="${this.handleDragEnd}"
|
|
593
|
-
>${label}</ui-chip>
|
|
594
|
-
`;
|
|
595
|
-
}
|
|
596
|
-
|
|
597
|
-
protected renderDataSourceOptions(): TemplateResult {
|
|
598
|
-
return html`
|
|
599
|
-
<details class="assertion-group" open>
|
|
600
|
-
<summary>Data source</summary>
|
|
601
|
-
<div class="group-content">
|
|
602
|
-
${this.renderDataSourceChip('Status code', 'data-source', DataSteps.ReadDataSourceStepKind, FlowSourceEnum.response, FlowResponseDataEnum.status)}
|
|
603
|
-
${this.renderDataSourceChip('Response headers', 'data-source', DataSteps.ReadDataSourceStepKind, FlowSourceEnum.response, FlowResponseDataEnum.headers)}
|
|
604
|
-
${this.renderDataSourceChip('Response body', 'data-source', DataSteps.ReadDataSourceStepKind, FlowSourceEnum.response, FlowResponseDataEnum.body)}
|
|
605
|
-
${this.renderDataSourceChip('Status message', 'data-source', DataSteps.ReadDataSourceStepKind, FlowSourceEnum.response, FlowResponseDataEnum.statusText)}
|
|
606
|
-
</div>
|
|
607
|
-
</details>
|
|
608
|
-
`;
|
|
609
|
-
}
|
|
610
|
-
|
|
611
|
-
protected renderTransformationOptions(): TemplateResult {
|
|
612
|
-
return html`
|
|
613
|
-
<details class="assertion-group" open>
|
|
614
|
-
<summary>Transformation</summary>
|
|
615
|
-
<div class="group-content">
|
|
616
|
-
${this.renderStepChip('Read value', 'transformation', DataSteps.ReadValueStepKind)}
|
|
617
|
-
${this.renderStepChip('As number', 'transformation', TransformationSteps.AsNumberStepKind)}
|
|
618
|
-
${this.renderStepChip('Round', 'transformation', TransformationSteps.RoundStepKind)}
|
|
619
|
-
${this.renderStepChip('To lower case', 'transformation', TransformationSteps.AsLowerCaseStepKind)}
|
|
620
|
-
${this.renderStepChip('To upper case', 'transformation', TransformationSteps.AsUpperCaseStepKind)}
|
|
621
|
-
${this.renderStepChip('Trim', 'transformation', TransformationSteps.TrimStepKind)}
|
|
622
|
-
${this.renderStepChip('Substring', 'transformation', TransformationSteps.SubstringStepKind)}
|
|
623
|
-
</div>
|
|
624
|
-
</details>
|
|
625
|
-
`;
|
|
626
|
-
}
|
|
627
|
-
|
|
628
|
-
protected renderAssertionOptions(): TemplateResult {
|
|
629
|
-
return html`
|
|
630
|
-
<details class="assertion-group" open>
|
|
631
|
-
<summary>Assertions</summary>
|
|
632
|
-
<div class="group-content">
|
|
633
|
-
${this.renderStepChip('Equal', 'assertion', CoreAssertions.EqualAssertionKind)}
|
|
634
|
-
${this.renderStepChip('Not equal', 'assertion', CoreAssertions.NotEqualAssertionKind)}
|
|
635
|
-
${this.renderStepChip('Greater than', 'assertion', CoreAssertions.GreaterThanAssertionKind)}
|
|
636
|
-
${this.renderStepChip('Greater than equal', 'assertion', CoreAssertions.GreaterThanAssertionKind, 'equal')}
|
|
637
|
-
${this.renderStepChip('Less than', 'assertion', CoreAssertions.LessThanAssertionKind)}
|
|
638
|
-
${this.renderStepChip('Less than equal', 'assertion', CoreAssertions.LessThanAssertionKind, 'equal')}
|
|
639
|
-
${this.renderStepChip('Includes', 'assertion', CoreAssertions.IncludesAssertionKind)}
|
|
640
|
-
${this.renderStepChip('Not includes', 'assertion', CoreAssertions.NotIncludesAssertionKind)}
|
|
641
|
-
${this.renderStepChip('Matches', 'assertion', CoreAssertions.MatchesAssertionKind)}
|
|
642
|
-
${this.renderStepChip('OK', 'assertion', CoreAssertions.OkAssertionKind)}
|
|
643
|
-
${this.renderStepChip('Not OK', 'assertion', CoreAssertions.NotOkAssertionKind)}
|
|
644
|
-
${this.renderStepChip('To be...', 'assertion', CoreAssertions.ToBeAssertionKind)}
|
|
645
|
-
${this.renderStepChip('Not to be...', 'assertion', CoreAssertions.NotToBeAssertionKind)}
|
|
646
|
-
</div>
|
|
647
|
-
</details>
|
|
648
|
-
`;
|
|
649
|
-
}
|
|
650
|
-
|
|
651
|
-
protected renderEditor(): TemplateResult {
|
|
652
|
-
const { model } = this;
|
|
653
|
-
const content = Array.isArray(model) && !!model.length ? this.renderList(model) : this.renderEmptyMessage();
|
|
654
|
-
return html`
|
|
655
|
-
<section aria-label="Assertions editor" class="editor">${content}</section>
|
|
656
|
-
`;
|
|
657
|
-
}
|
|
658
|
-
|
|
659
|
-
protected renderEmptyMessage(): TemplateResult {
|
|
660
|
-
return html`
|
|
661
|
-
<div class="empty-message">No assertions added</div>
|
|
662
|
-
`;
|
|
663
|
-
}
|
|
664
|
-
|
|
665
|
-
protected renderList(model: IHttpAssertion[]): TemplateResult {
|
|
666
|
-
return html`
|
|
667
|
-
${model.map((item, index) => this.renderAssertion(item, index))}
|
|
668
|
-
`;
|
|
669
|
-
}
|
|
670
|
-
|
|
671
|
-
protected renderAssertion(item: IHttpAssertion, index: number): TemplateResult {
|
|
672
|
-
return html`
|
|
673
|
-
${this.renderAssertionDescription(item)}
|
|
674
|
-
<div class="param-row">
|
|
675
|
-
${this.renderToggleButton(item, index)}
|
|
676
|
-
${this.renderSteps(item, index)}
|
|
677
|
-
<div class="assertion-actions">
|
|
678
|
-
${this.renderRenameAssertion(index)}
|
|
679
|
-
${this.renderDeleteAssertion(index)}
|
|
680
|
-
</div>
|
|
681
|
-
</div>
|
|
682
|
-
`;
|
|
683
|
-
}
|
|
684
|
-
|
|
685
|
-
protected renderAssertionDescription(item: IHttpAssertion): TemplateResult | typeof nothing {
|
|
686
|
-
const { description } = item;
|
|
687
|
-
if (!description) {
|
|
688
|
-
return nothing;
|
|
689
|
-
}
|
|
690
|
-
return html`
|
|
691
|
-
<div class="assertion-description label-medium">${description}</div>
|
|
692
|
-
`;
|
|
693
|
-
}
|
|
694
|
-
|
|
695
|
-
protected renderToggleButton(item: IHttpAssertion, assertionIndex: number): TemplateResult {
|
|
696
|
-
return html`
|
|
697
|
-
<ui-switch
|
|
698
|
-
.checked="${!!item.enabled}"
|
|
699
|
-
@change="${this.handleToggle}"
|
|
700
|
-
aria-label="Toggle this assertion"
|
|
701
|
-
data-index="${assertionIndex}"
|
|
702
|
-
class="toggle-button"
|
|
703
|
-
></ui-switch>
|
|
704
|
-
`;
|
|
705
|
-
}
|
|
706
|
-
|
|
707
|
-
protected renderRenameAssertion(assertionIndex: number): TemplateResult {
|
|
708
|
-
return html`
|
|
709
|
-
<ui-icon-button
|
|
710
|
-
aria-label="Rename this assertion"
|
|
711
|
-
title="Rename this assertion"
|
|
712
|
-
data-assertion-index="${assertionIndex}"
|
|
713
|
-
@click="${this.handleRenameAssertion}"
|
|
714
|
-
class="rename-button"
|
|
715
|
-
>
|
|
716
|
-
<ui-icon icon="rename" role="presentation"></ui-icon>
|
|
717
|
-
</ui-icon-button>
|
|
718
|
-
`;
|
|
719
|
-
}
|
|
720
|
-
|
|
721
|
-
protected renderDeleteAssertion(assertionIndex: number): TemplateResult {
|
|
722
|
-
return html`
|
|
723
|
-
<ui-icon-button
|
|
724
|
-
aria-label="Delete this assertion"
|
|
725
|
-
title="Delete this assertion"
|
|
726
|
-
data-index="${assertionIndex}"
|
|
727
|
-
@click="${this.handleRemove}"
|
|
728
|
-
class="delete-button"
|
|
729
|
-
>
|
|
730
|
-
<ui-icon icon="deleteOutline" role="presentation"></ui-icon>
|
|
731
|
-
</ui-icon-button>
|
|
732
|
-
`;
|
|
733
|
-
}
|
|
734
|
-
|
|
735
|
-
protected renderSteps(item: IHttpAssertion, assertionIndex: number): TemplateResult {
|
|
736
|
-
const content = Array.isArray(item.steps) && !!item.steps.length ? this.renderStepsList(item.steps, assertionIndex) : this.renderEmptyStep(assertionIndex);
|
|
737
|
-
return html`
|
|
738
|
-
<div
|
|
739
|
-
class="steps"
|
|
740
|
-
data-index="${assertionIndex}"
|
|
741
|
-
@drop="${this.handleDrop}"
|
|
742
|
-
@dragover="${this.handleTargetDragOver}"
|
|
743
|
-
@dragleave="${this.handleTargetDragLeave}"
|
|
744
|
-
>${content}</div>
|
|
745
|
-
`;
|
|
746
|
-
}
|
|
747
|
-
|
|
748
|
-
protected renderEmptyStep(assertionIndex: number): TemplateResult {
|
|
749
|
-
return html`
|
|
750
|
-
<span class="step-pill empty drop-target space-step-left" data-index="${assertionIndex}" @drop="${this.handleDrop}" @dragover="${this.handleTargetDragOver}">Empty slot</span>
|
|
751
|
-
<span class="drop-info drop-target space-step-left" data-index="${assertionIndex}" @drop="${this.handleDrop}" @dragover="${this.handleTargetDragOver}">Drop an action here</span>
|
|
752
|
-
`;
|
|
753
|
-
}
|
|
754
|
-
|
|
755
|
-
protected renderStepsList(steps: IHttpStep[], assertionIndex: number): TemplateResult[] {
|
|
756
|
-
const items: TemplateResult[] = [];
|
|
757
|
-
steps.forEach((item, stepIndex) => {
|
|
758
|
-
const content = this.renderStep(item, assertionIndex, stepIndex);
|
|
759
|
-
if (content) {
|
|
760
|
-
items.push(html`
|
|
761
|
-
<div class="step-unit">
|
|
762
|
-
${this.renderDropSpacer(assertionIndex, stepIndex)}
|
|
763
|
-
${content}
|
|
764
|
-
</div>
|
|
765
|
-
`);
|
|
766
|
-
}
|
|
767
|
-
});
|
|
768
|
-
return items;
|
|
769
|
-
}
|
|
770
|
-
|
|
771
|
-
protected renderStep(item: IHttpStep, assertionIndex: number, stepIndex: number): TemplateResult | undefined {
|
|
772
|
-
const { kind } = item;
|
|
773
|
-
switch (kind) {
|
|
774
|
-
case DataSteps.ReadDataSourceStepKind: return this.renderReadDataSourceStep(item, assertionIndex, stepIndex);
|
|
775
|
-
case DataSteps.ReadValueStepKind: return this.renderReadValueStep(item as DataSteps.IReadValueStep, assertionIndex, stepIndex);
|
|
776
|
-
|
|
777
|
-
// transformations
|
|
778
|
-
case TransformationSteps.AsNumberStepKind: return this.renderStepPill('As number', assertionIndex, stepIndex);
|
|
779
|
-
case TransformationSteps.AsLowerCaseStepKind: return this.renderStepPill('To lower case', assertionIndex, stepIndex);
|
|
780
|
-
case TransformationSteps.AsUpperCaseStepKind: return this.renderStepPill('To upper case', assertionIndex, stepIndex);
|
|
781
|
-
case TransformationSteps.TrimStepKind: return this.renderStepPill('Trim', assertionIndex, stepIndex);
|
|
782
|
-
case TransformationSteps.RoundStepKind: return this.renderRoundStep(item as TransformationSteps.IRoundStep, assertionIndex, stepIndex);
|
|
783
|
-
case TransformationSteps.SubstringStepKind: return this.renderSubstringStep(item as TransformationSteps.ISubstringStep, assertionIndex, stepIndex);
|
|
784
|
-
|
|
785
|
-
// assertions
|
|
786
|
-
case CoreAssertions.EqualAssertionKind: return this.renderEqualAssertion(item as CoreAssertions.IEqualAssertion, assertionIndex, stepIndex);
|
|
787
|
-
case CoreAssertions.NotEqualAssertionKind: return this.renderNotEqualAssertion(item as CoreAssertions.INotEqualAssertion, assertionIndex, stepIndex);
|
|
788
|
-
case CoreAssertions.GreaterThanAssertionKind: return this.renderGreaterThanAssertion(item as CoreAssertions.IGreaterThanAssertion, assertionIndex, stepIndex);
|
|
789
|
-
case CoreAssertions.LessThanAssertionKind: return this.renderLessThanAssertion(item as CoreAssertions.ILessThanAssertion, assertionIndex, stepIndex);
|
|
790
|
-
case CoreAssertions.IncludesAssertionKind: return this.renderIncludesAssertion(item as CoreAssertions.IIncludesAssertion, assertionIndex, stepIndex);
|
|
791
|
-
case CoreAssertions.NotIncludesAssertionKind: return this.renderNotIncludesAssertion(item as CoreAssertions.INotIncludesAssertion, assertionIndex, stepIndex);
|
|
792
|
-
case CoreAssertions.MatchesAssertionKind: return this.renderMatchesAssertion(item as CoreAssertions.IMatchesAssertion, assertionIndex, stepIndex);
|
|
793
|
-
case CoreAssertions.OkAssertionKind: return this.renderStepPill('Is OK', assertionIndex, stepIndex);
|
|
794
|
-
case CoreAssertions.NotOkAssertionKind: return this.renderStepPill('Is not OK', assertionIndex, stepIndex);
|
|
795
|
-
case CoreAssertions.ToBeAssertionKind: return this.renderToBeAssertion(item as CoreAssertions.IToBeAssertion, assertionIndex, stepIndex);
|
|
796
|
-
case CoreAssertions.NotToBeAssertionKind: return this.renderNotToBeAssertion(item as CoreAssertions.INotToBeAssertion, assertionIndex, stepIndex);
|
|
797
|
-
default: return undefined;
|
|
798
|
-
}
|
|
799
|
-
}
|
|
800
|
-
|
|
801
|
-
protected renderDropSpacer(assertionIndex: number, stepIndex: number): TemplateResult {
|
|
802
|
-
return html`<div class="drop-target spacer"
|
|
803
|
-
data-index="${assertionIndex}"
|
|
804
|
-
data-step-index="${stepIndex}"
|
|
805
|
-
@drop="${this.handleDrop}"
|
|
806
|
-
@dragover="${this.handleTargetDragOver}"
|
|
807
|
-
@dragleave="${this.handleTargetDragLeave}"
|
|
808
|
-
> </div>`;
|
|
809
|
-
}
|
|
810
|
-
|
|
811
|
-
protected renderStepPill(label: string, assertionIndex: number, stepIndex: number): TemplateResult {
|
|
812
|
-
return html`
|
|
813
|
-
<span class="step-pill with-icon">
|
|
814
|
-
${label}
|
|
815
|
-
<ui-icon-button
|
|
816
|
-
title="Remove"
|
|
817
|
-
aria-label="Deletes this step"
|
|
818
|
-
@click="${this.handleRemoveStep}"
|
|
819
|
-
data-index="${assertionIndex}"
|
|
820
|
-
data-step-index="${stepIndex}"
|
|
821
|
-
><ui-icon icon="close"></ui-icon></ui-icon-button>
|
|
822
|
-
</span>
|
|
823
|
-
`;
|
|
824
|
-
}
|
|
825
|
-
|
|
826
|
-
protected renderReadDataSourceStep(item: DataSteps.IReadDataSourceStep, assertionIndex: number, stepIndex: number): TemplateResult | undefined {
|
|
827
|
-
const { data, source } = item;
|
|
828
|
-
if (!data || !source) {
|
|
829
|
-
// invalid configuration
|
|
830
|
-
return undefined;
|
|
831
|
-
}
|
|
832
|
-
let label: string | undefined;
|
|
833
|
-
if (source === FlowSourceEnum.response) {
|
|
834
|
-
if (data === FlowResponseDataEnum.url) {
|
|
835
|
-
label = 'Response URL';
|
|
836
|
-
} else if (data === FlowResponseDataEnum.headers) {
|
|
837
|
-
label = 'Response headers';
|
|
838
|
-
} else if (data === FlowResponseDataEnum.status) {
|
|
839
|
-
label = 'Status code';
|
|
840
|
-
} else if (data === FlowResponseDataEnum.statusText) {
|
|
841
|
-
label = 'Status message';
|
|
842
|
-
} else if (data === FlowResponseDataEnum.body) {
|
|
843
|
-
label = 'Response body';
|
|
844
|
-
}
|
|
845
|
-
} else if (source === FlowSourceEnum.request) {
|
|
846
|
-
if (data === FlowRequestDataEnum.url) {
|
|
847
|
-
label = 'Request URL';
|
|
848
|
-
} else if (data === FlowRequestDataEnum.headers) {
|
|
849
|
-
label = 'Request headers';
|
|
850
|
-
} else if (data === FlowRequestDataEnum.body) {
|
|
851
|
-
label = 'Request body';
|
|
852
|
-
} else if (data === FlowRequestDataEnum.method) {
|
|
853
|
-
label = 'Request method';
|
|
854
|
-
}
|
|
855
|
-
}
|
|
856
|
-
if (!label) {
|
|
857
|
-
return undefined;
|
|
858
|
-
}
|
|
859
|
-
return this.renderStepPill(label, assertionIndex, stepIndex);
|
|
860
|
-
}
|
|
861
|
-
|
|
862
|
-
protected renderReadValueStep(item: DataSteps.IReadValueStep, assertionIndex: number, stepIndex: number): TemplateResult {
|
|
863
|
-
return html`
|
|
864
|
-
<ui-text-field
|
|
865
|
-
name="value.${assertionIndex}.${stepIndex}"
|
|
866
|
-
data-assertion-index="${assertionIndex}"
|
|
867
|
-
data-step-index="${stepIndex}"
|
|
868
|
-
label="Read value"
|
|
869
|
-
required
|
|
870
|
-
.value="${live(item.path || '')}"
|
|
871
|
-
@change="${this.handleReadValueStepChange}"
|
|
872
|
-
></ui-text-field>
|
|
873
|
-
`;
|
|
874
|
-
}
|
|
875
|
-
|
|
876
|
-
protected renderRoundStep(item: TransformationSteps.IRoundStep, assertionIndex: number, stepIndex: number): TemplateResult {
|
|
877
|
-
const pill = this.renderStepPill('Round', assertionIndex, stepIndex);
|
|
878
|
-
const { precision = 0 } = item;
|
|
879
|
-
return html`
|
|
880
|
-
${pill}
|
|
881
|
-
<ui-text-field
|
|
882
|
-
name="precision.${assertionIndex}.${stepIndex}"
|
|
883
|
-
data-assertion-index="${assertionIndex}"
|
|
884
|
-
data-step-index="${stepIndex}"
|
|
885
|
-
label="Precision"
|
|
886
|
-
required
|
|
887
|
-
.value="${live(String(precision))}"
|
|
888
|
-
@change="${this.handleRoundPrecisionChange}"
|
|
889
|
-
class="space-step-left number-input"
|
|
890
|
-
type="number"
|
|
891
|
-
min="0"
|
|
892
|
-
max="100"
|
|
893
|
-
step="1"
|
|
894
|
-
title="The number of digits to appear after the decimal point. Should be a value between 0 and 100, inclusive."
|
|
895
|
-
></ui-text-field>
|
|
896
|
-
`;
|
|
897
|
-
}
|
|
898
|
-
|
|
899
|
-
protected renderSubstringStep(item: TransformationSteps.ISubstringStep, assertionIndex: number, stepIndex: number): TemplateResult {
|
|
900
|
-
const pill = this.renderStepPill('Substring', assertionIndex, stepIndex);
|
|
901
|
-
const { start = 0, end } = item;
|
|
902
|
-
return html`
|
|
903
|
-
${pill}
|
|
904
|
-
<ui-text-field
|
|
905
|
-
name="start.${assertionIndex}.${stepIndex}"
|
|
906
|
-
data-assertion-index="${assertionIndex}"
|
|
907
|
-
data-step-index="${stepIndex}"
|
|
908
|
-
label="Start"
|
|
909
|
-
required
|
|
910
|
-
.value="${live(String(start))}"
|
|
911
|
-
@change="${this.handleSubstringStartChange}"
|
|
912
|
-
class="space-step-left number-input"
|
|
913
|
-
type="number"
|
|
914
|
-
step="1"
|
|
915
|
-
title="The index of the first character to include in the returned substring."
|
|
916
|
-
></ui-text-field>
|
|
917
|
-
|
|
918
|
-
<ui-text-field
|
|
919
|
-
name="end.${assertionIndex}.${stepIndex}"
|
|
920
|
-
data-assertion-index="${assertionIndex}"
|
|
921
|
-
data-step-index="${stepIndex}"
|
|
922
|
-
label="End"
|
|
923
|
-
.value="${live(end ? String(end) : '')}"
|
|
924
|
-
@change="${this.handleSubstringEndChange}"
|
|
925
|
-
class="space-step-left number-input"
|
|
926
|
-
type="number"
|
|
927
|
-
step="1"
|
|
928
|
-
title="The index of the first character to exclude from the returned substring."
|
|
929
|
-
></ui-text-field>
|
|
930
|
-
`;
|
|
931
|
-
}
|
|
932
|
-
|
|
933
|
-
protected renderEqualAssertion(item: CoreAssertions.IEqualAssertion, assertionIndex: number, stepIndex: number): TemplateResult {
|
|
934
|
-
return html`
|
|
935
|
-
<ui-text-field
|
|
936
|
-
name="equal.${assertionIndex}.${stepIndex}"
|
|
937
|
-
data-assertion-index="${assertionIndex}"
|
|
938
|
-
data-step-index="${stepIndex}"
|
|
939
|
-
data-kind="${CoreAssertions.EqualAssertionKind}"
|
|
940
|
-
label="Equal to"
|
|
941
|
-
required
|
|
942
|
-
.value="${live(item.value || '')}"
|
|
943
|
-
@change="${this.handleEqualAssertionValueChange}"
|
|
944
|
-
>
|
|
945
|
-
<ui-icon-button
|
|
946
|
-
slot="suffix"
|
|
947
|
-
title="Remove assertion"
|
|
948
|
-
aria-label="Deletes this assertion"
|
|
949
|
-
@click="${this.handleRemoveStep}"
|
|
950
|
-
data-index="${assertionIndex}"
|
|
951
|
-
data-step-index="${stepIndex}"
|
|
952
|
-
><ui-icon icon="close" role="presentation"></ui-icon></ui-icon-button>
|
|
953
|
-
</ui-text-field>
|
|
954
|
-
`;
|
|
955
|
-
}
|
|
956
|
-
|
|
957
|
-
protected renderNotEqualAssertion(item: CoreAssertions.INotEqualAssertion, assertionIndex: number, stepIndex: number): TemplateResult {
|
|
958
|
-
return html`
|
|
959
|
-
<ui-text-field
|
|
960
|
-
name="not-equal.${assertionIndex}.${stepIndex}"
|
|
961
|
-
data-assertion-index="${assertionIndex}"
|
|
962
|
-
data-step-index="${stepIndex}"
|
|
963
|
-
data-kind="${CoreAssertions.NotEqualAssertionKind}"
|
|
964
|
-
label="Not equal to"
|
|
965
|
-
required
|
|
966
|
-
.value="${live(item.value || '')}"
|
|
967
|
-
@change="${this.handleEqualAssertionValueChange}"
|
|
968
|
-
>
|
|
969
|
-
<ui-icon-button
|
|
970
|
-
slot="suffix"
|
|
971
|
-
title="Remove assertion"
|
|
972
|
-
aria-label="Deletes this assertion"
|
|
973
|
-
@click="${this.handleRemoveStep}"
|
|
974
|
-
data-index="${assertionIndex}"
|
|
975
|
-
data-step-index="${stepIndex}"
|
|
976
|
-
><ui-icon icon="close" role="presentation"></ui-icon></ui-icon-button>
|
|
977
|
-
</ui-text-field>
|
|
978
|
-
`;
|
|
979
|
-
}
|
|
980
|
-
|
|
981
|
-
protected renderGreaterThanAssertion(item: CoreAssertions.IGreaterThanAssertion, assertionIndex: number, stepIndex: number): TemplateResult {
|
|
982
|
-
const { equal, value } = item;
|
|
983
|
-
const label = equal ? 'Greater than equal' : 'Greater than';
|
|
984
|
-
const effectiveValue = typeof value === 'number' ? String(value) : '';
|
|
985
|
-
return html`
|
|
986
|
-
<ui-text-field
|
|
987
|
-
name="value.${assertionIndex}.${stepIndex}"
|
|
988
|
-
data-assertion-index="${assertionIndex}"
|
|
989
|
-
data-step-index="${stepIndex}"
|
|
990
|
-
data-kind="${CoreAssertions.GreaterThanAssertionKind}"
|
|
991
|
-
data-variant="${equal ? 'equal' : ''}"
|
|
992
|
-
label="${label}"
|
|
993
|
-
required
|
|
994
|
-
.value="${live(effectiveValue)}"
|
|
995
|
-
@change="${this.handleGreaterThanAssertionValueChange}"
|
|
996
|
-
inputMode="numeric"
|
|
997
|
-
>
|
|
998
|
-
<ui-icon-button
|
|
999
|
-
slot="suffix"
|
|
1000
|
-
title="Remove assertion"
|
|
1001
|
-
aria-label="Deletes this assertion"
|
|
1002
|
-
@click="${this.handleRemoveStep}"
|
|
1003
|
-
data-index="${assertionIndex}"
|
|
1004
|
-
data-step-index="${stepIndex}"
|
|
1005
|
-
><ui-icon icon="close" role="presentation"></ui-icon></ui-icon-button>
|
|
1006
|
-
</ui-text-field>
|
|
1007
|
-
`;
|
|
1008
|
-
}
|
|
1009
|
-
|
|
1010
|
-
protected renderLessThanAssertion(item: CoreAssertions.ILessThanAssertion, assertionIndex: number, stepIndex: number): TemplateResult {
|
|
1011
|
-
const { equal, value } = item;
|
|
1012
|
-
const label = equal ? 'Less than equal' : 'Less than';
|
|
1013
|
-
const effectiveValue = typeof value === 'number' ? String(value) : '';
|
|
1014
|
-
return html`
|
|
1015
|
-
<ui-text-field
|
|
1016
|
-
name="value.${assertionIndex}.${stepIndex}"
|
|
1017
|
-
data-assertion-index="${assertionIndex}"
|
|
1018
|
-
data-step-index="${stepIndex}"
|
|
1019
|
-
data-kind="${CoreAssertions.LessThanAssertionKind}"
|
|
1020
|
-
data-variant="${equal ? 'equal' : ''}"
|
|
1021
|
-
label="${label}"
|
|
1022
|
-
required
|
|
1023
|
-
.value="${live(effectiveValue)}"
|
|
1024
|
-
@change="${this.handleLessThanAssertionValueChange}"
|
|
1025
|
-
inputMode="numeric"
|
|
1026
|
-
>
|
|
1027
|
-
<ui-icon-button
|
|
1028
|
-
slot="suffix"
|
|
1029
|
-
title="Remove assertion"
|
|
1030
|
-
aria-label="Deletes this assertion"
|
|
1031
|
-
@click="${this.handleRemoveStep}"
|
|
1032
|
-
data-index="${assertionIndex}"
|
|
1033
|
-
data-step-index="${stepIndex}"
|
|
1034
|
-
><ui-icon icon="close" role="presentation"></ui-icon></ui-icon-button>
|
|
1035
|
-
</ui-text-field>
|
|
1036
|
-
`;
|
|
1037
|
-
}
|
|
1038
|
-
|
|
1039
|
-
protected renderIncludesAssertion(item: CoreAssertions.IIncludesAssertion, assertionIndex: number, stepIndex: number): TemplateResult {
|
|
1040
|
-
const { value } = item;
|
|
1041
|
-
return html`
|
|
1042
|
-
<ui-text-field
|
|
1043
|
-
name="includes.${assertionIndex}.${stepIndex}"
|
|
1044
|
-
data-assertion-index="${assertionIndex}"
|
|
1045
|
-
data-step-index="${stepIndex}"
|
|
1046
|
-
data-kind="${CoreAssertions.IncludesAssertionKind}"
|
|
1047
|
-
label="Includes value"
|
|
1048
|
-
required
|
|
1049
|
-
.value="${live(value || '')}"
|
|
1050
|
-
@change="${this.handleIncludesAssertionValueChange}"
|
|
1051
|
-
>
|
|
1052
|
-
<ui-icon-button
|
|
1053
|
-
slot="suffix"
|
|
1054
|
-
title="Remove assertion"
|
|
1055
|
-
aria-label="Deletes this assertion"
|
|
1056
|
-
@click="${this.handleRemoveStep}"
|
|
1057
|
-
data-index="${assertionIndex}"
|
|
1058
|
-
data-step-index="${stepIndex}"
|
|
1059
|
-
><ui-icon icon="close" role="presentation"></ui-icon></ui-icon-button>
|
|
1060
|
-
</ui-text-field>
|
|
1061
|
-
`;
|
|
1062
|
-
}
|
|
1063
|
-
|
|
1064
|
-
protected renderNotIncludesAssertion(item: CoreAssertions.INotIncludesAssertion, assertionIndex: number, stepIndex: number): TemplateResult {
|
|
1065
|
-
const { value } = item;
|
|
1066
|
-
return html`
|
|
1067
|
-
<ui-text-field
|
|
1068
|
-
name="not-includes.${assertionIndex}.${stepIndex}"
|
|
1069
|
-
data-assertion-index="${assertionIndex}"
|
|
1070
|
-
data-step-index="${stepIndex}"
|
|
1071
|
-
data-kind="${CoreAssertions.NotIncludesAssertionKind}"
|
|
1072
|
-
label="Not includes value"
|
|
1073
|
-
required
|
|
1074
|
-
.value="${live(value || '')}"
|
|
1075
|
-
@change="${this.handleIncludesAssertionValueChange}"
|
|
1076
|
-
>
|
|
1077
|
-
<ui-icon-button
|
|
1078
|
-
slot="suffix"
|
|
1079
|
-
title="Remove assertion"
|
|
1080
|
-
aria-label="Deletes this assertion"
|
|
1081
|
-
@click="${this.handleRemoveStep}"
|
|
1082
|
-
data-index="${assertionIndex}"
|
|
1083
|
-
data-step-index="${stepIndex}"
|
|
1084
|
-
><ui-icon icon="close" role="presentation"></ui-icon></ui-icon-button>
|
|
1085
|
-
</ui-text-field>
|
|
1086
|
-
`;
|
|
1087
|
-
}
|
|
1088
|
-
|
|
1089
|
-
protected renderMatchesAssertion(item: CoreAssertions.IMatchesAssertion, assertionIndex: number, stepIndex: number): TemplateResult {
|
|
1090
|
-
const { value } = item;
|
|
1091
|
-
return html`
|
|
1092
|
-
<ui-text-field
|
|
1093
|
-
name="matches.${assertionIndex}.${stepIndex}"
|
|
1094
|
-
data-assertion-index="${assertionIndex}"
|
|
1095
|
-
data-step-index="${stepIndex}"
|
|
1096
|
-
data-kind="${CoreAssertions.MatchesAssertionKind}"
|
|
1097
|
-
label="Matches regex"
|
|
1098
|
-
required
|
|
1099
|
-
.value="${live(value || '')}"
|
|
1100
|
-
@change="${this.handleMatchesAssertionValueChange}"
|
|
1101
|
-
@input="${this.validateRegexPattern}"
|
|
1102
|
-
invalidText="Pattern is invalid"
|
|
1103
|
-
>
|
|
1104
|
-
<ui-icon-button
|
|
1105
|
-
slot="suffix"
|
|
1106
|
-
title="Remove assertion"
|
|
1107
|
-
aria-label="Deletes this assertion"
|
|
1108
|
-
@click="${this.handleRemoveStep}"
|
|
1109
|
-
data-index="${assertionIndex}"
|
|
1110
|
-
data-step-index="${stepIndex}"
|
|
1111
|
-
><ui-icon icon="close" role="presentation"></ui-icon></ui-icon-button>
|
|
1112
|
-
</ui-text-field>
|
|
1113
|
-
`;
|
|
1114
|
-
}
|
|
1115
|
-
|
|
1116
|
-
protected renderToBeAssertion(item: CoreAssertions.IToBeAssertion, assertionIndex: number, stepIndex: number): TemplateResult {
|
|
1117
|
-
const { value } = item;
|
|
1118
|
-
const types = Object.values(CoreAssertions.ToBeTypes);
|
|
1119
|
-
return html`
|
|
1120
|
-
<ui-text-field
|
|
1121
|
-
name="to-be.${assertionIndex}.${stepIndex}"
|
|
1122
|
-
data-assertion-index="${assertionIndex}"
|
|
1123
|
-
data-step-index="${stepIndex}"
|
|
1124
|
-
data-kind="${CoreAssertions.ToBeAssertionKind}"
|
|
1125
|
-
label="To be..."
|
|
1126
|
-
required
|
|
1127
|
-
.value="${live(value || '')}"
|
|
1128
|
-
@change="${this.handleMatchesAssertionValueChange}"
|
|
1129
|
-
.list="${types}"
|
|
1130
|
-
>
|
|
1131
|
-
<ui-icon-button
|
|
1132
|
-
slot="suffix"
|
|
1133
|
-
title="Remove assertion"
|
|
1134
|
-
aria-label="Deletes this assertion"
|
|
1135
|
-
@click="${this.handleRemoveStep}"
|
|
1136
|
-
data-index="${assertionIndex}"
|
|
1137
|
-
data-step-index="${stepIndex}"
|
|
1138
|
-
><ui-icon icon="close" role="presentation"></ui-icon></ui-icon-button>
|
|
1139
|
-
</ui-text-field>
|
|
1140
|
-
`;
|
|
1141
|
-
}
|
|
1142
|
-
|
|
1143
|
-
protected renderNotToBeAssertion(item: CoreAssertions.INotToBeAssertion, assertionIndex: number, stepIndex: number): TemplateResult {
|
|
1144
|
-
const { value } = item;
|
|
1145
|
-
const types = Object.values(CoreAssertions.ToBeTypes);
|
|
1146
|
-
return html`
|
|
1147
|
-
<ui-text-field
|
|
1148
|
-
name="not-to-be.${assertionIndex}.${stepIndex}"
|
|
1149
|
-
data-assertion-index="${assertionIndex}"
|
|
1150
|
-
data-step-index="${stepIndex}"
|
|
1151
|
-
data-kind="${CoreAssertions.NotToBeAssertionKind}"
|
|
1152
|
-
label="Not to be..."
|
|
1153
|
-
required
|
|
1154
|
-
.value="${live(value || '')}"
|
|
1155
|
-
@change="${this.handleMatchesAssertionValueChange}"
|
|
1156
|
-
.list="${types}"
|
|
1157
|
-
>
|
|
1158
|
-
<ui-icon-button
|
|
1159
|
-
slot="suffix"
|
|
1160
|
-
title="Remove assertion"
|
|
1161
|
-
aria-label="Deletes this assertion"
|
|
1162
|
-
@click="${this.handleRemoveStep}"
|
|
1163
|
-
data-index="${assertionIndex}"
|
|
1164
|
-
data-step-index="${stepIndex}"
|
|
1165
|
-
><ui-icon icon="close" role="presentation"></ui-icon></ui-icon-button>
|
|
1166
|
-
</ui-text-field>
|
|
1167
|
-
`;
|
|
1168
|
-
}
|
|
1169
|
-
|
|
1170
|
-
protected renderRenameAssertionDialog(): TemplateResult {
|
|
1171
|
-
return html`
|
|
1172
|
-
<ui-dialog modal class="rename-dialog" @close="${this.handleRenameDialogResult}">
|
|
1173
|
-
<ui-icon slot="icon" icon="rename"></ui-icon>
|
|
1174
|
-
<span slot="title">Rename assertion</span>
|
|
1175
|
-
|
|
1176
|
-
<ui-text-field
|
|
1177
|
-
name="rename"
|
|
1178
|
-
label="Assertion description"
|
|
1179
|
-
required
|
|
1180
|
-
></ui-text-field>
|
|
1181
|
-
|
|
1182
|
-
<ui-button slot="button" value="dismiss" type="text">Cancel</ui-button>
|
|
1183
|
-
<ui-button slot="button" value="confirm" type="text">Accept</ui-button>
|
|
1184
|
-
</ui-dialog>
|
|
1185
|
-
`;
|
|
1186
|
-
}
|
|
1187
|
-
}
|