Initial commit (code only without large binaries)

This commit is contained in:
robin
2026-02-15 18:58:44 +08:00
commit 35df75498f
9442 changed files with 1495866 additions and 0 deletions

View File

@@ -0,0 +1,29 @@
{$layout "layout_popup"}
{$template "/code_editor"}
<h3>创建脚本</h3>
<form class="ui form" data-tea-action="$" data-tea-success="success">
<csrf-token></csrf-token>
<table class="ui table definition selectable">
<tr>
<td class="title">脚本文件名 *</td>
<td>
<input type="text" name="filename" maxlength="50" ref="focus" placeholder="xxx.js" spellcheck="false"/>
</td>
</tr>
<tr>
<td>脚本说明 *</td>
<td>
<input type="text" name="name" maxlength="50" placeholder="脚本用途"/>
</td>
</tr>
<tr>
<td>脚本代码</td>
<td>
<source-code-box type="application/javascript" :read-only="false" name="code" height="200"></source-code-box>
</td>
</tr>
</table>
<submit-btn></submit-btn>
</form>

View File

@@ -0,0 +1,43 @@
{$layout}
<first-menu>
<menu-item @click.prevent="createScript">[创建脚本]</menu-item>
<span class="item"><tip-icon content="在这里添加的脚本会在脚本上下文启动的时候直接运行,定义的函数和类可以在其他脚本中直接引用。"></tip-icon></span>
</first-menu>
<p class="ui message blue" v-if="hasUpdates">
<a href="" @click.prevent="publishScripts">脚本库已被修改,点此发布到边缘节点。</a>
</p>
<p class="comment" v-if="scripts.length == 0">暂时还没有脚本。</p>
<div v-if="scripts.length > 0">
<div class="margin"></div>
<table class="ui table selectable">
<thead>
<tr>
<th>脚本文件名</th>
<th>脚本说明</th>
<th>修改时间</th>
<th class="two wide">状态</th>
<th class="two op">操作</th>
</tr>
</thead>
<tr v-for="script in scripts">
<td>
<a :href="'/servers/scripts/script?scriptId=' + script.id">{{script.filename}}</a>
<span v-if="script.isChanged" title="已修改">*</span>
</td>
<td>{{script.name}}</td>
<td>{{script.updatedTime}}</td>
<td>
<label-on :v-is-on="script.isOn"></label-on>
</td>
<td>
<a :href="'/servers/scripts/script?scriptId=' + script.id">详情</a> &nbsp;
<a href="" @click.prevent="deleteScript(script.id)">删除</a>
</td>
</tr>
</table>
</div>
<div class="page" v-html="page"></div>

View File

@@ -0,0 +1,31 @@
Tea.context(function () {
this.createScript = function () {
teaweb.popup(".createPopup", {
height: "28em",
callback: function () {
teaweb.successRefresh("保存成功")
}
})
}
this.deleteScript = function (scriptId) {
let that = this
teaweb.confirm("确定要删除此脚本吗?", function () {
that.$post(".delete")
.params({
scriptId: scriptId
})
.refresh()
.success()
})
}
this.publishScripts = function () {
let that = this
teaweb.confirm("确定要发布脚本到边缘节点?", function () {
that.$post(".publish")
.refresh()
.success()
})
}
})

View File

@@ -0,0 +1,35 @@
{$layout}
{$template "/code_editor"}
<first-menu>
<menu-item href="/servers/scripts">脚本库</menu-item>
<span class="item disabled" style="padding: 0">&raquo;</span>
<menu-item :href="'.script?scriptId=' + script.id" class="active">"{{script.filename}}"详情</menu-item>
<menu-item :href="'.update?scriptId=' + script.id">修改</menu-item>
</first-menu>
<table class="ui table definition selectable">
<tr>
<td class="title">脚本文件名</td>
<td>
{{script.filename}}
</td>
</tr>
<tr>
<td>状态</td>
<td><label-on :v-is-on="script.isOn"></label-on></td>
</tr>
<tr>
<td>脚本说明</td>
<td>
{{script.name}}
</td>
</tr>
<tr>
<td>脚本代码</td>
<td>
<source-code-box type="application/javascript" name="code">{{script.code}}</source-code-box>
<p class="comment"><a :href="'/servers/scripts/update?scriptId=' + script.id + '&editingCode=1'">[修改代码]</a></p>
</td>
</tr>
</table>

View File

@@ -0,0 +1,46 @@
{$layout}
{$template "/code_editor"}
<first-menu>
<menu-item href="/servers/scripts">脚本库</menu-item>
<span class="item disabled" style="padding: 0">&raquo;</span>
<menu-item :href="'.script?scriptId=' + script.id">"{{script.filename}}"详情</menu-item>
<menu-item :href="'.update?scriptId=' + script.id" class="active">修改</menu-item>
</first-menu>
<form class="ui form" data-tea-action="$" data-tea-success="success">
<csrf-token></csrf-token>
<input type="hidden" name="scriptId" :value="script.id"/>
<table class="ui table definition selectable">
<tr>
<td class="title">脚本文件名 *</td>
<td>
<input type="text" name="filename" maxlength="50" :ref="isEditingCode ? '' : 'focus'" placeholder="xxx.js" v-model="script.filename" spellcheck="false"/>
</td>
</tr>
<tr>
<td>脚本说明 *</td>
<td>
<input type="text" name="name" maxlength="50" placeholder="脚本用途" v-model="script.name"/>
</td>
</tr>
<tr>
<td>脚本代码</td>
<td>
<source-code-box type="application/javascript" :read-only="false" name="code" height="200" focus="true">{{script.code}}</source-code-box>
</td>
</tr>
<tr>
<td colspan="2"><more-options-indicator></more-options-indicator></td>
</tr>
<tbody v-show="moreOptionsVisible">
<tr>
<td>启用当前脚本</td>
<td>
<checkbox name="isOn" v-model="script.isOn"></checkbox>
</td>
</tr>
</tbody>
</table>
<submit-btn></submit-btn>
</form>

View File

@@ -0,0 +1,3 @@
Tea.context(function () {
this.success = NotifyReloadSuccess("保存成功")
})