/** * Copyright (c) 2020-present, Goldman Sachs * * Licensed 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 { observer } from 'mobx-react-lite'; import { FormButton, FormDropdownMenuTrigger } from '@finos/legend-data-cube'; import { useLegendDataCubeBuilderStore } from '../LegendDataCubeBuilderStoreProvider.js'; import type { LocalFileDataCubeSourceLoaderState } from '../../../stores/builder/source/LocalFileDataCubeSourceLoaderState.js'; import { LocalFileDataCubePartialSourceLoader } from './LocalFileDataCubeSourceLoader.js'; import { DataCubeIcon } from '@finos/legend-art'; import { formatDistanceToNow } from '@finos/legend-shared'; import type { LegendDataCubeSourceLoaderState } from '../../../stores/builder/source/LegendDataCubeSourceLoaderState.js'; import { LegendDataCubeBlockingWindow } from '../../LegendDataCubeBlockingWindow.js'; import { LegendDataCubeSourceBuilderType } from '../../../stores/builder/source/LegendDataCubeSourceBuilderState.js'; export const LegendDataCubeSourceLoader = observer( (props: { state: LegendDataCubeSourceLoaderState }) => { const { state } = props; const store = useLegendDataCubeBuilderStore(); const persistentDataCube = state.persistentDataCube; return ( <>
{persistentDataCube.name}
{persistentDataCube.lastUpdatedAt ? formatDistanceToNow( new Date(persistentDataCube.lastUpdatedAt), { includeSeconds: true, addSuffix: true, }, ) : '(unknown)'}
{persistentDataCube.owner}
Source Type:
{}} open={false} disabled={true} >
{state.label}
{state.label === LegendDataCubeSourceBuilderType.LOCAL_FILE && ( )}
{ state.display.onClose?.(); state.display.close(); }} > Cancel { state.finalize().catch((error) => { store.alertService.alertUnhandledError(error); }); }} > OK
); }, ); export const LegendDataCubeSourceLoaderBlockingWindow = observer(() => { const store = useLegendDataCubeBuilderStore(); if (!store.sourceLoader) { return null; } return ( ); });