Skip to content

Commit c49bf50

Browse files
committed
Remove search toolbar on empty workspaces list
1 parent cad4fbf commit c49bf50

File tree

1 file changed

+63
-62
lines changed

1 file changed

+63
-62
lines changed

components/dashboard/src/workspaces/Workspaces.tsx

Lines changed: 63 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -66,70 +66,71 @@ export default class Workspaces extends React.Component<WorkspacesProps, Workspa
6666
const onAll = () => wsModel!.active = false;
6767
return <>
6868
<Header title="Workspaces" subtitle="Manage recent and stopped workspaces." />
69-
70-
<div className="lg:px-28 px-10 pt-8 flex">
71-
<div className="flex">
72-
<div className="py-4">
73-
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 16 16" width="16" height="16"><path fill="#A8A29E" d="M6 2a4 4 0 100 8 4 4 0 000-8zM0 6a6 6 0 1110.89 3.477l4.817 4.816a1 1 0 01-1.414 1.414l-4.816-4.816A6 6 0 010 6z"/></svg>
74-
</div>
75-
<input type="search" placeholder="Search Workspaces" onChange={(v) => { if (wsModel) wsModel.setSearch(v.target.value) }} />
76-
</div>
77-
<div className="flex-1" />
78-
<div className="py-3">
79-
<DropDown prefix="Filter: " contextMenuWidth="w-32" activeEntry={wsModel?.active ? 'Active' : 'All'} entries={[{
80-
title: 'Active',
81-
onClick: onActive
82-
}, {
83-
title: 'All',
84-
onClick: onAll
85-
}]} />
86-
</div>
87-
<div className="py-3 pl-3">
88-
<DropDown prefix="Limit: " contextMenuWidth="w-32" activeEntry={wsModel ? wsModel?.limit+'' : undefined} entries={[{
89-
title: '50',
90-
onClick: () => { if (wsModel) wsModel.limit = 50; }
91-
}, {
92-
title: '100',
93-
onClick: () => { if (wsModel) wsModel.limit = 100; }
94-
}, {
95-
title: '200',
96-
onClick: () => { if (wsModel) wsModel.limit = 200; }
97-
}]} />
98-
</div>
99-
{wsModel && this.state?.workspaces.length > 0 ?
100-
<button onClick={this.showStartWSModal} className="ml-2">New Workspace</button>
101-
: null
102-
}
103-
</div>
10469
{wsModel && (
10570
this.state?.workspaces.length > 0 || wsModel.searchTerm ?
106-
<ItemsList className="lg:px-28 px-10">
107-
<Item header={true} className="px-6">
108-
<ItemFieldIcon />
109-
<ItemField className="w-3/12">Name</ItemField>
110-
<ItemField className="w-4/12">Context</ItemField>
111-
<ItemField className="w-2/12">Pending Changes</ItemField>
112-
<ItemField className="w-2/12">Last Start</ItemField>
113-
<ItemFieldContextMenu />
114-
</Item>
115-
{
116-
wsModel.active || wsModel.searchTerm ? null :
117-
<Item className="w-full bg-gitpod-kumquat-light py-6 px-6">
118-
<ItemFieldIcon>
119-
<img src={exclamation} alt="Exclamation Mark" className="m-auto" />
120-
</ItemFieldIcon>
121-
<ItemField className=" flex flex-col">
122-
<div className="text-gitpod-red font-semibold">Garbage Collection</div>
123-
<p className="text-gray-500">Unpinned workspaces that have been stopped for more than 14 days will be automatically deleted. <a className="text-blue-600 learn-more hover:text-gray-800 hover:dark:text-gray-100" href="https://www.gitpod.io/docs/life-of-workspace/#garbage-collection">Learn more</a></p>
124-
</ItemField>
125-
</Item>
126-
}
127-
{
128-
this.state?.workspaces.map(e => {
129-
return <WorkspaceEntry key={e.workspace.id} desc={e} model={wsModel} stopWorkspace={wsId => getGitpodService().server.stopWorkspace(wsId)}/>
130-
})
131-
}
132-
</ItemsList>
71+
<div>
72+
<div className="lg:px-28 px-10 pt-8 flex">
73+
<div className="flex">
74+
<div className="py-4">
75+
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 16 16" width="16" height="16"><path fill="#A8A29E" d="M6 2a4 4 0 100 8 4 4 0 000-8zM0 6a6 6 0 1110.89 3.477l4.817 4.816a1 1 0 01-1.414 1.414l-4.816-4.816A6 6 0 010 6z"/></svg>
76+
</div>
77+
<input type="search" placeholder="Search Workspaces" onChange={(v) => { if (wsModel) wsModel.setSearch(v.target.value) }} />
78+
</div>
79+
<div className="flex-1" />
80+
<div className="py-3">
81+
<DropDown prefix="Filter: " contextMenuWidth="w-32" activeEntry={wsModel?.active ? 'Active' : 'All'} entries={[{
82+
title: 'Active',
83+
onClick: onActive
84+
}, {
85+
title: 'All',
86+
onClick: onAll
87+
}]} />
88+
</div>
89+
<div className="py-3 pl-3">
90+
<DropDown prefix="Limit: " contextMenuWidth="w-32" activeEntry={wsModel ? wsModel?.limit+'' : undefined} entries={[{
91+
title: '50',
92+
onClick: () => { if (wsModel) wsModel.limit = 50; }
93+
}, {
94+
title: '100',
95+
onClick: () => { if (wsModel) wsModel.limit = 100; }
96+
}, {
97+
title: '200',
98+
onClick: () => { if (wsModel) wsModel.limit = 200; }
99+
}]} />
100+
</div>
101+
{wsModel && this.state?.workspaces.length > 0 ?
102+
<button onClick={this.showStartWSModal} className="ml-2">New Workspace</button>
103+
: null
104+
}
105+
</div>
106+
<ItemsList className="lg:px-28 px-10">
107+
<Item header={true} className="px-6">
108+
<ItemFieldIcon />
109+
<ItemField className="w-3/12">Name</ItemField>
110+
<ItemField className="w-4/12">Context</ItemField>
111+
<ItemField className="w-2/12">Pending Changes</ItemField>
112+
<ItemField className="w-2/12">Last Start</ItemField>
113+
<ItemFieldContextMenu />
114+
</Item>
115+
{
116+
wsModel.active || wsModel.searchTerm ? null :
117+
<Item className="w-full bg-gitpod-kumquat-light py-6 px-6">
118+
<ItemFieldIcon>
119+
<img src={exclamation} alt="Exclamation Mark" className="m-auto" />
120+
</ItemFieldIcon>
121+
<ItemField className=" flex flex-col">
122+
<div className="text-gitpod-red font-semibold">Garbage Collection</div>
123+
<p className="text-gray-500">Unpinned workspaces that have been stopped for more than 14 days will be automatically deleted. <a className="text-blue-600 learn-more hover:text-gray-800 hover:dark:text-gray-100" href="https://www.gitpod.io/docs/life-of-workspace/#garbage-collection">Learn more</a></p>
124+
</ItemField>
125+
</Item>
126+
}
127+
{
128+
this.state?.workspaces.map(e => {
129+
return <WorkspaceEntry key={e.workspace.id} desc={e} model={wsModel} stopWorkspace={wsId => getGitpodService().server.stopWorkspace(wsId)}/>
130+
})
131+
}
132+
</ItemsList>
133+
</div>
133134
:
134135
<div className="lg:px-28 px-10 flex flex-col space-y-2">
135136
<div className="px-6 py-3 flex justify-between space-x-2 text-gray-400 border-t border-gray-200 dark:border-gray-800 h-96">

0 commit comments

Comments
 (0)