lp1846552 Adjust character formatting & subfolder collab/khuckins/lp1846552-port-loca-admin-shelving-location-order-tweaks
authorKyle Huckins <khuckins@catalyte.io>
Fri, 11 Oct 2019 22:51:47 +0000 (22:51 +0000)
committerKyle Huckins <khuckins@catalyte.io>
Fri, 11 Oct 2019 22:54:25 +0000 (22:54 +0000)
- Switch character formatting to UNIX instead of DOS/Windows
- Move copy-location-order components into new copy-location folder
- Adjust link in Local Admin page to link to new Angular UI

Signed-off-by: Kyle Huckins <khuckins@catalyte.io>
 Changes to be committed:
modified:   Open-ILS/src/eg2/src/app/staff/admin/local/admin-local.module.ts
renamed:    Open-ILS/src/eg2/src/app/staff/admin/local/copy-location-order.component.html -> Open-ILS/src/eg2/src/app/staff/admin/local/copy-location/copy-location-order.component.html
renamed:    Open-ILS/src/eg2/src/app/staff/admin/local/copy-location-order.component.ts -> Open-ILS/src/eg2/src/app/staff/admin/local/copy-location/copy-location-order.component.ts
new file:   Open-ILS/src/eg2/src/app/staff/admin/local/copy-location/copy-location-routing.module.ts
new file:   Open-ILS/src/eg2/src/app/staff/admin/local/copy-location/copy-location.module.ts
modified:   Open-ILS/src/eg2/src/app/staff/admin/local/routing.module.ts
modified:   Open-ILS/src/eg2/src/app/staff/admin/local/share/card.component.html
modified:   Open-ILS/src/eg2/src/app/staff/admin/local/share/card.component.ts
modified:   Open-ILS/src/eg2/src/app/staff/admin/local/share/table-list.component.html
modified:   Open-ILS/src/eg2/src/app/staff/admin/local/share/table-list.component.ts

13 files changed:
Open-ILS/src/eg2/src/app/staff/admin/local/admin-local-splash.component.html
Open-ILS/src/eg2/src/app/staff/admin/local/admin-local.module.ts
Open-ILS/src/eg2/src/app/staff/admin/local/copy-location-order.component.html [deleted file]
Open-ILS/src/eg2/src/app/staff/admin/local/copy-location-order.component.ts [deleted file]
Open-ILS/src/eg2/src/app/staff/admin/local/copy-location/copy-location-order.component.html [new file with mode: 0644]
Open-ILS/src/eg2/src/app/staff/admin/local/copy-location/copy-location-order.component.ts [new file with mode: 0644]
Open-ILS/src/eg2/src/app/staff/admin/local/copy-location/copy-location-routing.module.ts [new file with mode: 0644]
Open-ILS/src/eg2/src/app/staff/admin/local/copy-location/copy-location.module.ts [new file with mode: 0644]
Open-ILS/src/eg2/src/app/staff/admin/local/routing.module.ts
Open-ILS/src/eg2/src/app/staff/admin/local/share/card.component.html
Open-ILS/src/eg2/src/app/staff/admin/local/share/card.component.ts
Open-ILS/src/eg2/src/app/staff/admin/local/share/table-list.component.html
Open-ILS/src/eg2/src/app/staff/admin/local/share/table-list.component.ts

index 02565df..ec22b85 100644 (file)
@@ -30,7 +30,7 @@
     <eg-link-table-link i18n-label label="Shelving Location Groups" 
       url="/eg/staff/admin/local/asset/copy_location_group"></eg-link-table-link>
     <eg-link-table-link i18n-label label="Shelving Location Order" 
-      url="/eg/staff/admin/local/asset/copy_location_order"></eg-link-table-link>
+      routerLink="/staff/admin/local/asset/copy_location_order"></eg-link-table-link>
     <eg-link-table-link i18n-label label="Shelving Locations Editor" 
       routerLink="/staff/admin/local/asset/copy_location"></eg-link-table-link>
     <eg-link-table-link i18n-label label="Item Tags" 
index 8beccea..9f70ab7 100644 (file)
@@ -7,19 +7,13 @@ import {AdminLocalSplashComponent} from './admin-local-splash.component';
 import {AddressAlertComponent} from './address-alert.component';
 import {AdminCarouselComponent} from './admin-carousel.component';
 import {StandingPenaltyComponent} from './standing-penalty.component';
-import {CopyLocationOrderComponent} from './copy-location-order.component';
-import {TableListComponent} from './share/table-list.component';
-import {CardComponent} from './share/card.component';
 
 @NgModule({
   declarations: [
       AdminLocalSplashComponent,
       AddressAlertComponent,
       AdminCarouselComponent,
-      StandingPenaltyComponent,
-      CopyLocationOrderComponent,
-      TableListComponent,
-      CardComponent
+      StandingPenaltyComponent
   ],
   imports: [
     AdminCommonModule,
diff --git a/Open-ILS/src/eg2/src/app/staff/admin/local/copy-location-order.component.html b/Open-ILS/src/eg2/src/app/staff/admin/local/copy-location-order.component.html
deleted file mode 100644 (file)
index 47631cf..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-<div (mouseup)="disableMouseUp()" (mouseleave)="disableMouseUp()" [style.height.vh]="100">\r
-    <eg-staff-banner bannerText="Shelving Location Order" i18n-bannerText>\r
-    </eg-staff-banner>\r
-    <div>\r
-        <h3>Context Org Unit</h3>\r
-        <div [style.width.%]="30">\r
-            <eg-org-select domId="acpl" [applyDefault]="true" (onChange)="onChange($event)"></eg-org-select>            \r
-        </div>\r
-    </div>    \r
-    <p>To move an item, drag it up or down with the mouse.</p>\r
-    <ng-container *ngIf="locations && locations.length>0">\r
-        <table-list \r
-        [content_list]="locations" \r
-        [is_mouse_down]="detect_mouse_down"\r
-        (saveContent)="applyChanges($event)"\r
-        (toggleDragAndDrop)="toggleDragAndDrop($event)"   \r
-        (nodeIsSelected)="displaySelectedNode($event)" (detectMousePosition)="onMouseDown($event)"></table-list>\r
-    </ng-container>\r
-    <div *ngIf="detect_mouse_down && detect_mouse"\r
-    [ngStyle]="position_styling" \r
-    [style.top.px]="mouse_y_position+25" \r
-    [style.left.px]="mouse_x_position-75" >{{selected_node.name}} ({{selected_node.shortname}})</div>\r
-</div>
\ No newline at end of file
diff --git a/Open-ILS/src/eg2/src/app/staff/admin/local/copy-location-order.component.ts b/Open-ILS/src/eg2/src/app/staff/admin/local/copy-location-order.component.ts
deleted file mode 100644 (file)
index 756600e..0000000
+++ /dev/null
@@ -1,209 +0,0 @@
-import {Component, OnInit, HostListener} from '@angular/core';\r
-import {PcrudService} from '@eg/core/pcrud.service';\r
-import {AuthService} from '@eg/core/auth.service';\r
-import {ToastService} from '@eg/share/toast/toast.service';\r
-import { IdlService } from '@eg/core/idl.service';\r
-\r
-\r
-\r
-class Category {\r
-    name:string;\r
-    owning_lib:string;\r
-    shortname:string;\r
-    unhashed_element:any;\r
-}\r
-\r
-@Component({\r
-    templateUrl: './copy-location-order.component.html'\r
-})\r
-\r
-export class CopyLocationOrderComponent implements OnInit {\r
-    orders:any;\r
-    locations:any;\r
-    id_log=[];\r
-    lib_tree=[];\r
-    active_libraries=[];\r
-    mouse_x_position:number;    \r
-    mouse_y_position:number;\r
-    detect_mouse_down=false;\r
-    detect_mouse = false;\r
-    selected_node:any;\r
-\r
-    position_styling={\r
-        backgroundColor:"white",\r
-        boxShadow:"5px 4px 10px 2px #5B5A5A",\r
-        textAlign:"center",\r
-        padding:"3px",\r
-        width:'80px',\r
-        position:'fixed',\r
-    }\r
-\r
-    constructor(\r
-        private pcrud: PcrudService,\r
-        private idl: IdlService,\r
-        private toast: ToastService,        \r
-        private auth: AuthService,\r
-    ) {\r
-    }\r
-\r
-    ngOnInit() {\r
-        //this.createTree();        \r
-        //this.filterGrid(this.auth.user().ws_ou());\r
-    };\r
-\r
-    detectMouseLeave(){\r
-        this.detect_mouse=false;\r
-    }\r
-\r
-    toggleDragAndDrop(toggle){\r
-\r
-        this.detect_mouse=toggle;\r
-    }\r
-\r
-    disableMouseUp(){   \r
-        this.detect_mouse_down=false;\r
-    }\r
-    onMouseDown(is_mouse_down){\r
-        this.detect_mouse_down=is_mouse_down;\r
-    }\r
-    \r
-\r
-    displaySelectedNode(node){\r
-        this.selected_node=node;\r
-    }\r
-\r
-    /**\r
-     * Initializes the search for the library tree and the array of the library locations.\r
-     * @param org The authorized user passed in during initialization.\r
-     */\r
-    filterGrid(org) {\r
-        // fetch the locations and order entries\r
-        if(!this.orders) {\r
-            this.pcrud.search('acplo', {org : org}, {order_by : {acplo : 'position'}})\r
-                .subscribe(elements => console.log("Order",elements));\r
-            this.mappingLocation();\r
-        }\r
-    }\r
-\r
-\r
-    /**\r
-     * Maps the values of the specified category to an array of objects, whose keys hold the necessary values.\r
-     */\r
-    mappingLocation(){       \r
-        this.locations=[];\r
-        this.pcrud.search('acpl',\r
-        {owning_lib:this.id_log, deleted : 'f'}\r
-        ).subscribe(element => {\r
-            var categ = new Category();\r
-            var unhashed_element=element;\r
-            var hashed_element = this.idl.toHash(element, false);\r
-            var found_library =  this.findLibrary(hashed_element.owning_lib)\r
-            categ.name=hashed_element.name;\r
-            categ.owning_lib= found_library.name;\r
-            categ.shortname=found_library.shortname;\r
-            categ.unhashed_element=unhashed_element;\r
-            this.locations.push(categ);\r
-        });\r
-        this.id_log=[];\r
-    }\r
-\r
-    /**\r
-     * Finds the Library name, using the library id.\r
-     * @param lib_id The id that is to be used to find the name.\r
-     */\r
-    findLibrary(lib_id){\r
-        var lib_name;\r
-        this.active_libraries.forEach(library=>{\r
-            if(library.id==lib_id){\r
-                lib_name= {\r
-                    name:library.name,\r
-                    shortname:library.shortname\r
-                };\r
-            }\r
-        })\r
-        return lib_name;\r
-    }\r
-\r
-    /**\r
-     * Starts from parent, logs id, looks for a specific key, checks to see if it has any children. If so\r
-     * rinse repeat.\r
-     * @param parent_node The uppermost parent node. \r
-     */\r
-    nodeTrailing(parent_node){\r
-        this.findParent(parent_node);\r
-    }\r
-\r
-    /**\r
-     * Creates a tree of the different library branches\r
-     * @param node The parent node, of which, the branches 'branch out'\r
-     */\r
-    createBranch(node){\r
-        this.lib_tree.push(node);\r
-        node.children.forEach(child => {\r
-            this.createBranch(child);\r
-        });\r
-    }\r
-\r
-    /**\r
-     * Checks if the node passed in has a parent node. If so, follow that branch, while saving the child nodes,\r
-     *  until the root node is found.\r
-     * @param node The node that is to be checked for a parent.\r
-     */\r
-    findParent(node){\r
-        this.id_log.push(node.id);\r
-        this.active_libraries.push(node);\r
-        var filteredTree= this.lib_tree.filter(branch=> branch.ou_type.depth<=(node.ou_type.depth-1)); //Creates a filtered branch\r
-        filteredTree.forEach(branch =>{\r
-            if\r
-            (\r
-                ( branch.id==node.parent_ou)\r
-                && this.isChild(branch.children, node)\r
-            )\r
-            {\r
-                this.findParent(branch);\r
-            }\r
-        })\r
-    }\r
-\r
-    /**\r
-     * Using the given parameters, checks if the 'node' passed is the parent of the 'children' parameter passed in.\r
-     * @param children The array of children nodes that is to be checked.\r
-     * @param node The assumed parent node.\r
-     */\r
-    isChild(children, node){\r
-        var names_are_equal = false;\r
-        children.forEach(child => {\r
-            if(child.shortname==node.shortname){\r
-                names_are_equal= true;\r
-            }                    \r
-        })\r
-        return names_are_equal;\r
-    }\r
-\r
-    onChange(object){\r
-        if(this.lib_tree.length==0){\r
-            this.createBranch(this.idl.toHash(object, false));\r
-        }\r
-        this.nodeTrailing(this.idl.toHash(object, false))\r
-        this.mappingLocation();\r
-    }\r
-\r
-    applyChanges(new_locations){\r
-        var library_locations=[];\r
-        new_locations.forEach(element => {\r
-            library_locations.push(element.unhashed_element)            \r
-        });\r
-        var library =this.pcrud.update(library_locations);   \r
-        \r
-        console.log(library.subscribe(object=> console.log(object)))     \r
-    }\r
-    \r
-  @HostListener('mousemove', ['$event'])\r
-  mouseMove($event: MouseEvent) {\r
-      this.mouse_y_position=$event.clientY;\r
-      this.mouse_x_position=$event.clientX;\r
-  }\r
-\r
-\r
-}\r
-\r
diff --git a/Open-ILS/src/eg2/src/app/staff/admin/local/copy-location/copy-location-order.component.html b/Open-ILS/src/eg2/src/app/staff/admin/local/copy-location/copy-location-order.component.html
new file mode 100644 (file)
index 0000000..00d9f85
--- /dev/null
@@ -0,0 +1,23 @@
+<div (mouseup)="disableMouseUp()" (mouseleave)="disableMouseUp()" [style.height.vh]="100">
+    <eg-staff-banner bannerText="Shelving Location Order" i18n-bannerText>
+    </eg-staff-banner>
+    <div>
+        <h3>Context Org Unit</h3>
+        <div [style.width.%]="30">
+            <eg-org-select domId="acpl" [applyDefault]="true" (onChange)="onChange($event)"></eg-org-select>            
+        </div>
+    </div>    
+    <p>To move an item, drag it up or down with the mouse.</p>
+    <ng-container *ngIf="locations && locations.length>0">
+        <table-list 
+        [content_list]="locations" 
+        [is_mouse_down]="detect_mouse_down"
+        (saveContent)="applyChanges($event)"
+        (toggleDragAndDrop)="toggleDragAndDrop($event)"   
+        (nodeIsSelected)="displaySelectedNode($event)" (detectMousePosition)="onMouseDown($event)"></table-list>
+    </ng-container>
+    <div *ngIf="detect_mouse_down && detect_mouse"
+    [ngStyle]="position_styling" 
+    [style.top.px]="mouse_y_position+25" 
+    [style.left.px]="mouse_x_position-75" >{{selected_node.name}} ({{selected_node.shortname}})</div>
+</div>
\ No newline at end of file
diff --git a/Open-ILS/src/eg2/src/app/staff/admin/local/copy-location/copy-location-order.component.ts b/Open-ILS/src/eg2/src/app/staff/admin/local/copy-location/copy-location-order.component.ts
new file mode 100644 (file)
index 0000000..cdf7360
--- /dev/null
@@ -0,0 +1,207 @@
+import {Component, OnInit, HostListener} from '@angular/core';
+import {PcrudService} from '@eg/core/pcrud.service';
+import {AuthService} from '@eg/core/auth.service';
+import {ToastService} from '@eg/share/toast/toast.service';
+import { IdlService } from '@eg/core/idl.service';
+
+class Category {
+    name:string;
+    owning_lib:string;
+    shortname:string;
+    unhashed_element:any;
+}
+
+@Component({
+    templateUrl: './copy-location-order.component.html'
+})
+
+export class CopyLocationOrderComponent implements OnInit {
+    orders:any;
+    locations:any;
+    id_log=[];
+    lib_tree=[];
+    active_libraries=[];
+    mouse_x_position:number;    
+    mouse_y_position:number;
+    detect_mouse_down=false;
+    detect_mouse = false;
+    selected_node:any;
+
+    position_styling={
+        backgroundColor:"white",
+        boxShadow:"5px 4px 10px 2px #5B5A5A",
+        textAlign:"center",
+        padding:"3px",
+        width:'80px',
+        position:'fixed',
+    }
+
+    constructor(
+        private pcrud: PcrudService,
+        private idl: IdlService,
+        private toast: ToastService,        
+        private auth: AuthService,
+    ) {
+    }
+
+    ngOnInit() {
+        //this.createTree();        
+        //this.filterGrid(this.auth.user().ws_ou());
+    };
+
+    detectMouseLeave(){
+        this.detect_mouse=false;
+    }
+
+    toggleDragAndDrop(toggle){
+
+        this.detect_mouse=toggle;
+    }
+
+    disableMouseUp(){   
+        this.detect_mouse_down=false;
+    }
+    onMouseDown(is_mouse_down){
+        this.detect_mouse_down=is_mouse_down;
+    }
+    
+
+    displaySelectedNode(node){
+        this.selected_node=node;
+    }
+
+    /**
+     * Initializes the search for the library tree and the array of the library locations.
+     * @param org The authorized user passed in during initialization.
+     */
+    filterGrid(org) {
+        // fetch the locations and order entries
+        if(!this.orders) {
+            this.pcrud.search('acplo', {org : org}, {order_by : {acplo : 'position'}})
+                .subscribe(elements => console.log("Order",elements));
+            this.mappingLocation();
+        }
+    }
+
+
+    /**
+     * Maps the values of the specified category to an array of objects, whose keys hold the necessary values.
+     */
+    mappingLocation(){       
+        this.locations=[];
+        this.pcrud.search('acpl',
+        {owning_lib:this.id_log, deleted : 'f'}
+        ).subscribe(element => {
+            var categ = new Category();
+            var unhashed_element=element;
+            var hashed_element = this.idl.toHash(element, false);
+            var found_library =  this.findLibrary(hashed_element.owning_lib)
+            categ.name=hashed_element.name;
+            categ.owning_lib= found_library.name;
+            categ.shortname=found_library.shortname;
+            categ.unhashed_element=unhashed_element;
+            this.locations.push(categ);
+        });
+        this.id_log=[];
+    }
+
+    /**
+     * Finds the Library name, using the library id.
+     * @param lib_id The id that is to be used to find the name.
+     */
+    findLibrary(lib_id){
+        var lib_name;
+        this.active_libraries.forEach(library=>{
+            if(library.id==lib_id){
+                lib_name= {
+                    name:library.name,
+                    shortname:library.shortname
+                };
+            }
+        })
+        return lib_name;
+    }
+
+    /**
+     * Starts from parent, logs id, looks for a specific key, checks to see if it has any children. If so
+     * rinse repeat.
+     * @param parent_node The uppermost parent node. 
+     */
+    nodeTrailing(parent_node){
+        this.findParent(parent_node);
+    }
+
+    /**
+     * Creates a tree of the different library branches
+     * @param node The parent node, of which, the branches 'branch out'
+     */
+    createBranch(node){
+        this.lib_tree.push(node);
+        node.children.forEach(child => {
+            this.createBranch(child);
+        });
+    }
+
+    /**
+     * Checks if the node passed in has a parent node. If so, follow that branch, while saving the child nodes,
+     *  until the root node is found.
+     * @param node The node that is to be checked for a parent.
+     */
+    findParent(node){
+        this.id_log.push(node.id);
+        this.active_libraries.push(node);
+        var filteredTree= this.lib_tree.filter(branch=> branch.ou_type.depth<=(node.ou_type.depth-1)); //Creates a filtered branch
+        filteredTree.forEach(branch =>{
+            if
+            (
+                ( branch.id==node.parent_ou)
+                && this.isChild(branch.children, node)
+            )
+            {
+                this.findParent(branch);
+            }
+        })
+    }
+
+    /**
+     * Using the given parameters, checks if the 'node' passed is the parent of the 'children' parameter passed in.
+     * @param children The array of children nodes that is to be checked.
+     * @param node The assumed parent node.
+     */
+    isChild(children, node){
+        var names_are_equal = false;
+        children.forEach(child => {
+            if(child.shortname==node.shortname){
+                names_are_equal= true;
+            }                    
+        })
+        return names_are_equal;
+    }
+
+    onChange(object){
+        if(this.lib_tree.length==0){
+            this.createBranch(this.idl.toHash(object, false));
+        }
+        this.nodeTrailing(this.idl.toHash(object, false))
+        this.mappingLocation();
+    }
+
+    applyChanges(new_locations){
+        var library_locations=[];
+        new_locations.forEach(element => {
+            library_locations.push(element.unhashed_element)            
+        });
+        var library =this.pcrud.update(library_locations);   
+        
+        console.log(library.subscribe(object=> console.log(object)))     
+    }
+    
+  @HostListener('mousemove', ['$event'])
+  mouseMove($event: MouseEvent) {
+      this.mouse_y_position=$event.clientY;
+      this.mouse_x_position=$event.clientX;
+  }
+
+
+}
+
diff --git a/Open-ILS/src/eg2/src/app/staff/admin/local/copy-location/copy-location-routing.module.ts b/Open-ILS/src/eg2/src/app/staff/admin/local/copy-location/copy-location-routing.module.ts
new file mode 100644 (file)
index 0000000..126f0b1
--- /dev/null
@@ -0,0 +1,15 @@
+import {NgModule} from '@angular/core';
+import {RouterModule, Routes} from '@angular/router';
+import {CopyLocationOrderComponent} from './copy-location-order.component';
+
+const routes: Routes = [{
+    path: '',
+    component: CopyLocationOrderComponent
+}];
+
+@NgModule({
+    imports: [RouterModule.forChild(routes)],
+    exports: [RouterModule]
+})
+
+export class CopyLocationRoutingModule {}
\ No newline at end of file
diff --git a/Open-ILS/src/eg2/src/app/staff/admin/local/copy-location/copy-location.module.ts b/Open-ILS/src/eg2/src/app/staff/admin/local/copy-location/copy-location.module.ts
new file mode 100644 (file)
index 0000000..442509e
--- /dev/null
@@ -0,0 +1,27 @@
+import {NgModule} from '@angular/core';
+import {AdminCommonModule} from '@eg/staff/admin/common.module';
+import {TreeModule} from '@eg/share/tree/tree.module';
+import {CopyLocationRoutingModule} from './copy-location-routing.module';
+import {CopyLocationOrderComponent} from './copy-location-order.component';
+import {TableListComponent} from '@eg/staff/admin/local/share/table-list.component';
+import {CardComponent} from '@eg/staff/admin/local/share/card.component';
+
+ @NgModule({
+    declarations: [
+        CopyLocationOrderComponent,
+        TableListComponent,
+        CardComponent
+    ],
+    imports: [
+        AdminCommonModule,
+        CopyLocationRoutingModule,
+        TreeModule
+    ],
+    exports: [
+    ],
+    providers: [
+    ]
+})
+
+export class CopyLocationModule {
+}
\ No newline at end of file
index 865fd7e..41625af 100644 (file)
@@ -5,7 +5,6 @@ import {BasicAdminPageComponent} from '@eg/staff/admin/basic-admin-page.componen
 import {AddressAlertComponent} from './address-alert.component';
 import {AdminCarouselComponent} from './admin-carousel.component';
 import {StandingPenaltyComponent} from './standing-penalty.component';
-import {CopyLocationOrderComponent} from './copy-location-order.component';
 
 const routes: Routes = [{
     path: 'splash',
@@ -25,7 +24,7 @@ const routes: Routes = [{
     component: StandingPenaltyComponent
 }, {
     path: 'asset/copy_location_order',
-    component: CopyLocationOrderComponent
+    loadChildren: '@eg/staff/admin/local/copy-location/copy-location.module#CopyLocationModule'
 }, {
     path: ':schema/:table',
     component: BasicAdminPageComponent
index 440bae9..57686e3 100644 (file)
@@ -1,5 +1,3 @@
-\r
-\r
 <div [ngStyle]="table_container">\r
     <div [ngStyle]="card_container" (mouseleave)="onMouseLeave()" (mouseenter)="onMouseEnter()">        \r
         <button class="btn btn-lg" (click)="applyChanges()" [ngStyle]="button_style">Apply Changes?</button>\r
@@ -14,4 +12,4 @@
     </div>\r
     <div>\r
     </div>\r
-</div>\r
+</div>
\ No newline at end of file