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("custom7", "A custom property with name \"7\"");
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.templated", "");
@ -143,7 +142,6 @@ public class ClassificationControllerRestDocumentation {
fieldWithPath("custom6").description(classificationFieldDescriptionsMap.get("custom6")),
fieldWithPath("custom7").description(classificationFieldDescriptionsMap.get("custom7")),
fieldWithPath("custom8").description(classificationFieldDescriptionsMap.get("custom8")),
fieldWithPath("validInDomain").description(classificationFieldDescriptionsMap.get("validInDomain")),
fieldWithPath("_links.self.href").ignored()
};
@ -172,7 +170,6 @@ public class ClassificationControllerRestDocumentation {
fieldWithPath("custom6").ignored(),
fieldWithPath("custom7").ignored(),
fieldWithPath("custom8").ignored(),
fieldWithPath("validInDomain").ignored(),
fieldWithPath("_links.self.href").ignored()
};
@ -236,10 +233,7 @@ public class ClassificationControllerRestDocumentation {
.optional(),
fieldWithPath("custom8").type("String")
.description(classificationFieldDescriptionsMap.get("custom8"))
.optional(),
fieldWithPath("validInDomain").type("Boolean")
.description(classificationFieldDescriptionsMap.get("validInDomain"))
.optional(),
.optional()
};
}

View File

@ -93,7 +93,6 @@ public class CommonRestDocumentation {
fieldWithPath("custom6").ignored(),
fieldWithPath("custom7").ignored(),
fieldWithPath("custom8").ignored(),
fieldWithPath("validInDomain").ignored(),
fieldWithPath("_links").description(selfLinkFieldDescriptionsMap.get("_links")),
fieldWithPath("_links.self").description(selfLinkFieldDescriptionsMap.get("_links.self")),
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 custom8;
public void setIsValidInDomain(Boolean validInDomain) {
isValidInDomain = validInDomain;
public Boolean getIsValidInDomain() {
return isValidInDomain;
}
public void setIsValidInDomain(Boolean isValidInDomain) {
this.isValidInDomain = isValidInDomain;
}
public String getClassificationId() {
@ -91,10 +95,6 @@ public class ClassificationResource extends ResourceSupport {
this.domain = domain;
}
public boolean isValidInDomain() {
return isValidInDomain;
}
public String getCreated() {
return created;
}

View File

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

View File

@ -48,7 +48,16 @@
<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"
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 class="form-group required">
<label for="classification-category" class="control-label">Category</label>
<div class="dropdown clearfix btn-group">

View File

@ -251,7 +251,6 @@ export class ClassificationDetailsComponent implements OnInit, OnDestroy {
}
private removeClassificationConfirmation() {
if (!this.classification || !this.classification.classificationId) {
this.errorModalService.triggerError(
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 {
if (this.masterAndDetailSubscription) { this.masterAndDetailSubscription.unsubscribe(); }

View File

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