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.html b/SBOLCanvasFrontend/src/app/download-graph/download-graph.component.html
index c43fcea5..fbaf26f8 100644
--- a/SBOLCanvasFrontend/src/app/download-graph/download-graph.component.html
+++ b/SBOLCanvasFrontend/src/app/download-graph/download-graph.component.html
@@ -6,7 +6,7 @@
Download
Server
+ (selectionChange)="setRegistry($event.value)" value="{{registry}}">
{{registry}}
@@ -28,13 +28,14 @@ Download
Collection
- Root Collections
+ Root collection
{{collection.name}}
-
+
+
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 129f31a0..e75fb9f2 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();
}
@@ -224,6 +236,9 @@ 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();
this.updateParts();
} else if (row.type === DownloadGraphComponent.componentType) {
@@ -297,23 +312,91 @@ 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++) {
- 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);
+ this.collection = this.history[index].uri;
+ localStorage.setItem('3collection', this.collection);
+ localStorage.setItem('3collection_history', JSON.stringify(this.history));
+ }
+
+
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);
+ this.collection = this.history[index].uri;
+ localStorage.setItem('3collection', this.collection);
+ localStorage.setItem('3collection_history', JSON.stringify(this.history));
+
+ }
+ seen.push(value);
+ }
+
+ }
+
+ 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_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();
+
if (this.partRequest && !this.partRequest.closed) {
this.partRequest.unsubscribe();
}
@@ -329,8 +412,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);
diff --git a/SBOLCanvasFrontend/src/app/info-editor/info-editor.component.html b/SBOLCanvasFrontend/src/app/info-editor/info-editor.component.html
index 11b1475c..5081f660 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..fbd58161 100644
--- a/SBOLCanvasFrontend/src/app/info-editor/info-editor.component.ts
+++ b/SBOLCanvasFrontend/src/app/info-editor/info-editor.component.ts
@@ -12,6 +12,7 @@ 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 +40,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 +54,9 @@ export class InfoEditorComponent implements OnInit {
this.getRoles();
this.getInteractions();
this.getInteractionRoles();
+
+
+
}
getTypes() {
@@ -59,6 +65,7 @@ export class InfoEditorComponent implements OnInit {
getRoles() {
this.metadataService.loadRoles().subscribe(roles => this.partRoles = roles);
+
}
getRefinements(role: string) {
@@ -131,14 +138,18 @@ export class InfoEditorComponent implements OnInit {
}
}
+
inputChange(event: any) {
const id = event.target.id;
-
+
switch (id) {
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) {
@@ -213,6 +224,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