Adds an project-command plugin endpoint for plugins to provide own commands. Creates a common gr-project-command element for uniform appearance. Provides high-level project plugin API for typical use. project-command.html contains low-level plugin API example for advanced customization. Change-Id: I6e47e4724c9d5a5e783f8bb562fcd0a3fa342d6c
		
			
				
	
	
		
			43 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			HTML
		
	
	
	
	
	
			
		
		
	
	
			43 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			HTML
		
	
	
	
	
	
<dom-module id="sample-project-command">
 | 
						|
  <script>
 | 
						|
    Gerrit.install(plugin => {
 | 
						|
      // High-level API
 | 
						|
      plugin.project()
 | 
						|
          .createCommand('Bork', (projectName, projectConfig) => {
 | 
						|
            if (projectName !== 'All-Projects') {
 | 
						|
              return false;
 | 
						|
            }
 | 
						|
          }).onTap(() => {
 | 
						|
            alert('Bork, bork!');
 | 
						|
          });
 | 
						|
 | 
						|
      // Low-level API
 | 
						|
      plugin.registerCustomComponent(
 | 
						|
          'project-command', 'project-command-low');
 | 
						|
    });
 | 
						|
  </script>
 | 
						|
</dom-module>
 | 
						|
 | 
						|
<!-- Low-level custom component for project command. -->
 | 
						|
<dom-module id="project-command-low">
 | 
						|
  <template>
 | 
						|
    <gr-project-command
 | 
						|
        title="Low-level bork"
 | 
						|
        on-command-tap="_handleCommandTap">
 | 
						|
    </gr-project-command>
 | 
						|
  </template>
 | 
						|
  <script>
 | 
						|
    Polymer({
 | 
						|
      is: 'project-command-low',
 | 
						|
      attached() {
 | 
						|
        console.log(this.projectName);
 | 
						|
        console.log(this.config);
 | 
						|
        this.hidden = this.projectName !== 'All-Projects';
 | 
						|
      },
 | 
						|
      _handleCommandTap() {
 | 
						|
        alert('(softly) bork, bork.');
 | 
						|
      },
 | 
						|
    });
 | 
						|
  </script>
 | 
						|
</dom-module>
 |