diff --git a/app/server/static/bundle/document_classification.js b/app/server/static/bundle/document_classification.js index f7b25b21..bdfcdb0f 100644 --- a/app/server/static/bundle/document_classification.js +++ b/app/server/static/bundle/document_classification.js @@ -471,7 +471,19 @@ eval("var g;\n\n// This works in non-strict mode\ng = (function() {\n\treturn th /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! vue */ \"./node_modules/vue/dist/vue.esm.js\");\n/* harmony import */ var _mixin__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./mixin */ \"./static/js/mixin.js\");\n/* harmony import */ var _http__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./http */ \"./static/js/http.js\");\n\n\n\n\nvue__WEBPACK_IMPORTED_MODULE_0__[\"default\"].use(__webpack_require__(/*! vue-shortkey */ \"./node_modules/vue-shortkey/dist/index.js\"), {\n prevent: ['input', 'textarea'],\n});\n\n\nconst vm = new vue__WEBPACK_IMPORTED_MODULE_0__[\"default\"]({\n el: '#mail-app',\n delimiters: ['[[', ']]'],\n mixins: [_mixin__WEBPACK_IMPORTED_MODULE_1__[\"default\"]],\n\n methods: {\n isIn(label) {\n for (let i = 0; i < this.annotations[this.pageNumber].length; i++) {\n const a = this.annotations[this.pageNumber][i];\n if (a.label === label.id) {\n return a;\n }\n }\n return false;\n },\n\n async addLabel(label) {\n const a = this.isIn(label);\n if (a) {\n this.removeLabel(a);\n } else {\n const docId = this.docs[this.pageNumber].id;\n const payload = {\n label: label.id,\n };\n await _http__WEBPACK_IMPORTED_MODULE_2__[\"default\"].post(`docs/${docId}/annotations/`, payload).then((response) => {\n this.annotations[this.pageNumber].push(response.data);\n });\n }\n },\n },\n});\n\n\n//# sourceURL=webpack:///./static/js/document_classification.js?"); +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! vue */ \"./node_modules/vue/dist/vue.esm.js\");\n/* harmony import */ var _mixin__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./mixin */ \"./static/js/mixin.js\");\n/* harmony import */ var _http__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./http */ \"./static/js/http.js\");\n/* harmony import */ var _filter__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./filter */ \"./static/js/filter.js\");\n\n\n\n\n\nvue__WEBPACK_IMPORTED_MODULE_0__[\"default\"].use(__webpack_require__(/*! vue-shortkey */ \"./node_modules/vue-shortkey/dist/index.js\"), {\n prevent: ['input', 'textarea'],\n});\n\nvue__WEBPACK_IMPORTED_MODULE_0__[\"default\"].filter('simpleShortcut', _filter__WEBPACK_IMPORTED_MODULE_3__[\"default\"]);\n\n\nconst vm = new vue__WEBPACK_IMPORTED_MODULE_0__[\"default\"]({\n el: '#mail-app',\n delimiters: ['[[', ']]'],\n mixins: [_mixin__WEBPACK_IMPORTED_MODULE_1__[\"default\"]],\n\n methods: {\n isIn(label) {\n for (let i = 0; i < this.annotations[this.pageNumber].length; i++) {\n const a = this.annotations[this.pageNumber][i];\n if (a.label === label.id) {\n return a;\n }\n }\n return false;\n },\n\n async addLabel(label) {\n const a = this.isIn(label);\n if (a) {\n this.removeLabel(a);\n } else {\n const docId = this.docs[this.pageNumber].id;\n const payload = {\n label: label.id,\n };\n await _http__WEBPACK_IMPORTED_MODULE_2__[\"default\"].post(`docs/${docId}/annotations/`, payload).then((response) => {\n this.annotations[this.pageNumber].push(response.data);\n });\n }\n },\n },\n});\n\n\n//# sourceURL=webpack:///./static/js/document_classification.js?"); + +/***/ }), + +/***/ "./static/js/filter.js": +/*!*****************************!*\ + !*** ./static/js/filter.js ***! + \*****************************/ +/*! exports provided: default */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"default\", function() { return simpleShortcut; });\nfunction simpleShortcut(shortcut) {\n if (shortcut === null) {\n shortcut = '';\n } else {\n shortcut = shortcut.replace('ctrl', 'C');\n shortcut = shortcut.replace('shift', 'S');\n shortcut = shortcut.split(' ').join('-');\n }\n return shortcut;\n}\n\n\n//# sourceURL=webpack:///./static/js/filter.js?"); /***/ }), @@ -495,7 +507,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var axio /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _http__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./http */ \"./static/js/http.js\");\n\n\nconst getOffsetFromUrl = function(url) {\n const offsetMatch = url.match(/[?#].*offset=(\\d+)/);\n if (offsetMatch == null) {\n return 0;\n }\n\n return parseInt(offsetMatch[1], 10);\n};\n\nconst storeOffsetInUrl = function(offset) {\n let href = window.location.href;\n\n const fragmentStart = href.indexOf('#') + 1;\n if (fragmentStart === 0) {\n href += '#offset=' + offset;\n } else {\n const prefix = href.substring(0, fragmentStart);\n const fragment = href.substring(fragmentStart);\n\n const newFragment = fragment.split('&').map(function(fragmentPart) {\n const keyValue = fragmentPart.split('=');\n return keyValue[0] === 'offset'\n ? 'offset=' + offset\n : fragmentPart;\n }).join('&');\n\n href = prefix + newFragment;\n }\n\n window.location.href = href;\n};\n\nconst annotationMixin = {\n data() {\n return {\n pageNumber: 0,\n docs: [],\n annotations: [],\n labels: [],\n guideline: '',\n total: 0,\n remaining: 0,\n searchQuery: '',\n url: '',\n offset: getOffsetFromUrl(window.location.href),\n picked: 'all',\n count: 0,\n isActive: false,\n };\n },\n\n methods: {\n async nextPage() {\n this.pageNumber += 1;\n if (this.pageNumber === this.docs.length) {\n if (this.next) {\n this.url = this.next;\n await this.search();\n this.pageNumber = 0;\n } else {\n this.pageNumber = this.docs.length - 1;\n }\n }\n },\n\n async prevPage() {\n this.pageNumber -= 1;\n if (this.pageNumber === -1) {\n if (this.prev) {\n this.url = this.prev;\n await this.search();\n this.pageNumber = this.docs.length - 1;\n } else {\n this.pageNumber = 0;\n }\n }\n },\n\n async search() {\n await _http__WEBPACK_IMPORTED_MODULE_0__[\"default\"].get(this.url).then((response) => {\n this.docs = response.data.results;\n this.next = response.data.next;\n this.prev = response.data.previous;\n this.count = response.data.count;\n this.annotations = [];\n for (let i = 0; i < this.docs.length; i++) {\n const doc = this.docs[i];\n this.annotations.push(doc.annotations);\n }\n this.offset = getOffsetFromUrl(this.url);\n });\n },\n\n getState() {\n if (this.picked === 'all') {\n return '';\n }\n if (this.picked === 'active') {\n return 'true';\n }\n return 'false';\n },\n\n async submit() {\n const state = this.getState();\n this.url = `docs/?q=${this.searchQuery}&is_checked=${state}&offset=${this.offset}`;\n await this.search();\n this.pageNumber = 0;\n },\n\n removeLabel(annotation) {\n const docId = this.docs[this.pageNumber].id;\n _http__WEBPACK_IMPORTED_MODULE_0__[\"default\"].delete(`docs/${docId}/annotations/${annotation.id}`).then((response) => {\n const index = this.annotations[this.pageNumber].indexOf(annotation);\n this.annotations[this.pageNumber].splice(index, 1);\n });\n },\n },\n\n watch: {\n picked() {\n this.submit();\n },\n\n annotations() {\n // fetch progress info.\n _http__WEBPACK_IMPORTED_MODULE_0__[\"default\"].get('progress').then((response) => {\n this.total = response.data.total;\n this.remaining = response.data.remaining;\n });\n },\n\n offset() {\n storeOffsetInUrl(this.offset);\n },\n },\n\n created() {\n _http__WEBPACK_IMPORTED_MODULE_0__[\"default\"].get('labels').then((response) => {\n this.labels = response.data;\n });\n _http__WEBPACK_IMPORTED_MODULE_0__[\"default\"].get().then((response) => {\n this.guideline = response.data.guideline;\n });\n this.submit();\n },\n\n computed: {\n achievement() {\n const done = this.total - this.remaining;\n const percentage = Math.round(done / this.total * 100);\n return this.total > 0 ? percentage : 0;\n },\n\n compiledMarkdown() {\n return marked(this.guideline, {\n sanitize: true,\n });\n },\n\n id2label() {\n let id2label = {};\n for (let i = 0; i < this.labels.length; i++) {\n const label = this.labels[i];\n id2label[label.id] = label;\n }\n return id2label;\n },\n\n progressColor() {\n if (this.achievement < 30) {\n return 'is-danger';\n }\n if (this.achievement < 70) {\n return 'is-warning';\n }\n return 'is-primary';\n },\n },\n};\n\n/* harmony default export */ __webpack_exports__[\"default\"] = (annotationMixin);\n\n\n//# sourceURL=webpack:///./static/js/mixin.js?"); +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _http__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./http */ \"./static/js/http.js\");\n\n\nconst getOffsetFromUrl = function(url) {\n const offsetMatch = url.match(/[?#].*offset=(\\d+)/);\n if (offsetMatch == null) {\n return 0;\n }\n\n return parseInt(offsetMatch[1], 10);\n};\n\nconst storeOffsetInUrl = function(offset) {\n let href = window.location.href;\n\n const fragmentStart = href.indexOf('#') + 1;\n if (fragmentStart === 0) {\n href += '#offset=' + offset;\n } else {\n const prefix = href.substring(0, fragmentStart);\n const fragment = href.substring(fragmentStart);\n\n const newFragment = fragment.split('&').map(function(fragmentPart) {\n const keyValue = fragmentPart.split('=');\n return keyValue[0] === 'offset'\n ? 'offset=' + offset\n : fragmentPart;\n }).join('&');\n\n href = prefix + newFragment;\n }\n\n window.location.href = href;\n};\n\nconst annotationMixin = {\n data() {\n return {\n pageNumber: 0,\n docs: [],\n annotations: [],\n labels: [],\n guideline: '',\n total: 0,\n remaining: 0,\n searchQuery: '',\n url: '',\n offset: getOffsetFromUrl(window.location.href),\n picked: 'all',\n count: 0,\n isActive: false,\n };\n },\n\n methods: {\n async nextPage() {\n this.pageNumber += 1;\n if (this.pageNumber === this.docs.length) {\n if (this.next) {\n this.url = this.next;\n await this.search();\n this.pageNumber = 0;\n } else {\n this.pageNumber = this.docs.length - 1;\n }\n }\n },\n\n async prevPage() {\n this.pageNumber -= 1;\n if (this.pageNumber === -1) {\n if (this.prev) {\n this.url = this.prev;\n await this.search();\n this.pageNumber = this.docs.length - 1;\n } else {\n this.pageNumber = 0;\n }\n }\n },\n\n async search() {\n await _http__WEBPACK_IMPORTED_MODULE_0__[\"default\"].get(this.url).then((response) => {\n this.docs = response.data.results;\n this.next = response.data.next;\n this.prev = response.data.previous;\n this.count = response.data.count;\n this.annotations = [];\n for (let i = 0; i < this.docs.length; i++) {\n const doc = this.docs[i];\n this.annotations.push(doc.annotations);\n }\n this.offset = getOffsetFromUrl(this.url);\n });\n },\n\n getState() {\n if (this.picked === 'all') {\n return '';\n }\n if (this.picked === 'active') {\n return 'true';\n }\n return 'false';\n },\n\n async submit() {\n const state = this.getState();\n this.url = `docs/?q=${this.searchQuery}&is_checked=${state}&offset=${this.offset}`;\n await this.search();\n this.pageNumber = 0;\n },\n\n removeLabel(annotation) {\n const docId = this.docs[this.pageNumber].id;\n _http__WEBPACK_IMPORTED_MODULE_0__[\"default\"].delete(`docs/${docId}/annotations/${annotation.id}`).then((response) => {\n const index = this.annotations[this.pageNumber].indexOf(annotation);\n this.annotations[this.pageNumber].splice(index, 1);\n });\n },\n\n replaceNull(shortcut) {\n if (shortcut === null) {\n shortcut = '';\n }\n shortcut = shortcut.split(' ');\n return shortcut;\n },\n },\n\n watch: {\n picked() {\n this.submit();\n },\n\n annotations() {\n // fetch progress info.\n _http__WEBPACK_IMPORTED_MODULE_0__[\"default\"].get('progress').then((response) => {\n this.total = response.data.total;\n this.remaining = response.data.remaining;\n });\n },\n\n offset() {\n storeOffsetInUrl(this.offset);\n },\n },\n\n created() {\n _http__WEBPACK_IMPORTED_MODULE_0__[\"default\"].get('labels').then((response) => {\n this.labels = response.data;\n });\n _http__WEBPACK_IMPORTED_MODULE_0__[\"default\"].get().then((response) => {\n this.guideline = response.data.guideline;\n });\n this.submit();\n },\n\n computed: {\n achievement() {\n const done = this.total - this.remaining;\n const percentage = Math.round(done / this.total * 100);\n return this.total > 0 ? percentage : 0;\n },\n\n compiledMarkdown() {\n return marked(this.guideline, {\n sanitize: true,\n });\n },\n\n id2label() {\n let id2label = {};\n for (let i = 0; i < this.labels.length; i++) {\n const label = this.labels[i];\n id2label[label.id] = label;\n }\n return id2label;\n },\n\n progressColor() {\n if (this.achievement < 30) {\n return 'is-danger';\n }\n if (this.achievement < 70) {\n return 'is-warning';\n }\n return 'is-primary';\n },\n },\n};\n\n/* harmony default export */ __webpack_exports__[\"default\"] = (annotationMixin);\n\n\n//# sourceURL=webpack:///./static/js/mixin.js?"); /***/ }) diff --git a/app/server/static/bundle/label.js b/app/server/static/bundle/label.js index eba1fdc2..5021539c 100644 --- a/app/server/static/bundle/label.js +++ b/app/server/static/bundle/label.js @@ -452,6 +452,18 @@ eval("var g;\n\n// This works in non-strict mode\ng = (function() {\n\treturn th /***/ }), +/***/ "./static/js/filter.js": +/*!*****************************!*\ + !*** ./static/js/filter.js ***! + \*****************************/ +/*! exports provided: default */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"default\", function() { return simpleShortcut; });\nfunction simpleShortcut(shortcut) {\n if (shortcut === null) {\n shortcut = '';\n } else {\n shortcut = shortcut.replace('ctrl', 'C');\n shortcut = shortcut.replace('shift', 'S');\n shortcut = shortcut.split(' ').join('-');\n }\n return shortcut;\n}\n\n\n//# sourceURL=webpack:///./static/js/filter.js?"); + +/***/ }), + /***/ "./static/js/http.js": /*!***************************!*\ !*** ./static/js/http.js ***! @@ -472,7 +484,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var axio /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! vue */ \"./node_modules/vue/dist/vue.esm.js\");\n/* harmony import */ var _http__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./http */ \"./static/js/http.js\");\n\n\n\n\nconst vm = new vue__WEBPACK_IMPORTED_MODULE_0__[\"default\"]({\n el: '#mail-app',\n delimiters: ['[[', ']]'],\n data: {\n labels: [],\n labelText: '',\n selectedShortkey: '',\n backgroundColor: '#209cee',\n textColor: '#ffffff',\n },\n\n methods: {\n addLabel() {\n const payload = {\n text: this.labelText,\n shortcut: this.selectedShortkey,\n background_color: this.backgroundColor,\n text_color: this.textColor,\n };\n _http__WEBPACK_IMPORTED_MODULE_1__[\"default\"].post('labels/', payload).then((response) => {\n this.reset();\n this.labels.push(response.data);\n });\n },\n\n removeLabel(label) {\n const labelId = label.id;\n _http__WEBPACK_IMPORTED_MODULE_1__[\"default\"].delete(`labels/${labelId}`).then((response) => {\n const index = this.labels.indexOf(label);\n this.labels.splice(index, 1);\n });\n },\n\n reset() {\n this.labelText = '';\n this.selectedShortkey = '';\n this.backgroundColor = '#209cee';\n this.textColor = '#ffffff';\n },\n },\n created() {\n _http__WEBPACK_IMPORTED_MODULE_1__[\"default\"].get('labels').then((response) => {\n this.labels = response.data;\n });\n },\n});\n\n\n//# sourceURL=webpack:///./static/js/label.js?"); +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! vue */ \"./node_modules/vue/dist/vue.esm.js\");\n/* harmony import */ var _http__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./http */ \"./static/js/http.js\");\n/* harmony import */ var _filter__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./filter */ \"./static/js/filter.js\");\n\n\n\n\nvue__WEBPACK_IMPORTED_MODULE_0__[\"default\"].filter('simpleShortcut', _filter__WEBPACK_IMPORTED_MODULE_2__[\"default\"]);\n\n\nconst vm = new vue__WEBPACK_IMPORTED_MODULE_0__[\"default\"]({\n el: '#mail-app',\n delimiters: ['[[', ']]'],\n data: {\n labels: [],\n labelText: '',\n selectedKey: '',\n checkedKey: [],\n shortcutKey: '',\n backgroundColor: '#209cee',\n textColor: '#ffffff',\n },\n\n computed: {\n /**\n * combineKeys: Combine selectedKey and checkedKey to get shortcutKey\n * saveKeys: Save null to database if shortcutKey is empty string\n */\n combineKeys: function () {\n this.shortcutKey = '';\n\n // If checkedKey exits, add it to shortcutKey\n if (this.checkedKey.length > 0) {\n this.checkedKey.sort();\n this.shortcutKey = this.checkedKey.join(' ');\n\n // If selectedKey exist, add it to shortcutKey\n if (this.selectedKey.length !== 0) {\n this.shortcutKey = this.shortcutKey + ' ' + this.selectedKey;\n }\n }\n\n // If only selectedKey exist, assign to shortcutKey\n if (this.shortcutKey.length === 0 && this.selectedKey.length !== 0) {\n this.shortcutKey = this.selectedKey;\n }\n return this.shortcutKey;\n },\n\n saveKeys: function () {\n this.shortcutKey = this.combineKeys;\n if (this.shortcutKey === '') {\n return null;\n }\n return this.shortcutKey;\n },\n },\n \n methods: {\n addLabel() {\n const payload = {\n text: this.labelText,\n shortcut: this.saveKeys,\n background_color: this.backgroundColor,\n text_color: this.textColor,\n };\n _http__WEBPACK_IMPORTED_MODULE_1__[\"default\"].post('labels/', payload).then((response) => {\n this.reset();\n this.labels.push(response.data);\n });\n },\n\n removeLabel(label) {\n const labelId = label.id;\n _http__WEBPACK_IMPORTED_MODULE_1__[\"default\"].delete(`labels/${labelId}`).then((response) => {\n const index = this.labels.indexOf(label);\n this.labels.splice(index, 1);\n });\n },\n\n reset() {\n this.labelText = '';\n this.selectedKey = '';\n this.checkedKey = [];\n this.shortcutKey = '';\n this.backgroundColor = '#209cee';\n this.textColor = '#ffffff';\n },\n },\n created() {\n _http__WEBPACK_IMPORTED_MODULE_1__[\"default\"].get('labels').then((response) => {\n this.labels = response.data;\n });\n },\n});\n\n\n//# sourceURL=webpack:///./static/js/label.js?"); /***/ }) diff --git a/app/server/static/bundle/seq2seq.js b/app/server/static/bundle/seq2seq.js index bd57b9ed..32e00486 100644 --- a/app/server/static/bundle/seq2seq.js +++ b/app/server/static/bundle/seq2seq.js @@ -483,7 +483,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var axio /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _http__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./http */ \"./static/js/http.js\");\n\n\nconst getOffsetFromUrl = function(url) {\n const offsetMatch = url.match(/[?#].*offset=(\\d+)/);\n if (offsetMatch == null) {\n return 0;\n }\n\n return parseInt(offsetMatch[1], 10);\n};\n\nconst storeOffsetInUrl = function(offset) {\n let href = window.location.href;\n\n const fragmentStart = href.indexOf('#') + 1;\n if (fragmentStart === 0) {\n href += '#offset=' + offset;\n } else {\n const prefix = href.substring(0, fragmentStart);\n const fragment = href.substring(fragmentStart);\n\n const newFragment = fragment.split('&').map(function(fragmentPart) {\n const keyValue = fragmentPart.split('=');\n return keyValue[0] === 'offset'\n ? 'offset=' + offset\n : fragmentPart;\n }).join('&');\n\n href = prefix + newFragment;\n }\n\n window.location.href = href;\n};\n\nconst annotationMixin = {\n data() {\n return {\n pageNumber: 0,\n docs: [],\n annotations: [],\n labels: [],\n guideline: '',\n total: 0,\n remaining: 0,\n searchQuery: '',\n url: '',\n offset: getOffsetFromUrl(window.location.href),\n picked: 'all',\n count: 0,\n isActive: false,\n };\n },\n\n methods: {\n async nextPage() {\n this.pageNumber += 1;\n if (this.pageNumber === this.docs.length) {\n if (this.next) {\n this.url = this.next;\n await this.search();\n this.pageNumber = 0;\n } else {\n this.pageNumber = this.docs.length - 1;\n }\n }\n },\n\n async prevPage() {\n this.pageNumber -= 1;\n if (this.pageNumber === -1) {\n if (this.prev) {\n this.url = this.prev;\n await this.search();\n this.pageNumber = this.docs.length - 1;\n } else {\n this.pageNumber = 0;\n }\n }\n },\n\n async search() {\n await _http__WEBPACK_IMPORTED_MODULE_0__[\"default\"].get(this.url).then((response) => {\n this.docs = response.data.results;\n this.next = response.data.next;\n this.prev = response.data.previous;\n this.count = response.data.count;\n this.annotations = [];\n for (let i = 0; i < this.docs.length; i++) {\n const doc = this.docs[i];\n this.annotations.push(doc.annotations);\n }\n this.offset = getOffsetFromUrl(this.url);\n });\n },\n\n getState() {\n if (this.picked === 'all') {\n return '';\n }\n if (this.picked === 'active') {\n return 'true';\n }\n return 'false';\n },\n\n async submit() {\n const state = this.getState();\n this.url = `docs/?q=${this.searchQuery}&is_checked=${state}&offset=${this.offset}`;\n await this.search();\n this.pageNumber = 0;\n },\n\n removeLabel(annotation) {\n const docId = this.docs[this.pageNumber].id;\n _http__WEBPACK_IMPORTED_MODULE_0__[\"default\"].delete(`docs/${docId}/annotations/${annotation.id}`).then((response) => {\n const index = this.annotations[this.pageNumber].indexOf(annotation);\n this.annotations[this.pageNumber].splice(index, 1);\n });\n },\n },\n\n watch: {\n picked() {\n this.submit();\n },\n\n annotations() {\n // fetch progress info.\n _http__WEBPACK_IMPORTED_MODULE_0__[\"default\"].get('progress').then((response) => {\n this.total = response.data.total;\n this.remaining = response.data.remaining;\n });\n },\n\n offset() {\n storeOffsetInUrl(this.offset);\n },\n },\n\n created() {\n _http__WEBPACK_IMPORTED_MODULE_0__[\"default\"].get('labels').then((response) => {\n this.labels = response.data;\n });\n _http__WEBPACK_IMPORTED_MODULE_0__[\"default\"].get().then((response) => {\n this.guideline = response.data.guideline;\n });\n this.submit();\n },\n\n computed: {\n achievement() {\n const done = this.total - this.remaining;\n const percentage = Math.round(done / this.total * 100);\n return this.total > 0 ? percentage : 0;\n },\n\n compiledMarkdown() {\n return marked(this.guideline, {\n sanitize: true,\n });\n },\n\n id2label() {\n let id2label = {};\n for (let i = 0; i < this.labels.length; i++) {\n const label = this.labels[i];\n id2label[label.id] = label;\n }\n return id2label;\n },\n\n progressColor() {\n if (this.achievement < 30) {\n return 'is-danger';\n }\n if (this.achievement < 70) {\n return 'is-warning';\n }\n return 'is-primary';\n },\n },\n};\n\n/* harmony default export */ __webpack_exports__[\"default\"] = (annotationMixin);\n\n\n//# sourceURL=webpack:///./static/js/mixin.js?"); +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _http__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./http */ \"./static/js/http.js\");\n\n\nconst getOffsetFromUrl = function(url) {\n const offsetMatch = url.match(/[?#].*offset=(\\d+)/);\n if (offsetMatch == null) {\n return 0;\n }\n\n return parseInt(offsetMatch[1], 10);\n};\n\nconst storeOffsetInUrl = function(offset) {\n let href = window.location.href;\n\n const fragmentStart = href.indexOf('#') + 1;\n if (fragmentStart === 0) {\n href += '#offset=' + offset;\n } else {\n const prefix = href.substring(0, fragmentStart);\n const fragment = href.substring(fragmentStart);\n\n const newFragment = fragment.split('&').map(function(fragmentPart) {\n const keyValue = fragmentPart.split('=');\n return keyValue[0] === 'offset'\n ? 'offset=' + offset\n : fragmentPart;\n }).join('&');\n\n href = prefix + newFragment;\n }\n\n window.location.href = href;\n};\n\nconst annotationMixin = {\n data() {\n return {\n pageNumber: 0,\n docs: [],\n annotations: [],\n labels: [],\n guideline: '',\n total: 0,\n remaining: 0,\n searchQuery: '',\n url: '',\n offset: getOffsetFromUrl(window.location.href),\n picked: 'all',\n count: 0,\n isActive: false,\n };\n },\n\n methods: {\n async nextPage() {\n this.pageNumber += 1;\n if (this.pageNumber === this.docs.length) {\n if (this.next) {\n this.url = this.next;\n await this.search();\n this.pageNumber = 0;\n } else {\n this.pageNumber = this.docs.length - 1;\n }\n }\n },\n\n async prevPage() {\n this.pageNumber -= 1;\n if (this.pageNumber === -1) {\n if (this.prev) {\n this.url = this.prev;\n await this.search();\n this.pageNumber = this.docs.length - 1;\n } else {\n this.pageNumber = 0;\n }\n }\n },\n\n async search() {\n await _http__WEBPACK_IMPORTED_MODULE_0__[\"default\"].get(this.url).then((response) => {\n this.docs = response.data.results;\n this.next = response.data.next;\n this.prev = response.data.previous;\n this.count = response.data.count;\n this.annotations = [];\n for (let i = 0; i < this.docs.length; i++) {\n const doc = this.docs[i];\n this.annotations.push(doc.annotations);\n }\n this.offset = getOffsetFromUrl(this.url);\n });\n },\n\n getState() {\n if (this.picked === 'all') {\n return '';\n }\n if (this.picked === 'active') {\n return 'true';\n }\n return 'false';\n },\n\n async submit() {\n const state = this.getState();\n this.url = `docs/?q=${this.searchQuery}&is_checked=${state}&offset=${this.offset}`;\n await this.search();\n this.pageNumber = 0;\n },\n\n removeLabel(annotation) {\n const docId = this.docs[this.pageNumber].id;\n _http__WEBPACK_IMPORTED_MODULE_0__[\"default\"].delete(`docs/${docId}/annotations/${annotation.id}`).then((response) => {\n const index = this.annotations[this.pageNumber].indexOf(annotation);\n this.annotations[this.pageNumber].splice(index, 1);\n });\n },\n\n replaceNull(shortcut) {\n if (shortcut === null) {\n shortcut = '';\n }\n shortcut = shortcut.split(' ');\n return shortcut;\n },\n },\n\n watch: {\n picked() {\n this.submit();\n },\n\n annotations() {\n // fetch progress info.\n _http__WEBPACK_IMPORTED_MODULE_0__[\"default\"].get('progress').then((response) => {\n this.total = response.data.total;\n this.remaining = response.data.remaining;\n });\n },\n\n offset() {\n storeOffsetInUrl(this.offset);\n },\n },\n\n created() {\n _http__WEBPACK_IMPORTED_MODULE_0__[\"default\"].get('labels').then((response) => {\n this.labels = response.data;\n });\n _http__WEBPACK_IMPORTED_MODULE_0__[\"default\"].get().then((response) => {\n this.guideline = response.data.guideline;\n });\n this.submit();\n },\n\n computed: {\n achievement() {\n const done = this.total - this.remaining;\n const percentage = Math.round(done / this.total * 100);\n return this.total > 0 ? percentage : 0;\n },\n\n compiledMarkdown() {\n return marked(this.guideline, {\n sanitize: true,\n });\n },\n\n id2label() {\n let id2label = {};\n for (let i = 0; i < this.labels.length; i++) {\n const label = this.labels[i];\n id2label[label.id] = label;\n }\n return id2label;\n },\n\n progressColor() {\n if (this.achievement < 30) {\n return 'is-danger';\n }\n if (this.achievement < 70) {\n return 'is-warning';\n }\n return 'is-primary';\n },\n },\n};\n\n/* harmony default export */ __webpack_exports__[\"default\"] = (annotationMixin);\n\n\n//# sourceURL=webpack:///./static/js/mixin.js?"); /***/ }), diff --git a/app/server/static/bundle/sequence_labeling.js b/app/server/static/bundle/sequence_labeling.js index 1c46be9c..4ef4a3f9 100644 --- a/app/server/static/bundle/sequence_labeling.js +++ b/app/server/static/bundle/sequence_labeling.js @@ -463,6 +463,18 @@ eval("var g;\n\n// This works in non-strict mode\ng = (function() {\n\treturn th /***/ }), +/***/ "./static/js/filter.js": +/*!*****************************!*\ + !*** ./static/js/filter.js ***! + \*****************************/ +/*! exports provided: default */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"default\", function() { return simpleShortcut; });\nfunction simpleShortcut(shortcut) {\n if (shortcut === null) {\n shortcut = '';\n } else {\n shortcut = shortcut.replace('ctrl', 'C');\n shortcut = shortcut.replace('shift', 'S');\n shortcut = shortcut.split(' ').join('-');\n }\n return shortcut;\n}\n\n\n//# sourceURL=webpack:///./static/js/filter.js?"); + +/***/ }), + /***/ "./static/js/http.js": /*!***************************!*\ !*** ./static/js/http.js ***! @@ -483,7 +495,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var axio /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _http__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./http */ \"./static/js/http.js\");\n\n\nconst getOffsetFromUrl = function(url) {\n const offsetMatch = url.match(/[?#].*offset=(\\d+)/);\n if (offsetMatch == null) {\n return 0;\n }\n\n return parseInt(offsetMatch[1], 10);\n};\n\nconst storeOffsetInUrl = function(offset) {\n let href = window.location.href;\n\n const fragmentStart = href.indexOf('#') + 1;\n if (fragmentStart === 0) {\n href += '#offset=' + offset;\n } else {\n const prefix = href.substring(0, fragmentStart);\n const fragment = href.substring(fragmentStart);\n\n const newFragment = fragment.split('&').map(function(fragmentPart) {\n const keyValue = fragmentPart.split('=');\n return keyValue[0] === 'offset'\n ? 'offset=' + offset\n : fragmentPart;\n }).join('&');\n\n href = prefix + newFragment;\n }\n\n window.location.href = href;\n};\n\nconst annotationMixin = {\n data() {\n return {\n pageNumber: 0,\n docs: [],\n annotations: [],\n labels: [],\n guideline: '',\n total: 0,\n remaining: 0,\n searchQuery: '',\n url: '',\n offset: getOffsetFromUrl(window.location.href),\n picked: 'all',\n count: 0,\n isActive: false,\n };\n },\n\n methods: {\n async nextPage() {\n this.pageNumber += 1;\n if (this.pageNumber === this.docs.length) {\n if (this.next) {\n this.url = this.next;\n await this.search();\n this.pageNumber = 0;\n } else {\n this.pageNumber = this.docs.length - 1;\n }\n }\n },\n\n async prevPage() {\n this.pageNumber -= 1;\n if (this.pageNumber === -1) {\n if (this.prev) {\n this.url = this.prev;\n await this.search();\n this.pageNumber = this.docs.length - 1;\n } else {\n this.pageNumber = 0;\n }\n }\n },\n\n async search() {\n await _http__WEBPACK_IMPORTED_MODULE_0__[\"default\"].get(this.url).then((response) => {\n this.docs = response.data.results;\n this.next = response.data.next;\n this.prev = response.data.previous;\n this.count = response.data.count;\n this.annotations = [];\n for (let i = 0; i < this.docs.length; i++) {\n const doc = this.docs[i];\n this.annotations.push(doc.annotations);\n }\n this.offset = getOffsetFromUrl(this.url);\n });\n },\n\n getState() {\n if (this.picked === 'all') {\n return '';\n }\n if (this.picked === 'active') {\n return 'true';\n }\n return 'false';\n },\n\n async submit() {\n const state = this.getState();\n this.url = `docs/?q=${this.searchQuery}&is_checked=${state}&offset=${this.offset}`;\n await this.search();\n this.pageNumber = 0;\n },\n\n removeLabel(annotation) {\n const docId = this.docs[this.pageNumber].id;\n _http__WEBPACK_IMPORTED_MODULE_0__[\"default\"].delete(`docs/${docId}/annotations/${annotation.id}`).then((response) => {\n const index = this.annotations[this.pageNumber].indexOf(annotation);\n this.annotations[this.pageNumber].splice(index, 1);\n });\n },\n },\n\n watch: {\n picked() {\n this.submit();\n },\n\n annotations() {\n // fetch progress info.\n _http__WEBPACK_IMPORTED_MODULE_0__[\"default\"].get('progress').then((response) => {\n this.total = response.data.total;\n this.remaining = response.data.remaining;\n });\n },\n\n offset() {\n storeOffsetInUrl(this.offset);\n },\n },\n\n created() {\n _http__WEBPACK_IMPORTED_MODULE_0__[\"default\"].get('labels').then((response) => {\n this.labels = response.data;\n });\n _http__WEBPACK_IMPORTED_MODULE_0__[\"default\"].get().then((response) => {\n this.guideline = response.data.guideline;\n });\n this.submit();\n },\n\n computed: {\n achievement() {\n const done = this.total - this.remaining;\n const percentage = Math.round(done / this.total * 100);\n return this.total > 0 ? percentage : 0;\n },\n\n compiledMarkdown() {\n return marked(this.guideline, {\n sanitize: true,\n });\n },\n\n id2label() {\n let id2label = {};\n for (let i = 0; i < this.labels.length; i++) {\n const label = this.labels[i];\n id2label[label.id] = label;\n }\n return id2label;\n },\n\n progressColor() {\n if (this.achievement < 30) {\n return 'is-danger';\n }\n if (this.achievement < 70) {\n return 'is-warning';\n }\n return 'is-primary';\n },\n },\n};\n\n/* harmony default export */ __webpack_exports__[\"default\"] = (annotationMixin);\n\n\n//# sourceURL=webpack:///./static/js/mixin.js?"); +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _http__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./http */ \"./static/js/http.js\");\n\n\nconst getOffsetFromUrl = function(url) {\n const offsetMatch = url.match(/[?#].*offset=(\\d+)/);\n if (offsetMatch == null) {\n return 0;\n }\n\n return parseInt(offsetMatch[1], 10);\n};\n\nconst storeOffsetInUrl = function(offset) {\n let href = window.location.href;\n\n const fragmentStart = href.indexOf('#') + 1;\n if (fragmentStart === 0) {\n href += '#offset=' + offset;\n } else {\n const prefix = href.substring(0, fragmentStart);\n const fragment = href.substring(fragmentStart);\n\n const newFragment = fragment.split('&').map(function(fragmentPart) {\n const keyValue = fragmentPart.split('=');\n return keyValue[0] === 'offset'\n ? 'offset=' + offset\n : fragmentPart;\n }).join('&');\n\n href = prefix + newFragment;\n }\n\n window.location.href = href;\n};\n\nconst annotationMixin = {\n data() {\n return {\n pageNumber: 0,\n docs: [],\n annotations: [],\n labels: [],\n guideline: '',\n total: 0,\n remaining: 0,\n searchQuery: '',\n url: '',\n offset: getOffsetFromUrl(window.location.href),\n picked: 'all',\n count: 0,\n isActive: false,\n };\n },\n\n methods: {\n async nextPage() {\n this.pageNumber += 1;\n if (this.pageNumber === this.docs.length) {\n if (this.next) {\n this.url = this.next;\n await this.search();\n this.pageNumber = 0;\n } else {\n this.pageNumber = this.docs.length - 1;\n }\n }\n },\n\n async prevPage() {\n this.pageNumber -= 1;\n if (this.pageNumber === -1) {\n if (this.prev) {\n this.url = this.prev;\n await this.search();\n this.pageNumber = this.docs.length - 1;\n } else {\n this.pageNumber = 0;\n }\n }\n },\n\n async search() {\n await _http__WEBPACK_IMPORTED_MODULE_0__[\"default\"].get(this.url).then((response) => {\n this.docs = response.data.results;\n this.next = response.data.next;\n this.prev = response.data.previous;\n this.count = response.data.count;\n this.annotations = [];\n for (let i = 0; i < this.docs.length; i++) {\n const doc = this.docs[i];\n this.annotations.push(doc.annotations);\n }\n this.offset = getOffsetFromUrl(this.url);\n });\n },\n\n getState() {\n if (this.picked === 'all') {\n return '';\n }\n if (this.picked === 'active') {\n return 'true';\n }\n return 'false';\n },\n\n async submit() {\n const state = this.getState();\n this.url = `docs/?q=${this.searchQuery}&is_checked=${state}&offset=${this.offset}`;\n await this.search();\n this.pageNumber = 0;\n },\n\n removeLabel(annotation) {\n const docId = this.docs[this.pageNumber].id;\n _http__WEBPACK_IMPORTED_MODULE_0__[\"default\"].delete(`docs/${docId}/annotations/${annotation.id}`).then((response) => {\n const index = this.annotations[this.pageNumber].indexOf(annotation);\n this.annotations[this.pageNumber].splice(index, 1);\n });\n },\n\n replaceNull(shortcut) {\n if (shortcut === null) {\n shortcut = '';\n }\n shortcut = shortcut.split(' ');\n return shortcut;\n },\n },\n\n watch: {\n picked() {\n this.submit();\n },\n\n annotations() {\n // fetch progress info.\n _http__WEBPACK_IMPORTED_MODULE_0__[\"default\"].get('progress').then((response) => {\n this.total = response.data.total;\n this.remaining = response.data.remaining;\n });\n },\n\n offset() {\n storeOffsetInUrl(this.offset);\n },\n },\n\n created() {\n _http__WEBPACK_IMPORTED_MODULE_0__[\"default\"].get('labels').then((response) => {\n this.labels = response.data;\n });\n _http__WEBPACK_IMPORTED_MODULE_0__[\"default\"].get().then((response) => {\n this.guideline = response.data.guideline;\n });\n this.submit();\n },\n\n computed: {\n achievement() {\n const done = this.total - this.remaining;\n const percentage = Math.round(done / this.total * 100);\n return this.total > 0 ? percentage : 0;\n },\n\n compiledMarkdown() {\n return marked(this.guideline, {\n sanitize: true,\n });\n },\n\n id2label() {\n let id2label = {};\n for (let i = 0; i < this.labels.length; i++) {\n const label = this.labels[i];\n id2label[label.id] = label;\n }\n return id2label;\n },\n\n progressColor() {\n if (this.achievement < 30) {\n return 'is-danger';\n }\n if (this.achievement < 70) {\n return 'is-warning';\n }\n return 'is-primary';\n },\n },\n};\n\n/* harmony default export */ __webpack_exports__[\"default\"] = (annotationMixin);\n\n\n//# sourceURL=webpack:///./static/js/mixin.js?"); /***/ }), @@ -495,7 +507,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _htt /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! vue */ \"./node_modules/vue/dist/vue.esm.js\");\n/* harmony import */ var _mixin__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./mixin */ \"./static/js/mixin.js\");\n/* harmony import */ var _http__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./http */ \"./static/js/http.js\");\n\n\n\n\nvue__WEBPACK_IMPORTED_MODULE_0__[\"default\"].use(__webpack_require__(/*! vue-shortkey */ \"./node_modules/vue-shortkey/dist/index.js\"), {\n prevent: ['input', 'textarea'],\n});\n\nvue__WEBPACK_IMPORTED_MODULE_0__[\"default\"].component('annotator', {\n template: '
required
+optional
+optional
+optional
+