diff --git a/.gitignore b/.gitignore index 848cf35f6159d234cc17bdd38b41ac67bf38cbfe..b2e2ad0ac93521d0e4bd94936244a48885950602 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,7 @@ # dependencies /node_modules /frontend/node_modules +/backend/venv /backend/web/node_modules /backend/venv /.pnp diff --git a/backend/areas/users/user_service.py b/backend/areas/users/user_service.py index 0783ef70a9a02add97df1e6fac2dfe06907add17..8ef92c12c7adc8de36e8d2391a501f48e8d45b81 100644 --- a/backend/areas/users/user_service.py +++ b/backend/areas/users/user_service.py @@ -99,7 +99,7 @@ class UserService: db.session.add(app_role) - if data["tags"]: + if data.get("tags"): UserStackspinData.setTags(res["id"], data["tags"]) # Commit all changes to the stackspin database. diff --git a/frontend/src/components/Header/Header.tsx b/frontend/src/components/Header/Header.tsx index 3b360fc069b13d481956c7e212661444bf1fbf3a..451e88d161e93fe51a587e7287347c07de56d3ba 100644 --- a/frontend/src/components/Header/Header.tsx +++ b/frontend/src/components/Header/Header.tsx @@ -1,6 +1,6 @@ import React, { Fragment, useEffect, useState } from 'react'; import { Disclosure, Menu, Transition } from '@headlessui/react'; -import { MenuIcon, XIcon } from '@heroicons/react/outline'; +import { MenuIcon, XIcon, ExclamationIcon } from '@heroicons/react/outline'; import { performApiCall } from 'src/services/api'; import { useAuth } from 'src/services/auth'; import { useApps } from 'src/services/apps'; @@ -32,11 +32,13 @@ function filterNavigationByDashboardRole(isAdmin: boolean) { export interface Environment { HYDRA_PUBLIC_URL: string; KRATOS_PUBLIC_URL: string; + TELEPRESENCE: boolean; } const defaultEnvironment: Environment = { HYDRA_PUBLIC_URL: 'error-failed-to-load-env-from-backend', KRATOS_PUBLIC_URL: 'error-failed-to-load-env-from-backend', + TELEPRESENCE: false, }; // eslint-disable-next-line @typescript-eslint/no-empty-interface @@ -94,8 +96,18 @@ const Header: React.FC<HeaderProps> = () => { </span> ) : null; + // banner that only shows if telepresence is active + const underConstruction = environment.TELEPRESENCE ? ( + <div className="shadow bg-pink-500 h-6 text-xs text-white font-semibold uppercase flex justify-center items-center gap-2"> + <ExclamationIcon className="h-4" /> + <span className="h-4 m-0 p-0">Under Construction</span> + <ExclamationIcon className="h-4" /> + </div> + ) : null; + return ( <> + {underConstruction} <Disclosure as="nav" className="bg-white shadow relative z-10"> {({ open }) => ( <div className="relative"> diff --git a/frontend/src/modules/users/Users.tsx b/frontend/src/modules/users/Users.tsx index b8bbefe45de85fd13cd35ee777d61c56393ac7c9..b4111122d2abb56a6ebbcff43eb8c2f01eede2bf 100644 --- a/frontend/src/modules/users/Users.tsx +++ b/frontend/src/modules/users/Users.tsx @@ -176,6 +176,10 @@ export const Users: React.FC = () => { footer: (props) => props.column.id, accessorKey: 'email', }, + { + header: 'is Admin?', + accessorKey: 'admin', + }, { header: 'Status', footer: (props) => props.column.id, @@ -219,7 +223,7 @@ export const Users: React.FC = () => { }, initialState: { pagination: { - pageSize: 10, + pageSize: 20, }, }, onSortingChange: setSorting, @@ -445,21 +449,6 @@ export const Users: React.FC = () => { )} </div> - {/* <div className="flex flex-col"> - <div className="-my-2 overflow-x-auto sm:-mx-6 lg:-mx-8"> - <div className="py-2 align-middle inline-block min-w-full sm:px-6 lg:px-8"> - <div className="shadow border-b border-gray-200 sm:rounded-lg overflow-hidden"> - <Table - data={filterSearch as any} - columns={columns} - getSelectedRowIds={selectedRows} - loading={userTableLoading} - /> - </div> - </div> - </div> - </div> */} - <div className="flex flex-col"> <div className="-my-2 overflow-x-auto sm:-mx-6 lg:-mx-8"> <div className="py-2 align-middle inline-block min-w-full sm:px-6 lg:px-8">{CreateUserTable()}</div> diff --git a/frontend/src/services/users/transformations.ts b/frontend/src/services/users/transformations.ts index e430c1f08aca360bab416598331b6023c67a31c2..0d045416cefbec9fe679667e4605d8b3540cb7c6 100644 --- a/frontend/src/services/users/transformations.ts +++ b/frontend/src/services/users/transformations.ts @@ -61,6 +61,8 @@ export const transformUser = (response: any): User => { preferredUsername: response.preferredUsername ?? '', status: response.state ?? '', totp: transformTotp(response), + tags: response.stackspin_data.tags ?? '', + admin: response.stackspin_data.stackspin_admin ?? '', }; }; diff --git a/frontend/src/services/users/types.ts b/frontend/src/services/users/types.ts index cb3112f8180bd05dc9c39ed9cde33312e99769f9..44f7e5bd4f5b5cee70d20b47e4bc5ecac523d91f 100644 --- a/frontend/src/services/users/types.ts +++ b/frontend/src/services/users/types.ts @@ -6,6 +6,8 @@ export interface User { preferredUsername: string; status: string; totp?: boolean; + tags?: []; + admin?: boolean; } export interface FormUser extends User {