Skip to content

Commit

Permalink
Merge pull request #98 from polypheny/various-fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
vogti authored Jul 28, 2024
2 parents dbf2147 + 8a594c1 commit b63d3b8
Show file tree
Hide file tree
Showing 21 changed files with 112 additions and 219 deletions.
4 changes: 2 additions & 2 deletions src/app/components/components.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import {
DropdownDividerDirective,
DropdownItemDirective,
DropdownMenuDirective,
DropdownToggleDirective,
DropdownToggleDirective, FormCheckComponent, FormCheckInputDirective, FormCheckLabelDirective,
FormControlDirective,
FormDirective,
FormFeedbackComponent,
Expand Down Expand Up @@ -168,7 +168,7 @@ import {DockerInstanceComponent} from './docker/dockerinstance/dockerinstance.co
DropdownMenuDirective,
DropdownItemDirective,
DropdownDividerDirective,
DropdownToggleDirective, ModalTitleDirective, FormDirective, RowDirective, DropdownComponent, FormSelectDirective, TooltipDirective, ContainerComponent
DropdownToggleDirective, ModalTitleDirective, FormDirective, RowDirective, DropdownComponent, FormSelectDirective, TooltipDirective, ContainerComponent, FormCheckComponent, FormCheckInputDirective, FormCheckLabelDirective
],
declarations: [
BreadcrumbComponent,
Expand Down
3 changes: 1 addition & 2 deletions src/app/components/data-view/data-view.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -162,8 +162,7 @@ export class DataViewComponent implements OnDestroy {
}

checkModelAndLanguage() {
return (this.$result().dataModel === DataModel.DOCUMENT && [QueryLanguage.MQL, QueryLanguage.MONGO].includes(this.$result().language)) ||
(this.$result().dataModel === DataModel.RELATIONAL && this.$result().language === QueryLanguage.SQL);
return (this.$result().dataModel === DataModel.RELATIONAL && this.$result().language === QueryLanguage.SQL);
}

showCreateView() {
Expand Down
28 changes: 8 additions & 20 deletions src/app/components/data-view/input/input.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,26 +18,14 @@
</ng-container>

<ng-container *ngSwitchCase="_types.booleanTypes().includes(header.dataType.toLowerCase()) ? header.dataType : ''">
<div class="form-check form-check-inline switch-wrapper">
<span cInputGroupText *ngIf="showLabel">{{header.name}}</span>
<label class="switch switch-label switch-pill switch-outline-primary-alt switch-sm"
[ngClass]="{'ms-3':!showLabel}">
<input type="checkbox" class="switch-input" [id]="'insertRow'+header.name"
[checked]="value === true"
[disabled]="value === null && header.nullable === true"
(change)="onValueChange(checkboxInput.checked)" #checkboxInput>
<span class="switch-slider"></span>
</label>
<span cInputGroupText class="insertRowLabel">
{{ value === null ? 'null' : value }}
</span>

<button size="sm"
*ngIf="header.nullable"
[ngClass]="{'btn-primary': value === null || value == undefined, 'btn-light': value !== null}"
(click)="onValueChange( triggerNull(value) )">null
</button>
</div>
<span cInputGroupText *ngIf="showLabel">{{header.name}}</span>
<c-button-group aria-label="boolean entry" class="mx-auto" role="group" size="sm">
<button cButton color="primary" style="border-top-left-radius: 4px !important; border-bottom-left-radius: 4px !important;" (click)="onValueChange(true)" [variant]="value === true ? undefined:'outline'">true</button>
<button cButton color="primary" (click)="onValueChange(false)" [variant]="value === false ? undefined:'outline'">false</button>
@if (header.nullable){
<button cButton color="primary" (click)="onValueChange(null)" [variant]="value === null ? undefined:'outline'" >null</button>
}
</c-button-group>
</ng-container>

<ng-container *ngSwitchCase="_types.dateTimeTypes().includes(header.dataType.toLowerCase()) ? header.dataType : ''">
Expand Down
36 changes: 0 additions & 36 deletions src/app/components/data-view/models/result-set.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,6 @@ export class RelationalResult extends Result<string[], UiColumnDefinition> {
}
}

export class RelationalExploreResult extends RelationalResult {
explorerId: number;
classificationInfo: string;
includesClassificationInfo: boolean;
classifiedData: string[][];
isConvertedToSql: boolean;
}

export class GraphResult extends Result<string[], FieldDefinition> {

}
Expand All @@ -76,34 +68,6 @@ export enum QueryType {
}


export class InfoSet extends RelationalResult {


constructor(error: string, generatedQuery: any, affectedRows: number) {
super(error, affectedRows);
}
}

/**
* model with classified data coming form server
*/
export class ExploreSet {
header: UiColumnDefinition[];
dataAfterClassification: string[];
exploreManagerId: number;
graph: string;
}

export class ExplorColSet {
[column: string]: {}
}

export class SelectedColSet {
[column: string]: {
selected: string
}
}

export class DashboardSet {

availableAdapter: { string: Pair };
Expand Down
76 changes: 0 additions & 76 deletions src/app/models/ui-request.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,58 +85,9 @@ export class QueryRequest extends UIRequest {

export class GraphRequest extends QueryRequest {
type = 'GraphRequest';
private nodeIds: string[];
private edgeIds: string[];

constructor(namespace: string, nodeIds: Set<string>, edgeIds: Set<string>) {
super('MATCH * RETURN *', false, false, 'CYPHER', namespace);
this.nodeIds = Array.from(nodeIds);
this.edgeIds = Array.from(edgeIds);
}
}

export class QueryExplorationRequest extends UIRequest {
query: string;
analyze: boolean;
cPage: number;

constructor(query: string, analyze: boolean, cPage: number) {
super();
this.query = query;
this.analyze = analyze;
this.cPage = cPage;
return this;
}
}

/**
* Request to classify data
*/
export class ClassifyRequest {
id: number;
header: UiColumnDefinition[];
classified: string[][];
cPage: number;

constructor(id: number, header: UiColumnDefinition[], classified: string[][], cPage: number) {
this.id = id;
this.header = header;
this.classified = classified;
this.cPage = cPage;
return this;
}
}

export class Exploration {
id: number;
header: UiColumnDefinition[];
classified: string[][];

constructor(id: number, header: UiColumnDefinition[], classified: string[][]) {
this.id = id;
this.header = header;
this.classified = classified;

}
}

Expand Down Expand Up @@ -194,33 +145,6 @@ export class DeleteRequest extends UIRequest {
}
}

export class SchemaRequest extends UIRequest {
routerLinkRoot: string;
views: boolean;
/**
* depth 1: schemas
* depth 2: schemas + tables
* depth 3: schemas + tables + columns
*/
depth: number;
/**
* if show table is false, "table" will not be shown in left sidebar
*/
showTable: boolean;
schemaEdit: boolean;
dataModels: DataModel[];

constructor(routerLinkRoot: string, views: boolean, depth: number, showTable: boolean, schemaEdit?: boolean, dataModels: DataModel[] = [DataModel.RELATIONAL, DataModel.DOCUMENT, DataModel.GRAPH]) {
super();
this.routerLinkRoot = routerLinkRoot;
this.views = views;
this.depth = depth;
this.showTable = showTable;
this.schemaEdit = schemaEdit || false;
this.dataModels = dataModels;
}
}

export class ColumnRequest extends UIRequest {
oldColumn: UiColumnDefinition;
newColumn: UiColumnDefinition;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
<c-row class="no-gutters nb-toolbar">
<c-col md="9">
<c-button-toolbar role="group" aria-label="Toolbar with button groups">
<button cButton color="danger" variant="outline" class="me-4 flex-grow-0" (click)="closeNotebookModal.show()">Close</button>
<button cButton color="danger" variant="outline" class="me-4 flex-grow-0"
(click)="closeNotebookModal.show()">Close
</button>
<c-button-group size="sm" class="me-2" role="group" aria-label="Save">
<button cButton color="light" type="button" (click)="uploadNotebook()"
onclick="this.blur();" cTooltip="Save notebook (S)">
Expand All @@ -13,7 +15,8 @@
<c-button-group size="sm" class="me-2" role="group" aria-label="File Run Kernel">
<c-button-group dropdown triggers="mouseover" #dropdownFile="bs-dropdown"
(mouseleave)="dropdownFile.hide()">
<button cButton color="light" id="drop-file-btn" dropdownToggle type="button" class="dropdown-toggle"
<button cButton color="light" id="drop-file-btn" dropdownToggle type="button"
class="dropdown-toggle"
aria-controls="dropdown-menu" onclick="this.blur();">
File
</button>
Expand Down Expand Up @@ -46,8 +49,10 @@
</div>
</c-button-group>

<c-button-group dropdown triggers="mouseover" #dropdownRun="bs-dropdown" (mouseleave)="dropdownRun.hide()">
<button cButton color="light" id="drop-run-btn" dropdownToggle type="button" class="dropdown-toggle"
<c-button-group dropdown triggers="mouseover" #dropdownRun="bs-dropdown"
(mouseleave)="dropdownRun.hide()">
<button cButton color="light" id="drop-run-btn" dropdownToggle type="button"
class="dropdown-toggle"
aria-controls="dropdown-menu" onclick="this.blur();">
Run
</button>
Expand Down Expand Up @@ -86,7 +91,8 @@

<c-button-group dropdown triggers="mouseover" #dropdownKernel="bs-dropdown"
(mouseleave)="dropdownKernel.hide()">
<button cButton color="light" id="drop-kernel-btn" dropdownToggle type="button" class="dropdown-toggle"
<button cButton color="light" id="drop-kernel-btn" dropdownToggle type="button"
class="dropdown-toggle"
aria-controls="dropdown-menu" onclick="this.blur();">
Kernel
</button>
Expand Down Expand Up @@ -137,33 +143,33 @@
<i class="fa fa-plus"></i>
</button>
</c-button-group>
<c-button-group>
<select class="form-select btn pull-right me-1 bg-light px-1" aria-label="Select Cell Type"
<div class="btn-group" role="group">
<select cButton class="form-select me-1 bg-light text-black px-2" aria-label="Select Cell Type"
(change)="onTypeChange($event)"
[(ngModel)]="selectedCellType">
<option value="code">Code</option>
<option value="markdown">Markdown</option>
<option value="poly">Query</option>
<option value="raw">Raw</option>
</select>
</c-button-group>
</div>
</c-button-toolbar>
</c-col>
<c-col md="3" class="col-md-3 text-right">
<c-col md="3" class="col-md-3 d-flex justify-content-end">
<button cButton color="light" type="button" style="white-space: nowrap"
(click)="openChangeSessionModal.emit({name: name, path: path})">
<span class="me-2">{{kernelSpec?.spec?.display_name || 'No kernel'}}</span>
<span class="me-2">{{ kernelSpec?.spec?.display_name || 'No kernel' }}</span>
<c-badge class="badge badge-pill"
[color]="nb?.kernelStatus === 'idle' ? 'success': (!nb || nb?.kernelStatus === 'unknown' ? 'danger' : (nb?.kernelStatus === 'busy' ? 'primary' : (nb?.kernelStatus === 'starting' ? 'secondary' : 'primary')))">
{{nb?.kernelStatus || 'unknown'}}
{{ nb?.kernelStatus || 'unknown' }}
</c-badge>
</button>
</c-col>
</c-row>
</c-container>

<div class="nb-scroll px-3" *ngIf="session; else elseNoSession" tabindex="-1" id="notebook" (keydown)="keyDown($event)">
<h1 class="nb-title">{{name}}</h1>
<h1 class="nb-title">{{ name }}</h1>
<div class="nb-background mt-4 pt-4">
<ng-container *ngIf="nb">
<div cdkDropList class="drop-list" (cdkDropListDropped)="drop($event)">
Expand All @@ -178,7 +184,6 @@ <h1 class="nb-title">{{name}}</h1>
[isLast]="i === nb.cells.length-1"
[selectedCellType]="selectedCellType"
[(mode)]="mode"
[namespaces]="namespaces"
[nbLanguage]="kernelSpec?.spec?.language || 'python'"
[isTrusted]="nb.trustedCellIds.has(cell.id)"
(execute)="nb.executeCell($event)"
Expand All @@ -192,7 +197,7 @@ <h1 class="nb-title">{{name}}</h1>
</app-nb-cell>
<div *cdkDragPreview class="drop-preview">
<span class="text-secondary me-4" *ngIf="cell.cell_type === 'code'">[ ]:</span>
<span>{{getPreviewText( cell )}}</span>
<span>{{ getPreviewText(cell) }}</span>
</div>
<div class="example-custom-placeholder bg-primary" *cdkDragPlaceholder></div>
</div>
Expand Down Expand Up @@ -220,7 +225,8 @@ <h1 class="nb-title">The Selected Kernel No Longer Exists</h1>
<c-modal-content>
<c-modal-header>
<h4 cModalTitle>Delete Notebook</h4>
<button cButtonClose type="button" class="close" (click)="deleteNotebookModal.hide()" aria-label="Close"></button>
<button cButtonClose type="button" class="close" (click)="deleteNotebookModal.hide()"
aria-label="Close"></button>
</c-modal-header>

<c-modal-body>
Expand Down Expand Up @@ -316,7 +322,8 @@ <h4 cModalTitle>Rename File</h4>
<c-modal-content>
<c-modal-header>
<h4 cModalTitle>Close Notebook</h4>
<button cButtonClose type="button" class="close" (click)="closeNotebookCancelled()" aria-label="Close"></button>
<button cButtonClose type="button" class="close" (click)="closeNotebookCancelled()"
aria-label="Close"></button>
</c-modal-header>

<c-modal-body>
Expand All @@ -341,7 +348,7 @@ <h4 cModalTitle>Close Notebook</h4>
<c-modal-footer>
<button cButton color="secondary" type="button" (click)="closeNotebookCancelled()">Cancel</button>
<button cButton color="primary" type="submit" (click)="closeNotebookSubmitted()" [disabled]="deleting">
{{closeNotebookForm.get( "shutDown" ).value && session ? 'Close & Shut Down' : 'Close'}}
{{ closeNotebookForm.get("shutDown").value && session ? 'Close & Shut Down' : 'Close' }}
</button>
</c-modal-footer>
</c-modal-content>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import {delay, mergeMap, take, tap} from 'rxjs/operators';
import {LoadingScreenService} from '../../../../components/loading-screen/loading-screen.service';
import {FormControl, FormGroup, Validators} from '@angular/forms';
import {ToasterService} from '../../../../components/toast-exposer/toaster.service';
import {WebuiSettingsService} from "../../../../services/webui-settings.service";
import {WebuiSettingsService} from '../../../../services/webui-settings.service';

@Component({
selector: 'app-edit-notebook',
Expand Down
Loading

0 comments on commit b63d3b8

Please sign in to comment.