fix: No option to install/disconnect app from app detail page (#17997)
* fix: No option to install/disconnect app from app detail page * Fix types * fix: Install button showing up even after it is installed for all targers * chore: Simplified installOrDisconnectAppButton making it easy to read --------- Co-authored-by: Hariom <[email protected]> Co-authored-by: Peer Richelsen <[email protected]>
This commit is contained in:
5 files changed
+233
-78
No files matched your search
@@ -9,6 +9,7 @@ import { DisconnectIntegrationComponent, showToast } from "@calcom/ui";
|
||||
|
||||
export default function DisconnectIntegration(props: {
|
||||
credentialId: number;
|
||||
teamId?: number | null;
|
||||
label?: string;
|
||||
trashIcon?: boolean;
|
||||
isGlobal?: boolean;
|
||||
@@ -16,7 +17,7 @@ export default function DisconnectIntegration(props: {
|
||||
buttonProps?: ButtonProps;
|
||||
}) {
|
||||
const { t } = useLocale();
|
||||
const { onSuccess, credentialId } = props;
|
||||
const { onSuccess, credentialId, teamId } = props;
|
||||
const [modalOpen, setModalOpen] = useState(false);
|
||||
const utils = trpc.useUtils();
|
||||
|
||||
@@ -38,7 +39,7 @@ export default function DisconnectIntegration(props: {
|
||||
|
||||
return (
|
||||
<DisconnectIntegrationComponent
|
||||
onDeletionConfirmation={() => mutation.mutate({ id: credentialId })}
|
||||
onDeletionConfirmation={() => mutation.mutate({ id: credentialId, ...(teamId ? { teamId } : {}) })}
|
||||
isModalOpen={modalOpen}
|
||||
onModalOpen={() => setModalOpen((prevValue) => !prevValue)}
|
||||
{...props}
|
||||
|
||||
@@ -29,6 +29,18 @@ export const appCredentialsByTypeHandler = async ({ ctx, input }: AppCredentials
|
||||
],
|
||||
type: input.appType,
|
||||
},
|
||||
include: {
|
||||
user: {
|
||||
select: {
|
||||
name: true,
|
||||
},
|
||||
},
|
||||
team: {
|
||||
select: {
|
||||
name: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
// For app pages need to return which teams the user can install the app on
|
||||
|
||||
Reference in new issue
Block a user