Fix error reporting of restore form

angular does not attach form elements to the $scope when the DOM
elements are created dynamically!
This commit is contained in:
Johannes Zellner
2018-05-29 22:46:03 +02:00
parent c031253bd4
commit 9189532b83
2 changed files with 5 additions and 14 deletions

View File

@@ -200,16 +200,13 @@
</div>
<br/>
<fieldset>
<form role="form" name="appRestoreForm" ng-submit="appRestore.restore()" autocomplete="off">
<div class="form-group" ng-class="{ 'has-error': (appRestoreForm.password.$dirty && appRestoreForm.password.$invalid) || (!appRestoreForm.password.$dirty && appRestore.error.password) }">
<form role="form" ng-submit="appRestore.restore()" autocomplete="off">
<div class="form-group" ng-class="{ 'has-error': appRestore.error.password }">
<label class="control-label" for="appRestorePasswordInput">Provide your password to confirm this action</label>
<div class="control-label" ng-show="(appRestoreForm.password.$dirty && appRestoreForm.password.$invalid) || (!appRestoreForm.password.$dirty && appRestore.error.password)">
<small ng-show=" appRestoreForm.password.$dirty && appRestoreForm.password.$invalid">Password required</small>
<small ng-show="!appRestoreForm.password.$dirty && appRestore.error.password">Wrong password</small>
</div>
<div ng-show="appRestore.error.password"><small>Wrong password</small></div>
<input type="password" class="form-control" ng-model="appRestore.password" id="appRestorePasswordInput" name="password" required autofocus>
</div>
<input class="ng-hide" type="submit" ng-disabled="appRestoreForm.$invalid || busy"/>
<input class="ng-hide" type="submit" ng-disabled="!appRestore.password || appRestore.busy || !appRestore.selectedBackup"/>
</form>
</fieldset>
</uib-tab>
@@ -272,7 +269,7 @@
<button type="button" class="btn btn-primary pull-left" ng-click="appRestore.createBackup()" ng-disabled="appRestore.app.installationState === 'pending_backup'" uib-tooltip="Take a live snapshot of this app" tooltip-placement="right"><i class="fa fa-circle-o-notch fa-spin" ng-show="appRestore.app.installationState === 'pending_backup'"></i> Create Backup</button>
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
<button type="button" class="btn btn-success" ng-click="appRestore.clone()" ng-show="appRestore.action === 'clone' && appRestore.backups.length !== 0" ng-disabled="appCloneForm.$invalid || appRestore.busy || !appRestore.selectedBackup"><i class="fa fa-circle-o-notch fa-spin" ng-show="appRestore.busy"></i> Clone</button>
<button type="button" class="btn btn-danger" ng-click="appRestore.restore()" ng-show="appRestore.action === 'restore' && appRestore.backups.length !== 0" ng-disabled="appRestoreForm.$invalid || appRestore.busy || !appRestore.selectedBackup"><i class="fa fa-circle-o-notch fa-spin" ng-show="appRestore.busy"></i> Restore</button>
<button type="button" class="btn btn-danger" ng-click="appRestore.restore()" ng-show="appRestore.action === 'restore' && appRestore.backups.length !== 0" ng-disabled="!appRestore.password || appRestore.busy || !appRestore.selectedBackup"><i class="fa fa-circle-o-notch fa-spin" ng-show="appRestore.busy"></i> Restore</button>
</div>
</div>
</div>