-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
18 changed files
with
304 additions
and
59 deletions.
There are no files selected for viewing
81 changes: 81 additions & 0 deletions
81
src/apps/editor/components/box-concurrency/box-concurrency.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,81 @@ | ||
import React, { useRef } from 'react'; | ||
|
||
import { | ||
Draggable, | ||
DraggableTitle, | ||
DraggableWrapper, | ||
Input, | ||
Label, | ||
Toggle, | ||
VCol, | ||
} from '@/aero'; | ||
import { Positions } from '@/editor/config'; | ||
import { useOptionalSection, useWorkflowConcurrency } from '@/editor/stores'; | ||
|
||
import { Max } from './max'; | ||
|
||
export const ConcurrencyContent = React.forwardRef<HTMLDivElement>((_, ref) => { | ||
const { | ||
concurrency: { cancelInProgress, group }, | ||
onChangeGroup, | ||
toggleCancelInProgress, | ||
} = useWorkflowConcurrency(); | ||
|
||
const handleOnChangeGroup = (e: React.ChangeEvent<HTMLInputElement>) => { | ||
onChangeGroup(e.target.value); | ||
}; | ||
|
||
return ( | ||
<DraggableWrapper> | ||
<VCol | ||
ref={ref} | ||
variant="md" | ||
className="relative px-3 pb-3" | ||
align="between" | ||
> | ||
<DraggableWrapper> | ||
<Toggle | ||
text="Cancel in progress" | ||
value={cancelInProgress} | ||
onClick={toggleCancelInProgress} | ||
/> | ||
<VCol variant="md"> | ||
<Label className="text-muted-foreground">Group</Label> | ||
<Input | ||
placeholder="workflow-name" | ||
value={group} | ||
onChange={handleOnChangeGroup} | ||
/> | ||
</VCol> | ||
<Max /> | ||
<Label className="text-muted-foreground"> | ||
Matrix (available soon) | ||
</Label> | ||
</DraggableWrapper> | ||
</VCol> | ||
</DraggableWrapper> | ||
); | ||
}); | ||
|
||
export const BoxConcurrency: React.FC = () => { | ||
const innerRef = useRef(null); | ||
const { osConcurrency } = useOptionalSection('osConcurrency'); | ||
|
||
return osConcurrency ? ( | ||
<DraggableWrapper> | ||
<Draggable | ||
innerRef={innerRef} | ||
initialX={Positions.BoxEnvX} | ||
initialY={Positions.BoxEnvY} | ||
visible={({ ref, onExpand }) => ( | ||
<DraggableWrapper> | ||
<div ref={ref}> | ||
<DraggableTitle title="Concurrency" onExpand={onExpand} /> | ||
</div> | ||
</DraggableWrapper> | ||
)} | ||
invisible={({ ref }) => <ConcurrencyContent ref={ref} />} | ||
/> | ||
</DraggableWrapper> | ||
) : null; | ||
}; |
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 @@ | ||
export { BoxConcurrency } from './box-concurrency'; |
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,27 @@ | ||
import React from 'react'; | ||
|
||
import { Input, Label, VCol } from '@/aero'; | ||
import { useAdvancedInput } from '@/editor/hooks'; | ||
import { useWorkflowConcurrency } from '@/editor/stores'; | ||
|
||
export const Max: React.FC = () => { | ||
const { | ||
concurrency: { max }, | ||
onChangeMax, | ||
} = useWorkflowConcurrency(); | ||
|
||
const handleOnChange = (e: React.ChangeEvent<HTMLInputElement>) => { | ||
onChangeMax(+e.target.value); | ||
}; | ||
|
||
const { onKeyDown } = useAdvancedInput(String(max), { | ||
numOnly: true, | ||
}); | ||
|
||
return ( | ||
<VCol variant="md"> | ||
<Label className="text-muted-foreground">Max</Label> | ||
<Input onKeyDown={onKeyDown} onChange={handleOnChange} placeholder="2" /> | ||
</VCol> | ||
); | ||
}; |
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
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
63 changes: 34 additions & 29 deletions
63
src/apps/editor/components/optional-sections/optional-sections.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 |
---|---|---|
@@ -1,40 +1,45 @@ | ||
import React from 'react'; | ||
|
||
import { AppearTransition, Label, VCol } from '@/aero'; | ||
import { useFeatureSwitch } from '@/editor/stores'; | ||
|
||
import { OptionalSection } from './optional-section'; | ||
|
||
type Props = { | ||
show?: boolean; | ||
}; | ||
|
||
export const OptionalSections: React.FC<Props> = ({ show = false }) => ( | ||
<AppearTransition as={React.Fragment} show={show}> | ||
<div className="absolute transition-all top-14 w-[300px] min-h-[140px] bg-card px-3 py-2 border rounded-lg -translate-x-1/4"> | ||
<VCol variant="md"> | ||
<VCol variant="xs"> | ||
<p className="font-semibold">Enabled sections</p> | ||
<Label> | ||
There are some configurations that are not strictly required, such | ||
as the pemissions. In case you want to show them, enable them | ||
through this menu. | ||
</Label> | ||
</VCol> | ||
<VCol className="w-full" align="between"> | ||
<OptionalSection text="Permissions" section="osPermissions" /> | ||
<OptionalSection text="Env" section="osEnv" /> | ||
<OptionalSection | ||
text="Defaults (coming soon)" | ||
section="osDefaults" | ||
disabled | ||
/> | ||
<OptionalSection | ||
text="Concurrency (coming soon)" | ||
section="osConcurrency" | ||
disabled | ||
/> | ||
export const OptionalSections: React.FC<Props> = ({ show = false }) => { | ||
const { fsConcurrency } = useFeatureSwitch('fsConcurrency'); | ||
|
||
return ( | ||
<AppearTransition as={React.Fragment} show={show}> | ||
<div className="absolute transition-all top-14 w-[300px] min-h-[140px] bg-card px-3 py-2 border rounded-lg -translate-x-1/4"> | ||
<VCol variant="md"> | ||
<VCol variant="xs"> | ||
<p className="font-semibold">Enabled sections</p> | ||
<Label> | ||
There are some configurations that are not strictly required, such | ||
as the pemissions. In case you want to show them, enable them | ||
through this menu. | ||
</Label> | ||
</VCol> | ||
<VCol className="w-full" align="between"> | ||
<OptionalSection text="Permissions" section="osPermissions" /> | ||
<OptionalSection text="Env" section="osEnv" /> | ||
<OptionalSection | ||
text="Defaults (coming soon)" | ||
section="osDefaults" | ||
disabled | ||
/> | ||
<OptionalSection | ||
text={`Concurrency ${!fsConcurrency ? '(coming soon)' : ''}`} | ||
section="osConcurrency" | ||
disabled={!fsConcurrency} | ||
/> | ||
</VCol> | ||
</VCol> | ||
</VCol> | ||
</div> | ||
</AppearTransition> | ||
); | ||
</div> | ||
</AppearTransition> | ||
); | ||
}; |
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
38 changes: 38 additions & 0 deletions
38
src/apps/editor/components/visualiser/sections/workflow-concurrency.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,38 @@ | ||
import React from 'react'; | ||
|
||
import { Keyword, Line, Tabbed } from '@/aero'; | ||
import { useWorkflowConcurrency } from '@/editor/stores'; | ||
|
||
export const WorkflowConcurrency: React.FC = () => { | ||
const { | ||
concurrency: { cancelInProgress, group, max }, | ||
} = useWorkflowConcurrency(); | ||
|
||
const anyConcurrency = cancelInProgress || group !== '' || max > 0; | ||
if (!anyConcurrency) { | ||
return null; | ||
} | ||
|
||
return ( | ||
<> | ||
<Line> | ||
<Keyword>concurrency</Keyword>: | ||
</Line> | ||
{cancelInProgress ? ( | ||
<Tabbed tabs={2}> | ||
<Keyword>cancel-in-progress</Keyword>: true | ||
</Tabbed> | ||
) : null} | ||
{group !== '' ? ( | ||
<Tabbed tabs={2}> | ||
<Keyword>group</Keyword>: {group} | ||
</Tabbed> | ||
) : null} | ||
{max > 0 ? ( | ||
<Tabbed tabs={2}> | ||
<Keyword>max</Keyword>: {max} | ||
</Tabbed> | ||
) : null} | ||
</> | ||
); | ||
}; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,5 @@ | ||
export type FeatureSwitches = 'fsGlobalDrag' | 'fsDarkTheme' | 'fsCopyAction'; | ||
export type FeatureSwitches = | ||
| 'fsGlobalDrag' | ||
| 'fsDarkTheme' | ||
| 'fsCopyAction' | ||
| 'fsConcurrency'; |
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
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.