Skip to content

Commit

Permalink
Fix changing unversioned definitions
Browse files Browse the repository at this point in the history
  • Loading branch information
lharzenetter committed Apr 25, 2018
1 parent e415d55 commit 58ce1dd
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 7 deletions.
Expand Up @@ -47,7 +47,7 @@
*/
public class VersionUtils {

public static final Pattern VERSION_PATTERN = Pattern.compile("_([^_]*)-w([0-9]+)(-wip([0-9]+))?$");
private static final Pattern VERSION_PATTERN = Pattern.compile("_([^_]*)-w([0-9]+)(-wip([0-9]+))?$");

private static String REFERENCING_OBJECT = "referencingObject";

Expand Down
Expand Up @@ -43,7 +43,8 @@ public WineryVersion(String componentVersion, int wineryVersion, int workInProgr
this.workInProgressVersion = Math.abs(workInProgressVersion);
this.latestVersion = false;
this.releasable = false;
this.editable = false;
// to support editing of not versioned definitions
this.editable = !this.isVersionedInWinery();;
}

public String getComponentVersion() {
Expand Down
Expand Up @@ -59,7 +59,7 @@ export class InstanceComponent implements OnDestroy {
.data
.subscribe(data => {
this.newVersionAvailable = false;
this.editable = false;
this.editable = !this.editable;

This comment has been minimized.

Copy link
@koppor

koppor Apr 26, 2018

Member

Please comment on why this flag is just negated? Initially, this.editable is true (line 48) and this variable seems not to be changed elsewhere. Just add a comment above this line.

This comment has been minimized.

Copy link
@lharzenetter

lharzenetter Apr 26, 2018

Author Member

I just restored your changes, I didn't check everything you changed. I'll set it to true

this.toscaComponent = data['resolveData'] ? data['resolveData'] : new ToscaComponent(ToscaTypes.Admin, '', '');

this.service.setSharedData(this.toscaComponent);
Expand Down
Expand Up @@ -31,6 +31,10 @@ import { HttpErrorResponse, HttpResponse } from '@angular/common/http';
import { ExistService } from '../wineryUtils/existService';
import { catchError, retry } from 'rxjs/operators';

export function getToolTip(): TooltipConfig {
return Object.assign(new TooltipConfig(), { placement: 'right' });
}

@Component({
selector: 'winery-add-component',
templateUrl: 'addComponent.component.html',
Expand All @@ -39,9 +43,7 @@ import { catchError, retry } from 'rxjs/operators';
InheritanceService,
{
provide: TooltipConfig,
useFactory: () => {
return Object.assign(new TooltipConfig(), { placement: 'right' });
}
useFactory: getToolTip
}
]
})
Expand Down
Expand Up @@ -155,7 +155,8 @@ public void getVersionWithEditableFlagFromComponentWithoutAVersion() throws Exce

List<WineryVersion> versions = BackendUtils.getAllVersionsOfOneDefinition(policyTemplateId);

Assert.assertFalse(versions.get(0).isEditable());
// For continence, we accept editing already existing components
Assert.assertTrue(versions.get(0).isEditable());
}

@Test
Expand Down

0 comments on commit 58ce1dd

Please sign in to comment.