mirror of
https://github.com/discourse/discourse.git
synced 2024-11-28 07:00:58 +08:00
FIX: backups index template wasn't properly bound
This commit is contained in:
parent
58c9ca6132
commit
73e4c6ae4d
|
@ -1,8 +1,6 @@
|
||||||
export default Ember.ArrayController.extend({
|
export default Ember.ArrayController.extend({
|
||||||
needs: ["adminBackups"],
|
needs: ["adminBackups"],
|
||||||
status: Em.computed.alias("controllers.adminBackups"),
|
status: Ember.computed.alias("controllers.adminBackups"),
|
||||||
isOperationRunning: Ember.computed.alias("status.model.isOperationRunning"),
|
|
||||||
restoreDisabled: Ember.computed.alias("status.model.restoreDisabled"),
|
|
||||||
|
|
||||||
uploadLabel: function() { return I18n.t("admin.backups.upload.label"); }.property(),
|
uploadLabel: function() { return I18n.t("admin.backups.upload.label"); }.property(),
|
||||||
|
|
||||||
|
|
12
app/assets/javascripts/admin/models/backup-status.js.es6
Normal file
12
app/assets/javascripts/admin/models/backup-status.js.es6
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
import computed from "ember-addons/ember-computed-decorators";
|
||||||
|
|
||||||
|
export default Discourse.Model.extend({
|
||||||
|
|
||||||
|
restoreDisabled: Em.computed.not("restoreEnabled"),
|
||||||
|
|
||||||
|
@computed("allowRestore", "isOperationRunning")
|
||||||
|
restoreEnabled(allowRestore, isOperationRunning) {
|
||||||
|
return allowRestore && !isOperationRunning;
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
|
@ -1,9 +0,0 @@
|
||||||
Discourse.BackupStatus = Discourse.Model.extend({
|
|
||||||
|
|
||||||
restoreDisabled: Em.computed.not("restoreEnabled"),
|
|
||||||
|
|
||||||
restoreEnabled: function() {
|
|
||||||
return this.get('allowRestore') && !this.get("isOperationRunning");
|
|
||||||
}.property("isOperationRunning", "allowRestore")
|
|
||||||
|
|
||||||
});
|
|
|
@ -6,9 +6,9 @@
|
||||||
<div class="pull-right">
|
<div class="pull-right">
|
||||||
{{resumable-upload target="/admin/backups/upload" success="uploadSuccess" error="uploadError" uploadText=uploadLabel title="admin.backups.upload.title"}}
|
{{resumable-upload target="/admin/backups/upload" success="uploadSuccess" error="uploadError" uploadText=uploadLabel title="admin.backups.upload.title"}}
|
||||||
{{#if site.isReadOnly}}
|
{{#if site.isReadOnly}}
|
||||||
{{d-button icon="eye" action="toggleReadOnlyMode" disabled=model.isOperationRunning title="admin.backups.read_only.disable.title" label="admin.backups.read_only.disable.label"}}
|
{{d-button icon="eye" action="toggleReadOnlyMode" disabled=status.model.isOperationRunning title="admin.backups.read_only.disable.title" label="admin.backups.read_only.disable.label"}}
|
||||||
{{else}}
|
{{else}}
|
||||||
{{d-button icon="eye" action="toggleReadOnlyMode" disabled=model.isOperationRunning title="admin.backups.read_only.enable.title" label="admin.backups.read_only.enable.label"}}
|
{{d-button icon="eye" action="toggleReadOnlyMode" disabled=status.model.isOperationRunning title="admin.backups.read_only.enable.title" label="admin.backups.read_only.enable.label"}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
</div>
|
</div>
|
||||||
</th>
|
</th>
|
||||||
|
@ -20,12 +20,12 @@
|
||||||
<td>
|
<td>
|
||||||
<div class="pull-right">
|
<div class="pull-right">
|
||||||
<a {{bind-attr href="backup.link"}} class="btn download" title="{{i18n 'admin.backups.operations.download.title'}}">{{fa-icon "download"}}{{i18n 'admin.backups.operations.download.label'}}</a>
|
<a {{bind-attr href="backup.link"}} class="btn download" title="{{i18n 'admin.backups.operations.download.title'}}">{{fa-icon "download"}}{{i18n 'admin.backups.operations.download.label'}}</a>
|
||||||
{{#if model.isOperationRunning}}
|
{{#if status.model.isOperationRunning}}
|
||||||
{{d-button icon="trash-o" action="destroyBackup" actionParam=backup class="btn-danger" disabled="true" title="admin.backups.operations.is_running"}}
|
{{d-button icon="trash-o" action="destroyBackup" actionParam=backup class="btn-danger" disabled="true" title="admin.backups.operations.is_running"}}
|
||||||
{{d-button icon="play" action="startRestore" actionParam=backup disabled=model.restoreDisabled title=restoreTitle label="admin.backups.operations.restore.label"}}
|
{{d-button icon="play" action="startRestore" actionParam=backup disabled=status.model.restoreDisabled title=restoreTitle label="admin.backups.operations.restore.label"}}
|
||||||
{{else}}
|
{{else}}
|
||||||
{{d-button icon="trash-o" action="destroyBackup" actionParam=backup class="btn-danger" title="admin.backups.operations.destroy.title"}}
|
{{d-button icon="trash-o" action="destroyBackup" actionParam=backup class="btn-danger" title="admin.backups.operations.destroy.title"}}
|
||||||
{{d-button icon="play" action="startRestore" actionParam=backup disabled=model.restoreDisabled title=restoreTitle label="admin.backups.operations.restore.label"}}
|
{{d-button icon="play" action="startRestore" actionParam=backup disabled=status.model.restoreDisabled title=restoreTitle label="admin.backups.operations.restore.label"}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user