File size: 8,669 Bytes
ae01f49 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 | /////////////////////////////////////////////////////////////
//
// pgAdmin 4 - PostgreSQL Tools
//
// Copyright (C) 2013 - 2024, The pgAdmin Development Team
// This software is released under the PostgreSQL Licence
//
//////////////////////////////////////////////////////////////
import React from 'react';
import gettext from 'sources/gettext';
import _ from 'lodash';
import PropTypes from 'prop-types';
import { makeStyles } from '@mui/styles';
import pgAdmin from 'sources/pgadmin';
import PgAdminLogo from './PgAdminLogo';
import { Link } from '@mui/material';
const useStyles = makeStyles((theme) => ({
emptyPanel: {
background: theme.palette.grey[400],
overflow: 'hidden',
padding: '8px',
display: 'flex',
flexDirection: 'column',
flexGrow: 1,
height: '100%'
},
dashboardContainer: {
paddingBottom: '8px',
minHeight: '100%'
},
card: {
position: 'relative',
minWidth: 0,
wordWrap: 'break-word',
backgroundColor: theme.otherVars.tableBg,
backgroundClip: 'border-box',
border: '1px solid' + theme.otherVars.borderColor,
borderRadius: theme.shape.borderRadius,
marginTop: 8
},
row: {
marginRight: '-8px',
marginLeft: '-8px'
},
rowContent: {
display: 'flex',
flexWrap: 'wrap',
marginRight: '-7.5px',
marginLeft: '-7.5px'
},
cardHeader: {
padding: '0.25rem 0.5rem',
fontWeight: 'bold',
backgroundColor: theme.otherVars.tableBg,
borderBottom: '1px solid',
borderBottomColor: theme.otherVars.borderColor,
},
dashboardLink: {
color: theme.otherVars.colorFg + '!important',
flex: '0 0 50%',
maxWidth: '50%',
textAlign: 'center',
cursor: 'pointer'
},
gettingStartedLink: {
flex: '0 0 25%',
maxWidth: '50%',
textAlign: 'center',
cursor: 'pointer'
},
link: {
color: theme.palette.text.primary + '!important',
},
cardColumn: {
flex: '0 0 100%',
maxWidth: '100%',
margin: '8px'
},
cardBody: {
flex: '1 1 auto',
minHeight: '1px',
padding: '0.5rem !important',
},
welcomeLogo: {
width: '400px',
'& .app-name': {
fill: theme.otherVars.colorBrand
},
'& .app-name-underline': {
stroke: theme.palette.text.primary
},
'& .app-tagline': {
fill: theme.palette.text.primary
}
},
dashboardIcon: {
color: theme.otherVars.colorBrand
},
}));
function AddNewServer(pgBrowser) {
if (pgBrowser?.tree) {
let i = _.isUndefined(pgBrowser.tree.selected()) ?
pgBrowser.tree.first(null, false) :
pgBrowser.tree.selected(),
serverModule = pgAdmin.Browser.Nodes.server,
itemData = pgBrowser.tree.itemData(i);
while (itemData && itemData._type != 'server_group') {
i = pgBrowser.tree.next(i);
itemData = pgBrowser.tree.itemData(i);
}
if (!itemData) {
return;
}
if (serverModule) {
serverModule.callbacks.show_obj_properties.apply(
serverModule, [{
action: 'create',
}, i]
);
}
}
}
export default function WelcomeDashboard({ pgBrowser }) {
const classes = useStyles();
return (
<div className={classes.emptyPanel}>
<div className={classes.dashboardContainer}>
<div className={classes.row}>
<div className={classes.cardColumn}>
<div className={classes.card}>
<div className={classes.cardHeader}>{gettext('Welcome')}</div>
<div className={classes.cardBody}>
<div className={classes.welcomeLogo}>
<PgAdminLogo />
</div>
<h4>
{gettext('Feature rich')} | {gettext('Maximises PostgreSQL')}{' '}
| {gettext('Open Source')}{' '}
</h4>
<p>
{gettext(
'pgAdmin is an Open Source administration and management tool for the PostgreSQL database. It includes a graphical administration interface, an SQL query tool, a procedural code debugger and much more. The tool is designed to answer the needs of developers, DBAs and system administrators alike.'
)}
</p>
</div>
</div>
</div>
</div>
<div className={classes.row}>
<div className={classes.cardColumn}>
<div className={classes.card}>
<div className={classes.cardHeader}>{gettext('Quick Links')}</div>
<div className={classes.cardBody}>
<div className={classes.rowContent}>
<div className={classes.dashboardLink}>
<Link onClick={() => { AddNewServer(pgBrowser); }} className={classes.link}>
<div className={classes.dashboardIcon}>
<span
className="fa fa-4x fa-server"
aria-hidden="true"
></span>
</div>
{gettext('Add New Server')}
</Link>
</div>
<div className={classes.dashboardLink}>
<Link onClick={() => pgAdmin.Preferences.show()} className={classes.link}>
<div className={classes.dashboardIcon}>
<span
id="mnu_preferences"
className="fa fa-4x fa-cogs"
aria-hidden="true"
></span>
</div>
{gettext('Configure pgAdmin')}
</Link>
</div>
</div>
</div>
</div>
</div>
</div>
<div className={classes.row}>
<div className={classes.cardColumn}>
<div className={classes.card}>
<div className={classes.cardHeader}>{gettext('Getting Started')}</div>
<div className={classes.cardBody}>
<div className={classes.rowContent}>
<div className={classes.gettingStartedLink}>
<a
href="https://www.postgresql.org/docs"
target="postgres_help"
className={classes.link}
>
<div className={classes.dashboardIcon}>
<span
className="fa fa-4x dashboard-pg-doc"
aria-hidden="true"
></span>
</div>
{gettext('PostgreSQL Documentation')}
</a>
</div>
<div className={classes.gettingStartedLink}>
<a href="https://www.pgadmin.org" target="pgadmin_website" className={classes.link}>
<div className={classes.dashboardIcon}>
<span
className="fa fa-4x fa-globe"
aria-hidden="true"
></span>
</div>
{gettext('pgAdmin Website')}
</a>
</div>
<div className={classes.gettingStartedLink}>
<a
href="https://planet.postgresql.org"
target="planet_website"
className={classes.link}
>
<div className={classes.dashboardIcon}>
<span
className="fa fa-4x fa-book"
aria-hidden="true"
></span>
</div>
{gettext('Planet PostgreSQL')}
</a>
</div>
<div className={classes.gettingStartedLink}>
<a
href="https://www.postgresql.org/community"
target="postgres_website"
className={classes.link}
>
<div className={classes.dashboardIcon}>
<span
className="fa fa-4x fa-users"
aria-hidden="true"
></span>
</div>
{gettext('Community Support')}
</a>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
);
}
WelcomeDashboard.propTypes = {
pgBrowser: PropTypes.object.isRequired
};
|