Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
W
Web UI
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Maksim Gorelik
Web UI
Commits
d828bcf1
Commit
d828bcf1
authored
1 year ago
by
Eduardo Orthmann
Browse files
Options
Downloads
Patches
Plain Diff
add plugin props
parent
9fb7b224
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
locales/de.json
+3
-0
3 additions, 0 deletions
locales/de.json
locales/en.json
+3
-0
3 additions, 0 deletions
locales/en.json
src/app/[locale]/wallet/plugins/[plugin]/page.tsx
+17
-2
17 additions, 2 deletions
src/app/[locale]/wallet/plugins/[plugin]/page.tsx
with
23 additions
and
2 deletions
locales/de.json
+
3
−
0
View file @
d828bcf1
...
@@ -133,5 +133,8 @@
...
@@ -133,5 +133,8 @@
"Issuance"
:
{
"Issuance"
:
{
"title"
:
"Ausgabe"
,
"title"
:
"Ausgabe"
,
"select"
:
"Wählen"
"select"
:
"Wählen"
},
"Plugin"
:
{
"not-found"
:
"Plugin nicht gefunden"
}
}
}
}
This diff is collapsed.
Click to expand it.
locales/en.json
+
3
−
0
View file @
d828bcf1
...
@@ -133,5 +133,8 @@
...
@@ -133,5 +133,8 @@
"Issuance"
:
{
"Issuance"
:
{
"title"
:
"Issuance"
,
"title"
:
"Issuance"
,
"select"
:
"Select"
"select"
:
"Select"
},
"Plugin"
:
{
"not-found"
:
"Plugin not found"
}
}
}
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
src/app/[locale]/wallet/plugins/[plugin]/page.tsx
+
17
−
2
View file @
d828bcf1
...
@@ -3,6 +3,8 @@
...
@@ -3,6 +3,8 @@
import
{
RemoteComponent
}
from
'
@/RemoteComponent
'
;
import
{
RemoteComponent
}
from
'
@/RemoteComponent
'
;
import
{
type
Plugin
as
IPlugin
}
from
'
@/components/side-menu/WalletSideMenu
'
;
import
{
type
Plugin
as
IPlugin
}
from
'
@/components/side-menu/WalletSideMenu
'
;
import
{
useQueryClient
}
from
'
@tanstack/react-query
'
;
import
{
useQueryClient
}
from
'
@tanstack/react-query
'
;
import
{
useTranslations
}
from
'
next-intl
'
;
import
{
useAuth
}
from
'
oidc-react
'
;
import
{
useEffect
,
useState
}
from
'
react
'
;
import
{
useEffect
,
useState
}
from
'
react
'
;
interface
PluginProps
{
interface
PluginProps
{
...
@@ -14,6 +16,13 @@ interface PluginProps {
...
@@ -14,6 +16,13 @@ interface PluginProps {
const
Plugin
=
({
params
}:
PluginProps
):
JSX
.
Element
=>
{
const
Plugin
=
({
params
}:
PluginProps
):
JSX
.
Element
=>
{
const
[
PluginComponent
,
setPluginComponent
]
=
useState
<
JSX
.
Element
>
();
const
[
PluginComponent
,
setPluginComponent
]
=
useState
<
JSX
.
Element
>
();
const
pluginDiscoveryData
=
useQueryClient
().
getQueryData
<
IPlugin
[]
>
([
'
pluginDiscovery
'
]);
const
pluginDiscoveryData
=
useQueryClient
().
getQueryData
<
IPlugin
[]
>
([
'
pluginDiscovery
'
]);
const
t
=
useTranslations
(
'
Plugin
'
);
const
{
userData
}
=
useAuth
();
const
pluginMetadata
=
{
example1
:
'
Example 1
'
,
example2
:
'
Example 2
'
,
example3
:
'
Example 3
'
,
};
const
fetchPluginData
=
(
pluginDiscovery
:
IPlugin
[],
pluginRoute
:
string
):
void
=>
{
const
fetchPluginData
=
(
pluginDiscovery
:
IPlugin
[],
pluginRoute
:
string
):
void
=>
{
const
foundPlugin
=
pluginDiscovery
.
find
(
plugin
=>
plugin
.
route
===
pluginRoute
);
const
foundPlugin
=
pluginDiscovery
.
find
(
plugin
=>
plugin
.
route
===
pluginRoute
);
...
@@ -22,12 +31,18 @@ const Plugin = ({ params }: PluginProps): JSX.Element => {
...
@@ -22,12 +31,18 @@ const Plugin = ({ params }: PluginProps): JSX.Element => {
process
.
env
.
NODE_ENV
!==
'
development
'
?
process
.
env
.
ENV_URL
:
'
https://cloud-wallet.xfsc.dev
'
process
.
env
.
NODE_ENV
!==
'
development
'
?
process
.
env
.
ENV_URL
:
'
https://cloud-wallet.xfsc.dev
'
}
/api/dynamic/plugins
${
foundPlugin
?.
url
}
/main.js`
;
}
/api/dynamic/plugins
${
foundPlugin
?.
url
}
/main.js`
;
setPluginComponent
(<
RemoteComponent
url
=
{
url
}
/>);
setPluginComponent
(
<
RemoteComponent
url
=
{
url
}
token
=
{
userData
?.
access_token
}
metadata
=
{
pluginMetadata
}
/>
);
};
};
useEffect
(()
=>
{
useEffect
(()
=>
{
if
(
!
pluginDiscoveryData
)
{
if
(
!
pluginDiscoveryData
)
{
setPluginComponent
(<
div
>
Plugin
not
found
</
div
>);
setPluginComponent
(<
div
>
{
t
(
'
not
-
found
'
)
}
</
div
>);
}
else
{
}
else
{
fetchPluginData
(
pluginDiscoveryData
,
params
.
plugin
);
fetchPluginData
(
pluginDiscoveryData
,
params
.
plugin
);
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment