@@ -38,13 +38,13 @@ class ChatEditPage extends React.Component { | |||
getChat() { | |||
ChatBackend.getChat(this.props.account.name, this.state.chatName) | |||
.then((chat) => { | |||
if (chat.status === "ok") { | |||
.then((res) => { | |||
if (res.status === "ok") { | |||
this.setState({ | |||
chat: chat.data, | |||
chat: res.data, | |||
}); | |||
} else { | |||
Setting.showMessage("error", `Failed to get chat: ${chat.msg}`); | |||
Setting.showMessage("error", `Failed to get chat: ${res.msg}`); | |||
} | |||
}); | |||
} | |||
@@ -1,17 +1,17 @@ | |||
// Copyright 2023 The casbin Authors. All Rights Reserved. | |||
// | |||
// Licensed under the Apache License, Version 2.0 (the "License"); | |||
// you may not use this file except in compliance with the License. | |||
// You may obtain a copy of the License at | |||
// | |||
// http://www.apache.org/licenses/LICENSE-2.0 | |||
// | |||
// Unless required by applicable law or agreed to in writing, software | |||
// distributed under the License is distributed on an "AS IS" BASIS, | |||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |||
// See the License for the specific language governing permissions and | |||
// limitations under the License. | |||
// Copyright 2023 The casbin Authors. All Rights Reserved. | |||
// | |||
// Licensed under the Apache License, Version 2.0 (the "License"); | |||
// you may not use this file except in compliance with the License. | |||
// You may obtain a copy of the License at | |||
// | |||
// http://www.apache.org/licenses/LICENSE-2.0 | |||
// | |||
// Unless required by applicable law or agreed to in writing, software | |||
// distributed under the License is distributed on an "AS IS" BASIS, | |||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |||
// See the License for the specific language governing permissions and | |||
// limitations under the License. | |||
import React from "react"; | |||
import * as Conf from "./Conf"; | |||
import * as WordsetBackend from "./backend/WordsetBackend"; | |||
@@ -33,11 +33,11 @@ class ClusteringPage extends React.Component { | |||
getWordset() { | |||
WordsetBackend.getWordset(Conf.DefaultOwner, Conf.DefaultWordsetName) | |||
.then((wordset) => { | |||
if (wordset.status === "ok") { | |||
this.setState({wordset: wordset.data}); | |||
.then((res) => { | |||
if (res.status === "ok") { | |||
this.setState({wordset: res.data}); | |||
} else { | |||
Setting.showMessage("error", `Failed to get wordset: ${wordset.msg}`); | |||
Setting.showMessage("error", `Failed to get wordset: ${res.msg}`); | |||
} | |||
}); | |||
} | |||
@@ -36,13 +36,13 @@ class FactorsetEditPage extends React.Component { | |||
getFactorset() { | |||
FactorsetBackend.getFactorset(this.props.account.name, this.state.factorsetName) | |||
.then((factorset) => { | |||
if (factorset.status === "ok") { | |||
.then((res) => { | |||
if (res.status === "ok") { | |||
this.setState({ | |||
factorset: factorset.data, | |||
factorset: res.data, | |||
}); | |||
} else { | |||
Setting.showMessage("error", `Failed to get factorset: ${factorset.msg}`); | |||
Setting.showMessage("error", `Failed to get factorset: ${res.msg}`); | |||
} | |||
}); | |||
} | |||
@@ -36,17 +36,17 @@ class FileTreePage extends React.Component { | |||
getStore() { | |||
StoreBackend.getStore(this.state.owner, this.state.storeName) | |||
.then((store) => { | |||
if (store.status === "ok") { | |||
if (store.data2 !== null && store.data?.includes("error")) { | |||
store.data.error = store.data2; | |||
.then((res) => { | |||
if (res.status === "ok") { | |||
if (res.data2 !== null && res.data?.includes("error")) { | |||
res.data.error = res.data2; | |||
} | |||
this.setState({ | |||
store: store.data, | |||
store: res.data, | |||
}); | |||
} else { | |||
Setting.showMessage("error", `Failed to get store: ${store.msg}`); | |||
Setting.showMessage("error", `Failed to get store: ${res.msg}`); | |||
} | |||
}); | |||
} | |||
@@ -33,17 +33,17 @@ class HomePage extends React.Component { | |||
getStore() { | |||
StoreBackend.getStore("admin", "_casibase_default_store_") | |||
.then((store) => { | |||
if (store.status === "ok") { | |||
if (store.data2 !== null && store.data2.includes("error")) { | |||
store.data.error = store.data2; | |||
.then((res) => { | |||
if (res.status === "ok") { | |||
if (res.data2 !== null && res.data2.includes("error")) { | |||
res.data.error = res.data2; | |||
} | |||
this.setState({ | |||
store: store.data, | |||
store: res.data, | |||
}); | |||
} else { | |||
Setting.showMessage("error", `Failed to get store: ${store.msg}`); | |||
Setting.showMessage("error", `Failed to get store: ${res.msg}`); | |||
} | |||
}); | |||
} | |||
@@ -42,52 +42,52 @@ class MessageEditPage extends React.Component { | |||
getChats() { | |||
ChatBackend.getChats(this.props.account.name) | |||
.then((chats) => { | |||
if (chats.status === "ok") { | |||
.then((res) => { | |||
if (res.status === "ok") { | |||
this.setState({ | |||
chats: chats.data, | |||
chats: res.data, | |||
}); | |||
} else { | |||
Setting.showMessage("error", `Failed to get chat: ${chats.msg}`); | |||
Setting.showMessage("error", `Failed to get chat: ${res.msg}`); | |||
} | |||
}); | |||
} | |||
getChat(chatName) { | |||
ChatBackend.getChat(this.props.account.name, chatName) | |||
.then((chat) => { | |||
if (chat.status === "ok") { | |||
.then((res) => { | |||
if (res.status === "ok") { | |||
this.setState({ | |||
chat: chat.data, | |||
chat: res.data, | |||
}); | |||
} else { | |||
Setting.showMessage("error", `Failed to get chat: ${chat.msg}`); | |||
Setting.showMessage("error", `Failed to get chat: ${res.msg}`); | |||
} | |||
}); | |||
} | |||
getMessage() { | |||
MessageBackend.getMessage(this.props.account.name, this.state.messageName) | |||
.then((message) => { | |||
if (message.status === "ok") { | |||
.then((res) => { | |||
if (res.status === "ok") { | |||
this.setState({ | |||
message: message.data, | |||
message: res.data, | |||
}); | |||
} else { | |||
Setting.showMessage("error", `Failed to get message: ${message.msg}`); | |||
Setting.showMessage("error", `Failed to get message: ${res.msg}`); | |||
} | |||
}); | |||
} | |||
getMessages() { | |||
MessageBackend.getMessages(this.props.account.name) | |||
.then((messages) => { | |||
if (messages.status === "ok") { | |||
.then((res) => { | |||
if (res.status === "ok") { | |||
this.setState({ | |||
messages: messages.data, | |||
messages: res.data, | |||
}); | |||
} else { | |||
Setting.showMessage("error", `Failed to get messages: ${messages.msg}`); | |||
Setting.showMessage("error", `Failed to get messages: ${res.msg}`); | |||
} | |||
}); | |||
} | |||
@@ -37,13 +37,13 @@ class ProviderEditPage extends React.Component { | |||
getProvider() { | |||
ProviderBackend.getProvider(this.props.account.name, this.state.providerName) | |||
.then((provider) => { | |||
if (provider.status === "ok") { | |||
.then((res) => { | |||
if (res.status === "ok") { | |||
this.setState({ | |||
provider: provider.data, | |||
provider: res.data, | |||
}); | |||
} else { | |||
Setting.showMessage("error", `Failed to get provider: ${provider.msg}`); | |||
Setting.showMessage("error", `Failed to get provider: ${res.msg}`); | |||
} | |||
}); | |||
} | |||
@@ -36,17 +36,17 @@ class StoreEditPage extends React.Component { | |||
getStore() { | |||
StoreBackend.getStore(this.state.owner, this.state.storeName) | |||
.then((store) => { | |||
if (store.status === "ok") { | |||
if (store.data2 !== null && store.data2.includes("error")) { | |||
store.data.error = store.data2; | |||
.then((res) => { | |||
if (res.status === "ok") { | |||
if (res.data2 !== null && res.data2.includes("error")) { | |||
res.data.error = res.data2; | |||
} | |||
this.setState({ | |||
store: store.data, | |||
store: res.data, | |||
}); | |||
} else { | |||
Setting.showMessage("error", `Failed to get store: ${store.msg}`); | |||
Setting.showMessage("error", `Failed to get store: ${res.msg}`); | |||
} | |||
}); | |||
} | |||
@@ -34,13 +34,13 @@ class VectorEditPage extends React.Component { | |||
getVector() { | |||
VectorBackend.getVector(this.props.account.name, this.state.vectorName) | |||
.then((vector) => { | |||
if (vector.status === "ok") { | |||
.then((res) => { | |||
if (res.status === "ok") { | |||
this.setState({ | |||
vector: vector.data, | |||
vector: res.data, | |||
}); | |||
} else { | |||
Setting.showMessage("error", `Failed to get vector: ${vector.msg}`); | |||
Setting.showMessage("error", `Failed to get vector: ${res.msg}`); | |||
} | |||
}); | |||
} | |||
@@ -47,18 +47,18 @@ class VideoEditPage extends React.Component { | |||
getVideo() { | |||
VideoBackend.getVideo(this.props.account.name, this.state.videoName) | |||
.then((video) => { | |||
if (video.status === "ok") { | |||
.then((res) => { | |||
if (res.status === "ok") { | |||
this.setState({ | |||
video: video.data, | |||
video: res.data, | |||
currentTime: 0, | |||
}); | |||
if (video.dataUrl !== "") { | |||
this.getDataAndParse(video.dataUrl); | |||
if (res.dataUrl !== "") { | |||
this.getDataAndParse(res.dataUrl); | |||
} | |||
} else { | |||
Setting.showMessage("error", `Failed to get video: ${video.msg}`); | |||
Setting.showMessage("error", `Failed to get video: ${res.msg}`); | |||
} | |||
}); | |||
} | |||
@@ -42,13 +42,13 @@ class WordsetEditPage extends React.Component { | |||
getWordset() { | |||
WordsetBackend.getWordset(this.props.account.name, this.state.wordsetName) | |||
.then((wordset) => { | |||
if (wordset.status === "ok") { | |||
.then((res) => { | |||
if (res.status === "ok") { | |||
this.setState({ | |||
wordset: wordset.data, | |||
wordset: res.data, | |||
}); | |||
} else { | |||
Setting.showMessage("error", `Failed to get wordset: ${wordset.msg}`); | |||
Setting.showMessage("error", `Failed to get wordset: ${res.msg}`); | |||
} | |||
}); | |||
} | |||
@@ -136,14 +136,14 @@ class WordsetEditPage extends React.Component { | |||
matchLoading: true, | |||
}); | |||
WordsetBackend.getWordsetMatch(this.props.account.name, this.state.wordsetName) | |||
.then((wordset) => { | |||
if (wordset.status === "ok") { | |||
.then((res) => { | |||
if (res.status === "ok") { | |||
this.setState({ | |||
wordset: wordset.data, | |||
wordset: res.data, | |||
matchLoading: false, | |||
}); | |||
} else { | |||
Setting.showMessage("error", `Failed to get wordset: ${wordset.msg}`); | |||
Setting.showMessage("error", `Failed to get wordset: ${res.msg}`); | |||
} | |||
}); | |||
}}>{i18next.t("wordset:Match")}</Button> | |||
@@ -84,17 +84,17 @@ class WordsetGraph extends React.Component { | |||
loading: true, | |||
}); | |||
WordsetBackend.getWordsetGraph("admin", this.state.wordsetName, this.state.clusterNumber, this.state.distanceLimit) | |||
.then((graph) => { | |||
if (graph.status === "ok") { | |||
.then((res) => { | |||
if (res.status === "ok") { | |||
this.setState({ | |||
graph: graph.data, | |||
graph: res.data, | |||
loading: false, | |||
selectedType: null, | |||
selectedId: null, | |||
selectedIds: [], | |||
}); | |||
} else { | |||
Setting.showMessage("error", `Failed to get wordset graph: ${graph.msg}`); | |||
Setting.showMessage("error", `Failed to get wordset graph: ${res.msg}`); | |||
} | |||
}); | |||
} | |||
@@ -1,17 +1,17 @@ | |||
// Copyright 2023 The casbin Authors. All Rights Reserved. | |||
// | |||
// Licensed under the Apache License, Version 2.0 (the "License"); | |||
// you may not use this file except in compliance with the License. | |||
// You may obtain a copy of the License at | |||
// | |||
// http://www.apache.org/licenses/LICENSE-2.0 | |||
// | |||
// Unless required by applicable law or agreed to in writing, software | |||
// distributed under the License is distributed on an "AS IS" BASIS, | |||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |||
// See the License for the specific language governing permissions and | |||
// limitations under the License. | |||
// Copyright 2023 The casbin Authors. All Rights Reserved. | |||
// | |||
// Licensed under the Apache License, Version 2.0 (the "License"); | |||
// you may not use this file except in compliance with the License. | |||
// You may obtain a copy of the License at | |||
// | |||
// http://www.apache.org/licenses/LICENSE-2.0 | |||
// | |||
// Unless required by applicable law or agreed to in writing, software | |||
// distributed under the License is distributed on an "AS IS" BASIS, | |||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |||
// See the License for the specific language governing permissions and | |||
// limitations under the License. | |||
import React from "react"; | |||
import * as WordsetBackend from "./backend/WordsetBackend"; | |||
import WordsetGraph from "./WordsetGraph"; | |||
@@ -33,13 +33,13 @@ class WordsetGraphPage extends React.Component { | |||
getWordset() { | |||
WordsetBackend.getWordset(this.props.account.name, this.state.wordsetName) | |||
.then((wordset) => { | |||
if (wordset.status === "ok") { | |||
.then((res) => { | |||
if (res.status === "ok") { | |||
this.setState({ | |||
wordset: wordset.data, | |||
wordset: res.data, | |||
}); | |||
} else { | |||
Setting.showMessage("error", `Failed to get wordset: ${wordset.msg}`); | |||
Setting.showMessage("error", `Failed to get wordset: ${res.msg}`); | |||
} | |||
}); | |||
} | |||