Properly indent all source files
This commit is contained in:
@ -1,46 +1,46 @@
|
||||
<div class="header">
|
||||
<rb-form-date-input name="dateInput" label="older than" [options]="{enableTime: true}"
|
||||
[(ngModel)]="timestamp" (ngModelChange)="loadChangelog()">
|
||||
</rb-form-date-input>
|
||||
<rb-form-date-input name="dateInput" label="older than" [options]="{enableTime: true}"
|
||||
[(ngModel)]="timestamp" (ngModelChange)="loadChangelog()">
|
||||
</rb-form-date-input>
|
||||
|
||||
<rb-form-select name="pageSizeSelection" label="page size" [(ngModel)]="pageSize" (ngModelChange)="loadChangelog()">
|
||||
<option value="3">3</option>
|
||||
<option value="10">10</option>
|
||||
<option value="25">25</option>
|
||||
<option value="50">50</option>
|
||||
<option value="100">100</option>
|
||||
<option value="250">250</option>
|
||||
<option value="500">500</option>
|
||||
</rb-form-select>
|
||||
<rb-form-select name="pageSizeSelection" label="page size" [(ngModel)]="pageSize" (ngModelChange)="loadChangelog()">
|
||||
<option value="3">3</option>
|
||||
<option value="10">10</option>
|
||||
<option value="25">25</option>
|
||||
<option value="50">50</option>
|
||||
<option value="100">100</option>
|
||||
<option value="250">250</option>
|
||||
<option value="500">500</option>
|
||||
</rb-form-select>
|
||||
|
||||
<button class="rb-btn rb-link" type="button" (click)="loadChangelog(1)">
|
||||
next page
|
||||
<span class="rb-ic rb-ic-forward-right"></span>
|
||||
</button>
|
||||
<button class="rb-btn rb-link" type="button" (click)="loadChangelog(1)">
|
||||
next page
|
||||
<span class="rb-ic rb-ic-forward-right"></span>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<rb-table ellipsis>
|
||||
<tr>
|
||||
<th>Date</th>
|
||||
<th>Action</th>
|
||||
<th>Data</th>
|
||||
</tr>
|
||||
<tr *ngFor="let entry of changelog; index as i" class="clickable" (click)="showDetails(i, sampleModal)">
|
||||
<td>{{entry.date}}</td>
|
||||
<td>{{entry.action}}</td>
|
||||
<td>{{entry.data | json}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Date</th>
|
||||
<th>Action</th>
|
||||
<th>Data</th>
|
||||
</tr>
|
||||
<tr *ngFor="let entry of changelog; index as i" class="clickable" (click)="showDetails(i, sampleModal)">
|
||||
<td>{{entry.date}}</td>
|
||||
<td>{{entry.action}}</td>
|
||||
<td>{{entry.data | json}}</td>
|
||||
</tr>
|
||||
</rb-table>
|
||||
|
||||
<ng-template #sampleModal>
|
||||
<h4>Date</h4>
|
||||
<p class="space-below">{{changelog[modalDetail].date}}</p>
|
||||
<h4>Action</h4>
|
||||
<p class="space-below">{{changelog[modalDetail].action}}</p>
|
||||
<h4>Collection</h4>
|
||||
<p class="space-below">{{changelog[modalDetail].collection}}</p>
|
||||
<h4>Conditions</h4>
|
||||
<p class="space-below">{{changelog[modalDetail].conditions | json}}</p>
|
||||
<h4>Data</h4>
|
||||
<p class="space-below">{{changelog[modalDetail].data | json}}</p>
|
||||
<h4>Date</h4>
|
||||
<p class="space-below">{{changelog[modalDetail].date}}</p>
|
||||
<h4>Action</h4>
|
||||
<p class="space-below">{{changelog[modalDetail].action}}</p>
|
||||
<h4>Collection</h4>
|
||||
<p class="space-below">{{changelog[modalDetail].collection}}</p>
|
||||
<h4>Conditions</h4>
|
||||
<p class="space-below">{{changelog[modalDetail].conditions | json}}</p>
|
||||
<h4>Data</h4>
|
||||
<p class="space-below">{{changelog[modalDetail].data | json}}</p>
|
||||
</ng-template>
|
||||
|
@ -2,20 +2,20 @@
|
||||
|
||||
.header {
|
||||
|
||||
& > * {
|
||||
float: left;
|
||||
}
|
||||
& > * {
|
||||
float: left;
|
||||
}
|
||||
|
||||
button {
|
||||
float: right;
|
||||
}
|
||||
button {
|
||||
float: right;
|
||||
}
|
||||
}
|
||||
|
||||
tr.clickable {
|
||||
background: none;
|
||||
transition: background-color 0.5s;
|
||||
background: none;
|
||||
transition: background-color 0.5s;
|
||||
|
||||
&:hover {
|
||||
background: $color-gray-mercury;
|
||||
}
|
||||
&:hover {
|
||||
background: $color-gray-mercury;
|
||||
}
|
||||
}
|
||||
|
@ -4,44 +4,44 @@ import {ApiService} from '../services/api.service';
|
||||
import {ModalService} from '@inst-iot/bosch-angular-ui-components';
|
||||
|
||||
@Component({
|
||||
selector: 'app-changelog',
|
||||
templateUrl: './changelog.component.html',
|
||||
styleUrls: ['./changelog.component.scss']
|
||||
selector: 'app-changelog',
|
||||
templateUrl: './changelog.component.html',
|
||||
styleUrls: ['./changelog.component.scss']
|
||||
})
|
||||
export class ChangelogComponent implements OnInit {
|
||||
|
||||
timestamp = new Date(); // Time from date input
|
||||
pageSize = 25;
|
||||
changelog: ChangelogModel[] = [];
|
||||
modalDetail = 0; // Index of changelog element to show details of
|
||||
timestamp = new Date(); // Time from date input
|
||||
pageSize = 25;
|
||||
changelog: ChangelogModel[] = [];
|
||||
modalDetail = 0; // Index of changelog element to show details of
|
||||
|
||||
constructor(
|
||||
private api: ApiService,
|
||||
private modal: ModalService
|
||||
) { }
|
||||
constructor(
|
||||
private api: ApiService,
|
||||
private modal: ModalService
|
||||
) { }
|
||||
|
||||
ngOnInit(): void {
|
||||
this.loadChangelog();
|
||||
}
|
||||
ngOnInit(): void {
|
||||
this.loadChangelog();
|
||||
}
|
||||
|
||||
loadChangelog(page = 0) { // Load changelog with page no relative to current page
|
||||
this.api.get<ChangelogModel[]>(`/changelog/${
|
||||
page > 0 ? this.changelog[0]._id : // Use id if no new date was given
|
||||
Math.floor(new Date(
|
||||
new Date(this.timestamp).getTime() - new Date(this.timestamp).getTimezoneOffset() * 60000 // Adjust timezone
|
||||
).getTime() / 1000).toString(16) + '0000000000000000' // Id from time
|
||||
}/${page}/${this.pageSize}`, data => {
|
||||
this.changelog = data.map(e => new ChangelogModel().deserialize(e));
|
||||
if (page) { // Adjust date picker to new first element when user clicked on next page
|
||||
this.timestamp = new Date(this.changelog[0].date);
|
||||
}
|
||||
});
|
||||
}
|
||||
loadChangelog(page = 0) { // Load changelog with page no relative to current page
|
||||
this.api.get<ChangelogModel[]>(`/changelog/${
|
||||
page > 0 ? this.changelog[0]._id : // Use id if no new date was given
|
||||
Math.floor(new Date(
|
||||
new Date(this.timestamp).getTime() - new Date(this.timestamp).getTimezoneOffset() * 60000 // Adjust timezone
|
||||
).getTime() / 1000).toString(16) + '0000000000000000' // Id from time
|
||||
}/${page}/${this.pageSize}`, data => {
|
||||
this.changelog = data.map(e => new ChangelogModel().deserialize(e));
|
||||
if (page) { // Adjust date picker to new first element when user clicked on next page
|
||||
this.timestamp = new Date(this.changelog[0].date);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Show details of a changelog element with reference to needed modal
|
||||
showDetails(i: number, modal: TemplateRef<any>) {
|
||||
this.modalDetail = i;
|
||||
this.modal.open(modal).then(() => {});
|
||||
}
|
||||
// Show details of a changelog element with reference to needed modal
|
||||
showDetails(i: number, modal: TemplateRef<any>) {
|
||||
this.modalDetail = i;
|
||||
this.modal.open(modal).then(() => {});
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user