From 2b6357f8b4a6b4710da55aacb879acdf990bcdff Mon Sep 17 00:00:00 2001 From: Joffrey JAFFEUX Date: Sun, 16 Dec 2018 15:22:23 +0100 Subject: [PATCH] FIX: ember 3 support --- .../discourse/components/query-result.js.es6 | 6 ++-- .../controllers/admin-plugins-explorer.js.es6 | 4 +-- .../routes/admin-plugins-explorer.js.es6 | 1 + .../templates/admin/plugins-explorer.hbs | 29 +++++++++---------- .../templates/components/explorer-schema.hbs | 4 +-- .../components/json-file-uploader.hbs | 2 +- .../templates/explorer-query-result.hbs | 4 +-- 7 files changed, 25 insertions(+), 25 deletions(-) diff --git a/assets/javascripts/discourse/components/query-result.js.es6 b/assets/javascripts/discourse/components/query-result.js.es6 index 6224e9d..22a22a0 100644 --- a/assets/javascripts/discourse/components/query-result.js.es6 +++ b/assets/javascripts/discourse/components/query-result.js.es6 @@ -60,7 +60,7 @@ const QueryResultComponent = Ember.Component.extend({ } } return arr; - }.property("params.@each"), + }.property("params.[]"), columnDispNames: function() { if (!this.get("columns")) { @@ -76,7 +76,7 @@ const QueryResultComponent = Ember.Component.extend({ } return colName; }); - }.property("content", "columns.@each"), + }.property("content", "columns.[]"), fallbackTemplate: function() { return getOwner(this).lookup("template:explorer/text.raw"); @@ -103,7 +103,7 @@ const QueryResultComponent = Ember.Component.extend({ return { name: viewName, template }; }); - }.property("content", "columns.@each"), + }.property("content", "columns.[]"), transformedUserTable: function() { return transformedRelTable(this.get("content.relations.user")); diff --git a/assets/javascripts/discourse/controllers/admin-plugins-explorer.js.es6 b/assets/javascripts/discourse/controllers/admin-plugins-explorer.js.es6 index 84535e5..6b95755 100644 --- a/assets/javascripts/discourse/controllers/admin-plugins-explorer.js.es6 +++ b/assets/javascripts/discourse/controllers/admin-plugins-explorer.js.es6 @@ -44,7 +44,7 @@ export default Ember.Controller.extend({ selectedItem: function() { const id = parseInt(this.get("selectedQueryId")); - const item = this.get("content").find(q => q.get("id") === id); + const item = this.get("model").find(q => q.get("id") === id); !isNaN(id) ? this.set("showRecentQueries", false) : this.set("showRecentQueries", true); @@ -54,7 +54,7 @@ export default Ember.Controller.extend({ othersDirty: function() { const selected = this.get("selectedItem"); - return !!this.get("content").find(q => q !== selected && q.get("dirty")); + return !!this.get("model").find(q => q !== selected && q.get("dirty")); }.property("selectedItem", "selectedItem.dirty"), setEverEditing: function() { diff --git a/assets/javascripts/discourse/routes/admin-plugins-explorer.js.es6 b/assets/javascripts/discourse/routes/admin-plugins-explorer.js.es6 index 45f95c9..def6331 100644 --- a/assets/javascripts/discourse/routes/admin-plugins-explorer.js.es6 +++ b/assets/javascripts/discourse/routes/admin-plugins-explorer.js.es6 @@ -27,6 +27,7 @@ export default Discourse.Route.extend({ actions: { refreshModel: function() { this.refresh(); + return false; } } }); diff --git a/assets/javascripts/discourse/templates/admin/plugins-explorer.hbs b/assets/javascripts/discourse/templates/admin/plugins-explorer.hbs index ecb1379..c397e1b 100644 --- a/assets/javascripts/discourse/templates/admin/plugins-explorer.hbs +++ b/assets/javascripts/discourse/templates/admin/plugins-explorer.hbs @@ -1,19 +1,18 @@ {{#explorer-container hideSchema=hideSchema everEditing=everEditing}} - {{#if disallow}}

{{i18n "explorer.admins_only"}}

{{else}} {{#unless selectedQueryId}}
{{text-field value=search placeholderKey="explorer.search_placeholder"}} - {{d-button action="showCreate" icon="plus" class="no-text btn-right"}} - {{d-button action="importQuery" label="explorer.import.label" icon="upload"}} + {{d-button action=(action "showCreate") icon="plus" class="no-text btn-right"}} + {{d-button action=(action "importQuery") label="explorer.import.label" icon="upload"}}
{{#if showCreate}}
{{text-field value=newQueryName placeholderKey="explorer.create_placeholder"}} - {{d-button action="create" disabled=createDisabled label="explorer.create" icon="plus" class="btn-primary"}} + {{d-button action=(action "create") disabled=createDisabled label="explorer.create" icon="plus" class="btn-primary"}}
{{/if}} @@ -25,13 +24,13 @@ {{/if}} {{/unless}} - {{#if content.length}} + {{#if model.length}} {{#unless selectedItem.fake}}
{{#if selectedItem}} {{#if editing}}
- {{d-button action="goHome" icon="chevron-left" class="previous"}} + {{d-button action=(action "goHome") icon="chevron-left" class="previous"}}
{{text-field value=selectedItem.name}}
@@ -41,7 +40,7 @@
{{else}}
- {{d-button action="goHome" icon="chevron-left" class="previous"}} + {{d-button action=(action "goHome") icon="chevron-left" class="previous"}}

{{selectedItem.name}} {{#unless editDisabled}} {{d-icon "pencil"}} @@ -77,23 +76,23 @@
{{#if everEditing}} - {{d-button action="save" label="explorer.save" disabled=saveDisabled class="btn-primary"}} + {{d-button action=(action "save") label="explorer.save" disabled=saveDisabled class="btn-primary"}} {{else}} {{#unless editDisabled}} - {{d-button action="editName" label="explorer.edit" icon="pencil" class="btn-primary"}} + {{d-button action=(action "editName") label="explorer.edit" icon="pencil" class="btn-primary"}} {{/unless}} {{/if}} - {{d-button action="download" label="explorer.export" disabled=runDisabled icon="download"}} + {{d-button action=(action "download") label="explorer.export" disabled=runDisabled icon="download"}}
{{#if selectedItem.destroyed}} - {{d-button action="recover" class="" icon="undo" label="explorer.recover"}} + {{d-button action=(action "recover") class="" icon="undo" label="explorer.recover"}} {{else}} {{#if everEditing}} - {{d-button action="discard" class="btn-danger" icon="undo" label="explorer.undo" disabled=saveDisabled}} + {{d-button action=(action "discard") class="btn-danger" icon="undo" label="explorer.undo" disabled=saveDisabled}} {{/if}} {{#unless editDisabled}} - {{d-button action="destroy" class="btn-danger" icon="trash" label="explorer.delete"}} + {{d-button action=(action "destroy") class="btn-danger" icon="trash" label="explorer.delete"}} {{/unless}} {{/if}}
@@ -117,10 +116,10 @@ {{#if saveDisabled}} {{d-button label="explorer.run" disabled="true" class="btn-primary"}} {{else}} - {{d-button action="saverun" label="explorer.saverun"}} + {{d-button action=(action "saverun") label="explorer.saverun"}} {{/if}} {{else}} - {{d-button action="run" label="explorer.run" disabled=runDisabled class="btn-primary" type="submit"}} + {{d-button action=(action "run") label="explorer.run" disabled=runDisabled class="btn-primary" type="submit"}} {{/if}} diff --git a/assets/javascripts/discourse/templates/components/explorer-schema.hbs b/assets/javascripts/discourse/templates/components/explorer-schema.hbs index 6268103..30d5ee2 100644 --- a/assets/javascripts/discourse/templates/components/explorer-schema.hbs +++ b/assets/javascripts/discourse/templates/components/explorer-schema.hbs @@ -1,9 +1,9 @@ {{#if hideSchema}} - {{d-button action="expandSchema" icon="chevron-left" class="no-text unhide"}} + {{d-button action=(action "expandSchema") icon="chevron-left" class="no-text unhide"}} {{/if}}
{{text-field value=filter placeholderKey="explorer.schema.filter"}} - {{d-button action="collapseSchema" icon="chevron-right" class="no-text"}} + {{d-button action=(action "collapseSchema") icon="chevron-right" class="no-text"}} {{conditional-loading-spinner condition=loading}}
    diff --git a/assets/javascripts/discourse/templates/components/json-file-uploader.hbs b/assets/javascripts/discourse/templates/components/json-file-uploader.hbs index 1173a4d..9fa1538 100644 --- a/assets/javascripts/discourse/templates/components/json-file-uploader.hbs +++ b/assets/javascripts/discourse/templates/components/json-file-uploader.hbs @@ -1,7 +1,7 @@
    - {{d-button class="fileSelect" action="selectFile" class="" icon="upload" label="upload_selector.select_file"}} + {{d-button class="fileSelect" action=(action "selectFile") class="" icon="upload" label="upload_selector.select_file"}} {{conditional-loading-spinner condition=loading size="small"}}
    {{i18n "alternation"}}
    diff --git a/assets/javascripts/discourse/templates/explorer-query-result.hbs b/assets/javascripts/discourse/templates/explorer-query-result.hbs index 6c1e03d..c8771d4 100644 --- a/assets/javascripts/discourse/templates/explorer-query-result.hbs +++ b/assets/javascripts/discourse/templates/explorer-query-result.hbs @@ -1,6 +1,6 @@
    - {{d-button action="downloadResultJson" icon="download" label="explorer.download_json"}} - {{d-button action="downloadResultCsv" icon="download" label="explorer.download_csv"}} + {{d-button action=(action "downloadResultJson") icon="download" label="explorer.download_json"}} + {{d-button action=(action "downloadResultCsv") icon="download" label="explorer.download_csv"}}