summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Pursehouse <dpursehouse@collab.net>2019-10-25 08:34:01 +0900
committerDavid Pursehouse <dpursehouse@collab.net>2019-10-25 08:34:01 +0900
commita6526f91534971647fd7d1950c53eb0a34fc86fd (patch)
tree3f296b3d68c4bb553a064802f6119e30ca5afe59
parentb7f4a92cdc9b7322a3df25c1cb7c3308bc454a72 (diff)
parent6694a4d83947e6958db35aaf84160c45811aae31 (diff)
Merge branch 'stable-3.0' into stable-3.1
* stable-3.0: Document the getConfig()-method in the plugin's restApi interface Add getConfig() method to plugin restApi interface Change-Id: I4ac0453bbabb576c94b24455d90d9f3e3bdfbe9a
-rw-r--r--Documentation/pg-plugin-rest-api.txt11
-rw-r--r--polygerrit-ui/app/elements/shared/gr-js-api-interface/gr-plugin-rest-api.js4
-rw-r--r--polygerrit-ui/app/elements/shared/gr-js-api-interface/gr-plugin-rest-api_test.html11
3 files changed, 25 insertions, 1 deletions
diff --git a/Documentation/pg-plugin-rest-api.txt b/Documentation/pg-plugin-rest-api.txt
index 70487ef584..0d42bf60ee 100644
--- a/Documentation/pg-plugin-rest-api.txt
+++ b/Documentation/pg-plugin-rest-api.txt
@@ -25,6 +25,17 @@ Get server version.
.Returns
- Promise<string>
+== getConfig
+`repoApi.getConfig()`
+
+Get server config.
+
+.Params
+- None
+
+.Returns
+- Promise<Object>
+
== get
`repoApi.get(url)`
diff --git a/polygerrit-ui/app/elements/shared/gr-js-api-interface/gr-plugin-rest-api.js b/polygerrit-ui/app/elements/shared/gr-js-api-interface/gr-plugin-rest-api.js
index 984b870750..af8bd9e3f0 100644
--- a/polygerrit-ui/app/elements/shared/gr-js-api-interface/gr-plugin-rest-api.js
+++ b/polygerrit-ui/app/elements/shared/gr-js-api-interface/gr-plugin-rest-api.js
@@ -38,6 +38,10 @@
return getRestApi().getVersion();
};
+ GrPluginRestApi.prototype.getConfig = function() {
+ return getRestApi().getConfig();
+ };
+
GrPluginRestApi.prototype.invalidateReposCache = function() {
getRestApi().invalidateReposCache();
};
diff --git a/polygerrit-ui/app/elements/shared/gr-js-api-interface/gr-plugin-rest-api_test.html b/polygerrit-ui/app/elements/shared/gr-js-api-interface/gr-plugin-rest-api_test.html
index 8626280e0d..05f84c0ace 100644
--- a/polygerrit-ui/app/elements/shared/gr-js-api-interface/gr-plugin-rest-api_test.html
+++ b/polygerrit-ui/app/elements/shared/gr-js-api-interface/gr-plugin-rest-api_test.html
@@ -44,6 +44,7 @@ limitations under the License.
send: sendStub,
getLoggedIn: sandbox.stub(),
getVersion: sandbox.stub(),
+ getConfig: sandbox.stub(),
};
stub('gr-rest-api-interface', Object.keys(restApiStub).reduce((a, k) => {
a[k] = (...args) => restApiStub[k](...args);
@@ -135,12 +136,20 @@ limitations under the License.
});
});
- test('getConfig', () => {
+ test('getVersion', () => {
restApiStub.getVersion.returns(Promise.resolve('foo bar'));
return instance.getVersion().then(result => {
assert.isTrue(restApiStub.getVersion.calledOnce);
assert.equal(result, 'foo bar');
});
});
+
+ test('getConfig', () => {
+ restApiStub.getConfig.returns(Promise.resolve('foo bar'));
+ return instance.getConfig().then(result => {
+ assert.isTrue(restApiStub.getConfig.calledOnce);
+ assert.equal(result, 'foo bar');
+ });
+ });
});
</script>