Compare commits
60
Commits
v1.16.0
...
planka-0.1.25
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
16499052f7 | ||
|
|
cc32daa009 | ||
|
|
ea1b3b7f92 | ||
|
|
4e2863faa7 | ||
|
|
b46fb43e6f | ||
|
|
bcacfa8fe2 | ||
|
|
4df2becd6f | ||
|
|
2990ea593a | ||
|
|
b976673826 | ||
|
|
16e034efcb | ||
|
|
6712625c3f | ||
|
|
b5bbf6a6a4 | ||
|
|
3d3e7761f5 | ||
|
|
fa56b9c01f | ||
|
|
882213784f | ||
|
|
251bd793f3 | ||
|
|
088b0e760b | ||
|
|
cc1fa1cc3b | ||
|
|
bcd3ea86e8 | ||
|
|
0176650f67 | ||
|
|
f3963aded3 | ||
|
|
bbe720481a | ||
|
|
04f9030474 | ||
|
|
6d135be859 | ||
|
|
63cbe7063e | ||
|
|
7985bea2b8 | ||
|
|
733abccaa9 | ||
|
|
119cce82b4 | ||
|
|
988e70ec40 | ||
|
|
5e3fca3771 | ||
|
|
6d9ce56f4a | ||
|
|
3c8c04fd37 | ||
|
|
790a1d5cc9 | ||
|
|
4b352fd878 | ||
|
|
a196f2ef11 | ||
|
|
6c65d135f7 | ||
|
|
a1a1e9a86a | ||
|
|
0d39a7567f | ||
|
|
76a18d06d6 | ||
|
|
ce52fc5af7 | ||
|
|
0a2863a79c | ||
|
|
39e320fe4b | ||
|
|
2f3dfe775e | ||
|
|
22964cb375 | ||
|
|
fd89cf7f2b | ||
|
|
5acf84c20b | ||
|
|
6cd9da844f | ||
|
|
d7847fe89b | ||
|
|
d033520927 | ||
|
|
d911030831 | ||
|
|
9d95ed6c41 | ||
|
|
1a5a853fa3 | ||
|
|
273d994750 | ||
|
|
86d21d6abd | ||
|
|
a9c200cc3b | ||
|
|
3fedc14062 | ||
|
|
c42e1fb5dd | ||
|
|
9961340118 | ||
|
|
f54bd22757 | ||
|
|
1043dacd67 |
@@ -15,13 +15,13 @@ type: application
|
|||||||
# This is the chart version. This version number should be incremented each time you make changes
|
# This is the chart version. This version number should be incremented each time you make changes
|
||||||
# to the chart and its templates, including the app version.
|
# to the chart and its templates, including the app version.
|
||||||
# Versions are expected to follow Semantic Versioning (https://semver.org/)
|
# Versions are expected to follow Semantic Versioning (https://semver.org/)
|
||||||
version: 0.1.19
|
version: 0.1.25
|
||||||
|
|
||||||
# This is the version number of the application being deployed. This version number should be
|
# This is the version number of the application being deployed. This version number should be
|
||||||
# incremented each time you make changes to the application. Versions are not expected to
|
# incremented each time you make changes to the application. Versions are not expected to
|
||||||
# follow Semantic Versioning. They should reflect the version the application is using.
|
# follow Semantic Versioning. They should reflect the version the application is using.
|
||||||
# It is recommended to use it with quotes.
|
# It is recommended to use it with quotes.
|
||||||
appVersion: "1.16.0"
|
appVersion: "1.16.3"
|
||||||
|
|
||||||
dependencies:
|
dependencies:
|
||||||
- alias: postgresql
|
- alias: postgresql
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ helm install planka . --set secretkey=$SECRETKEY \
|
|||||||
--set admin_email="demo@demo.demo" \
|
--set admin_email="demo@demo.demo" \
|
||||||
--set admin_password="demo" \
|
--set admin_password="demo" \
|
||||||
--set admin_name="Demo Demo" \
|
--set admin_name="Demo Demo" \
|
||||||
--set admin_username="demo"
|
--set admin_username="demo" \
|
||||||
--set ingress.enabled=true \
|
--set ingress.enabled=true \
|
||||||
--set ingress.hosts[0].host=planka.example.dev \
|
--set ingress.hosts[0].host=planka.example.dev \
|
||||||
|
|
||||||
@@ -55,7 +55,7 @@ helm install planka . --set secretkey=$SECRETKEY \
|
|||||||
--set admin_email="demo@demo.demo" \
|
--set admin_email="demo@demo.demo" \
|
||||||
--set admin_password="demo" \
|
--set admin_password="demo" \
|
||||||
--set admin_name="Demo Demo" \
|
--set admin_name="Demo Demo" \
|
||||||
--set admin_username="demo"
|
--set admin_username="demo" \
|
||||||
--set ingress.enabled=true \
|
--set ingress.enabled=true \
|
||||||
--set ingress.hosts[0].host=planka.example.dev \
|
--set ingress.hosts[0].host=planka.example.dev \
|
||||||
--set ingress.tls[0].secretName=planka-tls \
|
--set ingress.tls[0].secretName=planka-tls \
|
||||||
@@ -76,6 +76,7 @@ admin_name: "Demo Demo"
|
|||||||
admin_username: "demo"
|
admin_username: "demo"
|
||||||
# Admin user
|
# Admin user
|
||||||
|
|
||||||
|
# Ingress
|
||||||
ingress:
|
ingress:
|
||||||
enabled: true
|
enabled: true
|
||||||
hosts:
|
hosts:
|
||||||
|
|||||||
@@ -55,14 +55,24 @@ spec:
|
|||||||
- mountPath: /app/private/attachments
|
- mountPath: /app/private/attachments
|
||||||
subPath: attachments
|
subPath: attachments
|
||||||
name: planka
|
name: planka
|
||||||
|
{{- if .Values.securityContext.readOnlyRootFilesystem }}
|
||||||
|
- mountPath: /app/logs
|
||||||
|
subPath: app-logs
|
||||||
|
name: emptydir
|
||||||
|
{{- end }}
|
||||||
resources:
|
resources:
|
||||||
{{- toYaml .Values.resources | nindent 12 }}
|
{{- toYaml .Values.resources | nindent 12 }}
|
||||||
env:
|
env:
|
||||||
|
{{- if not .Values.postgresql.enabled }}
|
||||||
|
- name: DATABASE_URL
|
||||||
|
value: {{ required "If the included postgresql deployment is disabled you need to define a Database URL in 'dburl'" .Values.dburl }}
|
||||||
|
{{- else }}
|
||||||
- name: DATABASE_URL
|
- name: DATABASE_URL
|
||||||
valueFrom:
|
valueFrom:
|
||||||
secretKeyRef:
|
secretKeyRef:
|
||||||
name: planka-postgresql-svcbind-custom-user
|
name: planka-postgresql-svcbind-custom-user
|
||||||
key: uri
|
key: uri
|
||||||
|
{{- end }}
|
||||||
- name: BASE_URL
|
- name: BASE_URL
|
||||||
{{- if .Values.baseUrl }}
|
{{- if .Values.baseUrl }}
|
||||||
value: {{ .Values.baseUrl }}
|
value: {{ .Values.baseUrl }}
|
||||||
@@ -134,3 +144,7 @@ spec:
|
|||||||
{{- else }}
|
{{- else }}
|
||||||
emptyDir: {}
|
emptyDir: {}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
{{- if .Values.securityContext.readOnlyRootFilesystem }}
|
||||||
|
- name: emptydir
|
||||||
|
emptyDir: {}
|
||||||
|
{{- end }}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
{{- if .Values.autoscaling.enabled }}
|
{{- if .Values.autoscaling.enabled }}
|
||||||
apiVersion: autoscaling/v2beta1
|
apiVersion: autoscaling/v2
|
||||||
kind: HorizontalPodAutoscaler
|
kind: HorizontalPodAutoscaler
|
||||||
metadata:
|
metadata:
|
||||||
name: {{ include "planka.fullname" . }}
|
name: {{ include "planka.fullname" . }}
|
||||||
@@ -17,12 +17,16 @@ spec:
|
|||||||
- type: Resource
|
- type: Resource
|
||||||
resource:
|
resource:
|
||||||
name: cpu
|
name: cpu
|
||||||
targetAverageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }}
|
target:
|
||||||
|
type: Utilization
|
||||||
|
averageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- if .Values.autoscaling.targetMemoryUtilizationPercentage }}
|
{{- if .Values.autoscaling.targetMemoryUtilizationPercentage }}
|
||||||
- type: Resource
|
- type: Resource
|
||||||
resource:
|
resource:
|
||||||
name: memory
|
name: memory
|
||||||
targetAverageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }}
|
target:
|
||||||
|
type: Utilization
|
||||||
|
averageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
|||||||
@@ -105,12 +105,14 @@ postgresql:
|
|||||||
serviceBindings:
|
serviceBindings:
|
||||||
enabled: true
|
enabled: true
|
||||||
|
|
||||||
|
## Set this if you disable the built-in postgresql deployment
|
||||||
|
dburl:
|
||||||
|
|
||||||
## PVC-based data storage configuration
|
## PVC-based data storage configuration
|
||||||
persistence:
|
persistence:
|
||||||
enabled: false
|
enabled: false
|
||||||
# existingClaim: netbox-data
|
# existingClaim: netbox-data
|
||||||
# storageClass: "-"
|
# storageClass: "-"
|
||||||
|
|
||||||
accessMode: ReadWriteOnce
|
accessMode: ReadWriteOnce
|
||||||
size: 10Gi
|
size: 10Gi
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -1 +1 @@
|
|||||||
REACT_APP_VERSION=1.16.0
|
REACT_APP_VERSION=1.16.3
|
||||||
|
|||||||
Generated
+16
@@ -17,6 +17,8 @@
|
|||||||
"initials": "^3.1.2",
|
"initials": "^3.1.2",
|
||||||
"js-cookie": "^3.0.5",
|
"js-cookie": "^3.0.5",
|
||||||
"jwt-decode": "^4.0.0",
|
"jwt-decode": "^4.0.0",
|
||||||
|
"linkify-react": "^4.1.3",
|
||||||
|
"linkifyjs": "^4.1.3",
|
||||||
"lodash": "^4.17.21",
|
"lodash": "^4.17.21",
|
||||||
"nanoid": "^5.0.3",
|
"nanoid": "^5.0.3",
|
||||||
"node-sass": "^9.0.0",
|
"node-sass": "^9.0.0",
|
||||||
@@ -11911,6 +11913,20 @@
|
|||||||
"resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.2.4.tgz",
|
"resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.2.4.tgz",
|
||||||
"integrity": "sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg=="
|
"integrity": "sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg=="
|
||||||
},
|
},
|
||||||
|
"node_modules/linkify-react": {
|
||||||
|
"version": "4.1.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/linkify-react/-/linkify-react-4.1.3.tgz",
|
||||||
|
"integrity": "sha512-rhI3zM/fxn5BfRPHfi4r9N7zgac4vOIxub1wHIWXLA5ENTMs+BGaIaFO1D1PhmxgwhIKmJz3H7uCP0Dg5JwSlA==",
|
||||||
|
"peerDependencies": {
|
||||||
|
"linkifyjs": "^4.0.0",
|
||||||
|
"react": ">= 15.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/linkifyjs": {
|
||||||
|
"version": "4.1.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/linkifyjs/-/linkifyjs-4.1.3.tgz",
|
||||||
|
"integrity": "sha512-auMesunaJ8yfkHvK4gfg1K0SaKX/6Wn9g2Aac/NwX+l5VdmFZzo/hdPGxEOETj+ryRa4/fiOPjeeKURSAJx1sg=="
|
||||||
|
},
|
||||||
"node_modules/loader-runner": {
|
"node_modules/loader-runner": {
|
||||||
"version": "4.3.0",
|
"version": "4.3.0",
|
||||||
"resolved": "https://registry.npmjs.org/loader-runner/-/loader-runner-4.3.0.tgz",
|
"resolved": "https://registry.npmjs.org/loader-runner/-/loader-runner-4.3.0.tgz",
|
||||||
|
|||||||
@@ -70,6 +70,8 @@
|
|||||||
"initials": "^3.1.2",
|
"initials": "^3.1.2",
|
||||||
"js-cookie": "^3.0.5",
|
"js-cookie": "^3.0.5",
|
||||||
"jwt-decode": "^4.0.0",
|
"jwt-decode": "^4.0.0",
|
||||||
|
"linkify-react": "^4.1.3",
|
||||||
|
"linkifyjs": "^4.1.3",
|
||||||
"lodash": "^4.17.21",
|
"lodash": "^4.17.21",
|
||||||
"nanoid": "^5.0.3",
|
"nanoid": "^5.0.3",
|
||||||
"node-sass": "^9.0.0",
|
"node-sass": "^9.0.0",
|
||||||
|
|||||||
@@ -23,10 +23,14 @@ createCard.failure = (localId, error) => ({
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const handleCardCreate = (card) => ({
|
const handleCardCreate = (card, cardMemberships, cardLabels, tasks, attachments) => ({
|
||||||
type: ActionTypes.CARD_CREATE_HANDLE,
|
type: ActionTypes.CARD_CREATE_HANDLE,
|
||||||
payload: {
|
payload: {
|
||||||
card,
|
card,
|
||||||
|
cardMemberships,
|
||||||
|
cardLabels,
|
||||||
|
tasks,
|
||||||
|
attachments,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -60,6 +64,34 @@ const handleCardUpdate = (card) => ({
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const duplicateCard = (id, card, taskIds) => ({
|
||||||
|
type: ActionTypes.CARD_DUPLICATE,
|
||||||
|
payload: {
|
||||||
|
id,
|
||||||
|
card,
|
||||||
|
taskIds,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
duplicateCard.success = (localId, card, cardMemberships, cardLabels, tasks) => ({
|
||||||
|
type: ActionTypes.CARD_DUPLICATE__SUCCESS,
|
||||||
|
payload: {
|
||||||
|
localId,
|
||||||
|
card,
|
||||||
|
cardMemberships,
|
||||||
|
cardLabels,
|
||||||
|
tasks,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
duplicateCard.failure = (id, error) => ({
|
||||||
|
type: ActionTypes.CARD_DUPLICATE__FAILURE,
|
||||||
|
payload: {
|
||||||
|
id,
|
||||||
|
error,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
const deleteCard = (id) => ({
|
const deleteCard = (id) => ({
|
||||||
type: ActionTypes.CARD_DELETE,
|
type: ActionTypes.CARD_DELETE,
|
||||||
payload: {
|
payload: {
|
||||||
@@ -94,6 +126,7 @@ export default {
|
|||||||
handleCardCreate,
|
handleCardCreate,
|
||||||
updateCard,
|
updateCard,
|
||||||
handleCardUpdate,
|
handleCardUpdate,
|
||||||
|
duplicateCard,
|
||||||
deleteCard,
|
deleteCard,
|
||||||
handleCardDelete,
|
handleCardDelete,
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -47,9 +47,11 @@ initializeCore.fetchConfig = (config) => ({
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const logout = () => ({
|
const logout = (invalidateAccessToken) => ({
|
||||||
type: ActionTypes.LOGOUT,
|
type: ActionTypes.LOGOUT,
|
||||||
payload: {},
|
payload: {
|
||||||
|
invalidateAccessToken,
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
logout.invalidateAccessToken = () => ({
|
logout.invalidateAccessToken = () => ({
|
||||||
|
|||||||
@@ -57,6 +57,12 @@ const updateCard = (id, data, headers) =>
|
|||||||
item: transformCard(body.item),
|
item: transformCard(body.item),
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
const duplicateCard = (id, data, headers) =>
|
||||||
|
socket.post(`/cards/${id}/duplicate`, data, headers).then((body) => ({
|
||||||
|
...body,
|
||||||
|
item: transformCard(body.item),
|
||||||
|
}));
|
||||||
|
|
||||||
const deleteCard = (id, headers) =>
|
const deleteCard = (id, headers) =>
|
||||||
socket.delete(`/cards/${id}`, undefined, headers).then((body) => ({
|
socket.delete(`/cards/${id}`, undefined, headers).then((body) => ({
|
||||||
...body,
|
...body,
|
||||||
@@ -81,6 +87,7 @@ export default {
|
|||||||
getCard,
|
getCard,
|
||||||
updateCard,
|
updateCard,
|
||||||
deleteCard,
|
deleteCard,
|
||||||
|
duplicateCard,
|
||||||
makeHandleCardCreate,
|
makeHandleCardCreate,
|
||||||
makeHandleCardUpdate,
|
makeHandleCardUpdate,
|
||||||
makeHandleCardDelete,
|
makeHandleCardDelete,
|
||||||
|
|||||||
@@ -4,7 +4,6 @@
|
|||||||
max-height: 60vh;
|
max-height: 60vh;
|
||||||
overflow-x: hidden;
|
overflow-x: hidden;
|
||||||
overflow-y: auto;
|
overflow-y: auto;
|
||||||
scrollbar-width: thin;
|
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
|
||||||
&::-webkit-scrollbar {
|
&::-webkit-scrollbar {
|
||||||
|
|||||||
@@ -85,7 +85,6 @@
|
|||||||
height: 56px;
|
height: 56px;
|
||||||
overflow-x: auto;
|
overflow-x: auto;
|
||||||
overflow-y: hidden;
|
overflow-y: hidden;
|
||||||
scrollbar-width: thin;
|
|
||||||
|
|
||||||
&:hover {
|
&:hover {
|
||||||
height: 38px;
|
height: 38px;
|
||||||
|
|||||||
@@ -36,6 +36,7 @@ const ActionsStep = React.memo(
|
|||||||
onUpdate,
|
onUpdate,
|
||||||
onMove,
|
onMove,
|
||||||
onTransfer,
|
onTransfer,
|
||||||
|
onDuplicate,
|
||||||
onDelete,
|
onDelete,
|
||||||
onUserAdd,
|
onUserAdd,
|
||||||
onUserRemove,
|
onUserRemove,
|
||||||
@@ -76,6 +77,11 @@ const ActionsStep = React.memo(
|
|||||||
openStep(StepTypes.MOVE);
|
openStep(StepTypes.MOVE);
|
||||||
}, [openStep]);
|
}, [openStep]);
|
||||||
|
|
||||||
|
const handleDuplicateClick = useCallback(() => {
|
||||||
|
onDuplicate();
|
||||||
|
onClose();
|
||||||
|
}, [onDuplicate, onClose]);
|
||||||
|
|
||||||
const handleDeleteClick = useCallback(() => {
|
const handleDeleteClick = useCallback(() => {
|
||||||
openStep(StepTypes.DELETE);
|
openStep(StepTypes.DELETE);
|
||||||
}, [openStep]);
|
}, [openStep]);
|
||||||
@@ -207,6 +213,11 @@ const ActionsStep = React.memo(
|
|||||||
context: 'title',
|
context: 'title',
|
||||||
})}
|
})}
|
||||||
</Menu.Item>
|
</Menu.Item>
|
||||||
|
<Menu.Item className={styles.menuItem} onClick={handleDuplicateClick}>
|
||||||
|
{t('action.duplicateCard', {
|
||||||
|
context: 'title',
|
||||||
|
})}
|
||||||
|
</Menu.Item>
|
||||||
<Menu.Item className={styles.menuItem} onClick={handleDeleteClick}>
|
<Menu.Item className={styles.menuItem} onClick={handleDeleteClick}>
|
||||||
{t('action.deleteCard', {
|
{t('action.deleteCard', {
|
||||||
context: 'title',
|
context: 'title',
|
||||||
@@ -232,6 +243,7 @@ ActionsStep.propTypes = {
|
|||||||
onUpdate: PropTypes.func.isRequired,
|
onUpdate: PropTypes.func.isRequired,
|
||||||
onMove: PropTypes.func.isRequired,
|
onMove: PropTypes.func.isRequired,
|
||||||
onTransfer: PropTypes.func.isRequired,
|
onTransfer: PropTypes.func.isRequired,
|
||||||
|
onDuplicate: PropTypes.func.isRequired,
|
||||||
onDelete: PropTypes.func.isRequired,
|
onDelete: PropTypes.func.isRequired,
|
||||||
onUserAdd: PropTypes.func.isRequired,
|
onUserAdd: PropTypes.func.isRequired,
|
||||||
onUserRemove: PropTypes.func.isRequired,
|
onUserRemove: PropTypes.func.isRequired,
|
||||||
|
|||||||
@@ -41,6 +41,7 @@ const Card = React.memo(
|
|||||||
onUpdate,
|
onUpdate,
|
||||||
onMove,
|
onMove,
|
||||||
onTransfer,
|
onTransfer,
|
||||||
|
onDuplicate,
|
||||||
onDelete,
|
onDelete,
|
||||||
onUserAdd,
|
onUserAdd,
|
||||||
onUserRemove,
|
onUserRemove,
|
||||||
@@ -185,6 +186,7 @@ const Card = React.memo(
|
|||||||
onUpdate={onUpdate}
|
onUpdate={onUpdate}
|
||||||
onMove={onMove}
|
onMove={onMove}
|
||||||
onTransfer={onTransfer}
|
onTransfer={onTransfer}
|
||||||
|
onDuplicate={onDuplicate}
|
||||||
onDelete={onDelete}
|
onDelete={onDelete}
|
||||||
onUserAdd={onUserAdd}
|
onUserAdd={onUserAdd}
|
||||||
onUserRemove={onUserRemove}
|
onUserRemove={onUserRemove}
|
||||||
@@ -238,6 +240,7 @@ Card.propTypes = {
|
|||||||
onUpdate: PropTypes.func.isRequired,
|
onUpdate: PropTypes.func.isRequired,
|
||||||
onMove: PropTypes.func.isRequired,
|
onMove: PropTypes.func.isRequired,
|
||||||
onTransfer: PropTypes.func.isRequired,
|
onTransfer: PropTypes.func.isRequired,
|
||||||
|
onDuplicate: PropTypes.func.isRequired,
|
||||||
onDelete: PropTypes.func.isRequired,
|
onDelete: PropTypes.func.isRequired,
|
||||||
onUserAdd: PropTypes.func.isRequired,
|
onUserAdd: PropTypes.func.isRequired,
|
||||||
onUserRemove: PropTypes.func.isRequired,
|
onUserRemove: PropTypes.func.isRequired,
|
||||||
|
|||||||
@@ -4,6 +4,8 @@ import classNames from 'classnames';
|
|||||||
import { Progress } from 'semantic-ui-react';
|
import { Progress } from 'semantic-ui-react';
|
||||||
import { useToggle } from '../../lib/hooks';
|
import { useToggle } from '../../lib/hooks';
|
||||||
|
|
||||||
|
import Linkify from '../Linkify';
|
||||||
|
|
||||||
import styles from './Tasks.module.scss';
|
import styles from './Tasks.module.scss';
|
||||||
|
|
||||||
const Tasks = React.memo(({ items }) => {
|
const Tasks = React.memo(({ items }) => {
|
||||||
@@ -48,7 +50,7 @@ const Tasks = React.memo(({ items }) => {
|
|||||||
key={item.id}
|
key={item.id}
|
||||||
className={classNames(styles.task, item.isCompleted && styles.taskCompleted)}
|
className={classNames(styles.task, item.isCompleted && styles.taskCompleted)}
|
||||||
>
|
>
|
||||||
{item.name}
|
<Linkify linkStopPropagation>{item.name}</Linkify>
|
||||||
</li>
|
</li>
|
||||||
))}
|
))}
|
||||||
</ul>
|
</ul>
|
||||||
|
|||||||
@@ -55,8 +55,10 @@
|
|||||||
display: block;
|
display: block;
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
line-height: 14px;
|
line-height: 14px;
|
||||||
|
overflow: hidden;
|
||||||
padding-bottom: 6px;
|
padding-bottom: 6px;
|
||||||
padding-left: 14px;
|
padding-left: 14px;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
|
||||||
&:before {
|
&:before {
|
||||||
content: "–";
|
content: "–";
|
||||||
|
|||||||
@@ -55,6 +55,7 @@ const CardModal = React.memo(
|
|||||||
onUpdate,
|
onUpdate,
|
||||||
onMove,
|
onMove,
|
||||||
onTransfer,
|
onTransfer,
|
||||||
|
onDuplicate,
|
||||||
onDelete,
|
onDelete,
|
||||||
onUserAdd,
|
onUserAdd,
|
||||||
onUserRemove,
|
onUserRemove,
|
||||||
@@ -140,6 +141,11 @@ const CardModal = React.memo(
|
|||||||
});
|
});
|
||||||
}, [isSubscribed, onUpdate]);
|
}, [isSubscribed, onUpdate]);
|
||||||
|
|
||||||
|
const handleDuplicateClick = useCallback(() => {
|
||||||
|
onDuplicate();
|
||||||
|
onClose();
|
||||||
|
}, [onDuplicate, onClose]);
|
||||||
|
|
||||||
const handleGalleryOpen = useCallback(() => {
|
const handleGalleryOpen = useCallback(() => {
|
||||||
isGalleryOpened.current = true;
|
isGalleryOpened.current = true;
|
||||||
}, []);
|
}, []);
|
||||||
@@ -496,6 +502,10 @@ const CardModal = React.memo(
|
|||||||
{t('action.move')}
|
{t('action.move')}
|
||||||
</Button>
|
</Button>
|
||||||
</CardMovePopup>
|
</CardMovePopup>
|
||||||
|
<Button fluid className={styles.actionButton} onClick={handleDuplicateClick}>
|
||||||
|
<Icon name="copy outline" className={styles.actionIcon} />
|
||||||
|
{t('action.duplicate')}
|
||||||
|
</Button>
|
||||||
<DeletePopup
|
<DeletePopup
|
||||||
title="common.deleteCard"
|
title="common.deleteCard"
|
||||||
content="common.areYouSureYouWantToDeleteThisCard"
|
content="common.areYouSureYouWantToDeleteThisCard"
|
||||||
@@ -555,6 +565,7 @@ CardModal.propTypes = {
|
|||||||
onUpdate: PropTypes.func.isRequired,
|
onUpdate: PropTypes.func.isRequired,
|
||||||
onMove: PropTypes.func.isRequired,
|
onMove: PropTypes.func.isRequired,
|
||||||
onTransfer: PropTypes.func.isRequired,
|
onTransfer: PropTypes.func.isRequired,
|
||||||
|
onDuplicate: PropTypes.func.isRequired,
|
||||||
onDelete: PropTypes.func.isRequired,
|
onDelete: PropTypes.func.isRequired,
|
||||||
onUserAdd: PropTypes.func.isRequired,
|
onUserAdd: PropTypes.func.isRequired,
|
||||||
onUserRemove: PropTypes.func.isRequired,
|
onUserRemove: PropTypes.func.isRequired,
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import { usePopup } from '../../../lib/popup';
|
|||||||
|
|
||||||
import NameEdit from './NameEdit';
|
import NameEdit from './NameEdit';
|
||||||
import ActionsStep from './ActionsStep';
|
import ActionsStep from './ActionsStep';
|
||||||
|
import Linkify from '../../Linkify';
|
||||||
|
|
||||||
import styles from './Item.module.scss';
|
import styles from './Item.module.scss';
|
||||||
|
|
||||||
@@ -65,7 +66,7 @@ const Item = React.memo(
|
|||||||
onClick={handleClick}
|
onClick={handleClick}
|
||||||
>
|
>
|
||||||
<span className={classNames(styles.task, isCompleted && styles.taskCompleted)}>
|
<span className={classNames(styles.task, isCompleted && styles.taskCompleted)}>
|
||||||
{name}
|
<Linkify linkStopPropagation>{name}</Linkify>
|
||||||
</span>
|
</span>
|
||||||
</span>
|
</span>
|
||||||
{isPersisted && canEdit && (
|
{isPersisted && canEdit && (
|
||||||
|
|||||||
@@ -49,7 +49,6 @@
|
|||||||
max-height: 60vh;
|
max-height: 60vh;
|
||||||
overflow-x: hidden;
|
overflow-x: hidden;
|
||||||
overflow-y: auto;
|
overflow-y: auto;
|
||||||
scrollbar-width: thin;
|
|
||||||
|
|
||||||
&::-webkit-scrollbar {
|
&::-webkit-scrollbar {
|
||||||
width: 5px;
|
width: 5px;
|
||||||
|
|||||||
@@ -25,7 +25,6 @@
|
|||||||
max-height: 60vh;
|
max-height: 60vh;
|
||||||
overflow-x: hidden;
|
overflow-x: hidden;
|
||||||
overflow-y: auto;
|
overflow-y: auto;
|
||||||
scrollbar-width: thin;
|
|
||||||
|
|
||||||
&::-webkit-scrollbar {
|
&::-webkit-scrollbar {
|
||||||
width: 5px;
|
width: 5px;
|
||||||
|
|||||||
@@ -0,0 +1,68 @@
|
|||||||
|
import React, { useCallback } from 'react';
|
||||||
|
import PropTypes from 'prop-types';
|
||||||
|
import LinkifyReact from 'linkify-react';
|
||||||
|
|
||||||
|
import history from '../history';
|
||||||
|
|
||||||
|
const Linkify = React.memo(({ children, linkStopPropagation, ...props }) => {
|
||||||
|
const handleLinkClick = useCallback(
|
||||||
|
(event) => {
|
||||||
|
if (linkStopPropagation) {
|
||||||
|
event.stopPropagation();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!event.target.getAttribute('target')) {
|
||||||
|
event.preventDefault();
|
||||||
|
history.push(event.target.href);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
[linkStopPropagation],
|
||||||
|
);
|
||||||
|
|
||||||
|
const linkRenderer = useCallback(
|
||||||
|
({ attributes: { href, ...linkProps }, content }) => {
|
||||||
|
let url;
|
||||||
|
try {
|
||||||
|
url = new URL(href, window.location);
|
||||||
|
} catch (error) {} // eslint-disable-line no-empty
|
||||||
|
|
||||||
|
const isSameSite = !!url && url.origin === window.location.origin;
|
||||||
|
|
||||||
|
return (
|
||||||
|
<a
|
||||||
|
{...linkProps} // eslint-disable-line react/jsx-props-no-spreading
|
||||||
|
href={href}
|
||||||
|
target={isSameSite ? undefined : '_blank'}
|
||||||
|
rel={isSameSite ? undefined : 'noreferrer'}
|
||||||
|
onClick={handleLinkClick}
|
||||||
|
>
|
||||||
|
{isSameSite ? url.pathname : content}
|
||||||
|
</a>
|
||||||
|
);
|
||||||
|
},
|
||||||
|
[handleLinkClick],
|
||||||
|
);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<LinkifyReact
|
||||||
|
{...props} // eslint-disable-line react/jsx-props-no-spreading
|
||||||
|
options={{
|
||||||
|
defaultProtocol: 'https',
|
||||||
|
render: linkRenderer,
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{children}
|
||||||
|
</LinkifyReact>
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
Linkify.propTypes = {
|
||||||
|
children: PropTypes.string.isRequired,
|
||||||
|
linkStopPropagation: PropTypes.bool,
|
||||||
|
};
|
||||||
|
|
||||||
|
Linkify.defaultProps = {
|
||||||
|
linkStopPropagation: false,
|
||||||
|
};
|
||||||
|
|
||||||
|
export default Linkify;
|
||||||
@@ -43,7 +43,6 @@
|
|||||||
max-height: calc(100vh - 268px);
|
max-height: calc(100vh - 268px);
|
||||||
overflow-x: hidden;
|
overflow-x: hidden;
|
||||||
overflow-y: auto;
|
overflow-y: auto;
|
||||||
scrollbar-width: thin;
|
|
||||||
width: 290px;
|
width: 290px;
|
||||||
|
|
||||||
&:hover {
|
&:hover {
|
||||||
|
|||||||
@@ -4,7 +4,6 @@
|
|||||||
max-height: 60vh;
|
max-height: 60vh;
|
||||||
overflow-x: hidden;
|
overflow-x: hidden;
|
||||||
overflow-y: auto;
|
overflow-y: auto;
|
||||||
scrollbar-width: thin;
|
|
||||||
|
|
||||||
&::-webkit-scrollbar {
|
&::-webkit-scrollbar {
|
||||||
width: 5px;
|
width: 5px;
|
||||||
|
|||||||
@@ -194,6 +194,9 @@ export default {
|
|||||||
CARD_TRANSFER: 'CARD_TRANSFER',
|
CARD_TRANSFER: 'CARD_TRANSFER',
|
||||||
CARD_TRANSFER__SUCCESS: 'CARD_TRANSFER__SUCCESS',
|
CARD_TRANSFER__SUCCESS: 'CARD_TRANSFER__SUCCESS',
|
||||||
CARD_TRANSFER__FAILURE: 'CARD_TRANSFER__FAILURE',
|
CARD_TRANSFER__FAILURE: 'CARD_TRANSFER__FAILURE',
|
||||||
|
CARD_DUPLICATE: 'CARD_DUPLICATE',
|
||||||
|
CARD_DUPLICATE__SUCCESS: 'CARD_DUPLICATE__SUCCESS',
|
||||||
|
CARD_DUPLICATE__FAILURE: 'CARD_DUPLICATE__FAILURE',
|
||||||
CARD_DELETE: 'CARD_DELETE',
|
CARD_DELETE: 'CARD_DELETE',
|
||||||
CARD_DELETE__SUCCESS: 'CARD_DELETE__SUCCESS',
|
CARD_DELETE__SUCCESS: 'CARD_DELETE__SUCCESS',
|
||||||
CARD_DELETE__FAILURE: 'CARD_DELETE__FAILURE',
|
CARD_DELETE__FAILURE: 'CARD_DELETE__FAILURE',
|
||||||
|
|||||||
@@ -132,6 +132,8 @@ export default {
|
|||||||
CURRENT_CARD_MOVE: `${PREFIX}/CURRENT_CARD_MOVE`,
|
CURRENT_CARD_MOVE: `${PREFIX}/CURRENT_CARD_MOVE`,
|
||||||
CARD_TRANSFER: `${PREFIX}/CARD_TRANSFER`,
|
CARD_TRANSFER: `${PREFIX}/CARD_TRANSFER`,
|
||||||
CURRENT_CARD_TRANSFER: `${PREFIX}/CURRENT_CARD_TRANSFER`,
|
CURRENT_CARD_TRANSFER: `${PREFIX}/CURRENT_CARD_TRANSFER`,
|
||||||
|
CARD_DUPLICATE: `${PREFIX}/CARD_DUPLICATE`,
|
||||||
|
CURRENT_CARD_DUPLICATE: `${PREFIX}/CURRENT_CARD_DUPLICATE`,
|
||||||
CARD_DELETE: `${PREFIX}/CARD_DELETE`,
|
CARD_DELETE: `${PREFIX}/CARD_DELETE`,
|
||||||
CURRENT_CARD_DELETE: `${PREFIX}/CURRENT_CARD_DELETE`,
|
CURRENT_CARD_DELETE: `${PREFIX}/CURRENT_CARD_DELETE`,
|
||||||
CARD_DELETE_HANDLE: `${PREFIX}/CARD_DELETE_HANDLE`,
|
CARD_DELETE_HANDLE: `${PREFIX}/CARD_DELETE_HANDLE`,
|
||||||
|
|||||||
@@ -62,6 +62,7 @@ const mapDispatchToProps = (dispatch, { id }) =>
|
|||||||
onUpdate: (data) => entryActions.updateCard(id, data),
|
onUpdate: (data) => entryActions.updateCard(id, data),
|
||||||
onMove: (listId, index) => entryActions.moveCard(id, listId, index),
|
onMove: (listId, index) => entryActions.moveCard(id, listId, index),
|
||||||
onTransfer: (boardId, listId) => entryActions.transferCard(id, boardId, listId),
|
onTransfer: (boardId, listId) => entryActions.transferCard(id, boardId, listId),
|
||||||
|
onDuplicate: () => entryActions.duplicateCard(id),
|
||||||
onDelete: () => entryActions.deleteCard(id),
|
onDelete: () => entryActions.deleteCard(id),
|
||||||
onUserAdd: (userId) => entryActions.addUserToCard(userId, id),
|
onUserAdd: (userId) => entryActions.addUserToCard(userId, id),
|
||||||
onUserRemove: (userId) => entryActions.removeUserFromCard(userId, id),
|
onUserRemove: (userId) => entryActions.removeUserFromCard(userId, id),
|
||||||
|
|||||||
@@ -78,6 +78,7 @@ const mapDispatchToProps = (dispatch) =>
|
|||||||
onUpdate: entryActions.updateCurrentCard,
|
onUpdate: entryActions.updateCurrentCard,
|
||||||
onMove: entryActions.moveCurrentCard,
|
onMove: entryActions.moveCurrentCard,
|
||||||
onTransfer: entryActions.transferCurrentCard,
|
onTransfer: entryActions.transferCurrentCard,
|
||||||
|
onDuplicate: entryActions.duplicateCurrentCard,
|
||||||
onDelete: entryActions.deleteCurrentCard,
|
onDelete: entryActions.deleteCurrentCard,
|
||||||
onUserAdd: entryActions.addUserToCurrentCard,
|
onUserAdd: entryActions.addUserToCurrentCard,
|
||||||
onUserRemove: entryActions.removeUserFromCurrentCard,
|
onUserRemove: entryActions.removeUserFromCurrentCard,
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ const handleCardUpdate = (card) => ({
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const moveCard = (id, listId, index = 0) => ({
|
const moveCard = (id, listId, index) => ({
|
||||||
type: EntryActionTypes.CARD_MOVE,
|
type: EntryActionTypes.CARD_MOVE,
|
||||||
payload: {
|
payload: {
|
||||||
id,
|
id,
|
||||||
@@ -47,7 +47,7 @@ const moveCard = (id, listId, index = 0) => ({
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const moveCurrentCard = (listId, index = 0) => ({
|
const moveCurrentCard = (listId, index) => ({
|
||||||
type: EntryActionTypes.CURRENT_CARD_MOVE,
|
type: EntryActionTypes.CURRENT_CARD_MOVE,
|
||||||
payload: {
|
payload: {
|
||||||
listId,
|
listId,
|
||||||
@@ -55,7 +55,7 @@ const moveCurrentCard = (listId, index = 0) => ({
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const transferCard = (id, boardId, listId, index = 0) => ({
|
const transferCard = (id, boardId, listId, index) => ({
|
||||||
type: EntryActionTypes.CARD_TRANSFER,
|
type: EntryActionTypes.CARD_TRANSFER,
|
||||||
payload: {
|
payload: {
|
||||||
id,
|
id,
|
||||||
@@ -65,7 +65,7 @@ const transferCard = (id, boardId, listId, index = 0) => ({
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const transferCurrentCard = (boardId, listId, index = 0) => ({
|
const transferCurrentCard = (boardId, listId, index) => ({
|
||||||
type: EntryActionTypes.CURRENT_CARD_TRANSFER,
|
type: EntryActionTypes.CURRENT_CARD_TRANSFER,
|
||||||
payload: {
|
payload: {
|
||||||
boardId,
|
boardId,
|
||||||
@@ -74,6 +74,18 @@ const transferCurrentCard = (boardId, listId, index = 0) => ({
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const duplicateCard = (id) => ({
|
||||||
|
type: EntryActionTypes.CARD_DUPLICATE,
|
||||||
|
payload: {
|
||||||
|
id,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
const duplicateCurrentCard = () => ({
|
||||||
|
type: EntryActionTypes.CURRENT_CARD_DUPLICATE,
|
||||||
|
payload: {},
|
||||||
|
});
|
||||||
|
|
||||||
const deleteCard = (id) => ({
|
const deleteCard = (id) => ({
|
||||||
type: EntryActionTypes.CARD_DELETE,
|
type: EntryActionTypes.CARD_DELETE,
|
||||||
payload: {
|
payload: {
|
||||||
@@ -103,6 +115,8 @@ export default {
|
|||||||
moveCurrentCard,
|
moveCurrentCard,
|
||||||
transferCard,
|
transferCard,
|
||||||
transferCurrentCard,
|
transferCurrentCard,
|
||||||
|
duplicateCard,
|
||||||
|
duplicateCurrentCard,
|
||||||
deleteCard,
|
deleteCard,
|
||||||
deleteCurrentCard,
|
deleteCurrentCard,
|
||||||
handleCardDelete,
|
handleCardDelete,
|
||||||
|
|||||||
@@ -1,8 +1,10 @@
|
|||||||
import EntryActionTypes from '../constants/EntryActionTypes';
|
import EntryActionTypes from '../constants/EntryActionTypes';
|
||||||
|
|
||||||
const logout = () => ({
|
const logout = (invalidateAccessToken) => ({
|
||||||
type: EntryActionTypes.LOGOUT,
|
type: EntryActionTypes.LOGOUT,
|
||||||
payload: {},
|
payload: {
|
||||||
|
invalidateAccessToken,
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
|||||||
@@ -39,9 +39,9 @@ export default {
|
|||||||
areYouSureYouWantToLeaveBoard: 'Opravdu chcete opustit tuto tabuli?',
|
areYouSureYouWantToLeaveBoard: 'Opravdu chcete opustit tuto tabuli?',
|
||||||
areYouSureYouWantToLeaveProject: 'Opravdu chcete opustit projekt?',
|
areYouSureYouWantToLeaveProject: 'Opravdu chcete opustit projekt?',
|
||||||
areYouSureYouWantToRemoveThisManagerFromProject:
|
areYouSureYouWantToRemoveThisManagerFromProject:
|
||||||
'Are you sure you want to remove this manager from the project?',
|
'Jste si jisti, že chcete tohoto správce z projektu odebrat?',
|
||||||
areYouSureYouWantToRemoveThisMemberFromBoard:
|
areYouSureYouWantToRemoveThisMemberFromBoard:
|
||||||
'Opravdu chcete odstranit tohoto člena z tabule?',
|
'Jste si jisti, že chcete tohoto člena odebrat z tabule?',
|
||||||
attachment: 'Příloha',
|
attachment: 'Příloha',
|
||||||
attachments: 'Přílohy',
|
attachments: 'Přílohy',
|
||||||
authentication: 'Ověření',
|
authentication: 'Ověření',
|
||||||
@@ -55,6 +55,7 @@ export default {
|
|||||||
cardNotFound_title: 'Karta nenalezena',
|
cardNotFound_title: 'Karta nenalezena',
|
||||||
cardOrActionAreDeleted: 'Karta nebo akce je smazána.',
|
cardOrActionAreDeleted: 'Karta nebo akce je smazána.',
|
||||||
color: 'Barva',
|
color: 'Barva',
|
||||||
|
copy_inline: 'copy',
|
||||||
createBoard_title: 'Vytvořit tabuli',
|
createBoard_title: 'Vytvořit tabuli',
|
||||||
createLabel_title: 'Vytvořit štítek',
|
createLabel_title: 'Vytvořit štítek',
|
||||||
createNewOneOrSelectExistingOne: 'Vytvořit nový nebo vyberte<br />již existující.',
|
createNewOneOrSelectExistingOne: 'Vytvořit nový nebo vyberte<br />již existující.',
|
||||||
@@ -130,7 +131,7 @@ export default {
|
|||||||
phone: 'Telefon',
|
phone: 'Telefon',
|
||||||
preferences: 'Volby',
|
preferences: 'Volby',
|
||||||
pressPasteShortcutToAddAttachmentFromClipboard:
|
pressPasteShortcutToAddAttachmentFromClipboard:
|
||||||
'Tip: dejte Ctrl-V (Cmd-V na Mac) pro vložení přílohy ze schránky.',
|
'Tip: stisknutím Ctrl-V (Cmd-V na Mac) přidáte přílohu ze schránky.',
|
||||||
project: 'Projekt',
|
project: 'Projekt',
|
||||||
projectNotFound_title: 'Projekt nenalezen',
|
projectNotFound_title: 'Projekt nenalezen',
|
||||||
removeManager_title: 'Odstranit vedoucího',
|
removeManager_title: 'Odstranit vedoucího',
|
||||||
@@ -199,6 +200,8 @@ export default {
|
|||||||
deleteTask: 'Smazat úkol',
|
deleteTask: 'Smazat úkol',
|
||||||
deleteTask_title: 'Smazat úkol',
|
deleteTask_title: 'Smazat úkol',
|
||||||
deleteUser: 'Smazat uživatele',
|
deleteUser: 'Smazat uživatele',
|
||||||
|
duplicate: 'Duplikovat',
|
||||||
|
duplicateCard_title: 'Duplikovat kartu',
|
||||||
edit: 'Upravit',
|
edit: 'Upravit',
|
||||||
editDueDate_title: 'Upravit termín do',
|
editDueDate_title: 'Upravit termín do',
|
||||||
editDescription_title: 'Upravit popis',
|
editDescription_title: 'Upravit popis',
|
||||||
@@ -226,13 +229,13 @@ export default {
|
|||||||
removeMember: 'Odstranit člena',
|
removeMember: 'Odstranit člena',
|
||||||
save: 'Uložit',
|
save: 'Uložit',
|
||||||
showAllAttachments: 'Zozbrazit všechny přílohy ({{hidden}} skryté)',
|
showAllAttachments: 'Zozbrazit všechny přílohy ({{hidden}} skryté)',
|
||||||
showFewerAttachments: 'Zobrazit méně příloh',
|
|
||||||
showDetails: 'Zobrazit detaily',
|
showDetails: 'Zobrazit detaily',
|
||||||
|
showFewerAttachments: 'Zobrazit méně příloh',
|
||||||
start: 'Start',
|
start: 'Start',
|
||||||
stop: 'Stop',
|
stop: 'Stop',
|
||||||
subscribe: 'Odebírat',
|
subscribe: 'Odebírat',
|
||||||
unsubscribe: 'Neodebírat',
|
unsubscribe: 'Neodebírat',
|
||||||
uploadNewAvatar: 'Nahrát nového avatara',
|
uploadNewAvatar: 'Nahrát nový avatar',
|
||||||
uploadNewImage: 'Nahrát nový obrázek',
|
uploadNewImage: 'Nahrát nový obrázek',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -51,6 +51,7 @@ export default {
|
|||||||
cardNotFound_title: 'Card Not Found',
|
cardNotFound_title: 'Card Not Found',
|
||||||
cardOrActionAreDeleted: 'Card or action are deleted.',
|
cardOrActionAreDeleted: 'Card or action are deleted.',
|
||||||
color: 'Color',
|
color: 'Color',
|
||||||
|
copy_inline: 'copy',
|
||||||
createBoard_title: 'Create Board',
|
createBoard_title: 'Create Board',
|
||||||
createLabel_title: 'Create Label',
|
createLabel_title: 'Create Label',
|
||||||
createNewOneOrSelectExistingOne: 'Create a new one or select<br />an existing one.',
|
createNewOneOrSelectExistingOne: 'Create a new one or select<br />an existing one.',
|
||||||
@@ -196,6 +197,8 @@ export default {
|
|||||||
deleteTask: 'Delete task',
|
deleteTask: 'Delete task',
|
||||||
deleteTask_title: 'Delete Task',
|
deleteTask_title: 'Delete Task',
|
||||||
deleteUser: 'Delete user',
|
deleteUser: 'Delete user',
|
||||||
|
duplicate: 'Duplicate',
|
||||||
|
duplicateCard_title: 'Duplicate Card',
|
||||||
edit: 'Edit',
|
edit: 'Edit',
|
||||||
editDueDate_title: 'Edit Due Date',
|
editDueDate_title: 'Edit Due Date',
|
||||||
editDescription_title: 'Edit Description',
|
editDescription_title: 'Edit Description',
|
||||||
|
|||||||
@@ -169,6 +169,7 @@ export default {
|
|||||||
deleteTask: 'Supprimer la tâche',
|
deleteTask: 'Supprimer la tâche',
|
||||||
deleteTask_title: 'Supprimer la tâche',
|
deleteTask_title: 'Supprimer la tâche',
|
||||||
deleteUser: "Supprimer l'utilisateur",
|
deleteUser: "Supprimer l'utilisateur",
|
||||||
|
duplicate: 'Dupliquer',
|
||||||
edit: 'Modifier',
|
edit: 'Modifier',
|
||||||
editDueDate_title: "Modifier la date d'échéance",
|
editDueDate_title: "Modifier la date d'échéance",
|
||||||
editDescription_title: 'Éditer la description',
|
editDescription_title: 'Éditer la description',
|
||||||
|
|||||||
@@ -3,10 +3,10 @@ export default {
|
|||||||
date: 'd/M/yyyy',
|
date: 'd/M/yyyy',
|
||||||
time: 'p',
|
time: 'p',
|
||||||
dateTime: '$t(format:date) $t(format:time)',
|
dateTime: '$t(format:date) $t(format:time)',
|
||||||
longDate: 'MMM d',
|
longDate: 'd MMM',
|
||||||
longDateTime: "MMMM d 'at' p",
|
longDateTime: "d MMMM 'alle' p",
|
||||||
fullDate: 'MMM d, y',
|
fullDate: 'd MMM, y',
|
||||||
fullDateTime: "MMMM d, y 'at' p",
|
fullDateTime: "d MMMM, y 'alle' p",
|
||||||
},
|
},
|
||||||
|
|
||||||
translation: {
|
translation: {
|
||||||
@@ -21,7 +21,7 @@ export default {
|
|||||||
administrator: 'Amministratore',
|
administrator: 'Amministratore',
|
||||||
all: 'tutto',
|
all: 'tutto',
|
||||||
allChangesWillBeAutomaticallySavedAfterConnectionRestored:
|
allChangesWillBeAutomaticallySavedAfterConnectionRestored:
|
||||||
'All changes will be automatically saved<br />after connection restored.',
|
'Tutte le modifiche verranno salvate<br />al ripristino della connessione.',
|
||||||
areYouSureYouWantToDeleteThisAttachment: 'Sei sicuro di voler eliminare questo allegato?',
|
areYouSureYouWantToDeleteThisAttachment: 'Sei sicuro di voler eliminare questo allegato?',
|
||||||
areYouSureYouWantToDeleteThisBoard: 'Sei sicuro di voler eliminare questa bacheca?',
|
areYouSureYouWantToDeleteThisBoard: 'Sei sicuro di voler eliminare questa bacheca?',
|
||||||
areYouSureYouWantToDeleteThisCard: 'Sei sicuro di voler eliminare questa card?',
|
areYouSureYouWantToDeleteThisCard: 'Sei sicuro di voler eliminare questa card?',
|
||||||
@@ -50,6 +50,7 @@ export default {
|
|||||||
cardNotFound_title: 'Card non trovata',
|
cardNotFound_title: 'Card non trovata',
|
||||||
cardOrActionAreDeleted: "La card o l'azione vengono eliminate.",
|
cardOrActionAreDeleted: "La card o l'azione vengono eliminate.",
|
||||||
color: 'Colore',
|
color: 'Colore',
|
||||||
|
copy_inline: 'copia',
|
||||||
createBoard_title: 'Crea Bacheca',
|
createBoard_title: 'Crea Bacheca',
|
||||||
createLabel_title: 'Crea Etichetta',
|
createLabel_title: 'Crea Etichetta',
|
||||||
createNewOneOrSelectExistingOne: 'Crea nuovo o seleziona<br />esistente.',
|
createNewOneOrSelectExistingOne: 'Crea nuovo o seleziona<br />esistente.',
|
||||||
@@ -94,8 +95,10 @@ export default {
|
|||||||
filterByLabels_title: 'Filtra per Etichetta',
|
filterByLabels_title: 'Filtra per Etichetta',
|
||||||
filterByMembers_title: 'Filtra per Membro',
|
filterByMembers_title: 'Filtra per Membro',
|
||||||
fromComputer_title: 'Dal Computer',
|
fromComputer_title: 'Dal Computer',
|
||||||
|
fromTrello: 'Da Trello',
|
||||||
general: 'Generale',
|
general: 'Generale',
|
||||||
hours: 'Ore',
|
hours: 'Ore',
|
||||||
|
importBoard_title: 'Importa Board',
|
||||||
invalidCurrentPassword: 'Password corrente non valida',
|
invalidCurrentPassword: 'Password corrente non valida',
|
||||||
labels: 'Etichette',
|
labels: 'Etichette',
|
||||||
language: 'Lingua',
|
language: 'Lingua',
|
||||||
@@ -123,7 +126,7 @@ export default {
|
|||||||
phone: 'Telefono',
|
phone: 'Telefono',
|
||||||
preferences: 'Preferenze',
|
preferences: 'Preferenze',
|
||||||
pressPasteShortcutToAddAttachmentFromClipboard:
|
pressPasteShortcutToAddAttachmentFromClipboard:
|
||||||
'Tip: prmi Ctrl-V (Cmd-V on Mac) per aggiungere un allegato dalla clipboard.',
|
'Consiglio: premi Ctrl-V (Cmd-V on Mac) per aggiungere un allegato dalla clipboard.',
|
||||||
project: 'Progetto',
|
project: 'Progetto',
|
||||||
projectNotFound_title: 'Progetto non trovato',
|
projectNotFound_title: 'Progetto non trovato',
|
||||||
removeManager_title: 'Rimuovi Manager',
|
removeManager_title: 'Rimuovi Manager',
|
||||||
@@ -193,6 +196,8 @@ export default {
|
|||||||
deleteTask: 'Elimina task',
|
deleteTask: 'Elimina task',
|
||||||
deleteTask_title: 'Elimina Task',
|
deleteTask_title: 'Elimina Task',
|
||||||
deleteUser: 'Elimina utente',
|
deleteUser: 'Elimina utente',
|
||||||
|
duplicate: 'Duplica',
|
||||||
|
duplicateCard_title: 'Duplica Card',
|
||||||
edit: 'Modifica',
|
edit: 'Modifica',
|
||||||
editDueDate_title: 'Modifica data di scadenza',
|
editDueDate_title: 'Modifica data di scadenza',
|
||||||
editDescription_title: 'Modifica Descrizione',
|
editDescription_title: 'Modifica Descrizione',
|
||||||
@@ -204,9 +209,10 @@ export default {
|
|||||||
editTitle_title: 'Modifica Titolo',
|
editTitle_title: 'Modifica Titolo',
|
||||||
editUsername_title: 'Modifica Username',
|
editUsername_title: 'Modifica Username',
|
||||||
hideDetails: 'Nascondi dettagli',
|
hideDetails: 'Nascondi dettagli',
|
||||||
|
import: 'Importa',
|
||||||
leaveBoard: 'Lascia bacheca',
|
leaveBoard: 'Lascia bacheca',
|
||||||
leaveProject: 'Lascia progetto',
|
leaveProject: 'Lascia progetto',
|
||||||
logOut_title: 'Log Out',
|
logOut_title: 'Disconnettiti',
|
||||||
makeCover_title: 'Crea Cover',
|
makeCover_title: 'Crea Cover',
|
||||||
move: 'Muovi',
|
move: 'Muovi',
|
||||||
moveCard_title: 'Muovi Card',
|
moveCard_title: 'Muovi Card',
|
||||||
|
|||||||
@@ -199,6 +199,8 @@ export default {
|
|||||||
deleteProject: 'Удалить проект',
|
deleteProject: 'Удалить проект',
|
||||||
deleteTask: 'Удалить задачу',
|
deleteTask: 'Удалить задачу',
|
||||||
deleteUser: 'Удалить пользователя',
|
deleteUser: 'Удалить пользователя',
|
||||||
|
duplicate: 'Дублировать',
|
||||||
|
duplicateCard_title: 'Дублировать карточку',
|
||||||
edit: 'Изменить',
|
edit: 'Изменить',
|
||||||
editBackground: 'Изменить фон',
|
editBackground: 'Изменить фон',
|
||||||
editDueDate: 'Изменить срок',
|
editDueDate: 'Изменить срок',
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import pick from 'lodash/pick';
|
||||||
import { attr, fk, many, oneToOne } from 'redux-orm';
|
import { attr, fk, many, oneToOne } from 'redux-orm';
|
||||||
|
|
||||||
import BaseModel from './BaseModel';
|
import BaseModel from './BaseModel';
|
||||||
@@ -165,7 +166,6 @@ export default class extends BaseModel {
|
|||||||
|
|
||||||
break;
|
break;
|
||||||
case ActionTypes.CARD_CREATE:
|
case ActionTypes.CARD_CREATE:
|
||||||
case ActionTypes.CARD_CREATE_HANDLE:
|
|
||||||
case ActionTypes.CARD_UPDATE__SUCCESS:
|
case ActionTypes.CARD_UPDATE__SUCCESS:
|
||||||
case ActionTypes.CARD_UPDATE_HANDLE:
|
case ActionTypes.CARD_UPDATE_HANDLE:
|
||||||
Card.upsert(payload.card);
|
Card.upsert(payload.card);
|
||||||
@@ -176,10 +176,63 @@ export default class extends BaseModel {
|
|||||||
Card.upsert(payload.card);
|
Card.upsert(payload.card);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
case ActionTypes.CARD_CREATE_HANDLE: {
|
||||||
|
const cardModel = Card.upsert(payload.card);
|
||||||
|
|
||||||
|
payload.cardMemberships.forEach(({ userId }) => {
|
||||||
|
cardModel.users.add(userId);
|
||||||
|
});
|
||||||
|
|
||||||
|
payload.cardLabels.forEach(({ labelId }) => {
|
||||||
|
cardModel.labels.add(labelId);
|
||||||
|
});
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
case ActionTypes.CARD_UPDATE:
|
case ActionTypes.CARD_UPDATE:
|
||||||
Card.withId(payload.id).update(payload.data);
|
Card.withId(payload.id).update(payload.data);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
case ActionTypes.CARD_DUPLICATE: {
|
||||||
|
const cardModel = Card.withId(payload.id);
|
||||||
|
|
||||||
|
const nextCardModel = Card.upsert({
|
||||||
|
...pick(cardModel.ref, [
|
||||||
|
'boardId',
|
||||||
|
'listId',
|
||||||
|
'position',
|
||||||
|
'name',
|
||||||
|
'description',
|
||||||
|
'dueDate',
|
||||||
|
'stopwatch',
|
||||||
|
]),
|
||||||
|
...payload.card,
|
||||||
|
});
|
||||||
|
|
||||||
|
cardModel.users.toRefArray().forEach(({ id }) => {
|
||||||
|
nextCardModel.users.add(id);
|
||||||
|
});
|
||||||
|
|
||||||
|
cardModel.labels.toRefArray().forEach(({ id }) => {
|
||||||
|
nextCardModel.labels.add(id);
|
||||||
|
});
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case ActionTypes.CARD_DUPLICATE__SUCCESS: {
|
||||||
|
Card.withId(payload.localId).deleteWithRelated();
|
||||||
|
const cardModel = Card.upsert(payload.card);
|
||||||
|
|
||||||
|
payload.cardMemberships.forEach(({ userId }) => {
|
||||||
|
cardModel.users.add(userId);
|
||||||
|
});
|
||||||
|
|
||||||
|
payload.cardLabels.forEach(({ labelId }) => {
|
||||||
|
cardModel.labels.add(labelId);
|
||||||
|
});
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
case ActionTypes.CARD_DELETE:
|
case ActionTypes.CARD_DELETE:
|
||||||
Card.withId(payload.id).deleteWithRelated();
|
Card.withId(payload.id).deleteWithRelated();
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import { attr, fk } from 'redux-orm';
|
import { attr, fk } from 'redux-orm';
|
||||||
|
|
||||||
|
import { createLocalId } from '../utils/local-id';
|
||||||
import BaseModel from './BaseModel';
|
import BaseModel from './BaseModel';
|
||||||
import ActionTypes from '../constants/ActionTypes';
|
import ActionTypes from '../constants/ActionTypes';
|
||||||
|
|
||||||
@@ -44,10 +45,24 @@ export default class extends BaseModel {
|
|||||||
|
|
||||||
break;
|
break;
|
||||||
case ActionTypes.BOARD_FETCH__SUCCESS:
|
case ActionTypes.BOARD_FETCH__SUCCESS:
|
||||||
|
case ActionTypes.CARD_CREATE_HANDLE:
|
||||||
|
case ActionTypes.CARD_DUPLICATE__SUCCESS:
|
||||||
payload.tasks.forEach((task) => {
|
payload.tasks.forEach((task) => {
|
||||||
Task.upsert(task);
|
Task.upsert(task);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
break;
|
||||||
|
case ActionTypes.CARD_DUPLICATE:
|
||||||
|
payload.taskIds.forEach((taskId, index) => {
|
||||||
|
const taskModel = Task.withId(taskId);
|
||||||
|
|
||||||
|
Task.upsert({
|
||||||
|
...taskModel.ref,
|
||||||
|
id: `${createLocalId()}-${index}`, // TODO: hack?
|
||||||
|
cardId: payload.card.id,
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case ActionTypes.TASK_CREATE:
|
case ActionTypes.TASK_CREATE:
|
||||||
case ActionTypes.TASK_CREATE_HANDLE:
|
case ActionTypes.TASK_CREATE_HANDLE:
|
||||||
|
|||||||
@@ -1,8 +1,7 @@
|
|||||||
import { call, fork, join, put, select, take } from 'redux-saga/effects';
|
import { call, fork, join, put, select, take } from 'redux-saga/effects';
|
||||||
|
|
||||||
import selectors from '../../selectors';
|
import selectors from '../../selectors';
|
||||||
import actions from '../../actions';
|
import entryActions from '../../entry-actions';
|
||||||
import { removeAccessToken } from '../../utils/access-token-storage';
|
|
||||||
import ErrorCodes from '../../constants/ErrorCodes';
|
import ErrorCodes from '../../constants/ErrorCodes';
|
||||||
|
|
||||||
let lastRequestTask;
|
let lastRequestTask;
|
||||||
@@ -22,8 +21,7 @@ function* queueRequest(method, ...args) {
|
|||||||
});
|
});
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (error.code === ErrorCodes.UNAUTHORIZED) {
|
if (error.code === ErrorCodes.UNAUTHORIZED) {
|
||||||
yield call(removeAccessToken);
|
yield put(entryActions.logout(false));
|
||||||
yield put(actions.logout()); // TODO: next url
|
|
||||||
yield take();
|
yield take();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import request from '../request';
|
|||||||
import selectors from '../../../selectors';
|
import selectors from '../../../selectors';
|
||||||
import actions from '../../../actions';
|
import actions from '../../../actions';
|
||||||
import api from '../../../api';
|
import api from '../../../api';
|
||||||
|
import i18n from '../../../i18n';
|
||||||
import { createLocalId } from '../../../utils/local-id';
|
import { createLocalId } from '../../../utils/local-id';
|
||||||
|
|
||||||
export function* createCard(listId, data, autoOpen) {
|
export function* createCard(listId, data, autoOpen) {
|
||||||
@@ -41,8 +42,23 @@ export function* createCard(listId, data, autoOpen) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function* handleCardCreate(card) {
|
export function* handleCardCreate({ id }) {
|
||||||
yield put(actions.handleCardCreate(card));
|
let card;
|
||||||
|
let cardMemberships;
|
||||||
|
let cardLabels;
|
||||||
|
let tasks;
|
||||||
|
let attachments;
|
||||||
|
|
||||||
|
try {
|
||||||
|
({
|
||||||
|
item: card,
|
||||||
|
included: { cardMemberships, cardLabels, tasks, attachments },
|
||||||
|
} = yield call(request, api.getCard, id));
|
||||||
|
} catch (error) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
yield put(actions.handleCardCreate(card, cardMemberships, cardLabels, tasks, attachments));
|
||||||
}
|
}
|
||||||
|
|
||||||
export function* updateCard(id, data) {
|
export function* updateCard(id, data) {
|
||||||
@@ -70,7 +86,7 @@ export function* handleCardUpdate(card) {
|
|||||||
yield put(actions.handleCardUpdate(card));
|
yield put(actions.handleCardUpdate(card));
|
||||||
}
|
}
|
||||||
|
|
||||||
export function* moveCard(id, listId, index) {
|
export function* moveCard(id, listId, index = 0) {
|
||||||
const position = yield select(selectors.selectNextCardPosition, listId, index, id);
|
const position = yield select(selectors.selectNextCardPosition, listId, index, id);
|
||||||
|
|
||||||
yield call(updateCard, id, {
|
yield call(updateCard, id, {
|
||||||
@@ -85,7 +101,7 @@ export function* moveCurrentCard(listId, index) {
|
|||||||
yield call(moveCard, cardId, listId, index);
|
yield call(moveCard, cardId, listId, index);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function* transferCard(id, boardId, listId, index) {
|
export function* transferCard(id, boardId, listId, index = 0) {
|
||||||
const { cardId: currentCardId, boardId: currentBoardId } = yield select(selectors.selectPath);
|
const { cardId: currentCardId, boardId: currentBoardId } = yield select(selectors.selectPath);
|
||||||
const position = yield select(selectors.selectNextCardPosition, listId, index, id);
|
const position = yield select(selectors.selectNextCardPosition, listId, index, id);
|
||||||
|
|
||||||
@@ -106,6 +122,55 @@ export function* transferCurrentCard(boardId, listId, index) {
|
|||||||
yield call(transferCard, cardId, boardId, listId, index);
|
yield call(transferCard, cardId, boardId, listId, index);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function* duplicateCard(id) {
|
||||||
|
const { listId, name } = yield select(selectors.selectCardById, id);
|
||||||
|
const index = yield select(selectors.selectCardIndexById, id);
|
||||||
|
|
||||||
|
const nextData = {
|
||||||
|
position: yield select(selectors.selectNextCardPosition, listId, index + 1),
|
||||||
|
name: `${name} (${i18n.t('common.copy', {
|
||||||
|
context: 'inline',
|
||||||
|
})})`,
|
||||||
|
};
|
||||||
|
|
||||||
|
const localId = yield call(createLocalId);
|
||||||
|
const taskIds = yield select(selectors.selectTaskIdsByCardId, id);
|
||||||
|
|
||||||
|
yield put(
|
||||||
|
actions.duplicateCard(
|
||||||
|
id,
|
||||||
|
{
|
||||||
|
...nextData,
|
||||||
|
id: localId,
|
||||||
|
},
|
||||||
|
taskIds,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
|
let card;
|
||||||
|
let cardMemberships;
|
||||||
|
let cardLabels;
|
||||||
|
let tasks;
|
||||||
|
|
||||||
|
try {
|
||||||
|
({
|
||||||
|
item: card,
|
||||||
|
included: { cardMemberships, cardLabels, tasks },
|
||||||
|
} = yield call(request, api.duplicateCard, id, nextData));
|
||||||
|
} catch (error) {
|
||||||
|
yield put(actions.duplicateCard.failure(localId, error));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
yield put(actions.duplicateCard.success(localId, card, cardMemberships, cardLabels, tasks));
|
||||||
|
}
|
||||||
|
|
||||||
|
export function* duplicateCurrentCard() {
|
||||||
|
const { cardId } = yield select(selectors.selectPath);
|
||||||
|
|
||||||
|
yield call(duplicateCard, cardId);
|
||||||
|
}
|
||||||
|
|
||||||
export function* deleteCard(id) {
|
export function* deleteCard(id) {
|
||||||
const { cardId, boardId } = yield select(selectors.selectPath);
|
const { cardId, boardId } = yield select(selectors.selectPath);
|
||||||
|
|
||||||
@@ -147,11 +212,13 @@ export default {
|
|||||||
handleCardCreate,
|
handleCardCreate,
|
||||||
updateCard,
|
updateCard,
|
||||||
updateCurrentCard,
|
updateCurrentCard,
|
||||||
|
handleCardUpdate,
|
||||||
moveCard,
|
moveCard,
|
||||||
moveCurrentCard,
|
moveCurrentCard,
|
||||||
transferCard,
|
transferCard,
|
||||||
transferCurrentCard,
|
transferCurrentCard,
|
||||||
handleCardUpdate,
|
duplicateCard,
|
||||||
|
duplicateCurrentCard,
|
||||||
deleteCard,
|
deleteCard,
|
||||||
deleteCurrentCard,
|
deleteCurrentCard,
|
||||||
handleCardDelete,
|
handleCardDelete,
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { call, put, select, take } from 'redux-saga/effects';
|
import { call, put, select } from 'redux-saga/effects';
|
||||||
|
|
||||||
import request from '../request';
|
import request from '../request';
|
||||||
import requests from '../requests';
|
import requests from '../requests';
|
||||||
@@ -84,8 +84,7 @@ export function* logout(invalidateAccessToken = true) {
|
|||||||
} catch (error) {} // eslint-disable-line no-empty
|
} catch (error) {} // eslint-disable-line no-empty
|
||||||
}
|
}
|
||||||
|
|
||||||
yield put(actions.logout());
|
yield put(actions.logout()); // TODO: next url
|
||||||
yield take();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
|||||||
@@ -1,10 +1,12 @@
|
|||||||
import { call, put, select, take } from 'redux-saga/effects';
|
import { call, put, select, take } from 'redux-saga/effects';
|
||||||
import { push } from '../../../lib/redux-router';
|
import { push } from '../../../lib/redux-router';
|
||||||
|
|
||||||
|
import { logout } from './core';
|
||||||
import request from '../request';
|
import request from '../request';
|
||||||
import selectors from '../../../selectors';
|
import selectors from '../../../selectors';
|
||||||
import actions from '../../../actions';
|
import actions from '../../../actions';
|
||||||
import api from '../../../api';
|
import api from '../../../api';
|
||||||
|
import { getAccessToken } from '../../../utils/access-token-storage';
|
||||||
import ActionTypes from '../../../constants/ActionTypes';
|
import ActionTypes from '../../../constants/ActionTypes';
|
||||||
import Paths from '../../../constants/Paths';
|
import Paths from '../../../constants/Paths';
|
||||||
|
|
||||||
@@ -25,6 +27,13 @@ export function* goToCard(cardId) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function* handleLocationChange() {
|
export function* handleLocationChange() {
|
||||||
|
const accessToken = yield call(getAccessToken);
|
||||||
|
|
||||||
|
if (!accessToken) {
|
||||||
|
yield call(logout, false);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const pathsMatch = yield select(selectors.selectPathsMatch);
|
const pathsMatch = yield select(selectors.selectPathsMatch);
|
||||||
|
|
||||||
if (!pathsMatch) {
|
if (!pathsMatch) {
|
||||||
|
|||||||
@@ -218,6 +218,7 @@ export function* handleUserDelete(user) {
|
|||||||
|
|
||||||
if (user.id === currentUserId) {
|
if (user.id === currentUserId) {
|
||||||
yield call(logout, false);
|
yield call(logout, false);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
yield put(actions.handleUserDelete(user));
|
yield put(actions.handleUserDelete(user));
|
||||||
|
|||||||
@@ -32,6 +32,8 @@ export default function* cardsWatchers() {
|
|||||||
takeEvery(EntryActionTypes.CURRENT_CARD_TRANSFER, ({ payload: { boardId, listId, index } }) =>
|
takeEvery(EntryActionTypes.CURRENT_CARD_TRANSFER, ({ payload: { boardId, listId, index } }) =>
|
||||||
services.transferCurrentCard(boardId, listId, index),
|
services.transferCurrentCard(boardId, listId, index),
|
||||||
),
|
),
|
||||||
|
takeEvery(EntryActionTypes.CARD_DUPLICATE, ({ payload: { id } }) => services.duplicateCard(id)),
|
||||||
|
takeEvery(EntryActionTypes.CURRENT_CARD_DUPLICATE, () => services.duplicateCurrentCard()),
|
||||||
takeEvery(EntryActionTypes.CARD_DELETE, ({ payload: { id } }) => services.deleteCard(id)),
|
takeEvery(EntryActionTypes.CARD_DELETE, ({ payload: { id } }) => services.deleteCard(id)),
|
||||||
takeEvery(EntryActionTypes.CURRENT_CARD_DELETE, () => services.deleteCurrentCard()),
|
takeEvery(EntryActionTypes.CURRENT_CARD_DELETE, () => services.deleteCurrentCard()),
|
||||||
takeEvery(EntryActionTypes.CARD_DELETE_HANDLE, ({ payload: { card } }) =>
|
takeEvery(EntryActionTypes.CARD_DELETE_HANDLE, ({ payload: { card } }) =>
|
||||||
|
|||||||
@@ -4,5 +4,9 @@ import services from '../services';
|
|||||||
import EntryActionTypes from '../../../constants/EntryActionTypes';
|
import EntryActionTypes from '../../../constants/EntryActionTypes';
|
||||||
|
|
||||||
export default function* coreWatchers() {
|
export default function* coreWatchers() {
|
||||||
yield all([takeEvery(EntryActionTypes.LOGOUT, () => services.logout())]);
|
yield all([
|
||||||
|
takeEvery(EntryActionTypes.LOGOUT, ({ payload: { invalidateAccessToken } }) =>
|
||||||
|
services.logout(invalidateAccessToken),
|
||||||
|
),
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,6 +16,10 @@ const createSocketEventsChannel = () =>
|
|||||||
emit(entryActions.handleSocketReconnect());
|
emit(entryActions.handleSocketReconnect());
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const handleLogout = () => {
|
||||||
|
emit(entryActions.logout(false));
|
||||||
|
};
|
||||||
|
|
||||||
const handleUserCreate = api.makeHandleUserCreate(({ item }) => {
|
const handleUserCreate = api.makeHandleUserCreate(({ item }) => {
|
||||||
emit(entryActions.handleUserCreate(item));
|
emit(entryActions.handleUserCreate(item));
|
||||||
});
|
});
|
||||||
@@ -171,6 +175,8 @@ const createSocketEventsChannel = () =>
|
|||||||
socket.on('disconnect', handleDisconnect);
|
socket.on('disconnect', handleDisconnect);
|
||||||
socket.on('reconnect', handleReconnect);
|
socket.on('reconnect', handleReconnect);
|
||||||
|
|
||||||
|
socket.on('logout', handleLogout);
|
||||||
|
|
||||||
socket.on('userCreate', handleUserCreate);
|
socket.on('userCreate', handleUserCreate);
|
||||||
socket.on('userUpdate', handleUserUpdate);
|
socket.on('userUpdate', handleUserUpdate);
|
||||||
socket.on('userDelete', handleUserDelete);
|
socket.on('userDelete', handleUserDelete);
|
||||||
@@ -227,6 +233,8 @@ const createSocketEventsChannel = () =>
|
|||||||
socket.off('disconnect', handleDisconnect);
|
socket.off('disconnect', handleDisconnect);
|
||||||
socket.off('reconnect', handleReconnect);
|
socket.off('reconnect', handleReconnect);
|
||||||
|
|
||||||
|
socket.off('logout', handleLogout);
|
||||||
|
|
||||||
socket.off('userCreate', handleUserCreate);
|
socket.off('userCreate', handleUserCreate);
|
||||||
socket.off('userUpdate', handleUserUpdate);
|
socket.off('userUpdate', handleUserUpdate);
|
||||||
socket.off('userDelete', handleUserDelete);
|
socket.off('userDelete', handleUserDelete);
|
||||||
|
|||||||
@@ -33,10 +33,10 @@ export function* authenticateUsingOidc() {
|
|||||||
const oidcConfig = yield select(selectors.selectOidcConfig);
|
const oidcConfig = yield select(selectors.selectOidcConfig);
|
||||||
|
|
||||||
const state = nanoid();
|
const state = nanoid();
|
||||||
window.sessionStorage.setItem('oidc-state', state);
|
window.localStorage.setItem('oidc-state', state);
|
||||||
|
|
||||||
const nonce = nanoid();
|
const nonce = nanoid();
|
||||||
window.sessionStorage.setItem('oidc-nonce', nonce);
|
window.localStorage.setItem('oidc-nonce', nonce);
|
||||||
|
|
||||||
let redirectUrl = `${oidcConfig.authorizationUrl}`;
|
let redirectUrl = `${oidcConfig.authorizationUrl}`;
|
||||||
redirectUrl += `&state=${encodeURIComponent(state)}`;
|
redirectUrl += `&state=${encodeURIComponent(state)}`;
|
||||||
@@ -49,11 +49,11 @@ export function* authenticateUsingOidcCallback() {
|
|||||||
// https://github.com/plankanban/planka/issues/511#issuecomment-1771385639
|
// https://github.com/plankanban/planka/issues/511#issuecomment-1771385639
|
||||||
const params = new URLSearchParams(window.location.hash.substring(1) || window.location.search);
|
const params = new URLSearchParams(window.location.hash.substring(1) || window.location.search);
|
||||||
|
|
||||||
const state = window.sessionStorage.getItem('oidc-state');
|
const state = window.localStorage.getItem('oidc-state');
|
||||||
window.sessionStorage.removeItem('oidc-state');
|
window.localStorage.removeItem('oidc-state');
|
||||||
|
|
||||||
const nonce = window.sessionStorage.getItem('oidc-nonce');
|
const nonce = window.localStorage.getItem('oidc-nonce');
|
||||||
window.sessionStorage.removeItem('oidc-nonce');
|
window.localStorage.removeItem('oidc-nonce');
|
||||||
|
|
||||||
yield put(replace(Paths.LOGIN));
|
yield put(replace(Paths.LOGIN));
|
||||||
|
|
||||||
|
|||||||
@@ -26,6 +26,24 @@ export const makeSelectCardById = () =>
|
|||||||
|
|
||||||
export const selectCardById = makeSelectCardById();
|
export const selectCardById = makeSelectCardById();
|
||||||
|
|
||||||
|
export const makeSelectCardIndexById = () =>
|
||||||
|
createSelector(
|
||||||
|
orm,
|
||||||
|
(_, id) => id,
|
||||||
|
({ Card }, id) => {
|
||||||
|
const cardModel = Card.withId(id);
|
||||||
|
|
||||||
|
if (!cardModel) {
|
||||||
|
return cardModel;
|
||||||
|
}
|
||||||
|
|
||||||
|
const cardModels = cardModel.list.getFilteredOrderedCardsModelArray();
|
||||||
|
return cardModels.findIndex((cardModelItem) => cardModelItem.id === cardModel.id);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
|
export const selectCardIndexById = makeSelectCardIndexById();
|
||||||
|
|
||||||
export const makeSelectUsersByCardId = () =>
|
export const makeSelectUsersByCardId = () =>
|
||||||
createSelector(
|
createSelector(
|
||||||
orm,
|
orm,
|
||||||
@@ -60,6 +78,26 @@ export const makeSelectLabelsByCardId = () =>
|
|||||||
|
|
||||||
export const selectLabelsByCardId = makeSelectLabelsByCardId();
|
export const selectLabelsByCardId = makeSelectLabelsByCardId();
|
||||||
|
|
||||||
|
export const makeSelectTaskIdsByCardId = () =>
|
||||||
|
createSelector(
|
||||||
|
orm,
|
||||||
|
(_, id) => id,
|
||||||
|
({ Card }, id) => {
|
||||||
|
const cardModel = Card.withId(id);
|
||||||
|
|
||||||
|
if (!cardModel) {
|
||||||
|
return cardModel;
|
||||||
|
}
|
||||||
|
|
||||||
|
return cardModel
|
||||||
|
.getOrderedTasksQuerySet()
|
||||||
|
.toRefArray()
|
||||||
|
.map((task) => task.id);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
|
export const selectTaskIdsByCardId = makeSelectTaskIdsByCardId();
|
||||||
|
|
||||||
export const makeSelectTasksByCardId = () =>
|
export const makeSelectTasksByCardId = () =>
|
||||||
createSelector(
|
createSelector(
|
||||||
orm,
|
orm,
|
||||||
@@ -286,10 +324,14 @@ export const selectNotificationIdsForCurrentCard = createSelector(
|
|||||||
export default {
|
export default {
|
||||||
makeSelectCardById,
|
makeSelectCardById,
|
||||||
selectCardById,
|
selectCardById,
|
||||||
|
makeSelectCardIndexById,
|
||||||
|
selectCardIndexById,
|
||||||
makeSelectUsersByCardId,
|
makeSelectUsersByCardId,
|
||||||
selectUsersByCardId,
|
selectUsersByCardId,
|
||||||
makeSelectLabelsByCardId,
|
makeSelectLabelsByCardId,
|
||||||
selectLabelsByCardId,
|
selectLabelsByCardId,
|
||||||
|
makeSelectTaskIdsByCardId,
|
||||||
|
selectTaskIdsByCardId,
|
||||||
makeSelectTasksByCardId,
|
makeSelectTasksByCardId,
|
||||||
selectTasksByCardId,
|
selectTasksByCardId,
|
||||||
makeSelectLastActivityIdByCardId,
|
makeSelectLastActivityIdByCardId,
|
||||||
|
|||||||
+11
-8
@@ -31,14 +31,6 @@ services:
|
|||||||
# - DEFAULT_ADMIN_NAME=Demo Demo
|
# - DEFAULT_ADMIN_NAME=Demo Demo
|
||||||
# - DEFAULT_ADMIN_USERNAME=demo
|
# - DEFAULT_ADMIN_USERNAME=demo
|
||||||
|
|
||||||
# Email Notifications (https://nodemailer.com/smtp/)
|
|
||||||
# - SMTP_HOST=
|
|
||||||
# - SMTP_PORT=587
|
|
||||||
# - SMTP_SECURE=true
|
|
||||||
# - SMTP_USER=
|
|
||||||
# - SMTP_PASSWORD=
|
|
||||||
# - SMTP_FROM="Demo Demo" <demo@demo.demo>
|
|
||||||
|
|
||||||
# - OIDC_ISSUER=
|
# - OIDC_ISSUER=
|
||||||
# - OIDC_CLIENT_ID=
|
# - OIDC_CLIENT_ID=
|
||||||
# - OIDC_CLIENT_SECRET=
|
# - OIDC_CLIENT_SECRET=
|
||||||
@@ -51,6 +43,17 @@ services:
|
|||||||
# - OIDC_IGNORE_USERNAME=true
|
# - OIDC_IGNORE_USERNAME=true
|
||||||
# - OIDC_IGNORE_ROLES=true
|
# - OIDC_IGNORE_ROLES=true
|
||||||
# - OIDC_ENFORCED=true
|
# - OIDC_ENFORCED=true
|
||||||
|
|
||||||
|
# Email Notifications (https://nodemailer.com/smtp/)
|
||||||
|
# - SMTP_HOST=
|
||||||
|
# - SMTP_PORT=587
|
||||||
|
# - SMTP_SECURE=true
|
||||||
|
# - SMTP_USER=
|
||||||
|
# - SMTP_PASSWORD=
|
||||||
|
# - SMTP_FROM="Demo Demo" <demo@demo.demo>
|
||||||
|
|
||||||
|
# - SLACK_BOT_TOKEN=
|
||||||
|
# - SLACK_CHANNEL_ID=
|
||||||
depends_on:
|
depends_on:
|
||||||
postgres:
|
postgres:
|
||||||
condition: service_healthy
|
condition: service_healthy
|
||||||
|
|||||||
Generated
+2
-2
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "planka",
|
"name": "planka",
|
||||||
"version": "1.16.0",
|
"version": "1.16.3",
|
||||||
"lockfileVersion": 2,
|
"lockfileVersion": 2,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "planka",
|
"name": "planka",
|
||||||
"version": "1.16.0",
|
"version": "1.16.3",
|
||||||
"hasInstallScript": true,
|
"hasInstallScript": true,
|
||||||
"license": "AGPL-3.0",
|
"license": "AGPL-3.0",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "planka",
|
"name": "planka",
|
||||||
"version": "1.16.0",
|
"version": "1.16.3",
|
||||||
"private": true,
|
"private": true,
|
||||||
"homepage": "https://plankanban.github.io/planka",
|
"homepage": "https://plankanban.github.io/planka",
|
||||||
"repository": {
|
"repository": {
|
||||||
|
|||||||
+11
-8
@@ -22,14 +22,6 @@ SECRET_KEY=notsecretkey
|
|||||||
# DEFAULT_ADMIN_NAME=Demo Demo
|
# DEFAULT_ADMIN_NAME=Demo Demo
|
||||||
# DEFAULT_ADMIN_USERNAME=demo
|
# DEFAULT_ADMIN_USERNAME=demo
|
||||||
|
|
||||||
# Email Notifications (https://nodemailer.com/smtp/)
|
|
||||||
# SMTP_HOST=
|
|
||||||
# SMTP_PORT=587
|
|
||||||
# SMTP_SECURE=true
|
|
||||||
# SMTP_USER=
|
|
||||||
# SMTP_PASSWORD=
|
|
||||||
# SMTP_FROM="Demo Demo" <demo@demo.demo>
|
|
||||||
|
|
||||||
# OIDC_ISSUER=
|
# OIDC_ISSUER=
|
||||||
# OIDC_CLIENT_ID=
|
# OIDC_CLIENT_ID=
|
||||||
# OIDC_CLIENT_SECRET=
|
# OIDC_CLIENT_SECRET=
|
||||||
@@ -43,6 +35,17 @@ SECRET_KEY=notsecretkey
|
|||||||
# OIDC_IGNORE_ROLES=true
|
# OIDC_IGNORE_ROLES=true
|
||||||
# OIDC_ENFORCED=true
|
# OIDC_ENFORCED=true
|
||||||
|
|
||||||
|
# Email Notifications (https://nodemailer.com/smtp/)
|
||||||
|
# SMTP_HOST=
|
||||||
|
# SMTP_PORT=587
|
||||||
|
# SMTP_SECURE=true
|
||||||
|
# SMTP_USER=
|
||||||
|
# SMTP_PASSWORD=
|
||||||
|
# SMTP_FROM="Demo Demo" <demo@demo.demo>
|
||||||
|
|
||||||
|
# SLACK_BOT_TOKEN=
|
||||||
|
# SLACK_CHANNEL_ID=
|
||||||
|
|
||||||
## Do not edit this
|
## Do not edit this
|
||||||
|
|
||||||
TZ=UTC
|
TZ=UTC
|
||||||
|
|||||||
@@ -9,6 +9,10 @@ module.exports = {
|
|||||||
deletedAt: new Date().toISOString(),
|
deletedAt: new Date().toISOString(),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (this.req.isSocket) {
|
||||||
|
sails.sockets.leaveAll(`@accessToken:${accessToken}`);
|
||||||
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
item: accessToken,
|
item: accessToken,
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -47,6 +47,7 @@ module.exports = {
|
|||||||
|
|
||||||
card = await sails.helpers.cards.deleteOne.with({
|
card = await sails.helpers.cards.deleteOne.with({
|
||||||
record: card,
|
record: card,
|
||||||
|
user: currentUser,
|
||||||
request: this.req,
|
request: this.req,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Executable
+82
@@ -0,0 +1,82 @@
|
|||||||
|
const Errors = {
|
||||||
|
NOT_ENOUGH_RIGHTS: {
|
||||||
|
notEnoughRights: 'Not enough rights',
|
||||||
|
},
|
||||||
|
CARD_NOT_FOUND: {
|
||||||
|
cardNotFound: 'Card not found',
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
inputs: {
|
||||||
|
id: {
|
||||||
|
type: 'string',
|
||||||
|
regex: /^[0-9]+$/,
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
|
position: {
|
||||||
|
type: 'number',
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
|
name: {
|
||||||
|
type: 'string',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
exits: {
|
||||||
|
notEnoughRights: {
|
||||||
|
responseType: 'forbidden',
|
||||||
|
},
|
||||||
|
cardNotFound: {
|
||||||
|
responseType: 'notFound',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
async fn(inputs) {
|
||||||
|
const { currentUser } = this.req;
|
||||||
|
|
||||||
|
const { card, list, board } = await sails.helpers.cards
|
||||||
|
.getProjectPath(inputs.id)
|
||||||
|
.intercept('pathNotFound', () => Errors.CARD_NOT_FOUND);
|
||||||
|
|
||||||
|
const boardMembership = await BoardMembership.findOne({
|
||||||
|
boardId: card.boardId,
|
||||||
|
userId: currentUser.id,
|
||||||
|
});
|
||||||
|
|
||||||
|
if (!boardMembership) {
|
||||||
|
throw Errors.CARD_NOT_FOUND; // Forbidden
|
||||||
|
}
|
||||||
|
|
||||||
|
if (boardMembership.role !== BoardMembership.Roles.EDITOR) {
|
||||||
|
throw Errors.NOT_ENOUGH_RIGHTS;
|
||||||
|
}
|
||||||
|
|
||||||
|
const values = _.pick(inputs, ['position', 'name']);
|
||||||
|
|
||||||
|
const {
|
||||||
|
card: nextCard,
|
||||||
|
cardMemberships,
|
||||||
|
cardLabels,
|
||||||
|
tasks,
|
||||||
|
} = await sails.helpers.cards.duplicateOne.with({
|
||||||
|
board,
|
||||||
|
list,
|
||||||
|
record: card,
|
||||||
|
values: {
|
||||||
|
...values,
|
||||||
|
creatorUser: currentUser,
|
||||||
|
},
|
||||||
|
request: this.req,
|
||||||
|
});
|
||||||
|
|
||||||
|
return {
|
||||||
|
item: nextCard,
|
||||||
|
included: {
|
||||||
|
cardMemberships,
|
||||||
|
cardLabels,
|
||||||
|
tasks,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
},
|
||||||
|
};
|
||||||
@@ -14,6 +14,30 @@ const valuesValidator = (value) => {
|
|||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const buildAndSendSlackMessage = async (user, card, action) => {
|
||||||
|
const cardLink = `<${sails.config.custom.baseUrl}/cards/${card.id}|${card.name}>`;
|
||||||
|
|
||||||
|
let markdown;
|
||||||
|
switch (action.type) {
|
||||||
|
case Action.Types.CREATE_CARD:
|
||||||
|
markdown = `${cardLink} was created by ${user.name} in *${action.data.list.name}*`;
|
||||||
|
|
||||||
|
break;
|
||||||
|
case Action.Types.MOVE_CARD:
|
||||||
|
markdown = `${cardLink} was moved by ${user.name} to *${action.data.toList.name}*`;
|
||||||
|
|
||||||
|
break;
|
||||||
|
case Action.Types.COMMENT_CARD:
|
||||||
|
markdown = `*${user.name}* commented on ${cardLink}:\n>${action.data.text}`;
|
||||||
|
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
await sails.helpers.utils.sendSlackMessage(markdown);
|
||||||
|
};
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
inputs: {
|
inputs: {
|
||||||
values: {
|
values: {
|
||||||
@@ -67,6 +91,10 @@ module.exports = {
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if (sails.config.custom.slackBotToken) {
|
||||||
|
buildAndSendSlackMessage(values.user, values.card, action);
|
||||||
|
}
|
||||||
|
|
||||||
return action;
|
return action;
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
const POSITION_GAP = 65535; // TODO: move to config
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
inputs: {
|
inputs: {
|
||||||
user: {
|
user: {
|
||||||
@@ -124,7 +126,7 @@ module.exports = {
|
|||||||
getUsedTrelloLabels().map(async (trelloLabel, index) => {
|
getUsedTrelloLabels().map(async (trelloLabel, index) => {
|
||||||
const plankaLabel = await Label.create({
|
const plankaLabel = await Label.create({
|
||||||
boardId: inputs.board.id,
|
boardId: inputs.board.id,
|
||||||
position: 65535 * (index + 1), // TODO: move to config
|
position: POSITION_GAP * (index + 1),
|
||||||
name: trelloLabel.name || null,
|
name: trelloLabel.name || null,
|
||||||
color: getPlankaLabelColor(trelloLabel.color),
|
color: getPlankaLabelColor(trelloLabel.color),
|
||||||
}).fetch();
|
}).fetch();
|
||||||
|
|||||||
@@ -1,9 +1,17 @@
|
|||||||
|
const buildAndSendSlackMessage = async (user, card) => {
|
||||||
|
await sails.helpers.utils.sendSlackMessage(`*${card.name}* was deleted by ${user.name}`);
|
||||||
|
};
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
inputs: {
|
inputs: {
|
||||||
record: {
|
record: {
|
||||||
type: 'ref',
|
type: 'ref',
|
||||||
required: true,
|
required: true,
|
||||||
},
|
},
|
||||||
|
user: {
|
||||||
|
type: 'ref',
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
request: {
|
request: {
|
||||||
type: 'ref',
|
type: 'ref',
|
||||||
},
|
},
|
||||||
@@ -21,6 +29,10 @@ module.exports = {
|
|||||||
},
|
},
|
||||||
inputs.request,
|
inputs.request,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if (sails.config.custom.slackBotToken) {
|
||||||
|
buildAndSendSlackMessage(inputs.user, card);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return card;
|
return card;
|
||||||
|
|||||||
@@ -0,0 +1,144 @@
|
|||||||
|
const valuesValidator = (value) => {
|
||||||
|
if (!_.isPlainObject(value)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!_.isUndefined(value.position) && !_.isFinite(value.position)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!_.isPlainObject(value.creatorUser)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
};
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
inputs: {
|
||||||
|
record: {
|
||||||
|
type: 'ref',
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
|
values: {
|
||||||
|
type: 'ref',
|
||||||
|
custom: valuesValidator,
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
|
board: {
|
||||||
|
type: 'ref',
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
|
list: {
|
||||||
|
type: 'ref',
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
|
request: {
|
||||||
|
type: 'ref',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
async fn(inputs) {
|
||||||
|
const { values } = inputs;
|
||||||
|
|
||||||
|
const cards = await sails.helpers.lists.getCards(inputs.record.listId);
|
||||||
|
|
||||||
|
const { position, repositions } = sails.helpers.utils.insertToPositionables(
|
||||||
|
values.position,
|
||||||
|
cards,
|
||||||
|
);
|
||||||
|
|
||||||
|
repositions.forEach(async ({ id, position: nextPosition }) => {
|
||||||
|
await Card.update({
|
||||||
|
id,
|
||||||
|
listId: inputs.record.listId,
|
||||||
|
}).set({
|
||||||
|
position: nextPosition,
|
||||||
|
});
|
||||||
|
|
||||||
|
sails.sockets.broadcast(`board:${inputs.record.boardId}`, 'cardUpdate', {
|
||||||
|
item: {
|
||||||
|
id,
|
||||||
|
position: nextPosition,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
const card = await Card.create({
|
||||||
|
..._.pick(inputs.record, [
|
||||||
|
'boardId',
|
||||||
|
'listId',
|
||||||
|
'name',
|
||||||
|
'description',
|
||||||
|
'dueDate',
|
||||||
|
'stopwatch',
|
||||||
|
]),
|
||||||
|
...values,
|
||||||
|
position,
|
||||||
|
creatorUserId: values.creatorUser.id,
|
||||||
|
}).fetch();
|
||||||
|
|
||||||
|
const cardMemberships = await sails.helpers.cards.getCardMemberships(inputs.record.id);
|
||||||
|
const cardMembershipsValues = cardMemberships.map((cardMembership) => ({
|
||||||
|
..._.pick(cardMembership, ['userId']),
|
||||||
|
cardId: card.id,
|
||||||
|
}));
|
||||||
|
const nextCardMemberships = await CardMembership.createEach(cardMembershipsValues).fetch();
|
||||||
|
|
||||||
|
const cardLabels = await sails.helpers.cards.getCardLabels(inputs.record.id);
|
||||||
|
const cardLabelsValues = cardLabels.map((cardLabel) => ({
|
||||||
|
..._.pick(cardLabel, ['labelId']),
|
||||||
|
cardId: card.id,
|
||||||
|
}));
|
||||||
|
const nextCardLabels = await CardLabel.createEach(cardLabelsValues).fetch();
|
||||||
|
|
||||||
|
const tasks = await sails.helpers.cards.getTasks(inputs.record.id);
|
||||||
|
const tasksValues = tasks.map((task) => ({
|
||||||
|
..._.pick(task, ['position', 'name', 'isCompleted']),
|
||||||
|
cardId: card.id,
|
||||||
|
}));
|
||||||
|
const nextTasks = await Task.createEach(tasksValues).fetch();
|
||||||
|
|
||||||
|
sails.sockets.broadcast(
|
||||||
|
`board:${card.boardId}`,
|
||||||
|
'cardCreate',
|
||||||
|
{
|
||||||
|
item: card,
|
||||||
|
},
|
||||||
|
inputs.request,
|
||||||
|
);
|
||||||
|
|
||||||
|
if (values.creatorUser.subscribeToOwnCards) {
|
||||||
|
await CardSubscription.create({
|
||||||
|
cardId: card.id,
|
||||||
|
userId: card.creatorUserId,
|
||||||
|
}).tolerate('E_UNIQUE');
|
||||||
|
|
||||||
|
sails.sockets.broadcast(`user:${card.creatorUserId}`, 'cardUpdate', {
|
||||||
|
item: {
|
||||||
|
id: card.id,
|
||||||
|
isSubscribed: true,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
await sails.helpers.actions.createOne.with({
|
||||||
|
values: {
|
||||||
|
card,
|
||||||
|
type: Action.Types.CREATE_CARD, // TODO: introduce separate type?
|
||||||
|
data: {
|
||||||
|
list: _.pick(inputs.list, ['id', 'name']),
|
||||||
|
},
|
||||||
|
user: values.creatorUser,
|
||||||
|
},
|
||||||
|
board: inputs.board,
|
||||||
|
});
|
||||||
|
|
||||||
|
return {
|
||||||
|
card,
|
||||||
|
cardMemberships: nextCardMemberships,
|
||||||
|
cardLabels: nextCardLabels,
|
||||||
|
tasks: nextTasks,
|
||||||
|
};
|
||||||
|
},
|
||||||
|
};
|
||||||
@@ -27,6 +27,7 @@ const buildAndSendEmail = async (user, board, card, action, notifiableUser) => {
|
|||||||
`from ${action.data.fromList.name} to ${action.data.toList.name} ` +
|
`from ${action.data.fromList.name} to ${action.data.toList.name} ` +
|
||||||
`on <a href="${process.env.BASE_URL}/boards/${board.id}">${board.name}</a></p>`,
|
`on <a href="${process.env.BASE_URL}/boards/${board.id}">${board.name}</a></p>`,
|
||||||
};
|
};
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case Action.Types.COMMENT_CARD:
|
case Action.Types.COMMENT_CARD:
|
||||||
emailData = {
|
emailData = {
|
||||||
@@ -37,6 +38,7 @@ const buildAndSendEmail = async (user, board, card, action, notifiableUser) => {
|
|||||||
`on <a href="${process.env.BASE_URL}/boards/${board.id}">${board.name}</a></p>` +
|
`on <a href="${process.env.BASE_URL}/boards/${board.id}">${board.name}</a></p>` +
|
||||||
`<p>${action.data.text}</p>`,
|
`<p>${action.data.text}</p>`,
|
||||||
};
|
};
|
||||||
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ module.exports = {
|
|||||||
|
|
||||||
sails.log.info('Email sent: %s', info.messageId);
|
sails.log.info('Email sent: %s', info.messageId);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
sails.log.error(error);
|
sails.log.error(error); // TODO: provide description text?
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -0,0 +1,53 @@
|
|||||||
|
const POST_MESSAGE_API_URL = 'https://slack.com/api/chat.postMessage';
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
inputs: {
|
||||||
|
markdown: {
|
||||||
|
type: 'string',
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
async fn(inputs) {
|
||||||
|
const headers = {
|
||||||
|
Authorization: `Bearer ${sails.config.custom.slackBotToken}`,
|
||||||
|
'Content-Type': 'application/json; charset=utf-8',
|
||||||
|
};
|
||||||
|
|
||||||
|
const body = {
|
||||||
|
blocks: [
|
||||||
|
{
|
||||||
|
type: 'section',
|
||||||
|
text: {
|
||||||
|
type: 'mrkdwn',
|
||||||
|
text: inputs.markdown,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
channel: sails.config.custom.slackChannelId,
|
||||||
|
};
|
||||||
|
|
||||||
|
let response;
|
||||||
|
try {
|
||||||
|
response = await fetch(POST_MESSAGE_API_URL, {
|
||||||
|
headers,
|
||||||
|
method: 'POST',
|
||||||
|
body: JSON.stringify(body),
|
||||||
|
});
|
||||||
|
} catch (error) {
|
||||||
|
sails.log.error(error); // TODO: provide description text?
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!response.ok) {
|
||||||
|
sails.log.error('Error sending to Slack: %s', response.error);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const responseJson = await response.json();
|
||||||
|
|
||||||
|
if (!responseJson.ok) {
|
||||||
|
sails.log.error('Error sending to Slack: %s', responseJson.error);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
};
|
||||||
@@ -61,6 +61,7 @@ module.exports = function defineCurrentUserHook(sails) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
if (req.isSocket) {
|
if (req.isSocket) {
|
||||||
|
sails.sockets.join(req, `@accessToken:${accessToken}`);
|
||||||
sails.sockets.join(req, `@user:${currentUser.id}`);
|
sails.sockets.join(req, `@user:${currentUser.id}`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,14 @@
|
|||||||
const openidClient = require('openid-client');
|
const openidClient = require('openid-client');
|
||||||
|
|
||||||
module.exports = function oidcServiceHook(sails) {
|
/**
|
||||||
|
* oidc hook
|
||||||
|
*
|
||||||
|
* @description :: A hook definition. Extends Sails by adding shadow routes, implicit actions,
|
||||||
|
* and/or initialization logic.
|
||||||
|
* @docs :: https://sailsjs.com/docs/concepts/extending-sails/hooks
|
||||||
|
*/
|
||||||
|
|
||||||
|
module.exports = function defineOidcHook(sails) {
|
||||||
let client = null;
|
let client = null;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
@@ -9,17 +17,20 @@ module.exports = function oidcServiceHook(sails) {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
async initialize() {
|
async initialize() {
|
||||||
if (sails.config.custom.oidcIssuer) {
|
if (!sails.config.custom.oidcIssuer) {
|
||||||
const issuer = await openidClient.Issuer.discover(sails.config.custom.oidcIssuer);
|
return;
|
||||||
|
|
||||||
client = new issuer.Client({
|
|
||||||
client_id: sails.config.custom.oidcClientId,
|
|
||||||
client_secret: sails.config.custom.oidcClientSecret,
|
|
||||||
redirect_uris: [sails.config.custom.oidcRedirectUri],
|
|
||||||
response_types: ['code'],
|
|
||||||
});
|
|
||||||
sails.log.info('OIDC hook has been loaded successfully');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sails.log.info('Initializing custom hook (`oidc`)');
|
||||||
|
|
||||||
|
const issuer = await openidClient.Issuer.discover(sails.config.custom.oidcIssuer);
|
||||||
|
|
||||||
|
client = new issuer.Client({
|
||||||
|
client_id: sails.config.custom.oidcClientId,
|
||||||
|
client_secret: sails.config.custom.oidcClientSecret,
|
||||||
|
redirect_uris: [sails.config.custom.oidcRedirectUri],
|
||||||
|
response_types: ['code'],
|
||||||
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
getClient() {
|
getClient() {
|
||||||
|
|||||||
@@ -1,6 +1,14 @@
|
|||||||
const nodemailer = require('nodemailer');
|
const nodemailer = require('nodemailer');
|
||||||
|
|
||||||
module.exports = function smtpServiceHook(sails) {
|
/**
|
||||||
|
* smtp hook
|
||||||
|
*
|
||||||
|
* @description :: A hook definition. Extends Sails by adding shadow routes, implicit actions,
|
||||||
|
* and/or initialization logic.
|
||||||
|
* @docs :: https://sailsjs.com/docs/concepts/extending-sails/hooks
|
||||||
|
*/
|
||||||
|
|
||||||
|
module.exports = function defineSmtpHook(sails) {
|
||||||
let transporter = null;
|
let transporter = null;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
@@ -9,19 +17,22 @@ module.exports = function smtpServiceHook(sails) {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
async initialize() {
|
async initialize() {
|
||||||
if (sails.config.custom.smtpHost) {
|
if (!sails.config.custom.smtpHost) {
|
||||||
transporter = nodemailer.createTransport({
|
return;
|
||||||
pool: true,
|
|
||||||
host: sails.config.custom.smtpHost,
|
|
||||||
port: sails.config.custom.smtpPort,
|
|
||||||
secure: sails.config.custom.smtpSecure,
|
|
||||||
auth: sails.config.custom.smtpUser && {
|
|
||||||
user: sails.config.custom.smtpUser,
|
|
||||||
pass: sails.config.custom.smtpPassword,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
sails.log.info('SMTP hook has been loaded successfully');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sails.log.info('Initializing custom hook (`smtp`)');
|
||||||
|
|
||||||
|
transporter = nodemailer.createTransport({
|
||||||
|
pool: true,
|
||||||
|
host: sails.config.custom.smtpHost,
|
||||||
|
port: sails.config.custom.smtpPort,
|
||||||
|
secure: sails.config.custom.smtpSecure,
|
||||||
|
auth: sails.config.custom.smtpUser && {
|
||||||
|
user: sails.config.custom.smtpUser,
|
||||||
|
pass: sails.config.custom.smtpPassword,
|
||||||
|
},
|
||||||
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
getTransporter() {
|
getTransporter() {
|
||||||
|
|||||||
@@ -0,0 +1,38 @@
|
|||||||
|
/**
|
||||||
|
* watcher hook
|
||||||
|
*
|
||||||
|
* @description :: A hook definition. Extends Sails by adding shadow routes, implicit actions,
|
||||||
|
* and/or initialization logic.
|
||||||
|
* @docs :: https://sailsjs.com/docs/concepts/extending-sails/hooks
|
||||||
|
*/
|
||||||
|
|
||||||
|
module.exports = function defineWatcherHook(sails) {
|
||||||
|
const checkSocketConnectionsToLogout = () => {
|
||||||
|
Object.keys(sails.io.sockets.adapter.rooms).forEach((room) => {
|
||||||
|
if (!room.startsWith('@accessToken:')) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const accessToken = room.split(':')[1];
|
||||||
|
|
||||||
|
try {
|
||||||
|
sails.helpers.utils.verifyToken(accessToken);
|
||||||
|
} catch (error) {
|
||||||
|
sails.sockets.broadcast(room, 'logout');
|
||||||
|
sails.sockets.leaveAll(room);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
return {
|
||||||
|
/**
|
||||||
|
* Runs when this Sails app loads/lifts.
|
||||||
|
*/
|
||||||
|
|
||||||
|
async initialize() {
|
||||||
|
sails.log.info('Initializing custom hook (`watcher`)');
|
||||||
|
|
||||||
|
setInterval(checkSocketConnectionsToLogout, 60 * 1000);
|
||||||
|
},
|
||||||
|
};
|
||||||
|
};
|
||||||
+10
-7
@@ -34,13 +34,6 @@ module.exports.custom = {
|
|||||||
defaultAdminEmail:
|
defaultAdminEmail:
|
||||||
process.env.DEFAULT_ADMIN_EMAIL && process.env.DEFAULT_ADMIN_EMAIL.toLowerCase(),
|
process.env.DEFAULT_ADMIN_EMAIL && process.env.DEFAULT_ADMIN_EMAIL.toLowerCase(),
|
||||||
|
|
||||||
smtpHost: process.env.SMTP_HOST,
|
|
||||||
smtpPort: process.env.SMTP_PORT || 587,
|
|
||||||
smtpSecure: process.env.SMTP_SECURE === 'true',
|
|
||||||
smtpUser: process.env.SMTP_USER,
|
|
||||||
smtpPassword: process.env.SMTP_PASSWORD,
|
|
||||||
smtpFrom: process.env.SMTP_FROM,
|
|
||||||
|
|
||||||
oidcIssuer: process.env.OIDC_ISSUER,
|
oidcIssuer: process.env.OIDC_ISSUER,
|
||||||
oidcClientId: process.env.OIDC_CLIENT_ID,
|
oidcClientId: process.env.OIDC_CLIENT_ID,
|
||||||
oidcClientSecret: process.env.OIDC_CLIENT_SECRET,
|
oidcClientSecret: process.env.OIDC_CLIENT_SECRET,
|
||||||
@@ -58,4 +51,14 @@ module.exports.custom = {
|
|||||||
oidcRedirectUri: `${
|
oidcRedirectUri: `${
|
||||||
sails.config.environment === 'production' ? process.env.BASE_URL : 'http://localhost:3000'
|
sails.config.environment === 'production' ? process.env.BASE_URL : 'http://localhost:3000'
|
||||||
}/oidc-callback`,
|
}/oidc-callback`,
|
||||||
|
|
||||||
|
smtpHost: process.env.SMTP_HOST,
|
||||||
|
smtpPort: process.env.SMTP_PORT || 587,
|
||||||
|
smtpSecure: process.env.SMTP_SECURE === 'true',
|
||||||
|
smtpUser: process.env.SMTP_USER,
|
||||||
|
smtpPassword: process.env.SMTP_PASSWORD,
|
||||||
|
smtpFrom: process.env.SMTP_FROM,
|
||||||
|
|
||||||
|
slackBotToken: process.env.SLACK_BOT_TOKEN,
|
||||||
|
slackChannelId: process.env.SLACK_CHANNEL_ID,
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -55,6 +55,7 @@ module.exports.routes = {
|
|||||||
'POST /api/lists/:listId/cards': 'cards/create',
|
'POST /api/lists/:listId/cards': 'cards/create',
|
||||||
'GET /api/cards/:id': 'cards/show',
|
'GET /api/cards/:id': 'cards/show',
|
||||||
'PATCH /api/cards/:id': 'cards/update',
|
'PATCH /api/cards/:id': 'cards/update',
|
||||||
|
'POST /api/cards/:id/duplicate': 'cards/duplicate',
|
||||||
'DELETE /api/cards/:id': 'cards/delete',
|
'DELETE /api/cards/:id': 'cards/delete',
|
||||||
'POST /api/cards/:cardId/memberships': 'card-memberships/create',
|
'POST /api/cards/:cardId/memberships': 'card-memberships/create',
|
||||||
'DELETE /api/cards/:cardId/memberships': 'card-memberships/delete',
|
'DELETE /api/cards/:cardId/memberships': 'card-memberships/delete',
|
||||||
|
|||||||
Reference in New Issue
Block a user