Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BIVS-2905] Step bundles, iteration 1: Edit, remove and drag a Step bundle #1353

Merged
merged 37 commits into from
Dec 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
1e2cc7e
Edit and remove a Step bundle
Dec 5, 2024
f4ac732
Merge branch 'master' into BIVS-2905-step-bundles
Dec 5, 2024
ad7c309
Styling
Dec 5, 2024
e07affa
Edit a step bundle
Dec 9, 2024
170c03b
Merge branch 'master' into BIVS-2905-step-bundles
Dec 9, 2024
1c0e5af
Merge branch 'master' into BIVS-2905-step-bundles
Dec 9, 2024
233e16f
Merge branch 'master' into BIVS-2905-step-bundles
Dec 10, 2024
4b67821
Add step to a step bundle
Dec 10, 2024
b662923
Edit and rename a step bundle
Dec 10, 2024
aefb187
Merge branch 'master' into BIVS-2905-step-bundles
Dec 10, 2024
69deced
useRenameStepBundle
Dec 10, 2024
2f01c32
Rename a step bundle
Dec 10, 2024
0c44633
Refactor useRenameStepBundle
Dec 10, 2024
d601050
Rename step bundles
Dec 11, 2024
8e92413
Remove Properties tab
Dec 11, 2024
16e93fe
useStepBundle
Dec 11, 2024
3925e90
Added feature flag to StepBundleDrawer
Dec 11, 2024
91573a9
Edit a step bundle on Pipelines page
Dec 11, 2024
8e8b9ae
Add step or step bundle on Pipelines page
Dec 11, 2024
852dd6d
Drag a Step bundle card
Dec 11, 2024
5e8d221
Merge branch 'master' into BIVS-2905-step-bundles
Dec 11, 2024
0de415f
Move step cards in step bundle cards
Dec 11, 2024
da02f8f
Merge branch 'master' into BIVS-2905-step-bundles
Dec 12, 2024
31d6925
Styling
Dec 12, 2024
bc2853e
Merge branch 'master' into BIVS-2905-step-bundles
Dec 12, 2024
089be47
Clone and remove a step from a step bundle
Dec 12, 2024
4b0590a
Clone steps in a step bundle, styling
Dec 13, 2024
5c429dc
Merge branch 'master' into BIVS-2905-step-bundles
Dec 13, 2024
101548f
Modify handleStepActionDialogChange
Dec 16, 2024
eb71dca
Merge branch 'master' into BIVS-2905-step-bundles
Dec 16, 2024
497df62
Fixes
Dec 16, 2024
2f4a35e
New Bitkit version
Dec 17, 2024
e8df199
Imports
Dec 17, 2024
dd5854b
Fix
Dec 17, 2024
041c6d7
Added tests to BitriseYMLService
Dec 17, 2024
9872572
Added stories
Dec 18, 2024
9bd1d09
Merge branch 'master' into BIVS-2905-step-bundles
Dec 18, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
127 changes: 63 additions & 64 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
"stepDefinitions": "spec/integration"
},
"dependencies": {
"@bitrise/bitkit": "^13.179.0",
"@bitrise/bitkit": "^13.188.0",
"@bitrise/react2angular": "^5.0.0",
"@bitrise/steplib-search": "^2.3.0",
"@chakra-ui/react": "^2.8.2",
Expand Down
2 changes: 1 addition & 1 deletion source/javascripts/components/_Step.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@

Step.prototype.displayName = function () {
if (this.isStepBundle()) {
return "Step bundle: " + this.cvs.replace("bundle::", "");
return this.cvs.replace("bundle::", "");
}
if (this.isWithBlock()) {
return "With group";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,26 @@ import FloatingDrawer, {
FloatingDrawerHeader,
FloatingDrawerProps,
} from '@/components/unified-editor/FloatingDrawer/FloatingDrawer';
import useDependantWorkflows from '@/hooks/useDependantWorkflows';
import StepBundleService from '@/core/models/StepBundleService';
import useFeatureFlag from '@/hooks/useFeatureFlag';
import useNavigation from '@/hooks/useNavigation';
import StepBundlePropertiesTab from './StepBundlePropertiesTab';

type Props = Omit<FloatingDrawerProps, 'children'> & {
workflowId: string;
stepIndex: number;
};

const StepBundleDrawer = ({ workflowId, stepIndex, ...props }: Props) => {
const { replace } = useNavigation();
const { data } = useStep({ workflowId, stepIndex });
const defaultStepLibrary = useDefaultStepLibrary();
const stepBundleId = data?.title;
const dependants = useDependantWorkflows({ stepBundleCvs: `bundle::${stepBundleId}` });
const usedInWorkflowsText = StepBundleService.getUsedByText(dependants.length);
const { replace } = useNavigation();
const enableStepBundles = useFeatureFlag('enable-wfe-step-bundles-ui') && stepBundleId;

const title = data?.title;
const isStepBundle = StepService.isStepBundle(data?.cvs || '', defaultStepLibrary, data?.userValues);

if (!isStepBundle || !data) {
Expand All @@ -34,22 +41,31 @@ const StepBundleDrawer = ({ workflowId, stepIndex, ...props }: Props) => {
<FloatingDrawerCloseButton />
<FloatingDrawerHeader>
<Text as="h3" textStyle="heading/h3">
{title}
{enableStepBundles ? stepBundleId : `Step bundle: ${stepBundleId}`}
</Text>
{enableStepBundles && (
<Text color="text/secondary" textStyle="body/md/regular">
{usedInWorkflowsText}
</Text>
)}
</FloatingDrawerHeader>
<FloatingDrawerBody>
<Notification
action={{
label: 'Go to YAML page',
onClick: () => replace('/yml'),
}}
status="info"
>
<Text textStyle="comp/notification/title">Edit step bundle configuration</Text>
<Text textStyle="comp/notification/message">
View more details or edit step bundle configuration in the Configuration YAML page.
</Text>
</Notification>
{enableStepBundles ? (
<StepBundlePropertiesTab stepBundleId={stepBundleId} />
) : (
<Notification
action={{
label: 'Go to YAML page',
onClick: () => replace('/yml'),
}}
status="info"
>
<Text textStyle="comp/notification/title">Edit step bundle configuration</Text>
<Text textStyle="comp/notification/message">
View more details or edit step bundle configuration in the Configuration YAML page.
</Text>
</Notification>
)}
</FloatingDrawerBody>
</FloatingDrawerContent>
</FloatingDrawer>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import EditableInput from '@/components/EditableInput/EditableInput';
import StepBundleService from '@/core/models/StepBundleService';
import { useStepBundles } from '@/hooks/useStepBundles';
import useRenameStepBundle from './hooks/useRenameStepBundle';

type StepBundlesPropertiesTabProps = {
stepBundleId: string;
};

const StepBundlesPropertiesTab = (props: StepBundlesPropertiesTabProps) => {
const { stepBundleId } = props;

const stepBundles = useStepBundles();
const stepBundleIds = Object.keys(stepBundles);

const handleNameChange = useRenameStepBundle(stepBundleId);

return (
<EditableInput
isRequired
name="name"
label="Name"
value={stepBundleId}
sanitize={StepBundleService.sanitizeName}
validate={(v) => StepBundleService.validateName(v, stepBundleId, stepBundleIds)}
onCommit={handleNameChange}
/>
);
};

export default StepBundlesPropertiesTab;
Loading