Skip to content

Commit c2d3f55

Browse files
Packages page UI
1 parent 6f5ee5c commit c2d3f55

36 files changed

+1155
-53
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,3 +105,5 @@ dist
105105

106106
# React client - git ignore
107107
/public
108+
109+
client/src/assets/*.identifier

client/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
"dependencies": {
1313
"antd": "^5.12.7",
1414
"autoprefixer": "^10.4.16",
15+
"compare-versions": "^6.1.0",
1516
"postcss": "^8.4.32",
1617
"react": "^18.2.0",
1718
"react-dom": "^18.2.0",

client/src/App.tsx

Lines changed: 27 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,10 @@ function getMenuItem(
3535
): MenuItem {
3636
return {
3737
key,
38-
icon,
38+
icon,
3939
children,
4040
label,
41-
} as MenuItem;
41+
} as MenuItem;
4242
}
4343

4444
const items: MenuItem[] = [
@@ -59,40 +59,54 @@ const App: React.FC = () => {
5959
const currentPath = window.location.pathname.slice(1);
6060

6161
const pathToSet = currentPath === '' ? 'project_details' : currentPath;
62-
62+
6363
setCurrentActiveRoute(pathToSet);
6464
}, []);
6565

6666
return (
67-
<Layout style={{ minHeight: '100vh' }}>
68-
<Sider collapsible collapsed={collapsed} onCollapse={(value) => setCollapsed(value)}>
67+
<Layout hasSider style={{ minHeight: '100vh', maxHeight: '100vh', overflow: 'scroll' }}>
68+
<Sider collapsible collapsed={collapsed} onCollapse={(value) => setCollapsed(value)}
69+
style={{ overflow: 'auto', height: '100vh', position: 'sticky', top: 0, left: 0 }}>
6970
<Menu style={{ minHeight: '92vh' }} defaultSelectedKeys={['project_details']}
70-
selectedKeys={[currentActiveRoute]}
71-
onSelect={(item) => setCurrentActiveRoute(item.key)}
72-
items={items} />
71+
selectedKeys={[currentActiveRoute]}
72+
onSelect={(item) => setCurrentActiveRoute(item.key)}
73+
items={items} />
7374
</Sider>
7475
<Layout style={{ minHeight: '100vh' }}>
75-
<Header style={{ display: 'flex' }}>
76+
<Header style={{
77+
position: 'sticky',
78+
top: 0,
79+
zIndex: 1,
80+
width: '100%',
81+
display: 'flex',
82+
alignItems: 'center',
83+
}}>
7684
<NopalmLogo includeTitle />
7785
</Header>
78-
<Content style={{ margin: '0 10px' }}>
86+
<Content style={{ margin: '0 10px', padding: 0, overflow: 'initial' }}>
7987
<div
8088
style={{
8189
padding: 24,
8290
borderRadius: borderRadiusLG,
8391
}}
8492
>
85-
{ routesToPages[currentActiveRoute] }
93+
{routesToPages[currentActiveRoute]}
8694
</div>
8795
</Content>
88-
<Footer style={{ textAlign: 'center' }}>
96+
{/* <Footer style={{
97+
position: 'fixed',
98+
// left: 200,
99+
bottom: 0,
100+
width: '100%',
101+
textAlign: 'center'
102+
}}>
89103
<div className="footer-container">
90104
<div className='copyright'>
91105
©{new Date().getFullYear()} | Created by Shravan Balasubramanian | Contact
92106
</div>
93107
<div className="contact"> <SocialMediaLinks /> </div>
94108
</div>
95-
</Footer>
109+
</Footer> */}
96110
</Layout>
97111
</Layout>
98112
);

client/src/api/Dataservice.ts

Lines changed: 72 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ const API_BASE_URL = 'http://localhost:8001/api';
44
// Actual
55
// const API_BASE_URL = '/api'
66

7+
import { InstalledPackageProps } from '../helpers/types';
8+
79
async function getProjectDetails(): Promise<Object> {
810
const urlPath = 'project';
911

@@ -14,8 +16,77 @@ async function getProjectDetails(): Promise<Object> {
1416
return project;
1517
}
1618

19+
async function getInstalledPackages(): Promise<InstalledPackageProps[]> {
20+
const urlPath = 'packages/installed';
21+
22+
const result = await fetch(`${API_BASE_URL}/${urlPath}`);
23+
24+
const { packages } = await result.json();
25+
26+
return packages;
27+
}
28+
29+
async function installPackage(packageName: string, versionToInstall: string) {
30+
const urlPath = 'packages/installed';
31+
32+
const result = await fetch(`${API_BASE_URL}/${urlPath}`, {
33+
method: 'POST',
34+
headers: {
35+
'Content-Type': 'application/json'
36+
},
37+
body: JSON.stringify({
38+
package: {
39+
name: packageName,
40+
version: versionToInstall
41+
}
42+
})
43+
});
44+
45+
return result;
46+
}
47+
48+
async function upgradePackage(packageName: string, versionToUpdate: string) {
49+
const urlPath = 'packages/upgrade';
50+
51+
const result = await fetch(`${API_BASE_URL}/${urlPath}`, {
52+
method: 'PUT',
53+
headers: {
54+
'Content-Type': 'application/json'
55+
},
56+
body: JSON.stringify({
57+
package: {
58+
name: packageName,
59+
version: versionToUpdate,
60+
latest: true
61+
}
62+
})
63+
});
64+
65+
return result;
66+
}
67+
68+
async function uninstallPackage(packageName: string) {
69+
const urlPath = 'packages/uninstall';
70+
71+
const result = await fetch(`${API_BASE_URL}/${urlPath}`, {
72+
method: 'DELETE',
73+
headers: {
74+
'Content-Type': 'application/json'
75+
},
76+
body: JSON.stringify({
77+
package: { name: packageName }
78+
})
79+
});
80+
81+
return result;
82+
}
83+
1784
const Dataservice = {
18-
getProjectDetails
85+
getProjectDetails,
86+
getInstalledPackages,
87+
installPackage,
88+
upgradePackage,
89+
uninstallPackage
1990
};
2091

2192
export default Dataservice;

client/src/assets/cli.png

610 Bytes
Loading
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[ZoneTransfer]
2+
ZoneId=3
3+
HostUrl=about:internet
511 Bytes
Loading
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[ZoneTransfer]
2+
ZoneId=3
3+
HostUrl=about:internet
1.35 KB
Loading
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[ZoneTransfer]
2+
ZoneId=3
3+
HostUrl=about:internet

0 commit comments

Comments
 (0)