Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: url breadcrumbs feature #784

Merged
merged 43 commits into from
Jul 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
405c5b5
chore: new nav bar
FrankFlitton Jul 11, 2023
20f4304
chore: navbar quick links
FrankFlitton Jul 11, 2023
19eda94
chore: task, workflow, launchplans
FrankFlitton Jul 11, 2023
2e6964e
chore: remove unused import
FrankFlitton Jul 11, 2023
8f58f16
chore: fixup navbar integration
FrankFlitton Jul 11, 2023
8c1c7b5
chore: fix linter
FrankFlitton Jul 11, 2023
1a89d76
chore: execution async value
FrankFlitton Jul 12, 2023
257b829
chore: fix types build fail
FrankFlitton Jul 12, 2023
fb684db
chore: async self link
FrankFlitton Jul 12, 2023
250ebb5
chore: add some exports
FrankFlitton Jul 12, 2023
e2199ee
chore: change to names export
FrankFlitton Jul 13, 2023
267ae2f
chore: spelling
ursucarina Jul 14, 2023
19c3184
chore: fix timestamps
ursucarina Jul 14, 2023
9ac3357
chore: fix file upload type failure
FrankFlitton Jul 14, 2023
f56553c
chore: fix Executions title not updating
FrankFlitton Jul 14, 2023
781f938
chore: remove depricated types file for dropzone
FrankFlitton Jul 14, 2023
86f238d
chore: fix execution launch plan self link
FrankFlitton Jul 17, 2023
fd44794
chore: pass custom component
FrankFlitton Jul 17, 2023
669953b
chore: fix named entity cases
FrankFlitton Jul 17, 2023
ab59c1c
chore: different custom component style
FrankFlitton Jul 17, 2023
b6e4e81
chore: dynamic breadcrumb hook with event dispatch
FrankFlitton Jul 18, 2023
c5b6a61
chore: dynamic breadcrumb hook with event dispatch
FrankFlitton Jul 18, 2023
91101cd
chore: project and domains link to dashboard
FrankFlitton Jul 18, 2023
5de0315
chore: add localstorage setting
FrankFlitton Jul 19, 2023
d9d2a0e
chore: get localstorage setting
FrankFlitton Jul 19, 2023
549291d
chore: named entities self links
FrankFlitton Jul 19, 2023
a5fc328
chore: spacing and scaffolding
FrankFlitton Jul 19, 2023
22dc11b
chore: grey header color
FrankFlitton Jul 19, 2023
5407e33
fix/dropdown breadcrumbs (#799)
4nalog Jul 19, 2023
2a1a993
chore: global inject without emotion
FrankFlitton Jul 19, 2023
ed14012
chore: generate id
FrankFlitton Jul 19, 2023
bc082f2
chore: initial unit tests
FrankFlitton Jul 19, 2023
f8c0fe4
chore: fix incorrect localstore value
FrankFlitton Jul 19, 2023
bcbd4b3
chore: named entities execution tests
FrankFlitton Jul 19, 2023
fde1c34
chore: domain and project util tests
FrankFlitton Jul 19, 2023
9617a45
chore: fix execution list page title 404 ing
FrankFlitton Jul 19, 2023
44483bb
chore: fix swipe left to go back
FrankFlitton Jul 20, 2023
b10fefe
chore: feature flag breadcrumb UI content
FrankFlitton Jul 24, 2023
15e1d6c
chore: set flags from url
FrankFlitton Jul 24, 2023
cab13ee
chore: set flags from exxternal config
FrankFlitton Jul 24, 2023
881908d
chore: set feature flags from env
FrankFlitton Jul 24, 2023
392c420
chore: get flags from external env
FrankFlitton Jul 25, 2023
162f36b
chore: better docs from breadcrumbs interface
FrankFlitton Jul 25, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
"workspaces": {
"packages": [
"packages/*",
"packages/**",
"website"
]
},
Expand Down
1 change: 0 additions & 1 deletion packages/console/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,6 @@
"@types/pure-render-decorator": "^0.2.27",
"@types/react": "^16.9.34",
"@types/react-dom": "^16.9.7",
"@types/react-dropzone": "^5.1.0",
"@types/react-router-dom": "^5.3.3",
"@types/react-virtualized": "^9.21.4",
"@types/serve-static": "^1.7.31",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
import React, { PropsWithChildren, useContext } from 'react';
import { AppConfig } from '@flyteorg/common';
import { Breadcrumb } from 'components';

export interface ExternalConfigurationProviderProps {
registry?: {
nav?: React.FC<any>;
topLevelLayout?: React.FC<any>;
taskExecutionAttemps?: React.FC<any>;
additionalRoutes?: any[];
breadcrumbs?: Breadcrumb[];
};
env?: any;
config?: AppConfig;
Expand Down
23 changes: 23 additions & 0 deletions packages/console/src/basics/FeatureFlags/FeatureFlags.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,31 @@ import {

export { FeatureFlag } from './defaultConfig';

/**
* Set feature flag value for current session using URLSearchParams values
* @param search
* @returns
*/
const getSearchParamFlags = (search: string): FeatureFlagConfig => {
const urlParams = new URLSearchParams(search);
const flags: FeatureFlagConfig = {};
for (const [key, value] of urlParams.entries()) {
if (value === 'true') {
flags[key] = true;
} else if (value === 'false') {
flags[key] = false;
}
}
return flags as FeatureFlagConfig;
};

const search: string = window.location.search || '';

// To turn on flag for local development only - update flag value here
// REMOVE change prior to commit
let runtimeConfig: FeatureFlagConfig = {
...defaultFlagConfig,
...getSearchParamFlags(search),
// 'test-flag-true': true, <== locally turns flag on
};

Expand All @@ -32,6 +53,7 @@ interface FeatureFlagState {
}

interface FeatureFlagProviderProps {
externalFlags?: { [k: string]: boolean };
children?: React.ReactNode;
}

Expand All @@ -55,6 +77,7 @@ export const useFeatureFlagContext = () => useContext(FeatureFlagContext);
export const FeatureFlagsProvider = (props: FeatureFlagProviderProps) => {
const [flags, setFlags] = useState<FeatureFlagConfig>({
...defaultFlagConfig,
...props.externalFlags,
...runtimeConfig,
});

Expand Down
5 changes: 5 additions & 0 deletions packages/console/src/basics/FeatureFlags/defaultConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ export enum FeatureFlag {
// Makes the header inline with the content
HorizontalLayout = 'horizontal-layout',

// Replace the page header with the breadcrumb context navigation with related item quicklinks
breadcrumbs = 'breadcrumbs',

// Test Only Mine flag
OnlyMine = 'only-mine',
}
Expand All @@ -29,6 +32,8 @@ export const defaultFlagConfig: FeatureFlagConfig = {

'horizontal-layout': false,

breadcrumbs: false,

'only-mine': false,
};

Expand Down
2 changes: 1 addition & 1 deletion packages/console/src/common/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { Routes } from 'routes/routes';
export function isValidDate(input: string | Date): boolean {
const date = input instanceof Date ? input : new Date(input);
const time = date.getTime();
return !isNaN(time) && time > 0;
return !Number.isNaN(time) && time > 0;
}

/** Converts a Protobuf Timestamp object to a JS Date */
Expand Down
10 changes: 9 additions & 1 deletion packages/console/src/components/App/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,16 @@ export const AppComponent: React.FC<AppComponentProps> = (
const horizontalLayoutFlag =
`${env.HORIZONTAL_LAYOUT}`.trim().toLowerCase() === 'true';

const breadcrumbsFlag = `${env.BREADCRUMBS}`.trim().toLowerCase() === 'true';

return (
<FeatureFlagsProvider>
<FeatureFlagsProvider
externalFlags={{
...props.env,
breadcrumbs: breadcrumbsFlag,
'horizontal-layout': horizontalLayoutFlag,
}}
>
<GlobalStyles />
<LocalCacheProvider>
<StylesProvider
Expand Down
Loading