Skip to content

Commit

Permalink
fix: prettier + eslint
Browse files Browse the repository at this point in the history
  • Loading branch information
goranbs committed Mar 22, 2024
1 parent 8a5412b commit 2fced69
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 52 deletions.
2 changes: 1 addition & 1 deletion frontend/src/lib/modules/alert.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,4 @@
</div>
</aside>
</div>
{/if}
{/if}
4 changes: 3 additions & 1 deletion frontend/src/routes/artifacts/artifact.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
import type { ArtifactHierarchyType } from '$typesdefinitions';
import Artifact from './artifact.svelte';
import SymbolForArtifact from './symbol-for-artifact.svelte';
export let artifact: ArtifactHierarchyType;
function toggleOpen(artifact: ArtifactHierarchyType): void {
// eslint-disable-next-line no-param-reassign
artifact.isExpanded = !artifact.isExpanded;
Expand Down Expand Up @@ -48,4 +50,4 @@
display: flex;
align-items: center;
}
</style>
</style>
59 changes: 9 additions & 50 deletions frontend/src/routes/artifacts/artifacts.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -4,63 +4,20 @@
import { requestGraphQLClient } from '$lib/graphqlUtils';
import allBucketsQuery from '$queries/get_all_buckets';
import allArtifactsQuery from '$queries/get_all_artifacts';
import { selectedBucket, reactiveBuckets, buckets } from '$stores/stores';
import { selectedBucket, buckets } from '$stores/stores';
import Alert from '$lib/modules/alert.svelte';
// TODO: consolidate types in the types.d.ts file
//import type { ArtifactType, BucketType } from '$lib/folders_types';
import type { Bucket, Artifact, BucketWithArtifacts } from '$typesdefinitions';
import FolderStructure from './artifact-structure.svelte';
let requestsComplete = false;
let alertTitle: string = '';
let alertMessage: string = '';
let alertVariant: string = '';
let alertVisible: boolean = false;
async function getBuckets(): Promise<JSON> {
try {
const response = await fetch(`/api/minio/buckets`);
if (!response.ok) {
const data = (await response.json()) as JSON;
throw new Error(
`Request error! Failed to load data! ${response.statusText} ${JSON.stringify(data)}`
);
}
const data = (await response.json()) as JSON;
// console.log('getBuckets:', data);
return data;
} catch (error) {
alertVisible = true;
alertTitle = 'Request Error';
alertMessage = `${error as string}`;
alertVariant = 'variant-filled-error';
// console.error(error);
return {} as JSON;
}
}
async function getArtifacts(bucket: string): Promise<JSON> {
// console.log("fetching artifacts");
try {
const response = await fetch(`/api/minio/buckets/objects?bucketName=${bucket}`);
if (!response.ok) {
const data = (await response.json()) as JSON;
throw new Error(
`Request error! Failed to load data! ${response.statusText} ${JSON.stringify(data)}`
);
}
const data = (await response.json()) as JSON;
// console.log('getArtifacts:', data);
return data;
} catch (error) {
alertVisible = true;
alertTitle = 'Request Error';
alertMessage = `${error as string}`;
alertVariant = 'variant-filled-error';
// console.error(error);
return {} as JSON;
}
}
const alertVariant: string = 'variant-filled-error';
async function loadData2(): Promise<void> {
const buckets_response: { buckets: Bucket[] } = await requestGraphQLClient(allBucketsQuery);
const requests = buckets_response.buckets.map(async (bucket) => {
const bucketsResponse: { buckets: Bucket[] } = await requestGraphQLClient(allBucketsQuery);
const requests = bucketsResponse.buckets.map(async (bucket) => {
const artifacts: { artifacts: Artifact[] } = await requestGraphQLClient(allArtifactsQuery, {
bucketName: bucket.name
});
Expand All @@ -83,8 +40,10 @@
alertMessage = `${error}`;
});
}
// TODO: implement the downloadArtifacts function
// this requires a new API endpoint to be implemented in the api routes
onMount(async () => {
// await loadData();
await loadData2();
Expand Down Expand Up @@ -117,4 +76,4 @@
.artifacts {
padding: 1rem;
}
</style>
</style>

0 comments on commit 2fced69

Please sign in to comment.