diff --git a/src/views/Bookmarks/bookmarksAgent.js b/src/agents/bookmarksAgent.js similarity index 100% rename from src/views/Bookmarks/bookmarksAgent.js rename to src/agents/bookmarksAgent.js diff --git a/src/views/Chronology/chronologyAgent.js b/src/agents/chronologyAgent.js similarity index 100% rename from src/views/Chronology/chronologyAgent.js rename to src/agents/chronologyAgent.js diff --git a/src/views/Comments/commentsAgent.js b/src/agents/commentsAgent.js similarity index 100% rename from src/views/Comments/commentsAgent.js rename to src/agents/commentsAgent.js diff --git a/src/agents/index.js b/src/agents/index.js new file mode 100644 index 0000000..81da3d4 --- /dev/null +++ b/src/agents/index.js @@ -0,0 +1,29 @@ +import workItems from "./workItemsAgent"; +import tasks from "./tasksAgent"; +import phases from "./phasesAgent"; +import matters from "./mattersAgent"; +import bookmarks from "./bookmarksAgent"; +import chronology from "./chronologyAgent"; +import comments from "./commentsAgent"; +import notifications from "./notificationsAgent"; +import participants from "./participantsAgent"; +import profile from "./profileAgent"; +import relatedDocuments from "./relatedDocumentsAgent"; +import search from "./searchAgent"; +import time from "./timeAgent"; + +export { + tasks, + workItems, + phases, + matters, + bookmarks, + chronology, + comments, + notifications, + participants, + profile, + relatedDocuments, + search, + time +} \ No newline at end of file diff --git a/src/views/Matters/mattersAgent.js b/src/agents/mattersAgent.js similarity index 87% rename from src/views/Matters/mattersAgent.js rename to src/agents/mattersAgent.js index a296953..22accf7 100644 --- a/src/views/Matters/mattersAgent.js +++ b/src/agents/mattersAgent.js @@ -35,6 +35,9 @@ const list = (page, pageSize) => { { path: "type.name" }, { path: "type.iconClass" }, { path: "phase.name" }, + { path: "roles.primary-owner.ods.name" }, + { path: "roles.primary-owner.participantType.iconClass" }, + { path: "documents!1.title" }, ] }; diff --git a/src/views/Notifications/notificationsAgent.js b/src/agents/notificationsAgent.js similarity index 100% rename from src/views/Notifications/notificationsAgent.js rename to src/agents/notificationsAgent.js diff --git a/src/views/Participants/participantsAgent.js b/src/agents/participantsAgent.js similarity index 100% rename from src/views/Participants/participantsAgent.js rename to src/agents/participantsAgent.js diff --git a/src/views/Tasks/phaseAgent.js b/src/agents/phasesAgent.js similarity index 100% rename from src/views/Tasks/phaseAgent.js rename to src/agents/phasesAgent.js diff --git a/src/views/Profile/profileAgent.js b/src/agents/profileAgent.js similarity index 100% rename from src/views/Profile/profileAgent.js rename to src/agents/profileAgent.js diff --git a/src/views/RelatedDocuments/relatedDocumentsAgent.js b/src/agents/relatedDocumentsAgent.js similarity index 100% rename from src/views/RelatedDocuments/relatedDocumentsAgent.js rename to src/agents/relatedDocumentsAgent.js diff --git a/src/views/Tabs/searchAgent.js b/src/agents/searchAgent.js similarity index 100% rename from src/views/Tabs/searchAgent.js rename to src/agents/searchAgent.js diff --git a/src/views/Tasks/tasksAgent.js b/src/agents/tasksAgent.js similarity index 100% rename from src/views/Tasks/tasksAgent.js rename to src/agents/tasksAgent.js diff --git a/src/views/Time/timeAgent.js b/src/agents/timeAgent.js similarity index 100% rename from src/views/Time/timeAgent.js rename to src/agents/timeAgent.js diff --git a/src/agents/workItemsAgent.js b/src/agents/workItemsAgent.js new file mode 100644 index 0000000..f153973 --- /dev/null +++ b/src/agents/workItemsAgent.js @@ -0,0 +1,18 @@ +import { SharedoFetch } from "@sharedo/mobile-core"; + +const save = (id, workItem) => { + const payload = { + ...workItem.workItem, + aspectData: {} + }; + + Reflect.ownKeys(workItem.aspectData).forEach(key => { + payload.aspectData[key] = JSON.stringify(workItem.aspectData[key]); + }); + + return SharedoFetch.post(`/api/aspects/sharedos/${id}`, payload); // Not using the public API as it is broken. +} + +export default { + save +} \ No newline at end of file diff --git a/src/constants/workItemTypes.js b/src/constants/workItemTypes.js new file mode 100644 index 0000000..a82d3cf --- /dev/null +++ b/src/constants/workItemTypes.js @@ -0,0 +1,12 @@ +const TASK = "TASK"; +const MATTER = "MATTER"; + +export { + TASK, + MATTER +} + +export default { + TASK, + MATTER +} \ No newline at end of file diff --git a/src/main.js b/src/main.js index e77532f..50a5095 100644 --- a/src/main.js +++ b/src/main.js @@ -15,58 +15,58 @@ Vue.config.productionTip = false // Keep same signature as Vue 3's createApp() var createApp = function (view, opts) { - return new Vue({ - ...opts, - render: h => h(view), - }); + return new Vue({ + ...opts, + render: h => h(view), + }); }; // This needs to be a promise, as we call Azure Functions API to get Static Web App configuration var l = CoreUi.loading(); settings.get().then(function (config) { - l.dismiss(); + l.dismiss(); - const vuetify = useVuetify({ - theme: { - options: { - customProperties: true, // Generate CSS variables - }, - themes: { - light: { - primary: '#27aa5e', - secondary: '#b0bec5', - accent: '#8c9eff', - error: '#b71c1c', - grey: '#9E9E9E', - }, - }, + const vuetify = useVuetify({ + theme: { + options: { + customProperties: true, // Generate CSS variables + }, + themes: { + light: { + primary: '#27aa5e', + secondary: '#b0bec5', + accent: '#8c9eff', + error: '#b71c1c', + grey: '#9E9E9E', }, - }); + }, + }, + }); - useTipTapVuetify(vuetify); + useTipTapVuetify(vuetify); - Vue.use(SharedoMobileCore, config); + Vue.use(SharedoMobileCore, config); - Vue.component("AppMenu", Menu); + Vue.component("AppMenu", Menu); - var notLoggedIn = function () { - const app = createApp(NotLoggedIn, { - router, - store, - vuetify, - }); - app.$mount("#app"); - } + var notLoggedIn = function () { + const app = createApp(NotLoggedIn, { + router, + store, + vuetify, + }); + app.$mount("#app"); + } - // Catch oauth reply - SharedoAuth.initialise(notLoggedIn).then(() => { - SharedoProfile.loadProfile().then(() => { - createApp(Main, { - router, - store, - vuetify - }).$mount('#app'); - }, err => { document.write("
" + err + "
"); }) + // Catch oauth reply + SharedoAuth.initialise(notLoggedIn).then(() => { + SharedoProfile.loadProfile().then(() => { + createApp(Main, { + router, + store, + vuetify + }).$mount('#app'); + }, err => { document.write("
" + err + "
"); }) - }); + }); }); diff --git a/src/router/index.js b/src/router/index.js index 150c935..6fb5400 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -1,110 +1,123 @@ import Vue from 'vue'; import VueRouter from 'vue-router'; -import TaskList from "@/views/Tasks/TaskList.vue" +import WorkItemList from "@/views/WorkItems/WorkItemList"; +import { TASK, MATTER } from "@/constants/workItemTypes"; Vue.use(VueRouter); const routes = [ - { - // Tab 1 - path: '/tasks', - alias: '/', // <= default page - name: 'tasks', - component: TaskList - }, - { - path: "/profile", - name: "profile", - component: () => import("@/views/Profile/Profile.vue") - }, - { - // Tab 1 -> Detail - path: "/tasks/:id", - name: "task-detail", - props: true, - component: () => import("@/views/Tasks/TaskDetail.vue") - }, - { - // Tab 1 -> Detail -> Time Entries - path: "/tasks/:id/time", - name: "task-time-entries", - props: ({ params }) => ({ - sharedoId: params.id - }), - component: () => import('@/views/Time/TimeEntryList.vue') - }, - { - // Tab 1 -> Detail -> Participants - path: "/tasks/:id/participants", - name: "task-participants", - props: ({ params }) => ({ - sharedoId: params.id - }), - component: () => import('@/views/Participants/ParticipantList.vue') - }, - { - // Tab 1 -> Detail -> Chronology - path: "/tasks/:id/chronology", - name: "task-chronology", - props: ({ params }) => ({ - sharedoId: params.id - }), - component: () => import('@/views/Chronology/ChronologyList.vue') - }, - { - // Tab 1 -> Detail -> Comments - path: "/tasks/:id/comments", - name: "task-comments", - props: ({ params }) => ({ - sharedoId: params.id - }), - component: () => import('@/views/Comments/CommentList.vue') - }, - { - // Tab 1 -> Bookmarks - path: "/bookmarks", - name: "bookmarks", - component: () => import('@/views/Bookmarks/BookmarkList.vue') - }, - { - // Tab 2 - path: '/new-task', - name: 'new-task', - component: () => import("@/views/Tabs/NewTask.vue") - }, - { - // Tab 3 - path: '/search', - name: 'search', - component: () => import("@/views/Tabs/Search.vue") - }, - { - path: "/work-items", - name: "matters", - component: () => import("@/views/Matters/MatterList.vue") - }, - { - path: "/work-items/:id", - name: "matter-detail", - props: true, - component: () => import("@/views/Matters/MatterDetail.vue") - }, - { - path: '/notifications', - name: 'notifications', - component: () => import('@/views/Notifications/NotificationList.vue') - }, - { - path: "/notifications/settings", - name: "notification-settings", - component: () => import("@/views/Notifications/NotificationSettings.vue") - } + { + // Tab 1 + path: '/tasks', + alias: '/', // <= default page + name: 'tasks', + props: () => ({ + type: TASK + }), + component: WorkItemList + }, + { + path: "/profile", + name: "profile", + component: () => import("@/views/Profile/Profile.vue") + }, + { + // Tab 1 -> Detail + path: "/tasks/:id", + name: "task-detail", + props: ({ params }) => ({ + id: params.id, + type: TASK + }), + component: () => import("@/views/WorkItems/WorkItemDetail.vue") + }, + { + // Tab 1 -> Detail -> Time Entries + path: "/tasks/:id/time", + name: "task-time-entries", + props: ({ params }) => ({ + sharedoId: params.id + }), + component: () => import('@/views/Time/TimeEntryList.vue') + }, + { + // Tab 1 -> Detail -> Participants + path: "/tasks/:id/participants", + name: "task-participants", + props: ({ params }) => ({ + sharedoId: params.id + }), + component: () => import('@/views/Participants/ParticipantList.vue') + }, + { + // Tab 1 -> Detail -> Chronology + path: "/tasks/:id/chronology", + name: "task-chronology", + props: ({ params }) => ({ + sharedoId: params.id + }), + component: () => import('@/views/Chronology/ChronologyList.vue') + }, + { + // Tab 1 -> Detail -> Comments + path: "/tasks/:id/comments", + name: "task-comments", + props: ({ params }) => ({ + sharedoId: params.id + }), + component: () => import('@/views/Comments/CommentList.vue') + }, + { + // Tab 1 -> Bookmarks + path: "/bookmarks", + name: "bookmarks", + component: () => import('@/views/Bookmarks/BookmarkList.vue') + }, + { + // Tab 2 + path: '/new-task', + name: 'new-task', + component: () => import("@/views/Tabs/NewTask.vue") + }, + { + // Tab 3 + path: '/search', + name: 'search', + component: () => import("@/views/Tabs/Search.vue") + }, + { + path: "/work-items", + name: "matters", + props: () => ({ + type: MATTER + }), + component: WorkItemList + }, + { + path: "/work-items/:id", + name: "matter-detail", + props: ({ params }) => ({ + id: params.id, + type: MATTER + }), + component: () => import("@/views/WorkItems/WorkItemDetail.vue") + }, + { + path: '/notifications', + name: 'notifications', + component: () => import('@/views/Notifications/NotificationList.vue') + }, + { + path: "/notifications/settings", + name: "notification-settings", + component: () => import("@/views/Notifications/NotificationSettings.vue") + } ] const router = new VueRouter({ - mode: 'history', - base: process.env.BASE_URL, - routes: routes, + mode: 'history', + base: process.env.BASE_URL, + routes: routes, }); export default router; diff --git a/src/services/index.js b/src/services/index.js new file mode 100644 index 0000000..6c90e7a --- /dev/null +++ b/src/services/index.js @@ -0,0 +1,5 @@ +import pushNotifications from "./pushNotificationsService"; + +export { + pushNotifications +} \ No newline at end of file diff --git a/src/views/Notifications/pushNotificationsService.js b/src/services/pushNotificationsService.js similarity index 97% rename from src/views/Notifications/pushNotificationsService.js rename to src/services/pushNotificationsService.js index 91ac1ee..77cb1f6 100644 --- a/src/views/Notifications/pushNotificationsService.js +++ b/src/services/pushNotificationsService.js @@ -1,5 +1,5 @@ import serviceWorker from "@/registerServiceWorker"; -import notifications from "./notificationsAgent"; +import { notifications } from "@/agents"; const toBase64 = buffer => { let binary = ''; diff --git a/src/views/Bookmarks/BookmarkList.vue b/src/views/Bookmarks/BookmarkList.vue index 6d58df9..14176f0 100644 --- a/src/views/Bookmarks/BookmarkList.vue +++ b/src/views/Bookmarks/BookmarkList.vue @@ -31,7 +31,7 @@ \ No newline at end of file diff --git a/src/views/Matters/MatterDetail.vue b/src/views/Matters/MatterDetail.vue deleted file mode 100644 index 331f359..0000000 --- a/src/views/Matters/MatterDetail.vue +++ /dev/null @@ -1,66 +0,0 @@ - - \ No newline at end of file diff --git a/src/views/Matters/MatterList.vue b/src/views/Matters/MatterList.vue deleted file mode 100644 index 28ba388..0000000 --- a/src/views/Matters/MatterList.vue +++ /dev/null @@ -1,93 +0,0 @@ - - \ No newline at end of file diff --git a/src/views/Notifications/NotificationList.vue b/src/views/Notifications/NotificationList.vue index a574384..3ca0679 100644 --- a/src/views/Notifications/NotificationList.vue +++ b/src/views/Notifications/NotificationList.vue @@ -59,7 +59,7 @@ import moment from "moment"; import { mapState, mapActions } from "vuex"; import { SharedoProfile, SharedoTypesTree } from "@sharedo/mobile-core"; -import notifications from "./notificationsAgent" +import { notifications } from "@/agents" export default { data: function () { diff --git a/src/views/Notifications/NotificationSettings.vue b/src/views/Notifications/NotificationSettings.vue index cfd65f6..9eadbb9 100644 --- a/src/views/Notifications/NotificationSettings.vue +++ b/src/views/Notifications/NotificationSettings.vue @@ -37,8 +37,8 @@ - - \ No newline at end of file diff --git a/src/views/Tasks/TaskList.vue b/src/views/Tasks/TaskList.vue deleted file mode 100644 index 71863e5..0000000 --- a/src/views/Tasks/TaskList.vue +++ /dev/null @@ -1,193 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/src/views/Time/TimeEntryForm.vue b/src/views/Time/TimeEntryForm.vue index 225277a..1d7d88e 100644 --- a/src/views/Time/TimeEntryForm.vue +++ b/src/views/Time/TimeEntryForm.vue @@ -68,7 +68,7 @@ import { SharedoProfile } from "@sharedo/mobile-core"; import moment from "moment"; import SegmentSelector from "./SegmentSelector"; -import time from "./timeAgent.js"; +import { time } from "@/agents"; export default { components: { SegmentSelector }, diff --git a/src/views/Time/TimeEntryList.vue b/src/views/Time/TimeEntryList.vue index 76a0e2d..86372d9 100644 --- a/src/views/Time/TimeEntryList.vue +++ b/src/views/Time/TimeEntryList.vue @@ -61,7 +61,7 @@ + + \ No newline at end of file diff --git a/src/views/Tasks/TaskDetail.vue b/src/views/WorkItems/WorkItemDetail.vue similarity index 81% rename from src/views/Tasks/TaskDetail.vue rename to src/views/WorkItems/WorkItemDetail.vue index ab8b4f1..a757ca2 100644 --- a/src/views/Tasks/TaskDetail.vue +++ b/src/views/WorkItems/WorkItemDetail.vue @@ -70,23 +70,26 @@ + + \ No newline at end of file