diff --git a/frontend/components/FormProjectCreation.vue b/frontend/components/FormProjectCreation.vue new file mode 100644 index 00000000..268e9f11 --- /dev/null +++ b/frontend/components/FormProjectCreation.vue @@ -0,0 +1,100 @@ + + + diff --git a/frontend/pages/projects/index.vue b/frontend/pages/projects/index.vue index 770cc3e1..e1d0217a 100644 --- a/frontend/pages/projects/index.vue +++ b/frontend/pages/projects/index.vue @@ -13,46 +13,16 @@ Add Project - - - - - - - + + import Modal from '~/components/Modal' +import FormProjectCreation from '~/components/FormProjectCreation' import ProjectService from '~/services/project.service' export default { layout: 'projects', components: { - Modal + Modal, + FormProjectCreation }, data: () => ({ dialog: false, - valid: true, search: '', selected: [], selectedUser: null, - projectTypes: [ - 'Text Classification', - 'Sequence Labeling', - 'Sequence to sequence' - ], // Todo: Get project types from backend server. projects: [], - newProject: { - name: '', - description: '', - project_type: null - }, - addModal: { - title: 'Add Project', - button: 'Add Project' - }, removeModal: { title: 'Remove Project', button: 'Yes, remove' @@ -151,9 +108,6 @@ export default { text: 'Type', value: 'project_type' } - ], - nameRules: [ - v => !!v || 'Name is required' ] }), @@ -162,14 +116,9 @@ export default { }, methods: { - async createProject() { - const response = await ProjectService.createProject(this.newProject) - this.projects.unshift(response) - this.newProject = { - name: '', - description: '', - project_type: null - } + createProject(project) { + this.projects.unshift(project) + this.dialog = false }, async deleteProject() { // Todo: bulk delete. @@ -179,9 +128,6 @@ export default { } this.selected = [] }, - openAddModal() { - this.$refs.childDialogue.open() - }, openRemoveModal() { this.$refs.removeDialogue.open() } diff --git a/frontend/services/api.service.js b/frontend/services/api.service.js index 160eacf4..86bf27bc 100644 --- a/frontend/services/api.service.js +++ b/frontend/services/api.service.js @@ -1,5 +1,5 @@ import axios from 'axios' -const baseURL = 'http://localhost:3000/v1' // Todo: change URL by development/staging/production. +const baseURL = 'http://127.0.0.1:3000/v1' // Todo: change URL by development/staging/production. export default class ApiService { constructor() {