Skip to content

Commit

Permalink
Merge branch 'finos:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
rafaelbey authored Dec 21, 2024
2 parents c85bcf1 + 1f435c8 commit 1df0be2
Show file tree
Hide file tree
Showing 87 changed files with 785 additions and 170 deletions.
11 changes: 11 additions & 0 deletions .changeset/new-iteration.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
'@finos/legend-application-data-cube-bootstrap': minor
'@finos/legend-application-query-bootstrap': minor
'@finos/legend-application-studio-bootstrap': minor
'@finos/legend-application-data-cube-deployment': minor
'@finos/legend-application-pure-ide-deployment': minor
'@finos/legend-application-query-deployment': minor
'@finos/legend-application-repl-deployment': minor
'@finos/legend-application-studio-deployment': minor
'@finos/legend-server-showcase-deployment': minor
---
2 changes: 2 additions & 0 deletions packages/legend-application-data-cube-bootstrap/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# @finos/legend-application-data-cube-bootstrap

## 12.85.0

## 12.84.0

## 12.83.0
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@finos/legend-application-data-cube-bootstrap",
"version": "12.84.0",
"version": "12.85.0",
"description": "Legend Data Cube application bootstrap",
"keywords": [
"legend",
Expand Down
2 changes: 2 additions & 0 deletions packages/legend-application-data-cube-deployment/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# @finos/legend-application-data-cube-deployment

## 12.85.0

## 12.84.0

## 12.83.0
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@finos/legend-application-data-cube-deployment",
"version": "12.84.0",
"version": "12.85.0",
"private": true,
"description": "Legend Data Cube web application deployment",
"keywords": [
Expand Down
6 changes: 6 additions & 0 deletions packages/legend-application-data-cube/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# @finos/legend-application-data-cube

## 0.1.3

### Patch Changes

- [#3753](https://github.com/finos/legend-studio/pull/3753) [`72f70b6`](https://github.com/finos/legend-studio/commit/72f70b62a6e15d96e6f1116ee84ed34eaba82022) ([@MauricioUyaguari](https://github.com/MauricioUyaguari)) - Edit existing data cube query

## 0.1.2

## 0.1.1
Expand Down
5 changes: 3 additions & 2 deletions packages/legend-application-data-cube/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@finos/legend-application-data-cube",
"version": "0.1.2",
"version": "0.1.3",
"description": "Legend Data Cube application core",
"keywords": [
"legend",
Expand Down Expand Up @@ -56,7 +56,8 @@
"mobx": "6.13.5",
"mobx-react-lite": "4.1.0",
"react": "19.0.0",
"react-dom": "19.0.0"
"react-dom": "19.0.0",
"serializr": "3.0.3"
},
"devDependencies": {
"@finos/legend-dev-utils": "workspace:*",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/**
* 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 { generatePath } from '@finos/legend-application/browser';

export enum LEGEND_DATA_CUBE_ROUTE_PATTERN_TOKEN {
DATA_CUBE_QUERY_ID = 'id',
}

export const LEGEND_DATA_CUBE_ROUTE_PATTERN = Object.freeze({
DEFAULT: '/',
VIEW_EXISTING_QUERY: `/:${LEGEND_DATA_CUBE_ROUTE_PATTERN_TOKEN.DATA_CUBE_QUERY_ID}`,
});

export type ExistingDataCubeViewerPathParams = {
[LEGEND_DATA_CUBE_ROUTE_PATTERN_TOKEN.DATA_CUBE_QUERY_ID]: string;
};

export const generatedSavedQueryUrl = (id: string): string => {
return generatePath(LEGEND_DATA_CUBE_ROUTE_PATTERN.VIEW_EXISTING_QUERY, {
id,
});
};
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,94 @@
*/

import { observer } from 'mobx-react-lite';
import { QuestionIcon } from '@finos/legend-art';
import {
Dialog,
Modal,
ModalBody,
ModalFooter,
ModalFooterButton,
ModalHeader,
PanelListItem,
PanelLoadingIndicator,
QuestionIcon,
clsx,
} from '@finos/legend-art';
import { useLegendDataCubeBaseStore } from './LegendDataCubeFrameworkProvider.js';
import { DataCubeSourceEditor } from './source/DataCubeSourceEditor.js';
import { useEffect } from 'react';
import { useEffect, useRef, useState } from 'react';
import { DataCube } from '@finos/legend-data-cube';
import type { LegendDataCubeStore } from '../stores/LegendDataCubeEditorStore.js';
import type { LegendCubeViewer } from '../stores/source/LegendCubeViewer.js';
import { flowResult } from 'mobx';

const CreateQueryDialog = observer(
(props: { view: LegendCubeViewer; store: LegendDataCubeStore }) => {
const { store } = props;
const close = (): void => store.setSaveModal(false);
const [queryName, setQueryName] = useState('');
const create = (): void => {
flowResult(store.saveQuery(queryName)).catch(
store.applicationStore.alertUnhandledError,
);
};
const isEmptyName = !queryName;
// name
const nameInputRef = useRef<HTMLInputElement>(null);
const setFocus = (): void => {
nameInputRef.current?.focus();
};

const changeName: React.ChangeEventHandler<HTMLInputElement> = (event) => {
setQueryName(event.target.value);
};

useEffect(() => {
setTimeout(() => setFocus(), 1);
}, []);
return (
<Dialog
open={store.saveModal}
onClose={close}
classes={{
root: 'editor-modal__root-container',
container: 'editor-modal__container',
paper: 'editor-modal__content',
}}
>
<Modal darkMode={false} className="query-export">
<ModalHeader title="Create New Query" />
<ModalBody>
<PanelLoadingIndicator
isLoading={store.saveModalState.isInProgress}
/>
<PanelListItem>
<div className="input--with-validation">
<input
ref={nameInputRef}
className={clsx('input input--dark', {
'input--caution': false,
})}
spellCheck={false}
value={queryName}
onChange={changeName}
title="New Query Name"
/>
</div>
</PanelListItem>
</ModalBody>
<ModalFooter>
<ModalFooterButton
text="Create Query"
title="Create new query"
disabled={isEmptyName}
onClick={create}
/>
</ModalFooter>
</Modal>
</Dialog>
);
},
);

export const DataCubeEditor = observer(() => {
const dataCubeStore = useLegendDataCubeBaseStore();
Expand Down Expand Up @@ -55,7 +138,15 @@ export const DataCubeEditor = observer(() => {
{dataCubeStore.cubeViewer ? (
<>
<div className="h-[calc(100%_-_30px)]">
<div className="h-12 w-full bg-gray-200"></div>
<div className="h-12 w-full bg-gray-200">
<button
onClick={() => dataCubeStore.setSaveModal(true)}
type="button"
className="relative rounded-full bg-sky-900 p-1 text-gray-400 hover:text-white focus:outline-none focus:ring-2 focus:ring-white focus:ring-offset-2 focus:ring-offset-gray-800"
>
Save
</button>
</div>
<div className="h-[calc(100%_-_30px)]">
<DataCube engine={dataCubeStore.cubeViewer.engine} />
</div>
Expand Down Expand Up @@ -88,6 +179,12 @@ export const DataCubeEditor = observer(() => {
{sourceSelector.open && (
<DataCubeSourceEditor sourceBuilder={sourceSelector} />
)}
{dataCubeStore.cubeViewer && dataCubeStore.saveModal && (
<CreateQueryDialog
store={dataCubeStore}
view={dataCubeStore.cubeViewer}
/>
)}
</>
);
});
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,21 @@ import { Route, Routes } from '@finos/legend-application/browser';
import { LegendDataCubeFrameworkProvider } from './LegendDataCubeFrameworkProvider.js';
import { observer } from 'mobx-react-lite';
import { DataCubeEditor } from './DataCubeEditor.js';
import { ExistingDataCubeQuery } from './source/ExistingDataCubeQuery.js';
import { LEGEND_DATA_CUBE_ROUTE_PATTERN } from '../__lib__/LegendDataCubeNavigation.js';

const LegendDataCubeWebApplicationRouter = observer(() => {
return (
<div className="app">
<Routes>
<Route path="*" element={<DataCubeEditor />} />
<Route
path={LEGEND_DATA_CUBE_ROUTE_PATTERN.DEFAULT}
element={<DataCubeEditor />}
/>
<Route
path={LEGEND_DATA_CUBE_ROUTE_PATTERN.VIEW_EXISTING_QUERY}
element={<ExistingDataCubeQuery />}
/>
</Routes>
</div>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ import { SavedQuerySourceEditor } from './SavedQuerySourceEditor.js';
import { SavedQueryInputSourceState } from '../../stores/source/SavedQueryInputSourceState.js';
import { useLegendDataCubeBaseStore } from '../LegendDataCubeFrameworkProvider.js';
import { flowResult } from 'mobx';
import type { CubeInputSource } from '../../stores/source/CubeInputSource.js';
import type { DataCubeEngine } from '@finos/legend-data-cube';
import type { DataCubeGenericSource } from '../../stores/model/DataCubeGenericSource.js';

export const DataCubeSourceEditor = observer(
(props: { sourceBuilder: LegendDataCubeSourceBuilder }) => {
Expand Down Expand Up @@ -111,7 +111,7 @@ export const DataCubeSourceEditor = observer(
onClick={() => {
flowResult(
sourceBuilder.inputSource(
(source: CubeInputSource, engine: DataCubeEngine) =>
(source: DataCubeGenericSource, engine: DataCubeEngine) =>
store.initializeView(source, engine),
),
).catch(store.context.applicationStore.alertUnhandledError);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
/**
* 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 { useLegendDataCubeBaseStore } from '../LegendDataCubeFrameworkProvider.js';
import { useEffect } from 'react';
import { QuestionIcon } from '@finos/legend-art';
import { useParams } from '@finos/legend-application/browser';
import { DataCube } from '@finos/legend-data-cube';
import { guaranteeNonNullable } from '@finos/legend-shared';
import {
LEGEND_DATA_CUBE_ROUTE_PATTERN_TOKEN,
type ExistingDataCubeViewerPathParams,
} from '../../__lib__/LegendDataCubeNavigation.js';
import { flowResult } from 'mobx';

export const ExistingDataCubeQuery = observer(() => {
const dataCubeStore = useLegendDataCubeBaseStore();
const params = useParams<ExistingDataCubeViewerPathParams>();
const sourceSelector = dataCubeStore.sourceSelector;
const queryId = guaranteeNonNullable(
params[LEGEND_DATA_CUBE_ROUTE_PATTERN_TOKEN.DATA_CUBE_QUERY_ID],
);
useEffect(() => {
flowResult(dataCubeStore.initialize(queryId)).catch(
dataCubeStore.applicationStore.alertUnhandledError,
);
}, [dataCubeStore, queryId]);

return (
<>
<div className="h-full w-full bg-white">
<div className="bg-sky-900">
<div className="mx-auto max-w-full px-2 sm:px-6 lg:px-8">
<div className="relative flex h-12 items-center justify-between">
<div className="flex flex-1 items-center justify-center sm:items-stretch sm:justify-start">
<div className="flex flex-shrink-0 items-center">
<div className="text-gray-300">Legend Data Cube</div>
</div>
</div>
<div className="md:block">
<div className="ml-4 flex items-center md:ml-6">
<button
type="button"
className="relative rounded-full bg-sky-900 p-1 text-gray-400 hover:text-white focus:outline-none focus:ring-2 focus:ring-white focus:ring-offset-2 focus:ring-offset-gray-800"
>
<QuestionIcon />
</button>
</div>
</div>
</div>
</div>
</div>
{dataCubeStore.cubeViewer ? (
<>
<div className="h-[calc(100%_-_30px)]">
<div className="h-[calc(100%_-_30px)]">
<DataCube engine={dataCubeStore.cubeViewer.engine} />
</div>
</div>
</>
) : (
<>
<div
onClick={() => sourceSelector.openModal()}
className="bg-white shadow"
>
<div className="mx-auto h-40 px-4 py-6 sm:px-6 lg:px-8">
<div className="group flex w-full flex-col items-center justify-center rounded-md border-2 border-dashed border-slate-300 py-3 text-base font-medium leading-6 text-slate-900 hover:cursor-pointer hover:border-solid hover:border-blue-500 hover:bg-white hover:text-blue-500">
<svg
className="mb-1 text-slate-400 group-hover:text-blue-500"
width="20"
height="20"
fill="currentColor"
aria-hidden="true"
>
<path d="M10 5a1 1 0 0 1 1 1v3h3a1 1 0 1 1 0 2h-3v3a1 1 0 1 1-2 0v-3H6a1 1 0 1 1 0-2h3V6a1 1 0 0 1 1-1Z" />
</svg>
Add Source
</div>
</div>
</div>
</>
)}
</div>
</>
);
});
Loading

0 comments on commit 1df0be2

Please sign in to comment.