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

(chore) Miscellaneous tweaks #55

Merged
merged 1 commit into from
Aug 28, 2024
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
1 change: 0 additions & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
src/**/*.test.tsx
src/**/*.spec.tsx
**/node_modules/**/*
2 changes: 0 additions & 2 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
dist/
node_modules/
**/*.css
**/*.scss
**/*.md
**/*.json
2 changes: 1 addition & 1 deletion packages/esm-admin-openconceptlab-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "@openmrs/esm-openconceptlab-app",
"version": "4.0.3",
"license": "MPL-2.0",
"description": "An app to manage the openconceptlab module",
"description": "Open Concept Lab management frontend module for O3",
"browser": "dist/openmrs-esm-openconceptlab-app.js",
"main": "src/index.ts",
"source": true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@ const Import: React.FC = () => {
const [file, setFile] = useState<File>();
const [isFileUploading, setIsFileUploading] = useState(false);

const { data: subscription, isLoading, isError } = useSubscription();
const { data: subscription, isLoading, error } = useSubscription();

useEffect(() => {
if (!isLoading && !isError) {
if (!isLoading && !error) {
setIsSubscriptionAvailable(!!subscription);
}
}, [isLoading, isError, subscription]);
}, [isLoading, error, subscription]);

const onAddFiles = useCallback(
(evt: React.DragEvent<HTMLInputElement>, { addedFiles }) => {
Expand Down Expand Up @@ -138,7 +138,7 @@ const Import: React.FC = () => {
);
}

if (isError) {
if (error) {
showNotification({
kind: 'error',
description: t('subscriptionError', 'Error occured while fetching the subscription'),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ import useSWR from 'swr';
import type { Import, Subscription } from '../types';

export function useSubscription() {
const { data, error, isValidating } = useSWR<{ data: { results: Subscription[] } }, Error>(
const { data, error, isLoading, isValidating } = useSWR<{ data: { results: Subscription[] } }, Error>(
'/ws/rest/v1/openconceptlab/subscription?v=full',
openmrsFetch,
);

return {
data: data?.data?.results[0],
isLoading: !data && !error,
isError: error,
error,
isLoading,
isValidating,
};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const PreviousImports: React.FC = () => {
const { t } = useTranslation();
const [pageSize, setPageSize] = useState(10);

const { data: prevImports, isLoading, isError } = usePreviousImports();
const { data: prevImports, isLoading, error } = usePreviousImports();
const { results, currentPage, goTo } = usePagination(prevImports, pageSize);

if (isLoading) {
Expand All @@ -43,7 +43,7 @@ const PreviousImports: React.FC = () => {
);
}

if (isError) {
if (error) {
showNotification({
kind: 'error',
description: t('previousImportsFetchError', 'Error occured while fetching the imports'),
Expand Down Expand Up @@ -76,7 +76,7 @@ const PreviousImports: React.FC = () => {

return (
!isLoading &&
!isError && (
!error && (
<Grid className={styles.grid}>
<Column sm={4} md={8} lg={10}>
<h3 className={styles.productiveHeading03}>{t('previousImports', 'Previous Imports')}</h3>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ import useSWR from 'swr';
import type { Import } from '../types';

export function usePreviousImports() {
const { data, error, isValidating } = useSWR<{ data: { results: Import[] } }, Error>(
const { data, error, isLoading, isValidating } = useSWR<{ data: { results: Import[] } }, Error>(
'/ws/rest/v1/openconceptlab/import?v=full',
openmrsFetch,
);

return {
data: data?.data?.results,
isLoading: !data && !error,
isError: error,
error,
isLoading,
isValidating,
};
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,17 @@ const Subscription: React.FC = () => {
const [validationType, setValidationType] = useState<'NONE' | 'FULL'>('FULL');
const [isSnapshotOptionDisabled, setIsSnapshotOptionDisabled] = useState(false);

const { data: subscription, isLoading, isError } = useSubscription();
const { data: subscription, isLoading, error } = useSubscription();

useEffect(() => {
if (!isLoading && !isError) {
if (!isLoading && !error) {
setSubscriptionUrl(subscription?.url || '');
setToken(subscription?.token || '');
setIsSubscribedToSnapshot(subscription?.subscribedToSnapshot || false);
setValidationType(subscription?.validationType || 'FULL');
setIsSnapshotOptionDisabled(subscription ? isVersionDefinedInUrl(subscription.url) : false);
}
}, [isLoading, isError, subscription]);
}, [isLoading, error, subscription]);

const handleChangeSubscriptionUrl = useCallback((event: React.ChangeEvent<HTMLInputElement>) => {
setSubscriptionUrl(event.target.value);
Expand Down Expand Up @@ -189,7 +189,7 @@ const Subscription: React.FC = () => {
);
}

if (isError) {
if (error) {
showNotification({
kind: 'error',
description: t('subscriptionError', 'Error occured while fetching the subscription'),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ import isNil from 'lodash-es/isNil';
import type { Subscription } from '../types';

export function useSubscription() {
const { data, error, isValidating } = useSWR<{ data: { results: Subscription[] } }, Error>(
const { data, error, isLoading, isValidating } = useSWR<{ data: { results: Subscription[] } }, Error>(
'/ws/rest/v1/openconceptlab/subscription?v=full',
openmrsFetch,
);

return {
data: data?.data?.results[0],
isLoading: !data && !error,
isError: error,
error,
isLoading,
isValidating,
};
}
Expand Down
2 changes: 1 addition & 1 deletion packages/esm-system-admin-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "@openmrs/esm-system-admin-app",
"version": "4.0.3",
"license": "MPL-2.0",
"description": "System Admin page for OpenMRS",
"description": "System admin frontend module for O3",
"browser": "dist/openmrs-esm-system-admin-app.js",
"main": "src/index.ts",
"source": true,
Expand Down