ru.coon 2.5.34 → 2.5.35
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/.gitattributes +1 -1
- package/.husky/pre-commit +0 -0
- package/CHANGELOG.md +3629 -3614
- package/Readme.md +24 -24
- package/TODO.md +7 -7
- package/doc/changelog.md +118 -118
- package/doc/shortcuts.md +5 -5
- package/index.js +1 -0
- package/jsdoc.config.json +29 -29
- package/package.json +77 -77
- package/sass/src/common/plugin/form/PeriodPicker.scss +8 -8
- package/src/CustomXMLReader.js +42 -42
- package/src/FieldsHelper.js +141 -141
- package/src/MessageResources.js +58 -58
- package/src/SystemProperties.js +208 -208
- package/src/chart/BaseChart.js +81 -81
- package/src/chart/ChartComponent.js +14 -14
- package/src/chart/editor/CoonChartEditor.js +189 -189
- package/src/chart/editor/CoonChartEditorViewModel.js +28 -28
- package/src/chart/editor/DataSourceChartBindForm.js +153 -153
- package/src/command/ASyncBaseCommand.js +4 -3
- package/src/command/ASyncBaseJSONCommand.js +15 -15
- package/src/command/DeletePropertyFromConfigurationCommand.js +18 -18
- package/src/command/GetAllPropertiesWithDefaultCommand.js +6 -6
- package/src/command/GetPropertyFromConfigurationCommand.js +18 -18
- package/src/command/Readme.md +4 -4
- package/src/command/SavePropertyFromConfigurationCommand.js +18 -18
- package/src/command/characteristic/CharacteristicValuesCommand.js +50 -50
- package/src/command/characteristic/SetEntityCharacteristicsCommand.js +49 -49
- package/src/common/baseModel.js +39 -39
- package/src/common/button/ForeignButton.js +132 -132
- package/src/common/command/AddNoteCommand.js +42 -42
- package/src/common/command/DeleteNoteCommand.js +40 -40
- package/src/common/command/GetNoteCommand.js +40 -40
- package/src/common/command/SaveNoteCommand.js +42 -42
- package/src/common/component/DFVCharacteristicField.js +24 -24
- package/src/common/component/ExternalFrame.scss +8 -8
- package/src/common/component/FinanceDocumentDateWindow.js +47 -47
- package/src/common/component/ForeignSelectWindow.js +93 -93
- package/src/common/component/HotkeyHelpText.js +43 -43
- package/src/common/component/HotkeyHelpText.scss +34 -34
- package/src/common/component/PropertyDict.js +279 -279
- package/src/common/component/TreeComponentStructure.js +155 -155
- package/src/common/component/TreeComponentStructure.scss +5 -5
- package/src/common/component/YearPanel.js +76 -76
- package/src/common/component/characteristic/CharacteristicPanelController.js +90 -90
- package/src/common/component/characteristic/characteristicAlgorithm/CharacteristicAlgorithmListController.js +133 -133
- package/src/common/component/characteristic/characteristicGroup/CharacteristicGroupPanelController.js +47 -47
- package/src/common/component/editor/CharacteristicAddTypeGrid.js +101 -101
- package/src/common/component/editor/CharacteristicForeignWindow.js +76 -76
- package/src/common/component/editor/CharacteristicHistoryPanel.js +110 -110
- package/src/common/component/editor/CharacteristicHistoryPanelAudit.js +73 -73
- package/src/common/component/editor/CharacteristicHistoryPanelWithDeletedChars.js +136 -136
- package/src/common/component/editor/CharacteristicHistoryUserAudit.js +49 -49
- package/src/common/component/editor/CharacteristicLoaderByCharacteristicEntityPlugin.js +41 -41
- package/src/common/component/editor/CharacteristicTypeLoaderPlugin.js +38 -38
- package/src/common/component/editor/EditorFactory.js +21 -23
- package/src/common/component/editor/HistoryListForTypeCharacteristicEditor.js +51 -51
- package/src/common/component/editor/HistoryTypedCharacteristicEditor.js +240 -240
- package/src/common/component/editor/creators/BaseEditorCreator.js +22 -22
- package/src/common/component/editor/creators/ByReportEditorCreator.js +8 -8
- package/src/common/component/editor/creators/CustomPanelEditorCreator.js +66 -66
- package/src/common/component/editor/creators/NumberEditorCreator.js +44 -44
- package/src/common/component/editor/creators/SimpleReportEditorCreator.js +37 -37
- package/src/common/component/editor/creators/TriggerFieldEditorCreator.js +127 -127
- package/src/common/component/settings/commands/getUserSettingsCommand.js +6 -6
- package/src/common/component/settings/commands/setUserPropValueCommand.js +23 -23
- package/src/common/component/settings/modules/settingClosePageConfirmation.js +27 -27
- package/src/common/component/settings/modules/settingShowNeedReloadMessage.js +75 -75
- package/src/common/component/settings/modules/settingwindowHolder.js +21 -21
- package/src/common/component/settings/stores/userSettingsStoreService.js +37 -37
- package/src/common/field/BankBikField.js +15 -15
- package/src/common/field/BankKppField.js +16 -16
- package/src/common/field/BankOgrnField.js +71 -71
- package/src/common/field/BankOgrnIpField.js +23 -23
- package/src/common/field/BankPaymentAccountField.js +48 -48
- package/src/common/field/DatePickerPresetsField.js +256 -256
- package/src/common/field/FieldsHelper.js +198 -198
- package/src/common/field/ForeignField.js +186 -186
- package/src/common/field/IDField.js +22 -22
- package/src/common/field/InnField.js +86 -86
- package/src/common/field/OpenDialogField.js +16 -16
- package/src/common/field/PhoneField.js +38 -38
- package/src/common/field/PropertyField.js +83 -83
- package/src/common/field/ReportValueField.js +128 -128
- package/src/common/field/ReportValueField.scss +2 -2
- package/src/common/field/SelectIconClassField.js +58 -58
- package/src/common/field/SnilsField.js +35 -35
- package/src/common/field/checkbox/CustomValueCheckBox.js +113 -113
- package/src/common/field/combo/AbstractComponentsComboBox.js +32 -32
- package/src/common/field/combo/BillingLookupComboBox.js +21 -21
- package/src/common/field/combo/CommandComboBox.js +17 -17
- package/src/common/field/combo/CommandComboBox.scss +19 -19
- package/src/common/field/combo/ConstantList.js +26 -26
- package/src/common/field/combo/IsweDynamicCheckboxGroup.js +17 -17
- package/src/common/field/combo/PanelComboBox.js +21 -21
- package/src/common/field/combo/TownTypeComboBox.js +21 -21
- package/src/common/field/fieldset/DateTimeField.js +143 -143
- package/src/common/field/fieldset/SelectAccountsRangeFieldSet.js +65 -65
- package/src/common/field/fieldset/TimePicker.js +92 -92
- package/src/common/field/numberfield/MoneyNumberField.js +177 -177
- package/src/common/field/radio/DynamicRadioGroup.js +87 -87
- package/src/common/field/withDefault.js +37 -37
- package/src/common/panel/DayPicker.js +63 -63
- package/src/common/panel/DayPicker.scss +15 -15
- package/src/common/panel/MainUploadPanel.scss +13 -13
- package/src/common/panel/SelectIconClassPanel.scss +38 -38
- package/src/common/panel/SelectIconClassPanelTemplate.scss +14 -14
- package/src/common/panel/StopwatchWindow.js +44 -44
- package/src/common/panel/WindowWrap.js +0 -0
- package/src/common/panel/WindowWrap.scss +8 -8
- package/src/common/panel/dropzone/UniversalMultiUploadForm.scss +29 -29
- package/src/common/panel/dropzone/UniversalMultiUploadFormController.js +233 -233
- package/src/common/panel/dropzone/UniversalMultiUploadFormViewModel.js +10 -10
- package/src/common/panel/dropzone/UploadDropZone.js +56 -56
- package/src/common/panel/dropzone/UploadDropZone.scss +36 -36
- package/src/common/panel/widget/LinkWindow.js +67 -67
- package/src/common/panel/widget/LinkWindowController.js +69 -69
- package/src/common/panel/widget/MainSettingsWindow.js +121 -121
- package/src/common/panel/widget/MainSettingsWindowController.js +68 -68
- package/src/common/panel/widget/PinWindow.js +42 -42
- package/src/common/panel/widget/PinWindowController.js +48 -48
- package/src/common/panel/widget/SettingsModel.js +15 -15
- package/src/common/panel/widget/SettingsWindow.js +154 -154
- package/src/common/panel/widget/SettingsWindowController.js +44 -44
- package/src/common/panel/widget/WidgetPanel.js +19 -19
- package/src/common/panel/widget/WidgetPanel.scss +157 -157
- package/src/common/panel/widget/WidgetPanelViewModel.js +13 -13
- package/src/common/plugin/form/CopyPastePlugin.js +68 -68
- package/src/common/plugin/form/CountRowsToFieldLabel.js +25 -25
- package/src/common/plugin/form/FieldDependsPlugin.js +215 -215
- package/src/common/plugin/form/PeriodMenu.js +58 -58
- package/src/common/plugin/form/PeriodPickerPlugin.js +51 -51
- package/src/common/plugin/mixin/defaults.js +17 -17
- package/src/common/tree/BaseContextMenu.js +50 -50
- package/src/common/tree/ContextMenuItem.js +18 -18
- package/src/common/tree/NodeTreeLoader.js +61 -61
- package/src/common/trigger/WikiTrigger.js +20 -20
- package/src/eventBus.js +73 -73
- package/src/info.js +39 -39
- package/src/info.scss +12 -12
- package/src/logSender.js +63 -63
- package/src/model/MoParameterFields.js +7 -7
- package/src/model/SimpleEntityCharacteristicBeanFields.js +6 -6
- package/src/model/VisualCharacteristicValueFields.js +6 -6
- package/src/model/VisualCharacteristicValuesFields.js +17 -17
- package/src/nav/AppNavTab.js +106 -106
- package/src/nav/AppNavTab.scss +20 -20
- package/src/nav/AppNavigationBar.js +88 -88
- package/src/nav/AppNavigationBar.scss +9 -9
- package/src/nav/AppNavigationBarViewController.js +66 -66
- package/src/nav/AppNavigationMenu.scss +64 -64
- package/src/nav/WindowBarMixin.js +27 -27
- package/src/nav/editor/NavigateElementEditorController.js +34 -34
- package/src/nav/editor/NavigateElementEditorView.js +94 -94
- package/src/nav/editor/NavigateElementEditorViewModel.js +22 -22
- package/src/nav/editor/menu/NavMenuTreeController.js +401 -401
- package/src/nav/editor/menu/NavMenuTreeView.js +146 -146
- package/src/nav/editor/menu/NavMenuTreeView.scss +104 -104
- package/src/nav/editor/menu/command/AddMenuCommand.js +20 -20
- package/src/nav/editor/menu/command/DeleteMenuCommand.js +20 -20
- package/src/nav/editor/menu/command/GetMenuCommand.js +20 -20
- package/src/nav/editor/menu/command/SaveMenuCommand.js +20 -20
- package/src/nav/editor/menu/form/NavMenuFormViewController.js +133 -133
- package/src/nav/editor/menu/form/NavMenuFormViewModel.js +24 -24
- package/src/nav/editor/workspace/NavWorkspaceListController.js +179 -179
- package/src/nav/editor/workspace/NavWorkspaceListView.js +59 -59
- package/src/nav/editor/workspace/NavWorkspaceListView.scss +35 -35
- package/src/nav/editor/workspace/command/AddWorkspaceCommand.js +20 -20
- package/src/nav/editor/workspace/command/DeleteWorkspaceCommand.js +20 -20
- package/src/nav/editor/workspace/command/GetWorkspaceCommand.js +20 -20
- package/src/nav/editor/workspace/command/SaveWorkspaceCommand.js +20 -20
- package/src/nav/editor/workspace/form/NavWorkspaceFormController.js +108 -108
- package/src/nav/editor/workspace/form/NavWorkspaceFormView.js +79 -79
- package/src/nav/editor/workspace/form/NavWorkspaceFormViewModel.js +18 -18
- package/src/nav/menu/NavMenuPanel.scss +11 -11
- package/src/nav/menu/WorkspaceMenuView.scss +218 -218
- package/src/nav/state.js +86 -86
- package/src/nav/windowHolder.js +97 -97
- package/src/nav/windowHolderTab.js +39 -39
- package/src/nav/windowHolderTab.scss +13 -13
- package/src/report/column/BigNumColumn.js +43 -43
- package/src/report/column/Check.js +49 -49
- package/src/report/column/CounterColumn.js +26 -26
- package/src/report/column/DynamicActionColumn.js +74 -74
- package/src/report/column/HintColumn.js +19 -19
- package/src/report/column/HintDateColumn.js +19 -19
- package/src/report/column/HintTimeIntervalColumn.js +33 -33
- package/src/report/column/IconSvgColumn.js +15 -15
- package/src/report/column/MoneyColumn.js +25 -25
- package/src/report/column/MultiFilesColumn.scss +8 -8
- package/src/report/column/MultiLineColumn.js +17 -17
- package/src/report/column/PercentColumn.js +38 -38
- package/src/report/column/SoftWrapColumn.js +18 -18
- package/src/report/column/TimeIntervalColumn.js +34 -34
- package/src/report/command/ConvertReportCommand.js +41 -41
- package/src/report/command/ExecuteAllReportsCommand.js +53 -53
- package/src/report/command/GetExcelFromRowsOrReportData.js +5 -5
- package/src/report/command/GetExcelReportDataCommand.js +5 -5
- package/src/report/command/GetPdfReportDataCommand.js +7 -7
- package/src/report/command/GetReportCommand.js +39 -39
- package/src/report/command/GetReportFieldsCommand.js +42 -42
- package/src/report/command/GetReportInfoCommand.js +29 -29
- package/src/report/command/GetReportRevisionCommand.js +25 -25
- package/src/report/command/GetReportVersionListCommand.js +28 -28
- package/src/report/command/PublisherPdfCommand.js +52 -52
- package/src/report/command/RestoreReportCommand.js +27 -27
- package/src/report/component/BoundListPagingToolbar.scss +7 -7
- package/src/report/component/EXTJSReportUploadForm.js +175 -175
- package/src/report/component/ErrorWindow.scss +15 -15
- package/src/report/component/EventKeyBox.js +20 -20
- package/src/report/component/IsweSimplestReportCombo.js +40 -40
- package/src/report/component/LookupCombo.js +24 -24
- package/src/report/component/ParameterizedReportCombo.scss +85 -85
- package/src/report/component/ReportPanel.scss +69 -69
- package/src/report/component/SimpleReportTag.scss +18 -18
- package/src/report/component/SubentityCombo.js +12 -12
- package/src/report/component/reportpanel/FilterPanel.scss +16 -16
- package/src/report/component/reportpanel/FilterPanelLegend.js +71 -71
- package/src/report/component/reportpanel/FilterPanelLegend.scss +23 -23
- package/src/report/component/reportpanel/ReportGrid.scss +19 -19
- package/src/report/component/reportpanel/ReportStore.js +55 -55
- package/src/report/component/reportpanel/ReportTreeStore.js +38 -38
- package/src/report/component/settings/AddVersioningTab.js +19 -19
- package/src/report/component/settings/ReportFormEditPanel.scss +87 -87
- package/src/report/component/settings/field/ReportFormFieldsGrid.scss +5 -5
- package/src/report/component/settings/parameter/ReportFormParameterEditPanel.js +64 -64
- package/src/report/component/settings/parameter/ReportFormParameterEditPanelController.js +124 -124
- package/src/report/component/settings/parameter/ReportFormParametersGridController.js +91 -91
- package/src/report/component/settings/plugin/PluginSelectWindow.js +245 -245
- package/src/report/component/settings/plugin/SpecificPluginSelectWindow.js +8 -8
- package/src/report/component/settings/property/ReportPropertiesPanel.scss +12 -12
- package/src/report/component/tab/ReportTabView.js +59 -59
- package/src/report/model/AccountDocumentBean.js +33 -33
- package/src/report/model/AccountDocumentBeanFields.js +35 -35
- package/src/report/model/ActionCodeBean.js +17 -17
- package/src/report/model/ActionCodeBeanFields.js +8 -8
- package/src/report/model/ActionCodeGroupBean.js +18 -18
- package/src/report/model/ActionCodeGroupBeanFields.js +9 -9
- package/src/report/model/BillingDocumentFields.js +29 -29
- package/src/report/model/BillingDocumentStateBean.js +20 -20
- package/src/report/model/BillingDocumentStateBeanFields.js +11 -11
- package/src/report/model/CharacteristicBean.js +37 -37
- package/src/report/model/CharacteristicBeanFields.js +30 -30
- package/src/report/model/ColorPluginBean.js +16 -16
- package/src/report/model/ColorPluginBeanFields.js +16 -16
- package/src/report/model/ComboValueWrapper.js +16 -16
- package/src/report/model/ComboValueWrapperFields.js +6 -6
- package/src/report/model/ConfigReportPropertyBeanFields.js +7 -7
- package/src/report/model/ConfigureCharacteristicBean.js +36 -36
- package/src/report/model/ConfigureCharacteristicBeanFields.js +27 -27
- package/src/report/model/FiltersPluginBean.js +12 -12
- package/src/report/model/FiltersPluginBeanFields.js +6 -6
- package/src/report/model/GroupButtonsPluginBean.js +16 -16
- package/src/report/model/GroupButtonsPluginBeanFields.js +13 -13
- package/src/report/model/LimitBean.js +27 -27
- package/src/report/model/LimitBeanFields.js +21 -21
- package/src/report/model/LimitDetailsBeanFields.js +12 -12
- package/src/report/model/LogRequestBean.js +19 -19
- package/src/report/model/LogRequestFields.js +11 -11
- package/src/report/model/LookupBean.js +16 -16
- package/src/report/model/LookupBeanFields.js +7 -7
- package/src/report/model/MenuGroupCharacteristicTypeBean.js +17 -17
- package/src/report/model/MenuGroupCharacteristicTypeBeanFields.js +8 -8
- package/src/report/model/RawCharacteristicValueBean.js +21 -21
- package/src/report/model/RawCharacteristicValueBeanFields.js +12 -12
- package/src/report/model/ReportAccessGroupBean.js +18 -18
- package/src/report/model/ReportAccessGroupBeanFields.js +9 -9
- package/src/report/model/ReportBeanFields.js +12 -12
- package/src/report/model/ReportFieldBean.js +26 -26
- package/src/report/model/ReportFieldBeanFields.js +10 -10
- package/src/report/model/ReportFieldPropertyBean.js +20 -20
- package/src/report/model/ReportFieldPropertyBeanFields.js +17 -17
- package/src/report/model/ReportFormBeanFields.js +20 -20
- package/src/report/model/ReportMaintenanceBean.js +26 -26
- package/src/report/model/ReportMaintenanceBeanFields.js +23 -23
- package/src/report/model/ReportNavigationContextBeanFields.js +16 -16
- package/src/report/model/ReportParameterBeanFields.js +14 -14
- package/src/report/model/ReportParameterMaintenanceBean.js +33 -33
- package/src/report/model/ReportParameterMaintenanceBeanFields.js +29 -29
- package/src/report/model/ReportPluginBeanFields.js +10 -10
- package/src/report/model/ReportPluginMaintenanceBean.js +22 -22
- package/src/report/model/ReportPluginMaintenanceBeanFields.js +17 -17
- package/src/report/model/ReportPropertyBean.js +19 -19
- package/src/report/model/ReportPropertyBeanFields.js +13 -13
- package/src/report/model/SummaryPluginBeanFields.js +7 -7
- package/src/report/model/ToggleColumnsPluginBean.js +12 -12
- package/src/report/model/ToggleColumnsPluginBeanFields.js +6 -6
- package/src/report/model/TownBeanFields.js +7 -7
- package/src/report/model/TownTypeBean.js +17 -17
- package/src/report/model/TownTypeBeanFields.js +8 -8
- package/src/report/model/UsersGroupsValueBean.js +16 -16
- package/src/report/model/UsersGroupsValueBeanFields.js +7 -7
- package/src/report/model/WizardBean.js +17 -17
- package/src/report/model/WizardBeanFields.js +8 -8
- package/src/report/plugin/SearchByPropButton.js +15 -15
- package/src/report/plugin/SettingsManagerPlugin/SettingsManagerPlugin.js +193 -193
- package/src/report/plugin/SettingsManagerPlugin/model/SMPProfileEntry.js +28 -28
- package/src/report/plugin/SettingsManagerPlugin/store/SMPAbstractEntryStore.js +89 -89
- package/src/report/plugin/SettingsManagerPlugin/store/SMPLocalEntryStore.js +64 -64
- package/src/report/plugin/SettingsManagerPlugin/store/SMPRemoteEntryStore.js +6 -6
- package/src/report/plugin/SettingsManagerPlugin/view/SMPMainView.js +300 -300
- package/src/report/plugin/SettingsManagerPlugin/view/SMPMainView.scss +3 -3
- package/src/report/plugin/SettingsManagerPlugin/view/SMPMainViewController.js +183 -183
- package/src/report/plugin/SettingsManagerPlugin/view/SMPMainViewModel.js +82 -82
- package/src/report/plugin/comboBtnWrapper.js +27 -27
- package/src/report/plugin/configPanel/BasePluginConfig.js +256 -256
- package/src/report/plugin/configPanel/CalculateCellSumPluginConfigPanel.js +29 -29
- package/src/report/plugin/configPanel/ChangeFieldValuePluginConfigGrid.js +110 -110
- package/src/report/plugin/configPanel/ExecuteCommandButtonPluginConfigPanel.scss +5 -5
- package/src/report/plugin/configPanel/GridEditorPluginConfigGrid.js +145 -145
- package/src/report/plugin/configPanel/GridFiltersPluginConfigPanelFiltersGrid.js +107 -107
- package/src/report/plugin/configPanel/GridRowAddPluginConfigPanel.js +146 -146
- package/src/report/plugin/configPanel/GridRowStylePluginConfigPropertyGrid.js +185 -185
- package/src/report/plugin/configPanel/GridToolbarButtonPluginConfigPanel.js +249 -249
- package/src/report/plugin/configPanel/GroupButtonsPluginConfigGrid.js +149 -149
- package/src/report/plugin/configPanel/GroupRowsPluginConfigPanel.scss +3 -3
- package/src/report/plugin/configPanel/SelectRowsPluginConfigPanel.js +35 -35
- package/src/report/plugin/configPanel/SetParameterPluginConfigPanel.js +108 -108
- package/src/report/plugin/configPanel/SpecificPluginConfig.js +45 -45
- package/src/report/plugin/configPanel/TextToTitleConfigPanel.js +74 -74
- package/src/report/plugin/configPanel/ToggleColumnsPluginConfigPanelAdditionalColumnsGrid.js +94 -94
- package/src/report/plugin/configPanel/ToolbarButtonPluginConfigPanel.js +164 -164
- package/src/report/plugin/configPanel/ToolbarItemPluginConfigPanel.js +83 -83
- package/src/report/plugin/configPanel/TreeFilterPluginConfigPanel.js +38 -38
- package/src/report/plugin/configPanel/common/pluginDescriptionLabel.js +7 -7
- package/src/report/plugin/configPanel/common/pluginDescriptionLabel.scss +8 -8
- package/src/report/plugin/configPanel/openCustomPanelButtonPlugin/ReportFormContextXTypeMappingGrid.js +71 -71
- package/src/report/plugin/configPanel/reportGroupsFieldValidationPlugin/RequiredParametersTree.js +157 -157
- package/src/report/plugin/configPanel/reportGroupsFieldValidationPlugin/UnusedParametersTree.js +66 -66
- package/src/report/plugin/form/ComboCustomSort.js +39 -39
- package/src/report/plugin/form/ComboLoadingProgress.js +78 -78
- package/src/report/plugin/form/CopyToClipboardPlugin.js +75 -75
- package/src/report/plugin/form/DatePeriodValidatePluginFactory.js +79 -79
- package/src/report/plugin/form/EnterConfirmFormPlugin.js +55 -55
- package/src/report/plugin/form/FieldOnEnterChangePlugin.js +27 -27
- package/src/report/plugin/form/FormFieldHidding.js +32 -32
- package/src/report/plugin/form/ReadOnlyFieldPlugin.js +24 -24
- package/src/report/plugin/form/ValidateFieldPlugin.js +42 -42
- package/src/report/plugin/form/WindowCheckStatePlugin.js +84 -84
- package/src/report/plugin/grid/AddRowButtonPlugin.js +33 -33
- package/src/report/plugin/grid/BadgeButtonPlugin.js +70 -70
- package/src/report/plugin/grid/CalculateCellSumPlugin.js +186 -186
- package/src/report/plugin/grid/ChangeFieldValueButtonPlugin.js +79 -79
- package/src/report/plugin/grid/CopyCellToSource.js +80 -80
- package/src/report/plugin/grid/CustomColumnSortPlugin.js +39 -39
- package/src/report/plugin/grid/DataSourceSelectionPlugin.js +164 -164
- package/src/report/plugin/grid/DeleteRowButtonPlugin.js +145 -145
- package/src/report/plugin/grid/ExecuteApiCommandButtonPlugin.js +23 -23
- package/src/report/plugin/grid/ExecuteCommandButtonPlugin.js +136 -136
- package/src/report/plugin/grid/ExporterPlugin.js +43 -43
- package/src/report/plugin/grid/FilterGridColumnsPlugin.js +79 -79
- package/src/report/plugin/grid/FormPanelStatePlugin.js +91 -91
- package/src/report/plugin/grid/GetAdditionalContextPlugin.js +73 -73
- package/src/report/plugin/grid/GridContextMenu.js +83 -83
- package/src/report/plugin/grid/GridContextPlugin.js +248 -248
- package/src/report/plugin/grid/GridEditButtonsDeleteBehavior.js +62 -62
- package/src/report/plugin/grid/GridFiltersByKeyPressingPlugin.js +99 -99
- package/src/report/plugin/grid/GridFiltersInHeadersPlugin.js +69 -69
- package/src/report/plugin/grid/GridFiltersPlugin.js +164 -164
- package/src/report/plugin/grid/GridFiltersPopupPlugin.js +106 -106
- package/src/report/plugin/grid/GridHistoryBehaviorPlugin.js +260 -260
- package/src/report/plugin/grid/GridHistoryBehaviorStep.js +45 -45
- package/src/report/plugin/grid/GridNoSelectPlugin.js +30 -30
- package/src/report/plugin/grid/GridRecordViewerPlugin.js +34 -2
- package/src/report/plugin/grid/GridRowAddPlugin.js +40 -40
- package/src/report/plugin/grid/GridRowCountPlugin.js +57 -57
- package/src/report/plugin/grid/GridRowEditingByEnterPlugin.js +44 -44
- package/src/report/plugin/grid/GridRowStylePlugin.scss +56 -56
- package/src/report/plugin/grid/GridRowTooltipForCellPlugin.js +118 -118
- package/src/report/plugin/grid/GridStoreDependency.js +63 -63
- package/src/report/plugin/grid/GridToolbarButtonPlugin.js +1 -1
- package/src/report/plugin/grid/GroupButtonsPlugin.js +120 -120
- package/src/report/plugin/grid/GroupRowsPlugin.js +133 -133
- package/src/report/plugin/grid/HideItemPlugin.js +54 -54
- package/src/report/plugin/grid/MultiEditorPlugin.js +119 -119
- package/src/report/plugin/grid/OpenURLButtonPlugin.js +48 -48
- package/src/report/plugin/grid/PrintPdfButtonPlugin.js +210 -210
- package/src/report/plugin/grid/ReportBoxContainerPlugin.js +30 -30
- package/src/report/plugin/grid/ReportCharacteristicBindPluginPanel.js +66 -66
- package/src/report/plugin/grid/ReportContainerPlugin.js +69 -69
- package/src/report/plugin/grid/ReportTabContainerPlugin.js +67 -67
- package/src/report/plugin/grid/ReportTabContainerPlugin.scss +3 -3
- package/src/report/plugin/grid/RestoreSelectionPlugin.js +93 -93
- package/src/report/plugin/grid/SaveTreeViewConfiguration.js +46 -46
- package/src/report/plugin/grid/SetCheckboxesPlugin.js +88 -88
- package/src/report/plugin/grid/SetParameterPlugin.js +139 -139
- package/src/report/plugin/grid/SetReportParameterPlugin.js +108 -108
- package/src/report/plugin/grid/SetSingleParameterPlugin.js +68 -68
- package/src/report/plugin/grid/SetValuePlugin.js +13 -13
- package/src/report/plugin/grid/StoreFiltersByKeyPressingPlugin.js +114 -114
- package/src/report/plugin/grid/SummaryPlugin.js +109 -109
- package/src/report/plugin/grid/TextToTitlePlugin.js +93 -93
- package/src/report/plugin/grid/ToggleColumnsPlugin.js +161 -161
- package/src/report/plugin/grid/ToggleColumnsPlugin.scss +7 -7
- package/src/report/plugin/grid/ToolbarButtonPlugin.scss +3 -3
- package/src/report/plugin/grid/ToolbarSeparatorPlugin.js +16 -16
- package/src/report/plugin/grid/UpdateGridPlugin.js +82 -82
- package/src/report/plugin/htmlEditor/ToolbarCombo.js +18 -18
- package/src/report/plugin/htmlEditor/ToolbarElement.js +34 -34
- package/src/report/plugin/report/BindDataViewPanelPlugin.js +65 -65
- package/src/report/plugin/report/IsweBindCustomPanelPlugin.js +68 -68
- package/src/report/store/AccountDocumentStore.js +49 -49
- package/src/report/store/ActionCodeGroupStore.js +19 -19
- package/src/report/store/ActionCodeStore.js +20 -20
- package/src/report/store/BillingDocumentStateListStore.js +22 -22
- package/src/report/store/BillingLookupStore.js +36 -36
- package/src/report/store/CharacteristicListStore.js +26 -26
- package/src/report/store/ColorPluginStore.js +19 -19
- package/src/report/store/ComboValueWrapperStore.js +18 -18
- package/src/report/store/FiltersPluginStore.js +19 -19
- package/src/report/store/GroupButtonsPluginStore.js +19 -19
- package/src/report/store/LimitDetailsStore.js +24 -24
- package/src/report/store/LimitStore.js +28 -28
- package/src/report/store/LookupStore.js +19 -19
- package/src/report/store/MenuGroupCharacteristicTypeListStore.js +18 -18
- package/src/report/store/RawCharacteristicValueListStore.js +18 -18
- package/src/report/store/RefStore.js +19 -19
- package/src/report/store/ReportFieldPropertyStore.js +25 -25
- package/src/report/store/ReportFieldStore.js +22 -22
- package/src/report/store/ReportNavigationContextStore.js +24 -24
- package/src/report/store/ReportParameterStore.js +21 -21
- package/src/report/store/ReportPluginStore.js +29 -29
- package/src/report/store/ReportPropertyStore.js +23 -23
- package/src/report/store/RequestLogStore.js +18 -18
- package/src/report/store/SimpleCharacteristicListStore.js +19 -19
- package/src/report/store/SimpleFilterPluginStore.js +19 -19
- package/src/report/store/SummaryPluginStore.js +19 -19
- package/src/report/store/ToggleColumnsPluginStore.js +19 -19
- package/src/report/store/TownTypeStore.js +19 -19
- package/src/report/store/WizardStore.js +20 -20
- package/src/research/ResearchTreeView.scss +19 -19
- package/src/research/TabItemWrapper.js +44 -44
- package/src/research/TabItemWrapperViewModel.js +19 -19
- package/src/research/command/GetCoonChartStructure.js +63 -63
- package/src/research/command/GetReportStructure.js +154 -154
- package/src/research/command/GetUiStructure.js +124 -124
- package/src/research/command/GetWidgetPanelStructure.js +76 -76
- package/src/security/Manager.js +30 -30
- package/src/security/Map.js +48 -48
- package/src/security/PropertyDataParser.js +135 -135
- package/src/security/component/role/RoleStore.js +4 -4
- package/src/security/component/role/RoleTagField.js +17 -17
- package/src/security/component/ui/UiCPRestrictionEditor.scss +4 -4
- package/src/security/restriction/Visibility.js +45 -45
- package/src/security/type/uiElement.js +54 -54
- package/src/stateProvider.js +20 -20
- package/src/uielement/command/ExecuteApiCommand.js +15 -15
- package/src/uielement/command/GetMenuTreeCommand.js +23 -23
- package/src/uielement/command/GetNavigateUIMenuEntryCommand.js +23 -23
- package/src/uielement/command/GetNextUIMenuEntryCommand.js +22 -22
- package/src/uielement/command/GetUIElementCommand.js +3 -1
- package/src/uielement/command/GetUIElementPropertyDocLinkCommand.js +18 -18
- package/src/uielement/command/GetUIElementRevisionCommand.js +25 -25
- package/src/uielement/command/GetUIElementVersionListCommand.js +27 -27
- package/src/uielement/component/CodemirrorEditor.js +68 -68
- package/src/uielement/component/MenuItemList.scss +35 -35
- package/src/uielement/component/UiCPVisualEditor.scss +108 -108
- package/src/uielement/component/UiCustomPanel.js +44 -44
- package/src/uielement/component/UiCustomPanelViewModel.js +15 -15
- package/src/uielement/component/UiElementLookupCombo.js +190 -190
- package/src/uielement/component/UiElementPropertyController.js +111 -111
- package/src/uielement/component/UiElementPropertyInfoController.js +23 -23
- package/src/uielement/component/UiElementPropertyPanel.js +80 -80
- package/src/uielement/component/formchips/Chip.js +87 -87
- package/src/uielement/component/formchips/FilterConditionToolbar.js +115 -115
- package/src/uielement/component/formchips/FilterConditionToolbar.scss +46 -46
- package/src/uielement/component/formchips/FilterConditionToolbarController.js +169 -169
- package/src/uielement/component/settings/AddVersioningTab.js +26 -26
- package/src/uielement/component/settings/EXTJSUiPanelImportJsonForm.js +42 -42
- package/src/uielement/component/settings/FrameView.js +113 -113
- package/src/uielement/component/settings/FrameViewController.js +132 -132
- package/src/uielement/component/settings/PropertyModel.js +8 -8
- package/src/uielement/component/settings/PropertyTreePanel.js +121 -121
- package/src/uielement/component/settings/UiCustomPanelAnnotationWindow.js +71 -71
- package/src/uielement/component/settings/UiCustomPanelEditor.scss +9 -9
- package/src/uielement/component/settings/config/UiCPConfigPanelController.scss +24 -24
- package/src/uielement/component/settings/linter/rule/BindRule.js +40 -40
- package/src/uielement/component/settings/linter/rule/BracesRule.js +68 -68
- package/src/uielement/component/settings/linter/rule/HandlerRule.js +45 -45
- package/src/uielement/component/settings/linter/rule/LayoutRule.js +24 -24
- package/src/uielement/component/settings/linter/rule/ReferenceRule.js +53 -53
- package/src/uielement/component/settings/linter/rule/XtypeRule.js +31 -31
- package/src/uielement/component/settings/plugin/UiCustomPanelPluginGrid.js +206 -206
- package/src/uielement/component/settings/plugin/UiCustomPanelPluginGrid.scss +11 -11
- package/src/uielement/component/settings/plugin/UiCustomPanelPluginGridController.js +205 -205
- package/src/uielement/component/settings/plugin/UiCustomPanelPluginPanel.scss +11 -11
- package/src/uielement/component/settings/plugin/UiCustomPanelPluginSelectWindow.js +152 -152
- package/src/uielement/component/settings/version/UiCPVersionPanel.scss +15 -15
- package/src/uielement/model/UIElementBeanFields.js +8 -8
- package/src/uielement/model/UiElementPropertyModel.js +31 -31
- package/src/uielement/plugin/AddBindingsPlugin.js +18 -18
- package/src/uielement/plugin/AddDoInitSupportPlugin.js +66 -66
- package/src/uielement/plugin/AddOutputParamsPlugin.js +22 -22
- package/src/uielement/plugin/ExecuteApiCommandPlugin.js +52 -52
- package/src/uielement/plugin/ExecuteFunctionPlugin.js +26 -26
- package/src/uielement/plugin/FireEventPlugin.js +31 -31
- package/src/uielement/plugin/MethodChainPlugin.js +24 -24
- package/src/uielement/plugin/OpenPanelPlugin.js +90 -90
- package/src/uielement/plugin/configPanel/AddBindingsPluginConfigPanelFormEditor.scss +29 -29
- package/src/uielement/plugin/configPanel/AddDoInitSupportPluginConfigPanel.js +214 -214
- package/src/uielement/plugin/configPanel/AddDoInitSupportPluginPropertiesGrid.js +62 -62
- package/src/uielement/plugin/configPanel/AddDoInitSupportPluginPropertiesGridController.js +102 -102
- package/src/uielement/plugin/configPanel/AddOutputParamsPluginConfigPanelFormEditor.js +110 -110
- package/src/uielement/plugin/configPanel/ExecuteApiCommandPluginConfigPanel.js +850 -850
- package/src/uielement/plugin/configPanel/ExecuteFunctionPluginConfigPanelFormEditor.js +86 -86
- package/src/uielement/plugin/configPanel/FireEventPluginConfigPanelFormEditor.js +107 -107
- package/src/uielement/plugin/configPanel/OpenPanelPluginConfigPanelFormEditor.js +239 -239
- package/src/uielement/plugin/configPanel/PrintPdfPluginConfigPanelFormEditor.js +350 -350
- package/src/userSettings.js +161 -161
- package/src/version.js +1 -1
- package/util/update.js +75 -75
|
@@ -1,850 +1,850 @@
|
|
|
1
|
-
Ext.define('Coon.uielement.plugin.configPanel.ExecuteApiCommandPluginConfigPanel', {
|
|
2
|
-
extend: 'Ext.panel.Panel',
|
|
3
|
-
alias: 'widget.ExecuteApiCommandPluginConfigPanel',
|
|
4
|
-
description: 'Плагин позволяет выполнить запрос к серверу',
|
|
5
|
-
layout: 'fit',
|
|
6
|
-
scrollable: 'y',
|
|
7
|
-
requires: ['Ext.ux.TreePicker'],
|
|
8
|
-
padding: 6,
|
|
9
|
-
viewModel: {
|
|
10
|
-
data: {
|
|
11
|
-
text: {
|
|
12
|
-
handler: 'handlerName',
|
|
13
|
-
picker: 'Команда',
|
|
14
|
-
docLink: '',
|
|
15
|
-
docLinkTooltip: 'Открыть документацию по команде (в новой вкладке)',
|
|
16
|
-
destination: 'propertyPath',
|
|
17
|
-
params: 'Параметры команды',
|
|
18
|
-
response: 'Формат ответа',
|
|
19
|
-
method: 'Метод',
|
|
20
|
-
mappingMode: 'mappingMode',
|
|
21
|
-
updateUrl: 'Обновить',
|
|
22
|
-
sendRequest: 'Отправить',
|
|
23
|
-
noParams: 'Параметры отсутствуют',
|
|
24
|
-
url: 'URL',
|
|
25
|
-
},
|
|
26
|
-
handlerName: null,
|
|
27
|
-
pickerSearchString: null,
|
|
28
|
-
mode: 'development',
|
|
29
|
-
selectedPath: null,
|
|
30
|
-
selectedOperationId: null,
|
|
31
|
-
selectedApiController: null,
|
|
32
|
-
apiInfo: {},
|
|
33
|
-
servers: null,
|
|
34
|
-
requestParams: null,
|
|
35
|
-
requestUrl: null,
|
|
36
|
-
requestMethod: null,
|
|
37
|
-
parsedResponse: null,
|
|
38
|
-
responseContainer: null,
|
|
39
|
-
mappingMode: 'data',
|
|
40
|
-
/* stateAttrs: [
|
|
41
|
-
'selectedPath',
|
|
42
|
-
'requestUrl',
|
|
43
|
-
'requestMethod',
|
|
44
|
-
'handlerName',
|
|
45
|
-
'responseContainer'
|
|
46
|
-
],*/
|
|
47
|
-
isRestoringState: false,
|
|
48
|
-
isParamsFormValid: false,
|
|
49
|
-
responsePreview: '',
|
|
50
|
-
responsePreviewLabel: '',
|
|
51
|
-
apiURL: '/v3/api-docs/CRM',
|
|
52
|
-
apiDocURL: '/api-doc/swagger-ui/index.html?configUrl=%2Fv3%2Fapi-docs%2Fswagger-config&urls.primaryName=CRM',
|
|
53
|
-
},
|
|
54
|
-
formulas: {
|
|
55
|
-
activeServerUrl: (get) => {
|
|
56
|
-
if (get('mode') === 'development') {
|
|
57
|
-
return location.origin;
|
|
58
|
-
}
|
|
59
|
-
const servers = get('servers');
|
|
60
|
-
if (Array.isArray(servers)) {
|
|
61
|
-
return servers.slice().shift().url;
|
|
62
|
-
}
|
|
63
|
-
return null;
|
|
64
|
-
},
|
|
65
|
-
// state: (get) => Object.fromEntries(get('stateAttrs').map((attr) => [attr, get(attr)])),
|
|
66
|
-
state: (get) => ({
|
|
67
|
-
selectedPath: get('selectedPath'),
|
|
68
|
-
requestParams: get('requestParams'),
|
|
69
|
-
requestMethod: get('requestMethod'),
|
|
70
|
-
handlerName: get('handlerName'),
|
|
71
|
-
responseContainer: get('responseContainer'),
|
|
72
|
-
mappingMode: get('mappingMode'),
|
|
73
|
-
}),
|
|
74
|
-
isObjectMode: (get) => get('mappingMode') === 'object',
|
|
75
|
-
docLinkEl: (get) => {
|
|
76
|
-
const o = get('selectedOperationId');
|
|
77
|
-
const c = get('selectedApiController');
|
|
78
|
-
if (o && c) {
|
|
79
|
-
const u = get('apiDocURL');
|
|
80
|
-
const t = get('text.docLink');
|
|
81
|
-
const tt = get('text.docLinkTooltip');
|
|
82
|
-
return `<a
|
|
83
|
-
href="${u}#/${c}/${o}"
|
|
84
|
-
target="_blank"
|
|
85
|
-
class="x-fa fa-question-circle"
|
|
86
|
-
style="text-decoration: none;"
|
|
87
|
-
title="${tt}"
|
|
88
|
-
>${t}</a>`;
|
|
89
|
-
} else {
|
|
90
|
-
return '';
|
|
91
|
-
}
|
|
92
|
-
},
|
|
93
|
-
},
|
|
94
|
-
stores: {
|
|
95
|
-
tree: {
|
|
96
|
-
remoteFilter: false,
|
|
97
|
-
type: 'tree',
|
|
98
|
-
},
|
|
99
|
-
api: {
|
|
100
|
-
autoLoad: true,
|
|
101
|
-
proxy: {
|
|
102
|
-
type: 'ajax',
|
|
103
|
-
url: '{apiURL}',
|
|
104
|
-
reader: {
|
|
105
|
-
type: 'json',
|
|
106
|
-
},
|
|
107
|
-
},
|
|
108
|
-
listeners: {
|
|
109
|
-
beforeload: 'onBeforeLoadApi',
|
|
110
|
-
load: 'onLoadApi',
|
|
111
|
-
},
|
|
112
|
-
},
|
|
113
|
-
methods: {
|
|
114
|
-
type: 'array',
|
|
115
|
-
fields: ['text'],
|
|
116
|
-
data: [],
|
|
117
|
-
},
|
|
118
|
-
responseTree: {
|
|
119
|
-
remoteFilter: false,
|
|
120
|
-
type: 'tree',
|
|
121
|
-
},
|
|
122
|
-
},
|
|
123
|
-
},
|
|
124
|
-
items: [
|
|
125
|
-
{
|
|
126
|
-
xtype: 'container',
|
|
127
|
-
|
|
128
|
-
layout: 'anchor',
|
|
129
|
-
scrollable: 'y',
|
|
130
|
-
defaults: {anchor: '100%', labelAlign: 'top'},
|
|
131
|
-
items: [
|
|
132
|
-
{
|
|
133
|
-
xtype: 'pluginDescriptionLabel',
|
|
134
|
-
bind: {
|
|
135
|
-
value: '{description}',
|
|
136
|
-
},
|
|
137
|
-
},
|
|
138
|
-
{
|
|
139
|
-
xtype: 'comboBtnWrapper',
|
|
140
|
-
combobox: {
|
|
141
|
-
reference: 'handlerCombo',
|
|
142
|
-
xtype: 'BaseComboBox',
|
|
143
|
-
flex: 1,
|
|
144
|
-
loadOnRender: false,
|
|
145
|
-
hideMode: 'offsets',
|
|
146
|
-
allowBlank: false,
|
|
147
|
-
store: 'codeHandlers',
|
|
148
|
-
bind: {
|
|
149
|
-
fieldLabel: '{text.handler}',
|
|
150
|
-
value: '{handlerName}',
|
|
151
|
-
},
|
|
152
|
-
valueField: 'id',
|
|
153
|
-
displayField: 'id',
|
|
154
|
-
},
|
|
155
|
-
},
|
|
156
|
-
{
|
|
157
|
-
xtype: 'container',
|
|
158
|
-
reference: 'mask-target',
|
|
159
|
-
layout: 'anchor',
|
|
160
|
-
items: [
|
|
161
|
-
{
|
|
162
|
-
xtype: 'fieldcontainer',
|
|
163
|
-
anchor: '100%',
|
|
164
|
-
layout: 'column',
|
|
165
|
-
items: [
|
|
166
|
-
{
|
|
167
|
-
xtype: 'treepicker',
|
|
168
|
-
autoSelect: true,
|
|
169
|
-
autoSelectLast: true,
|
|
170
|
-
reference: 'picker',
|
|
171
|
-
displayField: 'text',
|
|
172
|
-
labelStyle: 'display:inline;color: rgba(17, 17, 17, 0.54);color: var(--highlight-color);',
|
|
173
|
-
maxPickerHeight: 400,
|
|
174
|
-
columnWidth: 0.75,
|
|
175
|
-
editable: true,
|
|
176
|
-
enableKeyEvents: true,
|
|
177
|
-
disabled: true,
|
|
178
|
-
allowBlank: false,
|
|
179
|
-
triggerCls: 'svg-icon svg-icon-expand-bottom svg-icon-expand-bottom-default',
|
|
180
|
-
bind: {
|
|
181
|
-
store: '{tree}',
|
|
182
|
-
disabled: '{api.loading}',
|
|
183
|
-
fieldLabel:
|
|
184
|
-
'{text.picker} {docLinkEl}',
|
|
185
|
-
},
|
|
186
|
-
listeners: {
|
|
187
|
-
beforeselect: 'onPickerBeforeSelect',
|
|
188
|
-
select: 'onPickerSelect',
|
|
189
|
-
keyup: 'onPickerKeyPress',
|
|
190
|
-
},
|
|
191
|
-
initComponent: function() {
|
|
192
|
-
this['superclass'].initComponent.call(this, arguments);
|
|
193
|
-
},
|
|
194
|
-
onItemClick: function(view, record) {
|
|
195
|
-
if (record.get('leaf') === true) {
|
|
196
|
-
this.selectItem(record);
|
|
197
|
-
}
|
|
198
|
-
},
|
|
199
|
-
},
|
|
200
|
-
{
|
|
201
|
-
xtype: 'combo',
|
|
202
|
-
queryMode: 'local',
|
|
203
|
-
triggerAction: 'all',
|
|
204
|
-
reference: 'methodPicker',
|
|
205
|
-
columnWidth: 0.25,
|
|
206
|
-
disabled: true,
|
|
207
|
-
forceSelection: true,
|
|
208
|
-
margin: '1px 0 0 0',
|
|
209
|
-
bind: {
|
|
210
|
-
store: '{methods}',
|
|
211
|
-
value: '{requestMethod}',
|
|
212
|
-
fieldLabel: '{text.method}',
|
|
213
|
-
disabled: '{!selectedPath || api.loading}',
|
|
214
|
-
},
|
|
215
|
-
allowBlank: false,
|
|
216
|
-
}
|
|
217
|
-
],
|
|
218
|
-
},
|
|
219
|
-
{
|
|
220
|
-
xtype: 'form',
|
|
221
|
-
reference: 'main-form',
|
|
222
|
-
layout: 'anchor',
|
|
223
|
-
defaults: {
|
|
224
|
-
anchor: '100%',
|
|
225
|
-
},
|
|
226
|
-
items: [
|
|
227
|
-
{
|
|
228
|
-
xtype: 'fieldcontainer',
|
|
229
|
-
layout: {
|
|
230
|
-
type: 'hbox',
|
|
231
|
-
align: 'stretch',
|
|
232
|
-
},
|
|
233
|
-
defaults: {
|
|
234
|
-
padding: 10,
|
|
235
|
-
border: false,
|
|
236
|
-
style: 'border-top:none',
|
|
237
|
-
},
|
|
238
|
-
items: [
|
|
239
|
-
{
|
|
240
|
-
xtype: 'fieldset',
|
|
241
|
-
flex: 1,
|
|
242
|
-
hidden: true,
|
|
243
|
-
bind: {
|
|
244
|
-
title: '{text.params}',
|
|
245
|
-
visible: '{selectedPath && requestMethod}',
|
|
246
|
-
},
|
|
247
|
-
items: [
|
|
248
|
-
{
|
|
249
|
-
xtype: 'form',
|
|
250
|
-
reference: 'params-form',
|
|
251
|
-
layout: 'anchor',
|
|
252
|
-
defaults: {
|
|
253
|
-
anchor: '100%',
|
|
254
|
-
labelAlign: 'top',
|
|
255
|
-
},
|
|
256
|
-
listeners: {
|
|
257
|
-
validitychange: 'onParamsFormValidityChange',
|
|
258
|
-
},
|
|
259
|
-
}
|
|
260
|
-
],
|
|
261
|
-
},
|
|
262
|
-
{
|
|
263
|
-
xtype: 'fieldset',
|
|
264
|
-
flex: 1.5,
|
|
265
|
-
layout: 'fit',
|
|
266
|
-
margin: '0 0 0 2px',
|
|
267
|
-
maxHeight: 500,
|
|
268
|
-
scrollable: 'y',
|
|
269
|
-
bind: {
|
|
270
|
-
title: '{text.response}',
|
|
271
|
-
visible: '{selectedPath && requestMethod}',
|
|
272
|
-
},
|
|
273
|
-
items: [
|
|
274
|
-
{
|
|
275
|
-
xtype: 'tabpanel',
|
|
276
|
-
hidden: true,
|
|
277
|
-
bind: {
|
|
278
|
-
hidden: '{api.loading}',
|
|
279
|
-
},
|
|
280
|
-
items: [
|
|
281
|
-
{
|
|
282
|
-
xtype: 'treepanel',
|
|
283
|
-
title: 'TREE',
|
|
284
|
-
reference: 'response-preview-tree',
|
|
285
|
-
border: 0,
|
|
286
|
-
minHeight: 200,
|
|
287
|
-
rootVisible: true,
|
|
288
|
-
bind: {
|
|
289
|
-
store: '{responseTree}',
|
|
290
|
-
},
|
|
291
|
-
},
|
|
292
|
-
{
|
|
293
|
-
xtype: 'textarea',
|
|
294
|
-
title: 'JSON',
|
|
295
|
-
reference: 'response-preview',
|
|
296
|
-
border: 0,
|
|
297
|
-
editable: false,
|
|
298
|
-
minHeight: 150,
|
|
299
|
-
grow: true,
|
|
300
|
-
labelAlign: 'top',
|
|
301
|
-
bind: {
|
|
302
|
-
value: '{responsePreview}',
|
|
303
|
-
fieldLabel: '{responsePreviewLabel}',
|
|
304
|
-
},
|
|
305
|
-
}
|
|
306
|
-
],
|
|
307
|
-
}
|
|
308
|
-
],
|
|
309
|
-
}
|
|
310
|
-
],
|
|
311
|
-
},
|
|
312
|
-
{
|
|
313
|
-
xtype: 'fieldcontainer',
|
|
314
|
-
layout: 'column',
|
|
315
|
-
items: [
|
|
316
|
-
{
|
|
317
|
-
columnWidth: 1,
|
|
318
|
-
xtype: 'textfield',
|
|
319
|
-
editable: false,
|
|
320
|
-
bind: {
|
|
321
|
-
value: '{requestUrl}',
|
|
322
|
-
fieldLabel: 'text.url',
|
|
323
|
-
},
|
|
324
|
-
triggers: {
|
|
325
|
-
sync: {
|
|
326
|
-
cls: 'x-fa fa-sync-alt',
|
|
327
|
-
handler: 'updateUrl',
|
|
328
|
-
bind: {
|
|
329
|
-
disabled: '{!isParamsFormValid || !selectedPath}',
|
|
330
|
-
},
|
|
331
|
-
},
|
|
332
|
-
send: {
|
|
333
|
-
cls: 'x-fa fa-paper-plane',
|
|
334
|
-
handler: 'sendRequest',
|
|
335
|
-
bind: {
|
|
336
|
-
disabled: '{!sendRequest}',
|
|
337
|
-
},
|
|
338
|
-
},
|
|
339
|
-
},
|
|
340
|
-
}
|
|
341
|
-
],
|
|
342
|
-
},
|
|
343
|
-
{
|
|
344
|
-
xtype: 'ConstantList',
|
|
345
|
-
data: [
|
|
346
|
-
['object', 'object'],
|
|
347
|
-
// TODO add mapping
|
|
348
|
-
// ['map', 'map'],
|
|
349
|
-
['data', 'data']
|
|
350
|
-
],
|
|
351
|
-
bind: {
|
|
352
|
-
value: '{mappingMode}',
|
|
353
|
-
fieldLabel: '{text.mappingMode}',
|
|
354
|
-
},
|
|
355
|
-
allowBlank: true,
|
|
356
|
-
},
|
|
357
|
-
{
|
|
358
|
-
xtype: 'textfield',
|
|
359
|
-
hidden: true,
|
|
360
|
-
bind: {
|
|
361
|
-
fieldLabel: '{text.destination}',
|
|
362
|
-
value: '{responseContainer}',
|
|
363
|
-
visible: '{isObjectMode}',
|
|
364
|
-
allowBlank: true,
|
|
365
|
-
},
|
|
366
|
-
},
|
|
367
|
-
{
|
|
368
|
-
fieldLabel: 'Ответ',
|
|
369
|
-
xtype: 'textarea',
|
|
370
|
-
anchor: '100%',
|
|
371
|
-
readOnly: true,
|
|
372
|
-
grow: true,
|
|
373
|
-
hidden: true,
|
|
374
|
-
bind: {
|
|
375
|
-
value: '{parsedResponse}',
|
|
376
|
-
visible: '{parsedResponse}',
|
|
377
|
-
},
|
|
378
|
-
}
|
|
379
|
-
],
|
|
380
|
-
}
|
|
381
|
-
],
|
|
382
|
-
}
|
|
383
|
-
],
|
|
384
|
-
}
|
|
385
|
-
],
|
|
386
|
-
getData: function() {
|
|
387
|
-
return this.getViewModel().get('state');
|
|
388
|
-
},
|
|
389
|
-
setData: function(data) {
|
|
390
|
-
const vm = this.getViewModel();
|
|
391
|
-
vm.set('description', this.description);
|
|
392
|
-
for (const key of Object.keys(vm.get())) {
|
|
393
|
-
if (typeof data[key] !== 'undefined') {
|
|
394
|
-
vm.set('isRestoringState', true);
|
|
395
|
-
vm.set(key, data[key]);
|
|
396
|
-
}
|
|
397
|
-
}
|
|
398
|
-
setTimeout(() => {
|
|
399
|
-
vm.set('isRestoringState', false);
|
|
400
|
-
}, 1);
|
|
401
|
-
},
|
|
402
|
-
loadMask: null,
|
|
403
|
-
controller: {
|
|
404
|
-
bindings: {
|
|
405
|
-
onChangeSelectedPath: '{selectedPath}',
|
|
406
|
-
onChangeRequestMethod: '{requestMethod}',
|
|
407
|
-
},
|
|
408
|
-
updateParamsFromUrl: function(url) {
|
|
409
|
-
if (!url) {
|
|
410
|
-
return;
|
|
411
|
-
}
|
|
412
|
-
let params;
|
|
413
|
-
try {
|
|
414
|
-
params = new URL(url).searchParams;
|
|
415
|
-
} catch (e) {
|
|
416
|
-
return;
|
|
417
|
-
}
|
|
418
|
-
if (!params) {
|
|
419
|
-
return;
|
|
420
|
-
}
|
|
421
|
-
const paramsForm = this.lookup('params-form');
|
|
422
|
-
if (paramsForm) {
|
|
423
|
-
for (const paramName of params.keys()) {
|
|
424
|
-
const formField = paramsForm.items.findBy((field) => field.getName() === paramName);
|
|
425
|
-
formField && formField.setValue(params.get(paramName));
|
|
426
|
-
}
|
|
427
|
-
}
|
|
428
|
-
},
|
|
429
|
-
onChangeSelectedPath: function() {
|
|
430
|
-
this.updateParams();
|
|
431
|
-
},
|
|
432
|
-
onChangeRequestMethod: function() {
|
|
433
|
-
this.updateParams();
|
|
434
|
-
this.updateParamsFromUrl(this.getViewModel().get('requestUrl'));
|
|
435
|
-
},
|
|
436
|
-
onBeforeLoadApi: function(store) {
|
|
437
|
-
this.loadMask = new Ext.LoadMask({
|
|
438
|
-
target: this.lookup('mask-target'),
|
|
439
|
-
msg: 'Загрузка описания API...',
|
|
440
|
-
});
|
|
441
|
-
this.loadMask.show();
|
|
442
|
-
},
|
|
443
|
-
getApiData: function() {
|
|
444
|
-
const json = this.getStore('api').getAt(0);
|
|
445
|
-
return json['data'];
|
|
446
|
-
},
|
|
447
|
-
onLoadApi: function(store, data) {
|
|
448
|
-
this.loadMask && this.loadMask.destroy();
|
|
449
|
-
const vm = this.getViewModel();
|
|
450
|
-
if (Array.isArray(data)) {
|
|
451
|
-
const json = data.pop();
|
|
452
|
-
if (json && json.data) {
|
|
453
|
-
vm.set('apiInfo', json.data.info);
|
|
454
|
-
vm.set('servers', json.data.servers);
|
|
455
|
-
const treeStore = this.getStore('tree');
|
|
456
|
-
const rootNode = Ext.create('Ext.data.TreeModel', {
|
|
457
|
-
expanded: true,
|
|
458
|
-
text:
|
|
459
|
-
json.data.info['title'] +
|
|
460
|
-
' ' +
|
|
461
|
-
json.data.info['version'],
|
|
462
|
-
});
|
|
463
|
-
treeStore.setRoot(rootNode);
|
|
464
|
-
|
|
465
|
-
if (typeof json.data['paths'] === 'object') {
|
|
466
|
-
const paths = Object.keys(json.data['paths']);
|
|
467
|
-
const groups = new Map();
|
|
468
|
-
paths.forEach((path) => {
|
|
469
|
-
const info = path.split('/').slice(1);
|
|
470
|
-
const groupName = info.shift();
|
|
471
|
-
const existingGroup = groups.get(groupName);
|
|
472
|
-
if (groupName) {
|
|
473
|
-
const action = info.shift();
|
|
474
|
-
if (!info.length) {
|
|
475
|
-
if (!existingGroup) {
|
|
476
|
-
groups.set(
|
|
477
|
-
groupName,
|
|
478
|
-
action ? [action] : []
|
|
479
|
-
);
|
|
480
|
-
} else {
|
|
481
|
-
groups.set(groupName, existingGroup.concat(action));
|
|
482
|
-
}
|
|
483
|
-
} else {
|
|
484
|
-
const groupExists = !!groups.get(groupName);
|
|
485
|
-
if (groupExists) {
|
|
486
|
-
groups.set([groupName, action].join('/'), info);
|
|
487
|
-
} else {
|
|
488
|
-
const finalAction = info.pop();
|
|
489
|
-
const complexGroupName = [groupName, action].concat(info).join('/');
|
|
490
|
-
const existingComplexGroup = groups.get(complexGroupName);
|
|
491
|
-
if (!existingComplexGroup) {
|
|
492
|
-
groups.set(complexGroupName, finalAction ? [finalAction] : []);
|
|
493
|
-
} else {
|
|
494
|
-
groups.set(complexGroupName, existingComplexGroup.concat(finalAction));
|
|
495
|
-
}
|
|
496
|
-
}
|
|
497
|
-
}
|
|
498
|
-
}
|
|
499
|
-
});
|
|
500
|
-
const topNodes = Array.from(groups.keys()).sort();
|
|
501
|
-
const methodTagStyle =
|
|
502
|
-
'color:#FFF; border-radius:3px; padding: 0 4px';
|
|
503
|
-
const methodColors = new Map([
|
|
504
|
-
['get', '#61affe'],
|
|
505
|
-
['post', '#49cc90'],
|
|
506
|
-
['put', '#fca130'],
|
|
507
|
-
['delete', '#f93e3e']
|
|
508
|
-
]);
|
|
509
|
-
topNodes.forEach((group) => {
|
|
510
|
-
const node = {text: group, expanded: true};
|
|
511
|
-
const actions = groups.get(group);
|
|
512
|
-
if (actions.length) {
|
|
513
|
-
node['children'] = [];
|
|
514
|
-
actions.sort().forEach((action) => {
|
|
515
|
-
const path = [group, action].join('/');
|
|
516
|
-
const displayPath = path;
|
|
517
|
-
const methods = json.data['paths']['/' + path];
|
|
518
|
-
if (typeof methods === 'object') {
|
|
519
|
-
action += Object.keys(methods)
|
|
520
|
-
.map((method) => {
|
|
521
|
-
const color =
|
|
522
|
-
methodColors.get(method) ||
|
|
523
|
-
'gray';
|
|
524
|
-
return (
|
|
525
|
-
` <span style='${methodTagStyle};background-color:${color}'>` +
|
|
526
|
-
method.toUpperCase() +
|
|
527
|
-
'</span>'
|
|
528
|
-
);
|
|
529
|
-
})
|
|
530
|
-
.join(' ');
|
|
531
|
-
}
|
|
532
|
-
node['children'].push({
|
|
533
|
-
text: action,
|
|
534
|
-
path: displayPath,
|
|
535
|
-
leaf: true,
|
|
536
|
-
});
|
|
537
|
-
});
|
|
538
|
-
} else {
|
|
539
|
-
node['leaf'] = true;
|
|
540
|
-
}
|
|
541
|
-
rootNode.appendChild(node);
|
|
542
|
-
});
|
|
543
|
-
const savedPath = vm.get('selectedPath');
|
|
544
|
-
if (savedPath) {
|
|
545
|
-
const selectedRecord = treeStore.findRecord('path', savedPath);
|
|
546
|
-
if (selectedRecord) {
|
|
547
|
-
const picker = this.lookup('picker');
|
|
548
|
-
picker && picker.fireEvent('select', picker, selectedRecord, undefined, true);
|
|
549
|
-
}
|
|
550
|
-
}
|
|
551
|
-
}
|
|
552
|
-
}
|
|
553
|
-
}
|
|
554
|
-
},
|
|
555
|
-
onPickerSelect: function(picker, record, _, isFromRemoteState = false) {
|
|
556
|
-
const isLeaf = record.get('leaf');
|
|
557
|
-
const value = record.get('path') || record.get(picker.displayField);
|
|
558
|
-
const vm = this.getViewModel();
|
|
559
|
-
if (isLeaf) {
|
|
560
|
-
picker.setValue(value);
|
|
561
|
-
picker.setRawValue(value);
|
|
562
|
-
if (!isFromRemoteState) {
|
|
563
|
-
const methodsStore = vm.getStore('methods');
|
|
564
|
-
let requestMethod = null;
|
|
565
|
-
if (methodsStore && methodsStore.collect('text').includes(vm.get('requestMethod'))) {
|
|
566
|
-
requestMethod = vm.get('requestMethod');
|
|
567
|
-
}
|
|
568
|
-
vm.set({
|
|
569
|
-
'requestMethod': requestMethod,
|
|
570
|
-
'parsedResponse': null,
|
|
571
|
-
});
|
|
572
|
-
}
|
|
573
|
-
vm.set('selectedPath', value);
|
|
574
|
-
this.updateMethods(isFromRemoteState);
|
|
575
|
-
this.updateParams(isFromRemoteState);
|
|
576
|
-
this.updateUrl(isFromRemoteState);
|
|
577
|
-
} else {
|
|
578
|
-
vm.set('selectedPath', null);
|
|
579
|
-
}
|
|
580
|
-
},
|
|
581
|
-
onPickerKeyPress: function(picker) {
|
|
582
|
-
const searchString = String(picker.getRawValue()).toLowerCase();
|
|
583
|
-
const treeStore = this.getStore('tree');
|
|
584
|
-
if (!searchString || !searchString.length) {
|
|
585
|
-
treeStore.getFilters().removeAll();
|
|
586
|
-
}
|
|
587
|
-
if (searchString.length >= 2) {
|
|
588
|
-
treeStore.filterBy((node) => {
|
|
589
|
-
if (node.isRoot()) {
|
|
590
|
-
return true;
|
|
591
|
-
}
|
|
592
|
-
if (!node.isLeaf()) {
|
|
593
|
-
const nodeText = String(node.get('text')).toLowerCase();
|
|
594
|
-
return nodeText.startsWith(searchString);
|
|
595
|
-
} else {
|
|
596
|
-
return !node.parentNode.isRoot();
|
|
597
|
-
}
|
|
598
|
-
});
|
|
599
|
-
picker.expand();
|
|
600
|
-
}
|
|
601
|
-
},
|
|
602
|
-
/* https://stackoverflow.com/a/22129960 */
|
|
603
|
-
resolvePath: function(path, obj = {}, separator = '/') {
|
|
604
|
-
const properties = Array.isArray(path) ? path : path.split(separator);
|
|
605
|
-
return properties.reduce((prev, curr) => prev && prev[curr], obj);
|
|
606
|
-
},
|
|
607
|
-
/* TODO use @resolvePath */
|
|
608
|
-
getPropsByRef: function(ref, type) {
|
|
609
|
-
const json = this.getStore('api').getAt(0);
|
|
610
|
-
const refName = ref.split('/').pop();
|
|
611
|
-
const schema = json['data']['components']['schemas'][refName];
|
|
612
|
-
if (schema && schema['properties']) {
|
|
613
|
-
const props = schema['properties'];
|
|
614
|
-
// TODO bubble types
|
|
615
|
-
return JSON.stringify(
|
|
616
|
-
type === 'array' ? [props] : props,
|
|
617
|
-
null,
|
|
618
|
-
4
|
|
619
|
-
);
|
|
620
|
-
}
|
|
621
|
-
return '';
|
|
622
|
-
},
|
|
623
|
-
onParamsFormValidityChange: function(form, isValid) {
|
|
624
|
-
this.getViewModel().set('isParamsFormValid', isValid);
|
|
625
|
-
},
|
|
626
|
-
updateMethods: function() {
|
|
627
|
-
const json = this.getStore('api').getAt(0);
|
|
628
|
-
const methodsStore = this.getStore('methods');
|
|
629
|
-
const vm = this.getViewModel();
|
|
630
|
-
if (json) {
|
|
631
|
-
const methods =
|
|
632
|
-
json['data'].paths['/' + vm.get('selectedPath')];
|
|
633
|
-
if (typeof methods === 'object') {
|
|
634
|
-
const methodNames = Object.keys(methods).map((m) => ({text: m.toUpperCase()}));
|
|
635
|
-
methodsStore.loadData(methodNames, false);
|
|
636
|
-
const currentMethod = vm.get('requestMethod');
|
|
637
|
-
let autoSelect;
|
|
638
|
-
if (methodsStore.getCount() === 1) {
|
|
639
|
-
autoSelect = methodsStore.getAt(0);
|
|
640
|
-
} else if (currentMethod) {
|
|
641
|
-
autoSelect = methodsStore.findRecord('text', currentMethod);
|
|
642
|
-
}
|
|
643
|
-
const picker = this.lookup('methodPicker');
|
|
644
|
-
picker && picker.setSelection(autoSelect);
|
|
645
|
-
}
|
|
646
|
-
}
|
|
647
|
-
},
|
|
648
|
-
updateUrl: function(isFromRemoteState = false) {
|
|
649
|
-
const formPanel = this.lookup('params-form');
|
|
650
|
-
const vm = this.getViewModel();
|
|
651
|
-
const formValues = isFromRemoteState === true ? vm.get('requestParams') || '' : formPanel.getValues(true, true);
|
|
652
|
-
const requestUrl = new URL(
|
|
653
|
-
String(vm.get('selectedPath')) + (formValues.length ? '?' + formValues : ''),
|
|
654
|
-
String(vm.get('activeServerUrl')) + '/'
|
|
655
|
-
);
|
|
656
|
-
vm.set({
|
|
657
|
-
parsedResponse: null,
|
|
658
|
-
requestUrl: requestUrl.toString(),
|
|
659
|
-
requestParams: requestUrl.searchParams.toString(),
|
|
660
|
-
});
|
|
661
|
-
},
|
|
662
|
-
updateParams: function(isFromRemoteState = false) {
|
|
663
|
-
const json = this.getStore('api').getAt(0);
|
|
664
|
-
const vm = this.getViewModel();
|
|
665
|
-
const method = String(vm.get('requestMethod')).toLowerCase();
|
|
666
|
-
const path = vm.get('selectedPath');
|
|
667
|
-
const form = this.lookup('params-form');
|
|
668
|
-
form.removeAll();
|
|
669
|
-
this.getResponsePreview().reset();
|
|
670
|
-
vm.set({
|
|
671
|
-
selectedOperationId: null,
|
|
672
|
-
selectedApiController: null,
|
|
673
|
-
});
|
|
674
|
-
if (json && path) {
|
|
675
|
-
const methodsConfig = json['data']['paths'][`/${path}`][method];
|
|
676
|
-
if (methodsConfig) {
|
|
677
|
-
const parameters = methodsConfig['parameters'];
|
|
678
|
-
const tags = methodsConfig['tags'];
|
|
679
|
-
vm.set(
|
|
680
|
-
{
|
|
681
|
-
selectedOperationId: methodsConfig['operationId'],
|
|
682
|
-
selectedApiController: tags.length ? tags[0] : null,
|
|
683
|
-
}
|
|
684
|
-
);
|
|
685
|
-
if (Array.isArray(parameters)) {
|
|
686
|
-
parameters.forEach((config) => {
|
|
687
|
-
const isRequired = config['required'] === true;
|
|
688
|
-
let xtype;
|
|
689
|
-
let value = null;
|
|
690
|
-
|
|
691
|
-
switch (config['schema']['type']) {
|
|
692
|
-
case 'integer':
|
|
693
|
-
xtype = 'numberfield';
|
|
694
|
-
break;
|
|
695
|
-
case 'boolean':
|
|
696
|
-
xtype = 'checkbox';
|
|
697
|
-
break;
|
|
698
|
-
case 'string':
|
|
699
|
-
xtype = 'textfield';
|
|
700
|
-
break;
|
|
701
|
-
case 'array':
|
|
702
|
-
default:
|
|
703
|
-
xtype = 'textarea';
|
|
704
|
-
}
|
|
705
|
-
|
|
706
|
-
if (!isFromRemoteState) {
|
|
707
|
-
const refHolder = config['schema']['$ref'] ?
|
|
708
|
-
config['schema'] :
|
|
709
|
-
config['schema']['items'];
|
|
710
|
-
if (refHolder) {
|
|
711
|
-
value = this.getPropsByRef(
|
|
712
|
-
refHolder['$ref'],
|
|
713
|
-
config['schema']['type']
|
|
714
|
-
);
|
|
715
|
-
}
|
|
716
|
-
} else {
|
|
717
|
-
const requestQueryString = String(vm.get('requestParams'));
|
|
718
|
-
if (requestQueryString.length) {
|
|
719
|
-
const requestSearchParams = new URLSearchParams(requestQueryString);
|
|
720
|
-
const requestParams = Object.fromEntries(requestSearchParams.entries());
|
|
721
|
-
value = requestParams[config['name']];
|
|
722
|
-
}
|
|
723
|
-
}
|
|
724
|
-
|
|
725
|
-
const item = {
|
|
726
|
-
xtype,
|
|
727
|
-
fieldLabel:
|
|
728
|
-
(config['schema']['type'] || 'object') +
|
|
729
|
-
': ' +
|
|
730
|
-
config['name'],
|
|
731
|
-
allowBlank: !isRequired,
|
|
732
|
-
name: config['name'],
|
|
733
|
-
value,
|
|
734
|
-
};
|
|
735
|
-
if (isRequired) {
|
|
736
|
-
item['labelStyle'] = 'font-weight:bold';
|
|
737
|
-
}
|
|
738
|
-
if (xtype === 'textarea') {
|
|
739
|
-
item['grow'] = true;
|
|
740
|
-
}
|
|
741
|
-
form.add(item);
|
|
742
|
-
});
|
|
743
|
-
} else {
|
|
744
|
-
form.add({
|
|
745
|
-
xtype: 'displayfield',
|
|
746
|
-
bind: {
|
|
747
|
-
value: '{text.noParams}',
|
|
748
|
-
},
|
|
749
|
-
});
|
|
750
|
-
}
|
|
751
|
-
this.getResponsePreview().update(methodsConfig['responses'], json);
|
|
752
|
-
form.isValid();
|
|
753
|
-
}
|
|
754
|
-
}
|
|
755
|
-
},
|
|
756
|
-
sendRequest: async function() {
|
|
757
|
-
const vm = this.getViewModel();
|
|
758
|
-
Ext.Ajax.request({
|
|
759
|
-
url: String(vm.get('requestUrl')),
|
|
760
|
-
method: vm.get('requestMethod'),
|
|
761
|
-
success: (response) => {
|
|
762
|
-
this.processResponse(response);
|
|
763
|
-
},
|
|
764
|
-
failure: (response) => {
|
|
765
|
-
console.debug('server-side failure with status code ' + response.status);
|
|
766
|
-
vm.set('parsedResponse', null);
|
|
767
|
-
},
|
|
768
|
-
});
|
|
769
|
-
},
|
|
770
|
-
processResponse: function(response) {
|
|
771
|
-
const json = JSON5.parse(response.responseText);
|
|
772
|
-
console.debug(json);
|
|
773
|
-
this.getViewModel().set('parsedResponse', JSON.stringify(json, null, 4));
|
|
774
|
-
},
|
|
775
|
-
resolveNodeType: function(config, rootNode) {
|
|
776
|
-
if (typeof config !== 'object') {
|
|
777
|
-
return;
|
|
778
|
-
}
|
|
779
|
-
for (const key of Object.keys(config)) {
|
|
780
|
-
if (key === 'type') {
|
|
781
|
-
continue;
|
|
782
|
-
}
|
|
783
|
-
const childNode = Ext.create('Ext.data.TreeModel', {
|
|
784
|
-
leaf: true,
|
|
785
|
-
});
|
|
786
|
-
const value = config[key];
|
|
787
|
-
if (value['type']) {
|
|
788
|
-
childNode.set('text', `${key}: ${value['type']}`);
|
|
789
|
-
if (value['type'] === 'object') {
|
|
790
|
-
childNode.set('leaf', false);
|
|
791
|
-
childNode.set('expanded', true);
|
|
792
|
-
this.resolveNodeType(value, childNode);
|
|
793
|
-
}
|
|
794
|
-
} else if (value['$ref'] && String(value['$ref']).startsWith('#/')) {
|
|
795
|
-
const ref = this.resolvePath(String(value['$ref']).slice(2), this.getApiData());
|
|
796
|
-
if (ref) {
|
|
797
|
-
childNode.set('text', `${key}: object`);
|
|
798
|
-
childNode.set('expanded', true);
|
|
799
|
-
this.resolveNodeType(ref['properties'], childNode);
|
|
800
|
-
}
|
|
801
|
-
}
|
|
802
|
-
rootNode.appendChild(childNode);
|
|
803
|
-
}
|
|
804
|
-
},
|
|
805
|
-
getResponsePreview: function() {
|
|
806
|
-
const vm = this.getViewModel();
|
|
807
|
-
return {
|
|
808
|
-
reset: () => {
|
|
809
|
-
vm.set({responsePreview: '', responsePreviewLabel: ''});
|
|
810
|
-
},
|
|
811
|
-
update: (responses, json) => {
|
|
812
|
-
if (typeof responses['200'] !== 'undefined') {
|
|
813
|
-
const resp200 = responses['200']['content'];
|
|
814
|
-
if (typeof resp200 === 'object') {
|
|
815
|
-
const schemas = Object.values(resp200).shift();
|
|
816
|
-
if (schemas['schema']) {
|
|
817
|
-
const ref = String(schemas['schema']['$ref']);
|
|
818
|
-
if (ref.startsWith('#/')) {
|
|
819
|
-
const config = this.resolvePath(ref.slice(2), json['data']);
|
|
820
|
-
if (typeof config['properties'] === 'object') {
|
|
821
|
-
vm.set('responsePreview', JSON.stringify(config['properties'], (key, value) => {
|
|
822
|
-
if (value['$ref'] && String(value['$ref']).startsWith('#')) {
|
|
823
|
-
const refObj = this.resolvePath(String(value['$ref']).slice(2), json['data']);
|
|
824
|
-
if (refObj && refObj['type'] === 'object' && typeof refObj['properties'] === 'object') {
|
|
825
|
-
value = refObj['properties'];
|
|
826
|
-
}
|
|
827
|
-
}
|
|
828
|
-
return value;
|
|
829
|
-
}, 4));
|
|
830
|
-
}
|
|
831
|
-
const responseTreeStore = this.getStore('responseTree');
|
|
832
|
-
const rootNode = Ext.create('Ext.data.TreeModel', {
|
|
833
|
-
expanded: true,
|
|
834
|
-
text: 'object:',
|
|
835
|
-
});
|
|
836
|
-
if (typeof config['xml'] === 'object') {
|
|
837
|
-
vm.set('responsePreviewLabel', String(config['xml']['name']));
|
|
838
|
-
rootNode.set('text', String(config['xml']['name']));
|
|
839
|
-
}
|
|
840
|
-
this.resolveNodeType(config['properties'], rootNode);
|
|
841
|
-
responseTreeStore.setRoot(rootNode);
|
|
842
|
-
}
|
|
843
|
-
}
|
|
844
|
-
}
|
|
845
|
-
}
|
|
846
|
-
},
|
|
847
|
-
};
|
|
848
|
-
},
|
|
849
|
-
},
|
|
850
|
-
});
|
|
1
|
+
Ext.define('Coon.uielement.plugin.configPanel.ExecuteApiCommandPluginConfigPanel', {
|
|
2
|
+
extend: 'Ext.panel.Panel',
|
|
3
|
+
alias: 'widget.ExecuteApiCommandPluginConfigPanel',
|
|
4
|
+
description: 'Плагин позволяет выполнить запрос к серверу',
|
|
5
|
+
layout: 'fit',
|
|
6
|
+
scrollable: 'y',
|
|
7
|
+
requires: ['Ext.ux.TreePicker'],
|
|
8
|
+
padding: 6,
|
|
9
|
+
viewModel: {
|
|
10
|
+
data: {
|
|
11
|
+
text: {
|
|
12
|
+
handler: 'handlerName',
|
|
13
|
+
picker: 'Команда',
|
|
14
|
+
docLink: '',
|
|
15
|
+
docLinkTooltip: 'Открыть документацию по команде (в новой вкладке)',
|
|
16
|
+
destination: 'propertyPath',
|
|
17
|
+
params: 'Параметры команды',
|
|
18
|
+
response: 'Формат ответа',
|
|
19
|
+
method: 'Метод',
|
|
20
|
+
mappingMode: 'mappingMode',
|
|
21
|
+
updateUrl: 'Обновить',
|
|
22
|
+
sendRequest: 'Отправить',
|
|
23
|
+
noParams: 'Параметры отсутствуют',
|
|
24
|
+
url: 'URL',
|
|
25
|
+
},
|
|
26
|
+
handlerName: null,
|
|
27
|
+
pickerSearchString: null,
|
|
28
|
+
mode: 'development',
|
|
29
|
+
selectedPath: null,
|
|
30
|
+
selectedOperationId: null,
|
|
31
|
+
selectedApiController: null,
|
|
32
|
+
apiInfo: {},
|
|
33
|
+
servers: null,
|
|
34
|
+
requestParams: null,
|
|
35
|
+
requestUrl: null,
|
|
36
|
+
requestMethod: null,
|
|
37
|
+
parsedResponse: null,
|
|
38
|
+
responseContainer: null,
|
|
39
|
+
mappingMode: 'data',
|
|
40
|
+
/* stateAttrs: [
|
|
41
|
+
'selectedPath',
|
|
42
|
+
'requestUrl',
|
|
43
|
+
'requestMethod',
|
|
44
|
+
'handlerName',
|
|
45
|
+
'responseContainer'
|
|
46
|
+
],*/
|
|
47
|
+
isRestoringState: false,
|
|
48
|
+
isParamsFormValid: false,
|
|
49
|
+
responsePreview: '',
|
|
50
|
+
responsePreviewLabel: '',
|
|
51
|
+
apiURL: '/v3/api-docs/CRM',
|
|
52
|
+
apiDocURL: '/api-doc/swagger-ui/index.html?configUrl=%2Fv3%2Fapi-docs%2Fswagger-config&urls.primaryName=CRM',
|
|
53
|
+
},
|
|
54
|
+
formulas: {
|
|
55
|
+
activeServerUrl: (get) => {
|
|
56
|
+
if (get('mode') === 'development') {
|
|
57
|
+
return location.origin;
|
|
58
|
+
}
|
|
59
|
+
const servers = get('servers');
|
|
60
|
+
if (Array.isArray(servers)) {
|
|
61
|
+
return servers.slice().shift().url;
|
|
62
|
+
}
|
|
63
|
+
return null;
|
|
64
|
+
},
|
|
65
|
+
// state: (get) => Object.fromEntries(get('stateAttrs').map((attr) => [attr, get(attr)])),
|
|
66
|
+
state: (get) => ({
|
|
67
|
+
selectedPath: get('selectedPath'),
|
|
68
|
+
requestParams: get('requestParams'),
|
|
69
|
+
requestMethod: get('requestMethod'),
|
|
70
|
+
handlerName: get('handlerName'),
|
|
71
|
+
responseContainer: get('responseContainer'),
|
|
72
|
+
mappingMode: get('mappingMode'),
|
|
73
|
+
}),
|
|
74
|
+
isObjectMode: (get) => get('mappingMode') === 'object',
|
|
75
|
+
docLinkEl: (get) => {
|
|
76
|
+
const o = get('selectedOperationId');
|
|
77
|
+
const c = get('selectedApiController');
|
|
78
|
+
if (o && c) {
|
|
79
|
+
const u = get('apiDocURL');
|
|
80
|
+
const t = get('text.docLink');
|
|
81
|
+
const tt = get('text.docLinkTooltip');
|
|
82
|
+
return `<a
|
|
83
|
+
href="${u}#/${c}/${o}"
|
|
84
|
+
target="_blank"
|
|
85
|
+
class="x-fa fa-question-circle"
|
|
86
|
+
style="text-decoration: none;"
|
|
87
|
+
title="${tt}"
|
|
88
|
+
>${t}</a>`;
|
|
89
|
+
} else {
|
|
90
|
+
return '';
|
|
91
|
+
}
|
|
92
|
+
},
|
|
93
|
+
},
|
|
94
|
+
stores: {
|
|
95
|
+
tree: {
|
|
96
|
+
remoteFilter: false,
|
|
97
|
+
type: 'tree',
|
|
98
|
+
},
|
|
99
|
+
api: {
|
|
100
|
+
autoLoad: true,
|
|
101
|
+
proxy: {
|
|
102
|
+
type: 'ajax',
|
|
103
|
+
url: '{apiURL}',
|
|
104
|
+
reader: {
|
|
105
|
+
type: 'json',
|
|
106
|
+
},
|
|
107
|
+
},
|
|
108
|
+
listeners: {
|
|
109
|
+
beforeload: 'onBeforeLoadApi',
|
|
110
|
+
load: 'onLoadApi',
|
|
111
|
+
},
|
|
112
|
+
},
|
|
113
|
+
methods: {
|
|
114
|
+
type: 'array',
|
|
115
|
+
fields: ['text'],
|
|
116
|
+
data: [],
|
|
117
|
+
},
|
|
118
|
+
responseTree: {
|
|
119
|
+
remoteFilter: false,
|
|
120
|
+
type: 'tree',
|
|
121
|
+
},
|
|
122
|
+
},
|
|
123
|
+
},
|
|
124
|
+
items: [
|
|
125
|
+
{
|
|
126
|
+
xtype: 'container',
|
|
127
|
+
|
|
128
|
+
layout: 'anchor',
|
|
129
|
+
scrollable: 'y',
|
|
130
|
+
defaults: {anchor: '100%', labelAlign: 'top'},
|
|
131
|
+
items: [
|
|
132
|
+
{
|
|
133
|
+
xtype: 'pluginDescriptionLabel',
|
|
134
|
+
bind: {
|
|
135
|
+
value: '{description}',
|
|
136
|
+
},
|
|
137
|
+
},
|
|
138
|
+
{
|
|
139
|
+
xtype: 'comboBtnWrapper',
|
|
140
|
+
combobox: {
|
|
141
|
+
reference: 'handlerCombo',
|
|
142
|
+
xtype: 'BaseComboBox',
|
|
143
|
+
flex: 1,
|
|
144
|
+
loadOnRender: false,
|
|
145
|
+
hideMode: 'offsets',
|
|
146
|
+
allowBlank: false,
|
|
147
|
+
store: 'codeHandlers',
|
|
148
|
+
bind: {
|
|
149
|
+
fieldLabel: '{text.handler}',
|
|
150
|
+
value: '{handlerName}',
|
|
151
|
+
},
|
|
152
|
+
valueField: 'id',
|
|
153
|
+
displayField: 'id',
|
|
154
|
+
},
|
|
155
|
+
},
|
|
156
|
+
{
|
|
157
|
+
xtype: 'container',
|
|
158
|
+
reference: 'mask-target',
|
|
159
|
+
layout: 'anchor',
|
|
160
|
+
items: [
|
|
161
|
+
{
|
|
162
|
+
xtype: 'fieldcontainer',
|
|
163
|
+
anchor: '100%',
|
|
164
|
+
layout: 'column',
|
|
165
|
+
items: [
|
|
166
|
+
{
|
|
167
|
+
xtype: 'treepicker',
|
|
168
|
+
autoSelect: true,
|
|
169
|
+
autoSelectLast: true,
|
|
170
|
+
reference: 'picker',
|
|
171
|
+
displayField: 'text',
|
|
172
|
+
labelStyle: 'display:inline;color: rgba(17, 17, 17, 0.54);color: var(--highlight-color);',
|
|
173
|
+
maxPickerHeight: 400,
|
|
174
|
+
columnWidth: 0.75,
|
|
175
|
+
editable: true,
|
|
176
|
+
enableKeyEvents: true,
|
|
177
|
+
disabled: true,
|
|
178
|
+
allowBlank: false,
|
|
179
|
+
triggerCls: 'svg-icon svg-icon-expand-bottom svg-icon-expand-bottom-default',
|
|
180
|
+
bind: {
|
|
181
|
+
store: '{tree}',
|
|
182
|
+
disabled: '{api.loading}',
|
|
183
|
+
fieldLabel:
|
|
184
|
+
'{text.picker} {docLinkEl}',
|
|
185
|
+
},
|
|
186
|
+
listeners: {
|
|
187
|
+
beforeselect: 'onPickerBeforeSelect',
|
|
188
|
+
select: 'onPickerSelect',
|
|
189
|
+
keyup: 'onPickerKeyPress',
|
|
190
|
+
},
|
|
191
|
+
initComponent: function() {
|
|
192
|
+
this['superclass'].initComponent.call(this, arguments);
|
|
193
|
+
},
|
|
194
|
+
onItemClick: function(view, record) {
|
|
195
|
+
if (record.get('leaf') === true) {
|
|
196
|
+
this.selectItem(record);
|
|
197
|
+
}
|
|
198
|
+
},
|
|
199
|
+
},
|
|
200
|
+
{
|
|
201
|
+
xtype: 'combo',
|
|
202
|
+
queryMode: 'local',
|
|
203
|
+
triggerAction: 'all',
|
|
204
|
+
reference: 'methodPicker',
|
|
205
|
+
columnWidth: 0.25,
|
|
206
|
+
disabled: true,
|
|
207
|
+
forceSelection: true,
|
|
208
|
+
margin: '1px 0 0 0',
|
|
209
|
+
bind: {
|
|
210
|
+
store: '{methods}',
|
|
211
|
+
value: '{requestMethod}',
|
|
212
|
+
fieldLabel: '{text.method}',
|
|
213
|
+
disabled: '{!selectedPath || api.loading}',
|
|
214
|
+
},
|
|
215
|
+
allowBlank: false,
|
|
216
|
+
}
|
|
217
|
+
],
|
|
218
|
+
},
|
|
219
|
+
{
|
|
220
|
+
xtype: 'form',
|
|
221
|
+
reference: 'main-form',
|
|
222
|
+
layout: 'anchor',
|
|
223
|
+
defaults: {
|
|
224
|
+
anchor: '100%',
|
|
225
|
+
},
|
|
226
|
+
items: [
|
|
227
|
+
{
|
|
228
|
+
xtype: 'fieldcontainer',
|
|
229
|
+
layout: {
|
|
230
|
+
type: 'hbox',
|
|
231
|
+
align: 'stretch',
|
|
232
|
+
},
|
|
233
|
+
defaults: {
|
|
234
|
+
padding: 10,
|
|
235
|
+
border: false,
|
|
236
|
+
style: 'border-top:none',
|
|
237
|
+
},
|
|
238
|
+
items: [
|
|
239
|
+
{
|
|
240
|
+
xtype: 'fieldset',
|
|
241
|
+
flex: 1,
|
|
242
|
+
hidden: true,
|
|
243
|
+
bind: {
|
|
244
|
+
title: '{text.params}',
|
|
245
|
+
visible: '{selectedPath && requestMethod}',
|
|
246
|
+
},
|
|
247
|
+
items: [
|
|
248
|
+
{
|
|
249
|
+
xtype: 'form',
|
|
250
|
+
reference: 'params-form',
|
|
251
|
+
layout: 'anchor',
|
|
252
|
+
defaults: {
|
|
253
|
+
anchor: '100%',
|
|
254
|
+
labelAlign: 'top',
|
|
255
|
+
},
|
|
256
|
+
listeners: {
|
|
257
|
+
validitychange: 'onParamsFormValidityChange',
|
|
258
|
+
},
|
|
259
|
+
}
|
|
260
|
+
],
|
|
261
|
+
},
|
|
262
|
+
{
|
|
263
|
+
xtype: 'fieldset',
|
|
264
|
+
flex: 1.5,
|
|
265
|
+
layout: 'fit',
|
|
266
|
+
margin: '0 0 0 2px',
|
|
267
|
+
maxHeight: 500,
|
|
268
|
+
scrollable: 'y',
|
|
269
|
+
bind: {
|
|
270
|
+
title: '{text.response}',
|
|
271
|
+
visible: '{selectedPath && requestMethod}',
|
|
272
|
+
},
|
|
273
|
+
items: [
|
|
274
|
+
{
|
|
275
|
+
xtype: 'tabpanel',
|
|
276
|
+
hidden: true,
|
|
277
|
+
bind: {
|
|
278
|
+
hidden: '{api.loading}',
|
|
279
|
+
},
|
|
280
|
+
items: [
|
|
281
|
+
{
|
|
282
|
+
xtype: 'treepanel',
|
|
283
|
+
title: 'TREE',
|
|
284
|
+
reference: 'response-preview-tree',
|
|
285
|
+
border: 0,
|
|
286
|
+
minHeight: 200,
|
|
287
|
+
rootVisible: true,
|
|
288
|
+
bind: {
|
|
289
|
+
store: '{responseTree}',
|
|
290
|
+
},
|
|
291
|
+
},
|
|
292
|
+
{
|
|
293
|
+
xtype: 'textarea',
|
|
294
|
+
title: 'JSON',
|
|
295
|
+
reference: 'response-preview',
|
|
296
|
+
border: 0,
|
|
297
|
+
editable: false,
|
|
298
|
+
minHeight: 150,
|
|
299
|
+
grow: true,
|
|
300
|
+
labelAlign: 'top',
|
|
301
|
+
bind: {
|
|
302
|
+
value: '{responsePreview}',
|
|
303
|
+
fieldLabel: '{responsePreviewLabel}',
|
|
304
|
+
},
|
|
305
|
+
}
|
|
306
|
+
],
|
|
307
|
+
}
|
|
308
|
+
],
|
|
309
|
+
}
|
|
310
|
+
],
|
|
311
|
+
},
|
|
312
|
+
{
|
|
313
|
+
xtype: 'fieldcontainer',
|
|
314
|
+
layout: 'column',
|
|
315
|
+
items: [
|
|
316
|
+
{
|
|
317
|
+
columnWidth: 1,
|
|
318
|
+
xtype: 'textfield',
|
|
319
|
+
editable: false,
|
|
320
|
+
bind: {
|
|
321
|
+
value: '{requestUrl}',
|
|
322
|
+
fieldLabel: 'text.url',
|
|
323
|
+
},
|
|
324
|
+
triggers: {
|
|
325
|
+
sync: {
|
|
326
|
+
cls: 'x-fa fa-sync-alt',
|
|
327
|
+
handler: 'updateUrl',
|
|
328
|
+
bind: {
|
|
329
|
+
disabled: '{!isParamsFormValid || !selectedPath}',
|
|
330
|
+
},
|
|
331
|
+
},
|
|
332
|
+
send: {
|
|
333
|
+
cls: 'x-fa fa-paper-plane',
|
|
334
|
+
handler: 'sendRequest',
|
|
335
|
+
bind: {
|
|
336
|
+
disabled: '{!sendRequest}',
|
|
337
|
+
},
|
|
338
|
+
},
|
|
339
|
+
},
|
|
340
|
+
}
|
|
341
|
+
],
|
|
342
|
+
},
|
|
343
|
+
{
|
|
344
|
+
xtype: 'ConstantList',
|
|
345
|
+
data: [
|
|
346
|
+
['object', 'object'],
|
|
347
|
+
// TODO add mapping
|
|
348
|
+
// ['map', 'map'],
|
|
349
|
+
['data', 'data']
|
|
350
|
+
],
|
|
351
|
+
bind: {
|
|
352
|
+
value: '{mappingMode}',
|
|
353
|
+
fieldLabel: '{text.mappingMode}',
|
|
354
|
+
},
|
|
355
|
+
allowBlank: true,
|
|
356
|
+
},
|
|
357
|
+
{
|
|
358
|
+
xtype: 'textfield',
|
|
359
|
+
hidden: true,
|
|
360
|
+
bind: {
|
|
361
|
+
fieldLabel: '{text.destination}',
|
|
362
|
+
value: '{responseContainer}',
|
|
363
|
+
visible: '{isObjectMode}',
|
|
364
|
+
allowBlank: true,
|
|
365
|
+
},
|
|
366
|
+
},
|
|
367
|
+
{
|
|
368
|
+
fieldLabel: 'Ответ',
|
|
369
|
+
xtype: 'textarea',
|
|
370
|
+
anchor: '100%',
|
|
371
|
+
readOnly: true,
|
|
372
|
+
grow: true,
|
|
373
|
+
hidden: true,
|
|
374
|
+
bind: {
|
|
375
|
+
value: '{parsedResponse}',
|
|
376
|
+
visible: '{parsedResponse}',
|
|
377
|
+
},
|
|
378
|
+
}
|
|
379
|
+
],
|
|
380
|
+
}
|
|
381
|
+
],
|
|
382
|
+
}
|
|
383
|
+
],
|
|
384
|
+
}
|
|
385
|
+
],
|
|
386
|
+
getData: function() {
|
|
387
|
+
return this.getViewModel().get('state');
|
|
388
|
+
},
|
|
389
|
+
setData: function(data) {
|
|
390
|
+
const vm = this.getViewModel();
|
|
391
|
+
vm.set('description', this.description);
|
|
392
|
+
for (const key of Object.keys(vm.get())) {
|
|
393
|
+
if (typeof data[key] !== 'undefined') {
|
|
394
|
+
vm.set('isRestoringState', true);
|
|
395
|
+
vm.set(key, data[key]);
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
setTimeout(() => {
|
|
399
|
+
vm.set('isRestoringState', false);
|
|
400
|
+
}, 1);
|
|
401
|
+
},
|
|
402
|
+
loadMask: null,
|
|
403
|
+
controller: {
|
|
404
|
+
bindings: {
|
|
405
|
+
onChangeSelectedPath: '{selectedPath}',
|
|
406
|
+
onChangeRequestMethod: '{requestMethod}',
|
|
407
|
+
},
|
|
408
|
+
updateParamsFromUrl: function(url) {
|
|
409
|
+
if (!url) {
|
|
410
|
+
return;
|
|
411
|
+
}
|
|
412
|
+
let params;
|
|
413
|
+
try {
|
|
414
|
+
params = new URL(url).searchParams;
|
|
415
|
+
} catch (e) {
|
|
416
|
+
return;
|
|
417
|
+
}
|
|
418
|
+
if (!params) {
|
|
419
|
+
return;
|
|
420
|
+
}
|
|
421
|
+
const paramsForm = this.lookup('params-form');
|
|
422
|
+
if (paramsForm) {
|
|
423
|
+
for (const paramName of params.keys()) {
|
|
424
|
+
const formField = paramsForm.items.findBy((field) => field.getName() === paramName);
|
|
425
|
+
formField && formField.setValue(params.get(paramName));
|
|
426
|
+
}
|
|
427
|
+
}
|
|
428
|
+
},
|
|
429
|
+
onChangeSelectedPath: function() {
|
|
430
|
+
this.updateParams();
|
|
431
|
+
},
|
|
432
|
+
onChangeRequestMethod: function() {
|
|
433
|
+
this.updateParams();
|
|
434
|
+
this.updateParamsFromUrl(this.getViewModel().get('requestUrl'));
|
|
435
|
+
},
|
|
436
|
+
onBeforeLoadApi: function(store) {
|
|
437
|
+
this.loadMask = new Ext.LoadMask({
|
|
438
|
+
target: this.lookup('mask-target'),
|
|
439
|
+
msg: 'Загрузка описания API...',
|
|
440
|
+
});
|
|
441
|
+
this.loadMask.show();
|
|
442
|
+
},
|
|
443
|
+
getApiData: function() {
|
|
444
|
+
const json = this.getStore('api').getAt(0);
|
|
445
|
+
return json['data'];
|
|
446
|
+
},
|
|
447
|
+
onLoadApi: function(store, data) {
|
|
448
|
+
this.loadMask && this.loadMask.destroy();
|
|
449
|
+
const vm = this.getViewModel();
|
|
450
|
+
if (Array.isArray(data)) {
|
|
451
|
+
const json = data.pop();
|
|
452
|
+
if (json && json.data) {
|
|
453
|
+
vm.set('apiInfo', json.data.info);
|
|
454
|
+
vm.set('servers', json.data.servers);
|
|
455
|
+
const treeStore = this.getStore('tree');
|
|
456
|
+
const rootNode = Ext.create('Ext.data.TreeModel', {
|
|
457
|
+
expanded: true,
|
|
458
|
+
text:
|
|
459
|
+
json.data.info['title'] +
|
|
460
|
+
' ' +
|
|
461
|
+
json.data.info['version'],
|
|
462
|
+
});
|
|
463
|
+
treeStore.setRoot(rootNode);
|
|
464
|
+
|
|
465
|
+
if (typeof json.data['paths'] === 'object') {
|
|
466
|
+
const paths = Object.keys(json.data['paths']);
|
|
467
|
+
const groups = new Map();
|
|
468
|
+
paths.forEach((path) => {
|
|
469
|
+
const info = path.split('/').slice(1);
|
|
470
|
+
const groupName = info.shift();
|
|
471
|
+
const existingGroup = groups.get(groupName);
|
|
472
|
+
if (groupName) {
|
|
473
|
+
const action = info.shift();
|
|
474
|
+
if (!info.length) {
|
|
475
|
+
if (!existingGroup) {
|
|
476
|
+
groups.set(
|
|
477
|
+
groupName,
|
|
478
|
+
action ? [action] : []
|
|
479
|
+
);
|
|
480
|
+
} else {
|
|
481
|
+
groups.set(groupName, existingGroup.concat(action));
|
|
482
|
+
}
|
|
483
|
+
} else {
|
|
484
|
+
const groupExists = !!groups.get(groupName);
|
|
485
|
+
if (groupExists) {
|
|
486
|
+
groups.set([groupName, action].join('/'), info);
|
|
487
|
+
} else {
|
|
488
|
+
const finalAction = info.pop();
|
|
489
|
+
const complexGroupName = [groupName, action].concat(info).join('/');
|
|
490
|
+
const existingComplexGroup = groups.get(complexGroupName);
|
|
491
|
+
if (!existingComplexGroup) {
|
|
492
|
+
groups.set(complexGroupName, finalAction ? [finalAction] : []);
|
|
493
|
+
} else {
|
|
494
|
+
groups.set(complexGroupName, existingComplexGroup.concat(finalAction));
|
|
495
|
+
}
|
|
496
|
+
}
|
|
497
|
+
}
|
|
498
|
+
}
|
|
499
|
+
});
|
|
500
|
+
const topNodes = Array.from(groups.keys()).sort();
|
|
501
|
+
const methodTagStyle =
|
|
502
|
+
'color:#FFF; border-radius:3px; padding: 0 4px';
|
|
503
|
+
const methodColors = new Map([
|
|
504
|
+
['get', '#61affe'],
|
|
505
|
+
['post', '#49cc90'],
|
|
506
|
+
['put', '#fca130'],
|
|
507
|
+
['delete', '#f93e3e']
|
|
508
|
+
]);
|
|
509
|
+
topNodes.forEach((group) => {
|
|
510
|
+
const node = {text: group, expanded: true};
|
|
511
|
+
const actions = groups.get(group);
|
|
512
|
+
if (actions.length) {
|
|
513
|
+
node['children'] = [];
|
|
514
|
+
actions.sort().forEach((action) => {
|
|
515
|
+
const path = [group, action].join('/');
|
|
516
|
+
const displayPath = path;
|
|
517
|
+
const methods = json.data['paths']['/' + path];
|
|
518
|
+
if (typeof methods === 'object') {
|
|
519
|
+
action += Object.keys(methods)
|
|
520
|
+
.map((method) => {
|
|
521
|
+
const color =
|
|
522
|
+
methodColors.get(method) ||
|
|
523
|
+
'gray';
|
|
524
|
+
return (
|
|
525
|
+
` <span style='${methodTagStyle};background-color:${color}'>` +
|
|
526
|
+
method.toUpperCase() +
|
|
527
|
+
'</span>'
|
|
528
|
+
);
|
|
529
|
+
})
|
|
530
|
+
.join(' ');
|
|
531
|
+
}
|
|
532
|
+
node['children'].push({
|
|
533
|
+
text: action,
|
|
534
|
+
path: displayPath,
|
|
535
|
+
leaf: true,
|
|
536
|
+
});
|
|
537
|
+
});
|
|
538
|
+
} else {
|
|
539
|
+
node['leaf'] = true;
|
|
540
|
+
}
|
|
541
|
+
rootNode.appendChild(node);
|
|
542
|
+
});
|
|
543
|
+
const savedPath = vm.get('selectedPath');
|
|
544
|
+
if (savedPath) {
|
|
545
|
+
const selectedRecord = treeStore.findRecord('path', savedPath);
|
|
546
|
+
if (selectedRecord) {
|
|
547
|
+
const picker = this.lookup('picker');
|
|
548
|
+
picker && picker.fireEvent('select', picker, selectedRecord, undefined, true);
|
|
549
|
+
}
|
|
550
|
+
}
|
|
551
|
+
}
|
|
552
|
+
}
|
|
553
|
+
}
|
|
554
|
+
},
|
|
555
|
+
onPickerSelect: function(picker, record, _, isFromRemoteState = false) {
|
|
556
|
+
const isLeaf = record.get('leaf');
|
|
557
|
+
const value = record.get('path') || record.get(picker.displayField);
|
|
558
|
+
const vm = this.getViewModel();
|
|
559
|
+
if (isLeaf) {
|
|
560
|
+
picker.setValue(value);
|
|
561
|
+
picker.setRawValue(value);
|
|
562
|
+
if (!isFromRemoteState) {
|
|
563
|
+
const methodsStore = vm.getStore('methods');
|
|
564
|
+
let requestMethod = null;
|
|
565
|
+
if (methodsStore && methodsStore.collect('text').includes(vm.get('requestMethod'))) {
|
|
566
|
+
requestMethod = vm.get('requestMethod');
|
|
567
|
+
}
|
|
568
|
+
vm.set({
|
|
569
|
+
'requestMethod': requestMethod,
|
|
570
|
+
'parsedResponse': null,
|
|
571
|
+
});
|
|
572
|
+
}
|
|
573
|
+
vm.set('selectedPath', value);
|
|
574
|
+
this.updateMethods(isFromRemoteState);
|
|
575
|
+
this.updateParams(isFromRemoteState);
|
|
576
|
+
this.updateUrl(isFromRemoteState);
|
|
577
|
+
} else {
|
|
578
|
+
vm.set('selectedPath', null);
|
|
579
|
+
}
|
|
580
|
+
},
|
|
581
|
+
onPickerKeyPress: function(picker) {
|
|
582
|
+
const searchString = String(picker.getRawValue()).toLowerCase();
|
|
583
|
+
const treeStore = this.getStore('tree');
|
|
584
|
+
if (!searchString || !searchString.length) {
|
|
585
|
+
treeStore.getFilters().removeAll();
|
|
586
|
+
}
|
|
587
|
+
if (searchString.length >= 2) {
|
|
588
|
+
treeStore.filterBy((node) => {
|
|
589
|
+
if (node.isRoot()) {
|
|
590
|
+
return true;
|
|
591
|
+
}
|
|
592
|
+
if (!node.isLeaf()) {
|
|
593
|
+
const nodeText = String(node.get('text')).toLowerCase();
|
|
594
|
+
return nodeText.startsWith(searchString);
|
|
595
|
+
} else {
|
|
596
|
+
return !node.parentNode.isRoot();
|
|
597
|
+
}
|
|
598
|
+
});
|
|
599
|
+
picker.expand();
|
|
600
|
+
}
|
|
601
|
+
},
|
|
602
|
+
/* https://stackoverflow.com/a/22129960 */
|
|
603
|
+
resolvePath: function(path, obj = {}, separator = '/') {
|
|
604
|
+
const properties = Array.isArray(path) ? path : path.split(separator);
|
|
605
|
+
return properties.reduce((prev, curr) => prev && prev[curr], obj);
|
|
606
|
+
},
|
|
607
|
+
/* TODO use @resolvePath */
|
|
608
|
+
getPropsByRef: function(ref, type) {
|
|
609
|
+
const json = this.getStore('api').getAt(0);
|
|
610
|
+
const refName = ref.split('/').pop();
|
|
611
|
+
const schema = json['data']['components']['schemas'][refName];
|
|
612
|
+
if (schema && schema['properties']) {
|
|
613
|
+
const props = schema['properties'];
|
|
614
|
+
// TODO bubble types
|
|
615
|
+
return JSON.stringify(
|
|
616
|
+
type === 'array' ? [props] : props,
|
|
617
|
+
null,
|
|
618
|
+
4
|
|
619
|
+
);
|
|
620
|
+
}
|
|
621
|
+
return '';
|
|
622
|
+
},
|
|
623
|
+
onParamsFormValidityChange: function(form, isValid) {
|
|
624
|
+
this.getViewModel().set('isParamsFormValid', isValid);
|
|
625
|
+
},
|
|
626
|
+
updateMethods: function() {
|
|
627
|
+
const json = this.getStore('api').getAt(0);
|
|
628
|
+
const methodsStore = this.getStore('methods');
|
|
629
|
+
const vm = this.getViewModel();
|
|
630
|
+
if (json) {
|
|
631
|
+
const methods =
|
|
632
|
+
json['data'].paths['/' + vm.get('selectedPath')];
|
|
633
|
+
if (typeof methods === 'object') {
|
|
634
|
+
const methodNames = Object.keys(methods).map((m) => ({text: m.toUpperCase()}));
|
|
635
|
+
methodsStore.loadData(methodNames, false);
|
|
636
|
+
const currentMethod = vm.get('requestMethod');
|
|
637
|
+
let autoSelect;
|
|
638
|
+
if (methodsStore.getCount() === 1) {
|
|
639
|
+
autoSelect = methodsStore.getAt(0);
|
|
640
|
+
} else if (currentMethod) {
|
|
641
|
+
autoSelect = methodsStore.findRecord('text', currentMethod);
|
|
642
|
+
}
|
|
643
|
+
const picker = this.lookup('methodPicker');
|
|
644
|
+
picker && picker.setSelection(autoSelect);
|
|
645
|
+
}
|
|
646
|
+
}
|
|
647
|
+
},
|
|
648
|
+
updateUrl: function(isFromRemoteState = false) {
|
|
649
|
+
const formPanel = this.lookup('params-form');
|
|
650
|
+
const vm = this.getViewModel();
|
|
651
|
+
const formValues = isFromRemoteState === true ? vm.get('requestParams') || '' : formPanel.getValues(true, true);
|
|
652
|
+
const requestUrl = new URL(
|
|
653
|
+
String(vm.get('selectedPath')) + (formValues.length ? '?' + formValues : ''),
|
|
654
|
+
String(vm.get('activeServerUrl')) + '/'
|
|
655
|
+
);
|
|
656
|
+
vm.set({
|
|
657
|
+
parsedResponse: null,
|
|
658
|
+
requestUrl: requestUrl.toString(),
|
|
659
|
+
requestParams: requestUrl.searchParams.toString(),
|
|
660
|
+
});
|
|
661
|
+
},
|
|
662
|
+
updateParams: function(isFromRemoteState = false) {
|
|
663
|
+
const json = this.getStore('api').getAt(0);
|
|
664
|
+
const vm = this.getViewModel();
|
|
665
|
+
const method = String(vm.get('requestMethod')).toLowerCase();
|
|
666
|
+
const path = vm.get('selectedPath');
|
|
667
|
+
const form = this.lookup('params-form');
|
|
668
|
+
form.removeAll();
|
|
669
|
+
this.getResponsePreview().reset();
|
|
670
|
+
vm.set({
|
|
671
|
+
selectedOperationId: null,
|
|
672
|
+
selectedApiController: null,
|
|
673
|
+
});
|
|
674
|
+
if (json && path) {
|
|
675
|
+
const methodsConfig = json['data']['paths'][`/${path}`][method];
|
|
676
|
+
if (methodsConfig) {
|
|
677
|
+
const parameters = methodsConfig['parameters'];
|
|
678
|
+
const tags = methodsConfig['tags'];
|
|
679
|
+
vm.set(
|
|
680
|
+
{
|
|
681
|
+
selectedOperationId: methodsConfig['operationId'],
|
|
682
|
+
selectedApiController: tags.length ? tags[0] : null,
|
|
683
|
+
}
|
|
684
|
+
);
|
|
685
|
+
if (Array.isArray(parameters)) {
|
|
686
|
+
parameters.forEach((config) => {
|
|
687
|
+
const isRequired = config['required'] === true;
|
|
688
|
+
let xtype;
|
|
689
|
+
let value = null;
|
|
690
|
+
|
|
691
|
+
switch (config['schema']['type']) {
|
|
692
|
+
case 'integer':
|
|
693
|
+
xtype = 'numberfield';
|
|
694
|
+
break;
|
|
695
|
+
case 'boolean':
|
|
696
|
+
xtype = 'checkbox';
|
|
697
|
+
break;
|
|
698
|
+
case 'string':
|
|
699
|
+
xtype = 'textfield';
|
|
700
|
+
break;
|
|
701
|
+
case 'array':
|
|
702
|
+
default:
|
|
703
|
+
xtype = 'textarea';
|
|
704
|
+
}
|
|
705
|
+
|
|
706
|
+
if (!isFromRemoteState) {
|
|
707
|
+
const refHolder = config['schema']['$ref'] ?
|
|
708
|
+
config['schema'] :
|
|
709
|
+
config['schema']['items'];
|
|
710
|
+
if (refHolder) {
|
|
711
|
+
value = this.getPropsByRef(
|
|
712
|
+
refHolder['$ref'],
|
|
713
|
+
config['schema']['type']
|
|
714
|
+
);
|
|
715
|
+
}
|
|
716
|
+
} else {
|
|
717
|
+
const requestQueryString = String(vm.get('requestParams'));
|
|
718
|
+
if (requestQueryString.length) {
|
|
719
|
+
const requestSearchParams = new URLSearchParams(requestQueryString);
|
|
720
|
+
const requestParams = Object.fromEntries(requestSearchParams.entries());
|
|
721
|
+
value = requestParams[config['name']];
|
|
722
|
+
}
|
|
723
|
+
}
|
|
724
|
+
|
|
725
|
+
const item = {
|
|
726
|
+
xtype,
|
|
727
|
+
fieldLabel:
|
|
728
|
+
(config['schema']['type'] || 'object') +
|
|
729
|
+
': ' +
|
|
730
|
+
config['name'],
|
|
731
|
+
allowBlank: !isRequired,
|
|
732
|
+
name: config['name'],
|
|
733
|
+
value,
|
|
734
|
+
};
|
|
735
|
+
if (isRequired) {
|
|
736
|
+
item['labelStyle'] = 'font-weight:bold';
|
|
737
|
+
}
|
|
738
|
+
if (xtype === 'textarea') {
|
|
739
|
+
item['grow'] = true;
|
|
740
|
+
}
|
|
741
|
+
form.add(item);
|
|
742
|
+
});
|
|
743
|
+
} else {
|
|
744
|
+
form.add({
|
|
745
|
+
xtype: 'displayfield',
|
|
746
|
+
bind: {
|
|
747
|
+
value: '{text.noParams}',
|
|
748
|
+
},
|
|
749
|
+
});
|
|
750
|
+
}
|
|
751
|
+
this.getResponsePreview().update(methodsConfig['responses'], json);
|
|
752
|
+
form.isValid();
|
|
753
|
+
}
|
|
754
|
+
}
|
|
755
|
+
},
|
|
756
|
+
sendRequest: async function() {
|
|
757
|
+
const vm = this.getViewModel();
|
|
758
|
+
Ext.Ajax.request({
|
|
759
|
+
url: String(vm.get('requestUrl')),
|
|
760
|
+
method: vm.get('requestMethod'),
|
|
761
|
+
success: (response) => {
|
|
762
|
+
this.processResponse(response);
|
|
763
|
+
},
|
|
764
|
+
failure: (response) => {
|
|
765
|
+
console.debug('server-side failure with status code ' + response.status);
|
|
766
|
+
vm.set('parsedResponse', null);
|
|
767
|
+
},
|
|
768
|
+
});
|
|
769
|
+
},
|
|
770
|
+
processResponse: function(response) {
|
|
771
|
+
const json = JSON5.parse(response.responseText);
|
|
772
|
+
console.debug(json);
|
|
773
|
+
this.getViewModel().set('parsedResponse', JSON.stringify(json, null, 4));
|
|
774
|
+
},
|
|
775
|
+
resolveNodeType: function(config, rootNode) {
|
|
776
|
+
if (typeof config !== 'object') {
|
|
777
|
+
return;
|
|
778
|
+
}
|
|
779
|
+
for (const key of Object.keys(config)) {
|
|
780
|
+
if (key === 'type') {
|
|
781
|
+
continue;
|
|
782
|
+
}
|
|
783
|
+
const childNode = Ext.create('Ext.data.TreeModel', {
|
|
784
|
+
leaf: true,
|
|
785
|
+
});
|
|
786
|
+
const value = config[key];
|
|
787
|
+
if (value['type']) {
|
|
788
|
+
childNode.set('text', `${key}: ${value['type']}`);
|
|
789
|
+
if (value['type'] === 'object') {
|
|
790
|
+
childNode.set('leaf', false);
|
|
791
|
+
childNode.set('expanded', true);
|
|
792
|
+
this.resolveNodeType(value, childNode);
|
|
793
|
+
}
|
|
794
|
+
} else if (value['$ref'] && String(value['$ref']).startsWith('#/')) {
|
|
795
|
+
const ref = this.resolvePath(String(value['$ref']).slice(2), this.getApiData());
|
|
796
|
+
if (ref) {
|
|
797
|
+
childNode.set('text', `${key}: object`);
|
|
798
|
+
childNode.set('expanded', true);
|
|
799
|
+
this.resolveNodeType(ref['properties'], childNode);
|
|
800
|
+
}
|
|
801
|
+
}
|
|
802
|
+
rootNode.appendChild(childNode);
|
|
803
|
+
}
|
|
804
|
+
},
|
|
805
|
+
getResponsePreview: function() {
|
|
806
|
+
const vm = this.getViewModel();
|
|
807
|
+
return {
|
|
808
|
+
reset: () => {
|
|
809
|
+
vm.set({responsePreview: '', responsePreviewLabel: ''});
|
|
810
|
+
},
|
|
811
|
+
update: (responses, json) => {
|
|
812
|
+
if (typeof responses['200'] !== 'undefined') {
|
|
813
|
+
const resp200 = responses['200']['content'];
|
|
814
|
+
if (typeof resp200 === 'object') {
|
|
815
|
+
const schemas = Object.values(resp200).shift();
|
|
816
|
+
if (schemas['schema']) {
|
|
817
|
+
const ref = String(schemas['schema']['$ref']);
|
|
818
|
+
if (ref.startsWith('#/')) {
|
|
819
|
+
const config = this.resolvePath(ref.slice(2), json['data']);
|
|
820
|
+
if (typeof config['properties'] === 'object') {
|
|
821
|
+
vm.set('responsePreview', JSON.stringify(config['properties'], (key, value) => {
|
|
822
|
+
if (value['$ref'] && String(value['$ref']).startsWith('#')) {
|
|
823
|
+
const refObj = this.resolvePath(String(value['$ref']).slice(2), json['data']);
|
|
824
|
+
if (refObj && refObj['type'] === 'object' && typeof refObj['properties'] === 'object') {
|
|
825
|
+
value = refObj['properties'];
|
|
826
|
+
}
|
|
827
|
+
}
|
|
828
|
+
return value;
|
|
829
|
+
}, 4));
|
|
830
|
+
}
|
|
831
|
+
const responseTreeStore = this.getStore('responseTree');
|
|
832
|
+
const rootNode = Ext.create('Ext.data.TreeModel', {
|
|
833
|
+
expanded: true,
|
|
834
|
+
text: 'object:',
|
|
835
|
+
});
|
|
836
|
+
if (typeof config['xml'] === 'object') {
|
|
837
|
+
vm.set('responsePreviewLabel', String(config['xml']['name']));
|
|
838
|
+
rootNode.set('text', String(config['xml']['name']));
|
|
839
|
+
}
|
|
840
|
+
this.resolveNodeType(config['properties'], rootNode);
|
|
841
|
+
responseTreeStore.setRoot(rootNode);
|
|
842
|
+
}
|
|
843
|
+
}
|
|
844
|
+
}
|
|
845
|
+
}
|
|
846
|
+
},
|
|
847
|
+
};
|
|
848
|
+
},
|
|
849
|
+
},
|
|
850
|
+
});
|