import IssueTags from './IssueTags';
import IssueTransition from './IssueTransition';
import IssueType from './IssueType';
+import IssueOpenInIde from "./IssueOpenInIde";
interface Props {
issue: T.Issue;
}
};
+ openInIde = (issue: T.Issue) => {
+ console.log(issue);
+ async function postData(url = '') {
+ // Default options are marked with *
+ const response = await fetch(url, {
+ method: 'GET', // *GET, POST, PUT, DELETE, etc.
+ mode: 'cors', // no-cors, *cors, same-origin
+ cache: 'no-cache', // *default, no-cache, reload, force-cache, only-if-cached
+ credentials: 'same-origin', // include, *same-origin, omit
+ headers: {
+ 'Content-Type': 'application/json',
+ 'Access-Control-Allow-Origin': 'http://localhost:9000 http://135.181.88.65:9000'
+ // 'Content-Type': 'application/x-www-form-urlencoded',
+ },
+ redirect: 'follow', // manual, *follow, error
+ referrerPolicy: 'no-referrer', // no-referrer, *no-referrer-when-downgrade, origin, origin-when-cross-origin, same-origin, strict-origin, strict-origin-when-cross-origin, unsafe-url
+ body: null// body data type must match "Content-Type" header
+ });
+ return response.json(); // parses JSON response into native JavaScript objects
+ }
+ postData(`http://localhost:63333?projectName=${issue.projectName}&fileName=${issue.componentLongName}&lineNumber=${issue.line}`)
+ .then(data => {
+ console.log(data); // JSON data parsed by `data.json()` call
+ });
+ }
+
+
render() {
const { issue } = this.props;
const canAssign = issue.actions.includes('assign');
toggleComment={this.toggleComment}
/>
)}
+ <IssueOpenInIde openIssueInIde={() => this.openInIde(issue)}/>
</ul>
<ul className="list-inline">
<li className="issue-meta js-issue-tags">
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2020 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+import * as React from 'react';
+import { ButtonLink } from 'sonar-ui-common/components/controls/buttons';
+
+
+interface Props {
+ openIssueInIde:() => void
+}
+
+export default class IssueOpenInIde extends React.PureComponent<Props> {
+
+ render() {
+ return (
+ <li className="issue-meta dropdown">
+ <ButtonLink className="issue-action js-issue-comment"
+ onClick={this.props.openIssueInIde}>
+ <span className="issue-meta-label">Open in IDE</span>
+ </ButtonLink>
+ </li>
+ );
+ }
+}