Skip to content

Commit

Permalink
Merge branch 'main' into feat/trigger-apply-button
Browse files Browse the repository at this point in the history
  • Loading branch information
ZIJ committed Sep 6, 2024
2 parents c8d83e7 + 7084211 commit b5ec570
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export async function UserDriftedProjectsWithPagination({
getLoggedInUserOrganizationRole(organizationId)
]);
const [projects, totalPages] = await Promise.all([
getProjectsListForUser({ ...filters, organizationId, userRole, userId }),
getProjectsListForUser({ ...filters, organizationId, userRole, userId, driftedOnly: true }),
getProjectsCountForUser({ ...filters, organizationId, userId }),
]);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export default async function DriftsPage({
return (
<div className="flex flex-col space-y-4 max-w-5xl mt-8">
<PageHeading
title="Drifted projects (alpha)"
title="Drifted projects"
/>
<div className="md:w-1/3">
<Search placeholder="Search projects" />
Expand Down
10 changes: 8 additions & 2 deletions src/data/user/projects.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -303,18 +303,20 @@ export async function getProjectsListForUser({
organizationId,
query = '',
teamIds = [],
driftedOnly = false,
}: {
userId: string;
userRole: Enum<'organization_member_role'>;
organizationId: string;
query?: string;
teamIds?: number[];
driftedOnly?: boolean;
}): Promise<ProjectListType[]> {
const supabase = createSupabaseUserServerComponentClient();

let supabaseQuery = supabase
.from('projects')
.select('id,name, slug, latest_action_on, created_at, repo_id')
.select('id, name, slug, latest_action_on, created_at, repo_id, latest_drift_output')
.eq('organization_id', organizationId)
.ilike('name', `%${query}%`);

Expand Down Expand Up @@ -347,9 +349,13 @@ export async function getProjectsListForUser({

if (!data) return [];

const driftFilteredProjects = driftedOnly
? data.filter(project => !!project.latest_drift_output)
: data;

// Fetch repo details for each project
const projectsWithRepoDetails = await Promise.all(
data.map(async (project) => {
driftFilteredProjects.map(async (project) => {
const repoDetails = await getRepoDetails(project.repo_id);
const { repo_id, ...projectWithoutRepoId } = project;
return {
Expand Down
2 changes: 2 additions & 0 deletions supabase/migrations/20240905145824_event_type_to_batch.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ALTER TABLE digger_batches
ADD COLUMN event_type TEXT;
2 changes: 2 additions & 0 deletions supabase/migrations/20240905151622_drop_is_drift_column.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ALTER TABLE digger_jobs
DROP COLUMN is_drift_job;
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ALTER TABLE projects
ADD COLUMN drift_latest_terraform_output TEXT DEFAULT '';
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ALTER TABLE projects
DROP COLUMN drift_latest_terraform_output;

0 comments on commit b5ec570

Please sign in to comment.