Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(ui): improve differentiation between name and title #925

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export class ChannelMainComponent implements OnInit {

this.defaultExample = this.schema.example || noExample;
this.exampleTextAreaLineCount = this.defaultExample?.lineCount || 1;
this.defaultExampleType = this.operation().message.payload.type;
this.defaultExampleType = this.operation().message.payload.name;

this.headersSchemaIdentifier =
this.operation().message.headers.name.slice(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ export class ChannelOperationComponent implements OnInit {

defaultSchema: Schema = initSchema;
defaultExample: Example = initExample;
defaultExampleType: string = "";
originalDefaultExample: Example = this.defaultExample;

headers: Schema = initSchema;
Expand Down Expand Up @@ -57,7 +56,6 @@ export class ChannelOperationComponent implements OnInit {
const schema = schemas.get(schemaIdentifier)!!;
this.defaultSchema = schema;
this.originalDefaultExample = schema.example || noExample;
this.defaultExampleType = this.operation().message.payload.type;

const headersSchemaIdentifier =
this.operation().message.headers.name.slice(
Expand Down Expand Up @@ -123,7 +121,7 @@ export class ChannelOperationComponent implements OnInit {

publish(): void {
const example = this.defaultExample.value;
const payloadType = this.defaultExampleType;
const payloadType = this.operation().message.payload.name;
const headers = this.headersExample.value;
const bindings = this.messageBindingExampleString;
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ <h2>Schemas</h2>
><div class="type-badge">{{ schema.type }}</div></span
>
</div>
<div class="table-row" *ngIf="schema.description">
<div class="table-row description" *ngIf="schema.description">
<span>Description</span>
<markdown [data]="schema.description"></markdown>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,17 @@ describe("SchemaRangeComponent", function () {
});
};

const minimalSchema: Schema = {
title: "test",
name: "test",
anchorUrl: "test",
anchorIdentifier: "test",
usedBy: [],
};

it("should create the component", async () => {
await renderComponent({
title: "test",
name: "test",
anchorIdentifier: "test",
usedBy: [],
...minimalSchema,
minimum: 0.1,
maximum: 10,
exclusiveMinimum: true,
Expand All @@ -29,10 +34,7 @@ describe("SchemaRangeComponent", function () {

it("should have `( 0.1 .. 10 )` as value", async () => {
await renderComponent({
title: "test",
name: "test",
anchorIdentifier: "test",
usedBy: [],
...minimalSchema,
minimum: 0.1,
maximum: 10,
exclusiveMinimum: true,
Expand All @@ -44,10 +46,7 @@ describe("SchemaRangeComponent", function () {

it("should have `[ 0.1 .. 10 )` as value", async () => {
await renderComponent({
title: "test",
name: "test",
anchorIdentifier: "test",
usedBy: [],
...minimalSchema,
minimum: 0.1,
maximum: 10,
exclusiveMinimum: false,
Expand All @@ -59,10 +58,7 @@ describe("SchemaRangeComponent", function () {

it("should have `( 0.1 .. 10 ]` as value", async () => {
await renderComponent({
title: "test",
name: "test",
anchorIdentifier: "test",
usedBy: [],
...minimalSchema,
minimum: 0.1,
maximum: 10,
exclusiveMinimum: true,
Expand All @@ -74,10 +70,7 @@ describe("SchemaRangeComponent", function () {

it("should have `[ 0.1 .. 10 ]` as value", async () => {
await renderComponent({
title: "test",
name: "test",
anchorIdentifier: "test",
usedBy: [],
...minimalSchema,
minimum: 0.1,
maximum: 10,
});
Expand All @@ -87,10 +80,7 @@ describe("SchemaRangeComponent", function () {

it("should have `> 0.1` as value", async () => {
await renderComponent({
title: "test",
name: "test",
anchorIdentifier: "test",
usedBy: [],
...minimalSchema,
minimum: 0.1,
exclusiveMinimum: true,
});
Expand All @@ -100,10 +90,7 @@ describe("SchemaRangeComponent", function () {

it("should have `< 10` as value", async () => {
await renderComponent({
title: "test",
name: "test",
anchorIdentifier: "test",
usedBy: [],
...minimalSchema,
maximum: 10,
exclusiveMaximum: true,
});
Expand All @@ -113,10 +100,7 @@ describe("SchemaRangeComponent", function () {

it("should have `>= 0.1` as value", async () => {
await renderComponent({
title: "test",
name: "test",
anchorIdentifier: "test",
usedBy: [],
...minimalSchema,
minimum: 0.1,
});

Expand All @@ -125,10 +109,7 @@ describe("SchemaRangeComponent", function () {

it("should have `<= 10` as value", async () => {
await renderComponent({
title: "test",
name: "test",
anchorIdentifier: "test",
usedBy: [],
...minimalSchema,
maximum: 10,
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,14 @@
<ng-container *ngIf="property.value.items">
<span
class="type"
*ngIf="property.value.items.type && !property.value.items.anchorUrl"
*ngIf="
property.value.items.type && !property.value.items.refAnchorUrl
"
>{{ property.value.items.type }}[]</span
>
<span class="type" *ngIf="property.value.items.anchorUrl">
<a [href]="property.value.items.anchorUrl"
>{{ property.value.items.refTitle }}[]</a
<span class="type" *ngIf="property.value.items.refAnchorUrl">
<a [href]="property.value.items.refAnchorUrl"
>{{ property.value.items.refName }}[]</a
>
</span>
</ng-container>
Expand Down
1 change: 1 addition & 0 deletions springwolf-ui/src/app/models/channel.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export interface ChannelOperation {
export interface Channel {
name: string;
anchorIdentifier: string;
anchorUrl: string;
description?: string;
operations: ChannelOperation[];
bindings: Bindings;
Expand Down
1 change: 0 additions & 1 deletion springwolf-ui/src/app/models/message.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ export interface Message {
contentType: string;
payload: {
name: string;
type: string;
title: string;
anchorUrl: string;
};
Expand Down
4 changes: 2 additions & 2 deletions springwolf-ui/src/app/models/schema.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ export interface Schema {
*/
title: string;
anchorIdentifier: string;
anchorUrl: string;
usedBy: { name: string; anchorUrl: string; type: "channel" | "schema" }[];
description?: string;
deprecated?: boolean;
Expand All @@ -21,9 +22,8 @@ export interface Schema {
type?: string;
format?: string;
// type == ref
anchorUrl?: string;
refAnchorUrl?: string;
refName?: string;
refTitle?: string;
// type == object
properties?: { [key: string]: Schema };
required?: string[];
Expand Down
Loading