Remove dead code
This commit is contained in:
parent
f2991dd130
commit
9f05099338
@ -161,14 +161,6 @@ class ChatElement extends HTMLElement {
|
||||
|
||||
}
|
||||
|
||||
attributeChangedCallback(name: string, oldValue: string, newValue: string) {
|
||||
console.log(`🔄 Attribute ${name} changed from ${oldValue} to ${newValue}`);
|
||||
if (name === 'process-id' && newValue) {
|
||||
console.log('🔍 Loading chat with new process ID:', newValue);
|
||||
this.loadGroupListFromAProcess(newValue);
|
||||
}
|
||||
}
|
||||
|
||||
private initMessageEvents() {
|
||||
const sendButton = this.shadowRoot?.querySelector('#send-button');
|
||||
if (sendButton) {
|
||||
@ -1516,126 +1508,6 @@ class ChatElement extends HTMLElement {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Load the group list from all processes
|
||||
public async loadAllGroupListFromMyProcess(): Promise<void> {
|
||||
console.log('🎯 Loading all group list');
|
||||
const groupList = this.shadowRoot?.querySelector('#group-list');
|
||||
if (!groupList) {
|
||||
console.error('❌ Group list element not found');
|
||||
return;
|
||||
}
|
||||
|
||||
const processes = await this.getProcesses();
|
||||
|
||||
if (!processes || Object.keys(processes).length === 0) {
|
||||
console.log('⚠️ No processes found');
|
||||
return;
|
||||
}
|
||||
|
||||
for (const {key} of processes) {
|
||||
const processName = await key;
|
||||
console.log("Je suis l'id process de la boucle :" ,processName);
|
||||
this.loadGroupListFromAProcess(processName);
|
||||
}
|
||||
}
|
||||
|
||||
// Load the group list from a process
|
||||
private async loadGroupListFromAProcess(processId: string): Promise<void> {
|
||||
console.log('Loading group list with processId:', processId);
|
||||
const groupList = this.shadowRoot?.querySelector('#group-list');
|
||||
if (!groupList) return;
|
||||
|
||||
groupList.innerHTML = '';
|
||||
|
||||
this.processId = processId;
|
||||
const service = await Services.getInstance();
|
||||
const process = await service.getProcess(this.processId);
|
||||
|
||||
const roles = await service.getRoles(process);
|
||||
if (roles === null) {
|
||||
console.error('no roles in process');
|
||||
return;
|
||||
}
|
||||
this.processRoles = roles;
|
||||
console.log('🔑 Roles found:', this.processRoles);
|
||||
|
||||
const li = document.createElement('li');
|
||||
li.className = 'group-list-item';
|
||||
li.setAttribute('data-process-id', processId);
|
||||
|
||||
|
||||
|
||||
const container = document.createElement('div');
|
||||
container.className = 'group-item-container';
|
||||
|
||||
const nameSpan = document.createElement('span');
|
||||
nameSpan.textContent = `Process : `;
|
||||
nameSpan.className = 'process-name';
|
||||
|
||||
container.appendChild(nameSpan);
|
||||
|
||||
await addressToEmoji(processId).then(emojis => {
|
||||
const emojiSpan = document.createElement('span');
|
||||
emojiSpan.className = 'process-emoji';
|
||||
emojiSpan.textContent = emojis;
|
||||
container.appendChild(emojiSpan);
|
||||
});
|
||||
|
||||
li.appendChild(container);
|
||||
|
||||
const roleList = document.createElement('ul');
|
||||
roleList.className = 'role-list';
|
||||
(roleList as HTMLElement).style.display = 'none';
|
||||
|
||||
// Traiter chaque rôle
|
||||
Object.entries(roles).forEach(([roleName, roleData]: [string, any]) => {
|
||||
const roleItem = document.createElement('li');
|
||||
roleItem.className = 'role-item';
|
||||
|
||||
const roleContainer = document.createElement('div');
|
||||
roleContainer.className = 'role-item-container';
|
||||
|
||||
const roleNameSpan = document.createElement('span');
|
||||
roleNameSpan.className = 'role-name';
|
||||
roleNameSpan.textContent = roleName;
|
||||
|
||||
// Filtrer les membres dupliqués ici, avant de les passer à toggleMembers
|
||||
const uniqueMembers = new Map<string, any>();
|
||||
roleData.members?.forEach((member: any) => {
|
||||
const spAddress = member.sp_addresses?.[0];
|
||||
if (spAddress && !uniqueMembers.has(spAddress)) {
|
||||
uniqueMembers.set(spAddress, member);
|
||||
}
|
||||
});
|
||||
|
||||
// Créer un nouveau roleData avec les membres uniques
|
||||
const filteredRoleData = {
|
||||
...roleData,
|
||||
members: Array.from(uniqueMembers.values())
|
||||
};
|
||||
|
||||
roleContainer.addEventListener('click', async (event) => {
|
||||
console.log("CLICKED ON ROLE:", roleName);
|
||||
event.stopPropagation();
|
||||
await this.toggleMembers(filteredRoleData, roleItem);
|
||||
});
|
||||
|
||||
roleContainer.appendChild(roleNameSpan);
|
||||
roleItem.appendChild(roleContainer);
|
||||
roleList.appendChild(roleItem);
|
||||
});
|
||||
|
||||
li.appendChild(roleList);
|
||||
groupList.appendChild(li);
|
||||
|
||||
container.addEventListener('click', (event) => {
|
||||
event.stopPropagation();
|
||||
container.classList.toggle('expanded');
|
||||
roleList.style.display = container.classList.contains('expanded') ? 'block' : 'none';
|
||||
});
|
||||
}
|
||||
|
||||
// Send a file
|
||||
private async sendFile(file: File) {
|
||||
const MAX_FILE_SIZE = 1 * 1024 * 1024;
|
||||
|
Loading…
x
Reference in New Issue
Block a user