Skip to content

Commit

Permalink
1206 remove the node manager module from store (#1208)
Browse files Browse the repository at this point in the history
* add trans key for module crashed

* add beta tag for node manager plugin

* move the beta tag
  • Loading branch information
Thykof authored Sep 29, 2023
1 parent 34e46ea commit 7bec909
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 24 deletions.
1 change: 1 addition & 0 deletions web/massastation/src/i18n/en_US.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"store-banner": "Store",
"loading": "Loading...",
"massa-station-incompatible": "Available in Massa Station version: {version}",
"crashed-module": "The module is not working. Please delete it and then reinstall it.",
"mystation": {
"browse": "Browse the store below and manage plugins you've installed in this section"
},
Expand Down
2 changes: 1 addition & 1 deletion web/massastation/src/mirage/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export function mockServer(environment = ENV.DEV) {
models,
factories,
seeds(server) {
server.createList('plugin', 2);
server.createList('plugin', 8);
server.createList('domain', 50);
server.createList('store', 7);
server.createList('account', 5);
Expand Down
69 changes: 46 additions & 23 deletions web/massastation/src/pages/Store/StationSection/StationPlugin.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
Certificate,
Plugin,
PluginProps,
Tag,
Tooltip,
} from '@massalabs/react-ui-kit';
import {
Expand All @@ -20,6 +21,7 @@ import {
PLUGIN_STOP,
PLUGIN_UPDATE,
} from '@/const';
import Intl from '@/i18n/i18n';

import { MassaPluginModel, PluginStatus } from '@/models';

Expand Down Expand Up @@ -81,19 +83,31 @@ export function StationPlugin({
version: version,
} as PluginProps;

// Temporary display of beta tag for this specific plugin
// https://github.com/massalabs/station/issues/1206
let defaultContent =
name === 'Massa Node-manager'
? [<Tag type="warning" content="beta" />]
: [];

switch (status) {
case PluginStatus.Down:
pluginArgs = {
...pluginArgs,
topAction: (
// we use customClass because "disabled" doesn't let us click on the button to turn it back on
<Button
onClick={(e) => updatePluginState(e, PLUGIN_START)}
customClass="bg-primary text-tertiary"
variant="toggle"
>
off
</Button>
<div className="flex w-full justify-between pl-4">
<div className="flex item-center justify-center w-fit min-h-full h-full pt-2">
{defaultContent}
</div>
{/* we use customClass because "disabled" doesn't let us click on the button to turn it back on */}
<Button
onClick={(e) => updatePluginState(e, PLUGIN_START)}
customClass="bg-primary text-tertiary"
variant="toggle"
>
off
</Button>
</div>
),
content: [
<Button variant="icon" disabled>
Expand All @@ -109,19 +123,23 @@ export function StationPlugin({
pluginArgs = {
...pluginArgs,
topAction: (
<Button
disabled
onClick={(e) => updatePluginState(e, PLUGIN_START)}
customClass="bg-primary text-tertiary"
variant="toggle"
>
off
</Button>
<div className="flex w-full justify-between pl-4">
<div className="flex item-center justify-center w-fit min-h-full h-full pt-2">
{defaultContent}
</div>
<Button
onClick={(e) => updatePluginState(e, PLUGIN_START)}
customClass="bg-primary text-tertiary"
variant="toggle"
>
off
</Button>
</div>
),
content: [
<Tooltip
className="mas-tooltip"
content="The module is not working. Please delete it and then reinstall it."
content={Intl.t('store.crashed-module')}
icon={<FiAlertCircle className="text-s-error" />}
/>,
<Button variant="icon" disabled>
Expand All @@ -137,12 +155,17 @@ export function StationPlugin({
pluginArgs = {
...pluginArgs,
topAction: (
<Button
onClick={(e) => updatePluginState(e, PLUGIN_STOP)}
variant="toggle"
>
on
</Button>
<div className="flex w-full justify-between pl-4">
<div className="flex item-center justify-center w-fit min-h-full h-full pt-2">
{defaultContent}
</div>
<Button
onClick={(e) => updatePluginState(e, PLUGIN_STOP)}
variant="toggle"
>
on
</Button>
</div>
),
content: [
updatable &&
Expand Down

0 comments on commit 7bec909

Please sign in to comment.