Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add save to file functionality. #50

Merged
merged 39 commits into from
Jun 1, 2021
Merged
Show file tree
Hide file tree
Changes from 20 commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
a1e331d
Add save to file functionality.
duckonomy Apr 8, 2021
d8ca261
Improve project save.
duckonomy Apr 21, 2021
f700060
Remove unnecessary logs.
duckonomy Apr 21, 2021
1ff2a99
Change Import to Export.
duckonomy Apr 21, 2021
257c81d
Cleanup and fix routing.
duckonomy Apr 23, 2021
47a6d26
Add delete files and better export dialog
duckonomy Apr 26, 2021
53ebebb
Make name consistent.
duckonomy Apr 26, 2021
5ef2ae3
Fix exportMap name
duckonomy Apr 26, 2021
04d32e3
Fix project deletion/change.
duckonomy Apr 27, 2021
33a4801
Fix confirmation for project delete in welcome page.
duckonomy Apr 30, 2021
e54769f
Add arbitrary file saving instead of just uuid.
duckonomy Apr 30, 2021
082ebad
Remove logs.
duckonomy Apr 30, 2021
b138bb6
Change fileSuffix to fileName.
duckonomy May 14, 2021
c68a12a
Suggested fixes.
duckonomy May 14, 2021
45417af
Show DesignSafe project name in Linked Projects and truncate long names.
duckonomy May 14, 2021
eeb8db4
Update active project on link creation.
duckonomy May 17, 2021
8211094
Combine link and export.
duckonomy May 17, 2021
7c32c79
Prepopulate uuid in project link modal.
duckonomy May 17, 2021
22d9afc
Refactor export function.
duckonomy May 17, 2021
3479b70
Adjust welcome project list width.
duckonomy May 17, 2021
9c8eae7
Remove unused function in file browser.
duckonomy May 19, 2021
b135369
Fix column width.
duckonomy May 19, 2021
1e9578b
Stop spinner when no projects exist.
duckonomy May 19, 2021
82d176b
Organization user-panel buttons.
duckonomy May 19, 2021
0e645d2
Merge branch 'master' into task/DES-1929-save-to-file
duckonomy May 19, 2021
30c6cf6
Merge branch 'master' into task/DES-1929-save-to-file
duckonomy May 19, 2021
8420411
Correct project link.
duckonomy May 19, 2021
27893f1
Add tiles for observable projects.
duckonomy May 19, 2021
f431d60
Correct project path link.
duckonomy May 19, 2021
8c22531
Remove from project list after project deletion.
duckonomy May 19, 2021
db8b2c7
Fetch DS project information locally.
duckonomy May 20, 2021
9e68648
Merge branch 'task/DES-1929-save-to-file' of https://github.com/TACC-…
duckonomy May 20, 2021
ea4632f
Remove comment section.
duckonomy May 20, 2021
8a13b6e
Add saved location in welcome list.
duckonomy May 24, 2021
f304d5b
Organize manage panel with tabs.
duckonomy May 26, 2021
0dd878a
Add copy text feature.
duckonomy May 27, 2021
0998d10
Handle error when project undefined.
duckonomy May 27, 2021
c009467
Change wording.
duckonomy May 27, 2021
2611409
Minor fixes.
duckonomy Jun 1, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ import { MainProjectComponent } from './components/main-project/main-project.com
import {DragDropModule, CDK_DRAG_CONFIG} from '@angular/cdk/drag-drop';
import { LoginComponent } from './components/login/login.component';
import { LogoutComponent } from './components/logout/logout.component';
import { ModalLinkProjectComponent } from './components/modal-link-project/modal-link-project.component';

@NgModule({
declarations: [
Expand Down Expand Up @@ -87,6 +88,7 @@ import { LogoutComponent } from './components/logout/logout.component';
MainProjectComponent,
LoginComponent,
LogoutComponent,
ModalLinkProjectComponent,
],
imports: [
CommonModule,
Expand Down Expand Up @@ -151,6 +153,7 @@ import { LogoutComponent } from './components/logout/logout.component';
ModalCreatePointCloudComponent,
ModalCreateOverlayComponent,
ModalCreateTileServerComponent,
ModalPointCloudInfoComponent]
ModalPointCloudInfoComponent,
ModalLinkProjectComponent]
})
export class AppModule { }
3 changes: 3 additions & 0 deletions src/app/components/control-bar/control-bar.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
</div>
<div *ngIf="!loadingActiveProject && !loadingActiveProjectFailed" class="cell small-8 align-middle grid-x">
<span style="margin-left: 1rem">{{isPublicView? 'Public Map': 'Map'}}: {{ activeProject.name }}</span>
<div *ngIf="activeProject.system_name" style="padding-left: 30px">
<span>Project: {{activeProject.system_name}}</span>
</div>
<div *ngIf="loadingData" style="margin-left: 1rem">
<i class="fas fa-spin fa-spinner" style="margin-right: 0.3rem"></i>
<span>Loading Data</span>
Expand Down
5 changes: 5 additions & 0 deletions src/app/components/control-bar/control-bar.component.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
import {Component, OnInit, OnDestroy, Input} from '@angular/core';
import { ProjectsService } from '../../services/projects.service';
import { Project } from '../../models/models';
import { BsModalRef, BsModalService } from 'ngx-foundation';
import { GeoDataService } from '../../services/geo-data.service';
import {LatLng} from 'leaflet';
import {skip} from 'rxjs/operators';
import {combineLatest, Subscription} from 'rxjs';
import {NotificationsService} from '../../services/notifications.service';
import { ModalFileBrowserComponent } from '../modal-file-browser/modal-file-browser.component';
import { ModalLinkProjectComponent } from '../modal-link-project/modal-link-project.component';

@Component({
selector: 'app-control-bar',
Expand All @@ -20,8 +23,10 @@ export class ControlBarComponent implements OnInit, OnDestroy {
private loadingActiveProject = true;
private loadingActiveProjectFailed = false;
private loadingData = false;
modalRef: BsModalRef;

constructor(private projectsService: ProjectsService,
private bsModalService: BsModalService,
private geoDataService: GeoDataService,
private notificationsService: NotificationsService,
) { }
Expand Down
7 changes: 6 additions & 1 deletion src/app/components/file-browser/file-browser.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ export class FileBrowserComponent implements OnInit {
@Input() helpText = 'Note: Only files are selectable, not folders. Double click on a folder to navigate into it.';
@Input() allowedExtensions: Array<string> = [];
@Output() selection: EventEmitter<Array<RemoteFile>> = new EventEmitter<Array<RemoteFile>>();
@Output() systemSelection: EventEmitter<any> = new EventEmitter<any>();
@Output() currentPath: EventEmitter<string> = new EventEmitter<string>();

private currentUser: AuthenticatedUser;
private currentDirectory: RemoteFile;
Expand Down Expand Up @@ -65,8 +67,9 @@ export class FileBrowserComponent implements OnInit {
this.myDataSystem = systems.find( (sys) => sys.id === 'designsafe.storage.default');
this.communityDataSystem = systems.find( (sys) => sys.id === 'designsafe.storage.community');
this.publishedDataSystem = systems.find( (sys) => sys.id === 'designsafe.storage.published');
this.selectedSystem = this.myDataSystem;
this.projects = projects;
this.selectedSystem = this.myDataSystem;
this.systemSelection.next(this.myDataSystem);
this.currentUser = user;
const init = <RemoteFile> {
system: this.myDataSystem.id,
Expand All @@ -86,6 +89,7 @@ export class FileBrowserComponent implements OnInit {
type: 'dir',
path: pth
};
this.systemSelection.next(system)
this.browse(init);
}

Expand Down Expand Up @@ -119,6 +123,7 @@ export class FileBrowserComponent implements OnInit {
// This removes the first item in the listing, which in Agave
// is always a reference to self '.' and replaces with '..'
const current = files.shift();
this.currentPath.next(current.path);
current.path = this.tapisFilesService.getParentPath(current.path);
current.name = '..';
files.unshift(current);
Expand Down
52 changes: 39 additions & 13 deletions src/app/components/main-welcome/main-welcome.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,14 @@

<div class="grid-x align-center">
<div id=welcome-projects-list class="grid-y align-center">
<div class="welcome-project-header grid-x align-justify">
<div>
<div class="welcome-project-header grid-x">
<div class="map-column">
<b>Maps</b>
</div>
<div>
<div class="project-column">
<b>Linked Project</b>
</div>
<div class="button-column" style="text-align: right">
<div id="new-map" (click)="openCreateProjectModal()">
<i class="fas fa-plus"></i>
Create a New Map
Expand All @@ -40,22 +43,37 @@

<ng-template #projectDisconnected>
<div *ngIf="projects.length > 0; else noProject" class="project-list-container">
<div *ngFor="let p of projects; let indexOfelement=index;">
<div *ngFor="let p of projects; let indexOfElement=index;">
<div (dblclick)="routeToProject(p.uuid)"
class="project-list-item"
[ngClass]="{
'welcome-project-light': (indexOfelement % 2) == 0,
'welcome-project-dark': (indexOfelement % 2) == 1,
'welcome-project-light': (indexOfElement % 2) == 0,
'welcome-project-dark': (indexOfElement % 2) == 1,
'welcome-project': true,
'grid-x': true,
'align-justify' :true
'grid-x': true
}">
{{p.name}}
<div>

<div class="map-column">
{{p.name}}
</div>

<div class="project-column">
<ng-container *ngIf="p.system_name && p.system_id.includes('project'); else noSystem" class="list-column link-hover">
<a [href]="'https://www.designsafe-ci.org/data/browser/projects/' + p.system_id + '/'">
<span class="project-name">
{{p.dsName}} | {{p.system_name}}
</span>
</a>
</ng-container>
<ng-template #noSystem>
----------
</ng-template>
</div>
<div class="button-column" style="text-align: right">
<button class="project-list-item-button" (click)="routeToProject(p.uuid)">
<i class="fas fa-folder-open"></i>
</button>
<button class="project-list-item-button" (click)=deleteProject(p)>
<button class="project-list-item-button" (click)=openDeleteProjectModal(p)>
<i class="fas fa-trash"></i>
</button>
</div>
Expand Down Expand Up @@ -88,8 +106,16 @@
</div>
</div>

<div class="grid-x" id="sponsor">Powered by
<img src="assets/nsf.png" width="50px">
<div class="grid-x" id="sponsor">
duckonomy marked this conversation as resolved.
Show resolved Hide resolved
<a href="https://www.nsf.gov/">
<img src="assets/nsf.png" width="60px">
</a>
<a href="https://www.designsafe-ci.org/">
<img src="assets/designsafe.svg" width="200px">
</a>
<a href="https://www.designsafe-ci.org/about/">
<img src="assets/nheri.png" width="150px">
</a>
</div>

</div>
Expand Down
38 changes: 24 additions & 14 deletions src/app/components/main-welcome/main-welcome.component.styl
Original file line number Diff line number Diff line change
Expand Up @@ -12,64 +12,74 @@
padding: 20px
margin-bottom: 50px
#user-guide
width: 550px
width: 100%
text-align: right

.map-column
width: 200px
.project-column
width: 100%
.button-column
width: 250px
.project-name
display: inline-block
text-overflow: ellipsis
overflow: hidden
width: 90%
white-space: nowrap
#sponsor
height: 50px
display: flex
align-items: center
justify-content: center
background-color: #f7f7f7
img
padding-left: 5px
padding-left: 10px
#welcome-background
background-color: #f7f7f7
height: calc(100% - 40px)
#welcome-projects-list
background-color: #ffffff
width: 600px
width: 100%
.project-list-container
height: 270px
overflow-y: scroll
.project-list-item
font-size: 14px
padding: 12px
display: flex
flex-wrap: nowrap
jusitfy-content: space-between
.project-list-item-button
cursor: pointer
margin: 0px 10px
:hover
color: #fff
.welcome-project-header
font-size: 14px
padding: 12px
display: flex
flex-wrap: nowrap
background-color: #d0d0d0
.welcome-project-light
font-size: 14px
padding: 12px
background-color: #ffffff
.welcome-project-dark
font-size: 14px
padding: 12px
background-color: #eeeeee
.welcome-project:hover
color: #ffffff
background-color: #3c6fdb
a
color: #ADDFFF
#welcome-no-information
height: 100%
display: flex
flex-direction: column
font-size: 24px
padding: 90px
height: 270px
align-items: center
width: 100%
#welcome-information
background-color: #f7f7f7
// padding: 150px 300px
// padding: 50px
// margin-bottom: 20px
width: 800px
// width: calc(100% - 400px)
width: 100%
#welcome-logo
display: flex
flex-direction: column
Expand Down
66 changes: 46 additions & 20 deletions src/app/components/main-welcome/main-welcome.component.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
import { Component, OnInit } from '@angular/core';
import { Project } from '../../models/models';
import {GeoDataService} from '../../services/geo-data.service';
import {ProjectsService} from '../../services/projects.service';
import {BsModalService} from 'ngx-foundation';
import {BsModalRef, BsModalService} from 'ngx-foundation';
import {AgaveSystemsService} from '../../services/agave-systems.service';
import {ModalCreateProjectComponent} from '../modal-create-project/modal-create-project.component';
import { Router, ActivatedRoute } from '@angular/router';
import { ModalService } from 'src/app/services/modal.service';
import { combineLatest } from 'rxjs';
import { take } from 'rxjs/operators';

@Component({
selector: 'app-main-welcome',
Expand All @@ -16,48 +19,71 @@ export class MainWelcomeComponent implements OnInit {
release_url = 'https://github.com/TACC-cloud/hazmapper';
guide_url = 'https://www.designsafe-ci.org/rw/user-guide/workspace/hazmapper/';

spinner: boolean;
spinner: boolean = true;
connected: boolean;

public projects: Project[] = [];
public projects = [];
public activeProject: Project;

constructor(
private route: ActivatedRoute,
private router: Router,
private geoDataService: GeoDataService,
private projectsService: ProjectsService,
private bsModalService: BsModalService
private bsModalService: BsModalService,
private modalService: ModalService,
private agaveSystemsService: AgaveSystemsService
) { }

ngOnInit() {
this.projectsService.loadingProjects.subscribe((isLoading) => {
this.spinner = isLoading;
});

this.projectsService.getProjects();
this.agaveSystemsService.getDSProjectId();

this.projectsService.loadingProjectsFailed.subscribe((connected) => {
this.connected = connected;
duckonomy marked this conversation as resolved.
Show resolved Hide resolved
});

this.projectsService.projects.subscribe( (projects) => {
this.projects = projects;
});

this.projectsService.getProjects();
combineLatest(
this.projectsService.projects,
this.agaveSystemsService.dsProjects).pipe(take(1))
.subscribe(([projects, dsProjects]) => {
if (dsProjects) {
if (projects.length > 0) {
this.projects = dsProjects.length > 0
? projects.map(p => {
const pDir = dsProjects.find(dp => dp.id === p.system_id);
p.dsName = pDir ? pDir.dsId : null;
return p;
})
: projects;
this.spinner = false;
} else {
this.spinner = true;
}
}
});
}

routeToProject(projectId: number) {
this.router.navigate(['project', projectId], { relativeTo: this.route });
routeToProject(projectUUID: string) {
duckonomy marked this conversation as resolved.
Show resolved Hide resolved
this.router.navigate(['project', projectUUID], { relativeTo: this.route });
}

openCreateProjectModal() {
const modal = this.bsModalService.show(ModalCreateProjectComponent);
modal.content.onClose.subscribe( (project) => {
duckonomy marked this conversation as resolved.
Show resolved Hide resolved
const modal: BsModalRef = this.bsModalService.show(ModalCreateProjectComponent);
modal.content.onClose.subscribe( (project: Project) => {
this.routeToProject(project.uuid);
});
}

deleteProject(p: Project) {
this.projectsService.deleteProject(p);
openDeleteProjectModal(p: Project) {
duckonomy marked this conversation as resolved.
Show resolved Hide resolved
this.modalService.confirm(
'Delete map',
'Are you sure you want to delete this map? All associated features, metadata, and saved files will be deleted. THIS CANNOT BE UNDONE.',
['Cancel', 'Delete']).subscribe( (answer) => {
if (answer === 'Delete') {
this.projectsService.deleteProject(p);

}
});
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ export class ModalConfirmationBodyComponent {

constructor(public bsModalRef: BsModalRef) { }

closeModal(answer) {
this.answer = answer;
this.bsModalRef.hide();
}
}
closeModal(answer) {
this.answer = answer;
this.bsModalRef.hide();
}
}
Loading