@finos/legend-extension-dsl-data-space
Version:
Legend extension for Data Space DSL
44 lines • 3.05 kB
JavaScript
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
/**
* 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 { AnchorLinkIcon, QuestionCircleIcon } from '@finos/legend-art';
import {} from '../stores/DataSpaceViewerState.js';
import { useApplicationStore } from '@finos/legend-application';
import { useEffect, useRef } from 'react';
import { DATA_SPACE_VIEWER_ACTIVITY_MODE, generateAnchorForActivity, } from '../stores/DataSpaceViewerNavigation.js';
import { DataAccessOverview } from '@finos/legend-query-builder';
export const DataSpaceDataAccess = observer((props) => {
const { dataSpaceViewerState } = props;
const applicationStore = useApplicationStore();
const analysisResult = dataSpaceViewerState.dataSpaceAnalysisResult;
const documentationUrl = analysisResult.supportInfo?.documentationUrl;
const sectionRef = useRef(null);
const anchor = generateAnchorForActivity(DATA_SPACE_VIEWER_ACTIVITY_MODE.DATA_ACCESS);
useEffect(() => {
if (sectionRef.current) {
dataSpaceViewerState.layoutState.setWikiPageAnchor(anchor, sectionRef.current);
}
return () => dataSpaceViewerState.layoutState.unsetWikiPageAnchor(anchor);
}, [dataSpaceViewerState, anchor]);
const seeDocumentation = () => {
if (documentationUrl) {
applicationStore.navigationService.navigator.visitAddress(documentationUrl);
}
};
return (_jsxs("div", { ref: sectionRef, className: "data-space__viewer__wiki__section", children: [_jsxs("div", { className: "data-space__viewer__wiki__section__header", children: [_jsxs("div", { className: "data-space__viewer__wiki__section__header__label", children: ["Data Access", _jsx("button", { className: "data-space__viewer__wiki__section__header__anchor", tabIndex: -1, onClick: () => dataSpaceViewerState.changeZone(anchor, true), children: _jsx(AnchorLinkIcon, {}) })] }), Boolean(documentationUrl) && (_jsx("button", { className: "data-space__viewer__wiki__section__header__documentation", tabIndex: -1, onClick: seeDocumentation, title: "See Documentation", children: _jsx(QuestionCircleIcon, {}) }))] }), _jsx("div", { className: "data-space__viewer__wiki__section__content", children: _jsx("div", { className: "data-space__viewer__data-access", children: _jsx(DataAccessOverview, { dataAccessState: dataSpaceViewerState.currentDataAccessState }) }) })] }));
});
//# sourceMappingURL=DataSpaceDataAccess.js.map