mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-01-07 09:18:49 +01:00
Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
commit
05a506f2aa
10 changed files with 52 additions and 30 deletions
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"saveSearch": "Save query conditions",
|
||||
"useSearch": "Use query conditions",
|
||||
"saveCriterion": "Save named criterion",
|
||||
"useCriterion": "Use named criterion",
|
||||
"group": "Group",
|
||||
"noGroupBy": "No grouping",
|
||||
"groupByDoc": "Group by document",
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"saveSearch": "Guardar condiciones de consulta",
|
||||
"useSearch": "Usar condiciones de consulta",
|
||||
"saveCriterion": "Guardar criterio nombrado",
|
||||
"useCriterion": "Usar criterio con nombre",
|
||||
"grupo": "Grupo",
|
||||
"noGroupBy": "Sin agrupar",
|
||||
"groupByDoc": "Agrupar por documento",
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"saveSearch": "Enregistrer les conditions de la requête",
|
||||
"useSearch": "Utiliser les conditions de requête",
|
||||
"saveCriterion": "Enregistrer le critère nommé",
|
||||
"useCriterion": "Utiliser le critère nommé",
|
||||
"groupe": "Groupe",
|
||||
"noGroupBy": "Aucun regroupement",
|
||||
"groupByDoc": "Regrouper par document",
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"saveSearch": "保存查詢條件",
|
||||
"useSearch": "使用查詢條件",
|
||||
"saveCriterion": "保存命名查詢",
|
||||
"useCriterion": "使用命名查詢",
|
||||
"group": "分組",
|
||||
"noGroupBy": "不分組",
|
||||
"groupByDoc": "按文檔分組",
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"saveSearch": "保存查询条件",
|
||||
"useSearch": "使用查询条件",
|
||||
"saveCriterion": "保存命名查询",
|
||||
"useCriterion": "使用命名查询",
|
||||
"group": "分组",
|
||||
"noGroupBy": "不分组",
|
||||
"groupByDoc": "按文档分组",
|
||||
|
|
|
|||
|
|
@ -664,10 +664,10 @@ const addConfigMoreMenu = async (config: ISearchOption, edit: Protyle, element:
|
|||
}).element);
|
||||
window.siyuan.menus.menu.append(new MenuItem({type: "separator"}).element);
|
||||
window.siyuan.menus.menu.append(new MenuItem({
|
||||
label: window.siyuan.languages.saveSearch,
|
||||
label: window.siyuan.languages.saveCriterion,
|
||||
click() {
|
||||
const saveDialog = new Dialog({
|
||||
title: window.siyuan.languages.saveSearch,
|
||||
title: window.siyuan.languages.saveCriterion,
|
||||
content: `<div class="b3-dialog__content">
|
||||
<input class="b3-text-field fn__block" placeholder="${window.siyuan.languages.memo}">
|
||||
</div>
|
||||
|
|
@ -754,7 +754,7 @@ const addConfigMoreMenu = async (config: ISearchOption, edit: Protyle, element:
|
|||
});
|
||||
if (searchSubMenu.length > 0) {
|
||||
window.siyuan.menus.menu.append(new MenuItem({
|
||||
label: window.siyuan.languages.useSearch,
|
||||
label: window.siyuan.languages.useCriterion,
|
||||
type: "submenu",
|
||||
submenu: searchSubMenu
|
||||
}).element);
|
||||
|
|
|
|||
|
|
@ -60,6 +60,7 @@ func ServeAPI(ginServer *gin.Engine) {
|
|||
ginServer.Handle("POST", "/api/storage/removeLocalStorageVal", model.CheckAuth, removeLocalStorageVal)
|
||||
ginServer.Handle("POST", "/api/storage/setCriterion", model.CheckAuth, setCriterion)
|
||||
ginServer.Handle("POST", "/api/storage/getCriteria", model.CheckAuth, getCriteria)
|
||||
ginServer.Handle("POST", "/api/storage/removeCriterion", model.CheckAuth, removeCriterion)
|
||||
|
||||
ginServer.Handle("POST", "/api/account/login", model.CheckAuth, login)
|
||||
ginServer.Handle("POST", "/api/account/checkActivationcode", model.CheckAuth, checkActivationcode)
|
||||
|
|
|
|||
|
|
@ -25,6 +25,24 @@ import (
|
|||
"github.com/siyuan-note/siyuan/kernel/util"
|
||||
)
|
||||
|
||||
func removeCriterion(c *gin.Context) {
|
||||
ret := gulu.Ret.NewResult()
|
||||
defer c.JSON(http.StatusOK, ret)
|
||||
|
||||
arg, ok := util.JsonArg(c, ret)
|
||||
if !ok {
|
||||
return
|
||||
}
|
||||
|
||||
name := arg["name"].(string)
|
||||
err := model.RemoveCriterion(name)
|
||||
if nil != err {
|
||||
ret.Code = -1
|
||||
ret.Msg = err.Error()
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
func setCriterion(c *gin.Context) {
|
||||
ret := gulu.Ret.NewResult()
|
||||
defer c.JSON(http.StatusOK, ret)
|
||||
|
|
|
|||
|
|
@ -1,17 +0,0 @@
|
|||
// SiYuan - Build Your Eternal Digital Garden
|
||||
// Copyright (c) 2020-present, b3log.org
|
||||
//
|
||||
// This program is free software you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
package conf
|
||||
|
|
@ -59,6 +59,26 @@ type CriterionTypes struct {
|
|||
|
||||
var criteriaLock = sync.Mutex{}
|
||||
|
||||
func RemoveCriterion(name string) (err error) {
|
||||
criteriaLock.Lock()
|
||||
defer criteriaLock.Unlock()
|
||||
|
||||
criteria, err := getCriteria()
|
||||
if nil != err {
|
||||
return
|
||||
}
|
||||
|
||||
for i, c := range criteria {
|
||||
if c.Name == name {
|
||||
criteria = append(criteria[:i], criteria[i+1:]...)
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
err = setCriteria(criteria)
|
||||
return
|
||||
}
|
||||
|
||||
func SetCriterion(criterion *Criterion) (err error) {
|
||||
criteriaLock.Lock()
|
||||
defer criteriaLock.Unlock()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue