Files
gerrit/polygerrit-ui/app/samples/repo-command.html
brohlfs 3e7f5fdd3f Polymer 2: Add _legacyUndefinedCheck
When legacy-data-mixin.html is imported this will tell you on the console which observers need fixing regarding this change of behavior:

https://polymer-library.polymer-project.org/2.0/docs/upgrade#update-observers

This change was created by running this command line:

find polygerrit-ui/app/ -type f | xargs sed -i '/^    is: / a\    _legacyUndefinedCheck: true,'

Once all observers are fixed, this change will be reverted. This is tracked in https://bugs.chromium.org/p/gerrit/issues/detail?id=10723

Change-Id: Icccdfaa52bf77dfb25e949b2aa2402110f6c2276
2019-04-17 13:15:50 +00:00

44 lines
1.1 KiB
HTML

<dom-module id="sample-repo-command">
<script>
Gerrit.install(plugin => {
// High-level API
plugin.project()
.createCommand('Bork', (repoName, projectConfig) => {
if (repoName !== 'All-Projects') {
return false;
}
}).onTap(() => {
alert('Bork, bork!');
});
// Low-level API
plugin.registerCustomComponent(
'repo-command', 'repo-command-low');
});
</script>
</dom-module>
<!-- Low-level custom component for repo command. -->
<dom-module id="repo-command-low">
<template>
<gr-repo-command
title="Low-level bork"
on-command-tap="_handleCommandTap">
</gr-repo-command>
</template>
<script>
Polymer({
is: 'repo-command-low',
_legacyUndefinedCheck: true,
attached() {
console.log(this.repoName);
console.log(this.config);
this.hidden = this.repoName !== 'All-Projects';
},
_handleCommandTap() {
alert('(softly) bork, bork.');
},
});
</script>
</dom-module>