Skip to content
This repository was archived by the owner on Jun 18, 2023. It is now read-only.

Commit 04ba277

Browse files
committed
feat: First run of formatter
1 parent 568b6d5 commit 04ba277

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+709
-564
lines changed

src/app/app.component.css

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
app-header {
2-
position: fixed;
3-
z-index: 100;
4-
width: 100%;
2+
position: fixed;
3+
z-index: 100;
4+
width: 100%;
55
}
66

77
main {
8-
margin: 0 64px;
9-
padding: 64px 0;
10-
}
8+
margin: 0 64px;
9+
padding: 64px 0;
10+
}

src/app/app.component.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<app-header></app-header>
22
<main fxLayout="column" fxLayoutGap="24px">
3-
<app-info></app-info>
4-
<app-servers></app-servers>
5-
<app-channels></app-channels>
6-
<app-schemas></app-schemas>
3+
<app-info></app-info>
4+
<app-servers></app-servers>
5+
<app-channels></app-channels>
6+
<app-schemas></app-schemas>
77
</main>

src/app/app.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { Component } from '@angular/core';
33
@Component({
44
selector: 'app-root',
55
templateUrl: './app.component.html',
6-
styleUrls: ['./app.component.css']
6+
styleUrls: ['./app.component.css'],
77
})
88
export class AppComponent {
99
title = 'springwolf';

src/app/app.module.ts

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import { MockServer } from './shared/mock/mock-server';
2020
import { PublisherService } from './shared/publisher.service';
2121
import { FormsModule } from '@angular/forms';
2222
import { JsonComponent } from './shared/components/json/json.component';
23-
import {AsyncApiMapperService} from "./shared/asyncapi-mapper.service";
23+
import { AsyncApiMapperService } from './shared/asyncapi-mapper.service';
2424

2525
@NgModule({
2626
declarations: [
@@ -42,7 +42,9 @@ import {AsyncApiMapperService} from "./shared/asyncapi-mapper.service";
4242
HighlightModule,
4343
HttpClientModule,
4444
FormsModule,
45-
environment.production ? [] : HttpClientInMemoryWebApiModule.forRoot(MockServer, { delay: 100 })
45+
environment.production
46+
? []
47+
: HttpClientInMemoryWebApiModule.forRoot(MockServer, { delay: 100 }),
4648
],
4749
providers: [
4850
AsyncApiService,
@@ -52,11 +54,13 @@ import {AsyncApiMapperService} from "./shared/asyncapi-mapper.service";
5254
provide: HIGHLIGHT_OPTIONS,
5355
useValue: {
5456
languages: function () {
55-
return { typescript: () => import('highlight.js/lib/languages/typescript') };
56-
}
57-
}
58-
}
57+
return {
58+
typescript: () => import('highlight.js/lib/languages/typescript'),
59+
};
60+
},
61+
},
62+
},
5963
],
60-
bootstrap: [AppComponent]
64+
bootstrap: [AppComponent],
6165
})
62-
export class AppModule { }
66+
export class AppModule {}

src/app/channels/channel-main/channel-main.component.css

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,34 @@
11
textarea {
2-
margin-top: 16px;
3-
padding: 8px;
4-
border-radius: 4px;
5-
border-width: 0;
6-
line-height: 24px;
7-
background-color: #282c34;
8-
color: #abb2bf;
2+
margin-top: 16px;
3+
padding: 8px;
4+
border-radius: 4px;
5+
border-width: 0;
6+
line-height: 24px;
7+
background-color: #282c34;
8+
color: #abb2bf;
99
}
1010

1111
button {
12-
margin-top: 8px;
12+
margin-top: 8px;
1313
}
1414

1515
.property-badge {
16-
background-color: #C5CAE9;
17-
border-radius: 4px;
18-
padding: 6px;
19-
font-size: small;
20-
font-weight: bold;
16+
background-color: #c5cae9;
17+
border-radius: 4px;
18+
padding: 6px;
19+
font-size: small;
20+
font-weight: bold;
2121
}
2222

2323
.payload-name {
24-
background-color: #E0E0E0;
25-
border-radius: 4px;
26-
padding: 6px;
27-
font-weight: normal;
24+
background-color: #e0e0e0;
25+
border-radius: 4px;
26+
padding: 6px;
27+
font-weight: normal;
2828
}
2929

3030
.header-name {
31-
background-color: #E0E0E0;
31+
background-color: #e0e0e0;
3232
border-radius: 4px;
3333
padding: 6px;
3434
font-weight: normal;
Lines changed: 76 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -1,58 +1,80 @@
11
<section>
2+
<mat-divider></mat-divider>
3+
<div *ngIf="operation.message.description">
4+
<h4>{{ operation.message.description }}</h4>
25
<mat-divider></mat-divider>
3-
<div *ngIf="operation.message.description">
4-
<h4>{{ operation.message.description }}</h4>
5-
<mat-divider></mat-divider>
6-
</div>
7-
<mat-tab-group animationDuration="0ms">
8-
<mat-tab label="Example">
9-
<div fxLayout="column">
10-
<textarea spellcheck="false"
11-
#exampleTextArea
12-
[rows]="exampleTextAreaLineCount"
13-
[value]="defaultExample?.value"
14-
(keyup)="recalculateLineCount('example', exampleTextArea.value)"
15-
></textarea>
16-
<div fxLayout fxLayoutGap="8px">
17-
<button mat-raised-button color="primary" (click)="publish(exampleTextArea.value, headersTextArea.value)">
18-
Publish
19-
</button>
20-
<button mat-raised-button color="primary"
21-
(click)="exampleTextArea.value = defaultExample.value; exampleTextAreaLineCount=defaultExample.lineCount">
22-
Default
23-
</button>
24-
<button mat-raised-button color="primary" [cdkCopyToClipboard]="exampleTextArea.value">Copy</button>
25-
</div>
6+
</div>
7+
<mat-tab-group animationDuration="0ms">
8+
<mat-tab label="Example">
9+
<div fxLayout="column">
10+
<textarea
11+
spellcheck="false"
12+
#exampleTextArea
13+
[rows]="exampleTextAreaLineCount"
14+
[value]="defaultExample?.value"
15+
(keyup)="recalculateLineCount('example', exampleTextArea.value)"
16+
></textarea>
17+
<div fxLayout fxLayoutGap="8px">
18+
<button
19+
mat-raised-button
20+
color="primary"
21+
(click)="publish(exampleTextArea.value, headersTextArea.value)"
22+
>
23+
Publish
24+
</button>
25+
<button
26+
mat-raised-button
27+
color="primary"
28+
(click)="
29+
exampleTextArea.value = defaultExample.value;
30+
exampleTextAreaLineCount = defaultExample.lineCount
31+
"
32+
>
33+
Default
34+
</button>
35+
<button
36+
mat-raised-button
37+
color="primary"
38+
[cdkCopyToClipboard]="exampleTextArea.value"
39+
>
40+
Copy
41+
</button>
2642
</div>
27-
</mat-tab>
28-
<mat-tab label="Schema">
29-
<h4>
30-
{{ schemaName }}
31-
<span class="payload-name">
32-
<a [href]="operation.message.payload.anchorUrl" >{{ operation.message.payload.name }}</a>
33-
</span>
34-
</h4>
35-
<app-schema *ngIf="schema" [schema]="schema"></app-schema>
36-
</mat-tab>
37-
<mat-tab label="Headers">
38-
<h4>
39-
{{ headersSchemaName }}
40-
<span class="header-name">
41-
<a [href]="operation.message.headers.anchorUrl">{{ operation.message.headers.name }}</a>
42-
</span>
43-
</h4>
44-
<app-schema *ngIf="headers" [schema]="headers"></app-schema>
45-
<div fxLayout="column">
46-
<textarea spellcheck="false"
47-
#headersTextArea
48-
[rows]="headersTextAreaLineCount"
49-
[value]="headersExample?.value"
50-
(keyup)="recalculateLineCount('headers', headersTextArea.value)"
51-
></textarea>
52-
</div>
53-
</mat-tab>
54-
<mat-tab label="Bindings">
55-
<app-json [data]="operation.bindings[protocolName]"></app-json>
56-
</mat-tab>
57-
</mat-tab-group>
43+
</div>
44+
</mat-tab>
45+
<mat-tab label="Schema">
46+
<h4>
47+
{{ schemaName }}
48+
<span class="payload-name">
49+
<a [href]="operation.message.payload.anchorUrl">{{
50+
operation.message.payload.name
51+
}}</a>
52+
</span>
53+
</h4>
54+
<app-schema *ngIf="schema" [schema]="schema"></app-schema>
55+
</mat-tab>
56+
<mat-tab label="Headers">
57+
<h4>
58+
{{ headersSchemaName }}
59+
<span class="header-name">
60+
<a [href]="operation.message.headers.anchorUrl">{{
61+
operation.message.headers.name
62+
}}</a>
63+
</span>
64+
</h4>
65+
<app-schema *ngIf="headers" [schema]="headers"></app-schema>
66+
<div fxLayout="column">
67+
<textarea
68+
spellcheck="false"
69+
#headersTextArea
70+
[rows]="headersTextAreaLineCount"
71+
[value]="headersExample?.value"
72+
(keyup)="recalculateLineCount('headers', headersTextArea.value)"
73+
></textarea>
74+
</div>
75+
</mat-tab>
76+
<mat-tab label="Bindings">
77+
<app-json [data]="operation.bindings[protocolName]"></app-json>
78+
</mat-tab>
79+
</mat-tab-group>
5880
</section>

src/app/channels/channel-main/channel-main.component.ts

Lines changed: 37 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,9 @@ import { STATUS } from 'angular-in-memory-web-api';
1010
@Component({
1111
selector: 'app-channel-main',
1212
templateUrl: './channel-main.component.html',
13-
styleUrls: ['./channel-main.component.css']
13+
styleUrls: ['./channel-main.component.css'],
1414
})
1515
export class ChannelMainComponent implements OnInit {
16-
1716
@Input() docName: string;
1817
@Input() channelName: string;
1918
@Input() operation: Operation;
@@ -34,23 +33,24 @@ export class ChannelMainComponent implements OnInit {
3433
private snackBar: MatSnackBar
3534
) {}
3635

37-
3836
ngOnInit(): void {
39-
this.asyncApiService.getAsyncApi().subscribe(
40-
asyncapi => {
41-
let schemas: Map<string, Schema> = asyncapi.components.schemas;
42-
this.schemaName = this.operation.message.payload.name.slice(this.operation.message.payload.name.lastIndexOf('/') + 1)
43-
this.schema = schemas.get(this.schemaName);
37+
this.asyncApiService.getAsyncApi().subscribe((asyncapi) => {
38+
let schemas: Map<string, Schema> = asyncapi.components.schemas;
39+
this.schemaName = this.operation.message.payload.name.slice(
40+
this.operation.message.payload.name.lastIndexOf('/') + 1
41+
);
42+
this.schema = schemas.get(this.schemaName);
4443

45-
this.defaultExample = this.schema.example;
46-
this.exampleTextAreaLineCount = this.defaultExample?.lineCount || 0;
44+
this.defaultExample = this.schema.example;
45+
this.exampleTextAreaLineCount = this.defaultExample?.lineCount || 0;
4746

48-
this.headersSchemaName = this.operation.message.headers.name.slice(this.operation.message.headers.name.lastIndexOf('/') + 1)
49-
this.headers = schemas.get(this.headersSchemaName);
50-
this.headersExample = this.headers.example;
51-
this.headersTextAreaLineCount = this.headersExample?.lineCount || 0;
52-
}
53-
);
47+
this.headersSchemaName = this.operation.message.headers.name.slice(
48+
this.operation.message.headers.name.lastIndexOf('/') + 1
49+
);
50+
this.headers = schemas.get(this.headersSchemaName);
51+
this.headersExample = this.headers.example;
52+
this.headersTextAreaLineCount = this.headersExample?.lineCount || 0;
53+
});
5454

5555
this.protocolName = Object.keys(this.operation.bindings)[0];
5656
}
@@ -61,42 +61,47 @@ export class ChannelMainComponent implements OnInit {
6161
this.exampleTextAreaLineCount = text.split('\n').length;
6262
break;
6363
case 'headers':
64-
this.headersTextAreaLineCount = text.split('\n').length
64+
this.headersTextAreaLineCount = text.split('\n').length;
6565
break;
6666
}
6767
}
6868

6969
publish(example: string, headers: string): void {
7070
try {
7171
const payloadJson = JSON.parse(example);
72-
const headersJson = JSON.parse(headers)
73-
74-
this.publisherService.publish(this.protocolName, this.channelName, payloadJson, headersJson).subscribe(
75-
_ => this.handlePublishSuccess(),
76-
err => this.handlePublishError(err)
77-
);
78-
} catch(error) {
72+
const headersJson = JSON.parse(headers);
73+
74+
this.publisherService
75+
.publish(this.protocolName, this.channelName, payloadJson, headersJson)
76+
.subscribe(
77+
(_) => this.handlePublishSuccess(),
78+
(err) => this.handlePublishError(err)
79+
);
80+
} catch (error) {
7981
this.snackBar.open('Example payload is not valid', 'ERROR', {
80-
duration: 3000
81-
})
82+
duration: 3000,
83+
});
8284
}
8385
}
8486

8587
private handlePublishSuccess() {
86-
return this.snackBar.open('Example payload sent to: ' + this.channelName, 'PUBLISHED', {
87-
duration: 3000
88-
});
88+
return this.snackBar.open(
89+
'Example payload sent to: ' + this.channelName,
90+
'PUBLISHED',
91+
{
92+
duration: 3000,
93+
}
94+
);
8995
}
9096

91-
private handlePublishError(err: {status?: number}) {
97+
private handlePublishError(err: { status?: number }) {
9298
let msg = 'Publish failed';
9399
if (err?.status === STATUS.NOT_FOUND) {
94100
msg += ': no publisher was provided for ' + this.protocolName;
95101
}
96102

97103
return this.snackBar.open(msg, 'ERROR', {
98-
duration: 4000
104+
duration: 4000,
99105
});
100106
}
101-
102107
}

0 commit comments

Comments
 (0)