Skip to content

Commit

Permalink
Update jira extension
Browse files Browse the repository at this point in the history
- Added ability  to open issues in other application
- Initial commit
  • Loading branch information
EyLuismi committed Dec 25, 2024
1 parent 075164f commit a927cf8
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 4 deletions.
3 changes: 3 additions & 0 deletions extensions/jira/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Jira Changelog

## [Add ability to open issues in other application defined in extension preferences] - 2024-12-25
- Implemented the ability to open by default in any other application (e.g. other browser) any issue.

## [Add ability to copy newly created issue url to clipboard as an optional config] - 2024-12-12
- If you want to copy the newly created issue URL to the clipboard, you can now enable this feature in the extension settings.

Expand Down
10 changes: 9 additions & 1 deletion extensions/jira/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
"luarmr",
"horumy",
"santiago_perez",
"silv"
"silv",
"EyLuismi"
],
"pastContributors": [
"igor9silva"
Expand Down Expand Up @@ -145,6 +146,13 @@
"description": "API Token",
"type": "password",
"required": false
},
{
"name": "open_in",
"type": "appPicker",
"title": "Open Issues in",
"required": false,
"description": "Select the browser or application to open Issues with."
}
],
"dependencies": {
Expand Down
19 changes: 17 additions & 2 deletions extensions/jira/src/components/IssueActions.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Action, ActionPanel, Icon, showToast, Toast } from "@raycast/api";
import { Action, ActionPanel, closeMainWindow, getPreferenceValues, Icon, showToast, Toast, open } from "@raycast/api";
import { MutatePromise, useCachedPromise } from "@raycast/utils";
import { useState } from "react";

Expand Down Expand Up @@ -146,6 +146,9 @@ export default function IssueActions({
}
}


const { open_in } = getPreferenceValues<Preferences>();

return (
<ActionPanel title={issue.key}>
<ActionPanel.Section>
Expand All @@ -156,8 +159,20 @@ export default function IssueActions({
target={<IssueDetail initialIssue={issue} issueKey={issue.key} />}
/>
) : null}

{open_in ? (
<Action
title={`Open in ${open_in.name}`}
icon={Icon.Globe}
onAction={async () => {
open(issueUrl, open_in);
closeMainWindow();
}}
/>
) : (
<Action.OpenInBrowser url={issueUrl} />
)}

<Action.OpenInBrowser url={issueUrl} />

{showAttachmentsAction && "attachment" in issue.fields ? (
<Action.Push
Expand Down
3 changes: 2 additions & 1 deletion extensions/jira/src/open-from-clipboard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ export default function OpenFromClipboard() {

useEffect(() => {
async function getClipboardText() {
const { open_in } = getPreferenceValues<Preferences>();
const clipboardText = (await Clipboard.readText())?.trim();
if (!clipboardText || clipboardText.length == 0) {
await showHUD("Clipboard empty", { clearRootSearch: true, popToRootType: PopToRootType.Immediate });
Expand All @@ -42,7 +43,7 @@ export default function OpenFromClipboard() {
// If we got a base URL configured, open the issue in the browser and close raycast
const baseUrl = getBaseURL();
if (baseUrl) {
await open(getBaseURL() + "/browse/" + clipboardText);
await open(getBaseURL() + "/browse/" + clipboardText, open_in ?? undefined);
await closeMainWindow({ clearRootSearch: true, popToRootType: PopToRootType.Immediate });
return;
}
Expand Down

0 comments on commit a927cf8

Please sign in to comment.