Skip to content

Commit

Permalink
Merge pull request #942 from signal18/restic-aws
Browse files Browse the repository at this point in the history
angular backup options
  • Loading branch information
caffeinated92 committed Oct 25, 2024
1 parent b62888c commit eb4c17e
Show file tree
Hide file tree
Showing 3 changed files with 70 additions and 1 deletion.
2 changes: 1 addition & 1 deletion config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -635,7 +635,7 @@ type Config struct {
BackupMysqldumpOptions string `mapstructure:"backup-mysqldump-options" toml:"backup-mysqldump-options" json:"backupMysqldumpOptions"`
BackupMyDumperPath string `mapstructure:"backup-mydumper-path" toml:"backup-mydumper-path" json:"backupMydumperPath"`
BackupMyLoaderPath string `mapstructure:"backup-myloader-path" toml:"backup-myloader-path" json:"backupMyloaderPath"`
BackupMyLoaderOptions string `mapstructure:"backup-myloader-options" toml:"backup-myloader-options" json:"backupMyloaderOptions"`
BackupMyLoaderOptions string `mapstructure:"backup-myloader-options" toml:"backup-myloader-options" json:"backupMyLoaderOptions"`
BackupMyDumperOptions string `mapstructure:"backup-mydumper-options" toml:"backup-mydumper-options" json:"backupMyDumperOptions"`
BackupMysqlbinlogPath string `mapstructure:"backup-mysqlbinlog-path" toml:"backup-mysqlbinlog-path" json:"backupMysqlbinlogPath"`
BackupMysqlclientPath string `mapstructure:"backup-mysqlclient-path" toml:"backup-mysqlclient-path" json:"backupMysqlclientgPath"`
Expand Down
19 changes: 19 additions & 0 deletions share/dashboard/app/dashboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,21 @@ app.controller('DashboardController', function (
$scope.missingProxyTags = [];
$scope.promise = undefined;
$scope.processlist = {};

$scope.isEditing = {};
$scope.editableData = {};

// Start editing by setting the item id in isEditing and initializing editableData
$scope.startEditing = function(key, value) {
$scope.isEditing[key] = true;
$scope.editableData[key] = value; // Store the initial value in editableData
};

// Cancel editing by removing the item from editableData and resetting isEditing
$scope.cancelEditing = function(itemId) {
$scope.isEditing[itemId] = false; // Reset editing state for this item
delete $scope.editableData[itemId]; // Discard changes by deleting from editableData
};

$scope.UpdateProcessList = function (newData) {
// Iterate over each key in the new data
Expand Down Expand Up @@ -1887,6 +1902,10 @@ app.controller('DashboardController', function (
if (confirm("Confirm change '" + setting.toString() + "' to: " + value.toString())) httpGetWithoutResponse(getClusterUrl() + '/settings/actions/set/' + setting + '/' + value);
};

$scope.setSettingsEncode = function (setting, value) {
if (confirm("Confirm change '" + setting.toString() + "' to: " + value.toString())) httpGetWithoutResponse(getClusterUrl() + '/settings/actions/set/' + setting + '/' + btoa(value));
};

$scope.setsettingsnullable = function (setting, value) {
if (value.length == 0) {
value = "{undefined}"
Expand Down
50 changes: 50 additions & 0 deletions share/dashboard/static/card-setting-backup.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,60 @@
<md-select name="selectedLogicalBackup" ng-model="selectedLogicalBackup">
<md-option ng-selected="{{key == selectedCluster.config.backupLogicalType}}" ng-repeat="(key, value) in settings.backupLogicalList" ng-value="key">{{key}}</md-option>
</md-select>
</td>
</tr>
<tr>
<td colspan=4>
Mysqldump options: <br/>
<div ng-if="!isEditing['backupMysqldumpOptions']" style="display: flex;">
<input type="text" ng-model="selectedCluster.config.backupMysqldumpOptions" readonly placeholder="Original text here" style="flex: 1; margin-right: 8px;"/>
<button ng-click="startEditing('backupMysqldumpOptions', selectedCluster.config.backupMysqldumpOptions)">Edit</button>
</div>
<div ng-if="isEditing['backupMysqldumpOptions']" style="display: flex;">
<input type="text" ng-model="editableData.backupMysqldumpOptions" placeholder="Edit text here" style="flex: 1; margin-right: 8px;"/>
<button ng-click="setSettingsEncode('backup-mysqldump-options',editableData.backupMysqldumpOptions)">Save</button>
<button ng-click="cancelEditing('backupMysqldumpOptions')">Cancel</button>
</div>
</td>
</tr>
<tr>
<td colspan=4>
MyDumper options: <br/>
<div ng-if="!isEditing['backupMyDumperOptions']" style="display: flex;">
<input type="text" ng-model="selectedCluster.config.backupMyDumperOptions" readonly placeholder="Original text here" style="flex: 1; margin-right: 8px;"/>
<button ng-click="startEditing('backupMyDumperOptions', selectedCluster.config.backupMyDumperOptions)">Edit</button>
</div>
<div ng-if="isEditing['backupMyDumperOptions']" style="display: flex;">
<input type="text" ng-model="editableData.backupMyDumperOptions" placeholder="Edit text here" style="flex: 1; margin-right: 8px;"/>
<button ng-click="setSettingsEncode('backup-mydumper-options',editableData.backupMyDumperOptions)">Save</button>
<button ng-click="cancelEditing('backupMyDumperOptions')">Cancel</button>
</div>
</td>
</tr>
<tr>
<td colspan=4>
MyLoader options: <br/>
<div ng-if="!isEditing['backupMyLoaderOptions']" style="display: flex;">
<input type="text" ng-model="selectedCluster.config.backupMyLoaderOptions" readonly placeholder="Original text here" style="flex: 1; margin-right: 8px;"/>
<button ng-click="startEditing('backupMyLoaderOptions', selectedCluster.config.backupMyLoaderOptions)">Edit</button>
</div>
<div ng-if="isEditing['backupMyLoaderOptions']" style="display: flex;">
<input type="text" ng-model="editableData.backupMyLoaderOptions" placeholder="Edit text here" style="flex: 1; margin-right: 8px;"/>
<button ng-click="setSettingsEncode('backup-myloader-options',editableData.backupMyLoaderOptions)">Save</button>
<button ng-click="cancelEditing('backupMyLoaderOptions')">Cancel</button>
</div>
</td>
</tr>
<tr>
<td colspan=4>
Physical Backup: <span style="display:inline-block;;margin: 2px;" class="label label-success">{{selectedCluster.config.backupPhysicalType }}</span>
<md-select name="selectedPhysicalBackup" ng-model="selectedPhysicalBackup">
<md-option ng-selected="{{key == selectedCluster.config.backupPhysicalType}}" ng-repeat="(key, value) in settings.backupPhysicalList" ng-value="key">{{key}}</md-option>
</md-select>
</td>
</tr>
<tr>
<td colspan=4>
Binlog Backup: <span style="display:inline-block;;margin: 2px;" class="label label-success">{{selectedCluster.config.binlogCopyMode }}</span>
<md-select name="selectedBinlogBackup" ng-model="selectedBinlogBackup">
<md-option ng-selected="{{key == selectedCluster.config.binlogCopyMode}}" ng-repeat="(key, value) in settings.backupBinlogList" ng-value="key">{{key}}</md-option>
Expand Down

0 comments on commit eb4c17e

Please sign in to comment.