Skip to content

Commit aefc9ac

Browse files
authored
feat: create subscription forms, sources (#4076)
1 parent cc20fe7 commit aefc9ac

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+3146
-8
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,4 @@ src/client/mapsdRoutes.ts
3535
src/client/managedFunctionsRoutes.ts
3636
src/client/pinnedItemRoutes.ts
3737
src/client/fluxdocsdRoutes.ts
38+
src/client/subscriptionsRoutes.ts

package.json

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,11 @@
5252
"cy": "CYPRESS_dexUrl=https://$INGRESS_HOST:$PORT_HTTPS CYPRESS_baseUrl=http://localhost:9999 cypress open",
5353
"cy:dev": "source ../monitor-ci/.env && CYPRESS_dexUrl=CLOUD CYPRESS_baseUrl=https://$INGRESS_HOST:$PORT_HTTPS cypress open --config testFiles='{cloud,shared}/**/*.*'",
5454
"cy:dev-oss": "source ../monitor-ci/.env && CYPRESS_dexUrl=OSS CYPRESS_baseUrl=https://$INGRESS_HOST:$PORT_HTTPS cypress open --config testFiles='{oss,shared}/**/*.*'",
55-
"generate": "export SHA=1a9e6dd4a72fb8dd313134ec7107d0117b52cfd2 && export REMOTE=https://raw.githubusercontent.com/influxdata/openapi/${SHA}/ && yarn generate-meta",
55+
"generate": "export SHA=912fc1474b63f022231dbd068c935451ca0f677a && export REMOTE=https://raw.githubusercontent.com/influxdata/openapi/${SHA}/ && yarn generate-meta",
5656
"generate-local": "export REMOTE=../openapi/ && yarn generate-meta",
5757
"generate-meta": "if [ -z \"${CLOUD_URL}\" ]; then yarn generate-meta-oss; else yarn generate-meta-cloud; fi",
58-
"generate-meta-oss": "yarn oss-api && yarn notebooks && yarn unity && yarn annotations-oss && yarn pinned && yarn mapsd-oss && yarn cloudPriv && yarn fluxdocs",
59-
"generate-meta-cloud": "yarn cloud-api && yarn notebooks && yarn unity && yarn annotations && yarn cloudPriv && yarn pinned && yarn mapsd && yarn fluxdocs",
58+
"generate-meta-oss": "yarn oss-api && yarn notebooks && yarn unity && yarn annotations-oss && yarn pinned && yarn mapsd-oss && yarn cloudPriv && yarn fluxdocs && yarn subscriptions-oss",
59+
"generate-meta-cloud": "yarn cloud-api && yarn notebooks && yarn unity && yarn annotations && yarn cloudPriv && yarn pinned && yarn mapsd && yarn fluxdocs && yarn subscriptions",
6060
"oss": "oats ${REMOTE}contracts/oss-diff.yml > ./src/client/ossRoutes.ts",
6161
"cloud": "oats ${REMOTE}contracts/cloud-diff.yml > ./src/client/cloudRoutes.ts",
6262
"common": "oats ${REMOTE}contracts/common.yml > ./src/client/commonRoutes.ts",
@@ -69,6 +69,8 @@
6969
"annotations-oss": "oats ${REMOTE}contracts/priv/annotationd-oss.yml > ./src/client/annotationdRoutes.ts",
7070
"mapsd-oss": "touch ./src/client/mapsdRoutes.ts",
7171
"mapsd": "oats ${REMOTE}contracts/mapsd.yml > ./src/client/mapsdRoutes.ts",
72+
"subscriptions": "oats ${REMOTE}contracts/priv/nifid.yml > ./src/client/subscriptionsRoutes.ts",
73+
"subscriptions-oss": "touch ./src/client/subscriptionsRoutes.ts",
7274
"pinned": "oats ${REMOTE}contracts/priv/pinneditemsd.yml > ./src/client/pinnedItemRoutes.ts",
7375
"fluxdocs": "oats ${REMOTE}contracts/priv/fluxdocsd.yml > ./src/client/fluxdocsdRoutes.ts",
7476
"telegraf-plugins:update": "node src/writeData/utils/parsePluginsConfigurationText.mjs"

src/pageLayout/constants/navigationHierarchy.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,13 @@ export const generateNavItems = (): NavItem[] => {
7272
link: `${orgPrefix}/load-data/scrapers`,
7373
enabled: () => !CLOUD,
7474
},
75+
{
76+
id: 'subscriptions',
77+
testID: 'nav-subitem-subscriptions',
78+
label: 'Cloud Native Subscriptions',
79+
link: `${orgPrefix}/load-data/subscriptions`,
80+
enabled: () => CLOUD && isFlagEnabled('subscriptionsResourceType'),
81+
},
7582
{
7683
id: 'tokens',
7784
testID: 'nav-subitem-tokens',

src/settings/components/LoadDataNavigation.tsx

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import {FeatureFlag} from 'src/shared/utils/featureFlag'
99
// Decorators
1010
import {ErrorHandling} from 'src/shared/decorators/errors'
1111
import CloudExclude from 'src/shared/components/cloud/CloudExclude'
12+
import CloudOnly from 'src/shared/components/cloud/CloudOnly'
1213

1314
interface OwnProps {
1415
activeTab: string
@@ -31,29 +32,41 @@ class LoadDataNavigation extends PureComponent<Props> {
3132
text: 'Sources',
3233
id: 'sources',
3334
cloudExclude: false,
35+
cloudOnly: false,
3436
featureFlag: null,
3537
},
3638
{
3739
text: 'Buckets',
3840
id: 'buckets',
3941
cloudExclude: false,
42+
cloudOnly: false,
4043
featureFlag: null,
4144
},
4245
{
4346
text: 'Telegraf',
4447
id: 'telegrafs',
4548
cloudExclude: false,
49+
cloudOnly: false,
4650
featureFlag: null,
4751
},
4852
{
4953
text: 'Scrapers',
5054
id: 'scrapers',
5155
cloudExclude: true,
56+
cloudOnly: false,
5257
featureFlag: null,
5358
},
59+
{
60+
text: 'Cloud Native Subscriptions',
61+
id: 'subscriptions',
62+
cloudExclude: false,
63+
cloudOnly: true,
64+
featureFlag: 'subscriptionsResourceType',
65+
},
5466
{
5567
text: 'API Tokens',
5668
id: 'tokens',
69+
cloudOnly: false,
5770
cloudExclude: false,
5871
featureFlag: null,
5972
},
@@ -84,6 +97,10 @@ class LoadDataNavigation extends PureComponent<Props> {
8497
tabElement = <CloudExclude key={t.id}>{tabElement}</CloudExclude>
8598
}
8699

100+
if (t.cloudOnly) {
101+
tabElement = <CloudOnly key={t.id}>{tabElement}</CloudOnly>
102+
}
103+
87104
if (t.featureFlag) {
88105
tabElement = (
89106
<FeatureFlag key={t.id} name={t.featureFlag}>

src/shared/components/resource_sort_dropdown/generateSortItems.ts

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import {
1212
Scraper,
1313
Authorization,
1414
Flow,
15+
Subscription,
1516
} from 'src/types'
1617

1718
export type DashboardSortKey = keyof Dashboard | 'meta.updatedAt'
@@ -25,6 +26,7 @@ export type TelegrafSortKey = keyof Telegraf
2526
export type ScraperSortKey = keyof Scraper
2627
export type AuthorizationSortKey = keyof Authorization
2728
export type FlowSortKey = keyof Flow
29+
export type SubscriptionKey = keyof Subscription
2830

2931
export type SortKey =
3032
| DashboardSortKey
@@ -38,6 +40,7 @@ export type SortKey =
3840
| ScraperSortKey
3941
| AuthorizationSortKey
4042
| FlowSortKey
43+
| SubscriptionKey
4144

4245
export interface SortDropdownItem {
4346
label: string
@@ -383,5 +386,32 @@ export const generateSortItems = (
383386
sortDirection: Sort.Descending,
384387
},
385388
]
389+
case ResourceType.Subscriptions:
390+
return [
391+
{
392+
label: 'Name (A → Z)',
393+
sortKey: 'name',
394+
sortType: SortTypes.String,
395+
sortDirection: Sort.Ascending,
396+
},
397+
{
398+
label: 'Name (Z → A)',
399+
sortKey: 'name',
400+
sortType: SortTypes.String,
401+
sortDirection: Sort.Descending,
402+
},
403+
{
404+
label: 'Description (Ascending)',
405+
sortKey: 'description',
406+
sortType: SortTypes.String,
407+
sortDirection: Sort.Ascending,
408+
},
409+
{
410+
label: 'Description (Descending)',
411+
sortKey: 'description',
412+
sortType: SortTypes.String,
413+
sortDirection: Sort.Descending,
414+
},
415+
]
386416
}
387417
}

src/shared/constants/routes.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,3 +40,5 @@ export const DEVELOPER_TOOLS = 'developer-tools'
4040
export const INTEGRATIONS = 'integrations'
4141

4242
export const DATA_EXPLORER = 'data-explorer'
43+
44+
export const SUBSCRIPTIONS = 'subscriptions'

src/shared/containers/SetOrg.tsx

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ import {
4444
UsersPage,
4545
VariablesIndex,
4646
VersionPage,
47+
SubscriptionsLanding,
48+
CreateSubscriptionForm,
4749
WriteDataPage,
4850
} from 'src/shared/containers'
4951

@@ -67,6 +69,7 @@ import {
6769
CLIENT_LIBS,
6870
TELEGRAF_PLUGINS,
6971
SECRETS,
72+
SUBSCRIPTIONS,
7073
} from 'src/shared/constants/routes'
7174

7275
// Actions
@@ -229,6 +232,20 @@ const SetOrg: FC = () => {
229232
/>
230233
)}
231234

235+
{CLOUD && isFlagEnabled('subscriptionsResourceType') && (
236+
<Route
237+
path={`${orgPath}/${LOAD_DATA}/${SUBSCRIPTIONS}/create`}
238+
component={CreateSubscriptionForm}
239+
/>
240+
)}
241+
242+
{CLOUD && isFlagEnabled('subscriptionsResourceType') && (
243+
<Route
244+
path={`${orgPath}/${LOAD_DATA}/${SUBSCRIPTIONS}`}
245+
component={SubscriptionsLanding}
246+
/>
247+
)}
248+
232249
{/* Settings */}
233250
<Route
234251
path={`${orgPath}/${SETTINGS}/${VARIABLES}`}

src/shared/containers/index.tsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,13 @@ export const OrgOverlay = lazy(() => import('src/operator/OrgOverlayWrapper'))
9999

100100
export const CheckoutPage = lazy(() => import('src/checkout/CheckoutPage'))
101101

102+
export const SubscriptionsLanding = lazy(() =>
103+
import('src/writeData/subscriptions/components/SubscriptionsLanding')
104+
)
105+
export const CreateSubscriptionForm = lazy(() =>
106+
import('src/writeData/subscriptions/components/CreateSubscriptionPage')
107+
)
108+
102109
export const HomepageContainer = lazy(() =>
103110
import(
104111
'src/homepageExperience/containers/HomepageContainer'
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import {Notification} from 'src/types'
2+
import {defaultErrorNotification} from 'src/shared/copy/notifications'
3+
4+
// Subscriptions
5+
export const subscriptionCreateFail = (): Notification => ({
6+
...defaultErrorNotification,
7+
message: `Failed to create Subscription, please try again.`,
8+
})

src/shared/copy/notifications/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ export * from './categories/notebooks'
1414
export * from './categories/onboarding'
1515
export * from './categories/operator'
1616
export * from './categories/secrets'
17+
export * from './categories/subscriptions'
1718
export * from './categories/tasks'
1819
export * from './categories/template'
1920
export * from './categories/variables-urlQueries'

0 commit comments

Comments
 (0)