Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ coreshop.messenger.list = Class.create({
messagesStore: null,
failedMessagesStore: null,

autoRefreshInterval: null,
autoRefreshTimer: null,
lastRefreshLabel: null,

initialize: function () {
this.getPanel();
},
Expand All @@ -36,8 +40,47 @@ coreshop.messenger.list = Class.create({
}
},

updateLastRefreshLabel: function () {
if (this.lastRefreshLabel) {
var now = new Date();
var timeString = Ext.Date.format(now, 'Y-m-d H:i:s');
this.lastRefreshLabel.setText(t('coreshop_messenger_last_refresh') + ': ' + timeString);
}
},

startAutoRefresh: function (interval) {
this.stopAutoRefresh();

if (interval > 0) {
this.autoRefreshInterval = interval;
this.autoRefreshTimer = setInterval(this.reload.bind(this), interval * 1000);
}
},

stopAutoRefresh: function () {
if (this.autoRefreshTimer) {
clearInterval(this.autoRefreshTimer);
this.autoRefreshTimer = null;
}
this.autoRefreshInterval = null;
},

getPanel: function () {
if (!this.panel) {
this.lastRefreshLabel = Ext.create('Ext.toolbar.TextItem', {
text: ''
});

var autoRefreshStore = Ext.create('Ext.data.Store', {
fields: ['value', 'text'],
data: [
{value: 0, text: t('coreshop_messenger_auto_refresh_disabled')},
{value: 5, text: t('coreshop_messenger_auto_refresh_5s')},
{value: 10, text: t('coreshop_messenger_auto_refresh_10s')},
{value: 30, text: t('coreshop_messenger_auto_refresh_30s')}
]
});

this.panel = Ext.create('Ext.panel.Panel', {
id: 'coreshop_messenger_list',
title: t('coreshop_messenger_list'),
Expand All @@ -49,7 +92,21 @@ coreshop.messenger.list = Class.create({
xtype: 'button',
iconCls: 'pimcore_icon_reload',
handler: this.reload.bind(this)
}],
}, '-', {
xtype: 'combo',
store: autoRefreshStore,
displayField: 'text',
valueField: 'value',
value: 0,
editable: false,
width: 200,
queryMode: 'local',
listeners: {
select: function (combo, record) {
this.startAutoRefresh(record.get('value'));
}.bind(this)
}
}, '->', this.lastRefreshLabel],
items: [{
xtype: 'panel',
layout: 'border',
Expand Down Expand Up @@ -78,6 +135,7 @@ coreshop.messenger.list = Class.create({
tabPanel.setActiveItem('coreshop_messenger_list');

this.panel.on('destroy', function () {
this.stopAutoRefresh();
pimcore.globalmanager.remove('coreshop_messenger_list');
}.bind(this));

Expand All @@ -98,7 +156,10 @@ coreshop.messenger.list = Class.create({
rootProperty: 'data'
}
},
fields: ['name', 'count']
fields: ['name', 'count'],
listeners: {
load: this.updateLastRefreshLabel.bind(this)
}
});
this.chartStore.load();

Expand All @@ -118,6 +179,11 @@ coreshop.messenger.list = Class.create({
position: 'bottom',
grid: true,
fields: ['receiver'],
label: {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot this messes up the design and the chart is not seeable anymore, change it to trim the labels but also show them on hover on the bar

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed in f58485a. Labels longer than 15 characters are now trimmed with ellipsis, and hovering over a bar shows a tooltip with the full queue name and message count.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot there is still an issue with queues that have 0 messages, I sometimes cannot see what queue it is

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in a40e747. For queues with 0 messages, the label above the bar now shows the truncated queue name followed by "(0)" (e.g., "async_priority_high (0)"). This makes it easy to identify which queue has 0 messages without needing to hover. Queues with messages still show just the count number as before.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot now you completely messed it up :O

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reverted to the original clean chart design in 1b15e2c. The chart now shows:

  • Count labels inside bars (original design)
  • Tooltip on bar hover showing full queue name + count
  • Highlight effect on bar hover

The complex label modifications that broke the design have been removed.

rotate: {
degrees: -45
}
}
}],
series: [{
type: 'bar',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,9 @@ coreshop_messenger_failed_messages: 'Fehlgeschlagene Nachrichten'
coreshop_messenger_pending_messages: 'Ausstehende Nachrichten'
coreshop_messenger_receivers: 'Empfänger'
coreshop_messenger_info: 'Details'
coreshop_permission_messenger: 'CoreShop: Messenger'
coreshop_permission_messenger: 'CoreShop: Messenger'
coreshop_messenger_last_refresh: 'Aktualisiert'
coreshop_messenger_auto_refresh_disabled: 'Nicht aktualisieren'
coreshop_messenger_auto_refresh_5s: 'Alle 5 Sekunden aktualisieren'
coreshop_messenger_auto_refresh_10s: 'Alle 10 Sekunden aktualisieren'
coreshop_messenger_auto_refresh_30s: 'Alle 30 Sekunden aktualisieren'
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,9 @@ coreshop_messenger_failed_messages: 'Failed Messages'
coreshop_messenger_pending_messages: 'Pending Messages'
coreshop_messenger_receivers: 'Receivers'
coreshop_messenger_info: 'Details'
coreshop_permission_messenger: 'CoreShop: Messenger'
coreshop_permission_messenger: 'CoreShop: Messenger'
coreshop_messenger_last_refresh: 'Refreshed'
coreshop_messenger_auto_refresh_disabled: 'Do not refresh'
coreshop_messenger_auto_refresh_5s: 'Refresh every 5 seconds'
coreshop_messenger_auto_refresh_10s: 'Refresh every 10 seconds'
coreshop_messenger_auto_refresh_30s: 'Refresh every 30 seconds'
Loading