Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 58d3b62

Browse files
AdrinlolNikolayS
authored andcommitted
fix(ui): minor platform ui tweaks (https://gitlab.com/postgres-ai/platform/-/issues/246)
1 parent f37d3bb commit 58d3b62

File tree

6 files changed

+44
-26
lines changed

6 files changed

+44
-26
lines changed

‎ui/packages/platform/src/components/ConsolePageTitle.tsx‎

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,12 +65,19 @@ const useStyles = makeStyles(
6565
'margin-bottom': '20px',
6666
},
6767
pageTitleActions: {
68-
lineHeight: '37px',
69-
display: 'inline-block',
68+
display: 'flex',
69+
alignItems: 'center',
70+
height: '100%',
7071
float: 'right',
7172
},
7273
pageTitleActionContainer: {
7374
marginLeft: '10px',
75+
display: 'inline-block',
76+
height: "36px",
77+
78+
"& > span, button": {
79+
height: '100%',
80+
},
7481
},
7582
tooltip: {
7683
fontSize: '10px!important',
@@ -125,7 +132,7 @@ const ConsolePageTitle = ({
125132
id="filterOrgsInput"
126133
variant="outlined"
127134
size="small"
128-
style={{ minWidth: '260px',height: '30px' }}
135+
style={{ minWidth: '260px' }}
129136
className="filterOrgsInput"
130137
placeholder={filterProps.placeholder}
131138
value={filterProps.filterValue}

‎ui/packages/platform/src/components/ContentLayout/DemoOrgNotice/index.tsx‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ const useStyles = makeStyles(
4242
borderRadius: '3px',
4343
marginLeft: '5px',
4444
marginTop: '-2px',
45-
backgroundColor: colors.white,
4645
height: '20px',
4746
lineHeight: '20px',
4847
fontSize: '12px',
@@ -66,8 +65,8 @@ export const DemoOrgNotice = () => {
6665
{icons.infoIconBlue} This is a Demo organization, once you’ve
6766
explored <span className={classes.noWrap}>Database Lab</span> features:
6867
<Button
69-
variant="outlined"
70-
color="secondary"
68+
variant="contained"
69+
color="primary"
7170
className={classes.demoOrgNoticeButton}
7271
onClick={goToOrgForm}
7372
>

‎ui/packages/platform/src/components/Dashboard/Dashboard.tsx‎

Lines changed: 22 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,10 @@ import remarkGfm from 'remark-gfm'
2424
import { HorizontalScrollContainer } from '@postgres.ai/shared/components/HorizontalScrollContainer'
2525
import { PageSpinner } from '@postgres.ai/shared/components/PageSpinner'
2626
import { StubContainer } from '@postgres.ai/shared/components/StubContainer'
27-
import { ClassesType, RefluxTypes } from '@postgres.ai/platform/src/components/types'
27+
import {
28+
ClassesType,
29+
RefluxTypes,
30+
} from '@postgres.ai/platform/src/components/types'
2831

2932
import { ROUTES } from 'config/routes'
3033

@@ -103,7 +106,7 @@ class Dashboard extends Component<DashboardWithStylesProps, DashboardState> {
103106
const orgId = this.props.orgId
104107
const onlyProjects = this.props.onlyProjects
105108

106-
this.unsubscribe = (Store.listen as RefluxTypes["listen"])(function () {
109+
this.unsubscribe = (Store.listen as RefluxTypes['listen'])(function () {
107110
that.setState({ data: this.data })
108111
const auth: DashboardState['data']['auth'] =
109112
this.data && this.data.auth ? this.data.auth : null
@@ -330,6 +333,7 @@ class Dashboard extends Component<DashboardWithStylesProps, DashboardState> {
330333
this.state.data.userProfile.data &&
331334
this.state.data.userProfile.data.orgs &&
332335
this.state.data.userProfile.data.orgs[org] &&
336+
this.state.data.userProfile.data.orgs[org].projects &&
333337
this.state.data.userProfile.data.orgs[org].onboarding_text
334338
) {
335339
onboarding = (
@@ -422,7 +426,7 @@ class Dashboard extends Component<DashboardWithStylesProps, DashboardState> {
422426

423427
const useDemoDataButton = (
424428
<ConsoleButtonWrapper
425-
variant="contained"
429+
variant="outlined"
426430
color="primary"
427431
onClick={this.useDemoDataButtonHandler}
428432
id="useDemoDataButton"
@@ -434,7 +438,7 @@ class Dashboard extends Component<DashboardWithStylesProps, DashboardState> {
434438

435439
const createOrgButton = (
436440
<ConsoleButtonWrapper
437-
variant="outlined"
441+
variant="contained"
438442
color="primary"
439443
onClick={this.addOrgButtonHandler}
440444
id="createOrgButton"
@@ -451,14 +455,14 @@ class Dashboard extends Component<DashboardWithStylesProps, DashboardState> {
451455
inline
452456
title={'Create or join an organization'}
453457
actions={[
454-
{
455-
id: 'useDemoDataButton',
456-
content: useDemoDataButton,
457-
},
458458
{
459459
id: 'createOrgButton',
460460
content: createOrgButton,
461461
},
462+
{
463+
id: 'useDemoDataButton',
464+
content: useDemoDataButton,
465+
},
462466
]}
463467
>
464468
<p>
@@ -475,20 +479,26 @@ class Dashboard extends Component<DashboardWithStylesProps, DashboardState> {
475479
)
476480

477481
const pageActions = []
478-
if (!profile.data?.orgs || !profile.data?.orgs[settings.demoOrgAlias]) {
482+
if (
483+
Object.keys(profile?.data?.orgs).length > 0 &&
484+
(!profile.data?.orgs || !profile.data?.orgs[settings.demoOrgAlias])
485+
) {
479486
pageActions.push(useDemoDataButton)
480487
}
481-
pageActions.push(createOrgButton)
488+
489+
if (Object.keys(profile?.data?.orgs).length > 0) {
490+
pageActions.push(createOrgButton)
491+
}
482492

483493
return (
484494
<div className={classes.root}>
485495
<ConsolePageTitle
486496
top={true}
487497
title="Your organizations"
488498
information="Your own organizations and organizations of which you are a member"
489-
actions={pageActions}
499+
actions={filteredItems&&pageActions}
490500
filterProps={
491-
profile?.data?.orgs
501+
Object.keys(profile?.data?.orgs).length>0
492502
? {
493503
filterValue: this.state.filterValue,
494504
filterHandler: this.filterOrgsInputHandler,

‎ui/packages/platform/src/components/Dashboard/DashboardWrapper.tsx‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,6 @@ export const DashboardWrapper = (props: DashboardProps) => {
8282
width: '200px',
8383
},
8484
},
85-
createOrgButton: {
86-
height: '37px',
87-
},
8885
blockedStatus: {
8986
color: colors.state.error,
9087
fontSize: '1.1em',

‎ui/packages/platform/src/components/DbLabInstances/DbLabInstances.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -598,7 +598,7 @@ class DbLabInstances extends Component<
598598
key={4}
599599
onClick={(event) => this.menuHandler(event, 'destroy')}
600600
>
601-
Remove
601+
Remove from List
602602
</MenuItem>
603603
</Menu>
604604
)

‎ui/packages/platform/src/components/IndexPage/IndexPage.tsx‎

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -884,6 +884,7 @@ class IndexPage extends Component<IndexPageWithStylesProps, IndexPageState> {
884884
},
885885
userProfile: {
886886
data: {
887+
orgs: {},
887888
info: {
888889
first_name: '',
889890
user_name: '',
@@ -907,7 +908,7 @@ class IndexPage extends Component<IndexPageWithStylesProps, IndexPageState> {
907908

908909
document.getElementsByTagName('html')[0].style.overflow = 'hidden'
909910

910-
this.unsubscribe = (Store.listen as RefluxTypes["listen"])(function () {
911+
this.unsubscribe = (Store.listen as RefluxTypes['listen'])(function () {
911912
that.setState({ data: this.data })
912913

913914
// redirect to new organization alias if need
@@ -1302,9 +1303,13 @@ class IndexPage extends Component<IndexPageWithStylesProps, IndexPageState> {
13021303
<Route
13031304
path={ROUTES.ROOT.path}
13041305
exact
1305-
render={(props) => (
1306-
<DashboardWrapper onlyProjects={false} {...props} />
1307-
)}
1306+
render={(props) => {
1307+
if (env.data && env.data?.orgs) {
1308+
return <DashboardWrapper onlyProjects={false} {...props} />
1309+
} else {
1310+
return <OrgFormWrapper mode={'new'} {...props} />
1311+
}
1312+
}}
13081313
/>
13091314
<Route
13101315
path={ROUTES.CREATE_ORG.path}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /