Skip to content

Commit

Permalink
Version 1.0.1
Browse files Browse the repository at this point in the history
Version 1.0.1
  • Loading branch information
Alexxiia authored Jan 11, 2023
2 parents 0fab3a1 + ab3bce4 commit 56425df
Show file tree
Hide file tree
Showing 83 changed files with 1,667 additions and 514 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "vernite",
"version": "1.0.0",
"version": "1.0.1",
"scripts": {
"@------ WORKFLOW SCRIPTS --------": "",
"postinstall": "husky install",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,12 @@
<span class="header" i18n>Calendar</span>
</sidebar-entry>

<sidebar-entry [icon]="faMessage" [collapsed]="isCollapsed" [expandable]="(slackIntegrations$ | async)?.length">
<sidebar-entry *ngIf="!(slackIntegrations$ | async)?.length" [icon]="faMessage" routerLink="/messages/no-integration"
[collapsed]="isCollapsed">
<span class="header" i18n>Messages</span>
</sidebar-entry>
<sidebar-entry *ngIf="(slackIntegrations$ | async)?.length" [icon]="faMessage" [collapsed]="isCollapsed"
[expandable]="true">
<span class="header" i18n>Messages</span>
<div class="content">
<sidebar-entry *ngFor="let integration of slackIntegrations$ | async" [icon]="faServer" [collapsed]="isCollapsed"
Expand All @@ -28,7 +33,21 @@
</div>
</sidebar-entry>

<sidebar-entry [icon]="faLayerGroup" [collapsed]="isCollapsed" [expandable]="true" [showOptions]="true">
<sidebar-entry *ngIf="!(workspaceList$ | async)?.length" [icon]="faLayerGroup" [collapsed]="isCollapsed"
[expandable]="false" [showOptions]="true" routerLink="/workspaces">
<span class="header" i18n>Workspaces</span>
<ng-container class="options">
<button mat-menu-item routerLink="/workspaces">
<span i18n>Manage workspaces</span>
</button>
<button mat-menu-item routerLink="/workspaces/create">
<span i18n>Create new workspace</span>
</button>
</ng-container>
</sidebar-entry>

<sidebar-entry *ngIf="(workspaceList$ | async)?.length" [icon]="faLayerGroup" [collapsed]="isCollapsed"
[expandable]="true" [showOptions]="true">
<span class="header" i18n>Workspaces</span>
<ng-container class="options">
<button mat-menu-item routerLink="/workspaces">
Expand All @@ -39,52 +58,73 @@
</button>
</ng-container>
<div class="content">
<sidebar-entry *ngFor="let workspace of workspaceList$ | async" [expandable]="true" [collapsed]="isCollapsed"
[textIcon]="true" [showOptions]="true">
<span class="header">{{ workspace.name }}</span>
<div class="content">
<sidebar-entry *ngFor="let projectWithPrivileges of workspace.projectsWithPrivileges"
[collapsed]="isCollapsed" [textIcon]="!projectWithPrivileges.project.logo"
[imageIcon]="projectWithPrivileges.project.logo?.url" [showOptions]="true"
[routerLink]="['/', 'projects', projectWithPrivileges.project.id]">
<span class="header">{{ projectWithPrivileges.project.name }}</span>
<ng-container class="options">
<button mat-menu-item *ngIf="projectWithPrivileges.project.gitHubIntegration"
(click)="openWithVSCode(projectWithPrivileges.project)">
<span i18n>Open in github.dev</span>
</button>
<button mat-menu-item *ngIf="projectWithPrivileges.project.gitHubIntegration"
(click)="openWithLocalVSCode(projectWithPrivileges.project)">
<span i18n>Open in Visual Studio Code</span>
</button>
<button mat-menu-item *ngIf="projectWithPrivileges.project.gitHubIntegration"
(click)="openWithLocalVSCodeInsiders(projectWithPrivileges.project)">
<span i18n>Open in Visual Studio Code Insiders</span>
</button>
<button mat-menu-item (click)="editProject(projectWithPrivileges.project)">
<span i18n>Edit project</span>
</button>
<button mat-menu-item class="important" (click)="deleteProject(projectWithPrivileges.project)">
<span i18n>Delete project</span>
</button>
</ng-container>
</sidebar-entry>
</div>
<ng-container class="options">
<button mat-menu-item (click)="createProject(workspace)">
<span i18n>Create project</span>
</button>
<button mat-menu-item (click)="routeToWorkspace(workspace)">
<span i18n>Manage projects</span>
</button>
<button mat-menu-item (click)="editWorkspace(workspace)">
<span i18n>Edit workspace</span>
</button>
<button mat-menu-item class="important" (click)="deleteWorkspace(workspace)">
<span i18n>Delete workspace</span>
</button>
</ng-container>
</sidebar-entry>
<ng-container *ngFor="let workspace of workspaceList$ | async">
<sidebar-entry *ngIf="!workspace.projectsWithPrivileges?.length" [expandable]="false" [collapsed]="isCollapsed"
[textIcon]="true" [showOptions]="true" [routerLink]="['/', 'workspaces', workspace.id, 'projects']">
<span class="header">{{ workspace.name }}</span>
<ng-container class="options">
<button mat-menu-item (click)="createProject(workspace)">
<span i18n>Create project</span>
</button>
<button mat-menu-item (click)="routeToWorkspace(workspace)">
<span i18n>Manage projects</span>
</button>
<button mat-menu-item (click)="editWorkspace(workspace)">
<span i18n>Edit workspace</span>
</button>
<button mat-menu-item class="important" (click)="deleteWorkspace(workspace)">
<span i18n>Delete workspace</span>
</button>
</ng-container>
</sidebar-entry>

<sidebar-entry *ngIf="workspace.projectsWithPrivileges?.length" [expandable]="true" [collapsed]="isCollapsed"
[textIcon]="true" [showOptions]="true">
<span class="header">{{ workspace.name }}</span>
<div class="content">
<sidebar-entry *ngFor="let projectWithPrivileges of workspace.projectsWithPrivileges"
[collapsed]="isCollapsed" [textIcon]="!projectWithPrivileges.project.logo"
[imageIcon]="projectWithPrivileges.project.logo?.url" [showOptions]="true"
[routerLink]="['/', 'projects', projectWithPrivileges.project.id]">
<span class="header">{{ projectWithPrivileges.project.name }}</span>
<ng-container class="options">
<button mat-menu-item *ngIf="projectWithPrivileges.project.gitHubIntegration"
(click)="openWithVSCode(projectWithPrivileges.project)">
<span i18n>Open in github.dev</span>
</button>
<button mat-menu-item *ngIf="projectWithPrivileges.project.gitHubIntegration"
(click)="openWithLocalVSCode(projectWithPrivileges.project)">
<span i18n>Open in Visual Studio Code</span>
</button>
<button mat-menu-item *ngIf="projectWithPrivileges.project.gitHubIntegration"
(click)="openWithLocalVSCodeInsiders(projectWithPrivileges.project)">
<span i18n>Open in Visual Studio Code Insiders</span>
</button>
<button mat-menu-item (click)="editProject(projectWithPrivileges.project)">
<span i18n>Edit project</span>
</button>
<button mat-menu-item class="important" (click)="deleteProject(projectWithPrivileges.project)">
<span i18n>Delete project</span>
</button>
</ng-container>
</sidebar-entry>
</div>
<ng-container class="options">
<button mat-menu-item (click)="createProject(workspace)">
<span i18n>Create project</span>
</button>
<button mat-menu-item (click)="routeToWorkspace(workspace)">
<span i18n>Manage projects</span>
</button>
<button mat-menu-item (click)="editWorkspace(workspace)">
<span i18n>Edit workspace</span>
</button>
<button mat-menu-item class="important" (click)="deleteWorkspace(workspace)">
<span i18n>Delete workspace</span>
</button>
</ng-container>
</sidebar-entry>
</ng-container>
</div>
</sidebar-entry>
</div>
8 changes: 6 additions & 2 deletions src/app/_main/dialogs/report-bug/report-bug.dialog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { Component, OnInit } from '@angular/core';
import { FormControl, FormGroup } from '@ngneat/reactive-forms';
import { validateForm } from '@main/classes/form.class';
import { requiredValidator } from '@main/validators/required.validator';
import { lengthValidator } from '@main/validators/length.validator';

/** Report bug dialog component */
@Component({
Expand All @@ -13,8 +14,11 @@ import { requiredValidator } from '@main/validators/required.validator';
export class ReportBugDialog implements OnInit {
/** Report bug dialog form */
public form = new FormGroup({
title: new FormControl<string | null>('', [requiredValidator()]),
description: new FormControl<string | null>(''),
title: new FormControl<string | null>('', [requiredValidator(), lengthValidator(3, 100)]),
description: new FormControl<string | null>('', [
requiredValidator(),
lengthValidator(3, 1000),
]),
});

constructor(private dialogRef: MatDialogRef<ReportBugDialog>) {}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
<cdk-virtual-scroll-viewport autosize class="grow">
<audit-log-entry *cdkVirtualFor="let auditLog of auditLogs; trackBy: trackByAuditLog"
[auditLog]="auditLog"></audit-log-entry>
</cdk-virtual-scroll-viewport>
<ng-container *ngIf="!noScroll; else noScroll">
<cdk-virtual-scroll-viewport autosize class="grow">
<audit-log-entry *cdkVirtualFor="let auditLog of auditLogs; trackBy: trackByAuditLog"
[auditLog]="auditLog"></audit-log-entry>
</cdk-virtual-scroll-viewport>
</ng-container>
<ng-template #noScroll>
<audit-log-entry *ngFor="let auditLog of auditLogs; trackBy: trackByAuditLog" [auditLog]="auditLog"></audit-log-entry>
</ng-template>
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ import { AuditLog } from '../../interfaces/audit-log.interface';
export class AuditLogComponent {
@Input() auditLogs!: AuditLog<any>[];

@Input() noScroll: boolean = false;

public trackByAuditLog(index: number, auditLog: AuditLog<any>) {
return auditLog.date;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,12 +148,20 @@ export class AuditLogProjectEntriesPipe implements PipeTransform {
case 'assigneeId':
return {
label: $localize`assignee`,
oldValue: members.find(
(member) => member.user.id === auditLog.oldValues?.assigneeId,
)?.user.name,
newValue: members.find(
(member) => member.user.id === auditLog.newValues?.assigneeId,
)?.user.name,
oldValue: (() => {
const member = members.find(
(member) => member.user.id === auditLog.oldValues?.assigneeId,
);
if (!member)
return $localize`:unknown user|ctx. Changed assignee from unknown user to someone else:Unknown`;
return `${member?.user.name} ${member?.user.surname}`;
})(),
newValue: (() => {
const member = members.find(
(member) => member.user.id === auditLog.newValues?.assigneeId,
);
return `${member?.user.name} ${member?.user.surname}`;
})(),
};
case 'sprintId':
return {
Expand Down
22 changes: 22 additions & 0 deletions src/app/_main/validators/boolean.validator.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { FormControl } from '@ngneat/reactive-forms';
import { expectToFail, expectToPass } from '@tests/helpers/validator-testing.helper';
import { booleanValidator } from './boolean.validator';

describe('Test boolean validator', () => {
const validator = booleanValidator();

it('should pass', () => {
const control = new FormControl(true);
expectToPass(validator(control));
});

it('should pass', () => {
const control = new FormControl(false);
expectToPass(validator(control));
});

it('should not pass', () => {
const control = new FormControl(null);
expectToFail(validator(control));
});
});
18 changes: 18 additions & 0 deletions src/app/_main/validators/boolean.validator.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { AbstractControl, ValidatorFn } from '@angular/forms';
import { ValidationError } from '../interfaces/validation-error.interface';

/**
* Validator to check if the variable is a boolean
* @returns {ValidatorFn}
*/
export function booleanValidator(): ValidatorFn {
return (control: AbstractControl): ValidationError | null => {
if (control.value !== true && control.value !== false) {
return {
type: 'boolean',
message: $localize`It should be a boolean`,
};
}
return null;
};
}
32 changes: 32 additions & 0 deletions src/app/_main/validators/length.validator.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import { FormControl } from '@ngneat/reactive-forms';
import { expectToFail, expectToPass } from '@tests/helpers/validator-testing.helper';
import { lengthValidator } from './length.validator';

describe('Test length limit validator', () => {
const validator = lengthValidator(3, 50);

it('should pass', () => {
const control = new FormControl('a0123456789');
expectToPass(validator(control));
});

it('should pass', () => {
const control = new FormControl('abc');
expectToPass(validator(control));
});

it('should pass', () => {
const control = new FormControl('');
expectToPass(validator(control));
});

it('should not pass', () => {
const control = new FormControl('a');
expectToFail(validator(control));
});

it('should not pass', () => {
const control = new FormControl('012345678901234567890123456789012345678901234567890');
expectToFail(validator(control));
});
});
23 changes: 23 additions & 0 deletions src/app/_main/validators/length.validator.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { AbstractControl, ValidatorFn } from '@angular/forms';
import { ValidationError } from '../interfaces/validation-error.interface';

/**
* Validator to check if the length is not lesser or greater than specyfic numbers, but is different than 0
* @returns {ValidatorFn}
*/
export function lengthValidator(min_length: number, max_length: number): ValidatorFn {
return (control: AbstractControl): ValidationError | null => {
if (control.value.length > max_length) {
return {
type: 'max-length',
message: $localize`Length should not be greater than ${max_length}`,
};
} else if (control.value.length < min_length && control.value.length != 0) {
return {
type: 'min-length',
message: $localize`Length should not be lesser than ${min_length}`,
};
}
return null;
};
}
7 changes: 4 additions & 3 deletions src/app/_main/validators/max-length.validator.spec.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
import { FormControl } from '@ngneat/reactive-forms';
import { expectToFail, expectToPass } from '@tests/helpers/validator-testing.helper';
import { maxLengthValidator } from './max-length.validator';

describe('Test length limit validator', () => {
describe('Test maximum length limit validator', () => {
const validator = maxLengthValidator(50);

it('should pass', () => {
const control = new FormControl('a0123456789');
expect(validator(control)).toBeNull();
expectToPass(validator(control));
});

it('should not pass', () => {
const control = new FormControl('012345678901234567890123456789012345678901234567890');
expect(validator(control)).toBeTruthy();
expectToFail(validator(control));
});
});
22 changes: 22 additions & 0 deletions src/app/_main/validators/min-length.validator.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { FormControl } from '@ngneat/reactive-forms';
import { expectToFail, expectToPass } from '@tests/helpers/validator-testing.helper';
import { minLengthValidator } from './min-length.validator';

describe('Test minimum length limit validator', () => {
const validator = minLengthValidator(3);

it('should pass', () => {
const control = new FormControl('abc');
expectToPass(validator(control));
});

it('should pass', () => {
const control = new FormControl('');
expectToPass(validator(control));
});

it('should not pass', () => {
const control = new FormControl('a');
expectToFail(validator(control));
});
});
18 changes: 18 additions & 0 deletions src/app/_main/validators/min-length.validator.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { AbstractControl, ValidatorFn } from '@angular/forms';
import { ValidationError } from '../interfaces/validation-error.interface';

/**
* Validator to check if the length is not lesser than specyfic number, but is different than 0
* @returns {ValidatorFn}
*/
export function minLengthValidator(length: number): ValidatorFn {
return (control: AbstractControl): ValidationError | null => {
if (control.value.length < length && control.value.length != 0) {
return {
type: 'min-length',
message: $localize`Length should not be lesser than ${length}`,
};
}
return null;
};
}
Loading

0 comments on commit 56425df

Please sign in to comment.