From: Stefan Sterz <s.sterz@proxmox.com>
To: pbs-devel@lists.proxmox.com, pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH manager v4 4/4] ui: move NotesView panel and NotesEdit window to widget kit
Date: Fri, 1 Apr 2022 12:19:08 +0200 [thread overview]
Message-ID: <20220401101908.1154385-5-s.sterz@proxmox.com> (raw)
In-Reply-To: <20220401101908.1154385-1-s.sterz@proxmox.com>
this removes the NotesView panel and NotesEdit and replaces them with
with the version from the widget kit.
Signed-off-by: Stefan Sterz <s.sterz@proxmox.com>
---
www/manager6/Makefile | 2 -
www/manager6/dc/Config.js | 2 +-
www/manager6/node/Config.js | 2 +-
www/manager6/panel/GuestSummary.js | 2 +-
www/manager6/panel/NotesView.js | 129 -----------------------------
www/manager6/window/NotesEdit.js | 38 ---------
6 files changed, 3 insertions(+), 172 deletions(-)
delete mode 100644 www/manager6/panel/NotesView.js
delete mode 100644 www/manager6/window/NotesEdit.js
diff --git a/www/manager6/Makefile b/www/manager6/Makefile
index e6e01bd1..af026413 100644
--- a/www/manager6/Makefile
+++ b/www/manager6/Makefile
@@ -84,7 +84,6 @@ JSSRC= \
panel/BackupJobPrune.js \
panel/HealthWidget.js \
panel/IPSet.js \
- panel/NotesView.js \
panel/RunningChart.js \
panel/StatusPanel.js \
panel/GuestStatusView.js \
@@ -102,7 +101,6 @@ JSSRC= \
window/FirewallLograteEdit.js \
window/LoginWindow.js \
window/Migrate.js \
- window/NotesEdit.js \
window/Prune.js \
window/Restore.js \
window/SafeDestroyGuest.js \
diff --git a/www/manager6/dc/Config.js b/www/manager6/dc/Config.js
index 9c54b19d..13ded12e 100644
--- a/www/manager6/dc/Config.js
+++ b/www/manager6/dc/Config.js
@@ -28,7 +28,7 @@ Ext.define('PVE.dc.Config', {
itemId: 'summary',
},
{
- xtype: 'pveNotesView',
+ xtype: 'pmxNotesView',
title: gettext('Notes'),
iconCls: 'fa fa-sticky-note-o',
itemId: 'notes',
diff --git a/www/manager6/node/Config.js b/www/manager6/node/Config.js
index 68f80391..52357df8 100644
--- a/www/manager6/node/Config.js
+++ b/www/manager6/node/Config.js
@@ -129,7 +129,7 @@ Ext.define('PVE.node.Config', {
itemId: 'summary',
},
{
- xtype: 'pveNotesView',
+ xtype: 'pmxNotesView',
title: gettext('Notes'),
iconCls: 'fa fa-sticky-note-o',
itemId: 'notes',
diff --git a/www/manager6/panel/GuestSummary.js b/www/manager6/panel/GuestSummary.js
index 82cc7a7f..35721419 100644
--- a/www/manager6/panel/GuestSummary.js
+++ b/www/manager6/panel/GuestSummary.js
@@ -40,7 +40,7 @@ Ext.define('PVE.qemu.Summary', {
rstore: rstore,
},
{
- xtype: 'pveNotesView',
+ xtype: 'pmxNotesView',
flex: 1,
padding: template ? '5' : '0 0 0 5',
itemId: 'notesview',
diff --git a/www/manager6/panel/NotesView.js b/www/manager6/panel/NotesView.js
deleted file mode 100644
index 7c8299d0..00000000
--- a/www/manager6/panel/NotesView.js
+++ /dev/null
@@ -1,129 +0,0 @@
-Ext.define('PVE.panel.NotesView', {
- extend: 'Ext.panel.Panel',
- xtype: 'pveNotesView',
-
- title: gettext("Notes"),
- bodyPadding: 10,
- scrollable: true,
- animCollapse: false,
- maxLength: 64 * 1024,
-
- tbar: {
- itemId: 'tbar',
- hidden: true,
- items: [
- {
- text: gettext('Edit'),
- handler: function() {
- let view = this.up('panel');
- view.run_editor();
- },
- },
- ],
- },
-
- run_editor: function() {
- let me = this;
- Ext.create('PVE.window.NotesEdit', {
- pveSelNode: me.pveSelNode,
- url: me.url,
- listeners: {
- destroy: () => me.load(),
- },
- autoShow: true,
- }).setMaxLength(me.maxLength);
- },
-
- load: function() {
- var me = this;
-
- Proxmox.Utils.API2Request({
- url: me.url,
- waitMsgTarget: me,
- failure: function(response, opts) {
- me.update(gettext('Error') + " " + response.htmlStatus);
- me.setCollapsed(false);
- },
- success: function(response, opts) {
- var data = response.result.data.description || '';
-
- let mdHTML = Proxmox.Markdown.parse(data);
- me.update(mdHTML);
-
- if (me.collapsible && me.collapseMode === 'auto') {
- me.setCollapsed(data === '');
- }
- },
- });
- },
-
- 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() {
- let view = this.up('panel');
- view.run_editor();
- },
- }],
-
- initComponent: function() {
- const me = this;
- const type = me.pveSelNode.data.type;
-
- if (me.pveSelNode.data.id === 'root') {
- me.url = '/api2/extjs/cluster/options';
- } else {
- const nodename = me.pveSelNode.data.node;
- if (!nodename) {
- throw "no node name specified";
- }
-
- if (!Ext.Array.contains(['node', 'qemu', 'lxc'], type)) {
- throw 'invalid type specified';
- }
-
- const vmid = me.pveSelNode.data.vmid;
- if (!vmid && type !== 'node') {
- throw "no VM ID specified";
- }
-
- me.url = `/api2/extjs/nodes/${nodename}/`;
-
- // add the type specific path if qemu/lxc and set the backend's maxLen
- if (type === 'qemu' || type === 'lxc') {
- me.url += `${type}/${vmid}/`;
- me.maxLength = 8 * 1024;
- }
- me.url += 'config';
- }
-
- me.callParent();
- if (type === 'node' || type === '') { // '' is for datacenter
- me.down('#tbar').setVisible(true);
- } else if (me.pveSelNode.data.template !== 1) {
- me.setCollapsible(true);
- me.collapseDirection = 'right';
-
- let sp = Ext.state.Manager.getProvider();
- me.collapseMode = sp.get('guest-notes-collapse', 'never');
-
- if (me.collapseMode === 'auto') {
- me.setCollapsed(true);
- }
- }
- me.load();
- },
-});
diff --git a/www/manager6/window/NotesEdit.js b/www/manager6/window/NotesEdit.js
deleted file mode 100644
index 4649843e..00000000
--- a/www/manager6/window/NotesEdit.js
+++ /dev/null
@@ -1,38 +0,0 @@
-Ext.define('PVE.window.NotesEdit', {
- extend: 'Proxmox.window.Edit',
-
- title: gettext('Notes'),
- onlineHelp: 'markdown_basics',
-
- width: 800,
- height: '600px',
-
- resizable: true,
- layout: 'fit',
-
- autoLoad: true,
- defaultButton: undefined,
-
- setMaxLength: function(maxLength) {
- let me = this;
-
- let area = me.down('textarea[name="description"]');
- area.maxLength = maxLength;
- area.validate();
-
- return me;
- },
-
- items: {
- xtype: 'textarea',
- 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',
- },
- },
-});
--
2.30.2
prev parent reply other threads:[~2022-04-01 10:20 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-01 10:19 [pve-devel] [PATCH SERIES v4 0/4] add notes to functionality to pbs webui Stefan Sterz
2022-04-01 10:19 ` [pve-devel] [PATCH proxmox-backup v4 1/4] fix #3067: docs: add markdown primer from pve to pbs Stefan Sterz
2022-04-01 10:19 ` [pve-devel] [PATCH widget-toolkit v4 2/4] toolkit: add markdown based NotesView and NotesEdit Stefan Sterz
2022-04-06 8:26 ` Stefan Sterz
2022-04-06 11:39 ` [pve-devel] [pbs-devel] " Thomas Lamprecht
2022-04-01 10:19 ` [pve-devel] [PATCH proxmox-backup v4 3/4] fix #3067: ui: add a separate notes view for longer markdown notes Stefan Sterz
2022-04-01 10:19 ` Stefan Sterz [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220401101908.1154385-5-s.sterz@proxmox.com \
--to=s.sterz@proxmox.com \
--cc=pbs-devel@lists.proxmox.com \
--cc=pve-devel@lists.proxmox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox