Skip to content

Commit

Permalink
Merge branch 'master' into add-classes
Browse files Browse the repository at this point in the history
  • Loading branch information
rsiminel authored Aug 27, 2024
2 parents 0ba0243 + 34dfc33 commit fabf67f
Show file tree
Hide file tree
Showing 14 changed files with 685 additions and 423 deletions.
27 changes: 17 additions & 10 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,27 @@
# Changelog

## 1.4.30 (TBA)
## 1.4.31 (Unreleased)

* Fix 'Admin' button in 'My projects' page for administrators

## 1.4.30 (2024-08-02)

* Added a `project.terms_and_conditions_hds` setting in the config:
If true:
If true:
"Ask Admin" button to submit project creation form became available after 'project name' and 'expiration date' are filled, 'project description' is at least 30 char and a checkbox appears and 'terms and conditions hds' should also be checked
If false:
"Ask Admin" button to submit project creation form became available after 'project name' and 'expiration date' are filled, 'project description' is at least 30 char, no consentment checkbox
* Added 'End date' to the project request page
"Ask Admin" button to submit project creation form became available after 'project name' and 'expiration date' are filled, 'project description' is at least 30 char, no consent checkbox
* Add 'End date' to the project request page
* Set 'description' as a required field in the project request page and set a minimal length of 30 char
* Added a link to user profile on admin panels -> projects pending table
* Added 'Extend' button for admins to extend active TPs
* Prevented retroactive TP reservations
* Added checks to user registration form, the user information update form and the TP reservation form
* Added back button from single project view
* Improved TP calendar readability
* Add a link to user profile on admin panels -> projects pending table
* Add 'Extend' button for admins to extend active TPs
* Add checks to user registration form, the user information update form and the TP reservation form
* Add back button from single project view
* Updated TP calendar to increase readability
* Fix newly created group selection bug
* Update admin project creation UI: disappearing buttons and add "undo selection" button
* Actually show angular errors in web console when not in production and sentry is not set
* Fix owner change for databases and websites

## 1.4.29

Expand Down
2 changes: 1 addition & 1 deletion core/project.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ async function create_project_request(asked_project, user) {
'#NAME#': asked_project.id,
'#SIZE#': asked_project.size,
'#CPU#': asked_project.cpu,
'#EXPIRE#': asked_project.expire.toISOString().split('T')[0],
'#EXPIRE#': new Date(asked_project.expire).toISOString().split('T')[0],
'#ORGA#': asked_project.orga,
'#DESC#': asked_project.description
});
Expand Down
2 changes: 1 addition & 1 deletion dev_quickstart/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Genouestaccountmanager is fairly modular, so it will not fit a deployment for pr
* **At least the 'url' key, to match the access url to your instance**
* You may want to add your first username to the 'admin' list in the same file
* Copy it in genouestaccountmanager/config/
* phpldapadmin will be available on port 80 if needed.
* phpldapadmin will be available on port 8080 if needed.

## Requirements

Expand Down
73 changes: 17 additions & 56 deletions manager2/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions manager2/src/app/admin/databases/databases.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -181,13 +181,13 @@ <h3>Change database owner</h3>
<div class="col-sm-2">
<label for="owner_db_name">Database name</label>
<select id="owner_db_name" [ngModelOptions]="{standalone: true}" [(ngModel)]="owner_db_name" class="form-control">
<option *ngFor="let database of databases" [value]="database">{{database.name}}</option>
<option *ngFor="let database of databases" [ngValue]="database">{{database.name}}</option>
</select>
</div>
<div class="col-sm-2">
<label for="owner_dbhost">Database owner</label>
<select [ngModelOptions]="{standalone: true}" [(ngModel)]="owner_db_owner" id="owner_dbhost" class="form-control">
<option *ngFor="let user of users" [value]="user">{{user.uid}}</option>
<option *ngFor="let user of users" [ngValue]="user">{{user.uid}}</option>
</select>
</div>
<div class="col-sm-2">
Expand Down
5 changes: 3 additions & 2 deletions manager2/src/app/admin/project/project.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -95,11 +95,12 @@ <h4>Project <strong>{{project.id}}</strong></h4>
<option *ngFor="let user_a of all_users" [ngValue]="user_a.uid">{{user_a.uid}}</option>
</select>
</div>
<div class="col-sm-3">
<div class="col-sm-2">
<label style="opacity: 0;">Add member</label>
<button type="button" class="p-button p-button-sm p-button-success" (click)="add_user(); ">Add member</button>
</div>
<div class="col-sm-2">
<div class="col-sm-1"></div>
<div class="col-sm-3">
<label for="remove_user_admin">Remove project member</label>
<select id="remove_user_admin" [ngModelOptions]="{standalone: true}" [(ngModel)]="remove_user_admin" class="form-control">
<option *ngFor="let user_r of users" [ngValue]="user_r.uid">{{user_r.uid}}</option>
Expand Down
10 changes: 7 additions & 3 deletions manager2/src/app/admin/projects/projects.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -84,12 +84,16 @@ <h3>Project creation</h3>
</div>
<div class="form-group row">
<div class="col-sm-2">
<label style="opacity: 0;">Create</label>
<button type="button" class="p-button p-button-success" (click)="add_project()">Create project</button>
</div>
<div class="col-sm-2" *ngIf="new_project.uuid && new_project.uuid != ''">
<label style="opacity: 0;">Edit</label>
<button type="button" class="p-button" (click)="edit_project()">Save changes</button>
</div>
<div class="col-sm-2">
<label style="opacity: 0;">Create</label>
<button type="button" class="p-button p-button-success" (click)="add_project()">Create project</button>
<div class="col-sm-2" *ngIf="new_project.uuid && new_project.uuid != ''">
<label style="opacity: 0;">De-select</label>
<button type="button" class="p-button p-button-secondary" (click)="new_project = { };">Undo selection</button>
</div>
</div>
</form>
Expand Down
6 changes: 6 additions & 0 deletions manager2/src/app/admin/websites/websites.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,12 @@ export class WebsitesComponent implements OnInit {
this.chowner_err_msg = 'No web or owner selected';
return;
}

if(this.owner_web_name.owner === this.owner_web_owner.uid ){
this.chowner_err_msg = this.owner_web_owner.uid + " is already owner of this website";
return;
}

this.websitesService.changeOwner(this.owner_web_name.name, this.owner_web_name.owner, this.owner_web_owner.uid).subscribe(
resp => this.chowner_msg = resp['message'],
err => this.chowner_err_msg = err.error.message
Expand Down
5 changes: 4 additions & 1 deletion manager2/src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,10 @@ if (environment.sentry) {
export class SentryErrorHandler implements ErrorHandler {
constructor() {}
handleError(error) {
if (!environment.sentry) { return }
if (!environment.sentry && !environment.production) {
console.log(error.originalError || error)
return
}
const eventId = Sentry.captureException(error.originalError || error);
Sentry.showReportDialog({ eventId });
}
Expand Down
44 changes: 22 additions & 22 deletions manager2/src/app/project/project.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ <h3>Request a new project creation</h3>
<div *ngIf="id.errors.maxlength">Name can't be more than 42 characters long</div>
</div>
</div>

<div class="form-group row col-sm-12">
<label for="new_project_expire">Expiration date
<span style="color:red">(required) </span>
Expand All @@ -30,27 +30,27 @@ <h3>Request a new project creation</h3>
<div *ngIf="expire.errors.required">Expiration date is required</div>
</div>
</div>

<div class="form-group row col-sm-12">
<label for="new_project_size">Total expected project size (GB)</label>
<input placeholder="project size in GB" type="number" id="new_project_size" name="size" [value]="default_size" [ngModelOptions]="{standalone: true}" [(ngModel)]="new_project.size" class="form-control"/>
<small id="nameHelp" class="form-text text-muted"><i>Please include the <b>total</b> expected size for this project.</i></small>
</div>

<div class="form-group row col-sm-12">
<label for="new_project_cpu">Cpu (Hour)</label>
<input placeholder="project cpu in Hour" type="number" id="new_project_cpu" name="cpu" [value]="default_cpu" [ngModelOptions]="{standalone: true}" [(ngModel)]="new_project.cpu" class="form-control"/>
<small id="nameHelp" class="form-text text-muted"><i>Optional, for information only</i></small>
</div>

<div class="form-group row col-sm-12">
<label for="new_project_org">Financing
<span class="pi pi-question-circle" title="Entity financing the project" tooltip> </span>
</label>
<input placeholder="Ex : CNRS" type="text" id="new_project_org" name="orga" [ngModelOptions]="{standalone: true}" [(ngModel)]="new_project.orga" class="form-control"/>
<small id="orgaHelp" class="form-text text-muted"><em>Optional, for information only</em></small>
</div>

<div class="form-group row col-sm-12">
<label for="new_project_description">Description <span style="color:red">(required)</span> </label>
<textarea required placeholder="A description for the project" minlength="30" rows="2" id="new_project_description" name="description" [ngModelOptions]="{standalone: true}" [(ngModel)]="new_project.description" class="form-control" #description="ngModel"></textarea>
Expand All @@ -59,7 +59,7 @@ <h3>Request a new project creation</h3>
</div>
</div>

<div class="form-group" *ngIf="config.project.terms_and_conditions_hds">
<div class="form-group" *ngIf="config.project && config.project.terms_and_conditions_hds">
<div class="form-check">
<input class="form-check-input is-invalid" type="checkbox" value="" id="new_project_terms_and_conditions_hds" name="terms_and_conditions_hds" [(ngModel)]="new_project.terms_and_conditions_hds" #terms_and_conditions_hds="ngModel" required>
<label class="form-check-label" for="new_project_terms_and_conditions_hds">
Expand All @@ -71,30 +71,30 @@ <h3>Request a new project creation</h3>
</div>
</div>
</div>

</div>

<div class="modal-footer" id="submit">
<div class="form-group row col-sm-12">
<!-- Button with terms_and_conditions_hds -->
<button *ngIf="config.project.terms_and_conditions_hds"
id="test"
type="submit"
class="p-button p-button-sm p-button-primary"
[disabled]="id.invalid || expire.invalid || description.invalid || terms_and_conditions_hds.invalid"
<button *ngIf="config.project && config.project.terms_and_conditions_hds"
id="test"
type="submit"
class="p-button p-button-sm p-button-primary"
[disabled]="id.invalid || expire.invalid || description.invalid || terms_and_conditions_hds.invalid"
[ngClass]="{'disabled-btn': id.invalid || expire.invalid || description.invalid || terms_and_conditions_hds.invalid}">
Ask Admin
</button>

<!-- Button without terms_and_conditions_hds -->
<button *ngIf="!config.project.terms_and_conditions_hds"
id="test"
type="submit"
class="p-button p-button-sm p-button-primary"
[disabled]="id.invalid || expire.invalid || description.invalid"
<button *ngIf="!(config.project && config.project.terms_and_conditions_hds)"
id="test"
type="submit"
class="p-button p-button-sm p-button-primary"
[disabled]="id.invalid || expire.invalid || description.invalid"
[ngClass]="{'disabled-btn': id.invalid || expire.invalid || description.invalid}">
Ask Admin
</button>
</button>

<button type="button" class="p-button p-button-sm p-button-secondary" data-dismiss="modal">Cancel</button>
</div>
Expand Down Expand Up @@ -162,8 +162,8 @@ <h3>Projects</h3>
<td>{{project.created_at | date}}</td>
<td>{{project.expire | date}}</td>
<td>
<button *ngIf="!session_user.is_admin && project.owner != session_user.uid" type="button" class="p-button p-button-sm p-button-warning" (click)="request_user(project, session_user.uid,'remove')">Leave</button>
<button *ngIf="session_user.is_admin" type="button" class="p-button p-button-sm p-button-danger" (click)="router.navigate(['/admin/project/' + project.id])">Admin</button>
<button *ngIf="!session_user.is_admin && project.owner != session_user.uid" type="button" class="p-button p-button-sm p-button-warning" (click)="request_user(project, session_user.uid,'remove')">Leave project</button>
<a *ngIf="session_user.is_admin" routerLink="/admin/project/{{project.id}}"><span class="p-button p-button-sm p-button-danger">Admin</span></a>
</td>
</tr>
</ng-template>
Expand Down Expand Up @@ -348,4 +348,4 @@ <h4 class="modal-title">Terms and Conditions HDS</h4>
</div>
</div>
</div>
</div>
</div>
1 change: 1 addition & 0 deletions manager2/src/app/project/project.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export class ProjectComponent implements OnInit {
@ViewChild('dtp') table: Table;
@ViewChild('dtu') tableuser: Table;
@ViewChild('formModal') formModal: ElementRef;
@ViewChild('terms_and_conditions_hds') terms_and_conditions_hds;

new_project: Project
new_project_expire: string
Expand Down
Loading

0 comments on commit fabf67f

Please sign in to comment.