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: UI issues #893

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from
Open
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
2 changes: 1 addition & 1 deletion ui/src/adapters/api/identities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export async function getIdentities({
signal,
}: {
env: Env;
signal: AbortSignal;
signal?: AbortSignal;
}): Promise<Response<List<Identity>>> {
try {
const response = await axios({
Expand Down
6 changes: 3 additions & 3 deletions ui/src/adapters/parsers/view.ts
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ export type IssueCredentialFormData = {
credentialExpiration?: dayjs.Dayjs | null;
credentialStatusType: CredentialStatusType | null;
credentialSubject?: Record<string, unknown>;
displayMethod: { enabled: boolean; type: DisplayMethodType | ""; url: string };
displayMethod: { enabled: boolean; type: DisplayMethodType | ""; url: string | null };
proofTypes: ProofType[];
refreshService: { enabled: boolean; url: string };
schemaID?: string;
Expand All @@ -215,7 +215,7 @@ const issueCredentialFormDataParser = getStrictParser<IssueCredentialFormData>()
displayMethod: z.object({
enabled: z.boolean(),
type: z.union([z.nativeEnum(DisplayMethodType), z.literal("")]),
url: z.union([z.string().url(), z.literal("")]),
url: z.union([z.string().url().nullable(), z.literal("")]),
}),
proofTypes: z.array(z.nativeEnum(ProofType)).min(1, "At least one proof type is required"),
refreshService: z.object({
Expand Down Expand Up @@ -253,7 +253,7 @@ export const credentialFormParser = getStrictParser<

const baseIssuance = {
credentialDisplayMethod:
displayMethod.enabled && displayMethod.type !== ""
displayMethod.enabled && displayMethod.type !== "" && displayMethod.url
? { type: displayMethod.type, url: displayMethod.url }
: undefined,
credentialExpiration: credentialExpiration ? credentialExpiration.toDate() : undefined,
Expand Down
2 changes: 1 addition & 1 deletion ui/src/components/credentials/IssueCredential.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ const defaultCredentialFormInput: CredentialFormInput = {
},
issueCredential: {
credentialStatusType: null,
displayMethod: { enabled: false, type: "", url: "" },
displayMethod: { enabled: false, type: "", url: null },
proofTypes: [ProofType.BJJSignature2021],
refreshService: { enabled: false, url: "" },
},
Expand Down
6 changes: 3 additions & 3 deletions ui/src/components/credentials/IssueCredentialForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ export function IssueCredentialForm({
enabled: initialValues.displayMethod.enabled,
...(schemaDefaultDisplayMethod
? { type: schemaDefaultDisplayMethod.type, url: schemaDefaultDisplayMethod.url }
: { type: "", url: "" }),
: { type: "", url: null }),
},
}
: initialValues;
Expand Down Expand Up @@ -635,7 +635,7 @@ export function IssueCredentialForm({
<Select
className="full-width"
loading={isAsyncTaskStarting(credentialStatusTypes)}
placeholder="Valid URL of the display method"
placeholder="Choose revocation status"
>
{isAsyncTaskDataAvailable(credentialStatusTypes) &&
credentialStatusTypes.data.map((status) => (
Expand Down Expand Up @@ -714,7 +714,7 @@ export function IssueCredentialForm({
<Select
className="full-width"
loading={isAsyncTaskStarting(displayMethods)}
placeholder="Valid URL of the display method"
placeholder="Select display method"
>
{isAsyncTaskDataAvailable(displayMethods) &&
displayMethods.data.map(({ id, name, url }) => (
Expand Down
2 changes: 1 addition & 1 deletion ui/src/components/display-methods/DisplayMethodCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ export function DisplayMethodCard({ metadata }: { metadata: DisplayMethodMetadat
alt={metadata.logo.alt}
preview={false}
src={processedLogoImageUrl.success ? processedLogoImageUrl.data : metadata.logo.uri}
style={{ fontSize, width: getEmSize(44) }}
style={{ fontSize, maxHeight: getEmSize(44), maxWidth: getEmSize(44) }}
/>
<Flex vertical>
<Typography.Text
Expand Down
3 changes: 3 additions & 0 deletions ui/src/components/identities/Identity.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { ErrorResult } from "src/components/shared/ErrorResult";
import { LoadingResult } from "src/components/shared/LoadingResult";
import { SiderLayoutContent } from "src/components/shared/SiderLayoutContent";
import { useEnvContext } from "src/contexts/Env";
import { useIdentityContext } from "src/contexts/Identity";
import { AppError, IdentityDetails } from "src/domain";
import { AsyncTask, hasAsyncTaskFailed, isAsyncTaskStarting } from "src/utils/async";
import { isAbortedError, makeRequestAbortable } from "src/utils/browser";
Expand All @@ -20,6 +21,7 @@ import { formatIdentifier } from "src/utils/forms";

export function Identity() {
const env = useEnvContext();
const { fetchIdentities } = useIdentityContext();
const [identity, setIdentity] = useState<AsyncTask<IdentityDetails, AppError>>({
status: "pending",
});
Expand Down Expand Up @@ -74,6 +76,7 @@ export function Identity() {
if (response.success) {
void fetchIdentity().then(() => {
setIsEditModalOpen(false);
void fetchIdentities();
void message.success("Identity edited successfully");
});
} else {
Expand Down
4 changes: 2 additions & 2 deletions ui/src/contexts/Identity.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import {
} from "src/utils/constants";

type IdentityState = {
fetchIdentities: (signal: AbortSignal) => void;
fetchIdentities: (signal?: AbortSignal) => void;
getSelectedIdentity: () => Identity | undefined;
identifier: string;
identityList: AsyncTask<Identity[], AppError>;
Expand Down Expand Up @@ -61,7 +61,7 @@ export function IdentityProvider(props: PropsWithChildren) {
const identifierParam = searchParams.get(IDENTIFIER_SEARCH_PARAM);

const fetchIdentities = useCallback(
async (signal: AbortSignal) => {
async (signal?: AbortSignal) => {
setIdentityList((previousState) =>
isAsyncTaskDataAvailable(previousState)
? { data: previousState.data, status: "reloading" }
Expand Down
Loading