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: leftnav readonly layout and date fix #1317

Merged
merged 4 commits into from
Aug 28, 2024
Merged
Show file tree
Hide file tree
Changes from 2 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
30 changes: 9 additions & 21 deletions src/renderer/api/cadt/v1/index.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query/react';
import initialState from '@/store/slices/app/app.initialstate';

const projectsTag = 'projects';
const organizationsTag = 'organizations';
const unitsTag = 'units';
const auditTag = 'audit';
const issuancesTag = 'issuances';
const stagedProjectsTag = 'stagedProjects';
const stagedUnitsTag = 'stagedUnits';
const offerTag = 'offer';
const importedOfferTag = 'importedTransferTag';
export const projectsTag = 'projects';
export const organizationsTag = 'organizations';
export const unitsTag = 'units';
export const auditTag = 'audit';
export const issuancesTag = 'issuances';
export const stagedProjectsTag = 'stagedProjects';
export const stagedUnitsTag = 'stagedUnits';
export const offerTag = 'offer';
export const importedOfferTag = 'importedTransferTag';

const baseQuery = fetchBaseQuery({
baseUrl: '/',
Expand Down Expand Up @@ -62,15 +62,3 @@ export const cadtApi = createApi({
],
endpoints: () => ({}),
});

export {
projectsTag,
organizationsTag,
unitsTag,
auditTag,
stagedProjectsTag,
stagedUnitsTag,
issuancesTag,
offerTag,
importedOfferTag,
};
2 changes: 1 addition & 1 deletion src/renderer/api/cadt/v1/system/system.api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ const systemApi = cadtApi.injectEndpoints({
}),
transformResponse: (response: BaseQueryResult<Health>, meta): ServerHealth => {
const isHealthy = response?.message === 'OK';
const readOnly = meta?.response?.headers.get('cw-readonly') === 'true';
const readOnly = meta?.response?.headers.get('cw-read-only') === 'true';
return { isHealthy, readOnly };
},
}),
Expand Down
5 changes: 3 additions & 2 deletions src/renderer/components/blocks/widgets/SyncIndicator.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { BiRefresh } from 'react-icons/bi';
import { useLocation } from 'react-router-dom';
import { useDispatch } from 'react-redux';
import { FormattedMessage } from 'react-intl';
import { projectsTag, stagedProjectsTag, stagedUnitsTag, unitsTag } from '@/api/cadt/v1';

interface SyncIndicatorProps {
detailed: boolean;
Expand Down Expand Up @@ -68,11 +69,11 @@ const SyncIndicator: React.FC<SyncIndicatorProps> = ({ detailed, orgUid }) => {
setShowRefreshBadge(true);

if (location.pathname.includes('projects')) {
dispatch(invalidateProjectApiTag(['projects', 'stagedProjects']));
dispatch(invalidateProjectApiTag([projectsTag, stagedProjectsTag]));
}

if (location.pathname.includes('units')) {
dispatch(invalidateUnitsApiTag(['units', 'stagedUnits']));
dispatch(invalidateUnitsApiTag([unitsTag, stagedUnitsTag]));
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/renderer/components/form/Field.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ const Field: React.FC<FieldProps> = ({
</a>
);
case 'date':
return dayjs(new Date(initialValue)).format('MMMM D, YYYY');
return `${dayjs(new Date(initialValue)).format('MMMM D, YYYY')}`;
case 'tag':
return (
<TagInput defaultValue={initialValue} onChange={(tags) => setFieldValue(name, tags)} readonly={readonly} />
Expand Down