Skip to content

Commit 2ef33c3

Browse files
author
Jonas Gauffin
committed
Small UI fixes for the web
1 parent 1d0549f commit 2ef33c3

File tree

13 files changed

+72
-24
lines changed

13 files changed

+72
-24
lines changed

src/Server/Coderr.Server.SqlServer/Modules/Whitelists/AddEntryHandler.cs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using System;
2+
using System.Linq;
23
using System.Net;
34
using System.Threading.Tasks;
45
using Coderr.Server.Api.Modules.Whitelists.Commands;
@@ -55,8 +56,13 @@ public async Task HandleAsync(IMessageContext context, AddEntry message)
5556
private async Task LookupIps(AddEntry message, Whitelist entry)
5657
{
5758
var lookup = new LookupClient();
58-
var result = await lookup.QueryAsync(message.DomainName, QueryType.ANY);
59-
foreach (var record in result.AllRecords)
59+
var result = await lookup.QueryAsync(message.DomainName, QueryType.A);
60+
var result2 = await lookup.QueryAsync(message.DomainName, QueryType.AAAA);
61+
62+
var results = result.AllRecords.ToList();
63+
results.AddRange(result2.AllRecords);
64+
65+
foreach (var record in results)
6066
{
6167
switch (record)
6268
{

src/Server/Coderr.Server.WebSite/ClientApp/src/app/admin/apikeys/create/create.component.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ <h2 class="text-white text-shadow-1">Create an api key</h2>
55
<div class="panels">
66
<div class="panel">
77
<div class="fill">
8-
<div class="form-control">
8+
<div class="form-group">
99
<label>
1010
Name
1111
</label>
@@ -32,7 +32,7 @@ <h4 class="text-dark">Accessible applications</h4>
3232

3333
</div>
3434

35-
<div class="form-control p-2">
35+
<div class="form-group">
3636
<button class="btn">Save</button>
3737
</div>
3838

src/Server/Coderr.Server.WebSite/ClientApp/src/app/admin/apikeys/edit/edit.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ <h2 class="text-white text-shadow-1">Edit API key</h2>
44
<div class="panels">
55
<div class="panel ml-0">
66
<div class="fill">
7-
<div class="form-control">
7+
<div class="form-group">
88
<label>
99
Name
1010
</label>

src/Server/Coderr.Server.WebSite/ClientApp/src/app/admin/app-create/create.component.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
<form id="app-create" class="form p-2" [formGroup]="createForm" (ngSubmit)="onSubmit()" [attr.disabled]="disabled">
22

3-
<div class="form-control">
3+
<div class="form-group">
44
<label>
55
Name
66
</label>
77
<input type="text" placeholder="Application name" formControlName="name" />
88
</div>
9-
<div class="form-control" *ngIf="showGroups">
9+
<div class="form-group" *ngIf="showGroups">
1010
<label>Group</label>
1111
<select formControlName="groupId">
1212
<option *ngFor="let group of groups" [value]="group.id">{{group.name}}</option>
1313
</select>
1414
</div>
15-
<div class="form-control">
15+
<div class="form-group">
1616
<input type="checkbox" id="check1" class="inline" formControlName="trackStats" /><label class="inline" for="check1"><span></span>I want to compare our statistics with other companies</label>
1717
</div>
18-
<div class="form-control">
18+
<div class="form-group">
1919
<span class="error" style="white-space: pre-line">{{errorMessage}}</span>
2020
<button type="submit">Create application</button>
2121
<button type="reset" (click)="cancel()" class="btn dark">Cancel</button>

src/Server/Coderr.Server.WebSite/ClientApp/src/app/admin/groups/add/add.component.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
<form id="app-group-add" class="form p-2" [formGroup]="createForm" (ngSubmit)="onSubmit()" [attr.disabled]="disabled">
22

3-
<div class="form-control">
3+
<div class="form-group">
44
<label>
55
Name
66
</label>
77
<input type="text" placeholder="Group name" formControlName="name" />
88
</div>
9-
<div class="form-control">
9+
<div class="form-group">
1010
<span class="error" style="white-space: pre-line">{{errorMessage}}</span>
1111
<button type="submit">Create</button>
1212
<button type="reset" (click)="cancel()">Cancel</button>

src/Server/Coderr.Server.WebSite/ClientApp/src/app/admin/groups/add/add.component.ts

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,17 @@ import { Router, ActivatedRoute } from '@angular/router';
44
import { ApplicationService } from "../../../applications/application.service";
55
import { ApplicationGroupService } from "../application-groups.service";
66
import { NavMenuService } from "../../../nav-menu/nav-menu.service";
7+
import { IGroupListItem } from "../group.model";
8+
import { ToastrService } from "ngx-toastr";
9+
10+
export interface IGroupCreated {
11+
success: boolean;
12+
group?: IGroupListItem;
13+
error?: Error;
14+
15+
/** Can be "Canceled" if aborted (success = false) */
16+
message?: string;
17+
}
718

819
@Component({
920
selector: 'app-group-add',
@@ -17,10 +28,11 @@ export class GroupAddComponent implements OnInit, OnDestroy {
1728
errorMessage = '';
1829
returnUrl = '';
1930
disabled = false;
20-
@Output() closed = new EventEmitter();
31+
@Output() closed = new EventEmitter<IGroupCreated>();
2132

2233
constructor(
2334
private formBuilder: FormBuilder,
35+
private toastrService: ToastrService,
2436
private router: Router,
2537
private service: ApplicationGroupService,
2638
navMenuService: NavMenuService) {
@@ -50,6 +62,7 @@ export class GroupAddComponent implements OnInit, OnDestroy {
5062
this.disabled = true;
5163
this.service.create(this.createForm.value.name)
5264
.then(x => {
65+
this.toastrService.success('Entry is being created..');
5366
this.createForm.reset();
5467
this.closed.emit({ success: true, group: x });
5568
}).catch(e => {

src/Server/Coderr.Server.WebSite/ClientApp/src/app/admin/groups/edit/edit.component.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22
<div class="panel">
33
<h2>Edit group '{{name}}'</h2>
44
<div class="fill">
5-
<div class="form-control">
5+
<div class="form-group">
66
<label class="label">Name</label>
77
<input required type="text" name="name" [(ngModel)]="name" placeholder="Name describing this group" />
88
</div>
9-
<div class="form-control">
9+
<div class="form-group">
1010
<label>Applications</label>
1111
<p>
1212
<em class="small">Application(s) that are displayed under this group.</em>

src/Server/Coderr.Server.WebSite/ClientApp/src/app/admin/groups/list/list.component.html

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,16 @@ <h2>Application groups</h2>
2020
</tbody>
2121
</table>
2222
<div>
23-
<a [routerLink]="['new']" class="btn">Create</a>
23+
<a (click)="createGroup()" class="btn">Create</a>
2424
</div>
2525
</div>
26+
27+
<modal id="createNewGroupModal">
28+
<div class="panel">
29+
<h3>Create group</h3>
30+
<div class="fill">
31+
<p>Application groups are used to logically group applications into smaller lists.</p>
32+
<app-group-add (closed)="onGroupCreated($event)"></app-group-add>
33+
</div>
34+
</div>
35+
</modal>

src/Server/Coderr.Server.WebSite/ClientApp/src/app/admin/groups/list/list.component.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ import { Component, OnInit, OnDestroy } from '@angular/core';
22
import { IGroupListItem } from "../group.model";
33
import { ApplicationGroupService } from "../application-groups.service";
44
import { NavMenuService } from "../../../nav-menu/nav-menu.service";
5+
import { ModalService } from "../../../_controls/modal/modal.service";
6+
import { IGroupCreated } from "../add/add.component";
57

68
@Component({
79
selector: 'app-groups',
@@ -14,6 +16,7 @@ export class GroupListComponent implements OnInit, OnDestroy {
1416

1517
constructor(
1618
private groupService: ApplicationGroupService,
19+
private modalService: ModalService,
1720
navMenuService: NavMenuService) {
1821

1922
navMenuService.updateNav([
@@ -32,4 +35,18 @@ export class GroupListComponent implements OnInit, OnDestroy {
3235
this.sub.unsubscribe();
3336
}
3437

38+
createGroup() {
39+
this.modalService.open('createNewGroupModal');
40+
}
41+
42+
onGroupCreated(e: IGroupCreated) {
43+
console.log(e);
44+
if (e.success) {
45+
this.groups.push(e.group);
46+
}
47+
48+
this.modalService.close('createNewGroupModal');
49+
}
50+
51+
3552
}

src/Server/Coderr.Server.WebSite/ClientApp/src/app/admin/whitelist/add/add.component.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@
44
<h2>New whitelist</h2>
55

66
<div class="fill">
7-
<div class="form-control">
7+
<div class="form-group">
88
<label class="label">Host name</label>
99
<input required type="text" name="domainName" [(ngModel)]="domainName" placeholder="myapp.yourdomain.com" />
1010
<em class="small">Domain name, including the subdomain/host.</em>
1111
</div>
12-
<div class="form-control">
12+
<div class="form-group">
1313
<label>Applications</label>
1414
<p>
1515
<em class="small">Application(s) that the domain may report errors for. None marked = all are allowed.</em>
@@ -21,7 +21,7 @@ <h2>New whitelist</h2>
2121
</label>
2222
</div>
2323
</div>
24-
<div class="form-control">
24+
<div class="form-group">
2525
<label class="label">IP Addresses</label>
2626
<p>
2727
<em class="small">
@@ -41,7 +41,7 @@ <h2>New whitelist</h2>
4141
</table>
4242
<button type="button" (click)="showAddIp()">Add new IP</button>
4343
</div>
44-
<div class="form-control">
44+
<div class="form-group">
4545
<span class="error" style="white-space: pre-line">{{errorMessage}}</span>
4646
</div>
4747
</div>

0 commit comments

Comments
 (0)