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

Display the list of online servers by default #5014

Merged
merged 1 commit into from
Jul 15, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
22 changes: 17 additions & 5 deletions contribs/gmf/src/import/importdatasourceComponent.js
Original file line number Diff line number Diff line change
Expand Up @@ -278,21 +278,33 @@ class Controller {


if (this.serversEngine_) {
// Timeout to let Angular render the placeholder of the input properly,
// otherwise typeahead would copy the string with {{}} in it...
this.timeout_(() => {

/**
* @param {string} query Query string.
* @param {function(Array<string>):void} sync
*/
const serversEngineWithDefaults = (query, sync) => {
if (!this.serversEngine_) {
throw new Error('Missing serversEngine');
}
if (query === '') {
sync(this.serversEngine_.all());
} else {
this.serversEngine_.search(query, sync);
}
};
// Timeout to let Angular render the placeholder of the input properly,
// otherwise typeahead would copy the string with {{}} in it...
this.timeout_(() => {
const $urlInput = this.element_.find('input[name=url]');
const $connectBtn = this.element_.find('button.gmf-importdatasource-connect-btn');
$urlInput.typeahead({
hint: true,
highlight: true,
minLength: 1
minLength: 0
}, {
name: 'url',
source: this.serversEngine_.ttAdapter()
source: serversEngineWithDefaults
}).bind('typeahead:select', (ev, suggestion) => {
this.timeout_(() => {
this.url = suggestion;
Expand Down