You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@submarine.apache.org by pi...@apache.org on 2021/11/14 04:04:28 UTC

[submarine] branch master updated: SUBMARINE-1076. Add: search functionality on data-dict

This is an automated email from the ASF dual-hosted git repository.

pingsutw pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/submarine.git


The following commit(s) were added to refs/heads/master by this push:
     new 514bcf0  SUBMARINE-1076. Add: search functionality on data-dict
514bcf0 is described below

commit 514bcf02ceca28dba0d56a57f3011b6f68eb4c36
Author: atosystem <at...@hotmail.com>
AuthorDate: Tue Nov 9 14:07:18 2021 +0800

    SUBMARINE-1076. Add: search functionality on data-dict
    
    ### What is this PR for?
    
    * Implement the search functionality in `/workbench/manager/dataDict`
    * Fix the order of input field to match the columns
    
    ### What type of PR is it?
    [Feature]
    
    ### Todos
    
    ### What is the Jira issue?
    
    https://issues.apache.org/jira/browse/SUBMARINE-1076
    
    ### How should this be tested?
    
    Go to `/workbench/manager/dataDict` and search
    
    ### Screenshots (if appropriate)
    
    ### Questions:
    * Do the license files need updating? No
    * Are there breaking changes for older versions? No
    * Does this need new documentation? No
    
    Author: atosystem <at...@hotmail.com>
    
    Signed-off-by: Kevin <pi...@apache.org>
    
    Closes #794 from atosystem/SUBMARINE-1076 and squashes the following commits:
    
    2f8717b9 [atosystem] SUBMARINE-1076. Add: search functionality on data-dict
---
 .../manager/data-dict/data-dict.component.html     | 10 ++++----
 .../manager/data-dict/data-dict.component.ts       | 30 +++++++++++++++++++---
 2 files changed, 31 insertions(+), 9 deletions(-)

diff --git a/submarine-workbench/workbench-web/src/app/pages/workbench/manager/data-dict/data-dict.component.html b/submarine-workbench/workbench-web/src/app/pages/workbench/manager/data-dict/data-dict.component.html
index 4208e4e..9516062 100644
--- a/submarine-workbench/workbench-web/src/app/pages/workbench/manager/data-dict/data-dict.component.html
+++ b/submarine-workbench/workbench-web/src/app/pages/workbench/manager/data-dict/data-dict.component.html
@@ -21,15 +21,15 @@
   <div class="data-dict-table-operate">
     <form nz-form [nzLayout]="'inline'" [formGroup]="dataDictForm">
       <nz-form-item>
-        <nz-form-label>Dictionary Name</nz-form-label>
+        <nz-form-label>Dictionary Code</nz-form-label>
         <nz-form-control>
-          <input nz-input formControlName="dictName" placeholder="Enter Dictionary Name" />
+          <input nz-input formControlName="dictCode" placeholder="Enter Dictionary Code" />
         </nz-form-control>
       </nz-form-item>
       <nz-form-item>
-        <nz-form-label>Dictionary Code</nz-form-label>
+        <nz-form-label>Dictionary Name</nz-form-label>
         <nz-form-control>
-          <input nz-input formControlName="dictCode" placeholder="Enter Dictionary Code" />
+          <input nz-input formControlName="dictName" placeholder="Enter Dictionary Name" />
         </nz-form-control>
       </nz-form-item>
       <nz-form-item>
@@ -47,7 +47,7 @@
     </form>
   </div>
 
-  <nz-table #table [nzData]="sysDictList" [nzScroll]="{ x: '1100px' }" nzNoResult="No result" nzBordered>
+  <nz-table #table [nzData]="isFiltered ? filterArr : sysDictList" [nzScroll]="{ x: '1100px' }" nzNoResult="No result" nzBordered>
     <thead>
       <tr>
         <th nzLeft="0px">#</th>
diff --git a/submarine-workbench/workbench-web/src/app/pages/workbench/manager/data-dict/data-dict.component.ts b/submarine-workbench/workbench-web/src/app/pages/workbench/manager/data-dict/data-dict.component.ts
index 6f3c1b5..7fe1965 100644
--- a/submarine-workbench/workbench-web/src/app/pages/workbench/manager/data-dict/data-dict.component.ts
+++ b/submarine-workbench/workbench-web/src/app/pages/workbench/manager/data-dict/data-dict.component.ts
@@ -27,7 +27,7 @@ import { SysDictItem } from '@submarine/interfaces/sys-dict-item';
   styleUrls: ['./data-dict.component.scss']
 })
 export class DataDictComponent implements OnInit {
-  constructor(private fb: FormBuilder) {}
+  constructor(private fb: FormBuilder) { }
   dataDictForm: FormGroup;
   // TODO(kevin85421): (mock data) Replace it with sys-dict-item.ts
   sysDictList = [
@@ -81,6 +81,10 @@ export class DataDictComponent implements OnInit {
   // New Dict Item List
   newDictItemCode: string = '';
 
+  // For Filtering
+  isFiltered: boolean = false;
+  filterArr = [];
+
   ngOnInit() {
     this.dataDictForm = this.fb.group({
       dictName: [''],
@@ -88,9 +92,27 @@ export class DataDictComponent implements OnInit {
     });
   }
 
-  // TODO(kevin85421)
-  queryDataDict() {}
-  // TODO(kevin85421)
+  queryDataDict() {
+    this.filterArr = [];
+    if (
+      this.dataDictForm.get('dictCode').value === "" && 
+      this.dataDictForm.get('dictName').value === ""
+    ) {
+      this.isFiltered = false;
+    } else {
+      this.sysDictList.forEach((node) => {
+        if (
+          node.dictCode.includes(this.dataDictForm.get('dictCode').value) &&
+          node.dictName.includes(this.dataDictForm.get('dictName').value)
+        ) {
+          this.filterArr.push(node);
+        }
+      });
+      this.isFiltered = true;
+    }
+    this.filterArr = [...this.filterArr];
+  }
+
   onShowAddDataDictModal() {
     this.modalTitle = 'Add';
     this.selectedDictCode = '';

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@submarine.apache.org
For additional commands, e-mail: dev-help@submarine.apache.org