mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-11-01 06:42:06 +01:00
Surface all restored webhook secrets
Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
1 parent
eaedbdb32c
commit
49c20b1f07
2 files changed
+46
-28
No files matched your search
@@ -113,8 +113,8 @@ export function RoutineHistoryTab({
|
||||
pushToast({
|
||||
title: `Restored revision ${restoredFromNumber} as revision ${newNumber}`,
|
||||
body: data.secretMaterials.length > 0
|
||||
? "Paused triggers stay paused. New webhook secret available in the banner above."
|
||||
: "Paused triggers stay paused.",
|
||||
? "Trigger enabled state was restored from the snapshot. New webhook secrets are available in the banner above."
|
||||
: "Trigger enabled state was restored from the snapshot.",
|
||||
tone: "success",
|
||||
});
|
||||
onRestoreSecretMaterials(data);
|
||||
|
||||
@@ -91,8 +91,10 @@ type RoutineTab = (typeof routineTabs)[number];
|
||||
|
||||
type SecretMessage = {
|
||||
title: string;
|
||||
webhookUrl: string;
|
||||
webhookSecret: string;
|
||||
entries: Array<{
|
||||
webhookUrl: string;
|
||||
webhookSecret: string;
|
||||
}>;
|
||||
};
|
||||
|
||||
function autoResizeTextarea(element: HTMLTextAreaElement | null) {
|
||||
@@ -571,8 +573,10 @@ export function RoutineDetail() {
|
||||
if (result.secretMaterial) {
|
||||
setSecretMessage({
|
||||
title: "Webhook trigger created",
|
||||
webhookUrl: result.secretMaterial.webhookUrl,
|
||||
webhookSecret: result.secretMaterial.webhookSecret,
|
||||
entries: [{
|
||||
webhookUrl: result.secretMaterial.webhookUrl,
|
||||
webhookSecret: result.secretMaterial.webhookSecret,
|
||||
}],
|
||||
});
|
||||
} else {
|
||||
pushToast({
|
||||
@@ -646,8 +650,10 @@ export function RoutineDetail() {
|
||||
onSuccess: async (result) => {
|
||||
setSecretMessage({
|
||||
title: "Webhook secret rotated",
|
||||
webhookUrl: result.secretMaterial.webhookUrl,
|
||||
webhookSecret: result.secretMaterial.webhookSecret,
|
||||
entries: [{
|
||||
webhookUrl: result.secretMaterial.webhookUrl,
|
||||
webhookSecret: result.secretMaterial.webhookSecret,
|
||||
}],
|
||||
});
|
||||
await Promise.all([
|
||||
queryClient.invalidateQueries({ queryKey: queryKeys.routines.detail(routineId!) }),
|
||||
@@ -815,21 +821,30 @@ export function RoutineDetail() {
|
||||
<p className="font-medium">{secretMessage.title}</p>
|
||||
<p className="text-xs text-muted-foreground">Save this now. Paperclip will not show the secret value again.</p>
|
||||
</div>
|
||||
<div className="space-y-2">
|
||||
<div className="flex items-center gap-2">
|
||||
<Input value={secretMessage.webhookUrl} readOnly className="flex-1" />
|
||||
<Button variant="outline" size="sm" onClick={() => copySecretValue("Webhook URL", secretMessage.webhookUrl)}>
|
||||
<Copy className="h-3.5 w-3.5 mr-1" />
|
||||
URL
|
||||
</Button>
|
||||
</div>
|
||||
<div className="flex items-center gap-2">
|
||||
<Input value={secretMessage.webhookSecret} readOnly className="flex-1" />
|
||||
<Button variant="outline" size="sm" onClick={() => copySecretValue("Webhook secret", secretMessage.webhookSecret)}>
|
||||
<Copy className="h-3.5 w-3.5 mr-1" />
|
||||
Secret
|
||||
</Button>
|
||||
</div>
|
||||
<div className="space-y-3">
|
||||
{secretMessage.entries.map((entry, index) => (
|
||||
<div key={`${entry.webhookUrl}-${index}`} className="space-y-2">
|
||||
{secretMessage.entries.length > 1 && (
|
||||
<p className="text-xs font-medium text-muted-foreground">
|
||||
Webhook trigger {index + 1} of {secretMessage.entries.length}
|
||||
</p>
|
||||
)}
|
||||
<div className="flex items-center gap-2">
|
||||
<Input value={entry.webhookUrl} readOnly className="flex-1" />
|
||||
<Button variant="outline" size="sm" onClick={() => copySecretValue("Webhook URL", entry.webhookUrl)}>
|
||||
<Copy className="h-3.5 w-3.5 mr-1" />
|
||||
URL
|
||||
</Button>
|
||||
</div>
|
||||
<div className="flex items-center gap-2">
|
||||
<Input value={entry.webhookSecret} readOnly className="flex-1" />
|
||||
<Button variant="outline" size="sm" onClick={() => copySecretValue("Webhook secret", entry.webhookSecret)}>
|
||||
<Copy className="h-3.5 w-3.5 mr-1" />
|
||||
Secret
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
@@ -1227,12 +1242,15 @@ export function RoutineDetail() {
|
||||
agents={agentById}
|
||||
projects={projectById}
|
||||
onRestoreSecretMaterials={(response: RestoreRoutineRevisionResponse) => {
|
||||
const recreated = response.secretMaterials[0];
|
||||
if (recreated) {
|
||||
if (response.secretMaterials.length > 0) {
|
||||
setSecretMessage({
|
||||
title: "Webhook trigger restored",
|
||||
webhookUrl: recreated.webhookUrl,
|
||||
webhookSecret: recreated.webhookSecret,
|
||||
title: response.secretMaterials.length === 1
|
||||
? "Webhook trigger restored"
|
||||
: `${response.secretMaterials.length} webhook triggers restored`,
|
||||
entries: response.secretMaterials.map((recreated) => ({
|
||||
webhookUrl: recreated.webhookUrl,
|
||||
webhookSecret: recreated.webhookSecret,
|
||||
})),
|
||||
});
|
||||
}
|
||||
}}
|
||||
|
||||
Reference in new issue
Block a user