fixed issue when deleting offline meter file
parent
45414659df
commit
82479e8b18
|
@ -27,22 +27,22 @@ app.controller('OfflineMeterFileController', function($scope, $common, $cookies
|
||||||
},
|
},
|
||||||
'success': function(file, xhr) {
|
'success': function(file, xhr) {
|
||||||
//console.log('File success to upload from dropzone', 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 popType = 'TOASTER.SUCCESS';
|
||||||
var popTitle = $common.toaster.success_title;
|
var popTitle = $common.toaster.success_title;
|
||||||
var popBody = $common.toaster.success_add_body;
|
var popBody = $common.toaster.success_add_body;
|
||||||
|
|
||||||
popType = $translate.instant(popType);
|
popType = $translate.instant(popType);
|
||||||
popTitle = $translate.instant(popTitle);
|
popTitle = $translate.instant(popTitle);
|
||||||
popBody = $translate.instant(popBody,{template: templateName});
|
popBody = $translate.instant(popBody,{template: templateName});
|
||||||
|
|
||||||
toaster.pop({
|
toaster.pop({
|
||||||
type: popType,
|
type: popType,
|
||||||
title: popTitle,
|
title: popTitle,
|
||||||
body: popBody,
|
body: popBody,
|
||||||
showCloseButton: true,
|
showCloseButton: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
// toaster.pop({
|
// toaster.pop({
|
||||||
// type: 'success',
|
// type: 'success',
|
||||||
|
@ -77,15 +77,15 @@ app.controller('OfflineMeterFileController', function($scope, $common, $cookies
|
||||||
|
|
||||||
$scope.deleteOfflineMeterFile = function(offlinemeterfile) {
|
$scope.deleteOfflineMeterFile = function(offlinemeterfile) {
|
||||||
SweetAlert.swal({
|
SweetAlert.swal({
|
||||||
title: $translate.instant($common.sweet.title),
|
title: $translate.instant($common.sweet.title),
|
||||||
text: $translate.instant($common.sweet.text),
|
text: $translate.instant($common.sweet.text),
|
||||||
type: "warning",
|
type: "warning",
|
||||||
showCancelButton: true,
|
showCancelButton: true,
|
||||||
confirmButtonColor: "#DD6B55",
|
confirmButtonColor: "#DD6B55",
|
||||||
confirmButtonText: $translate.instant($common.sweet.confirmButtonText),
|
confirmButtonText: $translate.instant($common.sweet.confirmButtonText),
|
||||||
cancelButtonText: $translate.instant($common.sweet.cancelButtonText),
|
cancelButtonText: $translate.instant($common.sweet.cancelButtonText),
|
||||||
closeOnConfirm: true,
|
closeOnConfirm: true,
|
||||||
closeOnCancel: true
|
closeOnCancel: true
|
||||||
},
|
},
|
||||||
function(isConfirm) {
|
function(isConfirm) {
|
||||||
if (isConfirm) {
|
if (isConfirm) {
|
||||||
|
|
|
@ -208,8 +208,8 @@ class OfflineMeterFileItem:
|
||||||
# remove the file from disk
|
# remove the file from disk
|
||||||
os.remove(file_path)
|
os.remove(file_path)
|
||||||
except Exception as ex:
|
except Exception as ex:
|
||||||
raise falcon.HTTPError(falcon.HTTP_400, title='API.ERROR',
|
# ignore exception and don't return API.OFFLINE_METER_FILE_NOT_FOUND error
|
||||||
description='API.OFFLINE_METER_FILE_NOT_FOUND')
|
pass
|
||||||
|
|
||||||
# Note: the energy data imported from the deleted file will not be deleted
|
# 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_,))
|
cursor.execute(" DELETE FROM tbl_offline_meter_files WHERE id = %s ", (id_,))
|
||||||
|
|
Loading…
Reference in New Issue