FIX: missing tooltip on backup screen

This commit is contained in:
Régis Hanol 2015-03-26 18:05:27 +01:00
parent 2cc5858163
commit 6493e4f641
5 changed files with 41 additions and 51 deletions

View File

@ -14,6 +14,7 @@ Discourse.ResumableUploadComponent = Ember.Component.extend(Discourse.StringBuff
tagName: "button", tagName: "button",
classNames: ["btn", "ru"], classNames: ["btn", "ru"],
classNameBindings: ["isUploading"], classNameBindings: ["isUploading"],
attributeBindings: ["translatedTitle:title"],
resumable: null, resumable: null,
@ -22,6 +23,11 @@ Discourse.ResumableUploadComponent = Ember.Component.extend(Discourse.StringBuff
rerenderTriggers: ['isUploading', 'progress'], rerenderTriggers: ['isUploading', 'progress'],
translatedTitle: function() {
const title = this.get('title');
return title ? I18n.t(title) : this.get('text');
}.property('title', 'text'),
text: function() { text: function() {
if (this.get("isUploading")) { if (this.get("isUploading")) {
return this.get("progress") + " %"; return this.get("progress") + " %";

View File

@ -1,49 +1,24 @@
export default Ember.ArrayController.extend({ export default Ember.ArrayController.extend({
needs: ["adminBackups"], needs: ["adminBackups"],
status: Em.computed.alias("controllers.adminBackups"), status: Em.computed.alias("controllers.adminBackups"),
isOperationRunning: Em.computed.alias("status.isOperationRunning"),
uploadText: function() { return I18n.t("admin.backups.upload.text"); }.property(),
readOnlyModeDisabled: Em.computed.alias("status.isOperationRunning"),
restoreDisabled: Em.computed.alias("status.restoreDisabled"), restoreDisabled: Em.computed.alias("status.restoreDisabled"),
uploadLabel: function() { return I18n.t("admin.backups.upload.label"); }.property(),
restoreTitle: function() { restoreTitle: function() {
if (!this.get('status.allowRestore')) { if (!this.get('status.allowRestore')) {
return I18n.t("admin.backups.operations.restore.is_disabled"); return "admin.backups.operations.restore.is_disabled";
} else if (this.get("status.isOperationRunning")) { } else if (this.get("status.isOperationRunning")) {
return I18n.t("admin.backups.operation_already_running"); return "admin.backups.operations.is_running";
} else { } else {
return I18n.t("admin.backups.operations.restore.title"); return "admin.backups.operations.restore.title";
} }
}.property("status.isOperationRunning"), }.property("status.{allowRestore,isOperationRunning}"),
destroyDisabled: Em.computed.alias("status.isOperationRunning"),
destroyTitle: function() {
if (this.get("status.isOperationRunning")) {
return I18n.t("admin.backups.operation_already_running");
} else {
return I18n.t("admin.backups.operations.destroy.title");
}
}.property("status.isOperationRunning"),
readOnlyModeTitle: function() { return this._readOnlyModeI18n("title"); }.property("site.isReadOnly"),
readOnlyModeText: function() { return this._readOnlyModeI18n("text"); }.property("site.isReadOnly"),
_readOnlyModeI18n: function(value) {
var action = this.site.get("isReadOnly") ? "disable" : "enable";
return I18n.t("admin.backups.read_only." + action + "." + value);
},
actions: { actions: {
/** toggleReadOnlyMode() {
Toggle read-only mode
@method toggleReadOnlyMode
**/
toggleReadOnlyMode: function() {
var self = this; var self = this;
if (!this.site.get("isReadOnly")) { if (!this.site.get("isReadOnly")) {
bootbox.confirm( bootbox.confirm(
@ -64,7 +39,7 @@ export default Ember.ArrayController.extend({
}, },
_toggleReadOnlyMode: function(enable) { _toggleReadOnlyMode(enable) {
var site = this.site; var site = this.site;
Discourse.ajax("/admin/backups/readonly", { Discourse.ajax("/admin/backups/readonly", {
type: "PUT", type: "PUT",

View File

@ -9,7 +9,7 @@
{{#if canRollback}} {{#if canRollback}}
{{d-button action="rollback" {{d-button action="rollback"
class="btn-rollback" class="btn-rollback"
label="admin.backups.operations.rollback.text" label="admin.backups.operations.rollback.label"
title="admin.backups.operations.rollback.title" title="admin.backups.operations.rollback.title"
icon="ambulance" icon="ambulance"
disabled=rollbackDisabled}} disabled=rollbackDisabled}}
@ -18,13 +18,13 @@
{{d-button action="cancelOperation" {{d-button action="cancelOperation"
class="btn-danger" class="btn-danger"
title="admin.backups.operations.cancel.title" title="admin.backups.operations.cancel.title"
label="admin.backups.operations.cancel.text" label="admin.backups.operations.cancel.label"
icon="times"}} icon="times"}}
{{else}} {{else}}
{{d-button action="startBackup" {{d-button action="startBackup"
class="btn-primary" class="btn-primary"
title="admin.backups.operations.backup.title" title="admin.backups.operations.backup.title"
label="admin.backups.operations.backup.text" label="admin.backups.operations.backup.label"
icon="rocket"}} icon="rocket"}}
{{/if}} {{/if}}
</div> </div>

View File

@ -4,8 +4,12 @@
<th width="10%">{{i18n 'admin.backups.columns.size'}}</th> <th width="10%">{{i18n 'admin.backups.columns.size'}}</th>
<th> <th>
<div class="pull-right"> <div class="pull-right">
{{resumable-upload target="/admin/backups/upload" success="uploadSuccess" error="uploadError" uploadText=uploadText}} {{resumable-upload target="/admin/backups/upload" success="uploadSuccess" error="uploadError" uploadText=uploadLabel title="admin.backups.upload.title"}}
<button {{action "toggleReadOnlyMode"}} class="btn" {{bind-attr disabled="readOnlyModeDisabled" title="readOnlyModeTitle"}}><i class="fa fa-eye"></i>{{readOnlyModeText}}</button> {{#if site.isReadOnly}}
{{d-button icon="eye" action="toggleReadOnlyMode" disabled=isOperationRunning title="admin.backups.read_only.disable.title" label="admin.backups.read_only.disable.label"}}
{{else}}
{{d-button icon="eye" action="toggleReadOnlyMode" disabled=isOperationRunning title="admin.backups.read_only.enable.title" label="admin.backups.read_only.enable.label"}}
{{/if}}
</div> </div>
</th> </th>
</tr> </tr>
@ -15,9 +19,14 @@
<td>{{human-size backup.size}}</td> <td>{{human-size backup.size}}</td>
<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'}}"><i class="fa fa-download"></i>{{i18n 'admin.backups.operations.download.text'}}</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>
<button {{action "destroyBackup" backup}} class="btn btn-danger no-text" {{bind-attr disabled="destroyDisabled" title="destroyTitle"}}><i class="fa fa-trash-o"></i></button> {{#if isOperationRunning}}
<button {{action "startRestore" backup}} class="btn" {{bind-attr disabled="restoreDisabled" title="restoreTitle"}}><i class="fa fa-play"></i>{{i18n 'admin.backups.operations.restore.text'}}</button> {{d-button icon="trash-o" action="destroyBackup" actionParam=backup class="btn-danger no-text" disabled="true" title="admin.backups.operations.is_running"}}
{{d-button icon="play" action="startRestore" actionParam=backup disabled=restoreDisabled title=restoreTitle label="admin.backups.operations.restore.label"}}
{{else}}
{{d-button icon="trash-o" action="destroyBackup" actionParam=backup class="btn-danger no-text" title="admin.backups.operations.destroy.title"}}
{{d-button icon="play" action="startRestore" actionParam=backup disabled=restoreDisabled title=restoreTitle label="admin.backups.operations.restore.label"}}
{{/if}}
</div> </div>
</td> </td>
</tr> </tr>

View File

@ -1739,18 +1739,19 @@ en:
read_only: read_only:
enable: enable:
title: "Enable the read-only mode" title: "Enable the read-only mode"
text: "Enable read-only mode" label: "Enable read-only mode"
confirm: "Are you sure you want to enable the read-only mode?" confirm: "Are you sure you want to enable the read-only mode?"
disable: disable:
title: "Disable the read-only mode" title: "Disable the read-only mode"
text: "Disable read-only mode" label: "Disable read-only mode"
logs: logs:
none: "No logs yet..." none: "No logs yet..."
columns: columns:
filename: "Filename" filename: "Filename"
size: "Size" size: "Size"
upload: upload:
text: "Upload" label: "Upload"
title: "Upload a backup to this instance"
uploading: "Uploading..." uploading: "Uploading..."
success: "'{{filename}}' has successfully been uploaded." success: "'{{filename}}' has successfully been uploaded."
error: "There has been an error while uploading '{{filename}}': {{message}}" error: "There has been an error while uploading '{{filename}}': {{message}}"
@ -1758,28 +1759,27 @@ en:
is_running: "An operation is currently running..." is_running: "An operation is currently running..."
failed: "The {{operation}} failed. Please check the logs." failed: "The {{operation}} failed. Please check the logs."
cancel: cancel:
text: "Cancel" label: "Cancel"
title: "Cancel the current operation" title: "Cancel the current operation"
confirm: "Are you sure you want to cancel the current operation?" confirm: "Are you sure you want to cancel the current operation?"
backup: backup:
text: "Backup" label: "Backup"
title: "Create a backup" title: "Create a backup"
confirm: "Do you want to start a new backup?" confirm: "Do you want to start a new backup?"
without_uploads: "Yes (do not include files)" without_uploads: "Yes (do not include files)"
download: download:
text: "Download" label: "Download"
title: "Download the backup" title: "Download the backup"
destroy: destroy:
text: "Delete"
title: "Remove the backup" title: "Remove the backup"
confirm: "Are you sure you want to destroy this backup?" confirm: "Are you sure you want to destroy this backup?"
restore: restore:
is_disabled: "Restore is disabled in the site settings." is_disabled: "Restore is disabled in the site settings."
text: "Restore" label: "Restore"
title: "Restore the backup" title: "Restore the backup"
confirm: "Are your sure you want to restore this backup?" confirm: "Are your sure you want to restore this backup?"
rollback: rollback:
text: "Rollback" label: "Rollback"
title: "Rollback the database to previous working state" title: "Rollback the database to previous working state"
confirm: "Are your sure you want to rollback the database to the previous working state?" confirm: "Are your sure you want to rollback the database to the previous working state?"