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

Fix flatui #1011

Merged
merged 2 commits into from
Aug 15, 2023
Merged
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
5 changes: 5 additions & 0 deletions .changeset/lovely-ghosts-sin.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@portaljs/components': patch
---

fix bug when there were multiple flatuitable components at the same time
5 changes: 5 additions & 0 deletions .changeset/rare-pianos-repair.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@portaljs/ckan': patch
---

added package_count to organization type
10 changes: 5 additions & 5 deletions packages/ckan/src/interfaces/group.interface.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Activity } from "./activity.interface";
import { Dataset, Tag } from "./dataset.interface";
import { User } from "./user.interface";
import { Activity } from './activity.interface';
import { Dataset, Tag } from './dataset.interface';
import { User } from './user.interface';

export interface Group {
display_name: string;
Expand All @@ -10,9 +10,9 @@ export interface Group {
created: string;
name: string;
is_organization: false;
state: "active" | "deleted" | "inactive";
state: 'active' | 'deleted' | 'inactive';
image_url: string;
type: "group";
type: 'group';
title: string;
revision_id: string;
num_followers: number;
Expand Down
11 changes: 6 additions & 5 deletions packages/ckan/src/interfaces/organization.interface.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Activity } from "./activity.interface";
import { Dataset, Tag } from "./dataset.interface";
import { User } from "./user.interface";
import { Activity } from './activity.interface';
import { Dataset, Tag } from './dataset.interface';
import { User } from './user.interface';

export interface Organization {
id: string;
Expand All @@ -13,8 +13,9 @@ export interface Organization {
image_display_url?: string;
created?: string;
is_organization: boolean;
approval_status?: "approved";
state: "active";
package_count: number;
approval_status?: 'approved';
state: 'active';
packages?: Array<Dataset>;
activity_stream?: Array<Activity>;
users?: Array<User>;
Expand Down
Binary file removed packages/components/portaljs-components-0.1.12.tgz
Binary file not shown.
15 changes: 12 additions & 3 deletions packages/components/src/components/FlatUiTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,17 +42,25 @@ export interface FlatUiTableProps {
data?: { [key: string]: number | string }[];
rawCsv?: string;
corsProxy?: string;
randomId?: number;
}
export const FlatUiTable: React.FC<FlatUiTableProps> = ({
url,
data,
rawCsv,
corsProxy,
}) => {
const randomId = Math.random();
return (
// Provide the client to your App
<QueryClientProvider client={queryClient}>
<TableInner corsProxy={corsProxy} url={url} data={data} rawCsv={rawCsv} />
<TableInner
corsProxy={corsProxy}
url={url}
data={data}
rawCsv={rawCsv}
randomId={randomId}
/>
</QueryClientProvider>
);
};
Expand All @@ -62,6 +70,7 @@ const TableInner: React.FC<FlatUiTableProps> = ({
data,
rawCsv,
corsProxy,
randomId,
}) => {
if (data) {
return (
Expand All @@ -71,12 +80,12 @@ const TableInner: React.FC<FlatUiTableProps> = ({
);
}
const { data: csvString, isLoading: isDownloadingCSV } = useQuery(
['dataCsv', url],
['dataCsv', url, randomId],
() => getCsv(url as string, corsProxy),
{ enabled: !!url }
);
const { data: parsedData, isLoading: isParsing } = useQuery(
['dataPreview', csvString],
['dataPreview', csvString, randomId],
() => parseCsv(rawCsv ? (rawCsv as string) : (csvString as string)),
{ enabled: rawCsv ? true : !!csvString }
);
Expand Down