bdcontract-web-ide/js/codeManage/fileManage.js

71 lines
1.8 KiB
JavaScript

var onDeleteFile = function(obj) {
myToast("删除文件", obj.data);
if (obj.data == "success") {
listFiles();
listMemoryFiles();
}
};
var deleteYpk = function(){
if(global.ypkName == undefined || global.ypkName == "请选择ypk文件"){
myToast("提示","请先选择要删除的文件!");
return;
}
showDelete(global.ypkName);
};
var showDelete = function(projectName) {
var body = "<div class='input-group mb-3'>";
body += " <span class='input-group-text' >请确认是否删除:" + projectName
+ "?</span>";
body += " </div>";
$("#dialogBodyDiv").html(body);
showDialog("删除ypk文件", function() {
global.projectName = projectName;
deleteFile();
});
};
var deleteFile = function() {
var pingObj = {};
pingObj.file = global.projectName;
pingObj.action = "deleteFile";
pingObj.isCompiled = true;
pingObj.isPrivate = global.ypkIsPrivate;
global.filewssocket.send(JSON.stringify(pingObj));
};
var showDialog = function(title, cb) {
$("#dialogTitleH5").html(title);
$("#dialogConfimBtn").off("click").on("click", cb);
$("#dialog").modal("show");
};
var deleteMemoryFile = function(){
if(global.memoryFile == undefined || global.memoryFile == "选择时间"){
myToast("提示","请先选择要删除的文件!");
return;
}
showDeleteMemoryFile(global.memoryFile);
};
var showDeleteMemoryFile = function(projectName) {
var body = "<div class='input-group mb-3'>";
body += " <span class='input-group-text' >请确认是否删除:" + projectName
+ "?</span>";
body += " </div>";
$("#dialogBodyDiv").html(body);
showDialog("删除镜像文件", function() {
deleteFileMemoryFile();
});
};
var deleteFileMemoryFile = function() {
var pingObj = {};
pingObj.file = global.memoryFile;
pingObj.contractName = global.instanceName;
pingObj.action = "deleteMemoryFile";
global.wssocket.send(JSON.stringify(pingObj));
};