Skip to content

Commit

Permalink
added pinned functionality to flow listing
Browse files Browse the repository at this point in the history
  • Loading branch information
kurund committed Jul 31, 2022
1 parent aa35a0a commit ae22679
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/common/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ export const setColumnToBackendTerms: any = (listName: string, columnName: strin
};

const additionalItems: any = {
flow: { TITLE: 'name' },
flow: { TITLE: 'name', ' ': 'is_pinned' },
trigger: { TITLE: 'name' },
Search: {
TITLE: 'shortcode',
Expand Down
4 changes: 4 additions & 0 deletions src/containers/Flow/FlowList/FlowList.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@
min-width: 200px;
}

.Pinned {
width: 6%;
}

.Actions {
justify-content: flex-end;
margin-left: auto;
Expand Down
22 changes: 19 additions & 3 deletions src/containers/Flow/FlowList/FlowList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,20 @@ const getLastPublished = (date: string, fallback: string = '') =>
<div className={styles.LastPublishedFallback}>{fallback}</div>
);

const columnStyles = [styles.Name, styles.DateColumn, styles.DateColumn, styles.Actions];
const displayPinned = (isPinned: boolean) => {
if (isPinned) {
return 'Pinned';
}
return '';
};

const columnStyles = [
styles.Pinned,
styles.Name,
styles.DateColumn,
styles.DateColumn,
styles.Actions,
];
const flowIcon = <FlowIcon className={styles.FlowIcon} />;

const queries = {
Expand Down Expand Up @@ -160,13 +173,14 @@ export const FlowList: React.SFC<FlowListProps> = () => {
},
];

const getColumns = ({ name, keywords, lastChangedAt, lastPublishedAt }: any) => ({
const getColumns = ({ name, keywords, lastChangedAt, lastPublishedAt, isPinned }: any) => ({
pin: displayPinned(isPinned),
name: getName(name, keywords),
lastPublishedAt: getLastPublished(lastPublishedAt, t('Not published yet')),
lastChangedAt: getDate(lastChangedAt, t('Nothing in draft')),
});

const columnNames = ['TITLE', 'LAST PUBLISHED', 'LAST SAVED IN DRAFT', 'ACTIONS'];
const columnNames = [' ', 'TITLE', 'LAST PUBLISHED', 'LAST SAVED IN DRAFT', 'ACTIONS'];
const dialogMessage = t("You won't be able to use this flow.");

const columnAttributes = {
Expand Down Expand Up @@ -195,6 +209,8 @@ export const FlowList: React.SFC<FlowListProps> = () => {
additionalAction={additionalAction}
button={{ show: true, label: t('+ Create Flow') }}
secondaryButton={importButton}
defaultSortBy=" "
listOrder="desc"
/>

<Link to="/webhook-logs" className={styles.Webhook}>
Expand Down
1 change: 1 addition & 0 deletions src/graphql/queries/Flow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ export const FILTER_FLOW = gql`
lastPublishedAt
ignoreKeywords
updatedAt
isPinned
}
}
`;
Expand Down

0 comments on commit ae22679

Please sign in to comment.