merge: merge changes in BaaS
This commit is contained in:
parent
c8758ecfdc
commit
12a1b701f7
718
BaaSOnlineIDE.html
Normal file
718
BaaSOnlineIDE.html
Normal file
@ -0,0 +1,718 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
<meta http-equiv="Cache-Control" content="no-cache"/>
|
||||
<title>数瑞智能合约在线编辑器</title>
|
||||
<script src="./jqueryui1.12/jquery-2.1.4.js"></script>
|
||||
<link href="./jqueryui1.12/jquery-ui.css" rel="stylesheet">
|
||||
<script src="./jqueryui1.12/jquery-ui.js"></script>
|
||||
<script src="./jqueryui1.12/jquery.ui.position.js"></script>
|
||||
<script src="./js/createWS.js"></script>
|
||||
<script src="./js/cryptico.js"></script>
|
||||
<script src="./js/commonutil.js"></script>
|
||||
<script src="./js/popper.min.js"></script>
|
||||
|
||||
|
||||
<script src="js/codemirror/lib/codemirror.js"></script>
|
||||
<link rel="stylesheet" href="js/codemirror/lib/codemirror.css">
|
||||
<link rel="stylesheet" href="js/codemirror/lib/ayu-mirage.css">
|
||||
<script src="js/codemirror/addon/edit/matchbrackets.js"></script>
|
||||
<script src="js/codemirror/addon/comment/continuecomment.js"></script>
|
||||
<script src="js/codemirror/addon/comment/comment.js"></script>
|
||||
<link rel="stylesheet" href="js/codemirror/addon/hint/show-hint.css">
|
||||
<script src="js/codemirror/addon/hint/show-hint.js"></script>
|
||||
<script src="js/codemirror/mode/clike/clike.js"></script>
|
||||
<script src="js/codemirror/mode/javascript/javascript.js"></script>
|
||||
<script src="js/codemirror/mode/css/css.js"></script>
|
||||
<script src="js/codemirror/mode/xml/xml.js"></script>
|
||||
|
||||
<script src="js/codemirror/lib/format.js"></script>
|
||||
<script src="js/onlineide/staticAnalysis.js"></script>
|
||||
<link href="./css/staticAnalysis.css" rel="stylesheet">
|
||||
|
||||
<script src="./js/bootstrap.min.js"></script>
|
||||
<!-- <script src="./js/echarts.min.js"></script>-->
|
||||
<!-- <script src="./js/echartsTheme.js"></script>-->
|
||||
<!-- <script src="./js/echarts-gl.min.js"></script>-->
|
||||
<script src="./js/sm2.js"></script>
|
||||
<!-- <script src="./js/d3.v5.min.js"></script>-->
|
||||
<!-- <script src="./js/dagre-d3.min.js"></script>-->
|
||||
<script src="./js/tipsy/jquery.tipsy.min.js"></script>
|
||||
|
||||
<link href="./js/tipsy/jquery.tipsy.css" rel="stylesheet">
|
||||
<!-- <script src="./js/jspdf.min.js"></script>-->
|
||||
<!-- <script src="./js/umd.js"></script>-->
|
||||
|
||||
<script src="./jqueryui1.12/jquery.contextMenu.js"></script>
|
||||
<link href="./jqueryui1.12/jquery.contextMenu.min.css" rel="stylesheet">
|
||||
|
||||
<script src="./js/OnlineIDE.js"></script>
|
||||
<script src="./js/onlineide/leftmenu.js"></script>
|
||||
<script src="./js/onlineide/rightmenu.js"></script>
|
||||
|
||||
<script src="./js/onlineide/projectman.js"></script>
|
||||
|
||||
|
||||
<script src="./js/vue.js"></script>
|
||||
<link rel="stylesheet" href="./css/bootstrap.min.css">
|
||||
<link rel="stylesheet" href="./css/loading.css">
|
||||
<link rel="stylesheet" href="./css/common.css">
|
||||
<style>
|
||||
.projectButton {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.projectButton.ui-state-active {
|
||||
background: #08263a;
|
||||
color: white;
|
||||
}
|
||||
|
||||
.projectTreeDiv {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.outputNav {
|
||||
overflow-yyyy: scroll;
|
||||
}
|
||||
|
||||
.nav-tabs .nav-link.active, .nav-tabs .nav-item.show .nav-link {
|
||||
color: white;
|
||||
background-color: #08263a;
|
||||
border-color: #08263a;
|
||||
}
|
||||
|
||||
.ui-tabs {
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.ui-accordion .ui-accordion-content {
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.ui-tabs .ui-tabs-panel {
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.ui-menu-item.ui-state-active:hover {
|
||||
background: #08263a;
|
||||
color: white;
|
||||
border: 1px solid #999;
|
||||
}
|
||||
|
||||
.ui-state-active, .ui-widget-content .ui-state-active, .ui-widget-header .ui-state-active,
|
||||
a.ui-button:active, .ui-button:active, .ui-button.ui-state-active:hover {
|
||||
background: #08263a;
|
||||
color: white;
|
||||
border: 1px solid #999;
|
||||
}
|
||||
|
||||
.context-menu-root {
|
||||
z-index: 10;
|
||||
}
|
||||
|
||||
.fileLine {
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
.fileLine:hover {
|
||||
background: #08263a;
|
||||
color: white;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
#expand:hover {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<header
|
||||
class="headerFooter navbar navbar-default navbar-fixed-top navColor ">
|
||||
<div class="col-4">
|
||||
<a class="navbar-brand" href="#"> <img alt="Brand"
|
||||
src="./images/logo-1.png" style="height: 30px;">
|
||||
</a> <span>数瑞智能合约在线编辑器</span><input id="uploadFileInput" type="file"
|
||||
name="file" multiple onchange="uploadFile()" style="display: none;">
|
||||
</div>
|
||||
<div class="nav navbar-right userName" data-toggle="modal"
|
||||
data-target="#pubkeyDialog">欢迎, {{shortName}}
|
||||
</div>
|
||||
</header>
|
||||
<div class="container-fluid" id="main">
|
||||
<div class="row h-100">
|
||||
<div class="col-2 h-100" id="horiNav">
|
||||
<div class="container-fluid d-flex flex-column h-100">
|
||||
<div class="row" style="display: none;">
|
||||
<div class="col-12" style="padding: 0">
|
||||
<ul class="nav nav-tabs" role="tablist">
|
||||
<li class="nav-item"><a class="nav-link"
|
||||
id="publicprojecttab" data-toggle="tab" role="tab"
|
||||
aria-controls="publicproject" aria-selected="false"
|
||||
href="#publicproject" onclick="updateGlobalProject()">公共</a></li>
|
||||
<li class="nav-item"><a class="nav-link active"
|
||||
id="privateprojecttab" data-toggle="tab" role="tab"
|
||||
aria-selected="true" aria-controls="privateproject"
|
||||
href="#privateproject" onclick="updateGlobalProject()">私有</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<!-- <div class="input-group mt-1 mb-3">-->
|
||||
<!-- <button class="btn btn-block btn-outline-primary" type="button"-->
|
||||
<!-- id="button-addon2" onclick="createProject()">新建项目 +-->
|
||||
<!-- </button>-->
|
||||
<!-- </div>-->
|
||||
</div>
|
||||
<div class="row"
|
||||
style="flex: 1 1 auto; overflow-y: auto; overflow-x: hidden;">
|
||||
<div class="col-sm-12 h-100 "
|
||||
style="overflow-y: scroll; overflow-x: hidden">
|
||||
<div class="row">
|
||||
<div class="col-12" style="padding: 0; overflow-x: visible">
|
||||
<div class="tab-content">
|
||||
<!-- <div class="tab-pane fade" role="tabpanel"-->
|
||||
<!-- aria-labelledby="publicprojecttab" id="publicproject">-->
|
||||
<!-- <div id="publicprojectAccordion" class="accordion"></div>-->
|
||||
<!-- </div>-->
|
||||
<div class="tab-pane fade show active" id="privateproject" role="tabpanel"
|
||||
aria-labelledby="privateprojecttab" style="">
|
||||
<div id="privateprojectAccordion" class="accordion"></div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-8 h-100" style="padding: 0;" id="mainBox">
|
||||
<div class="container-fluid d-flex flex-column h-100">
|
||||
<div class="row mt-1">
|
||||
<div class="col-sm-12">
|
||||
<div class="btn-toolbar" role="toolbar"
|
||||
aria-label="Toolbar with button groups">
|
||||
<div class="btn-group mr-2" role="group"
|
||||
aria-label="First group">
|
||||
|
||||
<button type="button" class=" btn btn-outline-primary"
|
||||
data-toggle="tooltip" title="保存" onclick="saveFile()">
|
||||
<img alt="Brand" src="./images/onlineide/save.png"
|
||||
class="buttonimg">
|
||||
</button>
|
||||
<button type="button" class=" btn btn-outline-primary"
|
||||
data-toggle="tooltip" title="格式化"
|
||||
onclick="formatScriptEditor()">
|
||||
<img alt="Brand" src="./images/onlineide/formatter.png"
|
||||
class="buttonimg">
|
||||
</button>
|
||||
<!-- <button type="button" class=" btn btn-outline-primary"-->
|
||||
<!-- data-toggle="tooltip" title="静态分析" onclick="staticVerify()"-->
|
||||
<!-- onclick="showAnalysis()">-->
|
||||
<!-- <img alt="Brand" src="./images/onlineide/find.png"-->
|
||||
<!-- class="buttonimg">-->
|
||||
<!-- </button>-->
|
||||
<button type="button" class=" btn btn-outline-primary"
|
||||
data-toggle="tooltip" title="编译" onclick="compile()">
|
||||
<img alt="Brand" src="./images/onlineide/archive.png"
|
||||
class="buttonimg">
|
||||
</button>
|
||||
|
||||
<button type="button" class=" btn btn-outline-primary"
|
||||
data-toggle="tooltip" title="注册DOI" onclick="registerDOI()">
|
||||
<img alt="Brand" src="./images/onlineide/register.png"
|
||||
class="buttonimg">
|
||||
</button>
|
||||
|
||||
<button type="button" class="btn btn-outline-primary"
|
||||
title="生成文档" data-toggle="tooltip" onclick="genReadme()">
|
||||
<img alt="Brand" src="./images/onlineide/readme.png"
|
||||
class="buttonimg">
|
||||
</button>
|
||||
|
||||
</div>
|
||||
<div class="btn-group mr-2" role="group"
|
||||
aria-label="First group">
|
||||
<!-- <button type="button" class=" btn btn-outline-primary"
|
||||
data-toggle="tooltip" title="gasPrice" onclick="saveFile()">
|
||||
<img alt="Brand" src="./images/onlineide/price.png"
|
||||
class="buttonimg">
|
||||
</button>
|
||||
|
||||
<button type="button" class=" btn btn-outline-primary"
|
||||
data-toggle="tooltip" title="gasLimit">
|
||||
<img alt="Brand" src="./images/onlineide/price.png"
|
||||
class="buttonimg">
|
||||
</button> -->
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="row mt-1">
|
||||
<div class="col-sm-12">
|
||||
<ul class="nav nav-tabs .bg-primary" id="myFileTab"
|
||||
role="tablist">
|
||||
<li class="nav-item" v-for="(item,index) in openedFiles"><a
|
||||
class="nav-link" data-toggle="tab" t role="tab"
|
||||
onclick="clickTab(this)" :path='item.path'><span
|
||||
data-toggle="tooltip">{{item.name}}</span><img alt="Brand"
|
||||
class="closeimg ml-2"
|
||||
src="./images/onlineide/close.png"
|
||||
onclick="closeTab(this)"
|
||||
:path='item.path'/></a></li>
|
||||
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="box" style="overflow:auto; height:100%">
|
||||
<div id="contractCode" class="flex-grow-1" style="height:100%">
|
||||
<div id="textareaDiv" class="col-sm-12" style="width: 100%; height: 100%; padding:0">
|
||||
<textarea id="scriptEditor" style="width: 100%; height: 100%"
|
||||
class="form-control "></textarea>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="resize"
|
||||
style="height: 5px; background-color: lightgrey; display:none; cursor: s-resize"></div>
|
||||
<div id="analysis" class="col-sm-12" style="display:none; height: 50%">
|
||||
<div class="input-group mt-1 mb-3">
|
||||
<div class="input-group-prepepnd">
|
||||
<button data-toggle="tooltip" class="btn btn-outline-primary" type="image"
|
||||
onclick="staticAnalysis()"
|
||||
title="查看分析结果">
|
||||
<img src="./images/onlineide/execute.png" class="buttonimg"/>
|
||||
</button>
|
||||
|
||||
</div>
|
||||
<select id="selectRule" class="custom-select"
|
||||
style="appearance: none; -webkit-appearance:none;">
|
||||
<option selected>请选择数据开放规则</option>
|
||||
<option value="byValue">数据依赖开放</option>
|
||||
<option value="control">控制依赖开放</option>
|
||||
<option value="byValueAndControl">数据与控制依赖开放</option>
|
||||
<option value="close">不开放</option>
|
||||
</select>
|
||||
<div class="input-group-appepnd">
|
||||
<select id="selectSource" class="custom-select"
|
||||
style="appearance: none; -webkit-appearance:none;">
|
||||
<option selected>请选择数据源</option>
|
||||
<option value="originalData">参数</option>
|
||||
<option value="contractCall">合约调用</option>
|
||||
<option value="originalDataAndContractCall">参数及调用</option>
|
||||
|
||||
</select>
|
||||
</div>
|
||||
<div class="input-group-appepnd">
|
||||
<select class="custom-select" style="appearance: none"
|
||||
id="analysisFunction" onchange="showAnalysisResult()">
|
||||
<option selected value="">选择方法</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-sm-12">
|
||||
控制流图:<span id="svg-control-name"> </span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row h-100">
|
||||
<div class="col-sm-12">
|
||||
<svg id="svgCanvas"
|
||||
style="width:100%; height:100%;border:1px solid #ced4da;border-radius:.25rem"></svg>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-sm-12 mt-3">
|
||||
分析结果:
|
||||
<textarea id="ret" class="form-control"
|
||||
style="width: 100%; height: 200px;"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="col-2 h-100"
|
||||
style="transient: width 2s, height 2s, background-color 2s, transform 2s;"
|
||||
id="outputNav">
|
||||
<ul class="nav nav-tabs" id="myTab" role="tablist">
|
||||
<li class="nav-item"><span id="expand" class="mr-3"
|
||||
onclick="expandOrCollapse()">展开</span></li>
|
||||
<li class="nav-item"><a class="nav-link active"
|
||||
id="deploy-tab" data-toggle="tab" href="#deploy" role="tab"
|
||||
aria-controls="deploy" aria-selected="true">部署</a></li>
|
||||
<li class="nav-item"><a class="nav-link" id="execute-tab"
|
||||
data-toggle="tab" href="#execute" role="tab"
|
||||
aria-controls="execute" aria-selected="false"
|
||||
onclick="initResponseAndOutputArea()">执行</a></li>
|
||||
|
||||
</ul>
|
||||
<div class="tab-content outputNav" id="myTabContent">
|
||||
<div class="tab-pane fade show active" id="deploy" role="tabpanel"
|
||||
aria-labelledby="deploy-tab">
|
||||
<div class="input-group mt-1 mb-1" style="display: none;">
|
||||
<select class="custom-select" style="appearance: none"
|
||||
v-model="pubDialogVue.selectedSM2Key">
|
||||
<option v-for="(item,index) in pubDialogVue.sm2KeyList"
|
||||
:key="index" :value='item.id'>{{item.title}}
|
||||
</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="input-group mb-1">
|
||||
<select class="custom-select " id="selectedProject"
|
||||
aria-label="Example select with button addon"
|
||||
style="appearance: none">
|
||||
<option v-for="(item,index) in projects" :key="index"
|
||||
:value='index'>{{item}}
|
||||
</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="input-group mt-1">
|
||||
<button class="btn btn-block btn-outline-primary"
|
||||
onclick="startContractAsDebug()" type="button" id="button-addon2"
|
||||
title="启动" data-toggle="tooltip">
|
||||
<img alt="Brand" src="./images/onlineide/start.png"
|
||||
class="buttonimg">
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="input-group mt-1 mb-3">
|
||||
<span id="startResult"> </span>
|
||||
</div>
|
||||
|
||||
<div class="input-group mb-1">
|
||||
|
||||
<select class="custom-select " id="selectedContract"
|
||||
aria-label="Example select with button addon"
|
||||
style="appearance: none">
|
||||
<option v-for="(item,index) in contracts" :key="index"
|
||||
:value='index'>{{item.name}}
|
||||
</option>
|
||||
</select>
|
||||
<div class="input-group-append">
|
||||
<button type="button" class="btn btn-outline-primary"
|
||||
title="预览" data-toggle="tooltip" onclick="openinClient()">
|
||||
<img alt="Brand" src="./images/onlineide/preview.png"
|
||||
class="buttonimg">
|
||||
</button>
|
||||
<button type="button" class="btn btn-outline-primary"
|
||||
title="停止当前" data-toggle="tooltip" onclick="stopContract()">
|
||||
<img alt="Brand" src="./images/onlineide/kill.png"
|
||||
class="buttonimg">
|
||||
</button>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- <div class="input-group mb-1">-->
|
||||
<!-- <div class="btn-group btn-block" role="group">-->
|
||||
<!-- <button class="btn btn-outline-primary" type="button"-->
|
||||
<!-- id="button-addon2" title="刷新列表" onclick="listContracts()"-->
|
||||
<!-- data-toggle="tooltip">-->
|
||||
<!-- <img src="./images/onlineide/refresh.png" class="buttonimg"/>-->
|
||||
<!-- </button>-->
|
||||
<!-- <button type="button" class="btn btn-outline-primary"-->
|
||||
<!-- title="数据预览" data-toggle="tooltip" onclick="genData()">-->
|
||||
<!-- <img alt="Brand" src="./images/onlineide/data.png"-->
|
||||
<!-- class="buttonimg">-->
|
||||
<!-- </button>-->
|
||||
<!-- <button type="button" class="btn btn-outline-primary"-->
|
||||
<!-- title="查询当前合约DOI" data-toggle="tooltip"-->
|
||||
<!-- onclick="queryContractInstanceDOI()">DOI-->
|
||||
<!-- </button>-->
|
||||
<!-- </div>-->
|
||||
<!-- </div>-->
|
||||
|
||||
<div class="input-group mt-1 mb-3">
|
||||
<span id="stopResult"> </span>
|
||||
</div>
|
||||
<div class="input-group mb-1"></div>
|
||||
|
||||
<!-- <div class="input-group mb-3">-->
|
||||
<!-- <input type="text" class="form-control"-->
|
||||
<!-- id="contractInstanceDOIInput" placeholder="合约实例DOI"></input>-->
|
||||
<!-- <div class="input-group-append">-->
|
||||
<!-- <button class="btn btn-outline-primary"-->
|
||||
<!-- onclick="queryContractInstanceInfoByDOI()" type="button" data-toggle="tooltip"-->
|
||||
<!-- title="查询合约实例信息" id="button-addon2">查询-->
|
||||
<!-- </button>-->
|
||||
<!-- </div>-->
|
||||
<!-- <div class="input-group-append">-->
|
||||
<!-- <button class="btn btn-outline-primary"-->
|
||||
<!-- onclick="importContractInstanceCodeByDOI()" type="button" data-toggle="tooltip"-->
|
||||
<!-- title="导入合约实例代码" id="button-addon2">导入-->
|
||||
<!-- </button>-->
|
||||
<!-- </div>-->
|
||||
<!-- </div>-->
|
||||
<!-- <div class="row">-->
|
||||
<!-- <div class="col-sm-12">-->
|
||||
<!-- 查询结果:<span id="contractInstanceInfoTitle"> </span>-->
|
||||
<!-- </div>-->
|
||||
<!-- </div>-->
|
||||
<!-- <div class="row">-->
|
||||
<!-- <div class="col-sm-12" id="contractInstanceInfoAreaDiv">-->
|
||||
<!-- <textarea id="contractInstanceInfoArea" class="form-control"-->
|
||||
<!-- style="width: 100%; height: 150px;"></textarea>-->
|
||||
<!-- </div>-->
|
||||
<!-- </div>-->
|
||||
</div>
|
||||
<div class="tab-pane fade" id="execute" role="tabpanel"
|
||||
aria-labelledby="execute-tab">
|
||||
<div class="input-group mt-1 mb-1">
|
||||
<select class="custom-select " id="selectedContractAtExecute"
|
||||
aria-label="Example select with button addon"
|
||||
style="appearance: none" onchange="selectContractToExecute()">
|
||||
<option selected>选择实例</option>
|
||||
<option v-for="(item,index) in contracts" :key="index"
|
||||
:value='index'>{{item.name}}
|
||||
</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="input-group mb-1">
|
||||
<select class="custom-select" style="appearance: none"
|
||||
id="selectedFunction">
|
||||
<option selected>选择方法</option>
|
||||
<option v-for="(item,index) in contractFunctions" :key="index"
|
||||
:value='index'>{{item.functionName}}
|
||||
</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="input-group mb-3">
|
||||
<input type="text" class="form-control"
|
||||
id="executeContractArgInput" placeholder="填写参数"></input>
|
||||
<div class="input-group-append">
|
||||
<button class="btn btn-outline-primary"
|
||||
onclick="executeContract()" type="button" data-toggle="tooltip"
|
||||
title="调用" id="button-addon2">
|
||||
<img src="./images/onlineide/execute.png" class="buttonimg"/>
|
||||
</button>
|
||||
</div>
|
||||
<!-- <div class="input-group-append">-->
|
||||
<!-- <button class="btn btn-outline-primary"-->
|
||||
<!-- onclick="executeContractWithDynamicResult()" type="button"-->
|
||||
<!-- data-toggle="tooltip" title="动态分析" id="button-addon2">-->
|
||||
<!-- <img src="./images/onlineide/analysis.png" class="buttonimg"/>-->
|
||||
<!-- </button>-->
|
||||
<!-- </div>-->
|
||||
<!-- <div class="input-group-append">-->
|
||||
<!-- <button class="btn btn-outline-primary"-->
|
||||
<!-- onclick="testEvaluates()" type="button"-->
|
||||
<!-- data-toggle="tooltip" title="gas预估" id="button-addon2">-->
|
||||
<!-- <img src="./images/onlineide/budget.png" class="buttonimg"/>-->
|
||||
<!-- </button>-->
|
||||
<!-- </div>-->
|
||||
|
||||
</div>
|
||||
|
||||
<div class="input-group mb-3">
|
||||
<input type="text" class="form-control" id="gasLimit" placeholder="请输入合约执行消耗的gas上限"
|
||||
aria-label="maximum gas to be used" aria-describedby="button-addon2">
|
||||
<!-- <div cldialogBodyDivass="input-group-append">-->
|
||||
<!-- <button class="btn btn-outline-primary"-->
|
||||
<!-- onclick="getGasValue()" type="button"-->
|
||||
<!-- data-toggle="tooltip" title="提交gas值" id="button-addon2">确定-->
|
||||
<!-- </button>-->
|
||||
<!-- </div>-->
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-sm-12">
|
||||
执行结果:<span id="executeResultTitle"> </span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-sm-12" id="responseAreaDiv">
|
||||
<textarea id="responseArea" class="form-control"
|
||||
style="width: 100%; height: 200px;"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-sm-12 mt-3" id="outputStreamAreaDiv">
|
||||
控制台输出:
|
||||
<textarea id="outputStreamArea" class="form-control"
|
||||
style="width: 100%; height: 200px;"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- 用于配置sm2密钥的对话框 -->
|
||||
<div class="modal fade" id="pubkeyDialog" tabindex="-1" role="dialog"
|
||||
aria-labelledby="exampleModalCenterTitle" aria-hidden="true">
|
||||
<div class="modal-dialog modal-dialog-centered" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title" id="exampleModalLongTitle">用户信息</h5>
|
||||
<button type="button" class="close" data-dismiss="modal"
|
||||
aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="row" style="padding-left: 16px; padding-right: 16px">
|
||||
<div class="input-group mb-3">
|
||||
<div class="input-group-prepend">
|
||||
<label class="input-group-text" for="localKeyList">本地公钥</label>
|
||||
</div>
|
||||
<select class="custom-select"
|
||||
aria-label="Example select with button addon"
|
||||
style="appearance: none" v-model="selectedSM2Key"
|
||||
@change="changeSM2Key($event)">
|
||||
<option v-for="(item,index) in sm2KeyList" :key="index"
|
||||
:value='item.id'>{{item.title}}
|
||||
</option>
|
||||
</select>
|
||||
<div class="input-group-append">
|
||||
<button class="btn btn-outline-primary" for="localKeyList"
|
||||
v-on:click="exportPubkey">导出公钥
|
||||
</button>
|
||||
</div>
|
||||
<div class="input-group-append">
|
||||
<button class="btn btn-outline-danger" for="localKeyList"
|
||||
v-on:click="deletePubkey">删除公钥
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row" style="padding-left: 16px; padding-right: 16px">
|
||||
|
||||
<div class="input-group mb-1">
|
||||
<div class="input-group-prepend">
|
||||
<label class="input-group-text" for="localKeyList">当前SM2密钥</label>
|
||||
</div>
|
||||
<input type="text" class="form-control" placeholder="(请复制并妥善保存)"
|
||||
disabled="disabled" aria-label=""
|
||||
aria-describedby="basic-addon1">
|
||||
|
||||
<div class="input-group-append">
|
||||
<button type="button" class="btn btn-outline-primary"
|
||||
id="generatePubkeyBtn" v-on:click="generatePubkey">生成新公钥
|
||||
</button>
|
||||
<button type="button" class="btn btn-outline-primary"
|
||||
data-dismiss="modal" id="importPubkeyBtn"
|
||||
v-on:click="importPubkey">导入公钥
|
||||
</button>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<textarea class="form-control mb-3" title="复制密钥,并妥善保存"
|
||||
id="sm2KeyTextarea" v-model="sm2KeyStr"
|
||||
style="width: 100%; min-height: 150px" rows="" cols="">
|
||||
</textarea>
|
||||
<div class="row" style="padding-left: 16px; padding-right: 16px;">
|
||||
|
||||
</div>
|
||||
<div class="row" style="padding-left: 16px; padding-right: 16px">
|
||||
<span>我的权限:{{myRole}}</span>
|
||||
</div>
|
||||
<div class="input-group">
|
||||
<select id="inputGroupSelect04" v-model="test"
|
||||
class="custom-select" style="appearance: none"
|
||||
@change="changeProduct($event)">
|
||||
<option v-for="(item,index) in productList" :key="index"
|
||||
:value='item.id'>{{item.title}}
|
||||
</option>
|
||||
</select>
|
||||
<div class="input-group-append">
|
||||
<button class="btn btn-outline-primary" type="button"
|
||||
v-on:click="applyRole">角色认证
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<!-- Flexbox container for aligning the toasts -->
|
||||
<div aria-live="polite" aria-atomic="true"
|
||||
class="d-flex justify-content-center align-items-center"
|
||||
style="dispaly: none; height:0px; min-height: 200px; position: absolute; top: 30%; left: 40%;"
|
||||
aria-hidden="true">
|
||||
<!-- Then put toasts within -->
|
||||
<div id="alertDiv" class="toast" role="alert" data-delay="3000"
|
||||
aria-live="assertive" aria-atomic="true" style="min-width: 200px">
|
||||
<div class="toast-header">
|
||||
<strong class="mr-auto">{{toastTitle}}</strong>
|
||||
<button type="button" class="ml-2 mb-1 close" data-dismiss="toast"
|
||||
aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="toast-body">{{toastMessage}}</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal fade" id="dialog" tabindex="-1" role="dialog"
|
||||
aria-labelledby="exampleModalLabel" aria-hidden="true">
|
||||
<div class="modal-dialog" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title" id="dialogTitleH5">Modal title</h5>
|
||||
<button type="button" class="close" data-dismiss="modal"
|
||||
aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="modal-body" id="dialogBodyDiv">...</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-outline-secondary"
|
||||
id="dialogCloseBtn" data-dismiss="modal">关闭
|
||||
</button>
|
||||
<button type="button" id="dialogConfimBtn"
|
||||
class="btn btn-outline-primary" data-dismiss="modal">确定
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<footer class="headerFooter" footermt-autopy-3>
|
||||
<div class="row">
|
||||
<div style="padding-left: -10px;" class="col-2">©2018-2020</div>
|
||||
<div style="" class="col-6" id="hashDisplayDiv"></div>
|
||||
<div style="" class="col-4">
|
||||
Icons made by <a href="https://www.flaticon.com/authors/monkik"
|
||||
title="monkik" style="color: white;">monkik</a> and <a
|
||||
href="https://www.flaticon.com/authors/those-icons"
|
||||
title="Those Icons" style="color: white;">Those Icons</a> from <a
|
||||
href="https://www.flaticon.com/" title="Flaticon"
|
||||
style="color: white;">www.flaticon.com</a>
|
||||
</div>
|
||||
</div>
|
||||
</footer>
|
||||
|
||||
|
||||
<script>
|
||||
var h = document.body.clientHeight
|
||||
- $("header").css("height").replace("px", "")
|
||||
- $("footer").css("height").replace("px", "");
|
||||
$("#main").css("height", h + "px");
|
||||
init();
|
||||
|
||||
//initWSocket();
|
||||
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
@ -156,7 +156,7 @@ function onSessionID(data) {
|
||||
const loginParam = {
|
||||
action: "login",
|
||||
pubKey: global.sm2Key.publicKey,
|
||||
signature: sm2.doSignature(global.session, global.sm2Key.privateKey,{hash:true,der:true})
|
||||
signature: sm2.doSignature(global.session, global.sm2Key.privateKey, {hash: true, der: true})
|
||||
};
|
||||
global.wssocket.send(JSON.stringify(loginParam));
|
||||
}
|
||||
@ -309,8 +309,8 @@ function onListContractProcess(data) {
|
||||
|
||||
mainVue.contracts = [];
|
||||
var list = JSON.parse(data.data);
|
||||
for (var i=0;i<list.length;i++){
|
||||
if (list[i].contractStatus != "KILLED"){
|
||||
for (var i = 0; i < list.length; i++) {
|
||||
if (list[i].contractStatus != "KILLED") {
|
||||
mainVue.contracts.push(list[i]);
|
||||
}
|
||||
}
|
||||
@ -359,11 +359,11 @@ function onExecuteResult(obj) {
|
||||
const data = obj;
|
||||
$("#executeResultTitle")
|
||||
.html(data.status + " (" + obj.executeTime + "ms) 未知格式");
|
||||
if (data.result instanceof Object){
|
||||
if (data.result instanceof Object) {
|
||||
$("#executeResultTitle")
|
||||
.html(data.status + " (" + obj.executeTime + "ms) JSON格式");
|
||||
global.responseEditor.setValue(JSON.stringify(data.result));
|
||||
} else if (typeof data.result == 'string'){
|
||||
} else if (typeof data.result == 'string') {
|
||||
$("#executeResultTitle")
|
||||
.html(data.status + " (" + obj.executeTime + "ms) 字符串格式");
|
||||
global.responseEditor.setValue(data.result);
|
||||
@ -394,7 +394,7 @@ function onExecuteResult(obj) {
|
||||
|
||||
function onGenerateReadme(obj) {
|
||||
// console.log(obj.data);
|
||||
myToast("生成文档结果",obj.data);
|
||||
myToast("生成文档结果", obj.data);
|
||||
}
|
||||
|
||||
function onHashResult(obj) {
|
||||
@ -460,8 +460,9 @@ function showDialog(title, cb, cancelcb) {
|
||||
|
||||
function init() {
|
||||
console.log("[nodecenterManagement.js] init : ");
|
||||
const urlParams = getRequestParameters();
|
||||
initVue();
|
||||
initGlobal();
|
||||
initGlobal(urlParams);
|
||||
initWSocket();
|
||||
$('[data-toggle="tooltip"]').tooltip();
|
||||
const scriptEditor = $("#scriptEditor");
|
||||
@ -474,10 +475,32 @@ function init() {
|
||||
lineWrapping: true
|
||||
});
|
||||
global.scriptEditor.setSize("height", height);
|
||||
|
||||
}
|
||||
|
||||
function getRequestParameters() {
|
||||
if (location.href.indexOf("/BaaSOnlineIDE.html") !== -1) {
|
||||
let params = location.href.replace(/[^#]*(#(\/)?|\?)/, '')
|
||||
let url = location.href.replace(params, '')
|
||||
while (!params) {
|
||||
url = url.replace(/(#(\/)?|\?)$/, '')
|
||||
params = url.replace(/[^#]*(#(\/)?|\?)/, '')
|
||||
url = url.replace(params, '')
|
||||
}
|
||||
if (url.endsWith('#') || url.endsWith('#\/')) {
|
||||
let sKey = Math.random().toString()
|
||||
localStorage.setItem(sKey, params)
|
||||
location.href = url.replace(/#(\/)?/, '?' + sKey)
|
||||
} else {
|
||||
let json = atob(localStorage.getItem(params))
|
||||
try {
|
||||
return JSON.parse(json);
|
||||
} catch (e) {
|
||||
localStorage.removeItem(params)
|
||||
alert('链接失效!')
|
||||
location.href = location.origin
|
||||
}
|
||||
}
|
||||
} else {
|
||||
let arr = (location.search || "").replace(/^\?/, '').split("&");
|
||||
let params = {};
|
||||
for (let sd of arr) {
|
||||
@ -487,4 +510,5 @@ function getRequestParameters() {
|
||||
}
|
||||
}
|
||||
return params;
|
||||
}
|
||||
}
|
@ -3,7 +3,7 @@ function getDateDaysBefore(daysAgo) {
|
||||
return new Date(dateStr).getTime() - daysAgo * 24 * 3600 * 1000;
|
||||
}
|
||||
|
||||
const primaryColor = "#2E324C";
|
||||
let primaryColor = "#2E324C";
|
||||
|
||||
// ======Vue start
|
||||
let headerVue = "";
|
||||
@ -41,11 +41,17 @@ function initVue() {
|
||||
if (!sm2Key.publicKey || !sm2Key.privateKey) {
|
||||
this.sm2KeyStr = (JSON.stringify(global.sm2Key));
|
||||
} else {
|
||||
if (sm2Key.publicKey.search("\\.") != -1 || sm2Key.publicKey.search("\\.\\.") != -1 || sm2Key.publicKey.search("/") != -1 || sm2Key.publicKey.search("\\\\") != -1) {
|
||||
if (sm2Key.publicKey.search("\\.") !== -1 ||
|
||||
sm2Key.publicKey.search("\\.\\.") !== -1 ||
|
||||
sm2Key.publicKey.search("/") !== -1 ||
|
||||
sm2Key.publicKey.search("\\\\") !== -1) {
|
||||
myToast("导入失败", "不是合法的公钥!");
|
||||
return;
|
||||
}
|
||||
if (sm2Key.privateKey.search("\\.") != -1 || sm2Key.privateKey.search("\\.\\.") != -1 || sm2Key.privateKey.search("/") != -1 || sm2Key.privateKey.search("\\\\") != -1) {
|
||||
if (sm2Key.privateKey.search("\\.") !== -1 ||
|
||||
sm2Key.privateKey.search("\\.\\.") !== -1 ||
|
||||
sm2Key.privateKey.search("/") !== -1 ||
|
||||
sm2Key.privateKey.search("\\\\") !== -1) {
|
||||
myToast("导入失败", "不是合法的私钥!");
|
||||
return;
|
||||
}
|
||||
@ -194,15 +200,24 @@ function initVue() {
|
||||
|
||||
// ======Vue done
|
||||
|
||||
function initGlobal() {
|
||||
function initGlobal(urlParams) {
|
||||
window.global = {};
|
||||
global.sm2Key = localStorage.getItem("PrivKey");
|
||||
global.result = "";
|
||||
if (location.href.indexOf("/BaaSOnlineIDE.html") !== -1) {
|
||||
global.isBaaS = true
|
||||
primaryColor = "#08263a"
|
||||
}
|
||||
if (urlParams) {
|
||||
global.urlparam = urlParams
|
||||
global.sm2Key = urlParams.keys
|
||||
} else {
|
||||
global.sm2Key = localStorage.getItem("PrivKey");
|
||||
if (!global.sm2Key || global.sm2Key.length < 100) {
|
||||
generate();
|
||||
} else {
|
||||
global.sm2Key = JSON.parse(global.sm2Key);
|
||||
}
|
||||
}
|
||||
headerVue.shortName = global.sm2Key.publicKey.substr(0, 5);
|
||||
pubkeyDialogVue.sm2KeyStr = JSON.stringify(global.sm2Key);
|
||||
mainVue.pubDialogVue = pubkeyDialogVue;
|
||||
|
@ -1,4 +1,4 @@
|
||||
var createProject = function() {
|
||||
var createProject = function () {
|
||||
var body = "<div class='input-group mb-3'>";
|
||||
body += "<div class='input-group-prepend'> <span class='input-group-text'>项目名称</span> </div>";
|
||||
body += "<input type='text' id='newProjectNameInput' class='form-control' placeholder='必填'>";
|
||||
@ -18,17 +18,17 @@ var createProject = function() {
|
||||
showDialog("创建新项目", sendCreateProject);
|
||||
};
|
||||
|
||||
var sendCreateProject = function() {
|
||||
var sendCreateProject = function () {
|
||||
var projectName = $("#newProjectNameInput")[0].value;
|
||||
if (projectName == undefined || projectName.length == 0) {
|
||||
setTimeout(function() {
|
||||
setTimeout(function () {
|
||||
myToast("创建项目失败", "请输入项目名");
|
||||
}, 1000);
|
||||
return;
|
||||
}
|
||||
var projectTemplate = $("#selectProjectTemplate")[0].value;
|
||||
if (projectTemplate == undefined || projectName.length == 0) {
|
||||
setTimeout(function() {
|
||||
setTimeout(function () {
|
||||
myToast("创建项目失败", "请选择项目模板");
|
||||
}, 1000);
|
||||
return;
|
||||
@ -48,14 +48,14 @@ var sendCreateProject = function() {
|
||||
arg.name = projectName;
|
||||
arg.projectTemplate = projectTemplate;
|
||||
|
||||
if(arg.dir.indexOf("..") != -1){
|
||||
if (arg.dir.indexOf("..") != -1) {
|
||||
console.log(arg.dir);
|
||||
myToast("项目名称不符合规范!","请勿包含 . .. / \\");
|
||||
myToast("项目名称不符合规范!", "请勿包含 . .. / \\");
|
||||
return;
|
||||
}
|
||||
if(arg.name.indexOf(".") != -1 || arg.name.indexOf("..") != -1 || arg.name.indexOf("/") != -1 || arg.name.indexOf("\\") != -1){
|
||||
if (arg.name.indexOf(".") != -1 || arg.name.indexOf("..") != -1 || arg.name.indexOf("/") != -1 || arg.name.indexOf("\\") != -1) {
|
||||
console.log(arg.name);
|
||||
myToast("项目名称不符合规范!","请勿包含 . .. / \\");
|
||||
myToast("项目名称不符合规范!", "请勿包含 . .. / \\");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -64,14 +64,14 @@ var sendCreateProject = function() {
|
||||
global.filewssocket.send(JSON.stringify(arg));
|
||||
}
|
||||
|
||||
var listFiles = function() {
|
||||
var listFiles = function () {
|
||||
global.wssocket.send("{\"action\":\"listProjects\",\"isPrivate\":false}");
|
||||
global.wssocket.send("{\"action\":\"listProjects\",\"isPrivate\":true}");
|
||||
};
|
||||
var updateGlobalProject = function() {
|
||||
var updateGlobalProject = function () {
|
||||
setTimeout(updateGlobalProjectInternal, 100);
|
||||
};
|
||||
var updateGlobalProjectInternal = function() {
|
||||
var updateGlobalProjectInternal = function () {
|
||||
var isPublic = $("#publicprojecttab").hasClass("active");
|
||||
console.log("updateGlobalProject, isPublic:" + isPublic);
|
||||
if (isPublic)
|
||||
@ -81,7 +81,7 @@ var updateGlobalProjectInternal = function() {
|
||||
mainVue.projects = global.projects;
|
||||
};
|
||||
// ==========WSHandler callbacks=========
|
||||
var onListProjects = function(obj) {
|
||||
var onListProjects = function (obj) {
|
||||
global.filewssocket = global.wssocket;
|
||||
var data = JSON.parse(obj.data);
|
||||
var projectDiv = "publicprojectAccordion";
|
||||
@ -113,9 +113,9 @@ var onListProjects = function(obj) {
|
||||
$("#" + projectDiv).html(html);
|
||||
|
||||
$.contextMenu({
|
||||
selector : '#' + projectDiv + '> .headingDiv',
|
||||
zIndex : 10,
|
||||
callback : function(key, options) {
|
||||
selector: '#' + projectDiv + '> .headingDiv',
|
||||
zIndex: 10,
|
||||
callback: function (key, options) {
|
||||
var projectID = this[0].id.replace("headingDiv", "").replace("_p",
|
||||
"");
|
||||
var projectName = global.projects[projectID];
|
||||
@ -128,24 +128,24 @@ var onListProjects = function(obj) {
|
||||
downloadContract(projectName);
|
||||
}
|
||||
},
|
||||
items : {
|
||||
"Export" : {
|
||||
name : "下载项目",
|
||||
icon : "copy"
|
||||
items: {
|
||||
"Export": {
|
||||
name: "下载项目",
|
||||
icon: "copy"
|
||||
},
|
||||
"Rename" : {
|
||||
name : "重命名",
|
||||
icon : "edit"
|
||||
"Rename": {
|
||||
name: "重命名",
|
||||
icon: "edit"
|
||||
},
|
||||
"Delete" : {
|
||||
name : "删除",
|
||||
icon : "delete"
|
||||
"Delete": {
|
||||
name: "删除",
|
||||
icon: "delete"
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
var onListProject = function(obj) {
|
||||
var onListProject = function (obj) {
|
||||
var pad = "";
|
||||
if (obj.isPrivate != undefined && obj.isPrivate) {
|
||||
pad = "_p";
|
||||
@ -159,9 +159,9 @@ var onListProject = function(obj) {
|
||||
listDiv.html(getProjectTreeHtml2(data, "projectTreeUl", "/" + title
|
||||
+ "/", 24, global.lastClickedProjectId + pad));
|
||||
$.contextMenu({
|
||||
selector : '.fileLine',
|
||||
zIndex : 10,
|
||||
callback : function(key, options) {
|
||||
selector: '.fileLine',
|
||||
zIndex: 10,
|
||||
callback: function (key, options) {
|
||||
var projectName = this[0].parentElement.onclick + "";
|
||||
projectName = projectName.split("\n")[1];
|
||||
projectName = projectName.replace(/^[^"]*"/g, "").replace(
|
||||
@ -181,33 +181,33 @@ var onListProject = function(obj) {
|
||||
}
|
||||
|
||||
},
|
||||
items : {
|
||||
"New" : {
|
||||
name : "新建",
|
||||
icon : "add",
|
||||
items : {
|
||||
"Create File" : {
|
||||
name : "文件",
|
||||
icon : "copy"
|
||||
items: {
|
||||
"New": {
|
||||
name: "新建",
|
||||
icon: "add",
|
||||
items: {
|
||||
"Create File": {
|
||||
name: "文件",
|
||||
icon: "copy"
|
||||
},
|
||||
"Create Folder" : {
|
||||
name : "文件夹",
|
||||
icon : "paste"
|
||||
"Create Folder": {
|
||||
name: "文件夹",
|
||||
icon: "paste"
|
||||
},
|
||||
"Upload File" : {
|
||||
name : "上传文件",
|
||||
icon : "loading"
|
||||
"Upload File": {
|
||||
name: "上传文件",
|
||||
icon: "loading"
|
||||
}
|
||||
|
||||
}
|
||||
},
|
||||
"Rename" : {
|
||||
name : "重命名",
|
||||
icon : "edit"
|
||||
"Rename": {
|
||||
name: "重命名",
|
||||
icon: "edit"
|
||||
},
|
||||
"Delete" : {
|
||||
name : "删除",
|
||||
icon : "delete"
|
||||
"Delete": {
|
||||
name: "删除",
|
||||
icon: "delete"
|
||||
}
|
||||
|
||||
}
|
||||
@ -218,7 +218,7 @@ var onListProject = function(obj) {
|
||||
// ==========WSHandler done=====================
|
||||
|
||||
// projectbutton callbacks======================
|
||||
var getProjectLineHtml = function(i, dataContent, dataParent, isPrivate) {
|
||||
var getProjectLineHtml = function (i, dataContent, dataParent, isPrivate) {
|
||||
var ret = "";
|
||||
var pad = "";
|
||||
if (isPrivate) {
|
||||
@ -244,7 +244,7 @@ var getProjectLineHtml = function(i, dataContent, dataParent, isPrivate) {
|
||||
return ret;
|
||||
};
|
||||
|
||||
var switchProject = function(i) {
|
||||
var switchProject = function (i) {
|
||||
var pingObj = {};
|
||||
pingObj.action = "listProject";
|
||||
pingObj.project = global.projects[i];
|
||||
@ -258,7 +258,7 @@ var switchProject = function(i) {
|
||||
// console.log(global.lastClickedProjectId);
|
||||
global.filewssocket.send(JSON.stringify(pingObj));
|
||||
};
|
||||
var getProjectTreeHtml2 = function(data, clz, preFix, extraPadding, order) {
|
||||
var getProjectTreeHtml2 = function (data, clz, preFix, extraPadding, order) {
|
||||
if (data == undefined || data.subFiles == undefined)
|
||||
return "";
|
||||
var subLineID = "accrodionLine" + order;
|
||||
@ -326,18 +326,18 @@ var getProjectTreeHtml2 = function(data, clz, preFix, extraPadding, order) {
|
||||
return ret;
|
||||
};
|
||||
// Tab related handlers============
|
||||
var onListFile = function(obj) {
|
||||
var onListFile = function (obj) {
|
||||
var data = JSON.parse(obj.data);
|
||||
data.name = "...";
|
||||
data.changed = false;
|
||||
// .replace(/.*\//g,"");
|
||||
data.isPrivate = obj.isPrivate;
|
||||
mainVue.openedFiles.push(data);
|
||||
setTimeout(function() {
|
||||
setTimeout(function () {
|
||||
clickTab(data.path);
|
||||
}, 100);
|
||||
};
|
||||
var onStaticVerify = function(obj) {
|
||||
var onStaticVerify = function (obj) {
|
||||
var data = {};
|
||||
data.name = data.path = "/tmp/result_" + (new Date().getTime() % 1000)
|
||||
+ ".txt";
|
||||
@ -345,17 +345,16 @@ var onStaticVerify = function(obj) {
|
||||
obj.result = JSON.parse(obj.result);
|
||||
data.val = JSON.stringify(obj, null, 4);
|
||||
mainVue.openedFiles.push(data);
|
||||
setTimeout(function() {
|
||||
setTimeout(function () {
|
||||
clickTab(data.path);
|
||||
}, 100);
|
||||
}
|
||||
|
||||
|
||||
|
||||
var clickProjectDir = function() {
|
||||
var clickProjectDir = function () {
|
||||
|
||||
};
|
||||
var clickProjectFile = function(tar) {
|
||||
var clickProjectFile = function (tar) {
|
||||
var pingObj = {};
|
||||
pingObj.action = "listFile";
|
||||
pingObj.path = tar;
|
||||
@ -371,23 +370,23 @@ var clickProjectFile = function(tar) {
|
||||
global.filewssocket.send(JSON.stringify(pingObj));
|
||||
|
||||
};
|
||||
var formatScriptEditor = function() {
|
||||
var formatScriptEditor = function () {
|
||||
var from = global.scriptEditor.getCursor(true);
|
||||
var to = global.scriptEditor.getCursor(false);
|
||||
if (from == to) {
|
||||
from = {
|
||||
line : 0,
|
||||
ch : 0
|
||||
line: 0,
|
||||
ch: 0
|
||||
};
|
||||
to = {
|
||||
line : global.scriptEditor.lastLine() + 1,
|
||||
ch : 1
|
||||
line: global.scriptEditor.lastLine() + 1,
|
||||
ch: 1
|
||||
};
|
||||
}
|
||||
global.scriptEditor.autoFormatRange(from, to);
|
||||
|
||||
}
|
||||
var adjustFileName = function(title) {
|
||||
var adjustFileName = function (title) {
|
||||
if (mainVue.openedFiles.length < 2)
|
||||
return;
|
||||
var totalLen = 90;
|
||||
@ -409,7 +408,7 @@ var adjustFileName = function(title) {
|
||||
}
|
||||
}
|
||||
};
|
||||
var clickTab = function(title) {
|
||||
var clickTab = function (title) {
|
||||
if (title.getAttribute != undefined) {
|
||||
title = title.getAttribute("path");
|
||||
}
|
||||
@ -455,7 +454,7 @@ var clickTab = function(title) {
|
||||
adjustFileName(title);
|
||||
}
|
||||
};
|
||||
var closeTab = function(ele) {
|
||||
var closeTab = function (ele) {
|
||||
var path = ele.getAttribute("path");
|
||||
var newList = [];
|
||||
var pos = 0;
|
||||
@ -482,7 +481,7 @@ var closeTab = function(ele) {
|
||||
};
|
||||
// Tab related handlers============
|
||||
|
||||
var getProjectTreeHtml = function(data, clz, preFix) {
|
||||
var getProjectTreeHtml = function (data, clz, preFix) {
|
||||
if (data == undefined || data.subFiles == undefined)
|
||||
return "";
|
||||
var ret = "<ul class='" + clz + "'>";
|
||||
@ -506,7 +505,7 @@ var getProjectTreeHtml = function(data, clz, preFix) {
|
||||
};
|
||||
|
||||
// context menu callbacks=======================
|
||||
var showRename = function(projectName) {
|
||||
var showRename = function (projectName) {
|
||||
console.log("showRename");
|
||||
var body = "<div class='input-group mb-3'>";
|
||||
body += "<div class='input-group-prepend'>";
|
||||
@ -514,11 +513,11 @@ var showRename = function(projectName) {
|
||||
body += "</div> <input type='text' id='dialogInput' class='form-control' value='"
|
||||
+ projectName + "'></div>";
|
||||
$("#dialogBodyDiv").html(body);
|
||||
showDialog("重命名项目", function() {
|
||||
showDialog("重命名项目", function () {
|
||||
var pingObj = {};
|
||||
var newVal = $("#dialogInput")[0].value;
|
||||
if (newVal == undefined || newVal.length == 0 || newVal.indexOf("..") != -1 || newVal.indexOf("\\") != -1) {
|
||||
setTimeout(function() {
|
||||
setTimeout(function () {
|
||||
myToast("重命名失败", "新文件名不符合规范");
|
||||
}, 1000);
|
||||
return;
|
||||
@ -531,19 +530,19 @@ var showRename = function(projectName) {
|
||||
global.filewssocket.send(JSON.stringify(pingObj));
|
||||
});
|
||||
};
|
||||
var showDelete = function(projectName) {
|
||||
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("删除项目", function() {
|
||||
showDialog("删除项目", function () {
|
||||
global.projectName = projectName;
|
||||
deleteFile();
|
||||
});
|
||||
};
|
||||
|
||||
var showCreateFile = function(projectName, isDir) {
|
||||
var showCreateFile = function (projectName, isDir) {
|
||||
var body = "<div class='input-group mb-3'>";
|
||||
body += "<div class='input-group-prepend'>";
|
||||
body += " <span class='input-group-text' >创建文件" + (isDir ? "夹" : "")
|
||||
@ -551,10 +550,10 @@ var showCreateFile = function(projectName, isDir) {
|
||||
body += "</div> <input type='text' id='newProjectNameInput' class='form-control' placeholder='新文件"
|
||||
+ (isDir ? "夹" : "") + "'></div>";
|
||||
$("#dialogBodyDiv").html(body);
|
||||
showDialog("创建新文件", function() {
|
||||
showDialog("创建新文件", function () {
|
||||
var fileName = $("#newProjectNameInput")[0].value;
|
||||
if (fileName == undefined || fileName.length == 0) {
|
||||
setTimeout(function() {
|
||||
setTimeout(function () {
|
||||
myToast("新建文件失败", "请输入文件名");
|
||||
}, 1000);
|
||||
return;
|
||||
@ -576,7 +575,7 @@ var showCreateFile = function(projectName, isDir) {
|
||||
});
|
||||
}
|
||||
|
||||
var deleteFile = function() {
|
||||
var deleteFile = function () {
|
||||
var pingObj = {};
|
||||
pingObj.file = global.projectName;
|
||||
pingObj.action = "deleteFile";
|
||||
@ -584,7 +583,7 @@ var deleteFile = function() {
|
||||
global.filewssocket.send(JSON.stringify(pingObj));
|
||||
};
|
||||
|
||||
var saveFile = function() {
|
||||
var saveFile = function () {
|
||||
var pingObj = {};
|
||||
pingObj.isAppend = false;
|
||||
pingObj.isPrivate = global.currentFile.isPrivate;
|
||||
@ -602,7 +601,7 @@ var saveFile = function() {
|
||||
adjustFileName(global.currentFile.path);
|
||||
};
|
||||
|
||||
var sliceFile = function(file) {
|
||||
var sliceFile = function (file) {
|
||||
let piece = 1024 * 50;
|
||||
let totalSize = file.size; // 文件总大小
|
||||
let start = 0; // 每次上传的开始字节
|
||||
@ -619,16 +618,16 @@ var sliceFile = function(file) {
|
||||
return chunks;
|
||||
};
|
||||
|
||||
var uploadInternal = function() {
|
||||
var uploadInternal = function () {
|
||||
console.log("upload:" + global.uploadOrder + " total:" + global.chunks.length);
|
||||
var isAppend = true;
|
||||
if (global.uploadOrder == 0)
|
||||
isAppend = false;
|
||||
if (global.uploadOrder >= global.chunks.length) {
|
||||
progressTextDiv.innerText = global.uploadFiles[global.fileOrder-1].name+"上传已完成";
|
||||
progressTextDiv.innerText = global.uploadFiles[global.fileOrder - 1].name + "上传已完成";
|
||||
progressDiv.style.width = "100%";
|
||||
console.log("setTimeout uploadSingleFile");
|
||||
setTimeout(uploadSingleFile,500);
|
||||
setTimeout(uploadSingleFile, 500);
|
||||
return;
|
||||
}
|
||||
var num = global.uploadOrder * 100 / global.chunks.length;
|
||||
@ -644,19 +643,21 @@ var uploadInternal = function() {
|
||||
arg += "&count=" + global.chunks.length;
|
||||
arg += "&pubKey=" + global.sm2Key.publicKey;
|
||||
console.log(arg);
|
||||
var sign = sm2.doSignature(arg, global.sm2Key.privateKey,{hash:true,der:true});
|
||||
var sign = sm2.doSignature(arg, global.sm2Key.privateKey, {hash: true, der: true});
|
||||
console.log(sign)
|
||||
arg += "&sign=" + sign;
|
||||
$.ajax({
|
||||
url : './Upload?' + arg,
|
||||
type : 'POST',
|
||||
data : fd,
|
||||
processData : false, // tell jQuery not to process the data
|
||||
contentType : false, // tell jQuery not to set contentType
|
||||
success : function(data) {
|
||||
url: `${global.urlparam ?
|
||||
(location.href.startsWith('https') ? 'https://' : 'http://') + global.urlparam.nodeAddr :
|
||||
'.'}/Upload?${arg}`,
|
||||
type: 'POST',
|
||||
data: fd,
|
||||
processData: false, // tell jQuery not to process the data
|
||||
contentType: false, // tell jQuery not to set contentType
|
||||
success: function (data) {
|
||||
uploadInternal();
|
||||
},
|
||||
error : function(data) {
|
||||
error: function (data) {
|
||||
console.log("[uploadFile] error!");
|
||||
alert("Upload failed!");
|
||||
}
|
||||
@ -677,7 +678,7 @@ var uploadInternal = function() {
|
||||
|
||||
}
|
||||
|
||||
var uploadFile = function(obj) {
|
||||
var uploadFile = function (obj) {
|
||||
console.log("uploadFile : ");
|
||||
global.uploadFiles = $("#uploadFileInput")[0].files;
|
||||
global.fileOrder = 0;
|
||||
@ -689,23 +690,23 @@ var uploadFile = function(obj) {
|
||||
$("#dialogBodyDiv").html(body);
|
||||
|
||||
uploadSingleFile();
|
||||
showDialog("正在上传文件", function() {
|
||||
showDialog("正在上传文件", function () {
|
||||
cancelUpload();
|
||||
}, function() {
|
||||
}, function () {
|
||||
cancelUpload();
|
||||
});
|
||||
};
|
||||
var uploadSingleFile = function(){
|
||||
var uploadSingleFile = function () {
|
||||
console.log("uploadSingleFile");
|
||||
console.log(global.uploadFiles[global.fileOrder]);
|
||||
var file = global.uploadFiles[global.fileOrder];
|
||||
global.fileOrder++;
|
||||
if (file==undefined){
|
||||
progressTextDiv.innerHTML=global.uploadFiles.length+"个文件全部上传完毕";
|
||||
if (file == undefined) {
|
||||
progressTextDiv.innerHTML = global.uploadFiles.length + "个文件全部上传完毕";
|
||||
return;
|
||||
} else{
|
||||
progressTextDiv.innerHTML="上传第("
|
||||
+ (global.fileOrder) + "/" + global.uploadFiles.length + ")个文件:"+file.name;
|
||||
} else {
|
||||
progressTextDiv.innerHTML = "上传第("
|
||||
+ (global.fileOrder) + "/" + global.uploadFiles.length + ")个文件:" + file.name;
|
||||
}
|
||||
global.uploadFile = file;
|
||||
console.log(file);
|
||||
@ -714,11 +715,11 @@ var uploadSingleFile = function(){
|
||||
global.uploadFileName = file.name;
|
||||
uploadInternal();
|
||||
};
|
||||
var cancelUpload = function() {
|
||||
var cancelUpload = function () {
|
||||
global.uploadOrder = global.chunks.length + 1;
|
||||
global.fileOrder = global.uploadFiles.length+1;
|
||||
global.fileOrder = global.uploadFiles.length + 1;
|
||||
}
|
||||
var downloadContract = function(projectName) {
|
||||
var downloadContract = function (projectName) {
|
||||
// console.log(window.location.href);
|
||||
var url;
|
||||
if (window.location.href.indexOf("/SCIDE") != -1)
|
||||
@ -733,13 +734,13 @@ var downloadContract = function(projectName) {
|
||||
arg += "&isPrivate=" + isPrivate;
|
||||
arg += "&pubKey=" + global.sm2Key.publicKey;
|
||||
arg += "×tamp=" + new Date().getTime();
|
||||
var sign = sm2.doSignature(arg, global.sm2Key.privateKey,{hash:true,der:true});
|
||||
var sign = sm2.doSignature(arg, global.sm2Key.privateKey, {hash: true, der: true});
|
||||
arg += "&sign=" + sign;
|
||||
console.log(url + arg);
|
||||
window.open(url + arg);
|
||||
};
|
||||
|
||||
var staticVerifyNaive = function() {
|
||||
var staticVerifyNaive = function () {
|
||||
var arg = {};
|
||||
arg.action = "staticVerifyContract";
|
||||
arg.contractid = "-";
|
||||
@ -759,7 +760,7 @@ var staticVerifyNaive = function() {
|
||||
global.wssocket.send(JSON.stringify(arg));
|
||||
};
|
||||
|
||||
var compile = function() {
|
||||
var compile = function () {
|
||||
var arg = {};
|
||||
arg.action = "compile";
|
||||
if (global.projects[global.lastClickedProjectId] == undefined) {
|
||||
@ -775,7 +776,7 @@ var compile = function() {
|
||||
global.wssocket.send(JSON.stringify(arg));
|
||||
};
|
||||
|
||||
var registerDOI = function() {
|
||||
var registerDOI = function () {
|
||||
var arg = {};
|
||||
arg.action = "registerDOI";
|
||||
if (global.projects[global.lastClickedProjectId] == undefined) {
|
||||
@ -793,15 +794,15 @@ var registerDOI = function() {
|
||||
body += " <span class='input-group-text' >如果已经注册过,再次注册将导致之前的注册被覆盖." + "</span>";
|
||||
body += " </div>";
|
||||
$("#dialogBodyDiv").html(body);
|
||||
showDialog("请确认是否注册" + arg.path + "的DOI", function() {
|
||||
showDialog("请确认是否注册" + arg.path + "的DOI", function () {
|
||||
global.wssocket.send(JSON.stringify(arg));
|
||||
});
|
||||
};
|
||||
|
||||
var onCompile = function(obj) {
|
||||
myToast("提示",global.projects[global.lastClickedProjectId] + "项目编译结果:\n"+obj.result);
|
||||
var onCompile = function (obj) {
|
||||
myToast("提示", global.projects[global.lastClickedProjectId] + "项目编译结果:\n" + obj.result);
|
||||
};
|
||||
|
||||
var onRegisterDOI = function(obj) {
|
||||
myToast("提示",global.projects[global.lastClickedProjectId] + "项目注册DOI结果:\n"+obj.result);
|
||||
var onRegisterDOI = function (obj) {
|
||||
myToast("提示", global.projects[global.lastClickedProjectId] + "项目注册DOI结果:\n" + obj.result);
|
||||
};
|
@ -1,4 +1,4 @@
|
||||
var createProject = function() {
|
||||
var createProject = function () {
|
||||
var body = "<div class='input-group mb-3'>";
|
||||
body += "<div class='input-group-prepend'> <span class='input-group-text'>Project Name</span> </div>";
|
||||
body += "<input type='text' id='newProjectNameInput' class='form-control' placeholder='Required'>";
|
||||
@ -18,17 +18,17 @@ var createProject = function() {
|
||||
showDialog("Create New Project", sendCreateProject);
|
||||
};
|
||||
|
||||
var sendCreateProject = function() {
|
||||
var sendCreateProject = function () {
|
||||
var projectName = $("#newProjectNameInput")[0].value;
|
||||
if (projectName == undefined || projectName.length == 0) {
|
||||
setTimeout(function() {
|
||||
setTimeout(function () {
|
||||
myToast("Create Failed", "Please input the project name.");
|
||||
}, 1000);
|
||||
return;
|
||||
}
|
||||
var projectTemplate = $("#selectProjectTemplate")[0].value;
|
||||
if (projectTemplate == undefined || projectName.length == 0) {
|
||||
setTimeout(function() {
|
||||
setTimeout(function () {
|
||||
myToast("Create Failed", "Please select the project template.");
|
||||
}, 1000);
|
||||
return;
|
||||
@ -48,14 +48,14 @@ var sendCreateProject = function() {
|
||||
arg.name = projectName;
|
||||
arg.projectTemplate = projectTemplate;
|
||||
|
||||
if(arg.dir.indexOf("..") != -1){
|
||||
if (arg.dir.indexOf("..") != -1) {
|
||||
console.log(arg.dir);
|
||||
myToast("项目名称不符合规范!","请勿包含 . .. / \\");
|
||||
myToast("项目名称不符合规范!", "请勿包含 . .. / \\");
|
||||
return;
|
||||
}
|
||||
if(arg.name.indexOf(".") != -1 || arg.name.indexOf("..") != -1 || arg.name.indexOf("/") != -1 || arg.name.indexOf("\\") != -1){
|
||||
if (arg.name.indexOf(".") != -1 || arg.name.indexOf("..") != -1 || arg.name.indexOf("/") != -1 || arg.name.indexOf("\\") != -1) {
|
||||
console.log(arg.name);
|
||||
myToast("项目名称不符合规范!","请勿包含 . .. / \\");
|
||||
myToast("项目名称不符合规范!", "请勿包含 . .. / \\");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -64,14 +64,14 @@ var sendCreateProject = function() {
|
||||
global.filewssocket.send(JSON.stringify(arg));
|
||||
}
|
||||
|
||||
var listFiles = function() {
|
||||
var listFiles = function () {
|
||||
global.wssocket.send("{\"action\":\"listProjects\",\"isPrivate\":false}");
|
||||
global.wssocket.send("{\"action\":\"listProjects\",\"isPrivate\":true}");
|
||||
};
|
||||
var updateGlobalProject = function() {
|
||||
var updateGlobalProject = function () {
|
||||
setTimeout(updateGlobalProjectInternal, 100);
|
||||
};
|
||||
var updateGlobalProjectInternal = function() {
|
||||
var updateGlobalProjectInternal = function () {
|
||||
var isPublic = $("#publicprojecttab").hasClass("active");
|
||||
// console.log("updateGlobalProject, isPublic:" + isPublic);
|
||||
if (isPublic)
|
||||
@ -81,7 +81,7 @@ var updateGlobalProjectInternal = function() {
|
||||
mainVue.projects = global.projects;
|
||||
};
|
||||
// ==========WSHandler callbacks=========
|
||||
var onListProjects = function(obj) {
|
||||
var onListProjects = function (obj) {
|
||||
global.filewssocket = global.wssocket;
|
||||
var data = JSON.parse(obj.data);
|
||||
var projectDiv = "publicprojectAccordion";
|
||||
@ -113,9 +113,9 @@ var onListProjects = function(obj) {
|
||||
$("#" + projectDiv).html(html);
|
||||
|
||||
$.contextMenu({
|
||||
selector : '#' + projectDiv + '> .headingDiv',
|
||||
zIndex : 10,
|
||||
callback : function(key, options) {
|
||||
selector: '#' + projectDiv + '> .headingDiv',
|
||||
zIndex: 10,
|
||||
callback: function (key, options) {
|
||||
var projectID = this[0].id.replace("headingDiv", "").replace("_p",
|
||||
"");
|
||||
var projectName = global.projects[projectID];
|
||||
@ -128,24 +128,24 @@ var onListProjects = function(obj) {
|
||||
downloadContract(projectName);
|
||||
}
|
||||
},
|
||||
items : {
|
||||
"Export" : {
|
||||
name : "Download Project",
|
||||
icon : "copy"
|
||||
items: {
|
||||
"Export": {
|
||||
name: "Download Project",
|
||||
icon: "copy"
|
||||
},
|
||||
"Rename" : {
|
||||
name : "Rename Project",
|
||||
icon : "edit"
|
||||
"Rename": {
|
||||
name: "Rename Project",
|
||||
icon: "edit"
|
||||
},
|
||||
"Delete" : {
|
||||
name : "Delete Project",
|
||||
icon : "delete"
|
||||
"Delete": {
|
||||
name: "Delete Project",
|
||||
icon: "delete"
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
var onListProject = function(obj) {
|
||||
var onListProject = function (obj) {
|
||||
var pad = "";
|
||||
if (obj.isPrivate != undefined && obj.isPrivate) {
|
||||
pad = "_p";
|
||||
@ -159,9 +159,9 @@ var onListProject = function(obj) {
|
||||
listDiv.html(getProjectTreeHtml2(data, "projectTreeUl", "/" + title
|
||||
+ "/", 24, global.lastClickedProjectId + pad));
|
||||
$.contextMenu({
|
||||
selector : '.fileLine',
|
||||
zIndex : 10,
|
||||
callback : function(key, options) {
|
||||
selector: '.fileLine',
|
||||
zIndex: 10,
|
||||
callback: function (key, options) {
|
||||
// console.log(this);
|
||||
// console.log(key);
|
||||
// console.log(this[0]);
|
||||
@ -184,33 +184,33 @@ var onListProject = function(obj) {
|
||||
}
|
||||
|
||||
},
|
||||
items : {
|
||||
"New" : {
|
||||
name : "New",
|
||||
icon : "add",
|
||||
items : {
|
||||
"Create File" : {
|
||||
name : "File",
|
||||
icon : "copy"
|
||||
items: {
|
||||
"New": {
|
||||
name: "New",
|
||||
icon: "add",
|
||||
items: {
|
||||
"Create File": {
|
||||
name: "File",
|
||||
icon: "copy"
|
||||
},
|
||||
"Create Folder" : {
|
||||
name : "Folder",
|
||||
icon : "paste"
|
||||
"Create Folder": {
|
||||
name: "Folder",
|
||||
icon: "paste"
|
||||
},
|
||||
"Upload File" : {
|
||||
name : "Upload File",
|
||||
icon : "loading"
|
||||
"Upload File": {
|
||||
name: "Upload File",
|
||||
icon: "loading"
|
||||
}
|
||||
|
||||
}
|
||||
},
|
||||
"Rename" : {
|
||||
name : "Rename",
|
||||
icon : "edit"
|
||||
"Rename": {
|
||||
name: "Rename",
|
||||
icon: "edit"
|
||||
},
|
||||
"Delete" : {
|
||||
name : "Delete",
|
||||
icon : "delete"
|
||||
"Delete": {
|
||||
name: "Delete",
|
||||
icon: "delete"
|
||||
}
|
||||
|
||||
}
|
||||
@ -221,7 +221,7 @@ var onListProject = function(obj) {
|
||||
// ==========WSHandler done=====================
|
||||
|
||||
// projectbutton callbacks======================
|
||||
var getProjectLineHtml = function(i, dataContent, dataParent, isPrivate) {
|
||||
var getProjectLineHtml = function (i, dataContent, dataParent, isPrivate) {
|
||||
var ret = "";
|
||||
var pad = "";
|
||||
if (isPrivate) {
|
||||
@ -247,7 +247,7 @@ var getProjectLineHtml = function(i, dataContent, dataParent, isPrivate) {
|
||||
return ret;
|
||||
};
|
||||
|
||||
var switchProject = function(i) {
|
||||
var switchProject = function (i) {
|
||||
var pingObj = {};
|
||||
pingObj.action = "listProject";
|
||||
pingObj.project = global.projects[i];
|
||||
@ -261,7 +261,7 @@ var switchProject = function(i) {
|
||||
// console.log(global.lastClickedProjectId);
|
||||
global.filewssocket.send(JSON.stringify(pingObj));
|
||||
};
|
||||
var getProjectTreeHtml2 = function(data, clz, preFix, extraPadding, order) {
|
||||
var getProjectTreeHtml2 = function (data, clz, preFix, extraPadding, order) {
|
||||
if (data == undefined || data.subFiles == undefined)
|
||||
return "";
|
||||
var subLineID = "accrodionLine" + order;
|
||||
@ -329,18 +329,18 @@ var getProjectTreeHtml2 = function(data, clz, preFix, extraPadding, order) {
|
||||
return ret;
|
||||
};
|
||||
// Tab related handlers============
|
||||
var onListFile = function(obj) {
|
||||
var onListFile = function (obj) {
|
||||
var data = JSON.parse(obj.data);
|
||||
data.name = "...";
|
||||
data.changed = false;
|
||||
// .replace(/.*\//g,"");
|
||||
data.isPrivate = obj.isPrivate;
|
||||
mainVue.openedFiles.push(data);
|
||||
setTimeout(function() {
|
||||
setTimeout(function () {
|
||||
clickTab(data.path);
|
||||
}, 100);
|
||||
};
|
||||
var onStaticVerify = function(obj) {
|
||||
var onStaticVerify = function (obj) {
|
||||
var data = {};
|
||||
data.name = data.path = "/tmp/result_" + (new Date().getTime() % 1000)
|
||||
+ ".txt";
|
||||
@ -348,14 +348,14 @@ var onStaticVerify = function(obj) {
|
||||
obj.result = JSON.parse(obj.result);
|
||||
data.val = JSON.stringify(obj, null, 4);
|
||||
mainVue.openedFiles.push(data);
|
||||
setTimeout(function() {
|
||||
setTimeout(function () {
|
||||
clickTab(data.path);
|
||||
}, 100);
|
||||
}
|
||||
var clickProjectDir = function() {
|
||||
var clickProjectDir = function () {
|
||||
|
||||
};
|
||||
var clickProjectFile = function(tar) {
|
||||
var clickProjectFile = function (tar) {
|
||||
var pingObj = {};
|
||||
pingObj.action = "listFile";
|
||||
pingObj.path = tar;
|
||||
@ -371,23 +371,23 @@ var clickProjectFile = function(tar) {
|
||||
global.filewssocket.send(JSON.stringify(pingObj));
|
||||
|
||||
};
|
||||
var formatScriptEditor = function() {
|
||||
var formatScriptEditor = function () {
|
||||
var from = global.scriptEditor.getCursor(true);
|
||||
var to = global.scriptEditor.getCursor(false);
|
||||
if (from == to) {
|
||||
from = {
|
||||
line : 0,
|
||||
ch : 0
|
||||
line: 0,
|
||||
ch: 0
|
||||
};
|
||||
to = {
|
||||
line : global.scriptEditor.lastLine() + 1,
|
||||
ch : 1
|
||||
line: global.scriptEditor.lastLine() + 1,
|
||||
ch: 1
|
||||
};
|
||||
}
|
||||
global.scriptEditor.autoFormatRange(from, to);
|
||||
|
||||
}
|
||||
var adjustFileName = function(title) {
|
||||
var adjustFileName = function (title) {
|
||||
if (mainVue.openedFiles.length < 2)
|
||||
return;
|
||||
var totalLen = 90;
|
||||
@ -409,7 +409,7 @@ var adjustFileName = function(title) {
|
||||
}
|
||||
}
|
||||
};
|
||||
var clickTab = function(title) {
|
||||
var clickTab = function (title) {
|
||||
if (title.getAttribute != undefined) {
|
||||
title = title.getAttribute("path");
|
||||
}
|
||||
@ -454,7 +454,7 @@ var clickTab = function(title) {
|
||||
adjustFileName(title);
|
||||
}
|
||||
};
|
||||
var closeTab = function(ele) {
|
||||
var closeTab = function (ele) {
|
||||
var path = ele.getAttribute("path");
|
||||
var newList = [];
|
||||
var pos = 0;
|
||||
@ -480,7 +480,7 @@ var closeTab = function(ele) {
|
||||
};
|
||||
// Tab related handlers============
|
||||
|
||||
var getProjectTreeHtml = function(data, clz, preFix) {
|
||||
var getProjectTreeHtml = function (data, clz, preFix) {
|
||||
if (data == undefined || data.subFiles == undefined)
|
||||
return "";
|
||||
var ret = "<ul class='" + clz + "'>";
|
||||
@ -504,18 +504,18 @@ var getProjectTreeHtml = function(data, clz, preFix) {
|
||||
};
|
||||
|
||||
// context menu callbacks=======================
|
||||
var showRename = function(projectName) {
|
||||
var showRename = function (projectName) {
|
||||
var body = "<div class='input-group mb-3'>";
|
||||
body += "<div class='input-group-prepend'>";
|
||||
body += " <span class='input-group-text' >输入新名称</span>";
|
||||
body += "</div> <input type='text' id='dialogInput' class='form-control' value='"
|
||||
+ projectName + "'></div>";
|
||||
$("#dialogBodyDiv").html(body);
|
||||
showDialog("重命名项目", function() {
|
||||
showDialog("重命名项目", function () {
|
||||
var pingObj = {};
|
||||
var newVal = $("#dialogInput")[0].value;
|
||||
if (newVal == undefined || newVal.length == 0 || newVal.indexOf("..") != -1 || newVal.indexOf("\\") != -1) {
|
||||
setTimeout(function() {
|
||||
setTimeout(function () {
|
||||
myToast("重命名失败", "新文件名不符合规范");
|
||||
}, 1000);
|
||||
return;
|
||||
@ -528,19 +528,19 @@ var showRename = function(projectName) {
|
||||
global.filewssocket.send(JSON.stringify(pingObj));
|
||||
});
|
||||
};
|
||||
var showDelete = function(projectName) {
|
||||
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("删除项目", function() {
|
||||
showDialog("删除项目", function () {
|
||||
global.projectName = projectName;
|
||||
deleteFile();
|
||||
});
|
||||
};
|
||||
|
||||
var showCreateFile = function(projectName, isDir) {
|
||||
var showCreateFile = function (projectName, isDir) {
|
||||
var body = "<div class='input-group mb-3'>";
|
||||
body += "<div class='input-group-prepend'>";
|
||||
body += " <span class='input-group-text' >创建文件" + (isDir ? "夹" : "")
|
||||
@ -548,10 +548,10 @@ var showCreateFile = function(projectName, isDir) {
|
||||
body += "</div> <input type='text' id='newProjectNameInput' class='form-control' placeholder='新文件"
|
||||
+ (isDir ? "夹" : "") + "'></div>";
|
||||
$("#dialogBodyDiv").html(body);
|
||||
showDialog("创建新文件", function() {
|
||||
showDialog("创建新文件", function () {
|
||||
var fileName = $("#newProjectNameInput")[0].value;
|
||||
if (fileName == undefined || fileName.length == 0) {
|
||||
setTimeout(function() {
|
||||
setTimeout(function () {
|
||||
myToast("新建文件失败", "请输入文件名");
|
||||
}, 1000);
|
||||
return;
|
||||
@ -570,7 +570,7 @@ var showCreateFile = function(projectName, isDir) {
|
||||
});
|
||||
}
|
||||
|
||||
var deleteFile = function() {
|
||||
var deleteFile = function () {
|
||||
var pingObj = {};
|
||||
pingObj.file = global.projectName;
|
||||
pingObj.action = "deleteFile";
|
||||
@ -578,7 +578,7 @@ var deleteFile = function() {
|
||||
global.filewssocket.send(JSON.stringify(pingObj));
|
||||
};
|
||||
|
||||
var saveFile = function() {
|
||||
var saveFile = function () {
|
||||
var pingObj = {};
|
||||
pingObj.isAppend = false;
|
||||
pingObj.isPrivate = global.currentFile.isPrivate;
|
||||
@ -596,7 +596,7 @@ var saveFile = function() {
|
||||
adjustFileName(global.currentFile.path);
|
||||
};
|
||||
|
||||
var sliceFile = function(file) {
|
||||
var sliceFile = function (file) {
|
||||
let piece = 1024 * 50;
|
||||
let totalSize = file.size; // 文件总大小
|
||||
let start = 0; // 每次上传的开始字节
|
||||
@ -613,14 +613,14 @@ var sliceFile = function(file) {
|
||||
return chunks;
|
||||
};
|
||||
|
||||
var uploadInternal = function() {
|
||||
var uploadInternal = function () {
|
||||
var isAppend = true;
|
||||
if (global.uploadOrder == 0)
|
||||
isAppend = false;
|
||||
if (global.uploadOrder >= global.chunks.length) {
|
||||
progressTextDiv.innerText = global.uploadFiles[global.fileOrder-1].name+"上传已完成";
|
||||
progressTextDiv.innerText = global.uploadFiles[global.fileOrder - 1].name + "上传已完成";
|
||||
progressDiv.style.width = "100%";
|
||||
setTimeout(uploadSingleFile,500);
|
||||
setTimeout(uploadSingleFile, 500);
|
||||
return;
|
||||
}
|
||||
var num = global.uploadOrder * 100 / global.chunks.length;
|
||||
@ -635,18 +635,20 @@ var uploadInternal = function() {
|
||||
arg += "&order=" + global.uploadOrder;
|
||||
arg += "&count=" + global.chunks.length;
|
||||
arg += "&pubKey=" + global.sm2Key.publicKey;
|
||||
var sign = sm2.doSignature(arg, global.sm2Key.privateKey,{hash:true,der:true});
|
||||
var sign = sm2.doSignature(arg, global.sm2Key.privateKey, {hash: true, der: true});
|
||||
arg += "&sign=" + sign;
|
||||
$.ajax({
|
||||
url : './Upload?' + arg,
|
||||
type : 'POST',
|
||||
data : fd,
|
||||
processData : false, // tell jQuery not to process the data
|
||||
contentType : false, // tell jQuery not to set contentType
|
||||
success : function(data) {
|
||||
url: `${global.urlparam ?
|
||||
(location.href.startsWith('https') ? 'https://' : 'http://') + global.urlparam.nodeAddr :
|
||||
'.'}/Upload?${arg}`,
|
||||
type: 'POST',
|
||||
data: fd,
|
||||
processData: false, // tell jQuery not to process the data
|
||||
contentType: false, // tell jQuery not to set contentType
|
||||
success: function (data) {
|
||||
uploadInternal();
|
||||
},
|
||||
error : function(data) {
|
||||
error: function (data) {
|
||||
console.log("[uploadFile] error!");
|
||||
alert("Upload failed!");
|
||||
}
|
||||
@ -667,7 +669,7 @@ var uploadInternal = function() {
|
||||
|
||||
}
|
||||
|
||||
var uploadFile = function(obj) {
|
||||
var uploadFile = function (obj) {
|
||||
console.log("uploadFile : ");
|
||||
global.uploadFiles = $("#uploadFileInput")[0].files;
|
||||
global.fileOrder = 0;
|
||||
@ -679,21 +681,21 @@ var uploadFile = function(obj) {
|
||||
$("#dialogBodyDiv").html(body);
|
||||
|
||||
uploadSingleFile();
|
||||
showDialog("正在上传文件", function() {
|
||||
showDialog("正在上传文件", function () {
|
||||
cancelUpload();
|
||||
}, function() {
|
||||
}, function () {
|
||||
cancelUpload();
|
||||
});
|
||||
};
|
||||
var uploadSingleFile = function(){
|
||||
var uploadSingleFile = function () {
|
||||
var file = global.uploadFiles[global.fileOrder];
|
||||
global.fileOrder++;
|
||||
if (file==undefined){
|
||||
progressTextDiv.innerHTML=global.uploadFiles.length+"个文件全部上传完毕";
|
||||
if (file == undefined) {
|
||||
progressTextDiv.innerHTML = global.uploadFiles.length + "个文件全部上传完毕";
|
||||
return;
|
||||
} else{
|
||||
progressTextDiv.innerHTML="上传第("
|
||||
+ (global.fileOrder) + "/" + global.uploadFiles.length + ")个文件:"+file.name;
|
||||
} else {
|
||||
progressTextDiv.innerHTML = "上传第("
|
||||
+ (global.fileOrder) + "/" + global.uploadFiles.length + ")个文件:" + file.name;
|
||||
}
|
||||
global.uploadFile = file;
|
||||
global.chunks = sliceFile(file);
|
||||
@ -701,11 +703,11 @@ var uploadSingleFile = function(){
|
||||
global.uploadFileName = file.name;
|
||||
uploadInternal();
|
||||
};
|
||||
var cancelUpload = function() {
|
||||
var cancelUpload = function () {
|
||||
global.uploadOrder = global.chunks.length + 1;
|
||||
global.fileOrder = global.uploadFiles.length+1;
|
||||
global.fileOrder = global.uploadFiles.length + 1;
|
||||
}
|
||||
var downloadContract = function(projectName) {
|
||||
var downloadContract = function (projectName) {
|
||||
var url;
|
||||
if (window.location.href.indexOf("/SCIDE") != -1)
|
||||
url = window.location.href.replace("/OnlineIDE.html", "/CMManager?");
|
||||
@ -724,7 +726,7 @@ var downloadContract = function(projectName) {
|
||||
window.open(url + arg);
|
||||
};
|
||||
|
||||
var staticVerify = function() {
|
||||
var staticVerify = function () {
|
||||
var arg = {};
|
||||
arg.action = "staticVerifyContract";
|
||||
arg.contractid = "-";
|
||||
|
@ -99,11 +99,9 @@ var genReadme = function () {
|
||||
for (let anno of f.annotations) {
|
||||
if (anno.type == 'Param') {
|
||||
readmeFunc.args = anno.args[0];
|
||||
}
|
||||
else if (anno.type == 'Description') {
|
||||
} else if (anno.type == 'Description') {
|
||||
readmeFunc.description = anno.args[0];
|
||||
}
|
||||
else if (anno.type == 'Result') {
|
||||
} else if (anno.type == 'Result') {
|
||||
readmeFunc.result = anno.args[0];
|
||||
}
|
||||
}
|
||||
@ -138,7 +136,7 @@ var genData = function () {
|
||||
if ($('#gasLimit').val() == undefined || $('#gasLimit').val() == "") {
|
||||
arg.gasLimit = '1000';
|
||||
} else {
|
||||
arg.gasLimit =$('#gasLimit').val();
|
||||
arg.gasLimit = $('#gasLimit').val();
|
||||
}
|
||||
// console.log("[arg.gasLimit]"+arg.gasLimit);
|
||||
request.pubkey = sm2Key.publicKey;
|
||||
@ -177,11 +175,12 @@ var importContractInstanceCodeByDOI = function () {
|
||||
};
|
||||
|
||||
var openinClient = function () {
|
||||
var path = document.location.pathname;
|
||||
path = path.replace("/SCIDE","");
|
||||
path = path.replace("/OnlineIDE.html","");
|
||||
var url = path + "/client/bdwareclient.html?self=true&contract="
|
||||
+ mainVue.contracts[selectedContract.value].id;
|
||||
let url
|
||||
if (global.isBaaS) {
|
||||
url = `${location.origin}/client/BaaSClient.html${location.search}`;
|
||||
} else {
|
||||
url = `${location.origin}/client/bdwareclient.html?self=true&contract=${mainVue.contracts[selectedContract.value].id}`
|
||||
}
|
||||
window.open(url);
|
||||
};
|
||||
|
||||
@ -192,7 +191,7 @@ var stopAllContract = function () {
|
||||
};
|
||||
var selectContractToExecute = function () {
|
||||
var value = selectedContractAtExecute.value;
|
||||
if (value != undefined && value != "选择实例") {
|
||||
if (!value && value !== "选择实例") {
|
||||
var exportedFunction = mainVue.contracts[value].exportedFunctions;
|
||||
mainVue.contractFunctions = exportedFunction;
|
||||
|
||||
@ -220,7 +219,6 @@ var executeContract = function () {
|
||||
var request = {};
|
||||
|
||||
|
||||
|
||||
request.action = "executeContract";
|
||||
request.requestID = new Date().getTime() + "_"
|
||||
+ Math.floor(Math.random() * 10000);
|
||||
@ -233,12 +231,12 @@ var executeContract = function () {
|
||||
if ($('#gasLimit').val() == undefined || $('#gasLimit').val() == "") {
|
||||
arg.gasLimit = '1000';
|
||||
} else {
|
||||
arg.gasLimit =$('#gasLimit').val();
|
||||
arg.gasLimit = $('#gasLimit').val();
|
||||
}
|
||||
// console.log("[arg.gasLimit]"+arg.gasLimit);
|
||||
request.pubkey = sm2Key.publicKey;
|
||||
request.signature = sm2.doSignature(request.contractID + "|" + arg.action
|
||||
+ "|" + arg.arg + "|" + sm2Key.publicKey, sm2Key.privateKey,{hash:true,der:true});
|
||||
+ "|" + arg.arg + "|" + sm2Key.publicKey, sm2Key.privateKey, {hash: true, der: true});
|
||||
request.arg = JSON.stringify(arg);
|
||||
|
||||
localStorage.setItem("persisArg", JSON.stringify(request));
|
||||
@ -271,7 +269,7 @@ var executeContractWithDynamicResult = function () {
|
||||
request.pubkey = global.sm2Key.publicKey;
|
||||
request.signature = sm2.doSignature(request.contractID + "|" + arg.action
|
||||
+ "|" + arg.arg + "|" + global.sm2Key.publicKey,
|
||||
global.sm2Key.privateKey,{hash:true,der:true});
|
||||
global.sm2Key.privateKey, {hash: true, der: true});
|
||||
localStorage.setItem("persisArg", JSON.stringify(request));
|
||||
global.wssocket.send(JSON.stringify(request));
|
||||
};
|
||||
|
@ -77,8 +77,8 @@ var importContractInstanceCodeByDOI = function () {
|
||||
|
||||
var openinClient = function () {
|
||||
var path = document.location.pathname;
|
||||
path = path.replace("/SCIDE","");
|
||||
path = path.replace("/OnlineIDE.html","");
|
||||
path = path.replace("/SCIDE", "");
|
||||
path = path.replace("/OnlineIDE.html", "");
|
||||
var url = path + "/client/bdwareclient.html?self=true&contract="
|
||||
+ mainVue.contracts[selectedContract.value].id;
|
||||
window.open(url);
|
||||
@ -91,7 +91,7 @@ var stopAllContract = function () {
|
||||
};
|
||||
var selectContractToExecute = function () {
|
||||
var value = selectedContractAtExecute.value;
|
||||
if (value != undefined && value != "Select Instance") {
|
||||
if (value && value !== "Select Instance") {
|
||||
var exportedFunction = mainVue.contracts[value].exportedFunctions;
|
||||
mainVue.contractFunctions = exportedFunction;
|
||||
|
||||
@ -119,7 +119,6 @@ var executeContract = function () {
|
||||
var request = {};
|
||||
|
||||
|
||||
|
||||
request.action = "executeContract";
|
||||
request.requestID = new Date().getTime() + "_"
|
||||
+ Math.floor(Math.random() * 10000);
|
||||
@ -135,9 +134,9 @@ var executeContract = function () {
|
||||
if ($('#gasLimit').val() == undefined || $('#gasLimit').val() == "") {
|
||||
arg.gasLimit = '1000';
|
||||
} else {
|
||||
arg.gasLimit =$('#gasLimit').val();
|
||||
arg.gasLimit = $('#gasLimit').val();
|
||||
}
|
||||
console.log("[arg.gasLimit]"+arg.gasLimit);
|
||||
console.log("[arg.gasLimit]" + arg.gasLimit);
|
||||
//request.withEvaluatesAnalysis = global.withEvaluatesAnalysis;
|
||||
//}
|
||||
request.pubkey = sm2Key.publicKey;
|
||||
|
Loading…
Reference in New Issue
Block a user