NotesWhat is notes.io?

Notes brand slogan

Notes - notes.io

import React, {useEffect} from 'react';
import moment from 'moment-timezone';
import Papa from 'papaparse';
import Header from '@aosprodsys/brucke-ui-core/dist/es/components/Header';
import FilterTable from '@aosprodsys/brucke-ui-core/dist/es/components/filterTable/FilterTable';
import ActionsMenu from '@aosprodsys/brucke-ui-core/dist/es/components/ActionsMenuV2';
import Position from '@aosprodsys/brucke-ui-core/dist/es/components/Position';
import styles from '../sass/pages/feed-attributes.scss';
import {StoreContext} from '../utils/StoreContext';
import downloadFile from '../utils/downloadFile';

export const FeedAttributes = () => {
const {appState, feedAttributes} = React.useContext(StoreContext);
useEffect(() => {
feedAttributes.initialize();
feedAttributes.fetchFeedTypes();
}, []);
const tableColumns = [
{
Header: 'Attribute',
accessor: 'attribute'
},
{
Header: 'Immediate Parent',
accessor: 'immediateParent',
filterType: 'lookup-multiselect'
},
{
Header: 'Data Type',
accessor: 'dataType',
filterType: 'lookup-multiselect'
}
];
const {feedAttributesSchema, feedTypes, selectedFeedType} = feedAttributes;

const exportFeedAttributesData = (rows = []) => {
let exportRows = rows.map(row => ({
Attribute: row.attribute,
'Immediate Parent': row.immediateParent,
DataType: row.dataType
}));
downloadFile(
`feed_attribute_explorer_export_${moment(new Date()).format('YYYY_MM_DD_HHmm')}.csv`,
'text/csv',
`${Papa.unparse({
fields: Object.keys(exportRows[0] || {}),
data: exportRows
})}`
);
};
return (
<section className={`${styles.feedAttributes} feed-attributes`}>
<Header
onNavIconClick={appState.toggleLeftNav}
title={() => (
<div className="header-info">
<h1 className="global-header-super">Feed Attribute Explorer</h1>
<span className="global-header-subtitle">
(Information about attributes and where Deltamaker sources them from)
</span>
</div>
)}
/>

<section className="feed-attributes-table-container">
<Position>
{({width = window.innerWidth, windowInnerHeight = window.innerHeight}) => (
<FilterTable
height={windowInnerHeight - 350}
width={Math.max(width, 1300)}
columns={tableColumns}
data={feedAttributesSchema}
infiniteScroll={true}
enableGlobalFilter={true}
rowCountRenderer={count => (
<>
{count > 0 && (
<>
<div className="sub-actions-container">
<ActionsMenu
title={selectedFeedType}
align="right"
placement="bottom"
className="global-link-bold"
offsetX={0}
offsetY={8}
tooltipStyles={{borderTopLeftRadius: 0, borderTopRightRadius: 0}}
>
{feedTypes.map(option => (
<span
key={option.name}
className={`global-menu-link action-item`}
onClick={option => {
feedAttributes.updateValue({key: 'selectedFeedType', value: option});
}}
>
{option.label}
</span>
))}
</ActionsMenu>
</div>

<div className="row-label-export-container">
<button
className="global-link-bold"
onClick={() => {
exportFeedAttributesData(feedAttributesSchema);
}}
>
Export Table
</button>
<span>{`${count} ${count > 1 ? 'Rows' : 'Row'}`}</span>
</div>
</>
)}
</>
)}
/>
)}
</Position>
</section>
</section>
);
};

export default FeedAttributes;
     
 
what is notes.io
 

Notes.io is a web-based application for taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000 notes created and continuing...

With notes.io;

  • * You can take a note from anywhere and any device with internet connection.
  • * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
  • * You can quickly share your contents without website, blog and e-mail.
  • * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
  • * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.

Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.

Easy: Notes.io doesn’t require installation. Just write and share note!

Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )

Free: Notes.io works for 12 years and has been free since the day it was started.


You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;


Email: [email protected]

Twitter: http://twitter.com/notesio

Instagram: http://instagram.com/notes.io

Facebook: http://facebook.com/notesio



Regards;
Notes.io Team

     
 
Shortened Note Link
 
 
Looding Image
 
     
 
Long File
 
 

For written notes was greater than 18KB Unable to shorten.

To be smaller than 18KB, please organize your notes, or sign in.