Skip to content

Commit 4d33571

Browse files
Merge pull request #1915 from devtron-labs/feat/create-plugin
feat: create plugin
2 parents adac62f + 526a681 commit 4d33571

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+2192
-386
lines changed

.eslintignore

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ src/components/CIPipelineN/EnvironmentList.tsx
5555
src/components/CIPipelineN/InputPluginSelect.tsx
5656
src/components/CIPipelineN/MultiplsPort.tsx
5757
src/components/CIPipelineN/OutputDirectoryPath.tsx
58-
src/components/CIPipelineN/PluginCard.tsx
5958
src/components/CIPipelineN/PreBuild.tsx
6059
src/components/CIPipelineN/Sidebar.tsx
6160
src/components/CIPipelineN/TaskDetailComponent.tsx
@@ -269,7 +268,6 @@ src/components/common/DatePickers/Calender.tsx
269268
src/components/common/DatePickers/DayPickerRangeController.tsx
270269
src/components/common/DeprecatedUpdateWarn.tsx
271270
src/components/common/Description/GenericDescription.tsx
272-
src/components/common/DetectBottom.tsx
273271
src/components/common/DynamicTabs/__tests__/DynamicTabs.test.tsx
274272
src/components/common/ExportToCsv/ExportToCsv.tsx
275273
src/components/common/FloatingVariablesSuggestions/FloatingVariablesSuggestions.tsx

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"private": true,
55
"homepage": "/dashboard",
66
"dependencies": {
7-
"@devtron-labs/devtron-fe-common-lib": "0.2.22",
7+
"@devtron-labs/devtron-fe-common-lib": "0.2.24",
88
"@esbuild-plugins/node-globals-polyfill": "0.2.3",
99
"@rjsf/core": "^5.13.3",
1010
"@rjsf/utils": "^5.13.3",

src/assets/icons/ic-asterisk.svg

Lines changed: 11 additions & 0 deletions
Loading

src/assets/icons/ic-lego-block.svg

Lines changed: 20 additions & 0 deletions
Loading

src/assets/icons/ic-save.svg

Lines changed: 3 additions & 12 deletions
Loading

src/assets/img/[email protected]

-14.2 KB
Binary file not shown.

src/assets/img/[email protected]

15.5 KB
Loading
-28.2 KB
Binary file not shown.

src/components/CIPipelineN/CIPipeline.tsx

Lines changed: 39 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ import {
2626
RefVariableType,
2727
VariableType,
2828
MandatoryPluginDataType,
29-
MandatoryPluginDetailType,
3029
ButtonWithLoader,
3130
PluginDataStoreType,
3231
ProcessPluginDataReturnType,
@@ -35,6 +34,11 @@ import {
3534
getPluginsDetail,
3635
ErrorScreenManager,
3736
getUpdatedPluginStore,
37+
ModuleNameMap,
38+
SourceTypeMap,
39+
DEFAULT_ENV,
40+
getEnvironmentListMinPublic,
41+
ModuleStatus,
3842
Environment,
3943
PipelineFormType,
4044
} from '@devtron-labs/devtron-fe-common-lib'
@@ -50,11 +54,9 @@ import {
5054
BuildStageVariable,
5155
BuildTabText,
5256
JobPipelineTabText,
53-
ModuleNameMap,
5457
TriggerType,
5558
URLS,
5659
ViewType,
57-
SourceTypeMap,
5860
} from '../../config'
5961
import {
6062
deleteCIPipeline,
@@ -71,14 +73,11 @@ import { Sidebar } from './Sidebar'
7173
import { Build } from './Build'
7274
import { ReactComponent as WarningTriangle } from '../../assets/icons/ic-warning.svg'
7375
import { getModuleInfo } from '../v2/devtronStackManager/DevtronStackManager.service'
74-
import { ModuleStatus } from '../v2/devtronStackManager/DevtronStackManager.type'
7576
import { MULTI_REQUIRED_FIELDS_MSG } from '../../config/constantMessaging'
7677
import { LoadingState } from '../ciConfig/types'
7778
import { pipelineContext } from '../workflowEditor/workflowEditor'
7879
import { calculateLastStepDetailsLogic, checkUniqueness, validateTask } from '../cdPipeline/cdpipeline.util'
7980
import { PipelineContext, PipelineFormDataErrorType } from '../workflowEditor/types'
80-
import { getEnvironmentListMinPublic } from '../../services/service'
81-
import { DEFAULT_ENV } from '../app/details/triggerView/Constants'
8281

8382
const processPluginData = importComponentFromFELibrary('processPluginData', null, 'function')
8483
const validatePlugins = importComponentFromFELibrary('validatePlugins', null, 'function')
@@ -203,11 +202,13 @@ export default function CIPipeline({
203202
structuredClone(DEFAULT_PLUGIN_DATA_STORE),
204203
)
205204
const [availableTags, setAvailableTags] = useState<string[]>([])
205+
const [hideScopedVariableWidget, setHideScopedVariableWidget] = useState<boolean>(false)
206+
const [disableParentModalClose, setDisableParentModalClose] = useState<boolean>(false)
206207

207208
const selectedBranchRef = useRef(null)
208209

209-
const mandatoryPluginsMap: Record<number, MandatoryPluginDetailType> = useMemo(() => {
210-
const _mandatoryPluginsMap: Record<number, MandatoryPluginDetailType> = {}
210+
const mandatoryPluginsMap: PipelineContext['mandatoryPluginsMap'] = useMemo(() => {
211+
const _mandatoryPluginsMap: PipelineContext['mandatoryPluginsMap'] = {}
211212
if (mandatoryPluginData?.pluginData.length) {
212213
for (const plugin of mandatoryPluginData.pluginData) {
213214
_mandatoryPluginsMap[plugin.parentPluginId] = plugin
@@ -224,6 +225,18 @@ export default function CIPipeline({
224225
)
225226
}
226227

228+
const handleHideScopedVariableWidgetUpdate: PipelineContext['handleHideScopedVariableWidgetUpdate'] = (
229+
hideScopedVariableWidgetValue: boolean,
230+
) => {
231+
setHideScopedVariableWidget(hideScopedVariableWidgetValue)
232+
}
233+
234+
const handleDisableParentModalCloseUpdate: PipelineContext['handleDisableParentModalCloseUpdate'] = (
235+
disableParentModalCloseValue: boolean,
236+
) => {
237+
setDisableParentModalClose(disableParentModalCloseValue)
238+
}
239+
227240
const handleUpdateAvailableTags: PipelineContext['handleUpdateAvailableTags'] = (tags) => {
228241
setAvailableTags(tags)
229242
}
@@ -521,6 +534,10 @@ export default function CIPipeline({
521534
}, [location.pathname, ciPipeline.pipelineType])
522535

523536
const handleClose = () => {
537+
if (disableParentModalClose) {
538+
return null
539+
}
540+
524541
close()
525542
}
526543

@@ -737,7 +754,7 @@ export default function CIPipeline({
737754
<NavLink
738755
data-testid={`${toLink}-button`}
739756
replace
740-
className="tab-list__tab-link fs-13 pt-5 pb-5 flexbox"
757+
className="tab-list__tab-link fs-13 pt-0 pb-8 flexbox"
741758
activeClassName="active"
742759
to={toLink}
743760
onClick={() => {
@@ -747,7 +764,7 @@ export default function CIPipeline({
747764
{isJobCard ? JobPipelineTabText[stageName] : BuildTabText[stageName]}
748765
{(showAlert || showWarning) && (
749766
<WarningTriangle
750-
className={`icon-dim-16 mr-5 ml-5 mt-3 ${
767+
className={`icon-dim-16 mr-5 ml-5 mt-2 ${
751768
showAlert ? 'alert-icon-r5-imp' : 'warning-icon-y7-imp'
752769
}`}
753770
/>
@@ -780,6 +797,9 @@ export default function CIPipeline({
780797
pageState,
781798
availableTags,
782799
handleUpdateAvailableTags,
800+
handleHideScopedVariableWidgetUpdate,
801+
handleDisableParentModalCloseUpdate,
802+
mandatoryPluginsMap,
783803
}
784804
}, [
785805
formData,
@@ -792,6 +812,7 @@ export default function CIPipeline({
792812
globalVariables,
793813
pluginDataStore,
794814
availableTags,
815+
mandatoryPluginsMap,
795816
])
796817

797818
const renderCIPipelineModalContent = () => {
@@ -827,7 +848,6 @@ export default function CIPipeline({
827848
isJobCI={isJobCI}
828849
mandatoryPluginData={mandatoryPluginData}
829850
setInputVariablesListFromPrevStep={setInputVariablesListFromPrevStep}
830-
mandatoryPluginsMap={mandatoryPluginsMap}
831851
environments={environments}
832852
selectedEnv={selectedEnv}
833853
setSelectedEnv={setSelectedEnv}
@@ -837,12 +857,12 @@ export default function CIPipeline({
837857
<Switch>
838858
{isAdvanced && (
839859
<Route path={`${path}/pre-build`}>
840-
<PreBuild isJobView={isJobCard} mandatoryPluginsMap={mandatoryPluginsMap} />
860+
<PreBuild isJobView={isJobCard} />
841861
</Route>
842862
)}
843863
{isAdvanced && (
844864
<Route path={`${path}/post-build`}>
845-
<PreBuild mandatoryPluginsMap={mandatoryPluginsMap} />
865+
<PreBuild />
846866
</Route>
847867
)}
848868
<Route path={`${path}/build`}>
@@ -901,7 +921,7 @@ export default function CIPipeline({
901921
isAdvanced ? 'advanced-option-container' : 'bottom-border-radius'
902922
}`}
903923
>
904-
<div className="flex flex-align-center flex-justify bcn-0 py-12 pr-20 pl-20">
924+
<div className="flex flex-align-center flex-justify bcn-0 py-12 px-20">
905925
<h2 className="fs-16 fw-6 lh-1-43 m-0" data-testid="build-pipeline-heading">
906926
{title}
907927
</h2>
@@ -917,7 +937,11 @@ export default function CIPipeline({
917937
}
918938

919939
const renderFloatingVariablesWidget = () => {
920-
if (!window._env_.ENABLE_SCOPED_VARIABLES || activeStageName === BuildStageVariable.Build) {
940+
if (
941+
!window._env_.ENABLE_SCOPED_VARIABLES ||
942+
activeStageName === BuildStageVariable.Build ||
943+
hideScopedVariableWidget
944+
) {
921945
return <></>
922946
}
923947

src/components/CIPipelineN/Constants.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,3 +49,8 @@ export const triggerStageStyles = {
4949
export const TIPPY_VAR_MSG = 'This is a variable. It will be replaced with the value during execution.'
5050

5151
export const excludeVariables = ['DOCKER_IMAGE_TAG', 'DOCKER_IMAGE']
52+
53+
export const INLINE_PLUGIN_TEXT = {
54+
TITLE: 'Execute custom task',
55+
DESCRIPTION: 'Write a script to perform custom task or create custom plugin',
56+
}

0 commit comments

Comments
 (0)