Unverified Commit 56d485f6 authored by Alireza Heidari's avatar Alireza Heidari Committed by mvdbeek
Browse files

Improves credential status logic for optional tools

Updates credential validation to properly handle optional tool credentials by modifying warning conditions and status determination logic.

Enhance documentation for status variant in user credentials composables.

Changes exclamation icon display logic to show warnings when either required credentials are missing OR optional credentials are partially provided.

Refines status computation to return appropriate states based on whether tools have required credentials, preventing incorrect success states when no credentials are needed.
parent 64196180
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -162,7 +162,10 @@ onMounted(async () => {
                            fixed-width
                            transform="shrink-6 right-6 down-6" />
                        <FontAwesomeIcon
                            v-else-if="hasUserProvidedAllRequiredToolsServiceCredentials"
                            v-else-if="
                                !hasUserProvidedAllRequiredToolsServiceCredentials ||
                                !hasUserProvidedSomeOptionalToolsServiceCredentials
                            "
                            :icon="faExclamation"
                            fixed-width
                            transform="shrink-6 right-8 down-7" />
+4 −1
Original line number Diff line number Diff line
@@ -186,7 +186,10 @@ onMounted(async () => {
                            fixed-width
                            transform="shrink-6 right-6 down-6" />
                        <FontAwesomeIcon
                            v-else-if="hasUserProvidedAllRequiredServiceCredentials"
                            v-else-if="
                                !hasUserProvidedAllRequiredServiceCredentials ||
                                !hasUserProvidedSomeOptionalServiceCredentials
                            "
                            :icon="faExclamation"
                            fixed-width
                            transform="shrink-6 right-8 down-7" />
+14 −2
Original line number Diff line number Diff line
@@ -105,7 +105,13 @@ export function useUserMultiToolCredentials(tools: ToolIdentifier[]) {
        );
    });

    /** Status variant based on overall credential state across all tools. */
    /**
     * Get the appropriate status variant based on overall credential state.
     * "info" - when busy checking credentials.
     * "success" - when all required credentials are provided or no required credentials exist.
     * "warning" - when some required credentials are missing.
     * @returns {"info" | "success" | "warning"} Status variant.
     */
    const statusVariant = computed<"info" | "success" | "warning">(() => {
        if (isBusy.value) {
            return "info";
@@ -116,7 +122,13 @@ export function useUserMultiToolCredentials(tools: ToolIdentifier[]) {
        ) {
            return "success";
        }
        if (someToolsHasRequiredServiceCredentials.value) {
            return "warning";
        }
        if (!someToolsHasRequiredServiceCredentials.value) {
            return "success";
        }
        return "info";
    });

    /**
+12 −3
Original line number Diff line number Diff line
@@ -192,16 +192,25 @@ export function useUserToolCredentials(toolId: string, toolVersion: string) {

    /**
     * Get the appropriate banner variant based on credential state.
     * @returns {string} Banner variant ('info', 'success', or 'warning').
     * "info" - when busy checking credentials.
     * "success" - when all required credentials are provided or no required credentials exist.
     * "warning" - when some required credentials are missing.
     * @returns {"info" | "success" | "warning"} Status variant.
     */
    const statusVariant = computed(() => {
    const statusVariant = computed<"info" | "success" | "warning">(() => {
        if (isBusy.value) {
            return "info";
        }
        if (hasUserProvidedAllServiceCredentials.value || hasUserProvidedAllRequiredServiceCredentials.value) {
            return "success";
        }
        if (toolHasRequiredServiceCredentials.value) {
            return "warning";
        }
        if (!toolHasRequiredServiceCredentials.value) {
            return "success";
        }
        return "info";
    });

    /**