Skip to content

Commit

Permalink
task/WG-212: use updated project create and project update routes (#199)
Browse files Browse the repository at this point in the history
* Use updated project create and project update routes

* Remove unused methods

* Remove unused method

* Remove unused code

* Drop unused ModalLinkProjectComponent

* Add spinner as create project takes a few seconds

* Fix prettier issues
  • Loading branch information
nathanfranklin authored Feb 20, 2024
1 parent a674525 commit e48d9a3
Show file tree
Hide file tree
Showing 13 changed files with 46 additions and 388 deletions.
3 changes: 0 additions & 3 deletions angular/src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ import { StreetviewAssetsComponent } from './components/streetview-assets/street
import { PublicMapInfoPanelComponent } from './components/public-map-info-panel/public-map-info-panel.component';
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';
import { ModalStreetviewPublishComponent } from './components/modal-streetview-publish/modal-streetview-publish.component';
import { ModalStreetviewLogComponent } from './components/modal-streetview-log/modal-streetview-log.component';
import { ModalStreetviewLinkComponent } from './components/modal-streetview-link/modal-streetview-link.component';
Expand Down Expand Up @@ -114,7 +113,6 @@ import { QuestionnaireDetailComponent } from './components/questionnaire-detail/
PublicMapInfoPanelComponent,
LoginComponent,
LogoutComponent,
ModalLinkProjectComponent,
ModalStreetviewPublishComponent,
ModalStreetviewLogComponent,
ModalStreetviewLinkComponent,
Expand Down Expand Up @@ -199,7 +197,6 @@ import { QuestionnaireDetailComponent } from './components/questionnaire-detail/
ModalStreetviewUsernameComponent,
ModalStreetviewOrganizationComponent,
ModalPointCloudInfoComponent,
ModalLinkProjectComponent,
ModalQuestionnaireViewerComponent,
],
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ <h4>Create a new Map</h4>

<div class="button-group small">
<button class="button small warning" type="button" (click)="close()">Close</button>
<button class="button small align-right" type="submit" [disabled]="!projCreateForm.valid || submitting">Submit</button>
<button class="button small align-right" type="submit" [disabled]="!projCreateForm.valid || submitting">
Submit <i *ngIf="submitting" class="fas fa-spinner fa-spin"></i>
</button>
</div>
</form>
Original file line number Diff line number Diff line change
Expand Up @@ -67,28 +67,22 @@ export class ModalCreateProjectComponent implements OnInit, AfterContentChecked

submit() {
this.submitting = true;
const p = new Project();
const pr = new ProjectRequest();

p.description = this.projCreateForm.get('description').value;
p.name = this.projCreateForm.get('name').value;
p.system_path = this.selectedFiles.length > 0 ? this.selectedFiles[0].path || '/' : this.currentPath || '/';
pr.description = this.projCreateForm.get('description').value;
pr.name = this.projCreateForm.get('name').value;
pr.system_path = this.selectedFiles.length > 0 ? this.selectedFiles[0].path || '/' : this.currentPath || '/';

p.system_id = this.selectedSystem.id;
p.system_file = this.projCreateForm.get('fileName').value ? this.projCreateForm.get('fileName').value : p.name;
pr.system_id = this.selectedSystem.id;
pr.system_file = this.projCreateForm.get('fileName').value ? this.projCreateForm.get('fileName').value : pr.name;

if (this.selectedSystem.id.includes('project')) {
pr.observable = true;
pr.watch_content = this.projCreateForm.get('watchContent').value;
} else {
pr.observable = this.projCreateForm.get('watchContent').value;
pr.watch_content = pr.observable;
pr.watch_users = true;
}
pr.watch_content = this.projCreateForm.get('watchContent').value;

this.errorMessage = '';

pr.project = p;

this.projectsService.create(pr).subscribe(
(project) => {
this.close(project);
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

19 changes: 7 additions & 12 deletions angular/src/app/components/users-panel/users-panel.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@ import { NotificationsService } from '../../services/notifications.service';
import { ModalService } from '../../services/modal.service';
import { TabsetComponent, BsModalService } from 'ngx-foundation';
import { IProjectUser } from '../../models/project-user';
import { Project, ProjectRequest } from '../../models/models';
import { Project, ProjectUpdateRequest } from '../../models/models';
import { EnvService } from '../../services/env.service';
import { ModalLinkProjectComponent } from '../modal-link-project/modal-link-project.component';
import { AgaveSystemsService } from 'src/app/services/agave-systems.service';
import { combineLatest } from 'rxjs';
import { copyToClipboard } from '../../utils/copyText';
Expand Down Expand Up @@ -71,10 +70,6 @@ export class UsersPanelComponent implements OnInit {
return publicUrl;
}

openExportProjectModal() {
this.bsModalService.show(ModalLinkProjectComponent);
}

copyLinkToClipboard(link: string) {
copyToClipboard(link);
this.notificationsService.showSuccessToast(`Copied ${link} to the clipboard!`);
Expand Down Expand Up @@ -131,10 +126,10 @@ export class UsersPanelComponent implements OnInit {
this.nameInputError = false;
this.activeProject.name = name;

const pr = new ProjectRequest();
pr.project = this.activeProject;
const pr = new ProjectUpdateRequest();
pr.name = this.activeProject.name;

this.projectsService.updateProject(pr);
this.projectsService.updateProject(this.activeProject, pr);
} else {
this.nameInputError = true;
}
Expand All @@ -145,10 +140,10 @@ export class UsersPanelComponent implements OnInit {
this.descriptionInputError = false;
this.activeProject.description = description;

const pr = new ProjectRequest();
pr.project = this.activeProject;
const pr = new ProjectUpdateRequest();
pr.description = this.activeProject.description;

this.projectsService.updateProject(pr);
this.projectsService.updateProject(this.activeProject, pr);
} else {
this.descriptionInputError = true;
}
Expand Down
24 changes: 16 additions & 8 deletions angular/src/app/models/models.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,6 @@ import { Feature as GeoJSONFeature, GeoJsonProperties, Geometry, FeatureCollecti

// TODO: break these out into their own files

export enum AgaveFileOperations {
Delete,
Update,
}

export interface IFileImportRequest {
system_id: string;
path: string;
Expand Down Expand Up @@ -65,13 +60,26 @@ export interface Project {
export class Project implements Project {}

export interface ProjectRequest {
project: Project;
observable?: boolean;
watch_content?: boolean;
name: string;
description: string;
public: boolean;
system_file: string;
system_id: string;
system_path: string;
watch_content: boolean;
watch_users: boolean;
}

export class ProjectRequest implements ProjectRequest {}

export interface ProjectUpdateRequest {
name?: string;
description?: string;
public?: boolean;
}

export class ProjectUpdateRequest implements ProjectUpdateRequest {}

export class AuthToken {
token: string;
expires: Date;
Expand Down
17 changes: 0 additions & 17 deletions angular/src/app/models/rapid-project-request.ts

This file was deleted.

Loading

0 comments on commit e48d9a3

Please sign in to comment.