From 0a94421bcc5b7a7436c5466efe77157dc6d16fec Mon Sep 17 00:00:00 2001 From: Hironsan Date: Fri, 11 Oct 2019 14:26:21 +0900 Subject: [PATCH] Add URL validation --- .../pages/projects/_id/annotation/index.vue | 85 +++---- .../projects/_id/classification/index.vue | 210 ++++-------------- frontend/pages/projects/_id/dataset/index.vue | 2 + .../pages/projects/_id/download/index.vue | 1 + .../pages/projects/_id/guideline/index.vue | 1 + frontend/pages/projects/_id/labels/index.vue | 2 + frontend/pages/projects/_id/members/index.vue | 2 + frontend/pages/projects/_id/seq2seq/index.vue | 82 ++++--- 8 files changed, 140 insertions(+), 245 deletions(-) diff --git a/frontend/pages/projects/_id/annotation/index.vue b/frontend/pages/projects/_id/annotation/index.vue index 90cbc783..f9954d05 100644 --- a/frontend/pages/projects/_id/annotation/index.vue +++ b/frontend/pages/projects/_id/annotation/index.vue @@ -27,49 +27,54 @@ import SideBarLabeling from '~/components/organisms/SideBarLabeling' export default { layout: 'annotation', + components: { EntityItemBox, SideBarLabeling }, - data: () => ({ - progress: 30, - metadata: '{"wikiPageId":2}', - search: '', - labels: [ - { - id: 1, - name: 'Location', - color: '#E91E63', - shortcut: 'l' - }, - { - id: 2, - name: 'Organization', - color: '#03A9F4', - shortcut: 'o' - }, - { - id: 3, - name: 'Person', - color: '#009688', - shortcut: 'p' - }, - { - id: 4, - name: 'Date', - color: '#FF6F00', - shortcut: 'd' - }, - { - id: 5, - name: 'Other', - color: '#333333', - shortcut: 't' - } - ] - }) + + data() { + return { + progress: 30, + metadata: '{"wikiPageId":2}', + search: '', + labels: [ + { + id: 1, + name: 'Location', + color: '#E91E63', + shortcut: 'l' + }, + { + id: 2, + name: 'Organization', + color: '#03A9F4', + shortcut: 'o' + }, + { + id: 3, + name: 'Person', + color: '#009688', + shortcut: 'p' + }, + { + id: 4, + name: 'Date', + color: '#FF6F00', + shortcut: 'd' + }, + { + id: 5, + name: 'Other', + color: '#333333', + shortcut: 't' + } + ] + } + }, + + validate({ params }) { + return /^\d+$/.test(params.id) + } } - - diff --git a/frontend/pages/projects/_id/classification/index.vue b/frontend/pages/projects/_id/classification/index.vue index fa3b4383..42a93bb9 100644 --- a/frontend/pages/projects/_id/classification/index.vue +++ b/frontend/pages/projects/_id/classification/index.vue @@ -23,179 +23,53 @@ import SideBarLabeling from '~/components/organisms/SideBarLabeling' export default { layout: 'annotation', + components: { TextClassification, SideBarLabeling }, - data: () => ({ - progress: 30, - metadata: '{"wikiPageId":2}', - search: '', - content: 'Sony', - text: - 'Barack Hussein Obama II (born August 4, 1961) is an American attorney and politician who served as the 44th president of the United States from 2009 to 2017. A member of the Democratic Party, he was the first African American to be elected to the presidency. He previously served as a U.S. senator from Illinois from 2005 to 2008 and an Illinois state senator from 1997 to 2004.', - labelName: 'ORG', - labels: [ - { - id: 1, - name: 'Location', - color: '#E91E63', - shortcut: 'l' - }, - { - id: 2, - name: 'Organization', - color: '#03A9F4', - shortcut: 'o' - }, - { - id: 3, - name: 'Person', - color: '#009688', - shortcut: 'p' - }, - { - id: 4, - name: 'Date', - color: '#FF6F00', - shortcut: 'd' - }, - { - id: 5, - name: 'Other', - color: '#333333', - shortcut: 't' - } - ], - annotations: [ - { - id: 2, - prob: 0.0, - label: 3, - start_offset: 0, - end_offset: 23, - user: 1, - document: 1 - }, - { - id: 3, - prob: 0.0, - label: 4, - start_offset: 30, - end_offset: 44, - user: 1, - document: 1 - }, - { - id: 2, - prob: 0.0, - label: 1, - start_offset: 125, - end_offset: 138, - user: 1, - document: 1 - }, - { - id: 2, - prob: 0.0, - label: 4, - start_offset: 144, - end_offset: 148, - user: 1, - document: 1 - }, - { - id: 2, - prob: 0.0, - label: 4, - start_offset: 152, - end_offset: 156, - user: 1, - document: 1 - }, - { - id: 2, - prob: 0.0, - label: 2, - start_offset: 174, - end_offset: 190, - user: 1, - document: 1 - }, - { - id: 2, - prob: 0.0, - label: 1, - start_offset: 285, - end_offset: 289, - user: 1, - document: 1 - }, - { - id: 2, - prob: 0.0, - label: 1, - start_offset: 303, - end_offset: 311, - user: 1, - document: 1 - }, - { - id: 2, - prob: 0.0, - label: 4, - start_offset: 317, - end_offset: 321, - user: 1, - document: 1 - }, - { - id: 2, - prob: 0.0, - label: 4, - start_offset: 325, - end_offset: 329, - user: 1, - document: 1 - }, - { - id: 2, - prob: 0.0, - label: 1, - start_offset: 337, - end_offset: 345, - user: 1, - document: 1 - }, - { - id: 2, - prob: 0.0, - label: 4, - start_offset: 365, - end_offset: 369, - user: 1, - document: 1 - }, - { - id: 2, - prob: 0.0, - label: 4, - start_offset: 373, - end_offset: 377, - user: 1, - document: 1 - } - ] - }), - methods: { - save() {}, - cancel() {}, - open() {}, - close() {} + data() { + return { + progress: 30, + metadata: '{"wikiPageId":2}', + labels: [ + { + id: 1, + name: 'Location', + color: '#E91E63', + shortcut: 'l' + }, + { + id: 2, + name: 'Organization', + color: '#03A9F4', + shortcut: 'o' + }, + { + id: 3, + name: 'Person', + color: '#009688', + shortcut: 'p' + }, + { + id: 4, + name: 'Date', + color: '#FF6F00', + shortcut: 'd' + }, + { + id: 5, + name: 'Other', + color: '#333333', + shortcut: 't' + } + ] + } + }, + + validate({ params }) { + return /^\d+$/.test(params.id) } } - - diff --git a/frontend/pages/projects/_id/dataset/index.vue b/frontend/pages/projects/_id/dataset/index.vue index f0bba761..a38611c9 100644 --- a/frontend/pages/projects/_id/dataset/index.vue +++ b/frontend/pages/projects/_id/dataset/index.vue @@ -15,11 +15,13 @@ import DocumentDeletionButton from '@/components/containers/DocumentDeletionButt export default { layout: 'project', + components: { DocumentList, DocumentUploadButton, DocumentDeletionButton }, + validate({ params }) { return /^\d+$/.test(params.id) } diff --git a/frontend/pages/projects/_id/download/index.vue b/frontend/pages/projects/_id/download/index.vue index 5bed2f13..067ad5d8 100644 --- a/frontend/pages/projects/_id/download/index.vue +++ b/frontend/pages/projects/_id/download/index.vue @@ -12,6 +12,7 @@