@@ -17,53 +17,116 @@ interface Plugin {
17
17
18
18
export interface PurePluginInstalledListProps {
19
19
installedPlugins : Plugin [ ] | null ;
20
+ otherInstalledPlugins : any [ ] | null ;
20
21
error : string | null ;
21
22
}
22
23
23
- export function PurePluginInstalledList ( { installedPlugins, error } : PurePluginInstalledListProps ) {
24
+ export function PurePluginInstalledList ( { installedPlugins, otherInstalledPlugins , error } : PurePluginInstalledListProps ) {
24
25
return (
25
26
< SectionBox title = "Installed" textAlign = "center" paddingTop = { 2 } >
26
27
{ error ? (
27
28
< Typography > { `Error loading Installed plugins: ${ error } ` } </ Typography >
28
29
) : (
29
- < SimpleTable
30
- columns = { [
31
- {
32
- label : 'Name' ,
33
- getter : plugin => (
34
- < Box >
35
- < Link
36
- routeName = "/plugin-catalog/:repoName/:pluginName"
37
- params = { { repoName : plugin . repoName , pluginName : plugin . folderName } }
38
- >
39
- { plugin . pluginTitle }
40
- </ Link >
41
- </ Box >
42
- ) ,
43
- } ,
44
- {
45
- label : 'Version' ,
46
- getter : plugin => plugin . pluginVersion ,
47
- } ,
48
- {
49
- label : 'Repo' ,
50
- getter : plugin => plugin . repoName ,
51
- } ,
52
- {
53
- label : 'Author' ,
54
- getter : plugin => plugin . author ,
55
- } ,
56
- ] }
57
- emptyMessage = "No plugins installed"
58
- data = { installedPlugins || [ ] }
59
- />
30
+ < Box sx = { {
31
+ display : 'flex' ,
32
+ flexDirection : 'column' ,
33
+ gap : 2 ,
34
+ } } >
35
+
36
+ < Box sx = { {
37
+ display : 'flex' ,
38
+ flexDirection : 'column' ,
39
+ gap : 2 ,
40
+ alignItems : 'start' ,
41
+ } } >
42
+ < Typography variant = "h6" components = "h2" > Installed from the Plugin Catalog</ Typography >
43
+ < SimpleTable
44
+ columns = { [
45
+ {
46
+ label : 'Name' ,
47
+ getter : plugin => (
48
+ < Box >
49
+ < Link
50
+ routeName = "/plugin-catalog/:repoName/:pluginName"
51
+ params = { { repoName : plugin . repoName , pluginName : plugin . folderName } }
52
+ >
53
+ { plugin . pluginTitle }
54
+ </ Link >
55
+ </ Box >
56
+ ) ,
57
+ } ,
58
+ {
59
+ label : 'Version' ,
60
+ getter : plugin => plugin . pluginVersion ,
61
+ } ,
62
+ {
63
+ label : 'Repo' ,
64
+ getter : plugin => plugin . repoName ,
65
+ } ,
66
+ {
67
+ label : 'Author' ,
68
+ getter : plugin => plugin . author ,
69
+ } ,
70
+ ] }
71
+ emptyMessage = "No plugins installed"
72
+ data = { installedPlugins || [ ] }
73
+ />
74
+ </ Box >
75
+
76
+ < Box sx = { {
77
+ display : 'flex' ,
78
+ flexDirection : 'column' ,
79
+ gap : 2 ,
80
+ alignItems : 'start' ,
81
+
82
+ } } >
83
+ < Typography variant = "h6" components = "h2" > Other Installed Plugins</ Typography >
84
+
85
+ < SimpleTable
86
+ columns = { [
87
+ {
88
+ label : 'Name' ,
89
+ getter : otherInstalledPlugins => (
90
+ < Box >
91
+ < Link
92
+ routeName = { `pluginDetails` }
93
+ params = { { name : otherInstalledPlugins . name } }
94
+ >
95
+ { otherInstalledPlugins . name }
96
+ </ Link >
97
+ </ Box >
98
+ ) ,
99
+ } ,
100
+ {
101
+ label : 'Version' ,
102
+ getter : otherInstalledPlugins => otherInstalledPlugins . version ,
103
+ } ,
104
+ {
105
+ label : 'Repo' ,
106
+ getter : plugin => plugin . repoName ,
107
+ } ,
108
+ {
109
+ label : 'Author' ,
110
+ getter : plugin => plugin . author ,
111
+ } ,
112
+ ] }
113
+ emptyMessage = "No plugins installed"
114
+ data = { otherInstalledPlugins || [ ] }
115
+ />
116
+ </ Box >
117
+
118
+
119
+
120
+
121
+ </ Box >
60
122
) }
61
123
</ SectionBox >
62
124
) ;
63
125
}
64
126
65
127
export function PluginInstalledList ( ) {
66
128
const [ installedPlugins , setInstalledPlugins ] = useState < Plugin [ ] | null > ( null ) ;
129
+ const [ otherInstalledPlugins , setOtherInstalledPlugins ] = useState < Plugin [ ] | null > ( null ) ;
67
130
const [ error , setError ] = useState < string | null > ( null ) ;
68
131
69
132
useEffect ( ( ) => {
@@ -81,8 +144,20 @@ export function PluginInstalledList() {
81
144
}
82
145
}
83
146
147
+ async function fetchOtherInstalledPlugins ( ) {
148
+ const storedPlugins = localStorage . getItem ( 'headlampPluginSettings' ) ;
149
+ if ( storedPlugins ) {
150
+ const parsedPlugins = JSON . parse ( storedPlugins ) ;
151
+ setOtherInstalledPlugins ( parsedPlugins ) ;
152
+ console . log ( 'other plugins' , storedPlugins )
153
+ } else {
154
+ setOtherInstalledPlugins ( [ ] ) ;
155
+ }
156
+ }
157
+
84
158
fetchInstalledPlugins ( ) ;
159
+ fetchOtherInstalledPlugins ( ) ;
85
160
} , [ ] ) ;
86
161
87
- return < PurePluginInstalledList installedPlugins = { installedPlugins } error = { error } /> ;
162
+ return < PurePluginInstalledList installedPlugins = { installedPlugins } otherInstalledPlugins = { otherInstalledPlugins } error = { error } /> ;
88
163
}
0 commit comments