modified API error message for knowledge file cannot be removed from disk

pull/67/head
13621160019@163.com 2021-09-06 15:01:24 +08:00 committed by Caozhenhui
parent 14d0b7aa77
commit 16630dc30e
4 changed files with 20 additions and 6 deletions

View File

@ -834,6 +834,7 @@ function config($translateProvider) {
INVALID_VIRTUAL_METER_NAME: 'Invalid Virtual Meter Name',
INVALID_WEB_MESSAGE_ID: 'Invalid Web Message ID',
INVALID_WECHAT_MESSAGE_ID: 'Invalid Wechat Message ID',
KNOWLEDGE_FILE_CANNOT_BE_REMOVED_FROM_DISK: 'Knowledge File Cannot be Removed from Disk',
KNOWLEDGE_FILE_NOT_FOUND: 'Knowledge File Not Found',
MASTER_METER_DOES_NOT_BELONG_TO_SAME_ENERGY_CATEGORY: 'Master Meter Does Not Belong To Same Energy Category',
MASTER_METER_NOT_FOUND: 'Master Meter Not Found',
@ -1821,6 +1822,7 @@ function config($translateProvider) {
INVALID_VIRTUAL_METER_NAME: 'Invalid Virtual Meter Name',
INVALID_WEB_MESSAGE_ID: 'Invalid Web Message ID',
INVALID_WECHAT_MESSAGE_ID: 'Invalid Wechat Message ID',
KNOWLEDGE_FILE_CANNOT_BE_REMOVED_FROM_DISK: 'Knowledge File Cannot be Removed from Disk',
KNOWLEDGE_FILE_NOT_FOUND: 'Knowledge File Not Found',
MASTER_METER_DOES_NOT_BELONG_TO_SAME_ENERGY_CATEGORY: 'Master Meter Does Not Belong To Same Energy Category',
MASTER_METER_NOT_FOUND: 'Master Meter Not Found',
@ -2807,6 +2809,7 @@ function config($translateProvider) {
INVALID_VIRTUAL_METER_NAME: 'Invalid Virtual Meter Name',
INVALID_WEB_MESSAGE_ID: 'Invalid Web Message ID',
INVALID_WECHAT_MESSAGE_ID: 'Invalid Wechat Message ID',
KNOWLEDGE_FILE_CANNOT_BE_REMOVED_FROM_DISK: 'Knowledge File Cannot be Removed from Disk',
KNOWLEDGE_FILE_NOT_FOUND: 'Knowledge File Not Found',
MASTER_METER_DOES_NOT_BELONG_TO_SAME_ENERGY_CATEGORY: 'Master Meter Does Not Belong To Same Energy Category',
MASTER_METER_NOT_FOUND: 'Master Meter Not Found',

View File

@ -257,12 +257,11 @@ class KnowledgeFileItem:
file_uuid = row[0]
# Define file_path
file_path = os.path.join(config.upload_path, file_uuid)
# remove the file from disk
os.remove(file_path)
except Exception as ex:
raise falcon.HTTPError(falcon.HTTP_400, title='API.ERROR',
description='API.KNOWLEDGE_FILE_NOT_FOUND')
description='API.KNOWLEDGE_FILE_CANNOT_BE_REMOVED_FROM_DISK')
cursor.execute(" DELETE FROM tbl_knowledge_files WHERE id = %s ", (id_,))
cnx.commit()

17
web/README.md vendored
View File

@ -42,17 +42,26 @@ npx -v
```
* Open the “myems/web” directory with your cmd or terminal
* Run 'sudo npm i --unsafe-perm=true --allow-root'
```bash
cd myems/web
sudo npm i --unsafe-perm=true --allow-root
```
This command will download all the necessary dependencies for falcon in the node_modules directory.
* If you modified any scss files, then you need to compile SCSS
Run 'sudo npm run scss' command in your project directory to compile scss.
Run below command in your project directory to compile scss.
```bash
sudo npm run scss
```
* Run 'sudo npm start'
A local web server will start at http://localhost:3000.
We are using webpack and webpack-serve to automatically detect file changes. So, if you edit and save a file, your browser will automatically refresh and preview the change.
## Creating a Production Build
* Run 'sudo npm run build' command in your project directory to make the Production build.
* Run below command in your project directory to make the Production build.
```bash
sudo npm run build
```
This will create an optimized production build by compililing, merging and minifying all the source files as necessary and put them in the build/ folder.

View File

@ -597,6 +597,7 @@ const resources = {
"API.INVALID_VIRTUAL_METER_NAME": "Invalid virtual meter name",
"API.INVALID_WEB_MESSAGE_ID": "Invalid web message id",
"API.INVALID_WECHAT_MESSAGE_ID": "Invalid wechat message id",
"API.KNOWLEDGE_FILE_CANNOT_BE_REMOVED_FROM_DISK": "Knowledge File Cannot be Removed from Disk",
"API.KNOWLEDGE_FILE_NOT_FOUND": "Knowledge file not found",
"API.MASTER_METER_DOES_NOT_BELONG_TO_SAME_ENERGY_CATEGORY": "Master meter does not belong to same energy category",
"API.MASTER_METER_NOT_FOUND": "Master meter not found",
@ -1346,6 +1347,7 @@ const resources = {
"API.INVALID_VIRTUAL_METER_NAME": "",
"API.INVALID_WEB_MESSAGE_ID": "",
"API.INVALID_WECHAT_MESSAGE_ID": "",
"API.KNOWLEDGE_FILE_CANNOT_BE_REMOVED_FROM_DISK": "",
"API.KNOWLEDGE_FILE_NOT_FOUND": "",
"API.MASTER_METER_DOES_NOT_BELONG_TO_SAME_ENERGY_CATEGORY": "",
"API.MASTER_METER_NOT_FOUND": "",
@ -2095,6 +2097,7 @@ const resources = {
"API.INVALID_VIRTUAL_METER_NAME": "",
"API.INVALID_WEB_MESSAGE_ID": "",
"API.INVALID_WECHAT_MESSAGE_ID": "",
"API.KNOWLEDGE_FILE_CANNOT_BE_REMOVED_FROM_DISK": "",
"API.KNOWLEDGE_FILE_NOT_FOUND": "",
"API.MASTER_METER_DOES_NOT_BELONG_TO_SAME_ENERGY_CATEGORY": "",
"API.MASTER_METER_NOT_FOUND": "",