diff --git a/package.json b/package.json index b1e00d0b..60ac3e8a 100644 --- a/package.json +++ b/package.json @@ -19,6 +19,7 @@ "tweetnacl-util": "^0.15.0", "vue": "^2.6.10", "vue-context": "^4.0.3", + "vue-drag-drop": "^1.1.4", "vue-router": "^3.0.3", "vue-simple-context-menu": "^3.1.5", "vue-socket.io": "^3.0.7", diff --git a/public/config/config.local b/public/config/config.local index 028a5264..d36e1e4d 100644 --- a/public/config/config.local +++ b/public/config/config.local @@ -1,6 +1,6 @@ export default ({ tfApiUrl: 'https://radar.threefold.io/api/', - jsApiUrl: `http://172.17.0.2/api/actors/`, + jsApiUrl: `https://172.17.0.2/web/gedis/http/`, apiUrl: 'https://ffc-signaling.staging.jimber.org', janus: 'http://ffc-video.jimber.staging.org/janus', diff --git a/src/components/emaillistitem/emaillistitem.html b/src/components/emaillistitem/emaillistitem.html index f3ab73b0..56c78670 100644 --- a/src/components/emaillistitem/emaillistitem.html +++ b/src/components/emaillistitem/emaillistitem.html @@ -2,9 +2,9 @@ + - Move to {{box.name}} + Move to {{box.name}} diff --git a/src/components/emaillistitem/emaillistitem.js b/src/components/emaillistitem/emaillistitem.js index dda0093c..d366a75e 100644 --- a/src/components/emaillistitem/emaillistitem.js +++ b/src/components/emaillistitem/emaillistitem.js @@ -8,7 +8,6 @@ export default { props: ['email'], data () { return { - } }, computed: { @@ -22,7 +21,7 @@ export default { return div.textContent || div.innerText || '' }, emailDate () { - return moment(moment.unix(this.email.date)).from(moment()) + return moment(moment.unix(this.email.mtime)).from(moment()) } }, mounted () { @@ -30,10 +29,21 @@ export default { }, methods: { ...mapActions([ - 'updateFolder' + 'updateFolder', + 'updatePriority' ]), - moveMail (id, folder) { - this.updateFolder(id, folder) + moveMail (folder) { + this.updateFolder({ + mailId: this.email.id, + folder: folder + }) + }, + changePriority () { + this.updatePriority({ + mailId: this.email.id, + priority: !this.email.priority + }) + this.email.priority = !this.email.priority } } } diff --git a/src/components/emailnavigation/emailnavigation.html b/src/components/emailnavigation/emailnavigation.html index b8cc4828..505d9ad5 100644 --- a/src/components/emailnavigation/emailnavigation.html +++ b/src/components/emailnavigation/emailnavigation.html @@ -10,14 +10,16 @@ - - - fas fa-inbox - - - {{box.name}} - - + + + + {{box.icon}} + + + {{box.name}} + + + diff --git a/src/components/emailnavigation/emailnavigation.js b/src/components/emailnavigation/emailnavigation.js index 9c4e203e..1e38eb91 100644 --- a/src/components/emailnavigation/emailnavigation.js +++ b/src/components/emailnavigation/emailnavigation.js @@ -1,8 +1,9 @@ import { mapActions, mapGetters } from 'vuex' +import { Drag, Drop } from 'vue-drag-drop' export default { name: 'emailnavigation', - components: {}, + components: { Drag, Drop }, props: [], data () { return { @@ -18,8 +19,17 @@ export default { }, methods: { + ...mapActions([ + 'updateFolder' + ]), setSelectedBox (box) { this.$emit('selectMailBox', box) + }, + moveMail (mailArgument, event, folder) { + this.updateFolder({ + mailId: mailArgument.emailId, + folder: folder.name + }) } } } diff --git a/src/services/mailService.js b/src/services/mailService.js index 461f7842..8edbd597 100644 --- a/src/services/mailService.js +++ b/src/services/mailService.js @@ -9,10 +9,7 @@ export default ({ return Axios.post(`${config.jsApiUrl}mail/list`) }, sendMail (mail) { - mail.date = moment(moment.utc()).format('MM/DD/YYYY HH:mm') mail.attachments = [] - mail.headers = '' - mail = JSON.stringify(mail) return Axios.post(`${config.jsApiUrl}mail/send`, { args: { mail @@ -27,11 +24,19 @@ export default ({ }, headers) }, updateFolder (id, folder) { - return Axios.post(`${config.jsApiUrl}mail/update_folder`, { + return Axios.post(`${config.jsApiUrl}mail/move_message`, { args: { mail_id: id, folder_name: folder } }) + }, + updatePriority (id, priority) { + return Axios.post(`${config.jsApiUrl}mail/update_priority`, { + args: { + mail_id: id, + priority: priority + } + }) } }) diff --git a/src/store/mailStore.js b/src/store/mailStore.js index 75e720ba..016411cb 100644 --- a/src/store/mailStore.js +++ b/src/store/mailStore.js @@ -4,11 +4,11 @@ export default ({ state: { mails: [], boxes: [ - { name: 'Inbox' }, - { name: 'Outbox' }, - { name: 'Sent' }, - { name: 'Spam' }, - { name: 'Trash' } + { name: 'Inbox', icon: 'fas fa-envelope-open-text' }, + { name: 'Outbox', icon: 'far fa-paper-plane' }, + { name: 'Sent', icon: 'fas fa-paper-plane' }, + { name: 'Spam', icon: 'far fa-times-circle' }, + { name: 'Trash', icon: 'fas fa-trash' } ] }, actions: { @@ -36,12 +36,18 @@ export default ({ console.error(error) }) }, - updateFolder: (context, mailId, folder) => { - mailService.updateFolder(mailId, folder).then((response) => { + updateFolder: (context, data) => { + mailService.updateFolder(data.mailId, data.folder).then((response) => { context.dispatch('getMails') }).catch((error) => { console.error(error) }) + }, + updatePriority: (context, data) => { + mailService.updatePriority(data.mailId, data.priority).then((response) => { + }).catch((error) => { + console.error(error) + }) } }, mutations: { diff --git a/src/views/mails/mails.html b/src/views/mails/mails.html index 9c3e03de..b6be9735 100644 --- a/src/views/mails/mails.html +++ b/src/views/mails/mails.html @@ -47,7 +47,13 @@ diff --git a/src/views/mails/mails.js b/src/views/mails/mails.js index dcc1af1b..1c4d3a59 100644 --- a/src/views/mails/mails.js +++ b/src/views/mails/mails.js @@ -5,9 +5,11 @@ import { mapGetters, mapActions } from 'vuex' import { VueEditor } from 'vue2-editor' import { timingSafeEqual } from 'crypto' +import { Drag, Drop } from 'vue-drag-drop' + export default { name: 'mails', - components: { VueEditor, emailNavigation, fullEmail, emailListItem }, + components: { VueEditor, emailNavigation, fullEmail, emailListItem, Drag, Drop }, props: [], data () { return {