/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ import { useState, useEffect, useCallback, useRef } from 'react'; import { t } from '@apache-superset/core/translation'; import { styled } from '@apache-superset/core/theme'; import { SupersetClient } from '@superset-ui/core'; import { Spin } from 'antd'; import { Select } from '@superset-ui/core/components'; import { Icons } from '@superset-ui/core/components/Icons'; import { JsonForms } from '@jsonforms/react'; import type { JsonSchema, UISchemaElement } from '@jsonforms/core'; import { cellRegistryEntries } from '@great-expectations/jsonforms-antd-renderers'; import type { ErrorObject } from 'ajv'; import { StandardModal, ModalFormField, MODAL_STANDARD_WIDTH, } from 'src/components/Modal'; import { renderers, sanitizeSchema, buildUiSchema, getDynamicDependencies, areDependenciesSatisfied, serializeDependencyValues, SCHEMA_REFRESH_DEBOUNCE_MS, } from 'src/features/semanticLayers/jsonFormsHelpers'; interface SemanticLayerOption { uuid: string; name: string; } interface AvailableView { name: string; already_added: boolean; } const ModalContent = styled.div` padding: ${({ theme }) => theme.sizeUnit * 4}px; `; const LoadingContainer = styled.div` display: flex; justify-content: center; padding: ${({ theme }) => theme.sizeUnit * 4}px; `; const SectionLabel = styled.div` color: ${({ theme }) => theme.colorText}; font-size: ${({ theme }) => theme.fontSize}px; margin-top: ${({ theme }) => theme.sizeUnit}px; margin-bottom: ${({ theme }) => theme.sizeUnit * 2}px; `; const VerticalFormFields = styled.div` margin-bottom: ${({ theme }) => theme.sizeUnit * 4}px; /* The antd renderer's VerticalLayout creates its own