forked from raycast/extensions
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Coolify] view-secret-keys + update-projects (raycast#16003)
* [Coolify] view-secret-keys + update-projects * Update CHANGELOG.md and optimise images --------- Co-authored-by: raycastbot <[email protected]>
- Loading branch information
1 parent
1b5985f
commit a7f442e
Showing
8 changed files
with
184 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import { Action, ActionPanel, Form, Icon, useNavigation } from "@raycast/api"; | ||
import { FormValidation, useForm } from "@raycast/utils"; | ||
import { useState } from "react"; | ||
import { type CreateProject } from "../../types"; | ||
import useCoolify from "../../use-coolify"; | ||
|
||
export default function CreateProject({ onAdded }: { onAdded: () => void }) { | ||
const { pop } = useNavigation(); | ||
const [execute, setExecute] = useState(false); | ||
|
||
const { itemProps, handleSubmit, values } = useForm<CreateProject>({ | ||
onSubmit() { | ||
setExecute(true); | ||
}, | ||
validation: { | ||
name: FormValidation.Required, | ||
}, | ||
}); | ||
|
||
const { isLoading } = useCoolify("projects", { | ||
method: "POST", | ||
body: values, | ||
execute, | ||
onData() { | ||
onAdded(); | ||
pop(); | ||
}, | ||
onError() { | ||
setExecute(false); | ||
}, | ||
}); | ||
|
||
return ( | ||
<Form | ||
isLoading={isLoading} | ||
actions={ | ||
<ActionPanel> | ||
<Action.SubmitForm icon={Icon.Check} onSubmit={handleSubmit} /> | ||
</ActionPanel> | ||
} | ||
> | ||
<Form.Description text="Create Project" /> | ||
<Form.TextField title="Name" placeholder="Your Cool Project" {...itemProps.name} /> | ||
<Form.TextField | ||
title="Description" | ||
placeholder="This is my cool project everyone knows about" | ||
{...itemProps.description} | ||
/> | ||
<Form.Description text="New project will have a default production environment." /> | ||
</Form> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
import { Action, ActionPanel, Form, Icon, useNavigation } from "@raycast/api"; | ||
import { FormValidation, useForm } from "@raycast/utils"; | ||
import { useState } from "react"; | ||
import { CreateProject, Project } from "../../types"; | ||
import useCoolify from "../../use-coolify"; | ||
|
||
export default function UpdateProject({ project, onUpdated }: { project: Project; onUpdated: () => void }) { | ||
const { pop } = useNavigation(); | ||
const [execute, setExecute] = useState(false); | ||
|
||
const { itemProps, handleSubmit, values } = useForm<CreateProject>({ | ||
onSubmit() { | ||
setExecute(true); | ||
}, | ||
validation: { | ||
name: FormValidation.Required, | ||
}, | ||
initialValues: { | ||
name: project.name, | ||
description: project.description || "", | ||
}, | ||
}); | ||
|
||
const { isLoading } = useCoolify(`projects/${project.uuid}`, { | ||
method: "PATCH", | ||
body: values, | ||
execute, | ||
onData() { | ||
onUpdated(); | ||
pop(); | ||
}, | ||
onError() { | ||
setExecute(false); | ||
}, | ||
}); | ||
|
||
return ( | ||
<Form | ||
isLoading={isLoading} | ||
actions={ | ||
<ActionPanel> | ||
<Action.SubmitForm icon={Icon.Check} onSubmit={handleSubmit} /> | ||
</ActionPanel> | ||
} | ||
> | ||
<Form.Description text="Update Project" /> | ||
<Form.TextField title="Name" placeholder="Your Cooler Project" {...itemProps.name} /> | ||
<Form.TextField | ||
title="Description" | ||
placeholder="This is my cooler project everyone knows about" | ||
{...itemProps.description} | ||
/> | ||
</Form> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import { Action, ActionPanel, Icon, List } from "@raycast/api"; | ||
import InvalidUrl from "./lib/components/invalid-url"; | ||
import { PrivateKey } from "./lib/types"; | ||
import useCoolify from "./lib/use-coolify"; | ||
import { isValidCoolifyUrl } from "./lib/utils"; | ||
import { useState } from "react"; | ||
|
||
export default function PrivateKeys() { | ||
if (!isValidCoolifyUrl()) return <InvalidUrl />; | ||
|
||
const { isLoading, data: keys = [] } = useCoolify<PrivateKey[]>("security/keys"); | ||
|
||
const [isShowingDetail, setIsShowingDetail] = useState(false); | ||
|
||
return ( | ||
<List isLoading={isLoading} searchBarPlaceholder="Search keys" isShowingDetail={isShowingDetail}> | ||
<List.Section title="Private Keys" subtitle={`${keys.length} keys`}> | ||
{keys.map((key) => ( | ||
<List.Item | ||
key={key.id} | ||
icon={Icon.Key} | ||
title={key.name} | ||
subtitle={isShowingDetail ? undefined : key.description} | ||
detail={<List.Item.Detail markdown={key.private_key} />} | ||
actions={ | ||
<ActionPanel> | ||
<Action | ||
icon={Icon.AppWindowSidebarLeft} | ||
title="Toggle Private Key" | ||
onAction={() => setIsShowingDetail((prev) => !prev)} | ||
/> | ||
<Action.CopyToClipboard title="Copy Private Key to Clipboard" content={key.private_key} /> | ||
</ActionPanel> | ||
} | ||
/> | ||
))} | ||
</List.Section> | ||
</List> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters