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

View File

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

View File

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

View File

@ -4,8 +4,12 @@
<th width="10%">{{i18n 'admin.backups.columns.size'}}</th>
<th>
<div class="pull-right">
{{resumable-upload target="/admin/backups/upload" success="uploadSuccess" error="uploadError" uploadText=uploadText}}
<button {{action "toggleReadOnlyMode"}} class="btn" {{bind-attr disabled="readOnlyModeDisabled" title="readOnlyModeTitle"}}><i class="fa fa-eye"></i>{{readOnlyModeText}}</button>
{{resumable-upload target="/admin/backups/upload" success="uploadSuccess" error="uploadError" uploadText=uploadLabel title="admin.backups.upload.title"}}
{{#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>
</th>
</tr>
@ -15,9 +19,14 @@
<td>{{human-size backup.size}}</td>
<td>
<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>
<button {{action "destroyBackup" backup}} class="btn btn-danger no-text" {{bind-attr disabled="destroyDisabled" title="destroyTitle"}}><i class="fa fa-trash-o"></i></button>
<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>
<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 isOperationRunning}}
{{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>
</td>
</tr>

View File

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