2.0.0(preview)

This commit is contained in:
masnn committed 2020-06-08 13:41:43 +08:00
1 parent d5929d78b1
commit 1c8b62a6d9
33 files changed
+307 -241

No files matched your search

-3
View File
@@ -18,7 +18,6 @@ const page = new NamedPage('manage_module', () => {
});
addModuleDialog.clear = function () {
this.$dom.find('[name="url"]').val('');
this.$dom.find('[name="id"]').val('');
return this;
};
@@ -26,12 +25,10 @@ const page = new NamedPage('manage_module', () => {
const action = await addModuleDialog.clear().open();
if (action !== 'ok') return;
const url = addModuleDialog.$dom.find('[name="url"]').val();
const id = addModuleDialog.$dom.find('[name="id"]').val();
try {
await request.post('', {
operation: 'install',
url,
id,
});
window.location.reload();
} catch (error) {
+40
View File
@@ -0,0 +1,40 @@
import { NamedPage } from 'vj/misc/PageLoader';
import Notification from 'vj/components/notification';
import { ActionDialog } from 'vj/components/dialog';
import request from 'vj/utils/request';
const page = new NamedPage('manage_script', () => {
const runScriptDialog = new ActionDialog({
$body: $('.dialog__body--run-script > div'),
onDispatch(action) {
const $args = runScriptDialog.$dom.find('[name="args"]');
if (action === 'ok' && $args.val() === '') {
$args.focus();
return false;
}
return true;
},
});
runScriptDialog.clear = function () {
this.$dom.find('[name="args"]').val('');
return this;
};
window.runScript = async function (id) {
const action = await runScriptDialog.clear().open();
if (action !== 'ok') return;
const args = runScriptDialog.$dom.find('[name="args"]').val();
try {
await request.post('', {
args,
id,
});
window.location.reload();
} catch (error) {
Notification.error(error.message);
}
};
});
export default page;