Skip to content

Commit

Permalink
Prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
CannonLock committed Nov 19, 2024
1 parent bd4bed8 commit 0124123
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 17 deletions.
6 changes: 3 additions & 3 deletions web_ui/frontend/app/director/components/DirectorCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,12 @@ export const DirectorCard = ({ server, authenticated }: DirectorCardProps) => {
if (detailedServer === undefined) {
alertOnError(
async () => {
const response = await getDirectorServer(server.name)
const response = await getDirectorServer(server.name);
setDetailedServer(await response.json());
},
"Failed to fetch server details",
'Failed to fetch server details',
dispatch
)
);
}
}}
>
Expand Down
5 changes: 3 additions & 2 deletions web_ui/frontend/app/director/components/NamespaceCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ export interface NamespaceCardProps {
}

export const NamespaceCard = ({ namespace }: NamespaceCardProps) => {

const dispatch = useContext(AlertDispatchContext);
const [dropdownOpen, setDropdownOpen] = useState<boolean>(false);
const [servers, setServers] = useState<ServerDetailed[] | undefined>(
Expand Down Expand Up @@ -62,7 +61,9 @@ export const NamespaceCard = ({ namespace }: NamespaceCardProps) => {

const getAssociatedServers = async (namespace: DirectorNamespace) => {
const servers = await Promise.all(
[...namespace.origins, ...namespace.caches].map(async (name) => (await getDirectorServer(name)).json())
[...namespace.origins, ...namespace.caches].map(async (name) =>
(await getDirectorServer(name)).json()
)
);

// Alert the console if any servers are undefined, as this is unlikely to happen naturally
Expand Down
13 changes: 11 additions & 2 deletions web_ui/frontend/app/director/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,21 @@ export default function Page() {
const { data } = useSWR<ServerGeneral[] | undefined>(
'getDirectorServers',
async () =>
await alertOnError(getDirectorServers, 'Failed to fetch servers', dispatch)
await alertOnError(
getDirectorServers,
'Failed to fetch servers',
dispatch
)
);

const { data: namespaces } = useSWR<DirectorNamespace[] | undefined>(
'getDirectorNamespaces',
async () => await alertOnError(getDirectorNamespaces, "Faild to fetch Namespaces", dispatch)
async () =>
await alertOnError(
getDirectorNamespaces,
'Faild to fetch Namespaces',
dispatch
)
);

const { data: user, error } = useSWR('getUser', () =>
Expand Down
4 changes: 3 additions & 1 deletion web_ui/frontend/app/registry/components/PutPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,9 @@ import { alertOnError } from '@/helpers/util';
const PutPage = ({ update }: NamespaceFormPage) => {
const [id, setId] = useState<number | undefined>(undefined);
const [fromUrl, setFromUrl] = useState<URL | undefined>(undefined);
const [namespace, setNamespace] = useState<RegistryNamespace | undefined>(undefined);
const [namespace, setNamespace] = useState<RegistryNamespace | undefined>(
undefined
);

const dispatch = useContext(AlertDispatchContext);

Expand Down
3 changes: 1 addition & 2 deletions web_ui/frontend/helpers/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ export const getDirectorServer = async (name: string): Promise<Response> => {
);

return await fetchApi(async () => await fetch(url));
}
};

/**
* Get namespaces from director
Expand All @@ -147,7 +147,6 @@ export const getDirectorNamespaces = async () => {
return await fetchApi(async () => await fetch(url));
};


/**
* Get namespaces
*/
Expand Down
11 changes: 5 additions & 6 deletions web_ui/frontend/helpers/get.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
getDirectorNamespaces as getDirectorNamespacesResponse,
getDirectorServers as getDirectorServersResponse,
getConfig as getConfigResponse,
getNamespaces
getNamespaces,
} from '@/helpers/api';
import { flattenObject } from '@/app/config/util';
import { DirectorNamespace } from '@/types';
Expand All @@ -25,22 +25,21 @@ import { ServerGeneral } from '@/types';
* Get and sort director servers
*/
export const getDirectorServers = async () => {
const response = await getDirectorServersResponse()
const response = await getDirectorServersResponse();
const responseData: ServerGeneral[] = await response.json();
responseData.sort((a, b) => a.name.localeCompare(b.name));
return responseData;
}
};

/**
* Get and sort director namespaces
*/
export const getDirectorNamespaces = async () => {
const response = await getDirectorNamespacesResponse()
const response = await getDirectorNamespacesResponse();
const responseData: DirectorNamespace[] = await response.json();
responseData.sort((a, b) => a.path.localeCompare(b.path));
return responseData;
}

};

export const getConfig = async (): Promise<ParameterValueRecord> => {
let response = await getConfigResponse();
Expand Down
1 change: 0 additions & 1 deletion web_ui/frontend/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ export interface Server {
namespacePrefixes: string[];
}


export type StringTree = { [key: string]: StringTree | true };

export interface Alert {
Expand Down

0 comments on commit 0124123

Please sign in to comment.