@orchestrator-ui/orchestrator-ui-components 0.0.1-alpha.1 → 0.0.1-alpha.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.js CHANGED
@@ -1,9 +1,8 @@
1
1
  import { jsx, jsxs, Fragment } from '@emotion/react/jsx-runtime';
2
2
  import { css } from '@emotion/react';
3
3
  import { useState, createContext, useContext } from 'react';
4
- import { useEuiTheme, EuiBadge, EuiHeader, EuiHeaderSection, EuiHeaderSectionItem, EuiHeaderLogo, EuiBadgeGroup, EuiButtonIcon, EuiSideNav, EuiPageTemplate } from '@elastic/eui';
4
+ import { useEuiTheme, EuiBadge, EuiHeader, EuiHeaderSection, EuiHeaderSectionItem, EuiHeaderLogo, EuiBadgeGroup, EuiButtonIcon, EuiToolTip, EuiSideNav, EuiPageTemplate } from '@elastic/eui';
5
5
  import { useQuery } from 'react-query';
6
- import { useRouter } from 'next/router';
7
6
 
8
7
  var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
9
8
 
@@ -3034,9 +3033,7 @@ const OrchestratorPageHeader = ({
3034
3033
  const {
3035
3034
  data: processStatusCounts
3036
3035
  } = useProcessStatusCountsQuery();
3037
- const {
3038
- total: totalFailedTasks
3039
- } = getTaskCountsSummary(processStatusCounts);
3036
+ const taskCountsSummary = getTaskCountsSummary(processStatusCounts);
3040
3037
  return jsxs(EuiHeader, Object.assign({
3041
3038
  css: {
3042
3039
  backgroundColor: theme.colors.primary,
@@ -3068,15 +3065,8 @@ const OrchestratorPageHeader = ({
3068
3065
  color: theme.colors.success
3069
3066
  })
3070
3067
  }, {
3071
- children: ["Engine ", engineStatus === null || engineStatus === void 0 ? void 0 : engineStatus.global_status]
3072
- })), jsx(HeaderBadge, Object.assign({
3073
- color: "emptyShade",
3074
- iconType: () => jsx(XCircleFill, {
3075
- color: theme.colors.danger
3076
- })
3077
- }, {
3078
- children: totalFailedTasks
3079
- }))]
3068
+ children: ["Engine is ", engineStatus === null || engineStatus === void 0 ? void 0 : engineStatus.global_status]
3069
+ })), jsx(FailedTasksBadge, Object.assign({}, taskCountsSummary))]
3080
3070
  })), jsx(EuiButtonIcon, {
3081
3071
  "aria-label": "Logout",
3082
3072
  display: "empty",
@@ -3094,47 +3084,65 @@ const OrchestratorPageHeader = ({
3094
3084
  })]
3095
3085
  }));
3096
3086
  };
3087
+ const FailedTasksBadge = taskCountsSummary => {
3088
+ const {
3089
+ theme
3090
+ } = useOrchestratorTheme();
3091
+ return jsx(EuiToolTip, Object.assign({
3092
+ position: "bottom",
3093
+ content: jsxs(Fragment, {
3094
+ children: [jsxs("div", {
3095
+ children: ["Failed: ", taskCountsSummary.failed]
3096
+ }), jsxs("div", {
3097
+ children: ["Inconsistent data: ", taskCountsSummary.inconsistentData]
3098
+ }), jsxs("div", {
3099
+ children: ["API unavailable: ", taskCountsSummary.apiUnavailable]
3100
+ })]
3101
+ })
3102
+ }, {
3103
+ children: jsx(HeaderBadge, Object.assign({
3104
+ color: "emptyShade",
3105
+ iconType: () => jsx(XCircleFill, {
3106
+ color: theme.colors.danger
3107
+ })
3108
+ }, {
3109
+ children: taskCountsSummary.total
3110
+ }))
3111
+ }));
3112
+ };
3097
3113
 
3098
3114
  const OrchestratorSidebar = ({
3099
- text
3100
- }) => {
3101
- const router = useRouter();
3102
- return jsx(EuiSideNav, {
3103
- mobileTitle: "Nav Items",
3104
- isOpenOnMobile: false,
3115
+ routeTo
3116
+ }) => jsx(EuiSideNav, {
3117
+ mobileTitle: "Nav Items",
3118
+ isOpenOnMobile: false,
3119
+ items: [{
3120
+ name: 'Menu',
3121
+ id: 1,
3105
3122
  items: [{
3106
- name: 'Menu',
3107
- id: 1,
3108
- items: [{
3109
- name: 'Home',
3110
- id: 2,
3111
- onClick: e => {
3112
- e.preventDefault();
3113
- router.push('/');
3114
- },
3115
- href: '/'
3116
- }, {
3117
- name: 'Subscriptions',
3118
- id: 3,
3119
- // TODO: NEXT router / EUI seem to cause unneeded re-renders. At least in dev mode,
3120
- onClick: e => {
3121
- e.preventDefault();
3122
- router.push('/subscriptions');
3123
- },
3124
- href: '/subscriptions'
3125
- }
3126
- // {
3127
- // name: 'Anchor item',
3128
- // id: 4,
3129
- // href: '#',
3130
- // },
3131
- ]
3123
+ name: 'Home',
3124
+ id: 2,
3125
+ onClick: e => {
3126
+ e.preventDefault();
3127
+ routeTo('/');
3128
+ },
3129
+ href: '/'
3130
+ }, {
3131
+ name: 'Subscriptions',
3132
+ id: 3,
3133
+ // TODO: NEXT router / EUI seem to cause unneeded re-renders. At least in dev mode,
3134
+ onClick: e => {
3135
+ e.preventDefault();
3136
+ routeTo('/subscriptions');
3137
+ },
3138
+ href: '/subscriptions'
3132
3139
  }]
3133
- });
3134
- };
3140
+ }]
3141
+ });
3135
3142
 
3136
3143
  const OrchestratorPageTemplate = ({
3137
3144
  children,
3145
+ routeTo,
3138
3146
  getAppLogo
3139
3147
  }) => {
3140
3148
  const {
@@ -3160,7 +3168,7 @@ const OrchestratorPageTemplate = ({
3160
3168
  }
3161
3169
  }, {
3162
3170
  children: jsx(OrchestratorSidebar, {
3163
- text: "Sidebar"
3171
+ routeTo: routeTo
3164
3172
  })
3165
3173
  })), jsx(EuiPageTemplate.Section, Object.assign({
3166
3174
  css: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@orchestrator-ui/orchestrator-ui-components",
3
- "version": "0.0.1-alpha.1",
3
+ "version": "0.0.1-alpha.3",
4
4
  "main": "./index.js",
5
5
  "module": "./index.js",
6
6
  "type": "module",
@@ -10,7 +10,6 @@
10
10
  "react": "18.2.0",
11
11
  "@emotion/react": "11.10.6",
12
12
  "@elastic/eui": "75.1.2",
13
- "next": "13.1.1",
14
13
  "react-query": "3.39.3"
15
14
  }
16
15
  }
@@ -1,6 +1,7 @@
1
1
  import { FC, ReactElement, ReactNode } from 'react';
2
2
  export interface OrchestratorPageTemplateProps {
3
3
  getAppLogo: (navigationHeight: number) => ReactElement;
4
+ routeTo: (route: string) => void;
4
5
  children: ReactNode;
5
6
  }
6
7
  export declare const OrchestratorPageTemplate: FC<OrchestratorPageTemplateProps>;
@@ -1,5 +1,5 @@
1
1
  import { FC } from 'react';
2
2
  export interface OrchestratorSidebarProps {
3
- text: string;
3
+ routeTo: (route: string) => void;
4
4
  }
5
5
  export declare const OrchestratorSidebar: FC<OrchestratorSidebarProps>;