-
Notifications
You must be signed in to change notification settings - Fork 65
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(Template): Set up Standalone with Submodule Connection + Models (#…
…4748) * copied over templates for standalone * added templates library * changed templates lib to align with templates * added working UI of dev toolbox to templates * display serialized template json * added templates designer under libs * display template connections with button * used arm token to load logic app portal data * Added submodule for LogicAppsTemplates library * restructured templates standalone * moved templates to designer library * removed templates library * restructured designer library templates state * added the submodule to /sample folder & added data provider wrapper * added submodule properly & added loading manifestNames * added working maniests system loaded from github * cleanup * removed unused mocks * changed namespace of template model to Template * removed unusd workspace * Revert "removed unusd workspace" This reverts commit 8810321. * removed unused workspace only * fixed errors * resolved unimported imports * reflected NIT to keep the file clean --------- Co-authored-by: Travis Harris <travisharris@microsoft.com>
- Loading branch information
1 parent
ebad1be
commit 6c7ffba
Showing
24 changed files
with
2,030 additions
and
3,040 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,3 @@ | ||
[submodule "libs/designer/src/lib/core/templates/samples"] | ||
path = libs/designer/src/lib/core/templates/samples | ||
url = https://github.com/Azure/LogicAppsTemplates |
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
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
29 changes: 29 additions & 0 deletions
29
apps/Standalone/src/templates/app/TemplatesStandaloneDesigner.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,29 @@ | ||
import type { ReactNode } from 'react'; | ||
import { ReactQueryProvider, TemplatesDataProvider } from '@microsoft/logic-apps-designer'; | ||
import { loadToken } from '../../environments/environment'; | ||
import { DevToolbox } from '../components/DevToolbox'; | ||
import type { RootState } from '../state/Store'; | ||
import { TemplatesDesigner, TemplatesDesignerProvider } from '@microsoft/logic-apps-designer'; | ||
import { useQuery } from '@tanstack/react-query'; | ||
import { useSelector } from 'react-redux'; | ||
|
||
const LoadWhenArmTokenIsLoaded = ({ children }: { children: ReactNode }) => { | ||
const { isLoading } = useQuery(['armToken'], loadToken); | ||
return isLoading ? null : <>{children}</>; | ||
}; | ||
export const TemplatesStandaloneDesigner = () => { | ||
const theme = useSelector((state: RootState) => state.workflowLoader.theme); | ||
|
||
return ( | ||
<ReactQueryProvider> | ||
<LoadWhenArmTokenIsLoaded> | ||
<DevToolbox /> | ||
<TemplatesDesignerProvider locale="en-US" theme={theme}> | ||
<TemplatesDataProvider> | ||
<TemplatesDesigner /> | ||
</TemplatesDataProvider> | ||
</TemplatesDesignerProvider> | ||
</LoadWhenArmTokenIsLoaded> | ||
</ReactQueryProvider> | ||
); | ||
}; |
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,98 @@ | ||
import type { AppDispatch, RootState } from '../state/Store'; | ||
import type { IDropdownOption } from '@fluentui/react'; | ||
import { Dropdown, Stack, StackItem } from '@fluentui/react'; | ||
import { Accordion, AccordionHeader, AccordionItem, AccordionPanel, Tooltip, tokens } from '@fluentui/react-components'; | ||
import { Theme as ThemeType } from '@microsoft/logic-apps-shared'; | ||
import { useCallback, useState } from 'react'; | ||
import { useDispatch, useSelector } from 'react-redux'; | ||
import { AzureStandardLogicAppSelector } from '../../designer/app/AzureLogicAppsDesigner/LogicAppSelectionSetting/AzureStandardLogicAppSelector'; | ||
import { AzureConsumptionLogicAppSelector } from '../../designer/app/AzureLogicAppsDesigner/LogicAppSelectionSetting/AzureConsumptionLogicAppSelector'; | ||
import { useIsConsumption } from '../../designer/state/workflowLoadingSelectors'; | ||
import { ThemeProvider } from '@fluentui/react'; | ||
import { FluentProvider, webDarkTheme, webLightTheme } from '@fluentui/react-components'; | ||
import { AzureThemeDark } from '@fluentui/azure-themes/lib/azure/AzureThemeDark'; | ||
import { AzureThemeLight } from '@fluentui/azure-themes/lib/azure/AzureThemeLight'; | ||
import { workflowLoaderSlice } from '../state/WorkflowLoader'; | ||
|
||
const themeDropdownOptions = [ | ||
{ key: ThemeType.Light, text: 'Light' }, | ||
{ key: ThemeType.Dark, text: 'Dark' }, | ||
]; | ||
|
||
export const DevToolbox = () => { | ||
const dispatch = useDispatch<AppDispatch>(); | ||
|
||
const { theme } = useSelector((state: RootState) => state.workflowLoader); | ||
|
||
const [isTooltipVisible, setIsTooltipVisible] = useState<boolean>(false); | ||
const isLightMode = theme === ThemeType.Light; | ||
|
||
const changeThemeCB = useCallback( | ||
(_: unknown, item: IDropdownOption | undefined) => { | ||
dispatch(workflowLoaderSlice.actions.changeTheme((item?.key as ThemeType) ?? '')); | ||
}, | ||
[dispatch] | ||
); | ||
|
||
const isConsumption = useIsConsumption(); | ||
|
||
return ( | ||
<ThemeProvider theme={isLightMode ? AzureThemeLight : AzureThemeDark}> | ||
<FluentProvider theme={isLightMode ? webLightTheme : webDarkTheme}> | ||
<div style={{ marginBottom: '8px', backgroundColor: tokens.colorNeutralBackground2, padding: 4 }}> | ||
<Accordion defaultOpenItems={'1'} collapsible style={{ position: 'relative' }}> | ||
<Tooltip | ||
content="Clippy says hello!" | ||
relationship="label" | ||
positioning="below-start" | ||
withArrow | ||
showDelay={100} | ||
hideDelay={500} | ||
onVisibleChange={(_e, data) => setIsTooltipVisible(data.visible)} | ||
> | ||
<div | ||
style={{ | ||
position: 'absolute', | ||
top: 8, | ||
right: 12, | ||
padding: 4, | ||
backgroundColor: tokens.colorNeutralBackground4, | ||
borderRadius: tokens.borderRadiusMedium, | ||
zIndex: 10, | ||
cursor: 'pointer', | ||
}} | ||
> | ||
<span role="img" aria-label="Clippy!" style={{ fontSize: 20 }}> | ||
📎 | ||
</span>{' '} | ||
Tooltip tester! It's {isTooltipVisible ? 'visible' : 'hidden'} | ||
</div> | ||
</Tooltip> | ||
|
||
<AccordionItem value="1"> | ||
<AccordionHeader>Dev Toolbox</AccordionHeader> | ||
<AccordionPanel> | ||
<Stack horizontal tokens={{ childrenGap: '12px' }} wrap> | ||
<StackItem key={'themeDropDown'} style={{ width: '250px' }}> | ||
<Dropdown | ||
label="Theme" | ||
selectedKey={theme} | ||
onChange={changeThemeCB} | ||
placeholder="Select a theme" | ||
options={themeDropdownOptions} | ||
style={{ marginBottom: '12px' }} | ||
/> | ||
</StackItem> | ||
|
||
<StackItem style={{ width: '100%' }}> | ||
{isConsumption ? <AzureConsumptionLogicAppSelector /> : <AzureStandardLogicAppSelector />} | ||
</StackItem> | ||
</Stack> | ||
</AccordionPanel> | ||
</AccordionItem> | ||
</Accordion> | ||
</div> | ||
</FluentProvider> | ||
</ThemeProvider> | ||
); | ||
}; |
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,11 @@ | ||
import { workflowLoaderSlice } from './WorkflowLoader'; | ||
import { configureStore } from '@reduxjs/toolkit'; | ||
|
||
export const store = configureStore({ | ||
reducer: { | ||
workflowLoader: workflowLoaderSlice.reducer, // Aligning with Designer WorkflowLoader to utilize AppSelectors | ||
}, | ||
}); | ||
|
||
export type RootState = ReturnType<typeof store.getState>; | ||
export type AppDispatch = typeof store.dispatch; |
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,58 @@ | ||
/* eslint-disable @typescript-eslint/no-empty-function */ | ||
import type { PayloadAction } from '@reduxjs/toolkit'; | ||
import { createSlice } from '@reduxjs/toolkit'; | ||
import { Theme as ThemeType } from '@microsoft/logic-apps-shared'; | ||
|
||
export interface WorkflowLoadingState { | ||
resourcePath?: string; | ||
appId?: string; | ||
workflowName?: string; | ||
runId?: string; | ||
isConsumption: boolean; | ||
theme: ThemeType; | ||
} | ||
|
||
const initialState: WorkflowLoadingState = { | ||
appId: undefined, | ||
isConsumption: false, | ||
theme: ThemeType.Light, | ||
}; | ||
|
||
export const workflowLoaderSlice = createSlice({ | ||
name: 'workflowLoader', | ||
initialState, | ||
reducers: { | ||
setAppid: (state, action: PayloadAction<string>) => { | ||
state.appId = action.payload; | ||
}, | ||
setWorkflowName: (state, action: PayloadAction<string>) => { | ||
state.workflowName = action.payload; | ||
}, | ||
changeRunId: (state, action: PayloadAction<string>) => { | ||
state.runId = action.payload; | ||
}, | ||
setResourcePath: (state, action: PayloadAction<string>) => { | ||
state.resourcePath = action.payload; | ||
}, | ||
clearWorkflowDetails: (state) => { | ||
state.appId = undefined; | ||
state.workflowName = undefined; | ||
state.runId = undefined; | ||
state.resourcePath = ''; | ||
}, | ||
setConsumption: (state, action: PayloadAction<boolean>) => { | ||
state.isConsumption = action.payload; | ||
state.appId = undefined; | ||
state.workflowName = undefined; | ||
state.resourcePath = ''; | ||
}, | ||
changeTheme: (state, action: PayloadAction<ThemeType>) => { | ||
state.theme = action.payload; | ||
}, | ||
}, | ||
}); | ||
|
||
export const { setResourcePath, setAppid, setWorkflowName, clearWorkflowDetails, setConsumption, changeRunId } = | ||
workflowLoaderSlice.actions; | ||
|
||
export default workflowLoaderSlice.reducer; |
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
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
Oops, something went wrong.