From e08007610a5065d2d852b36620916277e19b557a Mon Sep 17 00:00:00 2001 From: Hironsan Date: Mon, 18 Jun 2018 15:09:20 +0900 Subject: [PATCH] Update progress bar when addLabel and deleteLabel --- doccano/app/db.sqlite3 | Bin 208896 -> 208896 bytes doccano/app/server/static/annotation.1.js | 34 +++++++++------------- 2 files changed, 14 insertions(+), 20 deletions(-) diff --git a/doccano/app/db.sqlite3 b/doccano/app/db.sqlite3 index b72fc474145f90a2431b70d407763005befde633..762e97e4e2d2a4320dbe5b87ceecc2f30bda4301 100644 GIT binary patch delta 315 zcmZp8z|-)6XMz+HBgaG;Cm^{o;fo$)^5#(e^&7-E_^&bW|K|V3|B?R<|8xFF{CD`T z@n6_1n6Qn1`UiU^R-I&4W=2M)L@=4a!pzAS4BnSd?43=9k${CgPqfAD|cf5HEN{|5gB z{$u=m_%{JvJ%itkBbkkXfs>JunUy0E!eV0PNPw}};z2A#Ne-u|PX HiDLl(UfD&! delta 304 zcmZp8z|-)6XMz+H!`F#2PC#;F!WTWpu+5?R>oX%EHXaXvejgG2y@bq5=UR+ElW1_n-`V>viHp)3}l24S!mGmymz dWN`vzgJH59VGtG*GkYkQ#mT(=M?VwC0ssmTLP-Ds diff --git a/doccano/app/server/static/annotation.1.js b/doccano/app/server/static/annotation.1.js index 28a8f596..2e7bf79c 100644 --- a/doccano/app/server/static/annotation.1.js +++ b/doccano/app/server/static/annotation.1.js @@ -54,6 +54,7 @@ var vm = new Vue({ .catch(function (error) { console.log('ERROR!! happend by Backend.') }); + this.updateProgress(); }, deleteLabel: function (index) { var label2id = swap(this.labels); @@ -73,9 +74,9 @@ var vm = new Vue({ console.log('ERROR!! happend by Backend.') }); this.items[this.cur]['labels'].splice(index, 1) + this.updateProgress(); }, nextPage: function () { - this.remaining -= 1; this.cur += 1; if (this.cur == this.items.length) { if (this.hasNext) { @@ -89,7 +90,6 @@ var vm = new Vue({ this.showMessage(this.cur); }, prevPage: function () { - this.remaining += 1; this.cur -= 1; if (this.cur == -1) { if (this.hasPrevious) { @@ -135,21 +135,10 @@ var vm = new Vue({ var text = this.items[index].text; var msg_body = '

' + text + '

'; $('.message .content').html(msg_body); - } - }, - created: function () { - var self = this; - axios.get('/' + base_url + '/apis/labels') - .then(function (response) { - self.labels = response.data['labels']; - //self.total = response.data['total']; - //self.remaining = response.data['remaining']; - }) - .catch(function (error) { - console.log('ERROR!! happend by Backend.') - }); - - axios.get('/' + base_url + '/apis/progress') + }, + updateProgress: function() { + var self = this; + axios.get('/' + base_url + '/apis/progress') .then(function (response) { self.total = response.data['total']; self.remaining = response.data['remaining']; @@ -157,14 +146,19 @@ var vm = new Vue({ .catch(function (error) { console.log('ERROR!! happend by Backend.') }); - - axios.get('/' + base_url + '/apis/data') + } + }, + created: function () { + var self = this; + axios.get('/' + base_url + '/apis/labels') .then(function (response) { - self.items = response.data['data']; + self.labels = response.data['labels']; }) .catch(function (error) { console.log('ERROR!! happend by Backend.') }); + this.updateProgress(); + this.submit() }, computed: { done: function () {