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

Refactor migration #30

Merged
merged 56 commits into from
Feb 20, 2024
Merged
Changes from 1 commit
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
c2c73aa
add create team mutation
frodesundby Dec 7, 2023
4edc323
Use serverside mutation when creating team
frodesundby Dec 7, 2023
ae7dbd9
Make settings page work when hookd is unavailable
thokra-nav Dec 7, 2023
3464a70
Support updating team
thokra-nav Dec 7, 2023
ba87352
Merge branch 'main' into move_teams_frontend
thokra-nav Dec 15, 2023
c5d1425
Use federated backend
thokra-nav Dec 15, 2023
439d028
working pagination mvp
frodesundby Dec 20, 2023
9c100f3
fix sorting for applications
frodesundby Dec 20, 2023
80d300e
Use new pagination on all pages
thokra-nav Dec 20, 2023
479b110
update default limits
frodesundby Dec 20, 2023
3ca2e51
use userIsOwner instead of userIsAdmin
frodesundby Dec 21, 2023
ee33817
WIP: add mem(e)ber
frodesundby Dec 21, 2023
2435885
Add member working
thokra-nav Dec 21, 2023
20e4388
Add edit member
thokra-nav Dec 22, 2023
394e484
add removeUserFrom Team functionality
frodesundby Dec 22, 2023
f31ce9b
Expand Managed Resources for teams
thokra-nav Dec 22, 2023
f38238d
WIP: admin-page
frodesundby Dec 22, 2023
a464f79
Adming page working
thokra-nav Dec 22, 2023
ecf4fda
Trigger synchronize all teams
thokra-nav Dec 22, 2023
d3d7fca
Update member role works, but are buggy
thokra-nav Dec 22, 2023
1f591fc
Update with changes to schema
thokra-nav Jan 11, 2024
b30fbd3
Merge main
thokra-nav Jan 11, 2024
36b417f
Fix some more pages
thokra-nav Jan 12, 2024
cc5a25c
Add a small readme and update user auth
thokra-nav Jan 18, 2024
2f92000
Sync
thokra-nav Jan 31, 2024
40d75f5
WIP: make it work together
thokra-nav Jan 31, 2024
af831da
sync
thokra-nav Jan 31, 2024
905b9cd
Fix githubrepos, settings doesn't work
thokra-nav Feb 5, 2024
85d7f71
Update settings to use new graphql fields
thokra-nav Feb 5, 2024
0264e74
Add oauth2 flow
thokra-nav Feb 5, 2024
dac4587
Handle some error messages
thokra-nav Feb 5, 2024
fe90666
Remove slack alerts channels
thokra-nav Feb 6, 2024
aa2d6e1
Update after removal of namespace
thokra-nav Feb 6, 2024
7dd00c3
Support more detail in app error messages, refs nais/system#24
kimtore Feb 7, 2024
ae591ee
Add vulnerability metrics graph for team
rbjornstad Feb 7, 2024
c21a1ad
Remove random data generation and use input.
rbjornstad Feb 8, 2024
48e5d91
Update vulnerabilityMetrics query and add date range inputs
rbjornstad Feb 8, 2024
26604e5
Clean up application error messages
kimtore Feb 8, 2024
8ce9465
Remove unused code
rbjornstad Feb 8, 2024
d1e1a5d
Refactor vulnerability graph component and add environment selection
rbjornstad Feb 12, 2024
6644028
Remove console.log statements
rbjornstad Feb 12, 2024
28cdc88
Change color of risk score in vulnerabilitiesTeamTransformLineChart
rbjornstad Feb 12, 2024
eefe720
Update vulnerabilityMetrics arguments to include non-nullable types
rbjornstad Feb 14, 2024
dc88eb9
Refactor showSymbol property in vulnerabilitiesTeamTransformLineChart
rbjornstad Feb 14, 2024
34a7b6b
Fix vulnerability graph data handling
rbjornstad Feb 14, 2024
68897a1
Add some message if no teams
thokra-nav Feb 9, 2024
4ec91af
Update schema and build image
thokra-nav Feb 13, 2024
7d83139
Update env to api
thokra-nav Feb 13, 2024
2e98b01
Forward cookies to api
thokra-nav Feb 13, 2024
0fa596a
A bit nicer without !
thokra-nav Feb 13, 2024
9b62100
handle -> handleFetch
thokra-nav Feb 13, 2024
f6f944c
Fix merge
thokra-nav Feb 14, 2024
ea4bf82
Run on refactor_migration
thokra-nav Feb 14, 2024
aed674e
Add handling for no applications with vulnerability data
rbjornstad Feb 14, 2024
46616b9
Remove excess value
thokra-nav Feb 20, 2024
f02ec40
Merge branch 'main' into refactor_migration
thokra-nav Feb 20, 2024
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
Prev Previous commit
Next Next commit
WIP: make it work together
thokra-nav committed Jan 31, 2024
commit 40d75f574e73ab4abd22f261976ebd26d61e3af1
33 changes: 22 additions & 11 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

26 changes: 8 additions & 18 deletions schema.graphql
Original file line number Diff line number Diff line change
@@ -586,7 +586,7 @@ input MonthlyCostFilter {

type Mutation {
"""
Add opt-out of a reconciler for a team member. Only reconcilers that uses team memberships can be opted out from.
Add opt-out of a reconciler for a team member. Only reconcilers that are member aware can be opted out from.
"""
addReconcilerOptOut(
"""The name of the reconciler to opt the team member out of."""
@@ -1190,14 +1190,11 @@ type Reconciler {
"""Whether or not the reconciler is enabled."""
enabled: Boolean!

"""Whether or not the reconciler uses team memberships when syncing."""
memberAware: Boolean!

"""The name of the reconciler."""
name: String!

"""The run order of the reconciler."""
runOrder: Int!

"""Whether or not the reconciler uses team memberships when syncing."""
usesTeamMemberships: Boolean!
}

"""Reconciler configuration type."""
@@ -1596,17 +1593,10 @@ type Team {
offset: Int
): DeploymentList!

"""A list of GitHub repositories for the team."""
gitHubRepositories(
"""Filter teams by GitHub repository permissions."""
filter: GitHubRepositoriesFilter

"""Limit the number of repositories to return. Default is 20."""
limit: Int

"""Offset to start listing repositories from. Default is 0."""
offset: Int
): GitHubRepositoryList!
"""
The email address of the Google Group for the team. This value is only available after the initial team synchronization.
"""
googleGroupEmail: String
id: ID!

"""Timestamp of the last successful synchronization of the team."""
8 changes: 5 additions & 3 deletions src/routes/admin/+page.gql
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
query AdminReconcilers {
reconcilers {
...ReconcilerFragment
reconcilers(limit: 100) {
nodes {
...ReconcilerFragment
}
}
}
}
4 changes: 3 additions & 1 deletion src/routes/admin/+page.svelte
Original file line number Diff line number Diff line change
@@ -7,7 +7,7 @@
export let data: PageData;

$: ({ AdminReconcilers } = data);
$: reconcilers = $AdminReconcilers.data?.reconcilers;
$: reconcilers = $AdminReconcilers.data?.reconcilers.nodes;

const synchronize = graphql(`
mutation Synchronize {
@@ -47,6 +47,8 @@

{#each reconcilers || [] as r}
<Reconciler reconciler={r} />
{:else}
<p>No reconcilers registered</p>
{/each}

<style>
3 changes: 1 addition & 2 deletions src/routes/admin/Reconciler.svelte
Original file line number Diff line number Diff line change
@@ -30,8 +30,7 @@
displayName
enabled
name
runOrder
usesTeamMemberships
memberAware
config {
configured
description
2 changes: 1 addition & 1 deletion src/routes/deploys/+page.svelte
Original file line number Diff line number Diff line change
@@ -4,7 +4,7 @@
import DeploymentStatus from '$lib/DeploymentStatus.svelte';
import Pagination from '$lib/Pagination.svelte';
import Time from '$lib/Time.svelte';
import { limitOffset } from '$lib/pagination';
import { changeParams, limitOffset } from '$lib/pagination';
import { Alert, Skeleton, Table, Tbody, Td, Th, Thead, Tr } from '@nais/ds-svelte-community';
import type { PageData } from './$houdini';
export let data: PageData;
4 changes: 2 additions & 2 deletions src/routes/team/[team]/(teamTabs)/members/AddMember.svelte
Original file line number Diff line number Diff line change
@@ -33,7 +33,7 @@
displayName
name
description
usesTeamMemberships
memberAware
}
}
}
@@ -57,7 +57,7 @@
return store.subscribe(async (v) => {
if (!v.data) return;

const recs = v.data.reconcilers.filter((r) => r.usesTeamMemberships);
const recs = v.data.reconcilers.nodes.filter((r) => r.memberAware);
reconcilers =
recs.map((r) => ({
name: r.displayName,
27 changes: 19 additions & 8 deletions src/routes/team/[team]/(teamTabs)/repositories/+page.gql
Original file line number Diff line number Diff line change
@@ -1,20 +1,31 @@
query Repositories($team: Slug!) @cache(policy: NetworkOnly) {
team(slug: $team) {
gitHubRepositories(limit: 20) {
reconcilerResources(key: "repo", reconciler: "github:team", limit: 20) {
pageInfo {
totalCount
hasNextPage
hasPreviousPage
}
nodes {
name
authorizations
permissions {
name
granted
}
roleName
name: value
metadata
}
}
# gitHubRepositories(limit: 20) {
# pageInfo {
# totalCount
# hasNextPage
# hasPreviousPage
# }
# nodes {
# name
# authorizations
# permissions {
# name
# granted
# }
# roleName
# }
# }
}
}
33 changes: 15 additions & 18 deletions src/routes/team/[team]/(teamTabs)/repositories/+page.svelte
Original file line number Diff line number Diff line change
@@ -2,11 +2,8 @@
import { page } from '$app/stores';
import { PendingValue, RepositoryAuthorization, graphql } from '$houdini';
import Card from '$lib/Card.svelte';
import Pagination from '$lib/Pagination.svelte';
import { sortTable } from '$lib/pagination';
import {
Button,
HelpText,
Link,
Table,
Tbody,
@@ -127,47 +124,47 @@
</Tr>
</Thead>
<Tbody>
{#each team.githubRepositories.edges as repo}
{#each team.reconcilerResources.nodes as repo}
<Tr>
<Td><Link href="https://github.com/{repo.node.name}">{repo.node.name}</Link></Td>
{#if teamRoles && teamRoles !== PendingValue && teamRoles.viewerIsMember}
{#if repo.node.authorizations !== null && repo.node.name !== null}
<Td><Link href="https://github.com/{repo.name}">{repo.name}</Link></Td>
<!-- {#if teamRoles && teamRoles !== PendingValue && teamRoles.viewerIsMember} -->
<!-- {#if repo.authorizations !== null && repo.value !== null}
<Td>
{#if repo.node.authorizations.includes('DEPLOY')}
{#if repo.authorizations.includes('DEPLOY')}
<Button
size="xsmall"
variant="danger"
on:click={() => {
deauthorizeDeploy(teamName, repo.node.name);
deauthorizeDeploy(teamName, repo.value);
}}>Deauthorize</Button
>
{:else}
<Button
size="xsmall"
variant="primary-neutral"
on:click={() => {
authorizeDeploy(teamName, repo.node.name);
authorizeDeploy(teamName, repo.value);
}}>Authorize</Button
>
{/if}
</Td>
{/if}
<Td
{/if} -->
<!-- <Td
><div class="roleHelpText">
{repo.node.roleName}<HelpText placement={'left'} title="Role description"
>The team's role for the repository.<br />{repo.node.roleName.toUpperCase()}: {roleDesc(
repo.node.roleName.toUpperCase()
{repo.roleName}<HelpText placement={'left'} title="Role description"
>The team's role for the repository.<br />{repo.roleName.toUpperCase()}: {roleDesc(
repo.roleName.toUpperCase()
)}</HelpText
>
</div></Td
>
{/if}
{/if} -->
</Tr>
{/each}
</Tbody>
</Table>

<Pagination
<!-- <Pagination
pageInfo={team.githubRepositories.pageInfo}
totalCount={team.githubRepositories.totalCount}
on:nextPage={() => {
@@ -178,7 +175,7 @@
if (!$Repositories.pageInfo.hasPreviousPage) return;
Repositories.loadPreviousPage();
}}
/>
/> -->
</Card>
{/if}

2 changes: 1 addition & 1 deletion vite.config.ts
Original file line number Diff line number Diff line change
@@ -14,7 +14,7 @@ export default defineConfig({
headers: {
'X-User-Email': import.meta.env?.VITE_API_USER_EMAIL
? import.meta.env?.VITE_API_USER_EMAIL
: 'dev.usersen@example.com'
: 'admin.usersen@example.com'
}
}
}