Skip to content

Commit

Permalink
feat: Add ansible framework option (#311)
Browse files Browse the repository at this point in the history
  • Loading branch information
callmevladik authored and SergK committed Jul 26, 2024
1 parent 4004b31 commit e579091
Show file tree
Hide file tree
Showing 18 changed files with 216 additions and 8 deletions.
1 change: 1 addition & 0 deletions src/configs/codebase-mappings/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ export const CODEBASE_COMMON_FRAMEWORKS = {
GIN: 'gin',
AWS: 'aws',
GIT_OPS: 'gitops',
ANSIBLE: 'ansible'
} as const;

export const CODEBASE_COMMON_BUILD_TOOLS = {
Expand Down
5 changes: 5 additions & 0 deletions src/configs/codebase-mappings/library/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,11 @@ export const LIBRARY_MAPPING: LibraryMapping = {
value: CODEBASE_COMMON_FRAMEWORKS.PYTHON_3_8,
icon: FRAMEWORK_ICON_MAPPING[CODEBASE_COMMON_FRAMEWORKS.PYTHON_3_8],
},
[CODEBASE_COMMON_FRAMEWORKS.ANSIBLE]: {
name: 'Ansible',
value: CODEBASE_COMMON_FRAMEWORKS.ANSIBLE,
icon: FRAMEWORK_ICON_MAPPING[CODEBASE_COMMON_FRAMEWORKS.ANSIBLE],
},
},
buildTools: {
[CODEBASE_COMMON_BUILD_TOOLS.PYTHON]: {
Expand Down
1 change: 1 addition & 0 deletions src/configs/icon-mappings/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ export const FRAMEWORK_ICON_MAPPING = {
[CODEBASE_COMMON_FRAMEWORKS.GIN]: RESOURCE_ICON_NAMES.GIN,
[CODEBASE_COMMON_FRAMEWORKS.ANTORA]: RESOURCE_ICON_NAMES.ANTORA,
[CODEBASE_COMMON_FRAMEWORKS.GIT_OPS]: RESOURCE_ICON_NAMES.GIT_OPS,
[CODEBASE_COMMON_FRAMEWORKS.ANSIBLE]: RESOURCE_ICON_NAMES.ANSIBLE,
} as const;

export const BUILD_TOOL_ICON_MAPPING = {
Expand Down
1 change: 1 addition & 0 deletions src/icons/iconify-icons-mapping.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,4 +73,5 @@ export enum ICONS {
KEY = 'solar:key-bold',
REDO = 'uil:redo',
CANCEL = 'mdi:cancel-bold',
QUEUE = 'hugeicons:queue-02',
}
2 changes: 2 additions & 0 deletions src/icons/sprites/Resources/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React from 'react';
import {
Angular,
Ansible,
Antora,
AWS,
Beego,
Expand Down Expand Up @@ -49,6 +50,7 @@ export const Resources = () => {
xmlnsXlink="http://www.w3.org/1999/xlink"
display={'none'}
>
<Ansible />
<Beego />
<Codenarc />
<Container />
Expand Down
1 change: 1 addition & 0 deletions src/icons/sprites/Resources/names.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,5 +39,6 @@ export const RESOURCE_ICON_NAMES = {
HARBOR: 'harbor',
OPENSHIFT: 'openshift',
NEXUS: 'nexus',
ANSIBLE: 'ansible',
OTHER: 'other',
} as const;
13 changes: 13 additions & 0 deletions src/icons/sprites/Resources/symbols/Ansible.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import React from 'react';
import { RESOURCE_ICON_NAMES } from '../names';

export const Ansible = () => {
return (
<symbol id={RESOURCE_ICON_NAMES.ANSIBLE} viewBox="0 0 24 24" xmlSpace="preserve">
<path
d="M10.617 11.473l4.686 3.695-3.102-7.662zM12 0C5.371 0 0 5.371 0 12s5.371 12 12 12 12-5.371 12-12S18.629 0 12 0zm5.797 17.305c-.011.471-.403.842-.875.83-.236 0-.416-.09-.664-.293l-6.19-5-2.079 5.203H6.191L11.438 5.44c.124-.314.427-.52.764-.506.326-.014.63.189.742.506l4.774 11.494c.045.111.08.234.08.348-.001.009-.001.009-.001.023z"
fill="#000"
/>
</symbol>
);
};
1 change: 1 addition & 0 deletions src/icons/sprites/Resources/symbols/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,4 @@ export * from './ECR';
export * from './Harbor';
export * from './Openshift';
export * from './Nexus';
export * from './Ansible';
2 changes: 1 addition & 1 deletion src/k8s/TaskRun/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ export class TaskRunKubeObject extends K8s.cluster.makeKubeObject<TaskRunKubeObj
case TASK_RUN_STEP_STATUS.RUNNING:
return [ICONS.LOADER_CIRCLE, STATUS_COLOR.IN_PROGRESS, true];
case TASK_RUN_STEP_STATUS.WAITING:
return [ICONS.LOADER_CIRCLE, STATUS_COLOR.IN_PROGRESS, true];
return [ICONS.QUEUE, STATUS_COLOR.UNKNOWN];
case TASK_RUN_STEP_STATUS.TERMINATED:
if (_reason === TASK_RUN_STEP_REASON.COMPLETED) {
return [ICONS.CHECK_CIRCLE, STATUS_COLOR.SUCCESS];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,24 @@ import {
StyledAccordionSummary,
} from '../../../../styles';

export function updateUnexecutedSteps(steps) {
if (!steps) {
return steps;
}
let errorIndex = steps.length - 1;
return steps.map((step, index) => {
if (!step.terminated || step.terminated.reason !== 'Completed') {
errorIndex = Math.min(index, errorIndex);
}
if (index > errorIndex) {
// eslint-disable-next-line no-unused-vars
const { running, terminated, ...rest } = step;
return { ...rest };
}
return step;
});
}

export const MenuAccordion = ({ taskRunName, taskRunListByNameMap, setQueryParams }) => {
const location = useLocation();
const queryParams = new URLSearchParams(location.search);
Expand All @@ -28,7 +46,7 @@ export const MenuAccordion = ({ taskRunName, taskRunListByNameMap, setQueryParam

const [icon, color, isRotating] = TaskRunKubeObject.getStatusIcon(taskRunStatus, taskRunReason);

const taskRunSteps = taskRun?.status?.steps;
const taskRunSteps = updateUnexecutedSteps(taskRun?.status?.steps);
const isExpanded = queryParamTaskRun === taskRunName;
const isActive = queryParamTaskRun === taskRunName && !queryParamStep;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export const useTabs = ({ taskRun }) => {
: []),
{
label: 'Status',
component: <ViewYAML item={taskRun.status} />,
component: <ViewYAML item={taskRun?.status} />,
},
];
}, [results, taskRun]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export const TaskRun = ({ taskRun }: { taskRun: TaskRunKubeObjectInterface }) =>

const tabs = useTabs({ taskRun });

return (
return taskRun ? (
<Paper>
<StyledDetailsHeader>
<Stack spacing={1}>
Expand Down Expand Up @@ -71,5 +71,5 @@ export const TaskRun = ({ taskRun }: { taskRun: TaskRunKubeObjectInterface }) =>
<Tabs tabs={tabs} initialTabIdx={0} />
</StyledDetailsBody>
</Paper>
);
) : null;
};
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,17 @@ import React from 'react';
import { LoadingWrapper } from '../../../../../../components/LoadingWrapper';
import { Tabs } from '../../../../../../components/Tabs';
import { PodKubeObject } from '../../../../../../k8s/Pod';
import { getTaskRunStepReason } from '../../../../../../k8s/TaskRun/utils/getStatus';
import {
getTaskRunStepReason,
getTaskRunStepStatus,
} from '../../../../../../k8s/TaskRun/utils/getStatus';
import { humanize } from '../../../../../../utils/date/humanize';
import { capitalizeFirstLetter } from '../../../../../../utils/format/capitalizeFirstLetter';
import { StyledDetailsBody, StyledDetailsHeader } from '../../styles';
import { useTabs } from './hooks/useTabs';

export const TaskRunStep = ({ taskRun, step }) => {
const status = getTaskRunStepStatus(step);
const reason = getTaskRunStepReason(step);

const completionTime = step?.terminated?.finishedAt || new Date().toISOString();
Expand Down Expand Up @@ -56,7 +61,7 @@ export const TaskRunStep = ({ taskRun, step }) => {
component="span"
color="secondary.dark"
>
{reason}
{capitalizeFirstLetter(reason || status || 'unknown')}
</Typography>
</Typography>
<Typography
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,16 @@ exports[`testing ManageGitServer Create renders ManageGitServer component withou
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
>
<symbol
id="ansible"
viewBox="0 0 24 24"
xml:space="preserve"
>
<path
d="M10.617 11.473l4.686 3.695-3.102-7.662zM12 0C5.371 0 0 5.371 0 12s5.371 12 12 12 12-5.371 12-12S18.629 0 12 0zm5.797 17.305c-.011.471-.403.842-.875.83-.236 0-.416-.09-.664-.293l-6.19-5-2.079 5.203H6.191L11.438 5.44c.124-.314.427-.52.764-.506.326-.014.63.189.742.506l4.774 11.494c.045.111.08.234.08.348-.001.009-.001.009-.001.023z"
fill="#000"
/>
</symbol>
<symbol
id="beego"
viewBox="6.56 1 71.44 77"
Expand Down Expand Up @@ -2323,6 +2333,16 @@ exports[`testing ManageGitServer Create renders ManageGitServer component withou
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
>
<symbol
id="ansible"
viewBox="0 0 24 24"
xml:space="preserve"
>
<path
d="M10.617 11.473l4.686 3.695-3.102-7.662zM12 0C5.371 0 0 5.371 0 12s5.371 12 12 12 12-5.371 12-12S18.629 0 12 0zm5.797 17.305c-.011.471-.403.842-.875.83-.236 0-.416-.09-.664-.293l-6.19-5-2.079 5.203H6.191L11.438 5.44c.124-.314.427-.52.764-.506.326-.014.63.189.742.506l4.774 11.494c.045.111.08.234.08.348-.001.009-.001.009-.001.023z"
fill="#000"
/>
</symbol>
<symbol
id="beego"
viewBox="6.56 1 71.44 77"
Expand Down Expand Up @@ -4575,6 +4595,16 @@ exports[`testing ManageGitServer Create renders ManageGitServer component withou
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
>
<symbol
id="ansible"
viewBox="0 0 24 24"
xml:space="preserve"
>
<path
d="M10.617 11.473l4.686 3.695-3.102-7.662zM12 0C5.371 0 0 5.371 0 12s5.371 12 12 12 12-5.371 12-12S18.629 0 12 0zm5.797 17.305c-.011.471-.403.842-.875.83-.236 0-.416-.09-.664-.293l-6.19-5-2.079 5.203H6.191L11.438 5.44c.124-.314.427-.52.764-.506.326-.014.63.189.742.506l4.774 11.494c.045.111.08.234.08.348-.001.009-.001.009-.001.023z"
fill="#000"
/>
</symbol>
<symbol
id="beego"
viewBox="6.56 1 71.44 77"
Expand Down Expand Up @@ -6827,6 +6857,16 @@ exports[`testing ManageGitServer Create renders ManageGitServer component withou
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
>
<symbol
id="ansible"
viewBox="0 0 24 24"
xml:space="preserve"
>
<path
d="M10.617 11.473l4.686 3.695-3.102-7.662zM12 0C5.371 0 0 5.371 0 12s5.371 12 12 12 12-5.371 12-12S18.629 0 12 0zm5.797 17.305c-.011.471-.403.842-.875.83-.236 0-.416-.09-.664-.293l-6.19-5-2.079 5.203H6.191L11.438 5.44c.124-.314.427-.52.764-.506.326-.014.63.189.742.506l4.774 11.494c.045.111.08.234.08.348-.001.009-.001.009-.001.023z"
fill="#000"
/>
</symbol>
<symbol
id="beego"
viewBox="6.56 1 71.44 77"
Expand Down
40 changes: 40 additions & 0 deletions src/widgets/ManageGitServer/__snapshots__/index.edit.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,16 @@ exports[`testing ManageGitServer Edit renders ManageGitServer component with Ger
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
>
<symbol
id="ansible"
viewBox="0 0 24 24"
xml:space="preserve"
>
<path
d="M10.617 11.473l4.686 3.695-3.102-7.662zM12 0C5.371 0 0 5.371 0 12s5.371 12 12 12 12-5.371 12-12S18.629 0 12 0zm5.797 17.305c-.011.471-.403.842-.875.83-.236 0-.416-.09-.664-.293l-6.19-5-2.079 5.203H6.191L11.438 5.44c.124-.314.427-.52.764-.506.326-.014.63.189.742.506l4.774 11.494c.045.111.08.234.08.348-.001.009-.001.009-.001.023z"
fill="#000"
/>
</symbol>
<symbol
id="beego"
viewBox="6.56 1 71.44 77"
Expand Down Expand Up @@ -2319,6 +2329,16 @@ exports[`testing ManageGitServer Edit renders ManageGitServer component with Ger
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
>
<symbol
id="ansible"
viewBox="0 0 24 24"
xml:space="preserve"
>
<path
d="M10.617 11.473l4.686 3.695-3.102-7.662zM12 0C5.371 0 0 5.371 0 12s5.371 12 12 12 12-5.371 12-12S18.629 0 12 0zm5.797 17.305c-.011.471-.403.842-.875.83-.236 0-.416-.09-.664-.293l-6.19-5-2.079 5.203H6.191L11.438 5.44c.124-.314.427-.52.764-.506.326-.014.63.189.742.506l4.774 11.494c.045.111.08.234.08.348-.001.009-.001.009-.001.023z"
fill="#000"
/>
</symbol>
<symbol
id="beego"
viewBox="6.56 1 71.44 77"
Expand Down Expand Up @@ -4566,6 +4586,16 @@ exports[`testing ManageGitServer Edit renders ManageGitServer component with Git
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
>
<symbol
id="ansible"
viewBox="0 0 24 24"
xml:space="preserve"
>
<path
d="M10.617 11.473l4.686 3.695-3.102-7.662zM12 0C5.371 0 0 5.371 0 12s5.371 12 12 12 12-5.371 12-12S18.629 0 12 0zm5.797 17.305c-.011.471-.403.842-.875.83-.236 0-.416-.09-.664-.293l-6.19-5-2.079 5.203H6.191L11.438 5.44c.124-.314.427-.52.764-.506.326-.014.63.189.742.506l4.774 11.494c.045.111.08.234.08.348-.001.009-.001.009-.001.023z"
fill="#000"
/>
</symbol>
<symbol
id="beego"
viewBox="6.56 1 71.44 77"
Expand Down Expand Up @@ -6807,6 +6837,16 @@ exports[`testing ManageGitServer Edit renders ManageGitServer component with Git
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
>
<symbol
id="ansible"
viewBox="0 0 24 24"
xml:space="preserve"
>
<path
d="M10.617 11.473l4.686 3.695-3.102-7.662zM12 0C5.371 0 0 5.371 0 12s5.371 12 12 12 12-5.371 12-12S18.629 0 12 0zm5.797 17.305c-.011.471-.403.842-.875.83-.236 0-.416-.09-.664-.293l-6.19-5-2.079 5.203H6.191L11.438 5.44c.124-.314.427-.52.764-.506.326-.014.63.189.742.506l4.774 11.494c.045.111.08.234.08.348-.001.009-.001.009-.001.023z"
fill="#000"
/>
</symbol>
<symbol
id="beego"
viewBox="6.56 1 71.44 77"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export const URL = () => {
form: {
register,
control,
formState: { errors, defaultValues },
formState: { errors },
},
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,16 @@ exports[`testing ManageRegistry Create renders ManageRegistry component without
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
>
<symbol
id="ansible"
viewBox="0 0 24 24"
xml:space="preserve"
>
<path
d="M10.617 11.473l4.686 3.695-3.102-7.662zM12 0C5.371 0 0 5.371 0 12s5.371 12 12 12 12-5.371 12-12S18.629 0 12 0zm5.797 17.305c-.011.471-.403.842-.875.83-.236 0-.416-.09-.664-.293l-6.19-5-2.079 5.203H6.191L11.438 5.44c.124-.314.427-.52.764-.506.326-.014.63.189.742.506l4.774 11.494c.045.111.08.234.08.348-.001.009-.001.009-.001.023z"
fill="#000"
/>
</symbol>
<symbol
id="beego"
viewBox="6.56 1 71.44 77"
Expand Down
Loading

0 comments on commit e579091

Please sign in to comment.