fixed issue when deleting offline meter file

pull/19/MERGE
13621160019@163.com 2021-03-16 12:07:10 +08:00
parent 45414659df
commit 82479e8b18
2 changed files with 24 additions and 24 deletions

View File

@ -27,22 +27,22 @@ app.controller('OfflineMeterFileController', function($scope, $common, $cookies
},
'success': function(file, xhr) {
//console.log('File success to upload from dropzone', file, xhr);
var templateName = file.name;
var templateName = file.name;
var popType = 'TOASTER.SUCCESS';
var popTitle = $common.toaster.success_title;
var popBody = $common.toaster.success_add_body;
var popType = 'TOASTER.SUCCESS';
var popTitle = $common.toaster.success_title;
var popBody = $common.toaster.success_add_body;
popType = $translate.instant(popType);
popTitle = $translate.instant(popTitle);
popBody = $translate.instant(popBody,{template: templateName});
popType = $translate.instant(popType);
popTitle = $translate.instant(popTitle);
popBody = $translate.instant(popBody,{template: templateName});
toaster.pop({
type: popType,
title: popTitle,
body: popBody,
showCloseButton: true,
});
toaster.pop({
type: popType,
title: popTitle,
body: popBody,
showCloseButton: true,
});
// toaster.pop({
// type: 'success',
@ -77,15 +77,15 @@ app.controller('OfflineMeterFileController', function($scope, $common, $cookies
$scope.deleteOfflineMeterFile = function(offlinemeterfile) {
SweetAlert.swal({
title: $translate.instant($common.sweet.title),
text: $translate.instant($common.sweet.text),
type: "warning",
showCancelButton: true,
confirmButtonColor: "#DD6B55",
confirmButtonText: $translate.instant($common.sweet.confirmButtonText),
cancelButtonText: $translate.instant($common.sweet.cancelButtonText),
closeOnConfirm: true,
closeOnCancel: true
title: $translate.instant($common.sweet.title),
text: $translate.instant($common.sweet.text),
type: "warning",
showCancelButton: true,
confirmButtonColor: "#DD6B55",
confirmButtonText: $translate.instant($common.sweet.confirmButtonText),
cancelButtonText: $translate.instant($common.sweet.cancelButtonText),
closeOnConfirm: true,
closeOnCancel: true
},
function(isConfirm) {
if (isConfirm) {

View File

@ -208,8 +208,8 @@ class OfflineMeterFileItem:
# remove the file from disk
os.remove(file_path)
except Exception as ex:
raise falcon.HTTPError(falcon.HTTP_400, title='API.ERROR',
description='API.OFFLINE_METER_FILE_NOT_FOUND')
# ignore exception and don't return API.OFFLINE_METER_FILE_NOT_FOUND error
pass
# Note: the energy data imported from the deleted file will not be deleted
cursor.execute(" DELETE FROM tbl_offline_meter_files WHERE id = %s ", (id_,))