2017-07-08 18:43:42 +08:00
|
|
|
<div class="panel panel-default">
|
|
|
|
<div class="panel-heading">
|
|
|
|
<h3 class="panel-title">Database settings</h3>
|
|
|
|
</div>
|
|
|
|
<div class="panel-body">
|
|
|
|
<div [hidden]="!error" class="alert alert-danger" role="alert"><strong>Error: </strong>{{error}}</div>
|
|
|
|
<form #settingsForm="ngForm">
|
|
|
|
<p class="title">Type:</p>
|
2017-07-15 23:29:40 +08:00
|
|
|
<select class="form-control" [(ngModel)]="settings.type" name="type" required>
|
2017-07-13 00:31:19 +08:00
|
|
|
<option *ngFor="let type of types" [ngValue]="type.key">{{type.value}}
|
2017-07-08 18:43:42 +08:00
|
|
|
</option>
|
|
|
|
</select>
|
2017-07-21 05:37:10 +08:00
|
|
|
<span *ngIf="settings.type == DatabaseType.mysql"
|
|
|
|
class="help-block">Install manually mysql node module to use mysql (npm install mysql)</span>
|
|
|
|
|
2017-07-15 23:29:40 +08:00
|
|
|
<ng-container *ngIf="settings.type == DatabaseType.mysql">
|
2017-07-08 18:43:42 +08:00
|
|
|
<p class="title">MySQL settings:</p>
|
|
|
|
<input type="text" class="form-control" placeholder="Host" autofocus
|
2017-07-15 23:29:40 +08:00
|
|
|
[(ngModel)]="settings.mysql.host" name="host" required>
|
2017-07-08 18:43:42 +08:00
|
|
|
<input type="text" class="form-control" placeholder="Database" autofocus
|
2017-07-15 23:29:40 +08:00
|
|
|
[(ngModel)]="settings.mysql.database" name="database" required>
|
2017-07-08 18:43:42 +08:00
|
|
|
<input type="text" class="form-control" placeholder="Username"
|
2017-07-15 23:29:40 +08:00
|
|
|
[(ngModel)]="settings.mysql.username" name="username">
|
2017-07-08 18:43:42 +08:00
|
|
|
<input type="password" class="form-control" placeholder="Password"
|
2017-07-15 23:29:40 +08:00
|
|
|
[(ngModel)]="settings.mysql.password" name="password">
|
2017-07-08 18:43:42 +08:00
|
|
|
</ng-container>
|
2017-07-21 05:37:10 +08:00
|
|
|
<ng-container *ngIf="settings.type == DatabaseType.sqlite">
|
|
|
|
<p class="title">SQLie settings:</p>
|
|
|
|
<input type="text" class="form-control" placeholder="storage" autofocus
|
|
|
|
[(ngModel)]="settings.sqlite.storage" name="host" required>
|
|
|
|
</ng-container>
|
2017-07-08 18:43:42 +08:00
|
|
|
|
|
|
|
</form>
|
|
|
|
<button class="btn btn-success pull-right"
|
2017-07-13 00:31:19 +08:00
|
|
|
[disabled]="!settingsForm.form.valid || !changed || inProgress"
|
2017-07-08 18:43:42 +08:00
|
|
|
(click)="save()">Save
|
|
|
|
</button>
|
|
|
|
<button class="btn btn-default pull-right"
|
|
|
|
(click)="reset()">Reset
|
|
|
|
</button>
|
|
|
|
</div>
|
|
|
|
</div>
|