Skip to content

Commit

Permalink
Version 1.1.0
Browse files Browse the repository at this point in the history
Version 1.1.0
  • Loading branch information
Alexxiia authored Jan 15, 2023
2 parents 3d110de + 1ae7035 commit d4a45c4
Show file tree
Hide file tree
Showing 12 changed files with 94 additions and 48 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.3",
"version": "1.1.0",
"scripts": {
"@------ WORKFLOW SCRIPTS --------": "",
"postinstall": "husky install",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,30 @@
transition: width .4s ease;
}

.dialog-outlet {
:host .dialog-outlet {
width: 100%;
height: 100%;
padding: 0;
border-radius: 0;
overflow-y: auto;
}

::ng-deep>* {
display: flex;
height: 100%;
flex-direction: column;

.mat-dialog-title {
display: block;
padding: 2rem 2rem 0 2rem;
}

.mat-dialog-content {
overflow: auto;
flex: 1;
padding: 0 2rem;
}

.mat-dialog-actions {
padding: 2rem 2rem 2rem 2rem;
}
}
}
6 changes: 2 additions & 4 deletions src/app/_main/dialogs/manual/manual.dialog.scss
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
:host {
position: relative;
display: block;
width: calc(100% + 4rem);
height: calc(100% + 4rem);
margin: -2rem;
}

.mat-dialog-content {
height: 100%;
margin: 0 -2rem;
}

.close-button {
Expand All @@ -25,4 +23,4 @@
height: 100%;
align-items: center;
justify-content: center;
}
}
8 changes: 4 additions & 4 deletions src/app/_main/pipes/markdown/markdown.pipe.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { DomSanitizer, SafeHtml } from '@angular/platform-browser';
import { PipeTransform, Pipe } from '@angular/core';
import { DomSanitizer } from '@angular/platform-browser';
import { PipeTransform, Pipe, SecurityContext } from '@angular/core';
import { marked, Renderer } from 'marked';
import { Marked } from '@main/libs/marked/marked.lib';

Expand All @@ -23,7 +23,7 @@ export class MarkdownPipe implements PipeTransform {
* @param value - markdown to display
* @returns markdown
*/
transform(value: string): SafeHtml {
transform(value: string): string {
// const innerHTML = marked.parse(value || '', { renderer: this.renderer });
// TODO: Add hljs to the marked options (https://marked.js.org/using_advanced)
// this.output.nativeElement
Expand All @@ -32,6 +32,6 @@ export class MarkdownPipe implements PipeTransform {
// hljs.highlightElement(c);
// });

return this.sanitizer.bypassSecurityTrustHtml(marked(value));
return this.sanitizer.sanitize(SecurityContext.HTML, marked(value)) || '';
}
}
3 changes: 3 additions & 0 deletions src/app/dashboard/interfaces/project.interface.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { ProjectMember } from './project-member.interface';
import { JSONParsable } from './../../_main/interfaces/json-parsable.interface';
import { ApiFile } from '@main/interfaces/api-file.interface';
import { Status } from '../../tasks/interfaces/status.interface';

export interface Project extends JSONParsable {
/**
Expand Down Expand Up @@ -34,4 +35,6 @@ export interface Project extends JSONParsable {
* Logo file metadata
*/
logo?: ApiFile;

statuses: Status[];
}
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
import { Component, OnInit } from '@angular/core';
import { TaskService } from '../../../../../tasks/services/task/task.service';
import { map, Observable, switchMap, forkJoin, of, EMPTY } from 'rxjs';
import { Observable, forkJoin, EMPTY, map } from 'rxjs';
import { MemberService } from '../../../../services/member/member.service';
import { ProjectMember } from '../../../../interfaces/project-member.interface';
import { Status } from '../../../../../tasks/interfaces/status.interface';
import { Task } from '@tasks/interfaces/task.interface';
import { ProjectService } from '../../../../services/project/project.service';
import { StatusService } from '../../../../../tasks/services/status/status.service';
import { Project } from '../../../../interfaces/project.interface';
import { TaskFilters } from '../../../../../tasks/filters/task.filters';
import { UserService } from '../../../../../auth/services/user/user.service';
import { Loader } from '../../../../../_main/classes/loader/loader.class';
import { withLoader } from '../../../../../_main/operators/loader.operator';
Expand Down Expand Up @@ -45,24 +44,27 @@ export class WidgetTasksComponent implements OnInit {
}

private loadProjects() {
return this.projectService.list().pipe(
switchMap((projects) => {
return forkJoin(projects.map((project) => this.loadProject(project)));
return forkJoin({
projects: this.projectService.list(),
tasks: this.taskService.listTasksAssignedToMe(),
}).pipe(
map(({ projects, tasks }) => {
return projects.map((project) =>
this.loadProject(
project,
tasks.filter((task) => task.projectId === project.id),
),
);
}),
map((projects) => projects.filter((project) => project.tasks.length > 0)),
);
}

private loadProject(project: Project) {
return this.userService.getMyself().pipe(
switchMap((user) => {
return forkJoin({
project: of(project),
members: this.memberService.map(project.id),
statuses: this.statusService.list(project.id),
tasks: this.taskService.list(project.id, TaskFilters.ASSIGNEE_ID(user.id)),
});
}),
);
private loadProject(project: Project, tasks: Task[]) {
return {
project: project,
members: new Map(),
statuses: project.statuses,
tasks: tasks,
};
}
}
2 changes: 1 addition & 1 deletion src/app/messages/interfaces/slack.interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export interface SlackChannel extends JSONParsable {
/** Interface to represent Slack channel with user */
export interface SlackChannelWithUser extends Omit<SlackChannel, 'user'> {
/** The user the slack channel is with */
user?: SlackUser;
user?: SlackUser | null;
}

/** Interface to represent Slack integration */
Expand Down
40 changes: 25 additions & 15 deletions src/app/messages/services/slack-integration.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,21 @@ export class SlackIntegrationService extends BaseService<
);
}

/**
* Get slack users by integration id
* @param slackId Slack integration id
* @returns Observable with users list
*/
@Cache()
public getUsers(slackId: number): Observable<SlackUser[]> {
return this.apiService.get(`/user/integration/slack/${slackId}/user`).pipe(
this.validate({
404: 'INTEGRATION_NOT_FOUND',
409: 'CONFLICT',
}),
);
}

/**
* Get messages from slack channel
* @param slackId Slack integration id
Expand Down Expand Up @@ -182,21 +197,16 @@ export class SlackIntegrationService extends BaseService<
* @returns list of slack channels joined with users
*/
public getChannelsWithUsers(slackId: number) {
return this.getChannels(slackId).pipe(
switchMap((channels) => {
return forkJoin(
channels.map((channel) => {
if (!channel.user) return of(channel as SlackChannelWithUser);

return this.getUser(slackId, channel.user).pipe(
map((user) => ({
...channel,
user,
})),
);
}),
);
}),
return forkJoin({
channels: this.getChannels(slackId),
users: this.getUsers(slackId),
}).pipe(
map(({ channels, users }) =>
channels.map((channel) => ({
...channel,
user: (channel.user && users.find((user) => user.id === channel.user)) || null,
})),
),
);
}

Expand Down
2 changes: 1 addition & 1 deletion src/app/tasks/pages/task/task.page.html
Original file line number Diff line number Diff line change
Expand Up @@ -114,4 +114,4 @@ <h4 class="text-lg font-bold mt-5" i18n>Dates</h4>
</div>
</div>

</div>
</div>
8 changes: 8 additions & 0 deletions src/app/tasks/services/task/task.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -381,4 +381,12 @@ export class TaskService extends BaseService<
map((tasks) => tasks.filter((task) => task.type === TaskType.EPIC)),
);
}

/**
* List all tasks assigned to current user
* @returns Observable with list of tasks assigned to current user
*/
public listTasksAssignedToMe(): Observable<(Task & { projectId: number })[]> {
return this.apiService.get('/me/tasks');
}
}
4 changes: 2 additions & 2 deletions src/styles/material/dialog.material.scss
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,17 @@ app-dialog-outlet {

.mat-dialog-content {
@include text-base;
max-height: 100vh;
}

.mat-dialog-actions {
display: flex;
justify-content: flex-end;
padding-top: 1.25rem;
border-top: 1px solid var(--color-dialog-delimiter);
margin-top: 1.25rem;

>* {
margin-left: 1.25rem;
}
}
}
}
4 changes: 4 additions & 0 deletions src/styles/styles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@
@tailwind utilities;

// Global styles
html {
overflow: hidden;
}

html,
body {
height: 100%;
Expand Down

0 comments on commit d4a45c4

Please sign in to comment.