Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Help Wanted: Default parameters are not correctly rendered in plugin registry methods #627

Open
agarciamontoro opened this issue May 25, 2020 · 15 comments

Comments

@agarciamontoro
Copy link
Member

See, for example, registerAdminConsoleCustomSetting, where showTitle is missing:

image

This happens because the default parameters have a different structure in the AST returned by the parser.

@akshitarora921
Copy link
Contributor

Hi, Can I take this?

@agarciamontoro
Copy link
Member Author

All yours, @akshitarora921, thanks for working on this :)

@akshitarora921
Copy link
Contributor

Hi @agarciamontorom,
I have a little doubt, According to my research the registry data is coming from {{<pluginjsdocs>}} from line 81 from file /mattermost-developer-documentation/site/content/integrate/plugins/webapp but to generate its data we need to run command make plugin-data and generate json files and we are interested in PluginJSDocs.json path site/data/PluginJSDocs.json but I see that json file is also in .gitignore file. So, where do I need to make the change? as json change will not reflect in the repo.
Go is quite new to me, please pardon me if I am wrong.

@akshitarora921
Copy link
Contributor

akshitarora921 commented Oct 7, 2021

PluginJSDocs.json
image

@akshitarora921
Copy link
Contributor

ooh this is just an adventure through all the files.
Correct me if I am wrong.
when we run command it actually runs this

rm -rf scripts/mattermost-webapp
	cd scripts && git clone https://github.com/mattermost/mattermost-webapp.git
	cd scripts && npm install
	mkdir -p site/data
	node scripts/plugin-jsdocs.js > site/data/PluginJSDocs.json

and get data from this https://github.com/mattermost/mattermost-webapp/blob/master/plugins/registry.js and spits out PluginJSDocs.json which we are displaying.

Conclusion

we need to make change in file https://github.com/mattermost/mattermost-webapp/blob/master/plugins/registry.js to be precise line 197 and whole snippet will look like

store.dispatch({
            type: ActionTypes.RECEIVED_PLUGIN_POST_COMPONENT,
            data: {
                id,
                pluginId: this.id,
                type,
                component,
                showTitle
            },
        });

@akshitarora921
Copy link
Contributor

but then how showTitle is coming now🤔

@agarciamontoro
Copy link
Member Author

Great investigation, @akshitarora921! This is definitely a code maze.

I think the problem is not in the definition of the functions (mattermost-webapp/blob/master/plugins/registry.js) but with how we retrieve the data from them in the little script in mattermost-developer-documentation/blob/master/scripts/plugin-jsdocs.js. I believe that the problem may lay in this line: I guess that statement.value.params contain only the non-optional parameters.

I would try to look into how this data is structured. We parse the file with espree at the beginning of the script, so I'd look into the espree API to see if we're missing something important there. Maybe espree simply does not parse optional parameters? I'm not sure 🤔

@akshitarora921
Copy link
Contributor

@agarciamontoro this is getting more and more interesting, whenever I look into it. Kudos to the developers who wrote this. 🙌🏼

@cwarnermm
Copy link
Member

@akshitarora921 - Are you actively working on this ticket?

@cwarnermm cwarnermm added the Awaiting Submitter Action Blocked on the author label Jan 27, 2022
@akshitarora921
Copy link
Contributor

No

@agarciamontoro
Copy link
Member Author

agarciamontoro commented Jan 27, 2022

Thanks for the answer, @akshitarora921, and for all your work!

Feel free to get back at it if you want to, I'll mark the issue up for grabs again.

@agarciamontoro
Copy link
Member Author

Whoops, I didn't mean to close the issue. Reopening :)

@agarciamontoro agarciamontoro added Up For Grabs and removed Awaiting Submitter Action Blocked on the author labels Jan 27, 2022
@akshitarora921
Copy link
Contributor

@agarciamontoro @cwarnermm I will try it. If I solve it, I will ask you to assign me again.

@cwarnermm cwarnermm changed the title Default parameters are not correctly rendered in plugin registry methods Help Wanted: Default parameters are not correctly rendered in plugin registry methods Jan 27, 2022
@cwarnermm
Copy link
Member

@akshitarora921 - Are you actively working on this ticket?

@akshitarora921
Copy link
Contributor

@cwarnermm No

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants