diff --git a/admin/app/translations.js b/admin/app/translations.js index 11fb9c0b..1f6497fb 100644 --- a/admin/app/translations.js +++ b/admin/app/translations.js @@ -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', diff --git a/myems-api/core/knowledgefile.py b/myems-api/core/knowledgefile.py index 43946971..75154c46 100644 --- a/myems-api/core/knowledgefile.py +++ b/myems-api/core/knowledgefile.py @@ -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() diff --git a/web/README.md b/web/README.md index ad00db13..18b79969 100644 --- a/web/README.md +++ b/web/README.md @@ -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. diff --git a/web/src/i18n.js b/web/src/i18n.js index f10b33f6..9bf58b21 100644 --- a/web/src/i18n.js +++ b/web/src/i18n.js @@ -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": "",