gui CHANGE rewrite list and leaf-list manipulation

To prepare for ordering, group list and leaf-list instances together
when displaying (providing them from backend) and also in manipulating
(creating, deleting in frontend)
diff --git a/frontend/config/tree.component.ts b/frontend/config/tree.component.ts
index bcb4da4..2810095 100644
--- a/frontend/config/tree.component.ts
+++ b/frontend/config/tree.component.ts
@@ -5,7 +5,7 @@
 import {Schema} from '../inventory/schema';
 import {ModificationsService} from './modifications.service';
 import {SessionsService} from './sessions.service';
-import {TreeService} from './config.component';
+import {TreeService} from './tree.service';
 import {SchemasService} from '../yang/schemas.service';
 
 @Directive({
@@ -60,10 +60,11 @@
     }
 
     closeCreatingDialog(node, reason='abort') {
-        this.modsService.createClose(node, reason);
+        this.modsService.createClose(this.activeSession, node, reason);
     }
 
     creatingDialogSelect(node, index, source) {
+        console.log(node)
         this.modsService.create(this.activeSession, node, index);
         this.sessionsService.storeData();
         if (('schemaChildren' in node) && node['schemaChildren'].length) {
@@ -85,7 +86,9 @@
     activeSession: Session;
     private timeout;
 
-    constructor(private modsService: ModificationsService, private sessionsService: SessionsService) {}
+    constructor(private treeService: TreeService,
+                private modsService: ModificationsService,
+                private sessionsService: SessionsService) {}
 
     ngOnInit(): void {
         this.activeSession = this.sessionsService.getActiveSession();
@@ -119,36 +122,31 @@
         menu.style.visibility = "hidden";
     }
 
-    deleteSubtree(node, value = null) {
-        this.modsService.delete(this.activeSession, node, value);
+    deleteSubtree(node) {
+        let rmlist = [];
+        if (node['info']['type'] == 8) {
+            rmlist = this.treeService.nodesToShow(this.activeSession, node);
+        } else {
+            rmlist.push(node);
+        }
+        for (let item of rmlist) {
+            this.modsService.delete(this.activeSession, item);
+        }
         this.sessionsService.storeData();
     }
 
-    /* 0 - not deleted, 1 - deleted value, 2 - deleted all values */
-    isDeleted(): number {
-        if ('deleted' in this.node) {
-            if (typeof this.node['deleted'] === 'boolean') {
-                if (this.node['deleted']) {
-                    return 2;
-                } else {
-                    return 0;
-                }
-            } else if (this.value) {
-                if (this.node['deleted'].indexOf(this.value) != -1) {
-                    return 1;
-                }
-            }
-        }
-        return 0;
+    deleteInstance(node) {
+        this.modsService.delete(this.activeSession, node);
+        this.sessionsService.storeData();
     }
 
     openCreatingDialog(element, node, parent = false) {
         if (parent) {
-            node = this.modsService.nodeParent(this.activeSession, node);
+            node = this.treeService.nodeParent(this.activeSession, node);
         }
         if (!('creatingChild' in node)) {
             this.sessionsService.childrenSchemas(this.activeSession.key, node['info']['path'], node).then(result => {
-                this.modsService.createOpen(result, node);
+                this.modsService.createOpen(this.activeSession, result, node);
             });
         } else if (element){
             /* scroll to the existing element */
@@ -157,7 +155,7 @@
     }
 
     closeCreatingDialog(node, reason='abort') {
-        this.modsService.createClose(node, reason);
+        this.modsService.createClose(this.activeSession, node, reason);
     }
 
     cancelModification(node, value = null) {
@@ -172,15 +170,15 @@
 }
 
 @Component({
-    selector: 'tree-view',
-    templateUrl: './tree.component.html',
+    selector: 'tree-node',
+    templateUrl: './tree-node.html',
     styleUrls: ['./tree.component.scss']
 })
 
-export class TreeView implements OnInit {
+export class TreeNode {
     @Input() node;
     @Input() indentation;
-    activeSession: Session;
+    @Input() activeSession: Session;
 
     constructor(private modsService: ModificationsService,
                 private sessionsService: SessionsService,
@@ -189,10 +187,6 @@
                 private changeDetector: ChangeDetectorRef,
                 private router: Router) {}
 
-    ngOnInit(): void {
-        this.activeSession = this.sessionsService.getActiveSession();
-    }
-
     inheritIndentation(node) {
         let newIndent;
         if (node['last']) {
@@ -269,7 +263,7 @@
 
     changeValue(node, target) {
         let input;
-        if (target.classList.contains('value')) {
+        if (target.classList.contains('value_inline')) {
             if (target.classList.contains('invalid')) {
                 return;
             }
@@ -279,7 +273,7 @@
         }
 
         if (node['info']['type'] == 8) {
-            this.modsService.change(this.activeSession, node, [input.value]);
+            this.modsService.change(this.activeSession, node, input.value);
         } else {
             this.modsService.change(this.activeSession, node, input.value);
         }
@@ -331,3 +325,23 @@
         }
     }
 }
+
+@Component({
+    selector: 'tree-view',
+    templateUrl: './tree.component.html',
+    styleUrls: ['./tree.component.scss']
+})
+
+export class TreeView implements OnInit {
+    @Input() node;
+    @Input() indentation;
+    activeSession: Session;
+
+    constructor(private sessionsService: SessionsService,
+                private treeService: TreeService) {}
+
+    ngOnInit(): void {
+        this.activeSession = this.sessionsService.getActiveSession();
+    }
+}
+