+
+ {
+ board.id ?
+
Éditer le tableau
:
+ Nouveau tableau
+ }
+
+
+ {
+ board.id ?
+ :
+ null
+ }
+
+
@@ -366,8 +386,16 @@ export class EditBoardPage extends React.Component {
}
onSaveBoardClick() {
+ let { board } = this.state;
+ board = { ...board };
+ if (!board.id) board.id = uuidv4();
+ this.props.dispatch(saveBoard({...board}));
+ this.props.history.push('/');
+ }
+
+ onDeleteBoardClick() {
const { board } = this.state;
- this.props.dispatch(saveBoard(board));
+ this.props.dispatch(deleteBoard(board.id));
this.props.history.push('/');
}
diff --git a/client/src/components/BoardPage/IssueCard.jsx b/client/src/components/BoardPage/IssueCard.jsx
index 3a2a09d..a193ed8 100644
--- a/client/src/components/BoardPage/IssueCard.jsx
+++ b/client/src/components/BoardPage/IssueCard.jsx
@@ -1,8 +1,13 @@
import React from 'react';
+const issueURLPattern = /(^https?:\/\/([^\/]))$/i;
+
export class IssueCard extends React.PureComponent {
render() {
const { card } = this.props;
+ const issueURLInfo = extractInfoFromIssueURL(card.issue.url);
+ const projectURL = `${issueURLInfo.baseURL}/${issueURLInfo.owner}/${issueURLInfo.projectName}`;
+ const issueURL = `${projectURL}/issues/${card.issue.number}`;
return (
@@ -30,18 +35,28 @@ export class IssueCard extends React.PureComponent {
);
}
+}
+
+function extractInfoFromIssueURL(issueURL) {
+ const pattern = /^(https?:\/\/[^\/]+)\/api\/v1\/repos\/([^\/]+)\/([^\/]+)\/.*$/;
+ const matches = pattern.exec(issueURL);
+ return {
+ baseURL: matches[1],
+ owner: matches[2],
+ projectName: matches[3],
+ };
}
\ No newline at end of file
diff --git a/client/src/components/HomePage/BoardCard.jsx b/client/src/components/HomePage/BoardCard.jsx
index 24b016d..461a1bb 100644
--- a/client/src/components/HomePage/BoardCard.jsx
+++ b/client/src/components/HomePage/BoardCard.jsx
@@ -26,11 +26,6 @@ export class BoardCard extends React.PureComponent {
-
-
-
-
-