-
Notifications
You must be signed in to change notification settings - Fork 502
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch '0.2.x' into fix/message-headers-ref-not-saved-on-asyncapi
- Loading branch information
Showing
19 changed files
with
395 additions
and
72 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
...end/studio/src/app/pages/apis/{apiId}/editor/_components/dialogs/aaiadd-tag.component.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#addTagModal .modal-dialog .modal-body form textarea { | ||
min-height: 60px; | ||
} | ||
|
||
#addtag-form .apriori-items { | ||
margin-top: 4px; | ||
} | ||
|
||
#addtag-form .apriori-items .apriori-item { | ||
background-color: #9c9c9c; | ||
color: white; | ||
cursor: pointer; | ||
margin-right: 5px; | ||
padding: 3px 6px; | ||
margin-bottom: 3px; | ||
display: inline-block; | ||
} | ||
|
||
#addtag-form .apriori-items .apriori-item.selected { | ||
background-color: #39a5dc; | ||
} | ||
|
||
#addtag-form .apriori-items .apriori-item:hover { | ||
filter: brightness(90%); | ||
} | ||
|
||
#addtag-form .apriori-items .apriori-item > .fa { | ||
margin-right: 3px; | ||
} |
47 changes: 47 additions & 0 deletions
47
...nd/studio/src/app/pages/apis/{apiId}/editor/_components/dialogs/aaiadd-tag.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
<!-- Add Tag Dialog --> | ||
<div bsModal #addTagModal="bs-modal" class="modal fade" id="addTagModal" tabindex="-1" role="dialog" aria-labelledby="addTagModalLabel" | ||
role="dialog" aria-hidden="true" (onShown)="doSelect()" [config]="{ backdrop: true }" | ||
(onHidden)="close()" *ngIf="isOpen()"> | ||
<div class="modal-dialog"> | ||
<div class="modal-content"> | ||
<div class="modal-header"> | ||
<button type="button" class="close" aria-hidden="true" (click)="cancel()"> | ||
<span class="pficon pficon-close"></span> | ||
</button> | ||
<h4 class="modal-title" id="addTagModalLabel">Add Tag</h4> | ||
</div> | ||
<div class="modal-body"> | ||
<p>Enter information about the new tag below and then click <strong>Add</strong>.</p> | ||
<form id="addtag-form" class="form-horizontal" (submit)="add()" #addTagForm="ngForm" data-dismiss="modal"> | ||
<div class="form-group"> | ||
<label class="col-sm-2 control-label required" for="tag">Tag</label> | ||
<div class="col-sm-10"> | ||
<input #addTagInput name="tag" type="text" id="tag" class="form-control" placeholder="Tag Name" | ||
required [(ngModel)]="tag" (ngModelChange)="tagExists = tags.indexOf($event) != -1" #name="ngModel"> | ||
<div class="apriori-items" *ngIf="hasItems()"> | ||
<span class="apriori-item" *ngFor="let item of getItems()" (click)="toggleItem(item)" [class.selected]="hasItem(item)"> | ||
<span class="fa fa-square-o" *ngIf="!hasItem(item)"></span> | ||
<span class="fa fa-check-square-o" *ngIf="hasItem(item)"></span> | ||
<span>{{ item }}</span> | ||
</span> | ||
</div> | ||
</div> | ||
|
||
</div> | ||
<div class="form-group"> | ||
<label class="col-sm-2 control-label" for="description">Description</label> | ||
<div class="col-sm-10"> | ||
<textarea name="description" id="description" class="form-control" autosize | ||
placeholder="Tag description" [(ngModel)]="description"></textarea> | ||
</div> | ||
</div> | ||
</form> | ||
</div> | ||
<div class="notice-of-required modal-notice-of-required">The fields marked with <span class="required-icon">*</span> are required.</div> | ||
<div class="modal-footer"> | ||
<button type="button" class="btn btn-primary" (click)="add()" [disabled]="!addTagForm.form.valid || tagExists">Add</button> | ||
<button type="button" class="btn btn-default" (click)="cancel()">Cancel</button> | ||
</div> | ||
</div> | ||
</div> | ||
</div> |
140 changes: 140 additions & 0 deletions
140
...-end/studio/src/app/pages/apis/{apiId}/editor/_components/dialogs/aaiadd-tag.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,140 @@ | ||
/** | ||
* @license | ||
* Copyright 2017 JBoss Inc | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
import {Component, ElementRef, EventEmitter, Output, QueryList, ViewChildren} from "@angular/core"; | ||
import {ModalDirective} from "ngx-bootstrap/modal"; | ||
import {AaiMessageBase, AaiOperation, AaiOperationBase, Node, OasDocument} from "@apicurio/data-models"; | ||
|
||
|
||
@Component({ | ||
selector: "aaiadd-tag-dialog", | ||
templateUrl: "aaiadd-tag.component.html", | ||
styleUrls: ["aaiadd-tag.component.css"] | ||
}) | ||
export class AaiAddTagDialogComponent { | ||
|
||
@Output() onAdd: EventEmitter<any> = new EventEmitter<any>(); | ||
|
||
@ViewChildren("addTagModal") addTagModal: QueryList<ModalDirective>; | ||
@ViewChildren("addTagInput") addTagInput: QueryList<ElementRef>; | ||
|
||
private _isOpen: boolean = false; | ||
private _node: Node; | ||
|
||
tag: string = ""; | ||
description: string = ""; | ||
|
||
tags: string[] = []; | ||
tagExists: boolean = false; | ||
|
||
/** | ||
* Called to open the dialog. | ||
*/ | ||
public open(node: AaiOperationBase | AaiMessageBase, tag?: string): void { | ||
this._node = node; | ||
this.tag = tag; | ||
if (!tag) { | ||
this.tag = ""; | ||
} | ||
this._isOpen = true; | ||
this.addTagModal.changes.subscribe( () => { | ||
if (this.addTagModal.first) { | ||
this.addTagModal.first.show(); | ||
} | ||
}); | ||
|
||
this.tags = []; | ||
this.tagExists = false; | ||
|
||
|
||
if (node.tags) { | ||
node.tags.forEach(tag => { | ||
this.tags.push(tag.name); | ||
}); | ||
} | ||
} | ||
|
||
/** | ||
* Called to close the dialog. | ||
*/ | ||
close(): void { | ||
this._isOpen = false; | ||
this.tag = ""; | ||
this.description = ""; | ||
} | ||
|
||
/** | ||
* Called when the user clicks "add". | ||
*/ | ||
add(): void { | ||
let tagInfo: any = { | ||
name: this.tag, | ||
description: this.description | ||
}; | ||
this.onAdd.emit(tagInfo); | ||
this.cancel(); | ||
} | ||
|
||
/** | ||
* Called when the user clicks "cancel". | ||
*/ | ||
cancel(): void { | ||
this.addTagModal.first.hide(); | ||
} | ||
|
||
/** | ||
* Returns true if the dialog is open. | ||
* @return | ||
*/ | ||
isOpen(): boolean { | ||
return this._isOpen; | ||
} | ||
|
||
/** | ||
* Called to initialize the selection/focus to the addTagInput field. | ||
*/ | ||
doSelect(): void { | ||
this.addTagInput.first.nativeElement.focus(); | ||
} | ||
|
||
public getItems(): string[] { | ||
if (this._node.ownerDocument().tags && this._node.ownerDocument().tags.length > 0) { | ||
let items: string[] = this._node.ownerDocument().tags.map(tagDef => tagDef.name).filter(tagName => !this.tags.includes(tagName)); | ||
items.sort(); | ||
return items; | ||
} else { | ||
return []; | ||
} | ||
} | ||
|
||
public hasItems(): boolean { | ||
return this.getItems().length > 0; | ||
} | ||
|
||
public hasItem(item: string): boolean { | ||
return this.tag && this.tag === item; | ||
} | ||
|
||
public toggleItem(item: string) { | ||
if (this.hasItem(item)) { | ||
this.tag = null; | ||
} else { | ||
this.tag = item; | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
...es/apis/{apiId}/editor/_components/forms/channel/operation/aaitags-section.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<section type="tags" label="TAG DEFINITIONS" [counterItems]="tags()" | ||
contextHelp="Configure tags for your API in this section. Once defined, tags can be used to organize your API's operations by arbitrary criteria." | ||
collaborationNodePath="/tags" | ||
[validationModels]="tags()"> | ||
<span actions> | ||
<icon-button (onClick)="addTagDialog.open(node)" [pullRight]="true" type="add" | ||
title="Add a tag to the API."></icon-button> | ||
<icon-button (onClick)="deleteAllTags()" [disabled]="!hasTags()" | ||
[pullRight]="true" type="delete" | ||
title="Delete all tag definitions."></icon-button> | ||
</span> | ||
<div body> | ||
<signpost *ngIf="tags().length === 0"> | ||
<span>No tags have been configured.</span> | ||
<a (click)="addTagDialog.open(node)">Add a tag</a> | ||
</signpost> | ||
|
||
<!-- The list of tags --> | ||
<div class="tags" *ngIf="tags().length > 0"> | ||
<tag-row *ngFor="let tag of tags()" [item]="tag" | ||
(onDelete)="deleteTag(tag)" [enableRename]="false"></tag-row> | ||
</div> | ||
</div> | ||
</section> | ||
<aaiadd-tag-dialog #addTagDialog (onAdd)="addTag($event)"></aaiadd-tag-dialog> | ||
|
Oops, something went wrong.