Skip to content
Open
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
2 changes: 1 addition & 1 deletion backend/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ go 1.22.2
require (
entgo.io/ent v0.12.5
github.com/99designs/gqlgen v0.17.44
github.com/cble-platform/cble-provider-grpc v0.2.1
github.com/cble-platform/cble-provider-grpc v0.2.2
github.com/docker/docker v25.0.3+incompatible
github.com/fatih/color v1.16.0
github.com/gin-contrib/cors v1.4.0
Expand Down
4 changes: 2 additions & 2 deletions backend/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ github.com/bytedance/sonic v1.5.0/go.mod h1:ED5hyg4y6t3/9Ku1R6dU/4KyJ48DZ4jPhfY1
github.com/bytedance/sonic v1.10.0-rc/go.mod h1:ElCzW+ufi8qKqNW0FY314xriJhyJhuoJ3gFZdAHF7NM=
github.com/bytedance/sonic v1.10.2 h1:GQebETVBxYB7JGWJtLBi07OVzWwt+8dWA00gEVW2ZFE=
github.com/bytedance/sonic v1.10.2/go.mod h1:iZcSUejdk5aukTND/Eu/ivjQuEL0Cu9/rf50Hi0u/g4=
github.com/cble-platform/cble-provider-grpc v0.2.1 h1:ZxL+YPhD+B8jRe4YnIaOC6lhjpWS0iAM/h+tg/Ahfy4=
github.com/cble-platform/cble-provider-grpc v0.2.1/go.mod h1:udlx6gdnTEX2dDU1PvPEOwDnAJKUogbtHqRe3Fg3RZI=
github.com/cble-platform/cble-provider-grpc v0.2.2 h1:Xvl4cnu9vdzx6zbbZ1jJkb72Wtu/9cDp1nu9OGa4X7c=
github.com/cble-platform/cble-provider-grpc v0.2.2/go.mod h1:udlx6gdnTEX2dDU1PvPEOwDnAJKUogbtHqRe3Fg3RZI=
github.com/cenkalti/backoff/v4 v4.2.1 h1:y4OZtCnogmCPw98Zjyt5a6+QwPLGkiQsYW5oUqylYbM=
github.com/cenkalti/backoff/v4 v4.2.1/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE=
github.com/chenzhuoyu/base64x v0.0.0-20211019084208-fb5309c8db06/go.mod h1:DH46F32mSOjUmXrMHnKwZdA8wcEefY7UVqBKYGjpdQY=
Expand Down
10 changes: 9 additions & 1 deletion backend/graph/generated/generated.go

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

9 changes: 5 additions & 4 deletions backend/graph/model/models_gen.go

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

1 change: 1 addition & 0 deletions backend/graph/schema.graphqls
Original file line number Diff line number Diff line change
Expand Up @@ -422,6 +422,7 @@ input ProviderInput {

input UserInput {
username: String!
password: String
email: String!
firstName: String!
lastName: String!
Expand Down
13 changes: 13 additions & 0 deletions backend/graph/schema.resolvers.go

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

13 changes: 13 additions & 0 deletions frontend/src/components/navbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,19 @@ export default function Navbar({
Permissions
</Button>
)}
{navPermissions?.listUsers && (
<Button
href="/users"
sx={{
my: 2,
color: 'white',
display: 'block',
textAlign: 'center',
}}
>
Users
</Button>
)}
</Box>
<IconButton
color="inherit"
Expand Down
12 changes: 12 additions & 0 deletions frontend/src/lib/api/generated/graphql.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -5475,6 +5475,18 @@
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "password",
"description": null,
"type": {
"kind": "SCALAR",
"name": "String",
"ofType": null
},
"defaultValue": null,
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "username",
"description": null,
Expand Down
15 changes: 11 additions & 4 deletions frontend/src/lib/api/generated/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -752,6 +752,7 @@ export type UserInput = {
email: Scalars['String']['input'];
firstName: Scalars['String']['input'];
lastName: Scalars['String']['input'];
password?: InputMaybe<Scalars['String']['input']>;
username: Scalars['String']['input'];
};

Expand Down Expand Up @@ -880,7 +881,7 @@ export type ListPermissionsQuery = { __typename?: 'Query', permissions: { __type
export type NavPermissionsQueryVariables = Exact<{ [key: string]: never; }>;


export type NavPermissionsQuery = { __typename?: 'Query', listProviders: boolean, listPermissions: boolean };
export type NavPermissionsQuery = { __typename?: 'Query', listProviders: boolean, listPermissions: boolean, listUsers: boolean };

export type GrantPermissionMutationVariables = Exact<{
subjectType: SubjectType;
Expand Down Expand Up @@ -1018,7 +1019,10 @@ export type MeQueryVariables = Exact<{ [key: string]: never; }>;

export type MeQuery = { __typename?: 'Query', me: { __typename?: 'User', id: string, createdAt: any, updatedAt: any, username: string, email: string, firstName: string, lastName: string } };

export type ListUsersQueryVariables = Exact<{ [key: string]: never; }>;
export type ListUsersQueryVariables = Exact<{
count?: Scalars['Int']['input'];
offset?: InputMaybe<Scalars['Int']['input']>;
}>;


export type ListUsersQuery = { __typename?: 'Query', users: { __typename?: 'UserPage', total: number, users: Array<{ __typename?: 'User', id: string, createdAt: any, updatedAt: any, username: string, email: string, firstName: string, lastName: string }> } };
Expand Down Expand Up @@ -1762,6 +1766,7 @@ export const NavPermissionsDocument = gql`
objectID: null
action: permission_list
)
listUsers: meHasPermission(objectType: user, objectID: null, action: user_list)
}
`;

Expand Down Expand Up @@ -2431,8 +2436,8 @@ export type MeLazyQueryHookResult = ReturnType<typeof useMeLazyQuery>;
export type MeSuspenseQueryHookResult = ReturnType<typeof useMeSuspenseQuery>;
export type MeQueryResult = Apollo.QueryResult<MeQuery, MeQueryVariables>;
export const ListUsersDocument = gql`
query ListUsers {
users {
query ListUsers($count: Int! = 10, $offset: Int) {
users(count: $count, offset: $offset) {
users {
...UserFragment
}
Expand All @@ -2453,6 +2458,8 @@ export const ListUsersDocument = gql`
* @example
* const { data, loading, error } = useListUsersQuery({
* variables: {
* count: // value for 'count'
* offset: // value for 'offset'
* },
* });
*/
Expand Down
5 changes: 5 additions & 0 deletions frontend/src/lib/api/graphql/permission.gql
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@ query NavPermissions {
objectID: null
action: permission_list
)
listUsers: meHasPermission(
objectType: user
objectID: null
action: user_list
)
}

mutation GrantPermission(
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/lib/api/graphql/user.gql
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ query Me {
}
}

query ListUsers {
users {
query ListUsers($count: Int! = 10, $offset: Int) {
users(count: $count, offset: $offset) {
users {
...UserFragment
}
Expand Down
9 changes: 8 additions & 1 deletion frontend/src/main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,11 @@ import { SnackbarProvider } from 'notistack'
import { ReactFlowProvider } from 'reactflow'
import { Box, CircularProgress } from '@mui/material'
import Logo from './components/logo'
import Users from './routes/users'

// Pages
const Root = lazy(() => import('./routes/root'))
const ErrorPage = lazy(() => import('./error-page'))
const ErrorPage = lazy(() => import('./routes/error-page'))
const Login = lazy(() => import('./routes/auth/login'))
const Blueprints = lazy(() => import('./routes/blueprints'))
const RequestBlueprint = lazy(() => import('./routes/blueprints/request'))
Expand Down Expand Up @@ -168,6 +169,12 @@ const router = createBrowserRouter([
{ index: true, element: <LazyComponent element={<Projects />} /> },
],
},
{
path: 'users',
children: [
{ index: true, element: <LazyComponent element={<Users />} /> },
],
},
],
errorElement: <LazyComponent element={<ErrorPage />} />,
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
import { Container, Typography } from '@mui/material'
import { useRouteError } from 'react-router-dom'
import Navbar from '../components/navbar'
import { ThemeContext } from '../theme'
import { useContext } from 'react'

export default function ErrorPage() {
const { themePreference, setThemePreference } = useContext(ThemeContext)
const error = useRouteError() as {
statusText?: string
error?: Error
Expand All @@ -18,6 +22,7 @@ export default function ErrorPage() {
minHeight: '100dvh',
}}
>
<Navbar themePreference={themePreference} setTheme={setThemePreference} />
<Typography variant="h3">Oops!</Typography>
<Typography variant="body1">
Sorry, an unexpected error has occurred.
Expand Down
Loading