-
+
@@ -48,7 +48,8 @@
{{ step2InstructionMessage }}
diff --git a/ngapp/src/app/connections/add-connection-wizard/add-connection-wizard.component.ts b/ngapp/src/app/connections/add-connection-wizard/add-connection-wizard.component.ts
index b465492c..f9ee9d02 100644
--- a/ngapp/src/app/connections/add-connection-wizard/add-connection-wizard.component.ts
+++ b/ngapp/src/app/connections/add-connection-wizard/add-connection-wizard.component.ts
@@ -53,6 +53,7 @@ export class AddConnectionWizardComponent implements OnInit {
public createComplete = true;
public createSuccessful = false;
public detailPropertiesLoaded = false;
+ public detailPropertiesLoadedType = "";
public requiredPropValues: Array<[string, string]> = [];
public templatesLoaded = false;
@@ -106,7 +107,7 @@ export class AddConnectionWizardComponent implements OnInit {
// Step 3 - Review and Create
this.step3Config = {
id: "step3",
- priority: 2,
+ priority: 0,
title: "Review and Create",
allowClickNav: false
} as WizardStepConfig;
@@ -129,6 +130,7 @@ export class AddConnectionWizardComponent implements OnInit {
loadingTitle: "Add Connection Wizard loading",
loadingSecondaryInfo: "Please wait for the wizard to finish loading...",
title: "Add Connection",
+ contentHeight: "500px"
} as WizardConfig;
// Load the templates for the first step
@@ -151,7 +153,6 @@ export class AddConnectionWizardComponent implements OnInit {
// ----------------
// Public Methods
// ----------------
-
/*
* Return the name valid state
*/
@@ -230,7 +231,10 @@ export class AddConnectionWizardComponent implements OnInit {
public nextClicked($event: WizardEvent): void {
// When leaving page 1, load the driver-specific property definitions
if ($event.step.config.id === "step1") {
- this.loadPropertyDefinitions(this.basicPropertyForm.controls["driver"].value);
+ const selectedDriver = this.basicPropertyForm.controls["driver"].value;
+ if(!this.detailPropertiesLoaded || (this.detailPropertiesLoadedType!==selectedDriver)) {
+ this.loadPropertyDefinitions(selectedDriver);
+ }
}
}
@@ -299,9 +303,20 @@ export class AddConnectionWizardComponent implements OnInit {
}
}
- public updatePage1ValidStatus( ): void {
- this.step1Config.nextEnabled = this.basicPropertyForm.valid;
- this.setNavAway(this.step1Config.nextEnabled);
+ /**
+ * Handler for property form initialization
+ * @param {boolean} isValid form valid state
+ */
+ public onDetailPropertyInit(isValid: boolean): void {
+ this.updatePage2ValidStatus(isValid);
+ }
+
+ /**
+ * Handler for property form changes
+ * @param {boolean} isValid form valid state
+ */
+ public onDetailPropertyChanged(isValid: boolean): void {
+ this.updatePage2ValidStatus(isValid);
}
/**
@@ -345,13 +360,7 @@ export class AddConnectionWizardComponent implements OnInit {
jndi: new FormControl("", Validators.required),
driver: new FormControl("", Validators.required)
});
- this.onChanges();
- }
-
- /*
- * React to basic property changes - update the page 1 status
- */
- private onChanges(): void {
+ // Responds to basic property changes - updates the page status
this.basicPropertyForm.valueChanges.subscribe((val) => {
this.updatePage1ValidStatus( );
});
@@ -361,6 +370,16 @@ export class AddConnectionWizardComponent implements OnInit {
this.step1Config.allowNavAway = allow;
}
+ private updatePage1ValidStatus( ): void {
+ this.step1Config.nextEnabled = this.basicPropertyForm.valid;
+ this.setNavAway(this.step1Config.nextEnabled);
+ }
+
+ private updatePage2ValidStatus(formValid: boolean): void {
+ this.step2Config.nextEnabled = formValid;
+ this.setNavAway(this.step2Config.nextEnabled);
+ }
+
/**
* Load the driver-specific property definitions
*/
@@ -371,8 +390,22 @@ export class AddConnectionWizardComponent implements OnInit {
.getConnectionTemplateProperties(driverName)
.subscribe(
(props) => {
- that.detailProperties = props;
+ // Sort the properties. (Required properties first)
+ const firstProps: any[] = [];
+ const nextProps: any[] = [];
+ let sortedProps: any[] = [];
+ for (const prop of props) {
+ if (prop.isRequired()) {
+ firstProps.push(prop);
+ } else {
+ nextProps.push(prop);
+ }
+ }
+ sortedProps = firstProps.concat(nextProps);
+
+ that.detailProperties = sortedProps;
this.detailPropertiesLoaded = true;
+ this.detailPropertiesLoadedType = driverName;
},
(error) => {
this.logger.error("[AddConnectionWizardComponent] Error: %o", error);
diff --git a/ngapp/src/app/connections/connections.component.spec.ts b/ngapp/src/app/connections/connections.component.spec.ts
index 4175c1f9..757dfb21 100644
--- a/ngapp/src/app/connections/connections.component.spec.ts
+++ b/ngapp/src/app/connections/connections.component.spec.ts
@@ -75,41 +75,41 @@ describe("ConnectionsComponent", () => {
expect(debugEl).toBeNull();
});
- // it("should toggle layout", () => {
- // // Initial layout should be Card Layout
- // let cardDebugElem = fixture.debugElement.query(By.css("app-connections-cards"));
- // let listDebugElem = fixture.debugElement.query(By.css("app-connections-list"));
- // expect(cardDebugElem).toBeDefined();
- // expect(listDebugElem).toBeNull();
- // const cardElem = cardDebugElem.nativeElement;
- // expect(cardElem).toBeDefined();
- //
- // // Change the layout to ListLayout
- // component.setListLayout();
- // fixture.detectChanges();
- //
- // // Verify that the layout has changed
- // cardDebugElem = fixture.debugElement.query(By.css("app-connections-cards"));
- // listDebugElem = fixture.debugElement.query(By.css("app-connections-list"));
- // expect(cardDebugElem).toBeNull();
- // expect(listDebugElem).toBeDefined();
- // const listElem = listDebugElem.nativeElement;
- // expect(listElem).toBeDefined();
- // });
-
- // it("should filter connections", () => {
- // // Expect 3 connections initially.
- // let connections = component.filteredConnections;
- // expect(connections.length).toEqual(3);
- //
- // // Set a name filter which satisfies none of the connections
- // component.nameFilter = "g";
- // component.filterConnections();
- // fixture.detectChanges();
- //
- // // Now expect 0 activities match
- // connections = component.filteredConnections;
- // expect(connections.length).toEqual(0);
- // });
+ it("should toggle layout", () => {
+ // Initial layout should be Card Layout
+ let cardDebugElem = fixture.debugElement.query(By.css("app-connections-cards"));
+ let listDebugElem = fixture.debugElement.query(By.css("app-connections-list"));
+ expect(cardDebugElem).toBeDefined();
+ expect(listDebugElem).toBeNull();
+ const cardElem = cardDebugElem.nativeElement;
+ expect(cardElem).toBeDefined();
+
+ // Change the layout to ListLayout
+ component.setListLayout();
+ fixture.detectChanges();
+
+ // Verify that the layout has changed
+ cardDebugElem = fixture.debugElement.query(By.css("app-connections-cards"));
+ listDebugElem = fixture.debugElement.query(By.css("app-connections-list"));
+ expect(cardDebugElem).toBeNull();
+ expect(listDebugElem).toBeDefined();
+ const listElem = listDebugElem.nativeElement;
+ expect(listElem).toBeDefined();
+ });
+
+ it("should filter connections", () => {
+ // Expect 3 connections initially.
+ let connections = component.filteredConnections;
+ expect(connections.length).toEqual(3);
+
+ // Set a name filter which satisfies none of the connections
+ component.nameFilter = "g";
+ component.filterConnections();
+ fixture.detectChanges();
+
+ // Now expect 0 activities match
+ connections = component.filteredConnections;
+ expect(connections.length).toEqual(0);
+ });
});
diff --git a/ngapp/src/app/connections/shared/mock-connection.service.ts b/ngapp/src/app/connections/shared/mock-connection.service.ts
index 78c64994..e4354b84 100644
--- a/ngapp/src/app/connections/shared/mock-connection.service.ts
+++ b/ngapp/src/app/connections/shared/mock-connection.service.ts
@@ -26,6 +26,9 @@ export class MockConnectionService extends ConnectionService {
constructor( http: Http, logger: LoggerService ) {
super(http, logger);
+ this.conn1.setId("conn1");
+ this.conn2.setId("conn2");
+ this.conn3.setId("conn3");
}
/**
diff --git a/ngapp/src/app/shared/property-form/property-form-property/property-form-property.component.html b/ngapp/src/app/shared/property-form/property-form-property/property-form-property.component.html
index 6bf149fb..cecad09e 100644
--- a/ngapp/src/app/shared/property-form/property-form-property/property-form-property.component.html
+++ b/ngapp/src/app/shared/property-form/property-form-property/property-form-property.component.html
@@ -1,16 +1,16 @@
-
+
+ [id]="property.getId()" type="text" title="A text value" [(ngModel)]="property.theDefaultValue">
+ [id]="property.getId()" type="password" title="A text value" [(ngModel)]="property.theDefaultValue">
+ [id]="property.getId()" type="checkbox" title="A boolean value" [(ngModel)]="property.theDefaultValue">