Skip to content

Commit

Permalink
various cleanup and reformattings
Browse files Browse the repository at this point in the history
  • Loading branch information
datomo committed Mar 17, 2024
1 parent 1d6621b commit 3c4fb27
Show file tree
Hide file tree
Showing 17 changed files with 178 additions and 142 deletions.
13 changes: 7 additions & 6 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
"hammer": "0.0.5",
"hammerjs": "^2.0.8",
"highlight.js": "^11.8.0",
"jquery": "^3.5.1",
"jquery": "3.7.1",
"jquery-ui": "^1.13.0",
"katex": "^0.16.0",
"lodash": "^4.17.20",
Expand Down
49 changes: 30 additions & 19 deletions src/app/components/data-view/data-card/data-card.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@
<div class="card-wrapper" *ngIf="$result()">
<c-card *ngFor="let d1 of $result().data; let i = index" (dblclick)="triggerEditing(i)"
[ngClass]="{'editing': i===editing, 'json-card': $result().dataModel === DataModel.DOCUMENT}">
<a cButton size="sm" color="secondary" variant="outline" *ngIf="entityConfig.update && i !== editing" [routerLink]="[]"
<a cButton size="sm" color="secondary" variant="outline" *ngIf="entityConfig.update && i !== editing"
[routerLink]="[]"
class="edit-card"
(click)="triggerEditing(i)"><i class="cil-pencil"></i></a>
<a cButton size="sm" color="secondary" variant="outline" *ngIf="entityConfig.update && i !== editing" [routerLink]="[]"
<a cButton size="sm" color="secondary" variant="outline" *ngIf="entityConfig.update && i !== editing"
[routerLink]="[]"
class="delete-card"
(click)="deleteRow(d1, i)" (mouseleave)="confirm = -1"><i
[ngClass]="{ 'cil-trash': i!==confirm, 'fa': i===confirm, 'fa-warning': i===confirm}"></i></a>
Expand Down Expand Up @@ -42,7 +44,7 @@
<ng-container *ngIf="i !== editing">
<ng-container [ngSwitch]="removeNull(h.dataType)">
<ng-container *ngSwitchCase="'FILE'">
<span class="key">{{h.name}}:</span>
<span class="key">{{ h.name }}:</span>
<a class="download val" [href]="getFileLink(d1[j])" download><span
class="cil-cloud-download"></span></a>
</ng-container>
Expand All @@ -55,7 +57,7 @@
<app-json-text [text]="d1[j]"></app-json-text>
</ng-container>
<ng-container *ngSwitchDefault>
<span class="key">{{h.name}}: </span>
<span class="key">{{ h.name }}: </span>
<app-expandable-text [text]="d1[j]"></app-expandable-text>
</ng-container>
</ng-container>
Expand All @@ -74,11 +76,17 @@
</ng-container>

<li cListGroupItem *ngIf="i === editing" style="display: flex; justify-content: space-between;">
<progressbar *ngIf="uploadProgress > -1 && uploadProgress !== 100 && uploadProgress !== 0"
[animate]="true" [value]="uploadProgress === 0 ? 100 : uploadProgress" [striped]="false"
type="primary"></progressbar>
<progressbar *ngIf="uploadProgress > -1 && (uploadProgress === 100 || uploadProgress === 0)"
[animate]="true" [value]="100" [striped]="true" type="primary"></progressbar>
<c-progress *ngIf="uploadProgress > -1 && uploadProgress !== 100 && uploadProgress !== 0">
<c-progress-bar
[animated]="true" [value]="uploadProgress === 0 ? 100 : uploadProgress"
variant="striped"
color="primary"></c-progress-bar>
</c-progress>
<c-progress *ngIf="uploadProgress > -1 && (uploadProgress === 100 || uploadProgress === 0)">
<c-progress-bar
[animated]="true" [value]="100" color="primary"></c-progress-bar>
</c-progress>

<button cButton color="light" size="sm" *ngIf="uploadProgress === -1" (click)="editing = -1">
cancel
</button>
Expand All @@ -98,11 +106,11 @@
<c-card *ngIf="entityConfig().create && showInsertCard"
[ngClass]="{'json-card': $result()?.dataModel === DataModel.DOCUMENT}">
<c-card-header>
Insert data
Insert Data
</c-card-header>
<ul cListGroup flush="true">
<li cListGroupItem *ngFor="let h of $result().header">
<app-input *ngIf="$result()?.dataModel === DataModel.RELATIONAL || h.name === '_id'"
<app-input *ngIf="$result()?.dataModel === DataModel.RELATIONAL"
[header]="h"
[showLabel]="true" [value]="insertValues.get(h.name)"
(valueChange)="inputChange(h.name, $event)"
Expand All @@ -113,13 +121,16 @@
(valueChange)="inputChange(h.name, $event)"></app-json-editor>
</li>
<li cListGroupItem>
<progressbar
*ngIf="editing === -1 && uploadProgress > -1 && uploadProgress !== 100 && uploadProgress !== 0"
[animate]="true" [value]="uploadProgress === 0 ? 100 : uploadProgress" [striped]="false"
type="primary"></progressbar>
<progressbar
*ngIf="editing === -1 && uploadProgress > -1 && (uploadProgress === 100 || uploadProgress === 0)"
[animate]="true" [value]="100" [striped]="true" type="primary"></progressbar>
<c-progress
*ngIf="editing === -1 && uploadProgress > -1 && uploadProgress !== 100 && uploadProgress !== 0">
<c-progress-bar [animated]="true" [value]="uploadProgress === 0 ? 100 : uploadProgress"
variant="striped"
color="primary"></c-progress-bar>
</c-progress>
<c-progress
*ngIf="editing === -1 && uploadProgress > -1 && (uploadProgress === 100 || uploadProgress === 0)">
<c-progress-bar [animated]="true" [value]="100" variant="striped" color="primary"></c-progress-bar>
</c-progress>
<button cButton color="light" size="sm" *ngIf="uploadProgress === -1 || editing !== -1"
(click)="showInsertCard = false">cancel
</button>
Expand All @@ -143,7 +154,7 @@
[disabled]="p.disabled" [active]="p.active">
<a cPageLink class="pe-auto page-link"
[style.cursor]="p.active || p.disabled ? 'inherit' : 'pointer'" (click)="paginate(p)"
[routerLink]>{{p.label}}</a>
[routerLink]>{{ p.label }}</a>
</li>
</c-pagination>
</nav>
Expand Down
31 changes: 18 additions & 13 deletions src/app/components/data-view/data-graph/data-graph.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@
<div *ngIf="showProperties" class="graph-properties">
<c-card class="card text-center h-100">
<c-card-header>
{{detail.id}}
{{ detail.id }}
</c-card-header>
<c-card-body>
<span *ngFor="let label of detail.labels" class="badge badge-pill"
[style]="{ 'background-color': getLabelColor(label) }">{{label}}</span>
[style]="{ 'background-color': getLabelColor(label) }">{{ label }}</span>
<div class="my-2"></div>
<div *ngFor="let entry of detail.properties | keyvalue">
<p><strong>{{entry.key}}: </strong>{{entry.value}}</p>
<p><strong>{{ entry.key }}: </strong>{{ entry.value }}</p>
</div>
</c-card-body>
<c-card-footer class="text-muted">
Expand All @@ -39,7 +39,7 @@

<c-card *ngIf="entityConfig().create && showInsertCard">
<c-card-header class="card-header">
Insert data
Insert Data
</c-card-header>
<ul class="list-group list-group-flush">
<li class="list-group-item" *ngFor="let h of $result().header">
Expand All @@ -54,18 +54,23 @@
[json]="insertValues.get(h.name)"
(valueChange)="inputChange(h.name, $event)"></app-json-editor>
</li>
<li class="list-group-item">
<progressbar
*ngIf="editing === -1 && uploadProgress > -1 && uploadProgress !== 100 && uploadProgress !== 0"
[animate]="true" [value]="uploadProgress === 0 ? 100 : uploadProgress" [striped]="false"
type="primary"></progressbar>
<progressbar
*ngIf="editing === -1 && uploadProgress > -1 && (uploadProgress === 100 || uploadProgress === 0)"
[animate]="true" [value]="100" [striped]="true" type="primary"></progressbar>
<li cListGroupItem>
<c-progress
*ngIf="editing === -1 && uploadProgress > -1 && uploadProgress !== 100 && uploadProgress !== 0">
<c-progress-bar
[animated]="true" [value]="uploadProgress === 0 ? 100 : uploadProgress" variant="striped"
color="primary"></c-progress-bar>
</c-progress>
<c-progress
*ngIf="editing === -1 && uploadProgress > -1 && (uploadProgress === 100 || uploadProgress === 0)">
<c-progress-bar
[animated]="true" [value]="100" variant="striped" color="primary"></c-progress-bar>
</c-progress>
<button cButton size="sm" color="light" *ngIf="uploadProgress === -1 || editing !== -1"
(click)="showInsertCard = false">cancel
</button>
<button cButton color="primary" size="sm" *ngIf="uploadProgress === -1 || editing !== -1" class="float-right"
<button cButton color="primary" size="sm" *ngIf="uploadProgress === -1 || editing !== -1"
class="float-right"
[disabled]="$result()?.dataModel === NamespaceType.DOCUMENT && !jsonValid"
(click)="insertTuple()">
save
Expand Down
55 changes: 33 additions & 22 deletions src/app/components/data-view/data-table/data-table.component.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<div class="text-danger mb-3"
*ngIf="$result() && $result().error && !$result().header">{{$result().error}}</div>
*ngIf="$result() && $result().error && !$result().header">{{ $result().error }}
</div>

<c-row *ngIf="$result() && $result().header">
<c-col [lg]="12" id="data-table-wrapper" [ngClass]="{ 'overflow-y-hidden': entityConfig().exploring }">
Expand All @@ -14,7 +15,8 @@
<th>
<span [tooltip]="getTooltip(h)" placement="bottom" [delay]="200" container="body"
[ngClass]="{'pk': h.primary}">{{ h.name }}</span>
<a *ngIf="false && entityConfig().sort && canOrder(h) && h.name !== '_data'" [routerLink]="[]"
<a *ngIf="false && entityConfig().sort && canOrder(h) && h.name !== '_data'"
[routerLink]="[]"
[ngClass]="{'btn-primary' : h.sort.sorting, 'btn-light': !h.sort.sorting, 'btn btn-sm float-right': true}"
(click)="sortTable(h.sort)">
<i [ngClass]="h.sort.direction === 'ASC' ? 'icon-arrow-up' : 'icon-arrow-down'"></i>
Expand Down Expand Up @@ -74,14 +76,16 @@
<ng-container *ngSwitchCase="'FILE'">
<a *ngIf="downloadingIthRow !== i" [routerLink]="[]" class="download"
(click)="getFile(d2, i)" download><span class="cil-cloud-download"></span></a>
<progressbar
*ngIf="downloadingIthRow === i && downloadProgress > -1 && downloadProgress !== 0 && downloadProgress !== 100"
[animate]="true" [value]="downloadProgress === 0 ? 100 : downloadProgress"
type="primary" class="file-progress"></progressbar>
<progressbar
*ngIf="downloadingIthRow === i && downloadProgress > -1 && (downloadProgress === 100 || downloadProgress === 0)"
[animate]="true" [value]="downloadProgress === 0 ? 100 : downloadProgress"
[striped]="true" type="primary" class="file-progress"></progressbar>
<c-progress>
<c-progress-bar
*ngIf="downloadingIthRow === i && downloadProgress > -1 && downloadProgress !== 0 && downloadProgress !== 100"
[animated]="true" [value]="downloadProgress === 0 ? 100 : downloadProgress"
variant="striped" color="primary" class="file-progress"></c-progress-bar>
<c-progress-bar
*ngIf="downloadingIthRow === i && downloadProgress > -1 && (downloadProgress === 100 || downloadProgress === 0)"
[animated]="true" [value]="downloadProgress === 0 ? 100 : downloadProgress"
variant="striped" color="primary" class="file-progress"></c-progress-bar>
</c-progress>
</ng-container>
<img *ngSwitchCase="'IMAGE'" [src]="getFileLink(d2)"
style="max-height:200px; max-width: 300px"/>
Expand All @@ -99,8 +103,9 @@
</ng-container>
</td>
<td class="delete" *ngIf="entityConfig().update || entityConfig().delete">
<button cButton color="danger" size="sm" cTextColor="white" *ngIf="entityConfig().delete" [ngClass]="{ 'cil-trash': i !== confirm, 'cil-warning': i === confirm }"
(click)="deleteRow(d1, i)" (mouseleave)="confirm = -1"></button>
<button cButton color="danger" size="sm" cTextColor="white" *ngIf="entityConfig().delete"
[ngClass]="{ 'cil-trash': i !== confirm, 'cil-warning': i === confirm }"
(click)="deleteRow(d1, i)" (mouseleave)="confirm = -1"></button>
</td>
</ng-container>
</tr>
Expand All @@ -122,15 +127,19 @@
<button cButton color="primary" id="addColumnBtn" (click)="insertTuple()"
*ngIf="uploadProgress === -1 || editing !== -1">+
</button>
<progressbar
*ngIf="editing === -1 && uploadProgress > -1 && uploadProgress !== 0 && uploadProgress !== 100"
[animate]="true" [value]="uploadProgress === 0 ? 100 : uploadProgress" [striped]="false"
type="primary" class="file-progress"></progressbar>
<progressbar
*ngIf="editing === -1 && uploadProgress > -1 && (uploadProgress === 100 || uploadProgress === 0)"
[animate]="true" [value]="100" [striped]="true" type="primary"
class="file-progress"></progressbar>
<!--<progressbar *ngIf="editing === -1 && uploadProgress > -1" [animate]="true" [value]="uploadProgress === 0 ? 100 : uploadProgress" [striped]="uploadProgress === 100 || uploadProgress === 0" type="primary" class="file-progress"></progressbar>-->
<c-progress
*ngIf="editing === -1 && uploadProgress > -1 && uploadProgress !== 0 && uploadProgress !== 100">
<c-progress-bar
[animated]="true" [value]="uploadProgress === 0 ? 100 : uploadProgress"
variant="striped"
color="primary" class="file-progress"></c-progress-bar>
</c-progress>
<c-progress
*ngIf="editing === -1 && uploadProgress > -1 && (uploadProgress === 100 || uploadProgress === 0)">
<c-progress-bar
[animated]="true" [value]="100" color="primary"
class="file-progress"></c-progress-bar>
</c-progress>
</td>
</tr>
</tbody>
Expand All @@ -145,7 +154,9 @@
<c-pagination align="center">
<li *ngFor="let p of pagination" class="page-item pe-auto" cPageItem
[disabled]="p.disabled" [active]="p.active">
<a cPageLink class="pe-auto page-link" [style.cursor]="p.active || p.disabled ? 'inherit' : 'pointer'" (click)="paginate(p)" [routerLink]>{{p.label}}</a>
<a cPageLink class="pe-auto page-link"
[style.cursor]="p.active || p.disabled ? 'inherit' : 'pointer'" (click)="paginate(p)"
[routerLink]>{{ p.label }}</a>
</li>
</c-pagination>
</nav>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<div class="json-viewer">
<ngx-json-viewer [json]="testing" [expanded]="false"></ngx-json-viewer>
<ngx-json-viewer [json]="json" [expanded]="false"></ngx-json-viewer>
</div>
6 changes: 3 additions & 3 deletions src/app/components/data-view/json-text/json-text.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {Component, Input, OnInit} from '@angular/core';
export class JsonTextComponent implements OnInit {

@Input() text?: string;
testing;
json: {};

constructor() {
}
Expand All @@ -18,10 +18,10 @@ export class JsonTextComponent implements OnInit {
if (regex.test(this.text)) {
return;
}
this.testing = this.parse(this.text);
this.json = this.parse(this.text);
}

parse(text: string) {
parse(text: string): {} {
try {
return JSON.parse(text);
} catch (e) {
Expand Down
Loading

0 comments on commit 3c4fb27

Please sign in to comment.