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/calendarnavigation/calendarnavigation.html b/src/components/calendarnavigation/calendarnavigation.html new file mode 100644 index 00000000..95153c15 --- /dev/null +++ b/src/components/calendarnavigation/calendarnavigation.html @@ -0,0 +1,29 @@ +
+ + + + + + fad fa-calendar-alt + + + {{calendar.name}} + + + + + + + + + + + + + + add + + + + +
\ No newline at end of file diff --git a/src/components/calendarnavigation/calendarnavigation.js b/src/components/calendarnavigation/calendarnavigation.js new file mode 100644 index 00000000..8b9305a7 --- /dev/null +++ b/src/components/calendarnavigation/calendarnavigation.js @@ -0,0 +1,32 @@ +import { mapActions, mapGetters } from 'vuex' + +export default { + name: 'calendarnavigation', + components: {}, + props: [], + data () { + return { + selectedBox: 0, + newCalendar: '' + } + }, + computed: { + ...mapGetters([ + 'calendars' + ]) + }, + mounted () { + }, + methods: { + ...mapActions([ + 'addCalendar' + ]), + addCal () { + this.addCalendar(this.newCalendar) + this.newCalendar = '' + }, + setSelectedCalendar (calendarId) { + this.$emit('setSelectedCalendar', calendarId) + } + } +} diff --git a/src/components/calendarnavigation/calendarnavigation.scss b/src/components/calendarnavigation/calendarnavigation.scss new file mode 100644 index 00000000..2d41c541 --- /dev/null +++ b/src/components/calendarnavigation/calendarnavigation.scss @@ -0,0 +1,3 @@ +.emailnavigation { + +} diff --git a/src/components/calendarnavigation/calendarnavigation.spec.js b/src/components/calendarnavigation/calendarnavigation.spec.js new file mode 100644 index 00000000..a8f716b7 --- /dev/null +++ b/src/components/calendarnavigation/calendarnavigation.spec.js @@ -0,0 +1,29 @@ +import Vue from 'vue'; +import EmailnavigationComponent from './index.vue'; + +// Here are some Jasmine 2.0 tests, though you can +// use any test runner / assertion library combo you prefer +describe('EmailnavigationComponent', () => { + // Inspect the raw component options + it('has a created hook', () => { + // expect(typeof EmailnavigationComponent.created).toBe('function'); + }) + // Evaluate the results of functions in + // the raw component options + it('sets the correct default data', () => { + // expect(typeof EmailnavigationComponent.data).toBe('function') + // const defaultData = EmailnavigationComponent.data(); + // expect(defaultData.message).toBe('hello!'); + }) + // Inspect the component instance on mount + it('correctly sets the message when created', () => { + // const vm = new Vue(EmailnavigationComponent).$mount(); + // expect(vm.message).toBe('bye!'); + }) + // Mount an instance and inspect the render output + it('renders the correct message', () => { + // const Ctor = Vue.extend(EmailnavigationComponent); + // const vm = new Ctor().$mount(); + // expect(vm.$el.textContent).toBe('bye!'); + }) +}) \ No newline at end of file diff --git a/src/components/calendarnavigation/index.vue b/src/components/calendarnavigation/index.vue new file mode 100644 index 00000000..e68fde3a --- /dev/null +++ b/src/components/calendarnavigation/index.vue @@ -0,0 +1,3 @@ + + + diff --git a/src/components/fullevent/fullevent.html b/src/components/fullevent/fullevent.html new file mode 100644 index 00000000..9238c689 --- /dev/null +++ b/src/components/fullevent/fullevent.html @@ -0,0 +1,130 @@ +
+ + +
+ + + fas fa-save + + + fas fa-pencil-alt + + + + + + + fas fa-trash + + Delete event + + + + + fas fa-times + + +
+ + + + + + + + + +

+ Select calendar +

+ + + + + +
+ +

+ Event details +

+ + + + + +
+ Cancel + OK +
+
+
+ + + + +
+ Cancel + OK +
+
+
+
+ + + + + +
+ Cancel + OK +
+
+
+ + + + +
+ Cancel + OK +
+
+
+
+
+
+
+
\ No newline at end of file diff --git a/src/components/fullevent/fullevent.js b/src/components/fullevent/fullevent.js new file mode 100644 index 00000000..919d4073 --- /dev/null +++ b/src/components/fullevent/fullevent.js @@ -0,0 +1,39 @@ +import { mapActions } from 'vuex' +import config from '../../../public/config' +import cloneDeep from 'lodash.clonedeep' + +export default { + name: 'fullevent', + components: {}, + props: [ 'calendars', 'selectedCalendarId' ], + data () { + return { + edit: true, + currentEvent: { + selectedCalendarId: this.selectedCalendarId + } + } + }, + computed: { + }, + mounted () { + }, + methods: { + ...mapActions([ + 'addEvent' + ]), + saveEvent () { + this.addEvent(this.currentEvent) + this.clearAndClose() + }, + clearAndClose () { + this.currentEvent = {} + this.$emit('cancel') + }, + cancel () { + this.$emit('cancel') + } + }, + watch: { + } +} diff --git a/src/components/fullevent/fullevent.scss b/src/components/fullevent/fullevent.scss new file mode 100644 index 00000000..d0408c0a --- /dev/null +++ b/src/components/fullevent/fullevent.scss @@ -0,0 +1,4 @@ +.fullcontact { + height: 100%; + width: 100%; +} \ No newline at end of file diff --git a/src/components/fullevent/fullevent.spec.js b/src/components/fullevent/fullevent.spec.js new file mode 100644 index 00000000..6712d5bd --- /dev/null +++ b/src/components/fullevent/fullevent.spec.js @@ -0,0 +1,29 @@ +import Vue from 'vue'; +import FullcontactComponent from './index.vue'; + +// Here are some Jasmine 2.0 tests, though you can +// use any test runner / assertion library combo you prefer +describe('FullcontactComponent', () => { + // Inspect the raw component options + it('has a created hook', () => { + // expect(typeof FullcontactComponent.created).toBe('function'); + }) + // Evaluate the results of functions in + // the raw component options + it('sets the correct default data', () => { + // expect(typeof FullcontactComponent.data).toBe('function') + // const defaultData = FullcontactComponent.data(); + // expect(defaultData.message).toBe('hello!'); + }) + // Inspect the component instance on mount + it('correctly sets the message when created', () => { + // const vm = new Vue(FullcontactComponent).$mount(); + // expect(vm.message).toBe('bye!'); + }) + // Mount an instance and inspect the render output + it('renders the correct message', () => { + // const Ctor = Vue.extend(FullcontactComponent); + // const vm = new Ctor().$mount(); + // expect(vm.$el.textContent).toBe('bye!'); + }) +}) \ No newline at end of file diff --git a/src/components/fullevent/index.vue b/src/components/fullevent/index.vue new file mode 100644 index 00000000..54d23f54 --- /dev/null +++ b/src/components/fullevent/index.vue @@ -0,0 +1,3 @@ + + + diff --git a/src/services/calendarService.js b/src/services/calendarService.js new file mode 100644 index 00000000..eba7bf36 --- /dev/null +++ b/src/services/calendarService.js @@ -0,0 +1,51 @@ +import Axios from 'axios' +import config from '../../public/config' +import moment from 'moment' +const headers = { headers: { 'Content-Type': 'application/json' } } +export default ({ + getCalendarIds () { + return Axios.post(`${config.jsApiUrl}calendar/list_calendars`) + }, + getFullCalendar (id) { + return Axios.post(`${config.jsApiUrl}calendar/get_calendar`, { + args: { + cal_id: id + } + }) + }, + addCalendar (calendarName) { + return Axios.post(`${config.jsApiUrl}calendar/add_calendar`, { + args: { + name: calendarName, + cal_id: calendarName + } + }) + }, + getEvent (calendarId, eventId) { + return Axios.post(`${config.jsApiUrl}calendar/get_event`, { + args: { + cal_id: calendarId, + uid: eventId + } + }) + }, + addEvent (event) { + console.log(event.startDate) + console.log(event.startTime) + console.log(moment(event.startDate + ' ' + event.startTime)) + console.log("------------") + console.log(event.toDate) + console.log(event.endTime) + console.log(moment(event.toDate + ' ' + event.endTime)) + + return Axios.post(`${config.jsApiUrl}calendar/add_event`, { + args: { + cal_id: event.selectedCalendarId, + uid: event.eventName, + summary: event.eventName, + dtstart: moment(event.startDate + ' ' + event.startTime).unix(), + dtend: moment(event.toDate + ' ' + event.endTime).unix() + } + }) + } +}) diff --git a/src/store/calendarStore.js b/src/store/calendarStore.js new file mode 100644 index 00000000..54992b5e --- /dev/null +++ b/src/store/calendarStore.js @@ -0,0 +1,67 @@ +import calendarService from '../services/calendarService' +import moment from 'moment' +export default ({ + state: { + calendars: [], + events: [] + }, + actions: { + getCalendars: (context) => { + calendarService.getCalendarIds().then((response) => { + context.dispatch('getFullCalendars', response.data.calendars) + }) + }, + getFullCalendars (context, calendarIds) { + let calendars = [] + + calendarIds.forEach(calendarId => { + calendarService.getFullCalendar(calendarId).then((response) => { + calendars.push(response.data.calendar) + }) + }) + context.commit('setCalendars', calendars) + }, + addCalendar (context, calendarName) { + calendarService.addCalendar(calendarName).then((response) => { + context.dispatch('getCalendars') + }) + }, + getFullEvents (context, obj) { + let calendarId = obj.calendarId + let eventIds = obj.eventIds + let events = [] + + eventIds.forEach(eventId => { + calendarService.getEvent(calendarId, eventId).then((response) => { + events.push(response.data.event) + }) + }) + context.commit('setEvents', events) + }, + addEvent (context, event) { + calendarService.addEvent(event).then((response) => { + context.dispatch('getCalendars') + }) + } + }, + mutations: { + setCalendars: (state, calendars) => { + state.calendars = calendars + }, + setEvents: (state, events) => { + state.events = events + } + }, + getters: { + calendars: (state) => state.calendars, + events: (state) => state.events.map(ev=> { + return { + start: moment.unix(ev.dtstart).format("YYYY-MM-DD HH:mm"), + end: moment.unix(ev.dtend).format("YYYY-MM-DD HH:mm"), + name: ev.summary, + cal_id: ev.calendar_id, + uid: ev.uid + } + }) + } +}) diff --git a/src/store/index.js b/src/store/index.js index 52cca28a..b1ee1142 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -5,6 +5,7 @@ import contactStore from './contactStore' import ffcStore from './ffcStore' import authStore from './authStore' import mailStore from './mailStore' +import calendarStore from './calendarStore' Vue.use(Vuex) @@ -14,6 +15,7 @@ export default new Vuex.Store({ contactStore, ffcStore, authStore, - mailStore + mailStore, + calendarStore } }) diff --git a/src/views/calendar/calendar.html b/src/views/calendar/calendar.html index 31a0dfea..96f6a31a 100644 --- a/src/views/calendar/calendar.html +++ b/src/views/calendar/calendar.html @@ -1,27 +1,42 @@
- + + + + + + -