Skip to content

Commit

Permalink
[#3816] make query-based resource visible
Browse files Browse the repository at this point in the history
  • Loading branch information
wardi committed Sep 15, 2017
1 parent ab07e63 commit 164b986
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 6 deletions.
1 change: 1 addition & 0 deletions ckan/lib/dictization/model_save.py
Expand Up @@ -50,6 +50,7 @@ def resource_dict_save(res_dict, context):
if key == 'query' and (new or obj.extras.get('query') != value):
obj.url_changed = True # XXX hack to notify datastore
obj.url_type = 'datastore'
new_extras['datastore_active'] = True
# resources save extras directly onto the object, instead
# of in a separate extras field like packages and groups
new_extras[key] = value
Expand Down
6 changes: 3 additions & 3 deletions ckan/public/base/javascript/modules/image-upload.js
Expand Up @@ -119,7 +119,9 @@ this.ckan.module('image-upload', function($) {
this._nameIsDirty = true;
}

if (options.is_url) {
if (this.field_query_input && this.field_query_input.value) {
this._showOnlyQuery();
} else if (options.is_url) {
this._showOnlyFieldUrl();

this._updateUrlLabel(this._('URL'));
Expand All @@ -132,8 +134,6 @@ this.ckan.module('image-upload', function($) {
this.field_url_input.val(filename);

this._updateUrlLabel(this._('File'));
} else if (this.field_query_input && this.field_query_input.value) {
this._showOnlyQuery();
} else {
this._showOnlyButtons();
}
Expand Down
4 changes: 2 additions & 2 deletions ckanext/datastore/set_permissions.sql
Expand Up @@ -62,9 +62,9 @@ CREATE OR REPLACE VIEW "_table_metadata" AS
LEFT OUTER JOIN pg_depend AS d ON d.objid = r.oid
LEFT OUTER JOIN pg_class AS dependent ON d.refobjid = dependent.oid
WHERE
(dependee.oid != dependent.oid OR dependent.oid IS NULL) AND
((dependee.oid != dependent.oid OR dependent.oid IS NULL) AND
-- is a table, view or materialized view
(dependee.relkind = 'r'::"char" OR dependee.relkind = 'v'::"char"
(dependee.relkind = 'r'::"char" OR dependee.relkind = 'v'::"char")
OR dependee.relkind = 'm'::"char")
AND dependee.relnamespace = (
SELECT oid FROM pg_namespace WHERE nspname='public')
Expand Down
2 changes: 1 addition & 1 deletion ckanext/datastore/templates/package/resource_read.html
Expand Up @@ -34,4 +34,4 @@ <h2>{{ _('Data Dictionary') }}</h2>
{% endblock %}
{% endif %}
{{ super() }}
{% endblock %}
{% endblock %}

0 comments on commit 164b986

Please sign in to comment.