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

Task/DES-2001: Project links as observables (subscribe to project-user data). #67

Merged
merged 30 commits into from
Jan 20, 2022
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
5c05202
Add ability to display custom styles and icons on map.
duckonomy Jun 17, 2021
67b40fd
Make project linking act like observable.
duckonomy Jun 21, 2021
29870fd
Fix leafletUtils
duckonomy Jun 23, 2021
b27d397
Add file name parameter.
duckonomy Jul 6, 2021
70509a6
Revert leaflet utils change.
duckonomy Jul 7, 2021
f6efe35
Remove unnecessary model.
duckonomy Jul 14, 2021
b433c40
Remove new line
duckonomy Jul 14, 2021
b3cea98
Move export logic to backend and cleanup routes.
duckonomy Aug 17, 2021
b6d7292
Handle error for project creation modal.
duckonomy Aug 24, 2021
9582dc1
Error message for exportProject.
duckonomy Aug 24, 2021
3d3a9e6
Remove use of /export endpoint and refactor create project UI for cla…
duckonomy Sep 3, 2021
4bb955c
Merge branch 'master' into task/DES-2001-project-links-as-observables
duckonomy Sep 3, 2021
7ea0cb9
Remove requests to unused routes..
duckonomy Sep 3, 2021
061361a
Merge branch 'master' into task/DES-2001-project-links-as-observables
duckonomy Dec 14, 2021
6ad0668
Remove errors related to merge.
duckonomy Dec 16, 2021
7fec5b6
Name to change filename for create project modal.
duckonomy Dec 20, 2021
3f2ef49
Save file by default when creating a project.
duckonomy Dec 20, 2021
f8be814
Remove delete button for map users.
duckonomy Dec 20, 2021
15fa676
Use project from request for update project.
duckonomy Dec 21, 2021
5d09454
Handle project error when save/delete project.
duckonomy Dec 22, 2021
95935d3
Handle empty file name.
duckonomy Dec 22, 2021
c8425fe
Remove checking file selection error for now.
duckonomy Jan 5, 2022
6c26f05
Quick fixes from Ellen's feedback.
duckonomy Jan 7, 2022
91a879d
Fix incorrect uuid location for saving in designsafe project metadata.
duckonomy Jan 7, 2022
0643472
Remove save as for now.
duckonomy Jan 7, 2022
aa5174b
Update src/app/components/modal-create-project/modal-create-project.c…
duckonomy Jan 19, 2022
d696b04
Remove unnecessary content.
duckonomy Jan 19, 2022
27a79ef
Drop more unnecessary content.
duckonomy Jan 19, 2022
8c9e31b
Adjust error message when creating observable map for local development.
duckonomy Jan 19, 2022
6e079aa
Change description for members when saved to My Data.
duckonomy Jan 19, 2022
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
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ export class ModalCreateProjectComponent implements OnInit, AfterContentChecked

createRapidProject() {
this.errorMessage = '';
const req: RapidProjectRequest = new RapidProjectRequest(this.rapidFolder.system, this.rapidFolder.path);
const req: RapidProjectRequest = new RapidProjectRequest(this.rapidFolder.system, this.rapidFolder.path, true);
this.projectsService.createRapidProject(req).subscribe( (project) => {
this.close(project);
}, (err) => {
duckonomy marked this conversation as resolved.
Show resolved Hide resolved
Expand All @@ -82,16 +82,32 @@ export class ModalCreateProjectComponent implements OnInit, AfterContentChecked
const p = new Project();
p.description = this.projCreateForm.get('description').value;
duckonomy marked this conversation as resolved.
Show resolved Hide resolved
p.name = this.projCreateForm.get('name').value;
this.projectsService.create(p).subscribe( (project) => {
this.projectsService.create(p).subscribe((project) => {
if (this.projCreateForm.get('exportMapLink').value) {
const path = this.selectedFiles.length > 0 ? this.selectedFiles[0].path : this.currentPath;
const systemId = this.selectedSystem.id;
this.projectsService.exportProject(project,
systemId,
path,
this.projCreateForm.get('linkProject').value,
this.projCreateForm.get('fileName').value)
if (!systemId.includes('project')) {
this.projectsService.exportProject(project,
systemId,
path,
this.projCreateForm.get('linkProject').value,
this.projCreateForm.get('fileName').value);
} else {
const req: RapidProjectRequest = new RapidProjectRequest(
systemId,
path,
true,
project.id,
this.projCreateForm.get('fileName').value
);
this.projectsService.createRapidProject(req).subscribe((resProject: Project) => {
this.close(resProject);
}, (err) => {
this.errorMessage = err.toString();
});
duckonomy marked this conversation as resolved.
Show resolved Hide resolved
}
}

this.close(project);
}, err => {
this.errorMessage = err.toString();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ export class ModalLinkProjectComponent implements OnInit {
@Input() allowEmptyFiles: false;
selectedFiles: Array<RemoteFile> = [];
selectedSystem: any;
fileName: string = '';
fileName = '';
activeProject: Project;
linkProject: boolean = false;
linkProject = false;
currentPath: string;
confirmRemove: boolean = false;
confirmRemove = false;
public onClose: Subject<any> = new Subject<any>();
constructor(private modalRef: BsModalRef,
private projectsService: ProjectsService,
Expand Down
23 changes: 17 additions & 6 deletions src/app/components/users-panel/users-panel.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { ModalLinkProjectComponent } from '../modal-link-project/modal-link-proj
import { AgaveSystemsService } from 'src/app/services/agave-systems.service';
import { combineLatest } from 'rxjs';
import { copyToClipboard } from '../../utils/copyText';
import {RapidProjectRequest} from 'src/app/models/rapid-project-request';

@Component({
selector: 'app-users-panel',
Expand Down Expand Up @@ -89,13 +90,23 @@ export class UsersPanelComponent implements OnInit {
allowedExtensions: []
};
const modal: BsModalRef = this.bsModalService.show(ModalLinkProjectComponent, { initialState });
modal.content.onClose.subscribe( (next) => {
modal.content.onClose.subscribe((next) => {
const path = next.fileList.length > 0 ? next.fileList[0].path : next.currentPath;
this.projectsService.exportProject(this.activeProject,
next.system.id,
path,
next.system.id.includes('project') && next.linkProject,
next.fileName);
if (next.linkProject) {
const req: RapidProjectRequest = new RapidProjectRequest(next.system.id, path, false, this.activeProject.id, next.fileName);
this.projectsService.createRapidProject(req).subscribe((project: Project) => {
this.notificationsService.showSuccessToast(`Saved to ${next.system.id}/${path}`);
}, (err) => {
this.notificationsService.showErrorToast(`Failed to save to ${next.system.id}/${path} ${err.toString()}`);
});

} else {
this.projectsService.exportProject(this.activeProject,
next.system.id,
path,
next.system.id.includes('project') && next.linkProject,
next.fileName);
}
});
}

Expand Down
13 changes: 12 additions & 1 deletion src/app/models/models.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import {Feature as GeoJSONFeature,
GeoJsonProperties,
Geometry,
FeatureCollection as IFeatureCollection } from 'geojson';

import { MarkerOptions } from 'leaflet';

// TODO: break these out into their own files

Expand Down Expand Up @@ -216,3 +216,14 @@ export interface DesignSafeProject {
export interface DesignSafeProjectCollection {
projects: DesignSafeProject[];
}

export interface MarkerIcon {
duckonomy marked this conversation as resolved.
Show resolved Hide resolved
color: string;
name: string;
}

export interface MarkerConfig {
type: string;
icon?: MarkerIcon;
options?: MarkerOptions;
}
8 changes: 7 additions & 1 deletion src/app/models/rapid-project-request.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@

class RapidProjectRequest {
system_id: string;
project_id: number;
file_name: string;
watch_content: boolean;
path: string;

constructor(systemId: string, path: string) {
constructor(systemId: string, path: string, watchContent: boolean, projectId?: number, fileName?: string) {
this.system_id = systemId;
this.project_id = projectId ? projectId : undefined;
this.file_name = fileName ? fileName : '';
this.watch_content = watchContent;
this.path = path;
}
}
Expand Down