Skip to content
This repository has been archived by the owner on Nov 22, 2019. It is now read-only.

Commit

Permalink
Changes to selected table card of the data service wizard
Browse files Browse the repository at this point in the history
- selected table cards are now in a scrollable div
- selected table card can now be expanded to allow column selection
- just using dummy column data currently until design is approved
  • Loading branch information
elvisisking committed Jan 11, 2018
1 parent f8fda6c commit 43639e7
Show file tree
Hide file tree
Showing 9 changed files with 309 additions and 38 deletions.
Expand Up @@ -20,3 +20,10 @@
.alert-padding {
padding-top: 10px;
}

.selected-tables-container {
background-color: #bbbbbb;
max-height: 480px;
margin-top: 0px;
overflow-y: auto;
}
Expand Up @@ -81,8 +81,8 @@
<strong>No tables selected</strong>
</div>
</div>
<div class = "col-sm-3" *ngIf="hasSelectedTables">
<div *ngFor="let table of getSelectedTables()">
<div class = "container-fluid container-cards-pf col-sm-3 selected-tables-container" *ngIf="hasSelectedTables">
<div class="row row-cards-pf" *ngFor="let table of getSelectedTables()">
<app-selected-table [table]="table" (selectionListTableRemoved)="onTableSelectionRemoved($event)"></app-selected-table>
</div>
</div>
Expand Down
Expand Up @@ -78,27 +78,27 @@
[columnMode]="'force'"
[reorderable]="false"
[selectionType]="'checkbox'"
(select)="tableSelectionChanged($event)"
[sorts]="[{prop: 'name', dir: 'asc'}]"
[cssClasses]="customClasses">
<ngx-datatable-column name="Tables"
[prop]="'name'"
[sortable]="true"
[comparator]="nameComparator"
[checkboxable]="true"
[headerCheckboxable]="true"
[canAutoResize]="true"
[width]="300"
[draggable]="false"
[resizeable]="false">
<ng-template ngx-datatable-header-template let-value="value" let-allRowsSelected="selectedAllRows" let-selectFn="selectAllTables">
Tables
<input type="checkbox" [checked]="selectedAllRows" (change)="selectAllTables()"/>Tables
<input type="text"
class="col-sm-12"
style="border:solid 1px #dddddd;padding:8px;margin:0 auto;width:100%;height:24px"
placeholder="Filter tables"
(keyup)="tableFilterChanged($event)"/>
</ng-template>
<ng-template ngx-datatable-cell-template let-row="row" let-isSelected="row.selected" let-onCheckboxChangeFn="selectedTableChanged">
<input type="checkbox" [checked]="row.selected" (change)="selectedTableChanged( row )"/>{{ row.name }}
</ng-template>
</ngx-datatable-column>
</ngx-datatable>
</div>
Expand Up @@ -343,23 +343,48 @@ export class JdbcTableSelectorComponent implements OnInit, TableSelector {
return this.tables.filter( ( table ) => table.selected );
}

public tableSelectionChanged( event: any ): void {
const selectedTables = event.selected;
const self = this;
public selectAllTables(): void {
this.selectedAllRows = !this.selectedAllRows;
const self = this;

// sync up the UI row selections with the actual table selections
this.filteredTables.forEach( ( table ) => {
if ( ( !table.selected && this.isSelected( selectedTables, table ) )
|| ( table.selected && !this.isSelected( selectedTables, table )) ) {
table.selected = !table.selected;
if ( table.selected !== self.selectedAllRows ) {
self.selectedTableChanged( table );
}
} );
}

if ( table.selected ) {
this.tableSelectionAdded.emit(table);
} else {
this.tableSelectionRemoved.emit(table);
/*
* Handler for changes in table selection
*/
public selectedTableChanged( table: Table ): void {
table.selected = !table.selected;

if ( table.selected ) {
this.tableSelectionAdded.emit(table);

// check column header checkbox if all are selected
if ( !this.selectedAllRows ) {
let selectAll = true;

for ( const tbl of this.filteredTables ) {
if ( !tbl.selected ) {
selectAll = false;
}
}

if ( selectAll ) {
this.selectedAllRows = true;
}
}
} );
} else {
this.tableSelectionRemoved.emit(table);

// uncheck column header checkbox if needed
if ( this.selectedAllRows ) {
this.selectedAllRows = false;
}
}
}

/**
Expand All @@ -369,6 +394,7 @@ export class JdbcTableSelectorComponent implements OnInit, TableSelector {
public deselectTable(table: Table): void {
const connName = table.getConnection().getId();
const tableName = table.getName();

for (const theTable of this.tables) {
const theConnName = theTable.getConnection().getId();
const theTableName = theTable.getName();
Expand Down
35 changes: 35 additions & 0 deletions ngapp/src/app/dataservices/selected-table/column.ts
@@ -0,0 +1,35 @@
/**
* @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.
*/

export class Column {

public selected = true;
public name: string;
public type: string;
public size: number;

public constructor( name: string,
selected: boolean,
type: string,
size: number ) {
this.name = name;
this.type = type;
this.selected = selected;
this.size = size;
}

}
@@ -1,24 +1,70 @@
.selected-table-card {
.selected-table-card .card-pf {
background-color: #def3ff;
border:2px dotted darkblue;
margin-top: 5px;
margin-left: 0;
min-height: 60px;
max-height: 80px;
padding-top: 5px;
padding-right: 5px;
margin: 0 0px 10px;
min-height: 40px;
}

.selected-table-name {
margin-left: 20px;
.selected-table-name:before {
display: inline-block;
margin-bottom: 0px;
margin-right: 10px;
margin-top: 0px;
font-family: "FontAwesome";
content: "\f0ce";
}

.selected-table-name .card-pf-title {
margin-bottom: 0px;
margin-left: 5px;
margin-top: 0px;
font-size: 14px;
font-weight: bold;
}

.selected-table-connection {
.selected-table-connection:before {
display: inline-block;
margin-bottom: 0px;
margin-left: 20px;
margin-right: 10px;
margin-top: 0px;
font-family: "FontAwesome";
content: "\f1e6";
color: #666666;
}

.selected-table-connection .card-pf-subtitle {
color: #666666;
margin-bottom: 0px;
margin-left: 5px;
margin-top: 0px;
font-size: 14px;
}

.selected-table-close-icon {
cursor: pointer;
color: darkred;
}

.selected-table-body .card-pf-body {
background-color: white;
margin-top: 10px !important;
}

.selected-table-column-selection {
margin-left: 5px;
padding-top: 5px;
font-weight: bold;
}

.seleted-table-card .pfng-card .card-pf-heading {
background-color: #def3ff;
margin-bottom: -10px !important;
}


.selected-table-card .pfng-card .card-pf-footer {
margin: 0 !important;
padding: 10px 0px 5px 20px;
min-height: 20px;
}

@@ -1,6 +1,84 @@
<div class="col-sm-12 selected-table-card">
<span class="fa fa-plug"></span><span class="selected-table-connection">{{ table.getConnection().getId() }}</span>
<span class="fa fa-close pull-right selected-table-close-icon" (click)="onRemove()"></span>
<br>
<span class="selected-table-name">{{ table.getName() }}</span>
</div>
<pfng-card class="selected-table-card"
[config]="config"
[headerTemplate]="tableHeaderTemplate"
(onActionSelect)="handleActionSelect($event)">
<ng-template #tableHeaderTemplate>
<h3 class="selected-table-name">
<span class="fa fa-close pull-right selected-table-close-icon" (click)="onRemove()"></span>
{{ table.getName() }}
</h3>
<h5 class="selected-table-connection">{{ table.getConnection().getId() }}</h5>
</ng-template>
<div class="selected-table-body">
<div *ngIf="showColumns">
<h5 class="selected-table-column-selection">Select columns to include in the view:</h5>
<ngx-datatable style="max-height: 200px;"
[rows]="columnDefinitions"
[footerHeight]="50"
[scrollbarV]="true"
[scrollbarH]="true"
[columnMode]="'force'"
[reorderable]="false"
[selectionType]="'checkbox'"
[sorts]="[{prop: 'name', dir: 'asc'}]"
[cssClasses]="customClasses">
<ngx-datatable-column name=""
[prop]="'selected'"
[width]="40"
[sortable]="false"
[canAutoResize]="true"
[draggable]="false"
[resizeable]="false">
<ngx-datatable-footer>
<ng-template ngx-datatable-footer-template>
<div style="padding: 5px 10px">{{selectedColumnCount}} of {{columnCount}} selected</div>
</ng-template>
</ngx-datatable-footer>
<ng-template ngx-datatable-cell-template let-row="row" let-isSelected="row.selected" let-onCheckboxChangeFn="selectedColumnChanged">
<input type="checkbox" [checked]="row.selected" (change)="selectedColumnChanged( row )"/>
</ng-template>
</ngx-datatable-column>
<ngx-datatable-column name="Name"
[prop]="'name'"
[sortable]="true"
[checkboxable]="false"
[canAutoResize]="true"
[draggable]="false"
[resizeable]="true">
</ngx-datatable-column>
<ngx-datatable-column name="Type"
[prop]="'type'"
[sortable]="true"
[checkboxable]="false"
[canAutoResize]="true"
[draggable]="false"
[resizeable]="true">
</ngx-datatable-column>
<ngx-datatable-column name="Size"
[prop]="'size'"
[sortable]="true"
[checkboxable]="false"
[canAutoResize]="true"
[draggable]="false"
[resizeable]="true">
</ngx-datatable-column>
</ngx-datatable>
</div>
</div>
</pfng-card>

<!--
<pfng-info-status-card
[config]="selectedTableConfig">
</pfng-info-status-card>
-->

<!--
<div class="col-sm-12 selected-table-card">
<span class="fa fa-plug"></span><span class="selected-table-connection">{{ table.getConnection().getId() }}</span>
<span class="fa fa-close pull-right selected-table-close-icon" (click)="onRemove()"></span>
<br>
<span class="selected-table-name">{{ table.getName() }}</span>
</div>
-->

0 comments on commit 43639e7

Please sign in to comment.