TSK-592 make isValidInDomain work

24: Auto stash before rebase of "miguel/master"
This commit is contained in:
Lars Leo Grätz 2018-07-16 14:21:03 +02:00 committed by Martin Rojas Miguel Angel
parent 97fd656eda
commit 55cd5916c9
7 changed files with 32 additions and 21 deletions

View File

@ -105,7 +105,6 @@ public class ClassificationControllerRestDocumentation {
classificationFieldDescriptionsMap.put("custom6", "A custom property with name \"6\""); classificationFieldDescriptionsMap.put("custom6", "A custom property with name \"6\"");
classificationFieldDescriptionsMap.put("custom7", "A custom property with name \"7\""); classificationFieldDescriptionsMap.put("custom7", "A custom property with name \"7\"");
classificationFieldDescriptionsMap.put("custom8", "A custom property with name \"8\""); classificationFieldDescriptionsMap.put("custom8", "A custom property with name \"8\"");
classificationFieldDescriptionsMap.put("validInDomain", "");
classificationFieldDescriptionsMap.put("_links.getAllClassifications.href", "Link to all classifications"); classificationFieldDescriptionsMap.put("_links.getAllClassifications.href", "Link to all classifications");
classificationFieldDescriptionsMap.put("_links.getAllClassifications.templated", ""); classificationFieldDescriptionsMap.put("_links.getAllClassifications.templated", "");
@ -143,7 +142,6 @@ public class ClassificationControllerRestDocumentation {
fieldWithPath("custom6").description(classificationFieldDescriptionsMap.get("custom6")), fieldWithPath("custom6").description(classificationFieldDescriptionsMap.get("custom6")),
fieldWithPath("custom7").description(classificationFieldDescriptionsMap.get("custom7")), fieldWithPath("custom7").description(classificationFieldDescriptionsMap.get("custom7")),
fieldWithPath("custom8").description(classificationFieldDescriptionsMap.get("custom8")), fieldWithPath("custom8").description(classificationFieldDescriptionsMap.get("custom8")),
fieldWithPath("validInDomain").description(classificationFieldDescriptionsMap.get("validInDomain")),
fieldWithPath("_links.self.href").ignored() fieldWithPath("_links.self.href").ignored()
}; };
@ -172,7 +170,6 @@ public class ClassificationControllerRestDocumentation {
fieldWithPath("custom6").ignored(), fieldWithPath("custom6").ignored(),
fieldWithPath("custom7").ignored(), fieldWithPath("custom7").ignored(),
fieldWithPath("custom8").ignored(), fieldWithPath("custom8").ignored(),
fieldWithPath("validInDomain").ignored(),
fieldWithPath("_links.self.href").ignored() fieldWithPath("_links.self.href").ignored()
}; };
@ -236,10 +233,7 @@ public class ClassificationControllerRestDocumentation {
.optional(), .optional(),
fieldWithPath("custom8").type("String") fieldWithPath("custom8").type("String")
.description(classificationFieldDescriptionsMap.get("custom8")) .description(classificationFieldDescriptionsMap.get("custom8"))
.optional(), .optional()
fieldWithPath("validInDomain").type("Boolean")
.description(classificationFieldDescriptionsMap.get("validInDomain"))
.optional(),
}; };
} }

View File

@ -93,7 +93,6 @@ public class CommonRestDocumentation {
fieldWithPath("custom6").ignored(), fieldWithPath("custom6").ignored(),
fieldWithPath("custom7").ignored(), fieldWithPath("custom7").ignored(),
fieldWithPath("custom8").ignored(), fieldWithPath("custom8").ignored(),
fieldWithPath("validInDomain").ignored(),
fieldWithPath("_links").description(selfLinkFieldDescriptionsMap.get("_links")), fieldWithPath("_links").description(selfLinkFieldDescriptionsMap.get("_links")),
fieldWithPath("_links.self").description(selfLinkFieldDescriptionsMap.get("_links.self")), fieldWithPath("_links.self").description(selfLinkFieldDescriptionsMap.get("_links.self")),
fieldWithPath("_links.self.href").description(selfLinkFieldDescriptionsMap.get("_links.self.href")) fieldWithPath("_links.self.href").description(selfLinkFieldDescriptionsMap.get("_links.self.href"))

View File

@ -31,8 +31,12 @@ public class ClassificationResource extends ResourceSupport {
public String custom7; public String custom7;
public String custom8; public String custom8;
public void setIsValidInDomain(Boolean validInDomain) { public Boolean getIsValidInDomain() {
isValidInDomain = validInDomain; return isValidInDomain;
}
public void setIsValidInDomain(Boolean isValidInDomain) {
this.isValidInDomain = isValidInDomain;
} }
public String getClassificationId() { public String getClassificationId() {
@ -91,10 +95,6 @@ public class ClassificationResource extends ResourceSupport {
this.domain = domain; this.domain = domain;
} }
public boolean isValidInDomain() {
return isValidInDomain;
}
public String getCreated() { public String getCreated() {
return created; return created;
} }

View File

@ -45,7 +45,7 @@ public class ClassificationAssemblerTest {
classification.setId("1"); classification.setId("1");
classification.setCategory("ABC"); classification.setCategory("ABC");
classification.setName("Classification 1"); classification.setName("Classification 1");
classification.setIsValidInDomain(false); classification.setIsValidInDomain(true);
classification.setCustom1("Custom1"); classification.setCustom1("Custom1");
classification.setCustom2("Custom2"); classification.setCustom2("Custom2");
classification.setCustom3("Custom3"); classification.setCustom3("Custom3");
@ -94,6 +94,7 @@ public class ClassificationAssemblerTest {
classificationResource.setApplicationEntryPoint("12"); classificationResource.setApplicationEntryPoint("12");
classificationResource.setServiceLevel("P1D"); classificationResource.setServiceLevel("P1D");
classificationResource.setDescription("Test"); classificationResource.setDescription("Test");
classificationResource.setIsValidInDomain(true);
// when // when
ClassificationImpl classification = (ClassificationImpl) classificationResourceAssembler ClassificationImpl classification = (ClassificationImpl) classificationResourceAssembler
.toModel(classificationResource); .toModel(classificationResource);

View File

@ -48,7 +48,16 @@
<label for="classification-domain" class="control-label">Domain</label> <label for="classification-domain" class="control-label">Domain</label>
<input type="text" disabled #domain="ngModel" class="form-control" id="classification-domain" placeholder="Domain" [(ngModel)]="classification.domain" <input type="text" disabled #domain="ngModel" class="form-control" id="classification-domain" placeholder="Domain" [(ngModel)]="classification.domain"
name="classification.domain"> name="classification.domain">
<a *ngIf="!masterDomainSelected()" (click)="validChanged()">
<label>
<b>Valid in Domain:</b>
<span class="glyphicon {{classification.isValidInDomain ? 'glyphicon-check': 'glyphicon-unchecked'}} blue"
aria-hidden="true"></span>
</label>
</a>
</div> </div>
<div class="form-group required"> <div class="form-group required">
<label for="classification-category" class="control-label">Category</label> <label for="classification-category" class="control-label">Category</label>
<div class="dropdown clearfix btn-group"> <div class="dropdown clearfix btn-group">

View File

@ -251,7 +251,6 @@ export class ClassificationDetailsComponent implements OnInit, OnDestroy {
} }
private removeClassificationConfirmation() { private removeClassificationConfirmation() {
if (!this.classification || !this.classification.classificationId) { if (!this.classification || !this.classification.classificationId) {
this.errorModalService.triggerError( this.errorModalService.triggerError(
new ErrorModel('There is no classification selected', 'Please check if you are creating a classification')); new ErrorModel('There is no classification selected', 'Please check if you are creating a classification'));
@ -275,6 +274,14 @@ export class ClassificationDetailsComponent implements OnInit, OnDestroy {
}) })
} }
validChanged(): void {
this.classification.isValidInDomain = !this.classification.isValidInDomain;
}
masterDomainSelected(): boolean {
return this.domainService.getSelectedDomainValue() === '';
}
ngOnDestroy(): void { ngOnDestroy(): void {
if (this.masterAndDetailSubscription) { this.masterAndDetailSubscription.unsubscribe(); } if (this.masterAndDetailSubscription) { this.masterAndDetailSubscription.unsubscribe(); }

View File

@ -18,6 +18,7 @@ import { Direction } from 'app/models/sorting';
@Injectable() @Injectable()
export class ClassificationsService { export class ClassificationsService {
private url = `${environment.taskanaRestUrl}/v1/classifications/`;
private classificationSelected = new Subject<ClassificationDefinition>(); private classificationSelected = new Subject<ClassificationDefinition>();
private classificationSaved = new Subject<number>(); private classificationSaved = new Subject<number>();
@ -42,7 +43,7 @@ export class ClassificationsService {
allPages: boolean = true): Observable<Array<Classification>> { allPages: boolean = true): Observable<Array<Classification>> {
return this.domainService.getSelectedDomain().mergeMap(domain => { return this.domainService.getSelectedDomain().mergeMap(domain => {
return this.getClassificationObservable(this.httpClient.get<ClassificationResource>( return this.getClassificationObservable(this.httpClient.get<ClassificationResource>(
`${environment.taskanaRestUrl}/v1/classifications/${TaskanaQueryParameters.getQueryParameters( `${this.url}${TaskanaQueryParameters.getQueryParameters(
sortBy, order, name, sortBy, order, name,
nameLike, descLike, owner, ownerLike, type, key, keyLike, requiredPermission, nameLike, descLike, owner, ownerLike, type, key, keyLike, requiredPermission,
!allPages ? TaskanaQueryParameters.page : undefined, !allPages ? TaskanaQueryParameters.pageSize : undefined, domain)}`)); !allPages ? TaskanaQueryParameters.page : undefined, !allPages ? TaskanaQueryParameters.pageSize : undefined, domain)}`));
@ -55,7 +56,7 @@ export class ClassificationsService {
// GET // GET
getClassification(id: string): Observable<ClassificationDefinition> { getClassification(id: string): Observable<ClassificationDefinition> {
return this.httpClient.get<ClassificationDefinition>(`${environment.taskanaRestUrl}/v1/classifications/${id}`) return this.httpClient.get<ClassificationDefinition>(`${this.url}${id}`)
.do((classification: ClassificationDefinition) => { .do((classification: ClassificationDefinition) => {
if (classification) { if (classification) {
this.classificationTypeService.selectClassificationType(classification.type); this.classificationTypeService.selectClassificationType(classification.type);
@ -66,7 +67,7 @@ export class ClassificationsService {
// POST // POST
postClassification(classification: Classification): Observable<Classification> { postClassification(classification: Classification): Observable<Classification> {
return this.httpClient.post<Classification>(`${environment.taskanaRestUrl}/v1/classifications`, classification); return this.httpClient.post<Classification>(`${this.url}`, classification);
} }
// PUT // PUT
@ -114,8 +115,8 @@ export class ClassificationsService {
} }
private buildHierarchy(classifications: Array<Classification>, type: string) { private buildHierarchy(classifications: Array<Classification>, type: string) {
const roots = [] const roots = [];
const children = new Array<any>(); const children = [];
for (let index = 0, len = classifications.length; index < len; ++index) { for (let index = 0, len = classifications.length; index < len; ++index) {
const item = classifications[index]; const item = classifications[index];