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

Run dbt cloud task as a part of pipeline #1351

Merged
merged 7 commits into from
Dec 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
12 changes: 8 additions & 4 deletions src/components/DBT/CreateOrgTaskForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import CustomDialog from '../Dialog/CustomDialog';
import { Controller, useFieldArray, useForm } from 'react-hook-form';
import Input from '../UI/Input/Input';
import { TASK_GITPULL, TASK_DBTCLEAN, TASK_DOCSGENERATE } from '@/config/constant';
import { TASK_GITPULL, TASK_DBTCLEAN, TASK_DBTCLOUD_JOB } from '@/config/constant';
import { useSession } from 'next-auth/react';
import { useContext, useEffect, useRef, useState } from 'react';
import { httpGet, httpPost } from '@/helpers/http';
Expand Down Expand Up @@ -89,7 +89,8 @@
.map((task: MasterTask) => {
return { id: task.slug, label: task.slug };
});
setMasterTasks(tasksDropDownRows);
console.log(tasksDropDownRows, 'taskdropdown');
setMasterTasks([...tasksDropDownRows]);

Check warning on line 93 in src/components/DBT/CreateOrgTaskForm.tsx

View check run for this annotation

Codecov / codecov/patch

src/components/DBT/CreateOrgTaskForm.tsx#L92-L93

Added lines #L92 - L93 were not covered by tests
} catch (err: any) {
console.error(err);
errorToast(err.message, [], globalContext);
Expand Down Expand Up @@ -155,6 +156,8 @@
setLoading(false);
};

const isDbtCloudTask = () => selectedTask?.id === TASK_DBTCLOUD_JOB;

const FormContent = () => {
return (
<>
Expand Down Expand Up @@ -285,12 +288,13 @@
</Button>
</List>
</Box>

<Box sx={{ m: 2 }} />
</Box>
{!isDbtCloudTask() && (
<InputLabel>
<Command task={selectedTask} flags={selectedFlags} options={optionsRef} />
</InputLabel>
</Box>
)}
</>
);
};
Expand Down
10 changes: 9 additions & 1 deletion src/components/DBT/DBTTaskList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,14 @@ export const DBTTaskList = ({
const tempRows = tasks
.filter((task: TransformTask) => task.slug != TASK_DOCSGENERATE)
.map((task: TransformTask) => [
<Box
key={`label-${task.uuid}`}
sx={{ display: 'flex', alignItems: 'center', marginLeft: '10px' }}
>
<Typography variant="body2" fontWeight={400}>
{task.label}
</Typography>
</Box>,
<Box
key={`name-${task.uuid}`}
sx={{ display: 'flex', alignItems: 'center', marginLeft: '10px' }}
Expand Down Expand Up @@ -338,7 +346,7 @@ export const DBTTaskList = ({
hasCreatePermission={permissions.includes('can_create_orgtask')}
openDialog={handleCreateOpenOrgTaskDialog}
title="Task"
headers={{ values: ['Command'] }}
headers={{ values: ['Label', 'Command'] }}
rows={rows}
height={80}
/>
Expand Down
2 changes: 1 addition & 1 deletion src/components/Flows/FlowCreate.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -168,12 +168,12 @@ const FlowCreate = ({
setLoading(true);
try {
const data: any = await httpGet(session, `prefect/v1/flows/${flowId}`);

let tasksToApply = tasks.filter(ValidateDefaultTasksToApplyInPipeline);

if (data.transformTasks.length === 0) {
tasksToApply = [];
}

//if "data.transformTasks" and "tasksToApply" are same then the alignment is simple else advanced.
const ifTasksAligned = data.transformTasks.every(
(task: { uuid: string; seq: number }, index: number) =>
Expand Down
6 changes: 4 additions & 2 deletions src/components/Flows/TaskSequence.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,9 @@ export const TaskSequence = ({ field, options: initialOptions }: TaskSequencePro
>
{node.rowIndex + 1}
</Box>
<Box sx={{ p: '4px 12px', background: '#F5FAFA', width: '100%' }}>{node.data.command}</Box>
<Box sx={{ p: '4px 12px', background: '#F5FAFA', width: '100%' }}>
{node.data.command || node.data.slug.replace(/-/g, ' ')}
</Box>
<Box
sx={{
p: '4px 12px',
Expand Down Expand Up @@ -157,7 +159,7 @@ export const TaskSequence = ({ field, options: initialOptions }: TaskSequencePro
<Autocomplete
data-testid="tasksequence"
inputValue=""
getOptionLabel={(task: any) => task.command}
getOptionLabel={(task: any) => task.command || task.slug?.replace(/-/g, ' ')}
placeholder="Select"
options={autocompleteOptions}
onChange={handleSelect}
Expand Down
1 change: 1 addition & 0 deletions src/config/constant.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ export const TASK_DBTCLEAN = 'dbt-clean';
export const TASK_DBTDEPS = 'dbt-deps';
export const TASK_GITPULL = 'git-pull';
export const TASK_DOCSGENERATE = 'dbt-docs-generate';
export const TASK_DBTCLOUD_JOB = 'dbt-cloud-job';

// Demo account
export const demoAccDestSchema = process.env.NEXT_PUBLIC_DEMO_ACCOUNT_DEST_SCHEMA;
Expand Down
Loading