diff --git a/assets/swirl/ts/stack/archive/edit.ts b/assets/swirl/ts/stack/archive/edit.ts deleted file mode 100644 index a6d7f99..0000000 --- a/assets/swirl/ts/stack/archive/edit.ts +++ /dev/null @@ -1,70 +0,0 @@ -/// -namespace Swirl.Stack.Archive { - import Validator = Swirl.Core.Validator; - import AjaxResult = Swirl.Core.AjaxResult; - import Notification = Swirl.Core.Notification; - import ValidationRule = Swirl.Core.ValidationRule; - - class ContentRequiredRule implements ValidationRule { - validate($form: JQuery, $input: JQuery, arg?: string): {ok: boolean, error?: string} { - let el = $input[0]; - if ($("#type-" + arg).prop("checked")) { - console.log(el.value); - return {ok: el.checkValidity ? el.checkValidity() : true, error: el.validationMessage}; - } - return {ok: true} - } - } - - export class EditPage { - private editor: any; - - constructor() { - Validator.register("content", new ContentRequiredRule(), ""); - - this.editor = CodeMirror.fromTextArea($("#txt-content")[0], {lineNumbers: true}); - - $("#file-content").change(e => { - let file = e.target; - if (file.files.length > 0) { - $('#filename').text(file.files[0].name); - } - }); - $("#type-input,#type-upload").click(e => { - let type = $(e.target).val(); - $("#div-input").toggle(type == "input"); - $("#div-upload").toggle(type == "upload"); - }); - $("#btn-submit").click(this.submit.bind(this)) - } - - private submit(e: JQueryEventObject) { - this.editor.save(); - - let results = Validator.bind("#div-form").validate(); - if (results.length > 0) { - return; - } - - let data = new FormData(); - data.append('name', $("#name").val()); - if ($("#type-input").prop("checked")) { - data.append('content', $('#txt-content').val()); - } else { - let file = $('#file-content')[0]; - data.append('content', file.files[0]); - } - - let url = $(e.target).data("url") || ""; - $ajax.post(url, data).encoder("none").trigger(e.target).json((r: AjaxResult) => { - if (r.success) { - location.href = "/stack/archive/" - } else { - Notification.show("danger", `FAILED: ${r.message}`); - } - }) - } - } -} - -declare var CodeMirror: any; \ No newline at end of file diff --git a/assets/swirl/ts/stack/archive/list.ts b/assets/swirl/ts/stack/archive/list.ts deleted file mode 100644 index 6120e4a..0000000 --- a/assets/swirl/ts/stack/archive/list.ts +++ /dev/null @@ -1,37 +0,0 @@ -/// -namespace Swirl.Stack.Archive { - import Modal = Swirl.Core.Modal; - import AjaxResult = Swirl.Core.AjaxResult; - import Dispatcher = Swirl.Core.Dispatcher; - - export class ListPage { - constructor() { - let dispatcher = Dispatcher.bind("#table-items"); - dispatcher.on("deploy-archive", this.deployArchive.bind(this)); - dispatcher.on("delete-archive", this.deleteArchive.bind(this)); - } - - private deployArchive(e: JQueryEventObject) { - let $tr = $(e.target).closest("tr"); - let id = $tr.data("id"); - let name = $tr.find("td:first").text().trim(); - Modal.confirm(`Are you sure to deploy archive: ${name}?`, "Deploy archive", (dlg, e) => { - $ajax.post("deploy", {id: id}).trigger(e.target).encoder("form").json(r => { - dlg.close(); - }) - }); - } - - private deleteArchive(e: JQueryEventObject) { - let $tr = $(e.target).closest("tr"); - let id = $tr.data("id"); - let name = $tr.find("td:first").text().trim(); - Modal.confirm(`Are you sure to remove archive: ${name}?`, "Delete archive", (dlg, e) => { - $ajax.post("delete", {id: id}).trigger(e.target).encoder("form").json(r => { - $tr.remove(); - dlg.close(); - }) - }); - } - } -} \ No newline at end of file diff --git a/assets/swirl/ts/stack/task/list.ts b/assets/swirl/ts/stack/task/list.ts deleted file mode 100644 index ea29936..0000000 --- a/assets/swirl/ts/stack/task/list.ts +++ /dev/null @@ -1,24 +0,0 @@ -/// -namespace Swirl.Stack.Task { - import Modal = Swirl.Core.Modal; - import AjaxResult = Swirl.Core.AjaxResult; - import Dispatcher = Swirl.Core.Dispatcher; - - export class ListPage { - constructor() { - let dispatcher = Dispatcher.bind("#table-items"); - dispatcher.on("delete-stack", this.deleteStack.bind(this)); - } - - private deleteStack(e: JQueryEventObject) { - let $tr = $(e.target).closest("tr"); - let name = $tr.find("td:first").text().trim(); - Modal.confirm(`Are you sure to remove stack: ${name}?`, "Delete stack", (dlg, e) => { - $ajax.post("delete", {name: name}).trigger(e.target).encoder("form").json(r => { - $tr.remove(); - dlg.close(); - }) - }); - } - } -} \ No newline at end of file diff --git a/config/i18n/en.yml b/config/i18n/en.yml index 6b55b82..f47a723 100644 --- a/config/i18n/en.yml +++ b/config/i18n/en.yml @@ -74,8 +74,6 @@ menu.network: Networks menu.service: Services menu.service.template: Templates menu.stack: Stacks -menu.stack.task: Tasks -menu.stack.archive: Archives menu.task: Tasks menu.secret: Secrets menu.config: Configs diff --git a/config/i18n/zh.yml b/config/i18n/zh.yml index 9fdc7ac..b5dc51a 100644 --- a/config/i18n/zh.yml +++ b/config/i18n/zh.yml @@ -74,8 +74,6 @@ menu.network: 网络 menu.service: 服务 menu.service.template: 模板 menu.stack: 编排 -menu.stack.task: 任务 -menu.stack.archive: 档案 menu.task: 任务 menu.secret: 私密配置 menu.config: 常规配置