@oneuptime/common 12.0.9 → 12.0.11
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/Models/DatabaseModels/NetworkDevice.ts +44 -0
- package/Models/DatabaseModels/NetworkDeviceLink.ts +116 -0
- package/Models/DatabaseModels/RunnerJob.ts +17 -2
- package/Server/API/LlmProviderAPI.ts +8 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1787400000000-AddDeviceRoleAndDeclaredLinkParent.ts +52 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/Index.ts +2 -0
- package/Server/Services/NetworkDeviceLabelRuleEngineService.ts +240 -0
- package/Server/Services/NetworkDeviceLinkService.ts +338 -2
- package/Server/Services/NetworkDeviceService.ts +265 -12
- package/Server/Services/RunnerJobService.ts +24 -1
- package/Server/Types/Billing/MeteredPlan/AllMeteredPlans.ts +19 -5
- package/Server/Types/Database/JSONColumnQuery.ts +42 -4
- package/Server/Utils/LLM/LLMService.ts +108 -19
- package/Server/Utils/Monitor/MonitorAlert.ts +22 -115
- package/Server/Utils/Monitor/MonitorIncident.ts +7 -337
- package/Server/Utils/Monitor/MonitorMaintenanceSuppression.ts +27 -2
- package/Server/Utils/Monitor/SeriesResourceLabels.ts +32 -0
- package/Server/Utils/Monitor/SeriesResourceLinker.ts +469 -0
- package/Server/Utils/SSRFProtection.ts +5 -4
- package/Server/Utils/Telemetry/InventoryEntityRegistry.ts +186 -38
- package/Tests/App/AdminDashboard/AdminUsersBulkAddToProject.test.tsx +955 -0
- package/Tests/App/AdminDashboard/BulkAddUsersToProject.test.ts +778 -0
- package/Tests/App/AdminDashboard/BulkAddUsersToProjectModal.test.tsx +1051 -0
- package/Tests/App/Dashboard/AdminNotificationRulesPage.test.tsx +420 -112
- package/Tests/App/Dashboard/OnCallReadinessSurfaces.test.tsx +81 -6
- package/Tests/App/Dashboard/PayAsYouGoConsentGate.test.tsx +543 -0
- package/Tests/App/Dashboard/PayAsYouGoFreePlan.test.ts +125 -0
- package/Tests/App/Dashboard/PayAsYouGoNotices.test.tsx +612 -0
- package/Tests/App/Dashboard/SloWidgetChartRendering.test.tsx +536 -0
- package/Tests/App/Dashboard/UserElementEmail.test.tsx +447 -0
- package/Tests/App/Dashboard/UserEmailCallSites.test.tsx +284 -0
- package/Tests/Models/AnalyticsModels/CommonModel.test.ts +312 -0
- package/Tests/Server/Infrastructure/Postgres/DeviceRoleAndDeclaredLinkParentMigration.test.ts +250 -0
- package/Tests/Server/Infrastructure/Postgres/EpisodeMemberNotifyIndexesMigration.test.ts +46 -18
- package/Tests/Server/Services/NetworkDeviceLabelRuleRun.test.ts +618 -0
- package/Tests/Server/Services/NetworkDeviceLinkParentValidation.test.ts +1043 -0
- package/Tests/Server/Services/NetworkSiteAssignmentRuleRun.test.ts +706 -0
- package/Tests/Server/Services/RunnerJobEnqueue.test.ts +412 -0
- package/Tests/Server/Types/Billing/PayAsYouGoMeteredPricing.test.ts +125 -0
- package/Tests/Server/Types/Database/JSONColumnQuery.test.ts +508 -0
- package/Tests/Server/Utils/AI/LLMServiceRequestPolicy.test.ts +2 -2
- package/Tests/Server/Utils/AI/LLMServiceRetryPolicy.test.ts +450 -0
- package/Tests/Server/Utils/Monitor/MonitorAlertResourceLinking.test.ts +556 -0
- package/Tests/Server/Utils/Monitor/MonitorIncidentResourceLinking.test.ts +547 -0
- package/Tests/Server/Utils/Monitor/MonitorMaintenanceSuppression.test.ts +30 -0
- package/Tests/Server/Utils/Monitor/SeriesResourceLinker.test.ts +699 -0
- package/Tests/Server/Utils/SeriesResourceLabels.test.ts +55 -0
- package/Tests/Server/Utils/Telemetry/InventoryEntityRegistry.test.ts +668 -0
- package/Tests/Types/API/URLMalformedTolerance.test.ts +301 -0
- package/Tests/Types/API/URLTelScheme.test.ts +261 -0
- package/Tests/Types/API/URLUnsupportedScheme.test.ts +148 -0
- package/Tests/Types/Billing/PayAsYouGoPricing.test.ts +64 -0
- package/Tests/Types/CustomField/CustomFieldTypeCorrespondence.test.ts +107 -0
- package/Tests/Types/Monitor/MonitorType.test.ts +62 -0
- package/Tests/Types/NetworkAutomation/RuleRunResult.test.ts +184 -0
- package/Tests/Types/Runbook/RunbookStepType.test.ts +124 -0
- package/Tests/Types/Workflow/BaseModelComponents.test.ts +17 -0
- package/Tests/UI/Components/Button.test.tsx +279 -0
- package/Tests/UI/Components/Charts/ChartXAxisDataKey.test.tsx +256 -0
- package/Tests/UI/Components/Charts/DataPointUtil.test.ts +323 -0
- package/Tests/UI/Components/DictionaryValuePlaceholderAndSuggestions.test.tsx +595 -0
- package/Tests/UI/Components/Icon.test.tsx +57 -0
- package/Tests/UI/Components/List.test.tsx +20 -3
- package/Tests/UI/Components/LogsSavedViewsDropdown.test.tsx +304 -0
- package/Tests/UI/Components/LogsViewerClearSavedView.test.tsx +179 -0
- package/Tests/UI/Components/ModelTable/CustomFieldColumns.test.tsx +349 -1
- package/Tests/UI/Components/Pagination.test.tsx +721 -146
- package/Tests/UI/Components/PaginationIntegration.test.tsx +386 -0
- package/Tests/UI/Components/PaginationUtil.test.ts +417 -0
- package/Tests/UI/Components/TelemetrySavedViewsDropdown.test.tsx +343 -0
- package/Tests/UI/Components/Workflow/ColumnEditor/ColumnControl.test.ts +289 -0
- package/Tests/UI/Components/Workflow/ColumnEditor/ColumnOperators.test.ts +271 -0
- package/Tests/UI/Components/Workflow/ColumnEditor/ColumnRow.test.ts +119 -0
- package/Tests/UI/Components/Workflow/ColumnEditor/ColumnRowSerialization.test.ts +968 -0
- package/Tests/UI/Components/Workflow/ModelColumnEditor.render.test.tsx +766 -0
- package/Tests/UI/Utils/RunNetworkRule.test.ts +320 -0
- package/Tests/Utils/APIRetryPolicy.test.ts +823 -0
- package/Tests/Utils/Monitor/NetworkDeviceRoleUtil.test.ts +502 -0
- package/Tests/Utils/Monitor/NetworkTopologyDeclaredHierarchy.test.ts +759 -0
- package/Tests/Utils/NetworkAutomation/RuleRunSummary.test.ts +286 -0
- package/Tests/Utils/Schema/BaseSchema.test.ts +651 -0
- package/Types/API/Protocol.ts +9 -0
- package/Types/API/URL.ts +286 -20
- package/Types/Billing/PayAsYouGoPricing.ts +47 -0
- package/Types/CustomField/CustomFieldType.ts +28 -0
- package/Types/Monitor/MonitorType.ts +11 -0
- package/Types/Monitor/SnmpMonitor/NetworkTopology.ts +13 -0
- package/Types/NetworkAutomation/RuleRunResult.ts +121 -0
- package/Types/Runbook/RunbookStepType.ts +23 -0
- package/UI/Components/AutocompleteTextInput/AutocompleteTextInput.tsx +7 -0
- package/UI/Components/Button/Button.tsx +14 -22
- package/UI/Components/Charts/Area/AreaChart.tsx +4 -2
- package/UI/Components/Charts/Bar/BarChart.tsx +4 -2
- package/UI/Components/Charts/ChartLibrary/Types/ChartDataPoint.ts +13 -0
- package/UI/Components/Charts/Line/LineChart.tsx +4 -2
- package/UI/Components/Charts/Types/XAxis/XAxis.ts +6 -0
- package/UI/Components/Charts/Utils/DataPoint.ts +15 -12
- package/UI/Components/Dictionary/Dictionary.tsx +4 -39
- package/UI/Components/Icon/Icon.tsx +1 -1
- package/UI/Components/LogsViewer/LogsViewer.tsx +5 -1
- package/UI/Components/LogsViewer/components/LogsFacetSidebar.tsx +8 -0
- package/UI/Components/LogsViewer/components/LogsPagination.tsx +29 -91
- package/UI/Components/LogsViewer/components/LogsViewerToolbar.tsx +2 -0
- package/UI/Components/LogsViewer/components/SavedViewsDropdown.tsx +66 -1
- package/UI/Components/ModelTable/CustomFieldColumns.tsx +55 -0
- package/UI/Components/Pagination/Pagination.tsx +373 -328
- package/UI/Components/Pagination/PaginationUtil.ts +263 -0
- package/UI/Components/Pagination/Screenshots/README.md +15 -0
- package/UI/Components/Pagination/Screenshots/pagination-before-after.png +0 -0
- package/UI/Components/Pagination/Screenshots/pagination-go-to-page-modal.png +0 -0
- package/UI/Components/Pagination/Screenshots/pagination-long-list.png +0 -0
- package/UI/Components/Pagination/Screenshots/pagination-mobile.png +0 -0
- package/UI/Components/Pagination/Screenshots/pagination-telemetry.png +0 -0
- package/UI/Components/TelemetryViewer/components/SavedViewsDropdown.tsx +66 -1
- package/UI/Components/TelemetryViewer/components/TelemetryPagination.tsx +38 -92
- package/UI/Components/TextArea/TextArea.tsx +3 -0
- package/UI/Components/Workflow/ArgumentsForm.tsx +18 -1
- package/UI/Components/Workflow/ColumnEditor/AddColumnDropdown.tsx +177 -0
- package/UI/Components/Workflow/ColumnEditor/ColumnConditionRow.tsx +243 -0
- package/UI/Components/Workflow/ColumnEditor/ColumnControl.ts +255 -0
- package/UI/Components/Workflow/ColumnEditor/ColumnFieldRow.tsx +178 -0
- package/UI/Components/Workflow/ColumnEditor/ColumnOperators.ts +206 -0
- package/UI/Components/Workflow/ColumnEditor/ColumnRow.ts +157 -0
- package/UI/Components/Workflow/ColumnEditor/ColumnRowSerialization.ts +517 -0
- package/UI/Components/Workflow/ColumnEditor/ColumnValueInput.tsx +482 -0
- package/UI/Components/Workflow/ColumnEditor/ModelQueryBuilder.tsx +131 -0
- package/UI/Components/Workflow/ColumnEditor/ModelRecordForm.tsx +163 -0
- package/UI/Components/Workflow/ModelColumnEditor.tsx +284 -100
- package/UI/Utils/NetworkAutomation/RunNetworkRule.ts +122 -0
- package/Utils/API.ts +243 -36
- package/Utils/Monitor/NetworkDeviceRoleUtil.ts +45 -0
- package/Utils/Monitor/NetworkTopologyUtil.ts +42 -2
- package/Utils/NetworkAutomation/RuleRunSummary.ts +147 -0
- package/build/dist/Models/DatabaseModels/NetworkDevice.js +45 -0
- package/build/dist/Models/DatabaseModels/NetworkDevice.js.map +1 -1
- package/build/dist/Models/DatabaseModels/NetworkDeviceLink.js +115 -0
- package/build/dist/Models/DatabaseModels/NetworkDeviceLink.js.map +1 -1
- package/build/dist/Models/DatabaseModels/RunnerJob.js +17 -2
- package/build/dist/Models/DatabaseModels/RunnerJob.js.map +1 -1
- package/build/dist/Server/API/LlmProviderAPI.js +9 -1
- package/build/dist/Server/API/LlmProviderAPI.js.map +1 -1
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1787400000000-AddDeviceRoleAndDeclaredLinkParent.js +33 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1787400000000-AddDeviceRoleAndDeclaredLinkParent.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/Index.js +2 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/Index.js.map +1 -1
- package/build/dist/Server/Services/NetworkDeviceLabelRuleEngineService.js +202 -0
- package/build/dist/Server/Services/NetworkDeviceLabelRuleEngineService.js.map +1 -1
- package/build/dist/Server/Services/NetworkDeviceLinkService.js +253 -1
- package/build/dist/Server/Services/NetworkDeviceLinkService.js.map +1 -1
- package/build/dist/Server/Services/NetworkDeviceService.js +223 -12
- package/build/dist/Server/Services/NetworkDeviceService.js.map +1 -1
- package/build/dist/Server/Services/RunnerJobService.js +20 -2
- package/build/dist/Server/Services/RunnerJobService.js.map +1 -1
- package/build/dist/Server/Types/Billing/MeteredPlan/AllMeteredPlans.js +12 -5
- package/build/dist/Server/Types/Billing/MeteredPlan/AllMeteredPlans.js.map +1 -1
- package/build/dist/Server/Types/Database/JSONColumnQuery.js +40 -4
- package/build/dist/Server/Types/Database/JSONColumnQuery.js.map +1 -1
- package/build/dist/Server/Utils/LLM/LLMService.js +78 -22
- package/build/dist/Server/Utils/LLM/LLMService.js.map +1 -1
- package/build/dist/Server/Utils/Monitor/MonitorAlert.js +22 -98
- package/build/dist/Server/Utils/Monitor/MonitorAlert.js.map +1 -1
- package/build/dist/Server/Utils/Monitor/MonitorIncident.js +7 -254
- package/build/dist/Server/Utils/Monitor/MonitorIncident.js.map +1 -1
- package/build/dist/Server/Utils/Monitor/MonitorMaintenanceSuppression.js +14 -2
- package/build/dist/Server/Utils/Monitor/MonitorMaintenanceSuppression.js.map +1 -1
- package/build/dist/Server/Utils/Monitor/SeriesResourceLabels.js +27 -0
- package/build/dist/Server/Utils/Monitor/SeriesResourceLabels.js.map +1 -1
- package/build/dist/Server/Utils/Monitor/SeriesResourceLinker.js +285 -0
- package/build/dist/Server/Utils/Monitor/SeriesResourceLinker.js.map +1 -0
- package/build/dist/Server/Utils/SSRFProtection.js +5 -4
- package/build/dist/Server/Utils/SSRFProtection.js.map +1 -1
- package/build/dist/Server/Utils/Telemetry/InventoryEntityRegistry.js +128 -35
- package/build/dist/Server/Utils/Telemetry/InventoryEntityRegistry.js.map +1 -1
- package/build/dist/Types/API/Protocol.js +9 -0
- package/build/dist/Types/API/Protocol.js.map +1 -1
- package/build/dist/Types/API/URL.js +241 -18
- package/build/dist/Types/API/URL.js.map +1 -1
- package/build/dist/Types/Billing/PayAsYouGoPricing.js +41 -0
- package/build/dist/Types/Billing/PayAsYouGoPricing.js.map +1 -0
- package/build/dist/Types/CustomField/CustomFieldType.js +26 -0
- package/build/dist/Types/CustomField/CustomFieldType.js.map +1 -1
- package/build/dist/Types/Monitor/MonitorType.js +10 -0
- package/build/dist/Types/Monitor/MonitorType.js.map +1 -1
- package/build/dist/Types/NetworkAutomation/RuleRunResult.js +39 -0
- package/build/dist/Types/NetworkAutomation/RuleRunResult.js.map +1 -0
- package/build/dist/Types/Runbook/RunbookStepType.js +21 -0
- package/build/dist/Types/Runbook/RunbookStepType.js.map +1 -1
- package/build/dist/UI/Components/AutocompleteTextInput/AutocompleteTextInput.js +1 -1
- package/build/dist/UI/Components/AutocompleteTextInput/AutocompleteTextInput.js.map +1 -1
- package/build/dist/UI/Components/Button/Button.js +10 -16
- package/build/dist/UI/Components/Button/Button.js.map +1 -1
- package/build/dist/UI/Components/Charts/Area/AreaChart.js +2 -1
- package/build/dist/UI/Components/Charts/Area/AreaChart.js.map +1 -1
- package/build/dist/UI/Components/Charts/Bar/BarChart.js +2 -1
- package/build/dist/UI/Components/Charts/Bar/BarChart.js.map +1 -1
- package/build/dist/UI/Components/Charts/ChartLibrary/Types/ChartDataPoint.js +12 -0
- package/build/dist/UI/Components/Charts/ChartLibrary/Types/ChartDataPoint.js.map +1 -1
- package/build/dist/UI/Components/Charts/Line/LineChart.js +2 -1
- package/build/dist/UI/Components/Charts/Line/LineChart.js.map +1 -1
- package/build/dist/UI/Components/Charts/Utils/DataPoint.js +17 -10
- package/build/dist/UI/Components/Charts/Utils/DataPoint.js.map +1 -1
- package/build/dist/UI/Components/Dictionary/Dictionary.js +4 -18
- package/build/dist/UI/Components/Dictionary/Dictionary.js.map +1 -1
- package/build/dist/UI/Components/Icon/Icon.js +1 -1
- package/build/dist/UI/Components/Icon/Icon.js.map +1 -1
- package/build/dist/UI/Components/LogsViewer/LogsViewer.js +3 -3
- package/build/dist/UI/Components/LogsViewer/LogsViewer.js.map +1 -1
- package/build/dist/UI/Components/LogsViewer/components/LogsFacetSidebar.js +5 -1
- package/build/dist/UI/Components/LogsViewer/components/LogsFacetSidebar.js.map +1 -1
- package/build/dist/UI/Components/LogsViewer/components/LogsPagination.js +14 -44
- package/build/dist/UI/Components/LogsViewer/components/LogsPagination.js.map +1 -1
- package/build/dist/UI/Components/LogsViewer/components/LogsViewerToolbar.js +1 -1
- package/build/dist/UI/Components/LogsViewer/components/LogsViewerToolbar.js.map +1 -1
- package/build/dist/UI/Components/LogsViewer/components/SavedViewsDropdown.js +20 -2
- package/build/dist/UI/Components/LogsViewer/components/SavedViewsDropdown.js.map +1 -1
- package/build/dist/UI/Components/ModelTable/CustomFieldColumns.js +42 -0
- package/build/dist/UI/Components/ModelTable/CustomFieldColumns.js.map +1 -1
- package/build/dist/UI/Components/Pagination/Pagination.js +174 -199
- package/build/dist/UI/Components/Pagination/Pagination.js.map +1 -1
- package/build/dist/UI/Components/Pagination/PaginationUtil.js +160 -0
- package/build/dist/UI/Components/Pagination/PaginationUtil.js.map +1 -0
- package/build/dist/UI/Components/TelemetryViewer/components/SavedViewsDropdown.js +20 -2
- package/build/dist/UI/Components/TelemetryViewer/components/SavedViewsDropdown.js.map +1 -1
- package/build/dist/UI/Components/TelemetryViewer/components/TelemetryPagination.js +23 -47
- package/build/dist/UI/Components/TelemetryViewer/components/TelemetryPagination.js.map +1 -1
- package/build/dist/UI/Components/TextArea/TextArea.js +1 -1
- package/build/dist/UI/Components/TextArea/TextArea.js.map +1 -1
- package/build/dist/UI/Components/Workflow/ArgumentsForm.js +14 -2
- package/build/dist/UI/Components/Workflow/ArgumentsForm.js.map +1 -1
- package/build/dist/UI/Components/Workflow/ColumnEditor/AddColumnDropdown.js +86 -0
- package/build/dist/UI/Components/Workflow/ColumnEditor/AddColumnDropdown.js.map +1 -0
- package/build/dist/UI/Components/Workflow/ColumnEditor/ColumnConditionRow.js +119 -0
- package/build/dist/UI/Components/Workflow/ColumnEditor/ColumnConditionRow.js.map +1 -0
- package/build/dist/UI/Components/Workflow/ColumnEditor/ColumnControl.js +206 -0
- package/build/dist/UI/Components/Workflow/ColumnEditor/ColumnControl.js.map +1 -0
- package/build/dist/UI/Components/Workflow/ColumnEditor/ColumnFieldRow.js +57 -0
- package/build/dist/UI/Components/Workflow/ColumnEditor/ColumnFieldRow.js.map +1 -0
- package/build/dist/UI/Components/Workflow/ColumnEditor/ColumnOperators.js +150 -0
- package/build/dist/UI/Components/Workflow/ColumnEditor/ColumnOperators.js.map +1 -0
- package/build/dist/UI/Components/Workflow/ColumnEditor/ColumnRow.js +67 -0
- package/build/dist/UI/Components/Workflow/ColumnEditor/ColumnRow.js.map +1 -0
- package/build/dist/UI/Components/Workflow/ColumnEditor/ColumnRowSerialization.js +309 -0
- package/build/dist/UI/Components/Workflow/ColumnEditor/ColumnRowSerialization.js.map +1 -0
- package/build/dist/UI/Components/Workflow/ColumnEditor/ColumnValueInput.js +204 -0
- package/build/dist/UI/Components/Workflow/ColumnEditor/ColumnValueInput.js.map +1 -0
- package/build/dist/UI/Components/Workflow/ColumnEditor/ModelQueryBuilder.js +66 -0
- package/build/dist/UI/Components/Workflow/ColumnEditor/ModelQueryBuilder.js.map +1 -0
- package/build/dist/UI/Components/Workflow/ColumnEditor/ModelRecordForm.js +83 -0
- package/build/dist/UI/Components/Workflow/ColumnEditor/ModelRecordForm.js.map +1 -0
- package/build/dist/UI/Components/Workflow/ModelColumnEditor.js +187 -68
- package/build/dist/UI/Components/Workflow/ModelColumnEditor.js.map +1 -1
- package/build/dist/UI/Utils/NetworkAutomation/RunNetworkRule.js +75 -0
- package/build/dist/UI/Utils/NetworkAutomation/RunNetworkRule.js.map +1 -0
- package/build/dist/Utils/API.js +175 -34
- package/build/dist/Utils/API.js.map +1 -1
- package/build/dist/Utils/Monitor/NetworkDeviceRoleUtil.js +37 -0
- package/build/dist/Utils/Monitor/NetworkDeviceRoleUtil.js.map +1 -1
- package/build/dist/Utils/Monitor/NetworkTopologyUtil.js +25 -3
- package/build/dist/Utils/Monitor/NetworkTopologyUtil.js.map +1 -1
- package/build/dist/Utils/NetworkAutomation/RuleRunSummary.js +78 -0
- package/build/dist/Utils/NetworkAutomation/RuleRunSummary.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* One value cell.
|
|
3
|
+
*
|
|
4
|
+
* The control comes from the column's type in the model schema, so nobody is
|
|
5
|
+
* asked whether the thing they are typing is Text, Number or Boolean - the
|
|
6
|
+
* model already said. What is left for the builder to choose is the one thing
|
|
7
|
+
* the schema genuinely cannot know: whether this value is typed in, or read
|
|
8
|
+
* from an earlier step at run time.
|
|
9
|
+
*/
|
|
10
|
+
import IconProp from "../../../../Types/Icon/IconProp";
|
|
11
|
+
import AutocompleteTextInput from "../../AutocompleteTextInput/AutocompleteTextInput";
|
|
12
|
+
import ColorPicker from "../../Forms/Fields/ColorPicker";
|
|
13
|
+
import Icon from "../../Icon/Icon";
|
|
14
|
+
import Input, { InputType } from "../../Input/Input";
|
|
15
|
+
import TextArea from "../../TextArea/TextArea";
|
|
16
|
+
import { ColumnValueMode, ModelColumnControl } from "./ColumnRow";
|
|
17
|
+
import { containsTemplateExpression } from "./ColumnRowSerialization";
|
|
18
|
+
import React from "react";
|
|
19
|
+
const INPUT_WRAPPER_CLASS = "relative w-full";
|
|
20
|
+
const MONO_INPUT_CLASS = "block w-full rounded-md border-0 bg-transparent py-1 pl-0 pr-0 font-mono text-xs text-indigo-900 placeholder-indigo-300 focus:outline-none focus:ring-0";
|
|
21
|
+
const ColumnValueInput = (props) => {
|
|
22
|
+
var _a, _b;
|
|
23
|
+
const isReference = props.valueMode === ColumnValueMode.Reference;
|
|
24
|
+
/*
|
|
25
|
+
* Typing "{{" anywhere in a text control means the builder is reaching for
|
|
26
|
+
* another step's output, so the cell becomes a reference there and then and
|
|
27
|
+
* keeps what has been typed. Without this the autocomplete would never open
|
|
28
|
+
* unless the reference button had been found first.
|
|
29
|
+
*/
|
|
30
|
+
const setTextAndDetectReference = (value) => {
|
|
31
|
+
if (!isReference && value.includes("{{")) {
|
|
32
|
+
props.onChange({ text: value, valueMode: ColumnValueMode.Reference });
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
props.onChange({ text: value });
|
|
36
|
+
};
|
|
37
|
+
/*
|
|
38
|
+
* Spelled "{ }" rather than drawn as an icon. The shared variable glyph is a
|
|
39
|
+
* dashed square that reads as a placeholder or a spinner, and this button has
|
|
40
|
+
* to say what it does at a glance - it is the only route from a typed value to
|
|
41
|
+
* an earlier step's output, which is how most of these payloads are built.
|
|
42
|
+
*/
|
|
43
|
+
const referenceButton = (React.createElement("button", { type: "button", "aria-pressed": isReference, title: isReference
|
|
44
|
+
? "Type a value instead"
|
|
45
|
+
: "Use a value from an earlier step", "aria-label": isReference
|
|
46
|
+
? "Type a value instead"
|
|
47
|
+
: "Use a value from an earlier step", "data-testid": `${props.dataTestId || "model-column"}-reference-toggle`, className: `shrink-0 rounded-md border px-1.5 py-1 font-mono text-[11px] leading-none transition-colors focus:outline-none focus:ring-1 focus:ring-indigo-500 ${isReference
|
|
48
|
+
? "border-indigo-200 bg-white text-indigo-500 hover:bg-indigo-50"
|
|
49
|
+
: "border-transparent text-gray-400 hover:border-gray-200 hover:bg-gray-50 hover:text-gray-600"}`, onClick: () => {
|
|
50
|
+
props.onChange({
|
|
51
|
+
valueMode: isReference
|
|
52
|
+
? ColumnValueMode.Literal
|
|
53
|
+
: ColumnValueMode.Reference,
|
|
54
|
+
});
|
|
55
|
+
} }, isReference ? "abc" : "{ }"));
|
|
56
|
+
// An operator like "is not set" takes no value at all.
|
|
57
|
+
if ((_a = props.operatorOption) === null || _a === void 0 ? void 0 : _a.hidesValueInput) {
|
|
58
|
+
return (React.createElement("div", { className: "flex h-9 items-center rounded-md border border-dashed border-gray-200 px-3 text-xs text-gray-400" }, "No value needed"));
|
|
59
|
+
}
|
|
60
|
+
if ((_b = props.operatorOption) === null || _b === void 0 ? void 0 : _b.expectsMultiValue) {
|
|
61
|
+
return (React.createElement(MultiValueInput, { values: props.values, placeholder: props.placeholder, ariaLabelledby: props.ariaLabelledby, dataTestId: props.dataTestId, onChange: (values) => {
|
|
62
|
+
props.onChange({ values: values });
|
|
63
|
+
} }));
|
|
64
|
+
}
|
|
65
|
+
if (isReference) {
|
|
66
|
+
return (React.createElement("div", { className: "flex w-full items-center gap-1.5 rounded-md border border-indigo-200 bg-indigo-50/40 px-2 py-1" },
|
|
67
|
+
React.createElement("span", { className: "shrink-0 font-mono text-[11px] text-indigo-400" }, "{ }"),
|
|
68
|
+
React.createElement("div", { className: "min-w-0 flex-1" },
|
|
69
|
+
React.createElement(AutocompleteTextInput, { value: props.text, placeholder: "{{local.components.step.returnValues.value}}", suggestions: props.suggestions, className: MONO_INPUT_CLASS, outerDivClassName: INPUT_WRAPPER_CLASS, disableSpellCheck: true, autoFocus: props.autoFocus, ariaLabelledby: props.ariaLabelledby, dataTestId: props.dataTestId, onChange: (value) => {
|
|
70
|
+
props.onChange({ text: value });
|
|
71
|
+
} })),
|
|
72
|
+
referenceButton));
|
|
73
|
+
}
|
|
74
|
+
const renderControl = () => {
|
|
75
|
+
/*
|
|
76
|
+
* A value the typed control cannot hold - text where the column wants a
|
|
77
|
+
* number, most often - is edited as text and written back exactly as it
|
|
78
|
+
* was read. Forcing it through the typed control would rewrite it.
|
|
79
|
+
*/
|
|
80
|
+
if (props.valueMode === ColumnValueMode.Raw) {
|
|
81
|
+
return (React.createElement(Input, { value: props.text, placeholder: props.placeholder, outerDivClassName: INPUT_WRAPPER_CLASS, ariaLabelledby: props.ariaLabelledby, dataTestId: props.dataTestId, tabIndex: props.tabIndex, autoFocus: props.autoFocus, onChange: (value) => {
|
|
82
|
+
/*
|
|
83
|
+
* The first keystroke ends raw mode: what is in the box is now what
|
|
84
|
+
* the builder means, so it is written in the column's own type. The
|
|
85
|
+
* mode and the text move together in one change - reported
|
|
86
|
+
* separately, the second report would overwrite the first and the
|
|
87
|
+
* cell could never be typed into at all.
|
|
88
|
+
*/
|
|
89
|
+
props.onChange({
|
|
90
|
+
text: value,
|
|
91
|
+
valueMode: value.includes("{{")
|
|
92
|
+
? ColumnValueMode.Reference
|
|
93
|
+
: ColumnValueMode.Literal,
|
|
94
|
+
});
|
|
95
|
+
} }));
|
|
96
|
+
}
|
|
97
|
+
switch (props.control) {
|
|
98
|
+
case ModelColumnControl.Boolean:
|
|
99
|
+
return (React.createElement(BooleanSegments, { value: props.text, ariaLabelledby: props.ariaLabelledby, autoFocus: props.autoFocus, dataTestId: props.dataTestId, onChange: (value) => {
|
|
100
|
+
props.onChange({ text: value });
|
|
101
|
+
} }));
|
|
102
|
+
case ModelColumnControl.Number:
|
|
103
|
+
return (React.createElement(Input, { type: InputType.NUMBER, value: props.text, placeholder: props.placeholder || "0", outerDivClassName: INPUT_WRAPPER_CLASS, ariaLabelledby: props.ariaLabelledby, dataTestId: props.dataTestId, tabIndex: props.tabIndex, autoFocus: props.autoFocus, onChange: (value) => {
|
|
104
|
+
props.onChange({ text: value });
|
|
105
|
+
} }));
|
|
106
|
+
case ModelColumnControl.Date:
|
|
107
|
+
return (React.createElement(Input, { type: InputType.DATETIME_LOCAL, value: props.text, outerDivClassName: INPUT_WRAPPER_CLASS, ariaLabelledby: props.ariaLabelledby, dataTestId: props.dataTestId, tabIndex: props.tabIndex, autoFocus: props.autoFocus, onChange: (value) => {
|
|
108
|
+
props.onChange({ text: value });
|
|
109
|
+
} }));
|
|
110
|
+
case ModelColumnControl.Color:
|
|
111
|
+
return (React.createElement(ColorPicker, { value: props.text, placeholder: props.placeholder || "#000000", ariaLabelledby: props.ariaLabelledby, dataTestId: props.dataTestId, tabIndex: props.tabIndex, onChange: (value) => {
|
|
112
|
+
props.onChange({ text: value ? value.toString() : "" });
|
|
113
|
+
} }));
|
|
114
|
+
case ModelColumnControl.LongText:
|
|
115
|
+
return (React.createElement(TextArea, { value: props.text, placeholder: props.placeholder, className: "block w-full rounded-md border border-gray-300 bg-white py-2 px-3 text-sm placeholder-gray-500 focus:border-indigo-500 focus:outline-none focus:ring-1 focus:ring-indigo-500 resize-y min-h-16", ariaLabelledby: props.ariaLabelledby, dataTestId: props.dataTestId, tabIndex: props.tabIndex, autoFocus: props.autoFocus, onChange: setTextAndDetectReference }));
|
|
116
|
+
default:
|
|
117
|
+
return (React.createElement(AutocompleteTextInput, { value: props.text, placeholder: props.placeholder, suggestions: props.suggestions, outerDivClassName: INPUT_WRAPPER_CLASS, className: props.control === ModelColumnControl.ObjectId
|
|
118
|
+
? "block w-full rounded-md border border-gray-300 bg-white py-2 pl-3 pr-3 font-mono text-xs text-gray-900 placeholder-gray-400 focus:border-indigo-500 focus:outline-none focus:ring-1 focus:ring-indigo-500"
|
|
119
|
+
: undefined, ariaLabelledby: props.ariaLabelledby, autoFocus: props.autoFocus, dataTestId: props.dataTestId, onChange: setTextAndDetectReference }));
|
|
120
|
+
}
|
|
121
|
+
};
|
|
122
|
+
return (React.createElement("div", { className: "flex w-full items-center gap-1" },
|
|
123
|
+
React.createElement("div", { className: "min-w-0 flex-1" }, renderControl()),
|
|
124
|
+
referenceButton));
|
|
125
|
+
};
|
|
126
|
+
/*
|
|
127
|
+
* Three states, not two. A boolean column with nothing typed into it is not
|
|
128
|
+
* "false" - it is a field the record does not set, and a toggle cannot say
|
|
129
|
+
* that. (The shared Toggle component also fires its onChange twice per click.)
|
|
130
|
+
*/
|
|
131
|
+
const BooleanSegments = (props) => {
|
|
132
|
+
const segments = [
|
|
133
|
+
{ label: "True", value: "true" },
|
|
134
|
+
{ label: "False", value: "false" },
|
|
135
|
+
{ label: "Not set", value: "" },
|
|
136
|
+
];
|
|
137
|
+
return (React.createElement("div", { className: "inline-flex rounded-md border border-gray-300 bg-white p-0.5", role: "group", "aria-labelledby": props.ariaLabelledby, "data-testid": props.dataTestId }, segments.map((segment) => {
|
|
138
|
+
const isSelected = props.value === segment.value;
|
|
139
|
+
return (React.createElement("button", { key: segment.label, type: "button", autoFocus: props.autoFocus && segment.value === "true", "aria-pressed": isSelected, className: `rounded px-2.5 py-1 text-xs font-medium transition-colors ${isSelected
|
|
140
|
+
? "bg-indigo-50 text-indigo-700"
|
|
141
|
+
: "text-gray-500 hover:text-gray-700"}`, onClick: () => {
|
|
142
|
+
props.onChange(segment.value);
|
|
143
|
+
} }, segment.label));
|
|
144
|
+
})));
|
|
145
|
+
};
|
|
146
|
+
/*
|
|
147
|
+
* "is any of" holds a list. The previous editor rendered a multi-select whose
|
|
148
|
+
* options were only ever the suggestions it had been handed, so a value nobody
|
|
149
|
+
* had suggested could not be entered at all - which for a list of IDs is every
|
|
150
|
+
* value. This is a chip input: type, press Enter or comma, and it is in.
|
|
151
|
+
*/
|
|
152
|
+
const MultiValueInput = (props) => {
|
|
153
|
+
const [draft, setDraft] = React.useState("");
|
|
154
|
+
const commitDraft = () => {
|
|
155
|
+
const entry = draft.trim();
|
|
156
|
+
if (entry === "" || props.values.includes(entry)) {
|
|
157
|
+
setDraft("");
|
|
158
|
+
return;
|
|
159
|
+
}
|
|
160
|
+
props.onChange([...props.values, entry]);
|
|
161
|
+
setDraft("");
|
|
162
|
+
};
|
|
163
|
+
return (React.createElement("div", { className: "w-full rounded-md border border-gray-300 bg-white px-2 py-1.5" },
|
|
164
|
+
props.values.length > 0 && (React.createElement("div", { className: "mb-1 flex flex-wrap gap-1" }, props.values.map((value, index) => {
|
|
165
|
+
return (React.createElement("span", { key: `${value}-${index}`, className: "inline-flex items-center gap-1 rounded bg-gray-100 px-1.5 py-0.5 text-xs text-gray-700" },
|
|
166
|
+
containsTemplateExpression(value) ? (React.createElement("span", { className: "font-mono text-indigo-600" }, value)) : (value),
|
|
167
|
+
React.createElement("button", { type: "button", "aria-label": `Remove ${value}`, className: "text-gray-400 hover:text-gray-600", onClick: () => {
|
|
168
|
+
props.onChange(props.values.filter((_entry, i) => {
|
|
169
|
+
return i !== index;
|
|
170
|
+
}));
|
|
171
|
+
} },
|
|
172
|
+
React.createElement(Icon, { icon: IconProp.Close, className: "h-3 w-3" }))));
|
|
173
|
+
}))),
|
|
174
|
+
React.createElement("input", { type: "text", value: draft, "aria-labelledby": props.ariaLabelledby, "data-testid": props.dataTestId, placeholder: props.placeholder || "Type a value and press Enter", className: "block w-full border-0 p-0 text-sm placeholder-gray-400 focus:outline-none focus:ring-0", onChange: (event) => {
|
|
175
|
+
const value = event.target.value;
|
|
176
|
+
if (value.endsWith(",")) {
|
|
177
|
+
setDraft(value.slice(0, -1));
|
|
178
|
+
/*
|
|
179
|
+
* setDraft is async, so commit from the typed text rather than from
|
|
180
|
+
* state, which still holds the previous keystroke here.
|
|
181
|
+
*/
|
|
182
|
+
const entry = value.slice(0, -1).trim();
|
|
183
|
+
if (entry !== "" && !props.values.includes(entry)) {
|
|
184
|
+
props.onChange([...props.values, entry]);
|
|
185
|
+
}
|
|
186
|
+
setDraft("");
|
|
187
|
+
return;
|
|
188
|
+
}
|
|
189
|
+
setDraft(value);
|
|
190
|
+
}, onKeyDown: (event) => {
|
|
191
|
+
if (event.key === "Enter") {
|
|
192
|
+
event.preventDefault();
|
|
193
|
+
commitDraft();
|
|
194
|
+
return;
|
|
195
|
+
}
|
|
196
|
+
if (event.key === "Backspace" &&
|
|
197
|
+
draft === "" &&
|
|
198
|
+
props.values.length > 0) {
|
|
199
|
+
props.onChange(props.values.slice(0, -1));
|
|
200
|
+
}
|
|
201
|
+
}, onBlur: commitDraft })));
|
|
202
|
+
};
|
|
203
|
+
export default ColumnValueInput;
|
|
204
|
+
//# sourceMappingURL=ColumnValueInput.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ColumnValueInput.js","sourceRoot":"","sources":["../../../../../../UI/Components/Workflow/ColumnEditor/ColumnValueInput.tsx"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,OAAO,QAAQ,MAAM,iCAAiC,CAAC;AACvD,OAAO,qBAAqB,MAAM,mDAAmD,CAAC;AAEtF,OAAO,WAAW,MAAM,gCAAgC,CAAC;AACzD,OAAO,IAAI,MAAM,iBAAiB,CAAC;AACnC,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,QAAQ,MAAM,yBAAyB,CAAC;AAC/C,OAAO,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAClE,OAAO,EAAE,0BAA0B,EAAE,MAAM,0BAA0B,CAAC;AACtE,OAAO,KAA0C,MAAM,OAAO,CAAC;AAkC/D,MAAM,mBAAmB,GAAW,iBAAiB,CAAC;AAEtD,MAAM,gBAAgB,GACpB,yJAAyJ,CAAC;AAE5J,MAAM,gBAAgB,GAAsC,CAC1D,KAAqB,EACP,EAAE;;IAChB,MAAM,WAAW,GAAY,KAAK,CAAC,SAAS,KAAK,eAAe,CAAC,SAAS,CAAC;IAI3E;;;;;OAKG;IACH,MAAM,yBAAyB,GAAoB,CAAC,KAAa,EAAQ,EAAE;QACzE,IAAI,CAAC,WAAW,IAAI,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC;YACzC,KAAK,CAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,SAAS,EAAE,eAAe,CAAC,SAAS,EAAE,CAAC,CAAC;YACtE,OAAO;QACT,CAAC;QAED,KAAK,CAAC,QAAQ,CAAC,EAAE,IAAI,E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C;oBAC3C,CAAC;oBAED,QAAQ,CAAC,EAAE,CAAC,CAAC;oBACb,OAAO;gBACT,CAAC;gBAED,QAAQ,CAAC,KAAK,CAAC,CAAC;YAClB,CAAC,EACD,SAAS,EAAE,CAAC,KAA4C,EAAE,EAAE;gBAC1D,IAAI,KAAK,CAAC,GAAG,KAAK,OAAO,EAAE,CAAC;oBAC1B,KAAK,CAAC,cAAc,EAAE,CAAC;oBACvB,WAAW,EAAE,CAAC;oBACd,OAAO;gBACT,CAAC;gBAED,IACE,KAAK,CAAC,GAAG,KAAK,WAAW;oBACzB,KAAK,KAAK,EAAE;oBACZ,KAAK,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,EACvB,CAAC;oBACD,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;gBAC5C,CAAC;YACH,CAAC,EACD,MAAM,EAAE,WAAW,GACnB,CACE,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* The query body: the conditions that decide which records a step acts on.
|
|
3
|
+
*
|
|
4
|
+
* Fully controlled, like the record form. One column header for the whole list
|
|
5
|
+
* rather than a Key/Operator/Value label repeated above every row, which is
|
|
6
|
+
* what made the old editor read as a spreadsheet.
|
|
7
|
+
*/
|
|
8
|
+
import IconProp from "../../../../Types/Icon/IconProp";
|
|
9
|
+
import Icon from "../../Icon/Icon";
|
|
10
|
+
import { findColumn } from "../ModelSchema";
|
|
11
|
+
import AddColumnDropdown from "./AddColumnDropdown";
|
|
12
|
+
import { isOfferableColumn } from "./ColumnControl";
|
|
13
|
+
import ColumnConditionRow from "./ColumnConditionRow";
|
|
14
|
+
import { makeColumnRow } from "./ColumnRow";
|
|
15
|
+
import React, { useState } from "react";
|
|
16
|
+
const ModelQueryBuilder = (props) => {
|
|
17
|
+
/*
|
|
18
|
+
* The row just added from the picker, so its value control can take focus.
|
|
19
|
+
* Without it the picker remounts to clear its own selection and focus falls
|
|
20
|
+
* to the document body, which for a keyboard user means starting again from
|
|
21
|
+
* the top of the panel.
|
|
22
|
+
*/
|
|
23
|
+
const [justAddedKey, setJustAddedKey] = useState("");
|
|
24
|
+
const offerableColumns = props.columns.filter((column) => {
|
|
25
|
+
return isOfferableColumn(column);
|
|
26
|
+
});
|
|
27
|
+
const replaceRow = (index, row) => {
|
|
28
|
+
const next = [...props.rows];
|
|
29
|
+
next[index] = row;
|
|
30
|
+
props.onChange(next);
|
|
31
|
+
};
|
|
32
|
+
return (React.createElement("div", null,
|
|
33
|
+
React.createElement("div", { className: "overflow-hidden rounded-md border border-gray-200 bg-white" },
|
|
34
|
+
props.rows.length === 0 ? (React.createElement("div", { className: "px-6 py-10 text-center" },
|
|
35
|
+
React.createElement(Icon, { icon: IconProp.Filter, className: "mx-auto h-6 w-6 text-gray-300" }),
|
|
36
|
+
React.createElement("p", { className: "mt-2 text-sm font-medium text-gray-700" }, "No conditions yet"),
|
|
37
|
+
React.createElement("p", { className: "mt-1 text-xs text-gray-500" }, "With no conditions this matches every record in the project."))) : (React.createElement(React.Fragment, null,
|
|
38
|
+
React.createElement("div", { className: "hidden border-b border-gray-100 bg-gray-50/60 px-3 py-1.5 text-[10px] font-semibold uppercase tracking-[0.08em] text-gray-400 sm:grid sm:grid-cols-[minmax(0,1fr)_minmax(0,0.85fr)_minmax(0,1.3fr)_auto] sm:gap-2" },
|
|
39
|
+
React.createElement("span", null, "Column"),
|
|
40
|
+
React.createElement("span", null, "Comparison"),
|
|
41
|
+
React.createElement("span", null, "Value"),
|
|
42
|
+
React.createElement("span", { className: "w-8" })),
|
|
43
|
+
React.createElement("div", { className: "divide-y divide-gray-100" }, props.rows.map((row, index) => {
|
|
44
|
+
return (React.createElement(ColumnConditionRow, { key: row.key, row: row, column: findColumn(props.columns, row.columnId), columns: offerableColumns, suggestions: props.suggestions, autoFocus: row.key === justAddedKey, onChange: (nextRow) => {
|
|
45
|
+
replaceRow(index, nextRow);
|
|
46
|
+
}, onRemove: () => {
|
|
47
|
+
props.onChange(props.rows.filter((_row, i) => {
|
|
48
|
+
return i !== index;
|
|
49
|
+
}));
|
|
50
|
+
} }));
|
|
51
|
+
})))),
|
|
52
|
+
React.createElement("div", { className: "border-t border-gray-100 bg-gray-50/40 px-3 py-2.5" },
|
|
53
|
+
React.createElement(AddColumnDropdown, { columns: offerableColumns.filter((column) => {
|
|
54
|
+
return !props.rows.some((row) => {
|
|
55
|
+
return row.columnId === column.id;
|
|
56
|
+
});
|
|
57
|
+
}), requiredColumnIds: [], placeholder: "Add a condition...", allowCustomColumn: true, dataTestId: "model-column-add", onAdd: (columnId) => {
|
|
58
|
+
const added = makeColumnRow({
|
|
59
|
+
columnId: columnId,
|
|
60
|
+
});
|
|
61
|
+
setJustAddedKey(added.key);
|
|
62
|
+
props.onChange([...props.rows, added]);
|
|
63
|
+
} })))));
|
|
64
|
+
};
|
|
65
|
+
export default ModelQueryBuilder;
|
|
66
|
+
//# sourceMappingURL=ModelQueryBuilder.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ModelQueryBuilder.js","sourceRoot":"","sources":["../../../../../../UI/Components/Workflow/ColumnEditor/ModelQueryBuilder.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,QAAQ,MAAM,iCAAiC,CAAC;AACvD,OAAO,IAAI,MAAM,iBAAiB,CAAC;AACnC,OAAO,EAAqB,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC/D,OAAO,iBAAiB,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,kBAAkB,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAkB,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5D,OAAO,KAAK,EAAE,EAAmC,QAAQ,EAAE,MAAM,OAAO,C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,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC;oBACzC,CAAC,GACD,CACE,CACF,CACF,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* The record body: every field this step writes, as a form.
|
|
3
|
+
*
|
|
4
|
+
* Fully controlled - the rows live in ModelColumnEditor, so what is on screen
|
|
5
|
+
* and what is stored on the argument can never drift apart.
|
|
6
|
+
*/
|
|
7
|
+
import IconProp from "../../../../Types/Icon/IconProp";
|
|
8
|
+
import Icon from "../../Icon/Icon";
|
|
9
|
+
import { findColumn, requiredWritableColumns, } from "../ModelSchema";
|
|
10
|
+
import AddColumnDropdown from "./AddColumnDropdown";
|
|
11
|
+
import { isOfferableColumn } from "./ColumnControl";
|
|
12
|
+
import ColumnFieldRow from "./ColumnFieldRow";
|
|
13
|
+
import { makeColumnRow } from "./ColumnRow";
|
|
14
|
+
import React, { useState } from "react";
|
|
15
|
+
const ModelRecordForm = (props) => {
|
|
16
|
+
/*
|
|
17
|
+
* The row just added from the picker, so its value control can take focus.
|
|
18
|
+
* Without it the picker remounts to clear its own selection and focus falls
|
|
19
|
+
* to the document body, which for a keyboard user means starting again from
|
|
20
|
+
* the top of the panel.
|
|
21
|
+
*/
|
|
22
|
+
const [justAddedKey, setJustAddedKey] = useState("");
|
|
23
|
+
const requiredColumnIds = requiredWritableColumns(props.columns).map((column) => {
|
|
24
|
+
return column.id;
|
|
25
|
+
});
|
|
26
|
+
const usedColumnIds = props.rows.map((row) => {
|
|
27
|
+
return row.columnId;
|
|
28
|
+
});
|
|
29
|
+
const offerableColumns = props.columns.filter((column) => {
|
|
30
|
+
return isOfferableColumn(column) && !usedColumnIds.includes(column.id);
|
|
31
|
+
});
|
|
32
|
+
/*
|
|
33
|
+
* Named so the builder is not left wondering where a column went. Relations
|
|
34
|
+
* and blobs cannot be a single box, and saying which ones is kinder than
|
|
35
|
+
* silently offering a shorter list than the model has.
|
|
36
|
+
*/
|
|
37
|
+
const unofferableColumnTitles = props.columns
|
|
38
|
+
.filter((column) => {
|
|
39
|
+
return !isOfferableColumn(column) && !column.isTenantColumn;
|
|
40
|
+
})
|
|
41
|
+
.map((column) => {
|
|
42
|
+
return column.title;
|
|
43
|
+
});
|
|
44
|
+
const knownColumnIds = props.columns.map((column) => {
|
|
45
|
+
return column.id;
|
|
46
|
+
});
|
|
47
|
+
const replaceRow = (index, row) => {
|
|
48
|
+
const next = [...props.rows];
|
|
49
|
+
next[index] = row;
|
|
50
|
+
props.onChange(next);
|
|
51
|
+
};
|
|
52
|
+
return (React.createElement("div", null,
|
|
53
|
+
React.createElement("div", { className: "overflow-hidden rounded-md border border-gray-200 bg-white" },
|
|
54
|
+
props.rows.length === 0 ? (React.createElement("div", { className: "px-6 py-10 text-center" },
|
|
55
|
+
React.createElement(Icon, { icon: IconProp.Database, className: "mx-auto h-6 w-6 text-gray-300" }),
|
|
56
|
+
React.createElement("p", { className: "mt-2 text-sm font-medium text-gray-700" }, "No fields set yet"),
|
|
57
|
+
React.createElement("p", { className: "mt-1 text-xs text-gray-500" }, "Pick a field below to start building this record."))) : (React.createElement("div", { className: "divide-y divide-gray-100" }, props.rows.map((row, index) => {
|
|
58
|
+
return (React.createElement(ColumnFieldRow, { key: row.key, row: row, column: findColumn(props.columns, row.columnId), knownColumnIds: knownColumnIds, isRequired: requiredColumnIds.includes(row.columnId), suggestions: props.suggestions, autoFocus: row.key === justAddedKey, onChange: (nextRow) => {
|
|
59
|
+
replaceRow(index, nextRow);
|
|
60
|
+
}, onRemove: () => {
|
|
61
|
+
props.onChange(props.rows.filter((_row, i) => {
|
|
62
|
+
return i !== index;
|
|
63
|
+
}));
|
|
64
|
+
} }));
|
|
65
|
+
}))),
|
|
66
|
+
React.createElement("div", { className: "border-t border-gray-100 bg-gray-50/40 px-3 py-2.5" },
|
|
67
|
+
React.createElement(AddColumnDropdown, { columns: offerableColumns, requiredColumnIds: requiredColumnIds, placeholder: "Add a field...", allowCustomColumn: true, dataTestId: "model-column-add", onAdd: (columnId) => {
|
|
68
|
+
const added = makeColumnRow({
|
|
69
|
+
columnId: columnId,
|
|
70
|
+
});
|
|
71
|
+
setJustAddedKey(added.key);
|
|
72
|
+
props.onChange([...props.rows, added]);
|
|
73
|
+
} }))),
|
|
74
|
+
unofferableColumnTitles.length > 0 && (React.createElement("p", { className: "mt-1.5 text-xs text-gray-400" },
|
|
75
|
+
unofferableColumnTitles.slice(0, 3).join(", "),
|
|
76
|
+
unofferableColumnTitles.length > 3
|
|
77
|
+
? ` and ${unofferableColumnTitles.length - 3} other field${unofferableColumnTitles.length - 3 === 1 ? "" : "s"}`
|
|
78
|
+
: "",
|
|
79
|
+
" ",
|
|
80
|
+
"can only be set with Edit as JSON."))));
|
|
81
|
+
};
|
|
82
|
+
export default ModelRecordForm;
|
|
83
|
+
//# sourceMappingURL=ModelRecordForm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ModelRecordForm.js","sourceRoot":"","sources":["../../../../../../UI/Components/Workflow/ColumnEditor/ModelRecordForm.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,QAAQ,MAAM,iCAAiC,CAAC;AACvD,OAAO,IAAI,MAAM,iBAAiB,CAAC;AACnC,OAAO,EAEL,UAAU,EACV,uBAAuB,GACxB,MAAM,gBAAgB,CAAC;AACxB,OAAO,iBAAiB,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,cAAc,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAkB,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5D,OAAO,KAAK,EAAE,EAAmC,QAAQ,EAAE,MAAM,OAAO,CAAC;AASzE,MAAM,eAAe,GAAsC,CACzD,KAAqB,EACP,EAAE;IAChB;;;;;OAKG;IACH,MAAM,CAAC,YAAY,EAAE,eAAe,CAAC,GAAG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