1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-01-20 00:08:02 +01:00
Nuno Góis 2022-12-12 13:21:12 +00:00 committed by GitHub
parent a3fdef11ab
commit e8d0fdba1f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 36 additions and 56 deletions

View File

@ -43,6 +43,7 @@ import { ColumnsMenu } from './ColumnsMenu/ColumnsMenu';
import { useStyles } from './ProjectFeatureToggles.styles'; import { useStyles } from './ProjectFeatureToggles.styles';
import { usePinnedFavorites } from 'hooks/usePinnedFavorites'; import { usePinnedFavorites } from 'hooks/usePinnedFavorites';
import { useFavoriteFeaturesApi } from 'hooks/api/actions/useFavoriteFeaturesApi/useFavoriteFeaturesApi'; import { useFavoriteFeaturesApi } from 'hooks/api/actions/useFavoriteFeaturesApi/useFavoriteFeaturesApi';
import { FeatureTagCell } from 'component/common/Table/cells/FeatureTagCell/FeatureTagCell';
interface IProjectFeatureTogglesProps { interface IProjectFeatureTogglesProps {
features: IProject['features']; features: IProject['features'];
@ -239,20 +240,18 @@ export const ProjectFeatureToggles = ({
sortType: 'alphanumeric', sortType: 'alphanumeric',
searchable: true, searchable: true,
}, },
// FIXME: no tags on project feature toggles from backend {
// { id: 'tags',
// id: 'tags', Header: 'Tags',
// Header: 'Tags', accessor: (row: IFeatureToggleListItem) =>
// accessor: (row: IFeatureToggleListItem) => row.tags
// row.tags ?.map(({ type, value }) => `${type}:${value}`)
// ?.map(({ type, value }) => `${type}:${value}`) .join('\n') || '',
// .join('\n') || '', Cell: FeatureTagCell,
// Cell: FeatureTagCell, width: 80,
// width: 80, hideInMenu: true,
// hideInMenu: true, searchable: true,
// searchable: true, },
// isVisible: false,
// },
{ {
Header: 'Created', Header: 'Created',
accessor: 'createdAt', accessor: 'createdAt',
@ -429,16 +428,15 @@ export const ProjectFeatureToggles = ({
useSortBy useSortBy
); );
// TODO: update after tags are added, move to other useEffect useEffect(() => {
// useEffect(() => { if (!features.some(({ tags }) => tags?.length)) {
// if (!features.some(({ tags }) => tags?.length)) { setHiddenColumns(hiddenColumns => [...hiddenColumns, 'tags']);
// setHiddenColumns(hiddenColumns => [...hiddenColumns, 'tags']); } else {
// } else { setHiddenColumns(hiddenColumns =>
// setHiddenColumns(hiddenColumns => hiddenColumns.filter(column => column !== 'tags')
// hiddenColumns.filter(column => column !== 'tags') );
// ); }
// } }, [setHiddenColumns, features]);
// }, [setHiddenColumns, features]);
useEffect(() => { useEffect(() => {
if (loading) { if (loading) {

View File

@ -77,7 +77,6 @@ exports[`should create default config 1`] = `
"networkView": false, "networkView": false,
"proxyReturnAllToggles": false, "proxyReturnAllToggles": false,
"responseTimeWithAppName": false, "responseTimeWithAppName": false,
"toggleTagFiltering": false,
"tokensLastSeen": false, "tokensLastSeen": false,
"variantsPerEnvironment": false, "variantsPerEnvironment": false,
}, },
@ -94,7 +93,6 @@ exports[`should create default config 1`] = `
"networkView": false, "networkView": false,
"proxyReturnAllToggles": false, "proxyReturnAllToggles": false,
"responseTimeWithAppName": false, "responseTimeWithAppName": false,
"toggleTagFiltering": false,
"tokensLastSeen": false, "tokensLastSeen": false,
"variantsPerEnvironment": false, "variantsPerEnvironment": false,
}, },

View File

@ -427,7 +427,8 @@ class FeatureStrategiesStore implements IFeatureStrategiesStore {
'environments', 'environments',
'feature_environments.environment', 'feature_environments.environment',
'environments.name', 'environments.name',
); )
.leftJoin('feature_tag as ft', 'ft.feature_name', 'features.name');
let selectColumns = [ let selectColumns = [
'features.name as feature_name', 'features.name as feature_name',
@ -439,20 +440,10 @@ class FeatureStrategiesStore implements IFeatureStrategiesStore {
'feature_environments.environment as environment', 'feature_environments.environment as environment',
'environments.type as environment_type', 'environments.type as environment_type',
'environments.sort_order as environment_sort_order', 'environments.sort_order as environment_sort_order',
'ft.tag_value as tag_value',
'ft.tag_type as tag_type',
] as (string | Raw<any>)[]; ] as (string | Raw<any>)[];
if (this.flagResolver.isEnabled('toggleTagFiltering')) {
query = query.leftJoin(
'feature_tag as ft',
'ft.feature_name',
'features.name',
);
selectColumns = [
...selectColumns,
'ft.tag_value as tag_value',
'ft.tag_type as tag_type',
];
}
if (userId && this.flagResolver.isEnabled('favorites')) { if (userId && this.flagResolver.isEnabled('favorites')) {
query = query.leftJoin(`favorite_features`, function () { query = query.leftJoin(`favorite_features`, function () {
this.on('favorite_features.feature', 'features.name').andOnVal( this.on('favorite_features.feature', 'features.name').andOnVal(

View File

@ -135,18 +135,16 @@ export default class FeatureToggleClientStore
.leftJoin('segments', `segments.id`, `fss.segment_id`); .leftJoin('segments', `segments.id`, `fss.segment_id`);
if (isAdmin) { if (isAdmin) {
if (this.flagResolver.isEnabled('toggleTagFiltering')) { query = query.leftJoin(
query = query.leftJoin( 'feature_tag as ft',
'feature_tag as ft', 'ft.feature_name',
'ft.feature_name', 'features.name',
'features.name', );
); selectColumns = [
selectColumns = [ ...selectColumns,
...selectColumns, 'ft.tag_value as tag_value',
'ft.tag_value as tag_value', 'ft.tag_type as tag_type',
'ft.tag_type as tag_type', ];
];
}
if (userId && this.flagResolver.isEnabled('favorites')) { if (userId && this.flagResolver.isEnabled('favorites')) {
query = query.leftJoin(`favorite_features`, function () { query = query.leftJoin(`favorite_features`, function () {

View File

@ -26,10 +26,6 @@ export const defaultExperimentalOptions = {
process.env.UNLEASH_EXPERIMENTAL_RESPONSE_TIME_WITH_APP_NAME, process.env.UNLEASH_EXPERIMENTAL_RESPONSE_TIME_WITH_APP_NAME,
false, false,
), ),
toggleTagFiltering: parseEnvVarBoolean(
process.env.UNLEASH_EXPERIMENTAL_TOGGLE_TAG_FILTERING,
false,
),
proxyReturnAllToggles: parseEnvVarBoolean( proxyReturnAllToggles: parseEnvVarBoolean(
process.env.UNLEASH_EXPERIMENTAL_PROXY_RETURN_ALL_TOGGLES, process.env.UNLEASH_EXPERIMENTAL_PROXY_RETURN_ALL_TOGGLES,
false, false,

View File

@ -40,7 +40,6 @@ process.nextTick(async () => {
anonymiseEventLog: false, anonymiseEventLog: false,
responseTimeWithAppName: true, responseTimeWithAppName: true,
changeRequests: true, changeRequests: true,
toggleTagFiltering: true,
favorites: true, favorites: true,
variantsPerEnvironment: true, variantsPerEnvironment: true,
networkView: true, networkView: true,