From 7ac6cc83f87803f8b38ee04695310776be0af5c4 Mon Sep 17 00:00:00 2001 From: garrrikkotua Date: Wed, 11 Dec 2024 16:33:39 +0400 Subject: [PATCH 1/8] fix --- .../components/settings/github-settings-drawer.vue | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/frontend/src/config/integrations/github/components/settings/github-settings-drawer.vue b/frontend/src/config/integrations/github/components/settings/github-settings-drawer.vue index e9f8ac77b8..87f9652c42 100644 --- a/frontend/src/config/integrations/github/components/settings/github-settings-drawer.vue +++ b/frontend/src/config/integrations/github/components/settings/github-settings-drawer.vue @@ -116,6 +116,7 @@ const subprojects = ref([]); const organizations = ref([]); const repositories = ref([]); const repoMappings = ref>({}); +const initialRepoMappings = ref>({}); // Drawer visibility const isDrawerVisible = computed({ @@ -157,7 +158,10 @@ const buildSettings = (): GitHubSettings => { .map((r) => ({ name: r.name, url: r.url, - updatedAt: r.updatedAt || dayjs().toISOString(), + updatedAt: (props.integration + && repoMappings.value[r.url] !== initialRepoMappings.value[r.url]) + ? dayjs().toISOString() + : r.updatedAt || dayjs().toISOString(), })), }), ); @@ -219,13 +223,15 @@ const fetchGithubMappings = () => { if (!props.integration) return; IntegrationService.fetchGitHubMappings(props.integration).then( (res: any[]) => { - repoMappings.value = res.reduce( + const mappings = res.reduce( (rm, mapping) => ({ ...rm, [mapping.url]: mapping.segment.id, }), {}, ); + repoMappings.value = mappings; + initialRepoMappings.value = mappings; }, ); }; From 002e70ea60e7ab91a64c2fc60ffdc0fc02ca6c14 Mon Sep 17 00:00:00 2001 From: garrrikkotua Date: Wed, 11 Dec 2024 17:15:24 +0400 Subject: [PATCH 2/8] debug --- .../github/components/settings/github-settings-drawer.vue | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/frontend/src/config/integrations/github/components/settings/github-settings-drawer.vue b/frontend/src/config/integrations/github/components/settings/github-settings-drawer.vue index 87f9652c42..509c466664 100644 --- a/frontend/src/config/integrations/github/components/settings/github-settings-drawer.vue +++ b/frontend/src/config/integrations/github/components/settings/github-settings-drawer.vue @@ -165,6 +165,10 @@ const buildSettings = (): GitHubSettings => { })), }), ); + console.log('building settings'); + console.log('repoMappings', repoMappings.value); + console.log('initialRepoMappings', initialRepoMappings.value); + console.log('orgs', orgs); return { orgs, updateMemberAttributes: true }; }; @@ -234,6 +238,10 @@ const fetchGithubMappings = () => { initialRepoMappings.value = mappings; }, ); + + console.log('fetchGithubMappings'); + console.log('repoMappings', repoMappings.value); + console.log('initialRepoMappings', initialRepoMappings.value); }; watch( From c94eed3affee95a07b73ddfbfeed89e322187406 Mon Sep 17 00:00:00 2001 From: garrrikkotua Date: Wed, 11 Dec 2024 17:23:01 +0400 Subject: [PATCH 3/8] log better --- .../components/settings/github-settings-drawer.vue | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/frontend/src/config/integrations/github/components/settings/github-settings-drawer.vue b/frontend/src/config/integrations/github/components/settings/github-settings-drawer.vue index 509c466664..0b1177ee8c 100644 --- a/frontend/src/config/integrations/github/components/settings/github-settings-drawer.vue +++ b/frontend/src/config/integrations/github/components/settings/github-settings-drawer.vue @@ -166,9 +166,9 @@ const buildSettings = (): GitHubSettings => { }), ); console.log('building settings'); - console.log('repoMappings', repoMappings.value); - console.log('initialRepoMappings', initialRepoMappings.value); - console.log('orgs', orgs); + console.log('repoMappings', JSON.parse(JSON.stringify(repoMappings.value))); + console.log('initialRepoMappings', JSON.parse(JSON.stringify(initialRepoMappings.value))); + console.log('orgs', JSON.parse(JSON.stringify(orgs))); return { orgs, updateMemberAttributes: true }; }; @@ -240,8 +240,8 @@ const fetchGithubMappings = () => { ); console.log('fetchGithubMappings'); - console.log('repoMappings', repoMappings.value); - console.log('initialRepoMappings', initialRepoMappings.value); + console.log('repoMappings', JSON.parse(JSON.stringify(repoMappings.value))); + console.log('initialRepoMappings', JSON.parse(JSON.stringify(initialRepoMappings.value))); }; watch( From dc0dccef93452f793565d91aee51ab0fb15fbabd Mon Sep 17 00:00:00 2001 From: garrrikkotua Date: Wed, 11 Dec 2024 17:39:40 +0400 Subject: [PATCH 4/8] more logging --- .../components/settings/github-settings-drawer.vue | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/frontend/src/config/integrations/github/components/settings/github-settings-drawer.vue b/frontend/src/config/integrations/github/components/settings/github-settings-drawer.vue index 0b1177ee8c..082ce4f8a8 100644 --- a/frontend/src/config/integrations/github/components/settings/github-settings-drawer.vue +++ b/frontend/src/config/integrations/github/components/settings/github-settings-drawer.vue @@ -175,6 +175,12 @@ const buildSettings = (): GitHubSettings => { const connect = () => { let integration: any = null; const settings: GitHubSettings = buildSettings(); + + // Add debug logging before API calls + console.log('Before API calls:'); + console.log('repoMappings:', JSON.parse(JSON.stringify(repoMappings.value))); + console.log('initialRepoMappings:', JSON.parse(JSON.stringify(initialRepoMappings.value))); + (props.integration?.id ? IntegrationService.update(props.integration.id, { settings, @@ -187,6 +193,11 @@ const connect = () => { ) .then((res) => { integration = res; + // Add debug logging before mapRepos + console.log('Before mapRepos:'); + console.log('repoMappings:', JSON.parse(JSON.stringify(repoMappings.value))); + console.log('initialRepoMappings:', JSON.parse(JSON.stringify(initialRepoMappings.value))); + return IntegrationService.githubMapRepos(res.id, repoMappings.value, [ res.segmentId, ], !!props.integration?.id); From d871433d05eeabfceb3f474f80d2db61badfe267 Mon Sep 17 00:00:00 2001 From: garrrikkotua Date: Wed, 11 Dec 2024 17:53:17 +0400 Subject: [PATCH 5/8] more logs --- .../github/components/settings/github-settings-drawer.vue | 1 + 1 file changed, 1 insertion(+) diff --git a/frontend/src/config/integrations/github/components/settings/github-settings-drawer.vue b/frontend/src/config/integrations/github/components/settings/github-settings-drawer.vue index 082ce4f8a8..5f62f36f67 100644 --- a/frontend/src/config/integrations/github/components/settings/github-settings-drawer.vue +++ b/frontend/src/config/integrations/github/components/settings/github-settings-drawer.vue @@ -259,6 +259,7 @@ watch( () => props.integration, (value?: Integration) => { if (value) { + console.log('watch'); fetchGithubMappings(); const { orgs } = value.settings; organizations.value = orgs From 70d264b2931828c504074b66e3dce262b0b0cc40 Mon Sep 17 00:00:00 2001 From: garrrikkotua Date: Wed, 11 Dec 2024 17:59:08 +0400 Subject: [PATCH 6/8] more logs --- .../github/components/settings/github-settings-drawer.vue | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/frontend/src/config/integrations/github/components/settings/github-settings-drawer.vue b/frontend/src/config/integrations/github/components/settings/github-settings-drawer.vue index 5f62f36f67..39d9107420 100644 --- a/frontend/src/config/integrations/github/components/settings/github-settings-drawer.vue +++ b/frontend/src/config/integrations/github/components/settings/github-settings-drawer.vue @@ -247,12 +247,11 @@ const fetchGithubMappings = () => { ); repoMappings.value = mappings; initialRepoMappings.value = mappings; + console.log('fetchGithubMappings'); + console.log('repoMappings', JSON.parse(JSON.stringify(repoMappings.value))); + console.log('initialRepoMappings', JSON.parse(JSON.stringify(initialRepoMappings.value))); }, ); - - console.log('fetchGithubMappings'); - console.log('repoMappings', JSON.parse(JSON.stringify(repoMappings.value))); - console.log('initialRepoMappings', JSON.parse(JSON.stringify(initialRepoMappings.value))); }; watch( From d43a917782037a0c212e942de0c4b05f61653ffc Mon Sep 17 00:00:00 2001 From: garrrikkotua Date: Wed, 11 Dec 2024 18:28:17 +0400 Subject: [PATCH 7/8] more fixing --- .../github/components/settings/github-settings-drawer.vue | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/frontend/src/config/integrations/github/components/settings/github-settings-drawer.vue b/frontend/src/config/integrations/github/components/settings/github-settings-drawer.vue index 39d9107420..69fdc74834 100644 --- a/frontend/src/config/integrations/github/components/settings/github-settings-drawer.vue +++ b/frontend/src/config/integrations/github/components/settings/github-settings-drawer.vue @@ -245,8 +245,10 @@ const fetchGithubMappings = () => { }), {}, ); - repoMappings.value = mappings; - initialRepoMappings.value = mappings; + // Create new objects to ensure no reference sharing + repoMappings.value = { ...mappings }; + initialRepoMappings.value = { ...mappings }; + console.log('fetchGithubMappings'); console.log('repoMappings', JSON.parse(JSON.stringify(repoMappings.value))); console.log('initialRepoMappings', JSON.parse(JSON.stringify(initialRepoMappings.value))); From 7d75b8a31bfe5b77526eebbbf6f33366ead634c6 Mon Sep 17 00:00:00 2001 From: garrrikkotua Date: Wed, 11 Dec 2024 19:03:46 +0400 Subject: [PATCH 8/8] rm --- .../settings/github-settings-drawer.vue | 19 ------------------- 1 file changed, 19 deletions(-) diff --git a/frontend/src/config/integrations/github/components/settings/github-settings-drawer.vue b/frontend/src/config/integrations/github/components/settings/github-settings-drawer.vue index 69fdc74834..1e56cbd71e 100644 --- a/frontend/src/config/integrations/github/components/settings/github-settings-drawer.vue +++ b/frontend/src/config/integrations/github/components/settings/github-settings-drawer.vue @@ -165,10 +165,6 @@ const buildSettings = (): GitHubSettings => { })), }), ); - console.log('building settings'); - console.log('repoMappings', JSON.parse(JSON.stringify(repoMappings.value))); - console.log('initialRepoMappings', JSON.parse(JSON.stringify(initialRepoMappings.value))); - console.log('orgs', JSON.parse(JSON.stringify(orgs))); return { orgs, updateMemberAttributes: true }; }; @@ -176,11 +172,6 @@ const connect = () => { let integration: any = null; const settings: GitHubSettings = buildSettings(); - // Add debug logging before API calls - console.log('Before API calls:'); - console.log('repoMappings:', JSON.parse(JSON.stringify(repoMappings.value))); - console.log('initialRepoMappings:', JSON.parse(JSON.stringify(initialRepoMappings.value))); - (props.integration?.id ? IntegrationService.update(props.integration.id, { settings, @@ -193,11 +184,6 @@ const connect = () => { ) .then((res) => { integration = res; - // Add debug logging before mapRepos - console.log('Before mapRepos:'); - console.log('repoMappings:', JSON.parse(JSON.stringify(repoMappings.value))); - console.log('initialRepoMappings:', JSON.parse(JSON.stringify(initialRepoMappings.value))); - return IntegrationService.githubMapRepos(res.id, repoMappings.value, [ res.segmentId, ], !!props.integration?.id); @@ -248,10 +234,6 @@ const fetchGithubMappings = () => { // Create new objects to ensure no reference sharing repoMappings.value = { ...mappings }; initialRepoMappings.value = { ...mappings }; - - console.log('fetchGithubMappings'); - console.log('repoMappings', JSON.parse(JSON.stringify(repoMappings.value))); - console.log('initialRepoMappings', JSON.parse(JSON.stringify(initialRepoMappings.value))); }, ); }; @@ -260,7 +242,6 @@ watch( () => props.integration, (value?: Integration) => { if (value) { - console.log('watch'); fetchGithubMappings(); const { orgs } = value.settings; organizations.value = orgs