generated from finos/software-project-blueprint
-
Notifications
You must be signed in to change notification settings - Fork 116
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* datacube: fix problem with no-column selected but drilldown with more than 1 col * pure ide: improvements
- Loading branch information
Showing
25 changed files
with
764 additions
and
151 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
'@finos/legend-application-pure-ide': patch | ||
'@finos/legend-application': patch | ||
'@finos/legend-data-cube': patch | ||
'@finos/legend-dev-utils': patch | ||
--- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
'@finos/legend-application-pure-ide': patch | ||
'@finos/legend-application': patch | ||
'@finos/legend-data-cube': patch | ||
'@finos/legend-dev-utils': patch | ||
'@finos/legend-lego': patch | ||
--- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
112 changes: 112 additions & 0 deletions
112
...ges/legend-application-pure-ide/src/components/command-center/SelectPCTAdapterCommand.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,112 @@ | ||
/** | ||
* 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 { | ||
compareLabelFn, | ||
CustomSelectorInput, | ||
Dialog, | ||
type SelectComponent, | ||
} from '@finos/legend-art'; | ||
import { useApplicationStore } from '@finos/legend-application'; | ||
import { usePureIDEStore } from '../PureIDEStoreProvider.js'; | ||
import { flowResult } from 'mobx'; | ||
import type { PCTAdapter } from '../../server/models/Test.js'; | ||
import { useRef, useState } from 'react'; | ||
|
||
function buildPCTAdapterOption(adapter: PCTAdapter) { | ||
return { | ||
label: adapter.name === '' ? adapter.func : adapter.name, | ||
value: adapter, | ||
}; | ||
} | ||
|
||
export const SelectPCTAdapterCommand = observer(() => { | ||
const ideStore = usePureIDEStore(); | ||
const applicationStore = useApplicationStore(); | ||
const selectorRef = useRef<SelectComponent>(null); | ||
const [menuOpen, setMenuOpen] = useState(false); | ||
|
||
const closeModal = (): void => ideStore.setPCTRunPath(undefined); | ||
const runPCT = (val: { label: string; value: PCTAdapter } | null): void => { | ||
if (val) { | ||
ideStore.setSelectedPCTAdapter(val.value); | ||
if (ideStore.PCTRunPath) { | ||
flowResult( | ||
ideStore.executeTests( | ||
ideStore.PCTRunPath, | ||
false, | ||
ideStore.selectedPCTAdapter?.func, | ||
), | ||
).catch(applicationStore.alertUnhandledError); | ||
} | ||
closeModal(); | ||
} | ||
}; | ||
const handleEnter = (): void => { | ||
selectorRef.current?.focus(); | ||
}; | ||
|
||
return ( | ||
<Dialog | ||
open={Boolean(ideStore.PCTRunPath)} | ||
onClose={closeModal} | ||
TransitionProps={{ | ||
onEnter: handleEnter, | ||
}} | ||
classes={{ container: 'command-modal__container' }} | ||
PaperProps={{ classes: { root: 'command-modal__inner-container' } }} | ||
> | ||
<div className="modal modal--dark command-modal"> | ||
<div className="modal__title">Select PCT Adapter</div> | ||
<div className="command-modal__content"> | ||
<CustomSelectorInput | ||
inputRef={selectorRef} | ||
className="command-modal__content__input" | ||
options={ideStore.PCTAdapters.map(buildPCTAdapterOption).sort( | ||
compareLabelFn, | ||
)} | ||
onMenuOpen={() => setMenuOpen(true)} | ||
onMenuClose={() => setMenuOpen(false)} | ||
onKeyDown={(event) => { | ||
if ( | ||
event.key === 'Enter' && | ||
ideStore.selectedPCTAdapter && | ||
!menuOpen | ||
) { | ||
event.stopPropagation(); | ||
event.preventDefault(); | ||
runPCT(buildPCTAdapterOption(ideStore.selectedPCTAdapter)); | ||
} | ||
}} | ||
value={ | ||
ideStore.selectedPCTAdapter | ||
? buildPCTAdapterOption(ideStore.selectedPCTAdapter) | ||
: null | ||
} | ||
onChange={runPCT} | ||
placeholder="Select a PCT adapter" | ||
escapeClearsValue={true} | ||
darkMode={ | ||
!applicationStore.layoutService | ||
.TEMPORARY__isLightColorThemeEnabled | ||
} | ||
/> | ||
</div> | ||
</div> | ||
</Dialog> | ||
); | ||
}); |
Oops, something went wrong.