Zimbra / zimlet-cli

Client tool to Develop, Build, and Package Zimbra X compatible zimlets for development and production.
GNU General Public License v3.0
13 stars 5 forks source link

Empty props.emailData #245

Open JulienSellier opened 1 month ago

JulienSellier commented 1 month ago

Hello,

Context: I try to code a custom zimlet and I have checked https://github.com/Zimbra/zm-zimlet-guide and all resources I could found about Zimlets for Zimbra 10.

Problem: My component get an empty array in props.emailData.

// src/index.js

import {createElement, Fragment} from 'preact';
import {provide} from 'preact-context-provider';
import classerEmail from "./components/classerEmail";

export default function Zimlet(context) {
  const {plugins} = context;

  const exports = {};

  exports.init = function init() {
    // The zimlet slots to load into, and what is being loaded into that slot
    plugins.register('slot::header-action-menu-item', provide(context)(classerEmail));
  };

  return exports;
}

// src/components/classerEmail/index.js

import {createElement} from 'preact';
import {withIntl} from "../../enhancers";
import {ActionButton, ModalDialog, TextInput} from '@zimbra-client/components';
import {compose} from 'recompose';

function classerEmail(props, context) {
  console.log(props.emailData); // Array [] length 0

  return (<div>test</div)
}
export default compose(withIntl())(classerEmail)

Can you help me ?

Other question : is there any documentation about Zimbra components listed there: https://github.com/cdubsodo/zm-x-web/tree/master/src/components ? It's hard to figure out how to use them...

Thanks

miteshsavani810 commented 1 month ago

@JulienSellier When you select a mail/conversation in the list then you will get selected items data in the props.emailData

JulienSellier commented 1 month ago

@miteshsavani810 Thanks for your answer, I managed to get them by deselecting the email then selecting it again but do you know why props.emailData is empty when is the email is pre-selected ? Is-it a bug ?

Other question, I can't deploy the Zimlet Sideloader because I get the error No package zimbra-zimlet-sideloader available

[root@zmpxy ~]# sudo yum install zimbra-zimlet-sideloader
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
epel/x86_64/metalink                                                                                                                 | 5.1 kB  00:00:00
 * epel: mirrors.hostiserver.com
base                                                                                                                                 | 3.6 kB  00:00:00
extras                                                                                                                               | 2.9 kB  00:00:00
updates                                                                                                                              | 2.9 kB  00:00:00
zimbra                                                                                                                               | 3.0 kB  00:00:00
zimbra-8815-oss                                                                                                                      | 3.0 kB  00:00:00
zimbra-90-oss                                                                                                                        | 3.0 kB  00:00:00
No package zimbra-zimlet-sideloader available.
Error: Nothing to do

I tried to update and upgrade sources but it didn't worked.

Thanks!

miteshsavani810 commented 1 month ago

@JulienSellier Yes, It is a bug, when you select 1 mail/conversation and reload the browser, the mail/conversation appears selected but you get the empty value in props.emailData.

Regarding unable to deploy the Zimlet Sideloader. Can you please tell us what OS and Zimbra version you're using? You can share the output of zmcontrol -v (run this command by zimbra user.)

JulienSellier commented 1 month ago

@miteshsavani810 Sure!

[root@zmpxy ~]# cat /etc/os-release
NAME="CentOS Linux"
VERSION="7 (Core)"
ID="centos"
ID_LIKE="rhel fedora"
[zimbra@zmpxy root]$ zmcontrol -v
Release 9.0.0_ZEXTRAS_20220713.RHEL7_64_20220705100521 RHEL7_64 FOSS edition.
JulienSellier commented 2 weeks ago

Hello @miteshsavani810 , I managed to install the Zimlet Sideloader so this point is fixed.

Is there a way to fix the empty props.emailData ?

Other question: how can i retrieve user's authentication token in the zimlet? On Zimbra 9 we are using a .jsp file to write the value and make it accessible in the zimlet.

Thanks for your help.