From 6cc790af191594875db720f2c962d8fcc8758fc3 Mon Sep 17 00:00:00 2001
From: shb0527 <111919818+shb0527@users.noreply.github.com>
Date: Mon, 15 Jul 2024 17:17:01 -0600
Subject: [PATCH 1/7] updates on angular 18
---
.../download-graph.component.html | 7 ++--
.../download-graph.component.ts | 36 +++++++++++++++++--
.../info-editor/info-editor.component.html | 4 ++-
.../app/info-editor/info-editor.component.ts | 15 ++++++--
.../src/app/metadata.service.ts | 9 ++++-
5 files changed, 63 insertions(+), 8 deletions(-)
diff --git a/SBOLCanvasFrontend/src/app/download-graph/download-graph.component.html b/SBOLCanvasFrontend/src/app/download-graph/download-graph.component.html
index c43fcea5..1ddcab32 100644
--- a/SBOLCanvasFrontend/src/app/download-graph/download-graph.component.html
+++ b/SBOLCanvasFrontend/src/app/download-graph/download-graph.component.html
@@ -6,7 +6,8 @@
Download
Server
+ (selectionChange)="setRegistry($event.value)" value="{{registry}}">
+
{{registry}}
@@ -28,7 +29,7 @@ Download
Collection
- Root Collections
+ {{collection}}
{{collection.name}}
@@ -106,6 +107,8 @@ Download
+
+
diff --git a/SBOLCanvasFrontend/src/app/download-graph/download-graph.component.ts b/SBOLCanvasFrontend/src/app/download-graph/download-graph.component.ts
index 129f31a0..c0841878 100644
--- a/SBOLCanvasFrontend/src/app/download-graph/download-graph.component.ts
+++ b/SBOLCanvasFrontend/src/app/download-graph/download-graph.component.ts
@@ -65,6 +65,16 @@ export class DownloadGraphComponent implements OnInit {
constructor(@Inject(MAT_DIALOG_DATA) public data: any, private dialog: MatDialog, private metadataService: MetadataService, private graphService: GraphService, private filesService: FilesService, private loginService: LoginService, public dialogRef: MatDialogRef) { }
ngOnInit() {
+
+ if (this.metadataService.getSavedRegistry() !== undefined) this.registry = this.metadataService.getSavedRegistry()
+ if (this.metadataService.getSavedCollection() !== undefined) {
+ this.collection = this.metadataService.getSavedCollection().collection
+ this.history = this.metadataService.getSavedCollection().history
+ } else {
+ this.collection = ""
+ this.history = []
+ }
+
this.working = true;
if (this.data != null) {
if (this.data.mode != null) {
@@ -112,8 +122,8 @@ export class DownloadGraphComponent implements OnInit {
}
this.updateParts();
this.parts.sort = this.sort;
- this.history = [];
- this.collection = "";
+ // this.history = [];
+ // this.collection = "";
}
loginDisabled(): boolean {
@@ -130,6 +140,7 @@ export class DownloadGraphComponent implements OnInit {
setRegistry(registry: string) {
this.registry = registry;
+ localStorage.setItem('1registry', this.registry)
this.updateParts();
}
@@ -174,6 +185,7 @@ export class DownloadGraphComponent implements OnInit {
// only allowed to get here when there is one item selected, and it's a collection
let row = this.selection.selected[0];
this.history.push(row);
+
this.selection.clear();
this.updateParts();
}
@@ -214,6 +226,7 @@ export class DownloadGraphComponent implements OnInit {
if (row.type === DownloadGraphComponent.collectionType) {
this.collection = row.uri;
}
+ localStorage.setItem('3collection', row.uri);
this.selection.toggle(row);
}
@@ -224,6 +237,7 @@ export class DownloadGraphComponent implements OnInit {
if (row.type === DownloadGraphComponent.collectionType) {
this.history.push(row);
this.collection = row.uri;
+ localStorage.setItem('3collection', row.uri);
this.selection.clear();
this.updateParts();
} else if (row.type === DownloadGraphComponent.componentType) {
@@ -313,7 +327,25 @@ export class DownloadGraphComponent implements OnInit {
this.updateParts();
}
+ reset(){
+
+ localStorage.clear()
+ this.collection= ''
+ this.registry = ''
+ this.history = []
+}
+
updateParts() {
+
+
+ if(localStorage.getItem('1registry') != null && localStorage.getItem('1registry').length > 0)
+ this.registry = localStorage.getItem('1registry')
+
+ if(localStorage.getItem('3collection') != null && localStorage.getItem('3collection').length > 0)
+ {
+ this.collection = localStorage.getItem('3collection')
+ }
+
if (this.partRequest && !this.partRequest.closed) {
this.partRequest.unsubscribe();
}
diff --git a/SBOLCanvasFrontend/src/app/info-editor/info-editor.component.html b/SBOLCanvasFrontend/src/app/info-editor/info-editor.component.html
index 31c94386..1422fba1 100644
--- a/SBOLCanvasFrontend/src/app/info-editor/info-editor.component.html
+++ b/SBOLCanvasFrontend/src/app/info-editor/info-editor.component.html
@@ -34,7 +34,9 @@
Display ID
-
+
+ This field is required
+
diff --git a/SBOLCanvasFrontend/src/app/info-editor/info-editor.component.ts b/SBOLCanvasFrontend/src/app/info-editor/info-editor.component.ts
index 58b8bddb..47b42b5d 100644
--- a/SBOLCanvasFrontend/src/app/info-editor/info-editor.component.ts
+++ b/SBOLCanvasFrontend/src/app/info-editor/info-editor.component.ts
@@ -11,7 +11,7 @@ import { ModuleInfo } from '../moduleInfo';
import { environment } from 'src/environments/environment';
import { CombinatorialDesignEditorComponent } from '../combinatorial-design-editor/combinatorial-design-editor.component';
// import { ThrowStmt } from '@angular/compiler';
-
+import { FormControl, Validators } from '@angular/forms';
@Component({
selector: 'app-info-editor',
@@ -39,6 +39,8 @@ export class InfoEditorComponent implements OnInit {
glyphInfo: GlyphInfo;
moduleInfo: ModuleInfo;
interactionInfo: InteractionInfo;
+ glyphCtrl: FormControl;
+
constructor(private graphService: GraphService, private metadataService: MetadataService, private filesService: FilesService, public dialog: MatDialog, private changeDetector: ChangeDetectorRef) { }
@@ -51,6 +53,9 @@ export class InfoEditorComponent implements OnInit {
this.getRoles();
this.getInteractions();
this.getInteractionRoles();
+
+
+
}
getTypes() {
@@ -59,6 +64,7 @@ export class InfoEditorComponent implements OnInit {
getRoles() {
this.metadataService.loadRoles().subscribe(roles => this.partRoles = roles);
+
}
getRefinements(role: string) {
@@ -131,13 +137,16 @@ export class InfoEditorComponent implements OnInit {
}
}
+
+
inputChange(event: any) {
const id = event.target.id;
-
+ console.log("displayID:" , this.glyphInfo.displayID);
switch (id) {
case 'displayID': {
const replaced = event.target.value.replace(/[\W_]+/g, '_');
if (this.glyphInfo != null) {
+
this.glyphInfo.displayID = replaced;
} else if (this.interactionInfo != null) {
this.interactionInfo.displayID = replaced;
@@ -213,6 +222,8 @@ export class InfoEditorComponent implements OnInit {
*/
glyphInfoUpdated(glyphInfo: GlyphInfo) {
this.glyphInfo = glyphInfo;
+
+ this.glyphCtrl = new FormControl( `${this.glyphInfo.displayID}`, Validators.required);
if (glyphInfo != null) {
if (glyphInfo.partRole != null) {
this.getRefinements(glyphInfo.partRole);
diff --git a/SBOLCanvasFrontend/src/app/metadata.service.ts b/SBOLCanvasFrontend/src/app/metadata.service.ts
index 6c4f9c73..4c222adf 100644
--- a/SBOLCanvasFrontend/src/app/metadata.service.ts
+++ b/SBOLCanvasFrontend/src/app/metadata.service.ts
@@ -65,11 +65,18 @@ export class MetadataService {
// Definition cannot have multiple strands.
private componentDefinitionModeSource = new BehaviorSubject(null);
componentDefinitionMode = this.componentDefinitionModeSource.asObservable();
-
+ private savedRegistry: string;
+ private savedCollection: { collection: string, history: Array
-
+
+
Part role
Download
+
diff --git a/SBOLCanvasFrontend/src/app/download-graph/download-graph.component.ts b/SBOLCanvasFrontend/src/app/download-graph/download-graph.component.ts
index c0841878..7bcb9f5d 100644
--- a/SBOLCanvasFrontend/src/app/download-graph/download-graph.component.ts
+++ b/SBOLCanvasFrontend/src/app/download-graph/download-graph.component.ts
@@ -237,7 +237,7 @@ export class DownloadGraphComponent implements OnInit {
if (row.type === DownloadGraphComponent.collectionType) {
this.history.push(row);
this.collection = row.uri;
- localStorage.setItem('3collection', row.uri);
+ localStorage.setItem('3collection_history', JSON.stringify(this.history));
this.selection.clear();
this.updateParts();
} else if (row.type === DownloadGraphComponent.componentType) {
@@ -341,9 +341,12 @@ export class DownloadGraphComponent implements OnInit {
if(localStorage.getItem('1registry') != null && localStorage.getItem('1registry').length > 0)
this.registry = localStorage.getItem('1registry')
- if(localStorage.getItem('3collection') != null && localStorage.getItem('3collection').length > 0)
+ if(localStorage.getItem('3collection_history') != null && localStorage.getItem('3collection_history').length > 0)
{
- this.collection = localStorage.getItem('3collection')
+ let collection_history = localStorage.getItem('3collection_history')
+ let historyArray = JSON.parse(collection_history);
+ //this.collection = localStorage.getItem('3collection');
+ this.history = historyArray;
}
if (this.partRequest && !this.partRequest.closed) {
From 5eb46b39984b2dd1cf93ff5636ad40fb18e80a81 Mon Sep 17 00:00:00 2001
From: shb0527 <111919818+shb0527@users.noreply.github.com>
Date: Wed, 17 Jul 2024 19:35:17 -0600
Subject: [PATCH 3/7] collection history modification
---
SBOLCanvasFrontend/angular.json | 3 +++
.../download-graph/download-graph.component.ts | 15 ++++++++++++---
2 files changed, 15 insertions(+), 3 deletions(-)
diff --git a/SBOLCanvasFrontend/angular.json b/SBOLCanvasFrontend/angular.json
index 184db74a..b7df9643 100644
--- a/SBOLCanvasFrontend/angular.json
+++ b/SBOLCanvasFrontend/angular.json
@@ -156,5 +156,8 @@
}
}
}
+ },
+ "cli": {
+ "analytics": "fb43b5e9-1232-45bc-9d12-26caf05409f2"
}
}
diff --git a/SBOLCanvasFrontend/src/app/download-graph/download-graph.component.ts b/SBOLCanvasFrontend/src/app/download-graph/download-graph.component.ts
index 7bcb9f5d..9fd640c5 100644
--- a/SBOLCanvasFrontend/src/app/download-graph/download-graph.component.ts
+++ b/SBOLCanvasFrontend/src/app/download-graph/download-graph.component.ts
@@ -226,7 +226,6 @@ export class DownloadGraphComponent implements OnInit {
if (row.type === DownloadGraphComponent.collectionType) {
this.collection = row.uri;
}
- localStorage.setItem('3collection', row.uri);
this.selection.toggle(row);
}
@@ -238,6 +237,7 @@ export class DownloadGraphComponent implements OnInit {
this.history.push(row);
this.collection = row.uri;
localStorage.setItem('3collection_history', JSON.stringify(this.history));
+
this.selection.clear();
this.updateParts();
} else if (row.type === DownloadGraphComponent.componentType) {
@@ -313,13 +313,23 @@ export class DownloadGraphComponent implements OnInit {
changeCollection(collection: string) {
this.selection.clear();
let found = false;
+ let index;
for (let i = 0; i < this.history.length; i++) {
- if (this.history[i] === collection) {
+
+ if (this.history[i].uri === collection) {
this.history.length = i + 1;
found = true;
+ index = i;
break;
}
+
}
+ if(found){
+ this.history = this.history.filter((_, i)=> i <= index);
+ localStorage.setItem('3collection_history', JSON.stringify(this.history));
+ }
+
+
if (!found)
this.history.length = 0;
this.collection = collection;
@@ -345,7 +355,6 @@ export class DownloadGraphComponent implements OnInit {
{
let collection_history = localStorage.getItem('3collection_history')
let historyArray = JSON.parse(collection_history);
- //this.collection = localStorage.getItem('3collection');
this.history = historyArray;
}
From 09d8eb3b913f61dc51fb0e7380e435226792397e Mon Sep 17 00:00:00 2001
From: shb0527 <111919818+shb0527@users.noreply.github.com>
Date: Thu, 18 Jul 2024 16:54:17 -0600
Subject: [PATCH 4/7] collection remove duplicates
---
.../download-graph.component.ts | 32 +++++++++++++++++--
.../app/info-editor/info-editor.component.ts | 2 +-
2 files changed, 30 insertions(+), 4 deletions(-)
diff --git a/SBOLCanvasFrontend/src/app/download-graph/download-graph.component.ts b/SBOLCanvasFrontend/src/app/download-graph/download-graph.component.ts
index 9fd640c5..cd24895b 100644
--- a/SBOLCanvasFrontend/src/app/download-graph/download-graph.component.ts
+++ b/SBOLCanvasFrontend/src/app/download-graph/download-graph.component.ts
@@ -315,14 +315,12 @@ export class DownloadGraphComponent implements OnInit {
let found = false;
let index;
for (let i = 0; i < this.history.length; i++) {
-
if (this.history[i].uri === collection) {
this.history.length = i + 1;
found = true;
index = i;
break;
}
-
}
if(found){
this.history = this.history.filter((_, i)=> i <= index);
@@ -332,11 +330,35 @@ export class DownloadGraphComponent implements OnInit {
if (!found)
this.history.length = 0;
- this.collection = collection;
+ this.collection = collection;
this.updateParts();
}
+ checkForDuplicateCollection(){
+
+ let seen = [];
+ let namesArray = [];
+
+ for(let i = 0; i < this.history.length; i++){
+ namesArray.push(this.history[i].name);
+ }
+
+ for(let i = 0; i < namesArray.length; i++){
+ let value = namesArray[i];
+ let index = 0;
+ if(seen.indexOf(value) !== -1){
+ index = seen.indexOf(value);
+ this.history = this.history.filter((_, x)=> x >= i);
+ localStorage.setItem('3collection_history', JSON.stringify(this.history));
+
+ }
+ seen.push(value);
+ }
+
+
+ }
+
reset(){
localStorage.clear()
@@ -353,10 +375,14 @@ export class DownloadGraphComponent implements OnInit {
if(localStorage.getItem('3collection_history') != null && localStorage.getItem('3collection_history').length > 0)
{
+
let collection_history = localStorage.getItem('3collection_history')
let historyArray = JSON.parse(collection_history);
this.history = historyArray;
}
+
+
+ this.checkForDuplicateCollection();
if (this.partRequest && !this.partRequest.closed) {
this.partRequest.unsubscribe();
diff --git a/SBOLCanvasFrontend/src/app/info-editor/info-editor.component.ts b/SBOLCanvasFrontend/src/app/info-editor/info-editor.component.ts
index 47b42b5d..121aef51 100644
--- a/SBOLCanvasFrontend/src/app/info-editor/info-editor.component.ts
+++ b/SBOLCanvasFrontend/src/app/info-editor/info-editor.component.ts
@@ -141,7 +141,7 @@ export class InfoEditorComponent implements OnInit {
inputChange(event: any) {
const id = event.target.id;
- console.log("displayID:" , this.glyphInfo.displayID);
+
switch (id) {
case 'displayID': {
const replaced = event.target.value.replace(/[\W_]+/g, '_');
From c4819aee9d9a53f1b6e2cec62faac200445abf19 Mon Sep 17 00:00:00 2001
From: shb0527 <111919818+shb0527@users.noreply.github.com>
Date: Fri, 19 Jul 2024 15:43:20 -0600
Subject: [PATCH 5/7] update collection
---
.../download-graph.component.html | 2 +-
.../download-graph.component.ts | 35 +++++++++++++++----
SBOLCanvasFrontend/src/app/files.service.ts | 3 ++
3 files changed, 32 insertions(+), 8 deletions(-)
diff --git a/SBOLCanvasFrontend/src/app/download-graph/download-graph.component.html b/SBOLCanvasFrontend/src/app/download-graph/download-graph.component.html
index f7a9501b..fbaf26f8 100644
--- a/SBOLCanvasFrontend/src/app/download-graph/download-graph.component.html
+++ b/SBOLCanvasFrontend/src/app/download-graph/download-graph.component.html
@@ -28,7 +28,7 @@ Download
Collection
- Root collection
+ Root collection
{{collection.name}}
diff --git a/SBOLCanvasFrontend/src/app/download-graph/download-graph.component.ts b/SBOLCanvasFrontend/src/app/download-graph/download-graph.component.ts
index cd24895b..be4cf49e 100644
--- a/SBOLCanvasFrontend/src/app/download-graph/download-graph.component.ts
+++ b/SBOLCanvasFrontend/src/app/download-graph/download-graph.component.ts
@@ -236,6 +236,7 @@ export class DownloadGraphComponent implements OnInit {
if (row.type === DownloadGraphComponent.collectionType) {
this.history.push(row);
this.collection = row.uri;
+ localStorage.setItem('3collection', this.collection);
localStorage.setItem('3collection_history', JSON.stringify(this.history));
this.selection.clear();
@@ -311,7 +312,15 @@ export class DownloadGraphComponent implements OnInit {
}
changeCollection(collection: string) {
+
+
+ if(collection === ""){
+ this.collection = "";
+ localStorage.setItem("3collection", this.collection);
+ }
+
this.selection.clear();
+
let found = false;
let index;
for (let i = 0; i < this.history.length; i++) {
@@ -324,6 +333,8 @@ export class DownloadGraphComponent implements OnInit {
}
if(found){
this.history = this.history.filter((_, i)=> i <= index);
+ this.collection = this.history[index].uri;
+ localStorage.setItem('3collection', this.collection);
localStorage.setItem('3collection_history', JSON.stringify(this.history));
}
@@ -348,17 +359,22 @@ export class DownloadGraphComponent implements OnInit {
let value = namesArray[i];
let index = 0;
if(seen.indexOf(value) !== -1){
+
index = seen.indexOf(value);
this.history = this.history.filter((_, x)=> x >= i);
+ this.collection = this.history[index].uri;
+ localStorage.setItem('3collection', this.collection);
localStorage.setItem('3collection_history', JSON.stringify(this.history));
}
seen.push(value);
}
-
}
-
+ collectionReset(){
+ this.collection = "";
+ localStorage.setItem('3collection', this.collection);
+ }
reset(){
localStorage.clear()
@@ -367,23 +383,26 @@ export class DownloadGraphComponent implements OnInit {
this.history = []
}
- updateParts() {
+collectionreset(){
+ this.selection.clear();
+}
-
+ updateParts() {
if(localStorage.getItem('1registry') != null && localStorage.getItem('1registry').length > 0)
this.registry = localStorage.getItem('1registry')
if(localStorage.getItem('3collection_history') != null && localStorage.getItem('3collection_history').length > 0)
{
-
let collection_history = localStorage.getItem('3collection_history')
let historyArray = JSON.parse(collection_history);
this.history = historyArray;
}
-
+ if(localStorage.getItem('3collection') != null && localStorage.getItem('3collection').length > 0)
+ this.collection = localStorage.getItem('3collection')
- this.checkForDuplicateCollection();
+ this.checkForDuplicateCollection();
+
if (this.partRequest && !this.partRequest.closed) {
this.partRequest.unsubscribe();
}
@@ -399,8 +418,10 @@ export class DownloadGraphComponent implements OnInit {
this.filesService.listParts(this.loginService.users[this.registry], this.registry, this.collection, this.partType, roleOrRefine, "components")
).subscribe(parts => {
let partCache = [];
+
parts[0].forEach(part => {
part.type = DownloadGraphComponent.collectionType;
+ //console.log("parts.............", part);
partCache.push(part);
});
parts[1].forEach(part => {
diff --git a/SBOLCanvasFrontend/src/app/files.service.ts b/SBOLCanvasFrontend/src/app/files.service.ts
index 0b3e437a..fd7230e0 100644
--- a/SBOLCanvasFrontend/src/app/files.service.ts
+++ b/SBOLCanvasFrontend/src/app/files.service.ts
@@ -158,10 +158,13 @@ export class FilesService {
headers = headers.set("Authorization", user);
let params = new HttpParams();
params = params.append("server", server);
+
if (collection != null && collection.length > 0)
params = params.append("collection", collection);
+
if (type != null && type.length > 0)
params = params.append("type", type);
+
if (role != null && role.length > 0)
params = params.append("role", role);
params = params.append("mode", mode);
From 12ed04b2862d4f3fe42ceb64d051100f9c0a5413 Mon Sep 17 00:00:00 2001
From: shb0527 <111919818+shb0527@users.noreply.github.com>
Date: Fri, 19 Jul 2024 15:51:19 -0600
Subject: [PATCH 6/7] delete lines
---
.../src/app/download-graph/download-graph.component.ts | 8 +-------
1 file changed, 1 insertion(+), 7 deletions(-)
diff --git a/SBOLCanvasFrontend/src/app/download-graph/download-graph.component.ts b/SBOLCanvasFrontend/src/app/download-graph/download-graph.component.ts
index be4cf49e..e75fb9f2 100644
--- a/SBOLCanvasFrontend/src/app/download-graph/download-graph.component.ts
+++ b/SBOLCanvasFrontend/src/app/download-graph/download-graph.component.ts
@@ -371,10 +371,7 @@ export class DownloadGraphComponent implements OnInit {
}
}
- collectionReset(){
- this.collection = "";
- localStorage.setItem('3collection', this.collection);
- }
+
reset(){
localStorage.clear()
@@ -383,9 +380,6 @@ export class DownloadGraphComponent implements OnInit {
this.history = []
}
-collectionreset(){
- this.selection.clear();
-}
updateParts() {
if(localStorage.getItem('1registry') != null && localStorage.getItem('1registry').length > 0)
From 670f8bf4345f1299d508c255a498879309477f09 Mon Sep 17 00:00:00 2001
From: shb0527 <111919818+shb0527@users.noreply.github.com>
Date: Fri, 19 Jul 2024 17:50:01 -0600
Subject: [PATCH 7/7] not allow empty input
---
.../src/app/info-editor/info-editor.component.ts | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/SBOLCanvasFrontend/src/app/info-editor/info-editor.component.ts b/SBOLCanvasFrontend/src/app/info-editor/info-editor.component.ts
index 121aef51..fbd58161 100644
--- a/SBOLCanvasFrontend/src/app/info-editor/info-editor.component.ts
+++ b/SBOLCanvasFrontend/src/app/info-editor/info-editor.component.ts
@@ -11,6 +11,7 @@ import { ModuleInfo } from '../moduleInfo';
import { environment } from 'src/environments/environment';
import { CombinatorialDesignEditorComponent } from '../combinatorial-design-editor/combinatorial-design-editor.component';
// import { ThrowStmt } from '@angular/compiler';
+
import { FormControl, Validators } from '@angular/forms';
@Component({
@@ -138,7 +139,6 @@ export class InfoEditorComponent implements OnInit {
}
-
inputChange(event: any) {
const id = event.target.id;
@@ -146,8 +146,10 @@ export class InfoEditorComponent implements OnInit {
case 'displayID': {
const replaced = event.target.value.replace(/[\W_]+/g, '_');
if (this.glyphInfo != null) {
-
- this.glyphInfo.displayID = replaced;
+ if(replaced !== ''){
+ //this.promptDisplayID();
+ this.glyphInfo.displayID = replaced;
+ }
} else if (this.interactionInfo != null) {
this.interactionInfo.displayID = replaced;
} else if (this.moduleInfo) {