Use imported RepoPluginConfig
This change removes usage of global Gerrit.RepoPluginConfig and
replace it with direct import. Also, the RepoPluginConfigMixin is removed,
because it was introduced as a workaround for polylint tests and is no
longer needed.
Change-Id: Ibb0d912fb3851005e9e5220e2602207ade322cf9
diff --git a/polygerrit-ui/app/behaviors/gr-repo-plugin-config-behavior/gr-repo-plugin-config-behavior.js b/polygerrit-ui/app/behaviors/gr-repo-plugin-config-behavior/gr-repo-plugin-config-behavior.js
index 3758b79..3ba2e60 100644
--- a/polygerrit-ui/app/behaviors/gr-repo-plugin-config-behavior/gr-repo-plugin-config-behavior.js
+++ b/polygerrit-ui/app/behaviors/gr-repo-plugin-config-behavior/gr-repo-plugin-config-behavior.js
@@ -14,40 +14,25 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-(function(window) {
- 'use strict';
- window.Gerrit = window.Gerrit || {};
+/** @polymerBehavior Gerrit.RepoPluginConfig*/
+export const RepoPluginConfig = {
+ // Should be kept in sync with
+ // gerrit/java/com/google/gerrit/extensions/api/projects/ProjectConfigEntryType.java.
+ ENTRY_TYPES: {
+ ARRAY: 'ARRAY',
+ BOOLEAN: 'BOOLEAN',
+ INT: 'INT',
+ LIST: 'LIST',
+ LONG: 'LONG',
+ STRING: 'STRING',
+ },
+ PLUGIN_CONFIG_CHANGED: 'plugin-config-changed',
+};
- /** @polymerBehavior Gerrit.RepoPluginConfig*/
- Gerrit.RepoPluginConfig = {
- // Should be kept in sync with
- // gerrit/java/com/google/gerrit/extensions/api/projects/ProjectConfigEntryType.java.
- ENTRY_TYPES: {
- ARRAY: 'ARRAY',
- BOOLEAN: 'BOOLEAN',
- INT: 'INT',
- LIST: 'LIST',
- LONG: 'LONG',
- STRING: 'STRING',
- },
- PLUGIN_CONFIG_CHANGED: 'plugin-config-changed',
- };
-
- // eslint-disable-next-line no-unused-vars
- function defineEmptyMixin() {
- // This is a temporary function.
- // Polymer linter doesn't process correctly the following code:
- // class MyElement extends Polymer.mixinBehaviors([legacyBehaviors], ...) {...}
- // To workaround this issue, the mock mixin is declared in this method.
- // In the following changes, legacy behaviors will be converted to mixins.
-
- /**
- * @polymer
- * @mixinFunction
- */
- Gerrit.RepoPluginConfigMixin = base =>
- class extends base {
- };
- }
-})(window);
+// TODO(dmfilippov) Remove the following lines with assignments
+// Plugins can use the behavior because it was accessible with
+// the global Gerrit... variable. To avoid breaking changes in plugins
+// temporary assign global variables.
+window.Gerrit = window.Gerrit || {};
+window.Gerrit.RepoPluginConfig = RepoPluginConfig;
diff --git a/polygerrit-ui/app/elements/admin/gr-repo-plugin-config/gr-repo-plugin-config.js b/polygerrit-ui/app/elements/admin/gr-repo-plugin-config/gr-repo-plugin-config.js
index 826bf93..d01f9ab 100644
--- a/polygerrit-ui/app/elements/admin/gr-repo-plugin-config/gr-repo-plugin-config.js
+++ b/polygerrit-ui/app/elements/admin/gr-repo-plugin-config/gr-repo-plugin-config.js
@@ -18,7 +18,6 @@
import '@polymer/iron-input/iron-input.js';
import '@polymer/paper-toggle-button/paper-toggle-button.js';
-import '../../../behaviors/gr-repo-plugin-config-behavior/gr-repo-plugin-config-behavior.js';
import '../../../styles/gr-form-styles.js';
import '../../../styles/gr-subpage-styles.js';
import '../../../styles/shared-styles.js';
@@ -32,13 +31,13 @@
import {LegacyElementMixin} from '@polymer/polymer/lib/legacy/legacy-element-mixin.js';
import {PolymerElement} from '@polymer/polymer/polymer-element.js';
import {htmlTemplate} from './gr-repo-plugin-config_html.js';
+import {RepoPluginConfig} from '../../../behaviors/gr-repo-plugin-config-behavior/gr-repo-plugin-config-behavior.js';
/**
- * @appliesMixin Gerrit.RepoPluginConfigMixin
* @extends Polymer.Element
*/
class GrRepoPluginConfig extends mixinBehaviors( [
- Gerrit.RepoPluginConfig,
+ RepoPluginConfig,
], GestureEventListeners(
LegacyElementMixin(
PolymerElement))) {