diff --git a/client/src/components/LoginForm.vue b/client/src/components/LoginForm.vue index cc061ec6..90e36413 100644 --- a/client/src/components/LoginForm.vue +++ b/client/src/components/LoginForm.vue @@ -1,8 +1,9 @@ - - -
Drop Gainstrack here or
click to upload
-
-
@@ -68,6 +55,7 @@ 'balance_sheet': ['Balance Sheet', 'g b'], 'prices': ['Prices', 'g c'], 'editor': ['Editor', 'g e'], + 'port': ['Import/Export', ''], 'errors': ['Errors', ''], 'events': ['Events', 'g E'], 'help': ['Help', 'g H'], @@ -80,7 +68,6 @@ 'query': ['Query', 'g q'], 'statistics': ['Statistics', 'g x'], 'trial_balance': ['Trial Balance', 'g t'], - 'irr': ['IRR', ''], 'aa': ['Asset Allocation', ''], 'pnlexplain': ['P&L Explain', ''], @@ -92,44 +79,11 @@ ['balance_sheet', 'income_statement', 'journal'], ['irr', 'aa', 'pnlexplain'], ['prices'], - ['editor'], + ['port', 'editor'], ['help', 'faq'] ] }; - private beforeUpload(file: File) { - const notify = this.$notify; - const store = this.$store; - - if (file.name.match(/\.gainstrack$/)) { - // console.log(`Trying to upload a ${file.type} of size ${file.size}`); - const reader = new FileReader(); - reader.onload = () => { - const text = reader.result; - axios.put('/api/source/', {source: text, filePath: '', entryHash: '', sha256sum: ''}) - .then(response => { - this.$store.dispatch('parseState', response.data); - if (response.data.errors.length > 0) { - notify.warning('There are errors...'); - this.$router.push({name: 'errors'}); - } else { - notify.success('Saved'); - this.$store.dispatch('reload'); - this.$store.dispatch('gainstrackText'); // Clear editor - // A bit of a hack to force a refresh of local state in current view - this.$router.go(0); - } - }) - }; - reader.onerror = () => { - notify.error(reader.result as string) - }; - reader.readAsText(file); - } else { - notify.warning('Can only upload .gainstrack files'); - } - return false; - } } diff --git a/client/src/pages/Port.vue b/client/src/pages/Port.vue new file mode 100644 index 00000000..0a9241e2 --- /dev/null +++ b/client/src/pages/Port.vue @@ -0,0 +1,73 @@ + + + + + \ No newline at end of file diff --git a/client/src/router/index.ts b/client/src/router/index.ts index aa7ec20e..232f9bc1 100644 --- a/client/src/router/index.ts +++ b/client/src/router/index.ts @@ -27,6 +27,11 @@ const routes: RouteConfig[] = [ component: () => import('../components/SourceErrors.vue'), meta: {title: 'Editor'} }, + { + path: '/port', + component: () => import('../pages/Port.vue'), + meta: {title: 'Import/Export'}, + }, {path: '/irr', component: () => import('../pages/IrrSummary.vue'), meta: {title: 'IRR'}}, {path: '/irr/:accountId', component: IrrDetail, name: 'irr_detail', props: true}, {