Skip to content
Permalink
Browse files
refactor(projects): don't use the cache when refreshing the projects …
…list. Also renames some labels and methods to clarify that these things are for deactivating a project as opposed to deleting a project. (#597)
  • Loading branch information
mdelez committed Nov 30, 2021
1 parent 56d3227 commit faebe3e20953d6c2afc12cff9bf94a670db50ced
Show file tree
Hide file tree
Showing 8 changed files with 135 additions and 67 deletions.

Large diffs are not rendered by default.

@@ -102,9 +102,9 @@
<app-project-form [projectCode]="data.project" (closeDialog)="dialogRef.close()"></app-project-form>
</div>

<!-- Delete project -->
<div *ngSwitchCase="'deleteProject'">
<app-dialog-header [title]="data.name" [subtitle]="'appLabels.form.project.title.delete' | translate">
<!-- Deactivate project -->
<div *ngSwitchCase="'deactivateProject'">
<app-dialog-header [title]="data.name" [subtitle]="'appLabels.form.project.title.deactivate' | translate">
</app-dialog-header>
Do you want to deactivate this project?
<mat-dialog-actions>
@@ -79,7 +79,7 @@ <h5 class="mat-subheading-2 link info-longname" (click)="openProjectPage(project
- http://www.knora.org/ontology/knora-admin#DefaultSharedOntologiesProject
-->
<button mat-menu-item *ngIf="status"
(click)="openDialog('deleteProject', project.shortname, project.id)">
(click)="openDialog('deactivateProject', project.shortname, project.id)">
Deactivate project
</button>
<button mat-menu-item *ngIf="!status"
@@ -156,8 +156,8 @@ export class ProjectsListComponent implements OnInit {
if (response === true) {
// get the mode
switch (mode) {
case 'deleteProject':
this.deleteProject(id);
case 'deactivateProject':
this.deactivateProject(id);
break;

case 'activateProject':
@@ -180,7 +180,8 @@ export class ProjectsListComponent implements OnInit {
localStorage.setItem('sortProjectsBy', key);
}

deleteProject(id: string) {
deactivateProject(id: string) {
// the deleteProject() method in js-lib sets the project's status to false, it is not actually deleted
this._dspApiConnection.admin.projectsEndpoint.deleteProject(id).subscribe(
(response: ApiResponseData<ProjectResponse>) => {
this.refreshParent.emit();
@@ -1,16 +1,3 @@
<!--
<form [formGroup]="findProject" class="form" *ngIf="!loading">
<mat-form-field class="large">
<input matInput [placeholder]="Find project…" [formControl]="">
</mat-form-field>
<mat-autocomplete #user="matAutocomplete" (optionSelected)="selectProject()">
<mat-option *ngFor="let project of filteredProjects | async" [value]="project?.name">
{{ project?.label }}
</mat-option>
</mat-autocomplete>
</form>
-->

<app-progress-indicator *ngIf="loading"></app-progress-indicator>

<div *ngIf="!loading" class="app-projects">
@@ -22,14 +9,3 @@
<app-projects-list [list]="inactive" [status]="false" (refreshParent)="refresh()"></app-projects-list>
</div>

<!--
<div *ngIf="system">
<button mat-raised-button [color]="'primary'" class="add-new" (click)="openDialog('createProject')">
NEW project
</button>
<app-progress-indicator *ngIf="loadSystem"></app-progress-indicator>
<app-projects-list *ngIf="!loadSystem" [list]="active" [system]="system"></app-projects-list>
<app-projects-list *ngIf="!loadSystem" [list]="inactive" [system]="system"></app-projects-list>
</div>
-->
@@ -83,10 +83,9 @@ export class ProjectsComponent implements OnInit {
// clean up list of projects
this.active = [];
this.inactive = [];

if (this.username) {
// logged-in user view: get all projects, where the user is member of
this._cache.get(this.username, this._dspApiConnection.admin.usersEndpoint.getUserByUsername(this.username)).subscribe(
this._dspApiConnection.admin.usersEndpoint.getUserByUsername(this.username).subscribe(
(response: ApiResponseData<UserResponse>) => {

for (const project of response.body.user.projects) {
@@ -154,17 +153,8 @@ export class ProjectsComponent implements OnInit {
* refresh list of projects after updating one
*/
refresh(): void {
// referesh the component
// refresh the component
this.loading = true;
// update the cache
// this._cache.del('members_of_' + this.projectCode);
this.initList();

// refresh child component: add user
/*
if (this.addUser) {
this.addUser.buildForm();
}
*/
}
}
@@ -97,8 +97,8 @@
"new": "Projekt erstellen",
"edit": "Projekt aktualisieren",
"editSuccess": "Das Projekt wurde erfolgreich aktualisiert",
"delete": "Projekt deaktivieren",
"deleteHint": "Möchtest du das Projekt wirklich deaktivieren?",
"deactivate": "Projekt deaktivieren",
"deactivateHint": "Möchtest du das Projekt wirklich deaktivieren?",
"formWizard": {
"step_1": "Projektdaten",
"step_2": "Mitlgieder hinzufügen",
@@ -121,9 +121,9 @@
"edit": "Update project",
"profile": "Research project",
"editSuccess": "You have successfully updated this project.",
"delete": "Deactivate project",
"deleteHint": "You're sure to delete this project?",
"deleteButton": "Deactivate project now",
"deactivate": "Deactivate project",
"deactivateHint": "You're sure to deactivate this project?",
"deactivateButton": "Deactivate project now",
"activate": "Do you want to reactivate?",
"activateButton": "Reactivate project now",
"formWizard": {

0 comments on commit faebe3e

Please sign in to comment.