From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by lists.proxmox.com (Postfix) with ESMTPS id 9D30D64CAC; Fri, 4 Mar 2022 12:32:45 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 9216F3A8B; Fri, 4 Mar 2022 12:32:15 +0100 (CET) Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com [94.136.29.106]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by firstgate.proxmox.com (Proxmox) with ESMTPS id BB59D3A45; Fri, 4 Mar 2022 12:32:13 +0100 (CET) Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1]) by proxmox-new.maurer-it.com (Proxmox) with ESMTP id 8D14A46EC7; Fri, 4 Mar 2022 12:32:13 +0100 (CET) From: Stefan Sterz To: pbs-devel@lists.proxmox.com, pve-devel@lists.proxmox.com Date: Fri, 4 Mar 2022 12:32:01 +0100 Message-Id: <20220304113202.4137916-6-s.sterz@proxmox.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220304113202.4137916-1-s.sterz@proxmox.com> References: <20220304113202.4137916-1-s.sterz@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL -0.000 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record T_SCC_BODY_TEXT_LINE -0.01 - Subject: [pve-devel] [PATCH proxmox-backup v3 5/6] fix #3607: ui: refactor notes by moving the panel/window to widget kit X-BeenThere: pve-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox VE development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 Mar 2022 11:32:45 -0000 for better re-use between pbs and pve move the markdown notes panel and editor window to the widget kit and unify them there. Signed-off-by: Stefan Sterz --- www/Makefile | 1 - www/NodeNotes.js | 2 +- www/panel/MarkdownNotes.js | 130 ------------------------------------- 3 files changed, 1 insertion(+), 132 deletions(-) delete mode 100644 www/panel/MarkdownNotes.js diff --git a/www/Makefile b/www/Makefile index aff0c901..922d8de9 100644 --- a/www/Makefile +++ b/www/Makefile @@ -81,7 +81,6 @@ JSSRC= \ panel/StorageAndDisks.js \ panel/UsageChart.js \ panel/NodeInfo.js \ - panel/MarkdownNotes.js \ ZFSList.js \ DirectoryList.js \ LoginView.js \ diff --git a/www/NodeNotes.js b/www/NodeNotes.js index 7fa3f2e6..f237f556 100644 --- a/www/NodeNotes.js +++ b/www/NodeNotes.js @@ -11,7 +11,7 @@ Ext.define('PBS.NodeNotes', { xtype: 'container', layout: 'fit', items: [{ - xtype: 'pbsMarkdownNotes', + xtype: 'pmxNotesView', tools: false, border: false, node: 'localhost', diff --git a/www/panel/MarkdownNotes.js b/www/panel/MarkdownNotes.js deleted file mode 100644 index 6d601401..00000000 --- a/www/panel/MarkdownNotes.js +++ /dev/null @@ -1,130 +0,0 @@ -Ext.define('PBS.panel.MarkdownNotes', { - extend: 'Ext.panel.Panel', - xtype: 'pbsMarkdownNotes', - mixins: ['Proxmox.Mixin.CBind'], - - title: gettext("Notes"), - bodyPadding: 10, - scrollable: true, - animCollapse: false, - maxLength: 64*1022, - - cbindData: function(initalConfig) { - let me = this; - - if (!me.node) { - throw 'no node provided, cannot construct url'; - } - - me.url = `/api2/extjs/nodes/${me.node}/config`; - return {}; - }, - - run_editor: function() { - let me = this; - Ext.create('Proxmox.window.Edit', { - title: gettext('Notes'), - onlineHelp: 'markdown_basics', - width: 800, - height: 600, - resizable: true, - layout: 'fit', - defaultButton: undefined, - items: { - xtype: 'textarea', - maxLength: me.maxLength, - name: 'description', - height: '100%', - value: '', - hideLabel: true, - emptyText: gettext('You can use Markdown for rich text formatting.'), - fieldStyle: { - 'white-space': 'pre-wrap', - 'font-family': 'monospace', - }, - }, - url: me.url, - listeners: { - destroy: function() { - me.load(); - }, - }, - autoShow: true, - autoLoad: true, - }); - }, - - setNotes: function(value) { - let me = this; - var data = value || ''; - - let mdHtml = Proxmox.Markdown.parse(data); - me.update(mdHtml); - - if (me.collapsible && me.collapseMode === 'auto') { - me.setCollapsed(data === ''); - } - }, - - load: function() { - var me = this; - - Proxmox.Utils.API2Request({ - url: me.url, - waitMsgTarget: me, - failure: function(response, opts) { - Ext.Msg.alert(gettext('Error'), response.htmlStatus); - me.setCollapsed(false); - }, - success: function(response, opts) { - me.setNotes(response.result.data.description); - }, - }); - }, - - listeners: { - render: function(c) { - var me = this; - me.getEl().on('dblclick', me.run_editor, me); - }, - afterlayout: function() { - let me = this; - if (me.collapsible && !me.getCollapsed() && me.collapseMode === 'always') { - me.setCollapsed(true); - me.collapseMode = ''; // only once, on initial load! - } - }, - }, - - tools: [{ - type: 'gear', - handler: function() { - this.up('panel').run_editor(); - }, - }], - - tbar: { - itemId: 'tbar', - hidden: true, - items: [ - { - text: gettext('Edit'), - handler: function() { - this.up('panel').run_editor(); - }, - }, - ], - }, - - initComponent: function() { - var me = this; - - me.callParent(); - - if (me.enableTbar === true) { - me.down('#tbar').setVisible(true); - } - - me.load(); - }, -}); -- 2.30.2