console: update sidebar icons for different action and trigger types (#5445)

This commit is contained in:
Rikin Kachhia 2020-07-22 17:10:17 +05:30 committed by GitHub
parent af5a70b202
commit 03305bb788
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 32 additions and 6 deletions

View File

@ -6,6 +6,7 @@
(Add entries here in the order of: server, console, cli, docs, others) (Add entries here in the order of: server, console, cli, docs, others)
- console: update sidebar icons for different action and trigger types
## `v1.3.0` ## `v1.3.0`

View File

@ -53,6 +53,17 @@ const LeftSidebarSection = ({
itemList = [...items]; itemList = [...items];
} }
const getServiceIcon = () => {
switch (service) {
case 'cron':
return 'fa-calendar';
case 'data':
return 'fa-database';
default:
return 'fa-wrench';
}
};
const getChildList = () => { const getChildList = () => {
let childList; let childList;
if (itemList.length === 0) { if (itemList.length === 0) {
@ -62,6 +73,8 @@ const LeftSidebarSection = ({
</li> </li>
); );
} else { } else {
const serviceIcon = getServiceIcon();
childList = itemList.map(a => { childList = itemList.map(a => {
let activeTableClass = ''; let activeTableClass = '';
if (currentItem && currentItem.name === a.name) { if (currentItem && currentItem.name === a.name) {
@ -76,7 +89,7 @@ const LeftSidebarSection = ({
> >
<Link to={getServiceEntityLink(a.name)} data-test={a.name}> <Link to={getServiceEntityLink(a.name)} data-test={a.name}>
<i <i
className={`${styles.tableIcon} fa fa-wrench`} className={`${styles.tableIcon} fa ${serviceIcon}`}
aria-hidden="true" aria-hidden="true"
/> />
{a.name} {a.name}

View File

@ -41,6 +41,17 @@ const LeftSidebar = ({
actionsList = [...actions]; actionsList = [...actions];
} }
const getActionIcon = action => {
switch (action.action_defn.type) {
case 'mutation':
return 'fa-pencil-square-o';
case 'query':
return 'fa-book';
default:
return 'fa-wrench';
}
};
const getChildList = () => { const getChildList = () => {
let childList; let childList;
if (actionsList.length === 0) { if (actionsList.length === 0) {
@ -59,6 +70,8 @@ const LeftSidebar = ({
activeTableClass = styles.activeLink; activeTableClass = styles.activeLink;
} }
const actionIcon = getActionIcon(a);
return ( return (
<li <li
className={activeTableClass} className={activeTableClass}
@ -70,7 +83,7 @@ const LeftSidebar = ({
data-test={a.action_name} data-test={a.action_name}
> >
<i <i
className={styles.tableIcon + ' fa fa-wrench'} className={styles.tableIcon + ' fa ' + actionIcon}
aria-hidden="true" aria-hidden="true"
/> />
{a.action_name} {a.action_name}

View File

@ -536,8 +536,7 @@ class Schema extends Component {
'Relationships inferred via foreign-keys that are not exposed over the GraphQL API', 'Relationships inferred via foreign-keys that are not exposed over the GraphQL API',
<> <>
<KnowMoreLink href="https://hasura.io/docs/1.0/graphql/manual/schema/table-relationships/index.html" /> <KnowMoreLink href="https://hasura.io/docs/1.0/graphql/manual/schema/table-relationships/index.html" />
&nbsp; <span className={styles.add_mar_left}>{getTrackAllBtn()}</span>
{getTrackAllBtn()}
</> </>
); );

View File

@ -37,7 +37,7 @@ const Info: React.FC = () => {
<div className={styles.padd_left}> <div className={styles.padd_left}>
<TopicDescription <TopicDescription
title="What are Scheduled events?" title="What are Scheduled events?"
imgUrl={`${globals.assetsPath}/common/img/scheduled-trigger.png`} imgUrl={`${globals.assetsPath}/common/img/scheduled-event.png`}
imgAlt={ADHOC_EVENTS_HEADING} imgAlt={ADHOC_EVENTS_HEADING}
description={topicDescription} description={topicDescription}
/> />

View File

@ -50,7 +50,7 @@ const Landing: React.FC<Props> = props => {
<div> <div>
<TopicDescription <TopicDescription
title="What are Cron Triggers?" title="What are Cron Triggers?"
imgUrl={`${globals.assetsPath}/common/img/scheduled-trigger.png`} imgUrl={`${globals.assetsPath}/common/img/cron-trigger.png`}
imgAlt={CRON_TRIGGER} imgAlt={CRON_TRIGGER}
description={topicDescription} description={topicDescription}
/> />