branch bow-v2-go updated (ddd9ad6 -> 2a0232e)
This is an automated email from the git hooks/post-receive script. New change to branch bow-v2-go in repository bow. See https://gitlab.nuiton.org/chorem/bow.git from ddd9ad6 correction recup pour l'edition new 53df464 ajout de la config du nombre de tag dans le cloud new dfee8c8 suppression du beforeMount qui ne sert plus avec les computed properties (diminution du nombre d'appel au back) new 2a0232e ajout delai avant enregistrement maxResult et MaxTagInCloud The 3 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "adds" were already present in the repository and have only been added to this reference. Detailed log of new commits: commit 2a0232e8aab6f8d7256faddc1ff2b44212770161 Author: Benjamin <poussin@codelutin.com> Date: Sun May 31 01:08:09 2020 +0200 ajout delai avant enregistrement maxResult et MaxTagInCloud commit dfee8c8d915759f11c3eaf1e03a29fdd60c53a27 Author: Benjamin <poussin@codelutin.com> Date: Sun May 31 01:07:34 2020 +0200 suppression du beforeMount qui ne sert plus avec les computed properties (diminution du nombre d'appel au back) commit 53df46493c2f16860289292a84f28785173229a6 Author: Benjamin <poussin@codelutin.com> Date: Thu May 28 23:54:19 2020 +0200 ajout de la config du nombre de tag dans le cloud Summary of changes: pkg/repository/bookmarkRepository.go | 2 +- pkg/repository/database.go | 19 +++---- web/src/components/common/TagsInput.vue | 5 -- web/src/components/preferences/MaxResultEditor.vue | 41 +++++++++----- .../components/preferences/MaxTagInCloudEditor.vue | 63 ++++++++++++++++++++++ web/src/views/Preferences.vue | 6 ++- 6 files changed, 105 insertions(+), 31 deletions(-) create mode 100644 web/src/components/preferences/MaxTagInCloudEditor.vue -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.
This is an automated email from the git hooks/post-receive script. New commit to branch bow-v2-go in repository bow. See https://gitlab.nuiton.org/chorem/bow.git commit 53df46493c2f16860289292a84f28785173229a6 Author: Benjamin <poussin@codelutin.com> Date: Thu May 28 23:54:19 2020 +0200 ajout de la config du nombre de tag dans le cloud --- pkg/repository/database.go | 13 +++--- .../components/preferences/MaxTagInCloudEditor.vue | 49 ++++++++++++++++++++++ web/src/views/Preferences.vue | 6 ++- 3 files changed, 60 insertions(+), 8 deletions(-) diff --git a/pkg/repository/database.go b/pkg/repository/database.go index 5bc1612..a8bb644 100644 --- a/pkg/repository/database.go +++ b/pkg/repository/database.go @@ -266,7 +266,8 @@ func (q *query) exec(currentUser model.BowUser, minRow int64, maxRow int64, argu QueryString fait une requete qui ne retourne qu'une seul ligne et retourne du string (qui peut ĂȘtre du json) */ func (q *query) QueryString(currentUser model.BowUser, arguments ...interface{}) (string, error) { - log.Println("[DB] begin tx") + txid, _ := utils.GenUUID() + log.Println(txid, "[DB] begin tx") tx, err := db.Begin(context.Background()) if err != nil { return "", utils.NewHTTPError500(err, currentUser) @@ -274,7 +275,7 @@ func (q *query) QueryString(currentUser model.BowUser, arguments ...interface{}) defer tx.Rollback(context.Background()) if q.presql != "" { - log.Println("[DB] exec pre query", q.presql) + log.Println(txid, "[DB] exec pre query", q.presql) _, err = db.Exec(context.Background(), q.presql, pgx.QuerySimpleProtocol(true)) if err != nil { return "", utils.NewHTTPError500(err, currentUser) @@ -282,14 +283,14 @@ func (q *query) QueryString(currentUser model.BowUser, arguments ...interface{}) } if !q.asNobody { - log.Println("[DB] change role to", currentUser.ID) + log.Println(txid, "[DB] change role to", currentUser.ID) _, err = db.Exec(context.Background(), fmt.Sprintf(`SET ROLE "%[1]s";`, currentUser.ID)) if err != nil { return "", utils.NewHTTPError500(err, currentUser) } } - log.Println("[DB] exec query", q.sql) + log.Println(txid, "[DB] exec query", q.sql) row := db.QueryRow(context.Background(), q.sql, arguments...) var pgjson pgtype.JSON @@ -299,14 +300,14 @@ func (q *query) QueryString(currentUser model.BowUser, arguments ...interface{}) } if q.postsql != "" { - log.Println("[DB] exec post query", q.postsql) + log.Println(txid, "[DB] exec post query", q.postsql) _, err = db.Exec(context.Background(), q.postsql, pgx.QuerySimpleProtocol(true)) if err != nil { return "", utils.NewHTTPError500(err, currentUser) } } - log.Println("[DB] commit tx") + log.Println(txid, "[DB] commit tx") err = tx.Commit(context.Background()) if err != nil { return "", utils.NewHTTPError500(err, currentUser) diff --git a/web/src/components/preferences/MaxTagInCloudEditor.vue b/web/src/components/preferences/MaxTagInCloudEditor.vue new file mode 100644 index 0000000..da43fc1 --- /dev/null +++ b/web/src/components/preferences/MaxTagInCloudEditor.vue @@ -0,0 +1,49 @@ +<template> + <div class="maxtagincloud-editor"> + <label for="maxtagincloud">Cloud's tag</label><input id="maxtagincloud" class="maxtagincloud" v-model="maxtagincloud" /> + <span class="errorMsg">{{ errorMsg }}</span> + </div> +</template> + +<script> +import { Component, Vue } from 'vue-property-decorator' + +@Component({ + name: 'MaxTagInCloudEditor', + components: {} +}) +class MaxTagInCloudEditor extends Vue { + errorMsg = '' + + get maxtagincloud() { + return this.user.maxtagincloud + } + + set maxtagincloud(value) { + let newMaxTagInCloud = parseInt(value) + this.$fetch.put('/users/current/maxtagincloud', {maxtagincloud: newMaxTagInCloud}).then( + () => { + let newUser = {...this.user} + newUser.maxtagincloud = newMaxTagInCloud + this.saveUser(newUser) + + this.errorMsg = 'saved' + }, + (err) => { + console.log('ko', err) + this.errorMsg = err.cause + } + ) + } + +} + +export default MaxTagInCloudEditor +</script> + +<style scoped lang="less"> +.maxtagincloud-editor { + display: flex; + flex-direction: row; +} +</style> diff --git a/web/src/views/Preferences.vue b/web/src/views/Preferences.vue index 4a766c3..66ef911 100644 --- a/web/src/views/Preferences.vue +++ b/web/src/views/Preferences.vue @@ -2,7 +2,8 @@ <div class="preferences"> <div>{{ errorMsg }}</div> <a :href="bookmarkletAdd">bookmarklet add</a> - <MaxResultEditor :user="user"></MaxResultEditor> + <MaxResultEditor></MaxResultEditor> + <MaxTagInCloudEditor></MaxTagInCloudEditor> <Actions :actions="user.actions"></Actions> <TagsEditor></TagsEditor> </div> @@ -12,12 +13,13 @@ // @ is an alias to /src import { Component, Vue } from 'vue-property-decorator' import MaxResultEditor from '@/components/preferences/MaxResultEditor' +import MaxTagInCloudEditor from '@/components/preferences/MaxTagInCloudEditor' import Actions from '@/components/preferences/Actions' import TagsEditor from '@/components/preferences/TagsEditor' @Component({ name: 'Preferences', - components: {MaxResultEditor, Actions, TagsEditor} + components: {MaxTagInCloudEditor, MaxResultEditor, Actions, TagsEditor} }) class Preferences extends Vue { errorMsg = '' -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.
This is an automated email from the git hooks/post-receive script. New commit to branch bow-v2-go in repository bow. See https://gitlab.nuiton.org/chorem/bow.git commit dfee8c8d915759f11c3eaf1e03a29fdd60c53a27 Author: Benjamin <poussin@codelutin.com> Date: Sun May 31 01:07:34 2020 +0200 suppression du beforeMount qui ne sert plus avec les computed properties (diminution du nombre d'appel au back) --- web/src/components/common/TagsInput.vue | 5 ----- 1 file changed, 5 deletions(-) diff --git a/web/src/components/common/TagsInput.vue b/web/src/components/common/TagsInput.vue index 14208ca..b3a1b6d 100644 --- a/web/src/components/common/TagsInput.vue +++ b/web/src/components/common/TagsInput.vue @@ -88,11 +88,6 @@ class TagsInput extends Vue { } ) } - - beforeMount() { - this.load() - console.log('xxxx', this.allTags, this.canCreate, this.limit, this.displayCount, this.value) - } } export default TagsInput -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.
This is an automated email from the git hooks/post-receive script. New commit to branch bow-v2-go in repository bow. See https://gitlab.nuiton.org/chorem/bow.git commit 2a0232e8aab6f8d7256faddc1ff2b44212770161 Author: Benjamin <poussin@codelutin.com> Date: Sun May 31 01:08:09 2020 +0200 ajout delai avant enregistrement maxResult et MaxTagInCloud --- pkg/repository/bookmarkRepository.go | 2 +- pkg/repository/database.go | 6 +-- web/src/components/preferences/MaxResultEditor.vue | 41 +++++++++++++------- .../components/preferences/MaxTagInCloudEditor.vue | 44 ++++++++++++++-------- 4 files changed, 60 insertions(+), 33 deletions(-) diff --git a/pkg/repository/bookmarkRepository.go b/pkg/repository/bookmarkRepository.go index 1e01756..1993a24 100644 --- a/pkg/repository/bookmarkRepository.go +++ b/pkg/repository/bookmarkRepository.go @@ -29,7 +29,7 @@ func BookmarkJSON(currentUser model.BowUser, id string, uri string, tags []strin } // normalize orderBy to prevent SQL injection - orderBy = bookmakFields[orderBy] + orderBy = bookmarkFields[orderBy] if orderBy == "" { orderBy = "creationdate" } diff --git a/pkg/repository/database.go b/pkg/repository/database.go index a8bb644..bd92d43 100644 --- a/pkg/repository/database.go +++ b/pkg/repository/database.go @@ -29,7 +29,7 @@ type errorLineExtract struct { // Use to normalize orderBy to prevent SQL injection // key: struct field name or database field name in lower case // value: database field name (to use in query) -var bookmakFields = make(map[string]string) +var bookmarkFields = make(map[string]string) /* Init initialise la connexion a la base en utilisant @@ -65,8 +65,8 @@ func computeFieldAvailable() { field := val.Type().Field(i) fieldName := strings.ToLower(field.Name) jsonName := strings.ToLower(strings.Split(field.Tag.Get("json"), ",")[0]) - bookmakFields[fieldName] = jsonName - bookmakFields[jsonName] = jsonName + bookmarkFields[fieldName] = jsonName + bookmarkFields[jsonName] = jsonName } } diff --git a/web/src/components/preferences/MaxResultEditor.vue b/web/src/components/preferences/MaxResultEditor.vue index e67869a..6990045 100644 --- a/web/src/components/preferences/MaxResultEditor.vue +++ b/web/src/components/preferences/MaxResultEditor.vue @@ -15,27 +15,40 @@ import { Component, Vue } from 'vue-property-decorator' class MaxResultEditor extends Vue { errorMsg = '' + timeoutSave = 0 + + cancelTimeoutSave() { + this.timeoutSave && clearTimeout(this.timeoutSave) + this.timeoutSave = 0 + } + get maxresult() { return this.user.maxresult } set maxresult(value) { - let newMaxresult = parseInt(value) - this.$fetch.put('/users/current/maxresult', {maxresult: newMaxresult}).then( - () => { - let newUser = {...this.user} - newUser.maxresult = newMaxresult - this.saveUser(newUser) - - this.errorMsg = 'saved' - }, - (err) => { - console.log('ko', err) - this.errorMsg = err.cause - } + this.cancelTimeoutSave() + this.timeoutSave = setTimeout( + function(v) { + let newMaxresult = parseInt(v) + this.$fetch.put('/users/current/maxresult', { maxresult: newMaxresult }).then( + () => { + let newUser = { ...this.user } + newUser.maxresult = newMaxresult + this.saveUser(newUser) + + this.errorMsg = 'saved' + }, + (err) => { + console.log('ko', err) + this.errorMsg = err.cause + } + ) + }.bind(this), + 800, + value ) } - } export default MaxResultEditor diff --git a/web/src/components/preferences/MaxTagInCloudEditor.vue b/web/src/components/preferences/MaxTagInCloudEditor.vue index da43fc1..d402e5e 100644 --- a/web/src/components/preferences/MaxTagInCloudEditor.vue +++ b/web/src/components/preferences/MaxTagInCloudEditor.vue @@ -1,6 +1,7 @@ <template> <div class="maxtagincloud-editor"> - <label for="maxtagincloud">Cloud's tag</label><input id="maxtagincloud" class="maxtagincloud" v-model="maxtagincloud" /> + <label for="maxtagincloud">Cloud's tag</label + ><input id="maxtagincloud" class="maxtagincloud" v-model="maxtagincloud" /> <span class="errorMsg">{{ errorMsg }}</span> </div> </template> @@ -15,27 +16,40 @@ import { Component, Vue } from 'vue-property-decorator' class MaxTagInCloudEditor extends Vue { errorMsg = '' + timeoutSave = 0 + + cancelTimeoutSave() { + this.timeoutSave && clearTimeout(this.timeoutSave) + this.timeoutSave = 0 + } + get maxtagincloud() { return this.user.maxtagincloud } set maxtagincloud(value) { - let newMaxTagInCloud = parseInt(value) - this.$fetch.put('/users/current/maxtagincloud', {maxtagincloud: newMaxTagInCloud}).then( - () => { - let newUser = {...this.user} - newUser.maxtagincloud = newMaxTagInCloud - this.saveUser(newUser) - - this.errorMsg = 'saved' - }, - (err) => { - console.log('ko', err) - this.errorMsg = err.cause - } + this.cancelTimeoutSave() + this.timeoutSave = setTimeout( + function(v) { + let newMaxTagInCloud = parseInt(v) + this.$fetch.put('/users/current/maxtagincloud', { maxtagincloud: newMaxTagInCloud }).then( + () => { + let newUser = { ...this.user } + newUser.maxtagincloud = newMaxTagInCloud + this.saveUser(newUser) + + this.errorMsg = 'saved' + }, + (err) => { + console.log('ko', err) + this.errorMsg = err.cause + } + ) + }.bind(this), + 800, + value ) } - } export default MaxTagInCloudEditor -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.
participants (1)
-
chorem.org scm