-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: ported SupersetXBlock from platform-plugin-superset
- Loading branch information
1 parent
517ec87
commit ea8cf45
Showing
16 changed files
with
1,008 additions
and
82 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
{% load i18n %} | ||
|
||
<div class="wrapper-comp-settings is-active editor-with-buttons" id="settings-tab"> | ||
<ul class="list-input settings-list"> | ||
<li class="field comp-setting-entry is-set"> | ||
<div class="wrapper-comp-setting"> | ||
<label class="label setting-label" for="superset_display_name">{% trans "Display name" %}</label> | ||
<input | ||
class="input setting-input" | ||
name="superset_display_name" | ||
id="superset_display_name" | ||
value="{{display_name}}" | ||
type="text" | ||
/> | ||
</div> | ||
<span class="tip setting-help"> {% trans display_name_field.help %} </span> | ||
</li> | ||
<li class="field comp-setting-entry is-set"> | ||
<div class="wrapper-comp-setting"> | ||
<label class="label setting-label" for="superset_superset_url">{% trans "Superset URL" %}</label> | ||
<input | ||
class="input setting-input" | ||
name="superset_superset_url" | ||
id="superset_superset_url" | ||
value="{{superset_url}}" | ||
type="text" | ||
/> | ||
</div> | ||
<span class="tip setting-help"> {% trans superset_url_field.help %} </span> | ||
</li> | ||
<li class="field comp-setting-entry is-set"> | ||
<div class="wrapper-comp-setting"> | ||
<label class="label setting-label" for="superset_superset_username">{% trans "Superset Username" %}</label> | ||
<input | ||
class="input setting-input" | ||
name="superset_superset_username" | ||
id="superset_superset_username" | ||
value="{{superset_username}}" | ||
type="text" | ||
/> | ||
</div> | ||
<span class="tip setting-help"> {% trans superset_username_field.help %} </span> | ||
</li> | ||
<li class="field comp-setting-entry is-set"> | ||
<div class="wrapper-comp-setting"> | ||
<label class="label setting-label" for="superset_superset_password">{% trans "Superset Password" %}</label> | ||
<input | ||
class="input setting-input" | ||
name="superset_superset_password" | ||
id="superset_superset_password" | ||
value="{{superset_password}}" | ||
type="text" | ||
/> | ||
</div> | ||
<span class="tip setting-help"> {% trans dashboard_uuid_field.help %} </span> | ||
</li> | ||
<li class="field comp-setting-entry is-set"> | ||
<div class="wrapper-comp-setting"> | ||
<label class="label setting-label" for="superset_dashboard_uuid">{% trans "Dashboard UUID" %}</label> | ||
<input | ||
class="input setting-input" | ||
name="superset_dashboard_uuid" | ||
id="superset_dashboard_uuid" | ||
value="{{dashboard_uuid}}" | ||
type="text" | ||
/> | ||
</div> | ||
<span class="tip setting-help"> {% trans dashboard_uuid_field.help %} </span> | ||
</li> | ||
<li class="field comp-setting-entry is-set"> | ||
<div class="wrapper-comp-setting"> | ||
<label class="label setting-label" for="superset_filters">{% trans "Filters" %}</label> | ||
<input | ||
class="input setting-input" | ||
name="superset_filters" | ||
id="superset_filters" | ||
value="{{filters}}" | ||
type="text" | ||
/> | ||
</div> | ||
<span class="tip setting-help"> {% trans filters_field.help %} </span> | ||
</li> | ||
|
||
</ul> | ||
|
||
<div class="xblock-actions"> | ||
<ul> | ||
<li class="action-item"> | ||
<a href="#" class="button action-primary save-button">{% trans "Save" %}</a> | ||
</li> | ||
<li class="action-item"> | ||
<a href="#" class="button cancel-button">{% trans "Cancel" %}</a> | ||
</li> | ||
</ul> | ||
</div> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
try { | ||
(function (require) { | ||
require.config({ | ||
paths: { | ||
supersetEmbeddedSdk: "https://cdn.jsdelivr.net/npm/@superset-ui/[email protected]/bundle/index.min", | ||
}, | ||
}); | ||
}).call(this, require || RequireJS.require); | ||
} catch (e) { | ||
console.log("Unable to load embedded_sdk via requirejs"); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
/* Javascript for SupersetXBlock. */ | ||
function SupersetXBlock(runtime, element) { | ||
|
||
$(element).find('.save-button').bind('click', function() { | ||
var handlerUrl = runtime.handlerUrl(element, 'studio_submit'); | ||
var data = { | ||
display_name: $(element).find('input[name=superset_display_name]').val(), | ||
dashboard_uuid: $(element).find('input[name=superset_dashboard_uuid]').val(), | ||
filters: $(element).find('input[name=superset_filters]').val(), | ||
}; | ||
$.post(handlerUrl, JSON.stringify(data)).done(function(response) { | ||
window.location.reload(false); | ||
}); | ||
}); | ||
|
||
$(element).find('.cancel-button').bind('click', function() { | ||
runtime.notify('cancel', {}); | ||
}); | ||
} |
Oops, something went wrong.