mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-16 06:30:14 +01:00
🎨 API getTag add an optional parameter ignoreMaxListHint https://github.com/siyuan-note/siyuan/issues/16000
Signed-off-by: Daniel <845765@qq.com>
This commit is contained in:
parent
53f0467f73
commit
9f3cd7ca95
7 changed files with 31 additions and 8 deletions
|
|
@ -751,6 +751,7 @@ export class Files extends Model {
|
|||
fetchPost("/api/filetree/listDocsByPath", {
|
||||
notebook: toURL,
|
||||
path: toDir === "/" ? "/" : toDir + ".sy",
|
||||
app: Constants.SIYUAN_APPID,
|
||||
}, response => {
|
||||
if (response.data.path === "/" && response.data.files.length === 0) {
|
||||
showMessage(window.siyuan.languages.emptyContent);
|
||||
|
|
@ -1123,7 +1124,8 @@ data-type="navigation-root" data-path="/">
|
|||
} else if (filePath.startsWith(item.path.replace(".sy", ""))) {
|
||||
const response = await fetchSyncPost("/api/filetree/listDocsByPath", {
|
||||
notebook: data.box,
|
||||
path: item.path
|
||||
path: item.path,
|
||||
app: Constants.SIYUAN_APPID,
|
||||
});
|
||||
newLiElement = await this.selectItem(response.data.box, filePath, response.data, setStorage, isSetCurrent);
|
||||
}
|
||||
|
|
@ -1160,6 +1162,7 @@ data-type="navigation-root" data-path="/">
|
|||
fetchPost("/api/filetree/listDocsByPath", {
|
||||
notebook: notebookId,
|
||||
path: liElement.getAttribute("data-path"),
|
||||
app: Constants.SIYUAN_APPID,
|
||||
}, response => {
|
||||
if (response.data.path === "/" && response.data.files.length === 0) {
|
||||
newFile({
|
||||
|
|
@ -1215,7 +1218,8 @@ data-type="navigation-root" data-path="/">
|
|||
} else {
|
||||
const response = await fetchSyncPost("/api/filetree/listDocsByPath", {
|
||||
notebook: notebookId,
|
||||
path: currentPath
|
||||
path: currentPath,
|
||||
app: Constants.SIYUAN_APPID,
|
||||
});
|
||||
liElement = await this.onLsSelect(response.data, filePath, setStorage, isSetCurrent);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -603,7 +603,8 @@ export class MobileFiles extends Model {
|
|||
} else if (filePath.startsWith(item.path.replace(".sy", ""))) {
|
||||
const response = await fetchSyncPost("/api/filetree/listDocsByPath", {
|
||||
notebook: data.box,
|
||||
path: item.path
|
||||
path: item.path,
|
||||
app: Constants.SIYUAN_APPID,
|
||||
});
|
||||
newLiElement = await this.selectItem(response.data.box, filePath, response.data, setStorage, isSetCurrent);
|
||||
}
|
||||
|
|
@ -640,6 +641,7 @@ export class MobileFiles extends Model {
|
|||
fetchPost("/api/filetree/listDocsByPath", {
|
||||
notebook: notebookId,
|
||||
path: liElement.getAttribute("data-path"),
|
||||
app: Constants.SIYUAN_APPID,
|
||||
}, response => {
|
||||
if (response.data.path === "/" && response.data.files.length === 0) {
|
||||
newFile({
|
||||
|
|
@ -695,7 +697,8 @@ export class MobileFiles extends Model {
|
|||
} else {
|
||||
const response = await fetchSyncPost("/api/filetree/listDocsByPath", {
|
||||
notebook: notebookId,
|
||||
path: currentPath
|
||||
path: currentPath,
|
||||
app: Constants.SIYUAN_APPID,
|
||||
});
|
||||
liElement = await this.onLsSelect(response.data, filePath, setStorage, isSetCurrent);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -607,6 +607,7 @@ const getLeaf = (liElement: HTMLElement, flashcard: boolean) => {
|
|||
notebook: notebookId,
|
||||
path: liElement.getAttribute("data-path"),
|
||||
flashcard,
|
||||
app: Constants.SIYUAN_APPID,
|
||||
}, response => {
|
||||
if (response.data.files.length === 0) {
|
||||
showMessage(window.siyuan.languages.emptyContent);
|
||||
|
|
|
|||
|
|
@ -1075,7 +1075,11 @@ func listDocsByPath(c *gin.Context) {
|
|||
// API `listDocsByPath` add an optional parameter `ignoreMaxListHint` https://github.com/siyuan-note/siyuan/issues/10290
|
||||
ignoreMaxListHintArg := arg["ignoreMaxListHint"]
|
||||
if nil == ignoreMaxListHintArg || !ignoreMaxListHintArg.(bool) {
|
||||
util.PushMsg(fmt.Sprintf(model.Conf.Language(48), len(files)), 7000)
|
||||
var app string
|
||||
if nil != arg["app"] {
|
||||
app = arg["app"].(string)
|
||||
}
|
||||
util.PushMsgWithApp(app, fmt.Sprintf(model.Conf.Language(48), len(files)), 7000)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -50,7 +50,8 @@ func getTag(c *gin.Context) {
|
|||
ignoreMaxListHint = ignoreMaxListHintArg.(bool)
|
||||
}
|
||||
|
||||
ret.Data = model.BuildTags(ignoreMaxListHint)
|
||||
app := arg["app"].(string)
|
||||
ret.Data = model.BuildTags(ignoreMaxListHint, app)
|
||||
}
|
||||
|
||||
func renameTag(c *gin.Context) {
|
||||
|
|
|
|||
|
|
@ -236,7 +236,7 @@ type Tag struct {
|
|||
|
||||
type Tags []*Tag
|
||||
|
||||
func BuildTags(ignoreMaxListHintArg bool) (ret *Tags) {
|
||||
func BuildTags(ignoreMaxListHintArg bool, appID string) (ret *Tags) {
|
||||
FlushTxQueue()
|
||||
sql.FlushQueue()
|
||||
|
||||
|
|
@ -255,7 +255,7 @@ func BuildTags(ignoreMaxListHintArg bool) (ret *Tags) {
|
|||
*tmp = append(*tmp, tag)
|
||||
countTag(tag, &total)
|
||||
if Conf.FileTree.MaxListCount < total && !ignoreMaxListHintArg {
|
||||
util.PushMsg(fmt.Sprintf(Conf.Language(243), Conf.FileTree.MaxListCount), 7000)
|
||||
util.PushMsgWithApp(appID, fmt.Sprintf(Conf.Language(243), Conf.FileTree.MaxListCount), 7000)
|
||||
break
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -163,6 +163,16 @@ func PushMsg(msg string, timeout int) (msgId string) {
|
|||
return
|
||||
}
|
||||
|
||||
func PushMsgWithApp(app, msg string, timeout int) (msgId string) {
|
||||
msgId = gulu.Rand.String(7)
|
||||
if "" == app {
|
||||
BroadcastByType("main", "msg", 0, msg, map[string]interface{}{"id": msgId, "closeTimeout": timeout})
|
||||
return
|
||||
}
|
||||
BroadcastByTypeAndApp("main", app, "msg", 0, msg, map[string]interface{}{"id": msgId, "closeTimeout": timeout})
|
||||
return
|
||||
}
|
||||
|
||||
func PushErrMsg(msg string, timeout int) (msgId string) {
|
||||
msgId = gulu.Rand.String(7)
|
||||
BroadcastByType("main", "msg", -1, msg, map[string]interface{}{"id": msgId, "closeTimeout": timeout})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue