Пример #1
0
    def file_upload(filenames, filecontents):
        if filenames is not None and filecontents is not None:
            for name, content in zip(filenames, filecontents):
                data = content.encode("utf8").split(b";base64,")[1]
                with open(os.path.join('./temp', name), "wb") as fp:
                    fp.write(base64.decodebytes(data))

        files = []
        for filename in os.listdir('./temp'):
            path = os.path.join('./temp', filename)
            if os.path.isfile(path):
                files.append(filename)

        if len(files) == 0:
            file_list = [
                html.Content(
                    html.
                    B('No files yet! Please use "Select TAB, WAX, Dataset Files"'
                      ))
            ]
        else:
            file_list = [html.Li(html.I(file)) for file in files]
        return file_list
Пример #2
0
def display_kw_df_summary(kw_df_list):
    kw_df = pd.DataFrame(kw_df_list)
    return [
        html.H3('Summary:'),
        html.Content('Total keywords: ' + str(len(kw_df))),
        html.Br(),
        html.Content('Unique Keywords: ' + str(kw_df['Keyword'].nunique())),
        html.Br(),
        html.Content('Ad Groups: ' + str(kw_df['Ad Group'].nunique())),
        html.Br(),
        html.Br(),
        html.Content('For more details on the logic behind generating '
                     'the keywords, please checkout the '),
        html.A('DataCamp tutorial on Search Engine Marketing.',
               href='http://bit.ly/datacamp_sem'),
        html.Br(),
        html.Br(),
        html.Content('Functionality based on the '),
        html.A('advertools', href='http://bit.ly/advertools'),
        html.Content(' package.')
    ]
Пример #3
0
def home_page_layout(data=None):
    if data is None:
        data = {'isadmin': False, 'logged_in': False, 'login_user': None}

    if data['logged_in']:
        # If you are the application admin show the log window otherwise leave it hidden
        if data['login_user'] == site_admin:
            log_display = 'grid'
        else:
            log_display = 'none'
    else:
        log_display = 'none'

    content = html.Div(
        html.Content([
            dbc.Row([
                # Log contents display
                dbc.Col(dbc.Card([
                    dbc.CardHeader(
                        html.H5('Log Output', className='card-title')),
                    dcc.Textarea(id='log-output',
                                 value=read_logfile(),
                                 readOnly=True,
                                 wrap='wrap')
                ]),
                        style={'display': log_display}),
                # Site admin controls
                dbc.Col(
                    dbc.Card([
                        dbc.CardHeader(
                            html.H5('Site Admin Controls',
                                    className='card-title')),
                        dbc.CardBody(
                            # id='site_admin_controls')
                            id='site-admin-card',
                            children=[
                                dcc.Tabs(
                                    id='site-admin-tabs',
                                    value='current_admins_list',
                                    children=[
                                        dcc.Tab(label='Current Admins',
                                                value='current_admins_list',
                                                style={
                                                    'border-radius':
                                                    '15px 0px 0px 0px'
                                                }),
                                        dcc.Tab(label='Edit Admins',
                                                value='site_admin_controls',
                                                style={
                                                    'border-radius':
                                                    '0px 15px 0px 0px'
                                                })
                                    ],
                                ),
                                html.Div(children=[
                                    dcc.Loading(id='site-admin-tabs-content',
                                                type='default')
                                ])
                            ])
                    ]),
                    style={
                        'display': log_display,
                        'maxWidth': '500px',
                        'maxHeight': '32.5vh'
                    },
                ),
            ]),
            dbc.Row([
                # In Development Features Column
                dbc.Col(dbc.Card([
                    dbc.CardHeader(
                        html.H5('Features in Development',
                                className='card-title')),
                    dbc.CardBody(read_upcoming_features())
                ]),
                        xl=4,
                        md=6,
                        width=12),
                # Implemented Features Column
                dbc.Col(dbc.Card([
                    dbc.CardHeader(
                        html.H5('Implemented Features',
                                className='card-title')),
                    dbc.CardBody(read_active_features())
                ]),
                        xl=4,
                        md=6,
                        width=12),
                # User Submission Form Column
                dbc.Col(
                    [
                        html.Div(
                            [
                                dbc.Form([
                                    html.H2('User Submission Form',
                                            style={'text-align': 'center'}),
                                    # Email input field
                                    dbc.FormGroup([
                                        dbc.Label('Email:', width=2),
                                        dbc.Col(dbc.Input(
                                            id='from_addr',
                                            type='email',
                                            placeholder=
                                            'Enter your L3Harris email address',
                                            value=''),
                                                width=10),
                                        dbc.FormFeedback(valid=True),
                                        dbc.FormFeedback(valid=False)
                                    ],
                                                  row=True),
                                    dbc.FormGroup(
                                        [
                                            dbc.Label('Choose one', width=4),
                                            dbc.Col(dbc.Select(
                                                options=[{
                                                    'label': 'Report a Bug',
                                                    'value': '1'
                                                }, {
                                                    'label': 'Feature Request',
                                                    'value': '2'
                                                }, {
                                                    'label': 'Request Admin',
                                                    'value': '3'
                                                }],
                                                id='msgType',
                                                value=1),
                                                    width=8)
                                        ],
                                        row=True),
                                    dbc.FormGroup([
                                        dbc.Textarea(
                                            id='body',
                                            bs_size='lg',
                                            placeholder=
                                            'Enter comments/suggestions',
                                            style={'height': '200px'},
                                            value='')
                                    ]),
                                    dbc.FormGroup([
                                        html.Div(
                                            '0',
                                            id='reset-div',
                                            style={'visibility': 'hidden'}),
                                        dbc.Button('Submit',
                                                   id='submit',
                                                   n_clicks=0,
                                                   size='lg',
                                                   color='success',
                                                   style={'width': '100px'}),
                                        dbc.Button('Reset',
                                                   id='reset',
                                                   n_clicks=0,
                                                   size='lg',
                                                   color='danger',
                                                   style={
                                                       'width': '100px',
                                                       'float': 'right'
                                                   })
                                    ]),
                                ]),
                                html.Div(id='output-state', children=[''])
                            ],
                            id='submission-form')
                    ],
                    xl={
                        'size': 4,
                        'offset': 0
                    },
                    md={
                        'size': 8,
                        'offset': 2
                    },
                    width=12)
            ])
        ]))
    return content
Пример #4
0
                  placeholder='Select Countries',
                  options=[{
                      'label': c,
                      'value': c
                  } for c in sorted(terrorism['country_txt'].unique())])
 ],
          style={
              'width': '50%',
              'margin-left': '25%',
              'background-color': '#eeeeee'
          }),
 dcc.Graph(id='by_year_country_world', config={'displayModeBar': False}),
 html.Hr(),
 html.Content('Top Countries',
              style={
                  'margin-left': '45%',
                  'font-size': 25
              }),
 html.Br(),
 html.Br(),
 html.Div([
     html.Div([
         html.Div([
             dcc.RangeSlider(
                 id='years_attacks',
                 min=1970,
                 max=2016,
                 dots=True,
                 value=[2010, 2016],
                 marks={str(yr): str(yr)
                        for yr in range(1970, 2017, 5)}),
Пример #5
0
import webbrowser
import socket
import dash
import dash_html_components as html
import dash_core_components as dcc
import dash_bootstrap_components as dbc
from dash.dependencies import Input
import plotly.express as px
import CC_AppModules as cca

app = dash.Dash(__name__, external_stylesheets=[dbc.themes.BOOTSTRAP])
buttonstyle = {'padding': '0px 0px 0px 20px','display':'inline-block'}

app.layout = html.Div([
    html.Div([
        html.Content(html.B('Team Citral Code Chef Level 1'))],
        style={
            'padding': '20px 0px 5px 20px',
            'background-color':'bisque',
            'font-size':'30px', 
            'text-align': 'center',
            'color': 'darkslategray'
        }
    ),

    html.Div(
        [
            html.Div([
                dbc.Button('Algorithm Info', 
                    id='open-info', 
                    style={'background-color':'darkslategray'}
Пример #6
0
server = app.server

app.layout = html.Div([
    html.Br(),
    html.Br(),
    html.Div('Search Engine Marketing: Keyword Generation Tool',
             style={
                 'text-align': 'center',
                 'font-size': 30
             }),
    html.Br(),
    html.Br(),
    html.Div([
        html.Div(
            [
                html.Content('Edit campaign name:'),
                dcc.Input(id='campaign_name',
                          value='SEM_Campaign',
                          style={
                              'height': 35,
                              'width': '97%',
                              'font-size': 20,
                              'font-family': 'Palatino'
                          }),
                html.Br(),
                html.Br(),
                html.Content('Select match type(s):'),
                dcc.Dropdown(
                    id='match_types',
                    multi=True,
                    options=[{
Пример #7
0
        html.Div([
            html.Div([
                html.Div([
                    dcc.Dropdown(id='pick', options=opt, value='All'),
                    dcc.Graph(id='line')
                ],
                         className='card-body')
            ],
                     className='card')
        ],
                 className='col-md-12')
    ],
             className='row mt-5'),
    html.Div([
        html.Div([
            html.Content('developed by: '),
            html.A(
                'Sankha Subhra Mondal',
                href=
                'https://www.linkedin.com/in/sankha-subhra-mondal-540133168/',
                className='text-warning decoration-none'),
            html.Content(' | '),
            html.A('Vist GitHub Repository',
                   href='https://github.com/Sankha1998/covid19_dashboardapp',
                   className='text-warning decoration-none')
        ],
                 className='col-md-6 offset-3 text-warning')
    ],
             className='row mt-5')
],
                      className='container')
Пример #8
0
                     'backgroundColor': '#eeeeee'
                 },
             ] + [{
                 'if': {
                     'column_id': c
                 },
                 'textAlign': 'left'
             } for c in ['Name', 'Location', 'Country', 'Place Type']],
             data=pd.DataFrame(
                 {k: ['' for i in range(10)]
                  for k in TABLE_COLS}).to_dict('rows'),
             filtering=True,
             sorting=True),
         html.A('@eliasdabbas', href='https://www.twitter.com/eliasdabbas'),
         html.P(),
         html.Content('Data: Twitter API  '),
         html.Br(),
         html.Content('  Code: '),
         html.A('github.com/eliasdabbas/trending-twitter',
                href='https://github.com/eliasdabbas/trending-twitter'),
         html.Br(),
         html.Br(),
     ],
     style={
         'width': '95%',
         'margin-left': '2.5%',
         'background-color': '#eeeeee',
         'font-family': 'Palatino'
     }),
 html.Br(),
 html.Br(),
Пример #9
0
import pandas as pd
import dash
import dash_html_components as html
import dash_core_components as dcc
import dash_bootstrap_components as dbc
from dash.dependencies import Input, Output, State
import plotly.express as px
import plotly.graph_objects as go
import CC_AppModules as cca

app = dash.Dash(__name__, external_stylesheets=[dbc.themes.BOOTSTRAP])
buttonstyle = {'padding': '0px 0px 0px 20px', 'display': 'inline-block'}

app.layout = html.Div([
    html.Div(
        [html.Content(html.B('Code Chef Level 1'))],
        style={
            'padding': '20px 0px 5px 20px',
            'background-color': 'bisque',
            'font-size': '30px',
            'text-align': 'center',
            'color': 'darkslategray'
        }),
    html.Div(
        [
            html.Div(dcc.Upload(
                id='files-upload',
                children=dbc.Button(
                    'Select TAB, WAX & Dataset Files',
                    style={'background-color': 'darkslategray'}),
                multiple=True),