Skip to content

Commit

Permalink
feat: votes added if selected as field (#603)
Browse files Browse the repository at this point in the history
- Interface for Votes
- Votes addedd with number format

resolve WEB-2464

Co-authored-by: Krystian Kedra <krystian.kedra-ext@sanofi.com>
  • Loading branch information
PiiXiieeS and Krystian Kedra authored Feb 4, 2025
1 parent 60fc042 commit 0bac1cf
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 4 deletions.
19 changes: 18 additions & 1 deletion src/proxy-page/dto/FieldInterface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ export const isIssue = (obj: any): obj is Issue =>
&& 'id' in obj
&& 'key' in obj
&& 'self' in obj;

export interface Option {
self: string;
value: string;
Expand All @@ -72,6 +71,19 @@ export const isOption = (obj: any): obj is Option =>
&& 'value' in obj
&& 'id' in obj;

export interface Votes {
self: string;
votes: number;
hasVoted: boolean;
}

export const isVotes = (obj: any): obj is Votes =>
obj
&& typeof obj === 'object'
&& 'self' in obj
&& 'votes' in obj
&& 'hasVoted' in obj;

export interface User {
self: string;
accountId: string;
Expand Down Expand Up @@ -335,6 +347,11 @@ export const formatDate = (dateString) => {
return [[formatted], 'date'];
};

export const formatVotes = (value: any) => {
const votes = getAllValues(value, isVotes, 'votes');
return [votes, 'normal'];
};

export const formatNumber = (number) => [[number || ''], 'normal'];

export const formatString = (string) => {
Expand Down
8 changes: 5 additions & 3 deletions src/proxy-page/steps/addJira.ts
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,7 @@ export default (config: ConfigService, jiraService: JiraService): Step => async
string: FieldInterfaces.formatString,
resolution: FieldInterfaces.formatResolution,
version: FieldInterfaces.formatVersion,
votes: FieldInterfaces.formatVotes,
component: FieldInterfaces.formatComponent,
team: FieldInterfaces.formatTeam,
status: FieldInterfaces.formatStatus,
Expand Down Expand Up @@ -360,17 +361,18 @@ export default (config: ConfigService, jiraService: JiraService): Step => async
new gridjs.Grid({
columns: ${gridjsColumns},
data: ${JSON.stringify(preparedData)},
resizable: true,
sort: true,
search: {
enabled: true,
selector: (cell, rowIndex, cellIndex) => cell.data?.map(item => item?.name).filter(name => name).join(', ') || cell.data
selector: (cell, rowIndex, cellIndex) => cell.data?.map(item => item?.name).filter(name => name).join(', ') || cell.data
},
width: '100%',
style: {
td: {
padding: '5px 5px',
maxWidth: '500px',
minWidth: '25px',
maxWidth: '200px',
minWidth: '10px',
overflow: 'auto',
},
th: {
Expand Down

0 comments on commit 0bac1cf

Please sign in to comment.