Skip to content

Commit

Permalink
🐛 Added webapp + collections
Browse files Browse the repository at this point in the history
  • Loading branch information
naelob committed Mar 23, 2024
1 parent 13ea074 commit eca0fbf
Show file tree
Hide file tree
Showing 30 changed files with 798 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ export default function ConnectionTable() {
status: connection.status,
linkedUser: connection.id_linked_user,
date: new Date().toISOString(),
connectionToken: connection.connection_token!
}))


Expand Down
29 changes: 28 additions & 1 deletion apps/client-ts/src/components/Connection/columns.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,14 @@ function truncateMiddle(str: string, maxLength: number) {
return `${start}...${end}`;
}

function insertDots(originalString: string): string {
if(!originalString) return "";
if (originalString.length <= 50) {
return originalString;
}
return originalString.substring(0, 50 - 3) + '...';
}

export const columns: ColumnDef<Connection>[] = [
{
id: "select",
Expand Down Expand Up @@ -95,7 +103,7 @@ export const columns: ColumnDef<Connection>[] = [
return value.includes(row.getValue(id))
},
},
{
{
accessorKey: "status",
header: ({ column }) => (
<DataTableColumnHeader column={column} title="Status" />
Expand Down Expand Up @@ -157,5 +165,24 @@ export const columns: ColumnDef<Connection>[] = [
</div>
)
},
},
{
accessorKey: "connectionToken",
header: ({ column }) => (
<DataTableColumnHeader column={column} title="Connection Token" />
),
cell: ({ row }) => {
<div className="flex">
<div className=" truncate mr-2">
<Badge variant="outline">{insertDots(row.getValue("connectionToken"))}</Badge>
</div>
<div
className="h-5 w-5 cursor-pointer mt-1"
onClick={() => navigator.clipboard.writeText(row.getValue("connectionToken"))}
>
<svg width="15" height="15" viewBox="0 0 15 15" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M10.6788 2.95419C10.0435 2.53694 9.18829 2.54594 8.51194 3.00541C8.35757 3.11027 8.1921 3.27257 7.7651 3.69957L7.14638 4.31829C6.95112 4.51355 6.63454 4.51355 6.43928 4.31829C6.24401 4.12303 6.24401 3.80645 6.43928 3.61119L7.058 2.99247C7.0725 2.97797 7.08679 2.96366 7.1009 2.94955C7.47044 2.57991 7.70691 2.34336 7.95001 2.17822C8.94398 1.50299 10.2377 1.46813 11.2277 2.11832C11.4692 2.27689 11.7002 2.508 12.0515 2.85942C12.0662 2.8741 12.081 2.88898 12.0961 2.90408C12.1112 2.91917 12.1261 2.93405 12.1408 2.94871C12.4922 3.30001 12.7233 3.53102 12.8819 3.77248C13.5321 4.76252 13.4972 6.05623 12.822 7.0502C12.6568 7.2933 12.4203 7.52976 12.0507 7.89929C12.0366 7.9134 12.0222 7.92771 12.0077 7.94221L11.389 8.56093C11.1938 8.7562 10.8772 8.7562 10.6819 8.56093C10.4867 8.36567 10.4867 8.04909 10.6819 7.85383L11.3006 7.23511C11.7276 6.80811 11.8899 6.64264 11.9948 6.48827C12.4543 5.81192 12.4633 4.95675 12.046 4.32141C11.9513 4.17714 11.8009 4.02307 11.389 3.61119C10.9771 3.1993 10.8231 3.04893 10.6788 2.95419ZM4.31796 6.43961C4.51322 6.63487 4.51322 6.95146 4.31796 7.14672L3.69924 7.76544C3.27224 8.19244 3.10993 8.35791 3.00507 8.51227C2.54561 9.18863 2.53661 10.0438 2.95385 10.6791C3.0486 10.8234 3.19896 10.9775 3.61085 11.3894C4.02274 11.8012 4.17681 11.9516 4.32107 12.0464C4.95642 12.4636 5.81158 12.4546 6.48794 11.9951C6.6423 11.8903 6.80777 11.728 7.23477 11.301L7.85349 10.6823C8.04875 10.487 8.36533 10.487 8.5606 10.6823C8.75586 10.8775 8.75586 11.1941 8.5606 11.3894L7.94188 12.0081C7.92738 12.0226 7.91307 12.0369 7.89897 12.051C7.52943 12.4206 7.29296 12.6572 7.04986 12.8223C6.05589 13.4976 4.76219 13.5324 3.77214 12.8822C3.53068 12.7237 3.29967 12.4925 2.94837 12.1411C2.93371 12.1264 2.91883 12.1116 2.90374 12.0965C2.88865 12.0814 2.87377 12.0665 2.8591 12.0518C2.50766 11.7005 2.27656 11.4695 2.11799 11.2281C1.4678 10.238 1.50265 8.94432 2.17788 7.95035C2.34303 7.70724 2.57957 7.47077 2.94922 7.10124C2.96333 7.08713 2.97763 7.07283 2.99213 7.05833L3.61085 6.43961C3.80611 6.24435 4.12269 6.24435 4.31796 6.43961Z" fill="currentColor" fillRule="evenodd" clipRule="evenodd"></path></svg>
</div>
</div>
},
}
]
13 changes: 13 additions & 0 deletions apps/client-ts/src/components/Connection/data/connection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ export const CONNECTIONS = [
"category": "medium",
"date": "",
"organisation": "",
"connectionToken": "",

},
{
Expand All @@ -16,6 +17,7 @@ export const CONNECTIONS = [
"category": "medium",
"date": "",
"organisation": "",
"connectionToken": "",
},
{
"linkedUser": "TASK-7839",
Expand All @@ -25,6 +27,7 @@ export const CONNECTIONS = [
"category": "high",
"date": "",
"organisation": "",
"connectionToken": "",
},
{
"linkedUser": "TASK-5562",
Expand All @@ -34,6 +37,7 @@ export const CONNECTIONS = [
"category": "medium",
"date": "",
"organisation": "",
"connectionToken": "",
},
{
"linkedUser": "TASK-8686",
Expand All @@ -43,6 +47,7 @@ export const CONNECTIONS = [
"category": "medium",
"date": "",
"organisation": "",
"connectionToken": "",
},
{
"linkedUser": "TASK-1280",
Expand All @@ -52,6 +57,7 @@ export const CONNECTIONS = [
"category": "high",
"date": "",
"organisation": "",
"connectionToken": "",
},
{
"linkedUser": "TASK-7262",
Expand All @@ -61,6 +67,7 @@ export const CONNECTIONS = [
"category": "high",
"date": "",
"organisation": "",
"connectionToken": "",
},
{
"linkedUser": "TASK-1138",
Expand All @@ -70,6 +77,7 @@ export const CONNECTIONS = [
"category": "medium",
"date": "",
"organisation": "",
"connectionToken": "",
},
{
"linkedUser": "TASK-7184",
Expand All @@ -79,6 +87,7 @@ export const CONNECTIONS = [
"category": "low",
"date": "",
"organisation": "",
"connectionToken": "",
},
{
"linkedUser": "TASK-5160",
Expand All @@ -88,6 +97,7 @@ export const CONNECTIONS = [
"category": "high",
"date": "",
"organisation": "",
"connectionToken": "",
},
{
"linkedUser": "TASK-5618",
Expand All @@ -97,6 +107,7 @@ export const CONNECTIONS = [
"category": "medium",
"date": "",
"organisation": "",
"connectionToken": "",
},
{
"linkedUser": "TASK-6699",
Expand All @@ -106,6 +117,7 @@ export const CONNECTIONS = [
"category": "medium",
"date": "",
"organisation": "",
"connectionToken": "",
},
{
"linkedUser": "TASK-2858",
Expand All @@ -115,5 +127,6 @@ export const CONNECTIONS = [
"category": "medium",
"date": "",
"organisation": "",
"connectionToken": "",
},
]
3 changes: 2 additions & 1 deletion apps/client-ts/src/components/Connection/data/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ export const connectionSchema = z.object({
category: z.string(),
status: z.string(),
linkedUser: z.string(),
date: z.string()
date: z.string(),
connectionToken: z.string()
})

export type Connection = z.infer<typeof connectionSchema>
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@ import { TicketingConnectionsService } from './services/ticketing.connection.ser
import { ServiceRegistry } from './services/registry.service';
import { FrontConnectionService } from './services/front/front.service';
import { GithubConnectionService } from './services/github/github.service';
import { JiraConnectionService } from './services/jira/jira.service';
import { JiraServiceMgmtConnectionService } from './services/jira_service_management/jira.service';
import { LinearConnectionService } from './services/linear/linear.service';
import { GitlabConnectionService } from './services/gitlab/gitlab.service';
import { ClickupConnectionService } from './services/clickup/clickup.service';
import { GorgiasConnectionService } from './services/gorgias/gorgias.service';

@Module({
imports: [WebhookModule],
Expand All @@ -25,6 +31,12 @@ import { GithubConnectionService } from './services/github/github.service';
ZendeskConnectionService,
FrontConnectionService,
GithubConnectionService,
JiraConnectionService,
JiraServiceMgmtConnectionService,
LinearConnectionService,
GitlabConnectionService,
ClickupConnectionService,
GorgiasConnectionService,
],
exports: [TicketingConnectionsService],
})
Expand Down
15 changes: 13 additions & 2 deletions packages/api/src/@core/utils/types/original/original.ticketing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,8 @@ import {
JiraTagInput,
JiraTagOutput,
} from '@ticketing/tag/services/jira/types';
import { GorgiasCollectionOutput } from '@ticketing/collection/services/gorgias/types';
import { JiraCollectionOutput } from '@ticketing/collection/services/jira/types';

/* INPUT */

Expand Down Expand Up @@ -188,6 +190,7 @@ export type OriginalTeamInput =

/* attachment */
export type OriginalAttachmentInput = null;
export type OriginalCollectionInput = null;

export type TicketingObjectInput =
| OriginalTicketInput
Expand All @@ -197,7 +200,8 @@ export type TicketingObjectInput =
| OriginalTagInput
| OriginalTeamInput
| OriginalContactInput
| OriginalAccountInput;
| OriginalAccountInput
| OriginalCollectionInput;

/* OUTPUT */

Expand Down Expand Up @@ -261,6 +265,12 @@ export type OriginalAttachmentOutput =
| GorgiasAttachmentOutput
| JiraAttachmentOutput;

/* collection */

export type OriginalCollectionOutput =
| GorgiasCollectionOutput
| JiraCollectionOutput;

export type TicketingObjectOutput =
| OriginalTicketOutput
| OriginalCommentOutput
Expand All @@ -269,4 +279,5 @@ export type TicketingObjectOutput =
| OriginalTeamOutput
| OriginalTagOutput
| OriginalContactOutput
| OriginalAccountOutput;
| OriginalAccountOutput
| OriginalCollectionOutput;
2 changes: 2 additions & 0 deletions packages/api/src/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import { CoreModule } from '@@core/core.module';
import { BullModule } from '@nestjs/bull';
import { TicketingModule } from '@ticketing/ticketing.module';
import { ThrottlerGuard, ThrottlerModule } from '@nestjs/throttler';
import { ProjectModule } from './project/project.module';

@Module({
imports: [
Expand Down Expand Up @@ -67,6 +68,7 @@ import { ThrottlerGuard, ThrottlerModule } from '@nestjs/throttler';
port: 6379,
},
}),
ProjectModule,
],
controllers: [AppController],
providers: [
Expand Down
15 changes: 13 additions & 2 deletions packages/api/src/ticketing/@utils/@types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,12 @@ import {
UnifiedUserInput,
UnifiedUserOutput,
} from '@ticketing/user/types/model.unified';
import { ICollectionService } from '@ticketing/collection/types';
import {
UnifiedCollectionInput,
UnifiedCollectionOutput,
} from '@ticketing/collection/types/model.unified';
import { collectionUnificationMapping } from '@ticketing/collection/types/mappingsTypes';

export enum TicketingObject {
ticket = 'ticket',
Expand All @@ -55,6 +61,7 @@ export enum TicketingObject {
account = 'account',
tag = 'tag',
team = 'team',
collection = 'collection',
}

export type UnifiedTicketing =
Expand All @@ -73,7 +80,9 @@ export type UnifiedTicketing =
| UnifiedTagInput
| UnifiedTagOutput
| UnifiedAttachmentInput
| UnifiedAttachmentOutput;
| UnifiedAttachmentOutput
| UnifiedCollectionInput
| UnifiedCollectionOutput;

export const unificationMapping = {
[TicketingObject.ticket]: ticketUnificationMapping,
Expand All @@ -83,6 +92,7 @@ export const unificationMapping = {
[TicketingObject.contact]: contactTicketingUnificationMapping,
[TicketingObject.team]: teamUnificationMapping,
[TicketingObject.tag]: tagUnificationMapping,
[TicketingObject.collection]: collectionUnificationMapping,
};

export type ITicketingService =
Expand All @@ -93,7 +103,8 @@ export type ITicketingService =
| IContactService
| IAccountService
| ITeamService
| ITagService;
| ITagService
| ICollectionService;

/*TODO: export all providers */
export * from '../../ticket/services/zendesk/types';
Expand Down
Loading

0 comments on commit eca0fbf

Please sign in to comment.