1
0
mirror of https://github.com/Unleash/unleash.git synced 2024-12-22 19:07:54 +01:00

Remove favorites feature flag (#2722)

This commit is contained in:
sjaanus 2022-12-21 14:03:06 +02:00 committed by GitHub
parent a0619e963d
commit be045dc13a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
15 changed files with 157 additions and 91 deletions

View File

@ -90,27 +90,23 @@ export const FeatureToggleListTable: VFC = () => {
const columns = useMemo(
() => [
...(uiConfig?.flags?.favorites
? [
{
Header: (
<FavoriteIconHeader
isActive={isFavoritesPinned}
onClick={onChangeIsFavoritePinned}
/>
),
accessor: 'favorite',
Cell: ({ row: { original: feature } }: any) => (
<FavoriteIconCell
value={feature?.favorite}
onClick={() => onFavorite(feature)}
/>
),
maxWidth: 50,
disableSortBy: true,
},
]
: []),
{
Header: (
<FavoriteIconHeader
isActive={isFavoritesPinned}
onClick={onChangeIsFavoritePinned}
/>
),
accessor: 'favorite',
Cell: ({ row: { original: feature } }: any) => (
<FavoriteIconCell
value={feature?.favorite}
onClick={() => onFavorite(feature)}
/>
),
maxWidth: 50,
disableSortBy: true,
},
{
Header: 'Seen',
accessor: 'lastSeenAt',
@ -179,7 +175,7 @@ export const FeatureToggleListTable: VFC = () => {
searchable: true,
},
],
[isFavoritesPinned, uiConfig?.flags?.favorites]
[isFavoritesPinned]
);
const {

View File

@ -115,16 +115,9 @@ export const FeatureView = () => {
<div className={styles.header}>
<div className={styles.innerContainer}>
<div className={styles.toggleInfoContainer}>
<ConditionallyRender
condition={Boolean(
uiConfig?.flags?.favorites
)}
show={() => (
<FavoriteIconButton
onClick={onFavorite}
isFavorite={feature?.favorite}
/>
)}
<FavoriteIconButton
onClick={onFavorite}
isFavorite={feature?.favorite}
/>
<h1
className={styles.featureViewHeader}

View File

@ -156,14 +156,9 @@ const Project = () => {
<div className={styles.innerContainer}>
<StyledTopRow>
<StyledDiv>
<ConditionallyRender
condition={Boolean(uiConfig?.flags?.favorites)}
show={() => (
<StyledFavoriteIconButton
onClick={onFavorite}
isFavorite={project?.favorite}
/>
)}
<StyledFavoriteIconButton
onClick={onFavorite}
isFavorite={project?.favorite}
/>
<h2 className={styles.title}>
<StyledName data-loading>

View File

@ -193,28 +193,24 @@ export const ProjectFeatureToggles = ({
const columns = useMemo(
() => [
...(uiConfig?.flags?.favorites
? [
{
id: 'favorite',
Header: (
<FavoriteIconHeader
isActive={isFavoritesPinned}
onClick={onChangeIsFavoritePinned}
/>
),
accessor: 'favorite',
Cell: ({ row: { original: feature } }: any) => (
<FavoriteIconCell
value={feature?.favorite}
onClick={() => onFavorite(feature)}
/>
),
maxWidth: 50,
disableSortBy: true,
},
]
: []),
{
id: 'favorite',
Header: (
<FavoriteIconHeader
isActive={isFavoritesPinned}
onClick={onChangeIsFavoritePinned}
/>
),
accessor: 'favorite',
Cell: ({ row: { original: feature } }: any) => (
<FavoriteIconCell
value={feature?.favorite}
onClick={() => onFavorite(feature)}
/>
),
maxWidth: 50,
disableSortBy: true,
},
{
Header: 'Seen',
accessor: 'lastSeenAt',
@ -303,7 +299,7 @@ export const ProjectFeatureToggles = ({
disableSortBy: true,
},
],
[projectId, environments, loading, onToggle, uiConfig?.flags?.favorites]
[projectId, environments, loading, onToggle]
);
const [searchValue, setSearchValue] = useState(

View File

@ -69,16 +69,11 @@ export const ProjectCard = ({
return (
<Card className={classes.projectCard} onMouseEnter={onHover}>
<div className={classes.header} data-loading>
<ConditionallyRender
condition={Boolean(uiConfig?.flags?.favorites)}
show={() => (
<FavoriteIconButton
onClick={onFavorite}
isFavorite={isFavorite}
size="medium"
sx={{ ml: -1 }}
/>
)}
<FavoriteIconButton
onClick={onFavorite}
isFavorite={isFavorite}
size="medium"
sx={{ ml: -1 }}
/>
<h2 className={classes.title}>{name}</h2>

View File

@ -44,7 +44,6 @@ export interface IFlags {
embedProxyFrontend?: boolean;
changeRequests?: boolean;
variantsPerEnvironment?: boolean;
favorites?: boolean;
networkView?: boolean;
maintenance?: boolean;
}

View File

@ -74,7 +74,6 @@ exports[`should create default config 1`] = `
"changeRequests": false,
"embedProxy": true,
"embedProxyFrontend": true,
"favorites": false,
"maintenance": false,
"maintenanceMode": false,
"networkView": false,
@ -92,7 +91,6 @@ exports[`should create default config 1`] = `
"changeRequests": false,
"embedProxy": true,
"embedProxyFrontend": true,
"favorites": false,
"maintenance": false,
"maintenanceMode": false,
"networkView": false,

View File

@ -259,7 +259,7 @@ class FeatureStrategiesStore implements IFeatureStrategiesStore {
.modify(FeatureToggleStore.filterByArchived, archived);
let selectColumns = ['features_view.*'] as (string | Raw<any>)[];
if (userId && this.flagResolver.isEnabled('favorites')) {
if (userId) {
query = query.leftJoin(`favorite_features`, function () {
this.on(
'favorite_features.feature',
@ -460,7 +460,7 @@ class FeatureStrategiesStore implements IFeatureStrategiesStore {
'ft.tag_type as tag_type',
] as (string | Raw<any>)[];
if (userId && this.flagResolver.isEnabled('favorites')) {
if (userId) {
query = query.leftJoin(`favorite_features`, function () {
this.on('favorite_features.feature', 'features.name').andOnVal(
'favorite_features.user_id',

View File

@ -146,7 +146,7 @@ export default class FeatureToggleClientStore
'ft.tag_type as tag_type',
];
if (userId && this.flagResolver.isEnabled('favorites')) {
if (userId) {
query = query.leftJoin(`favorite_features`, function () {
this.on(
'favorite_features.feature',

View File

@ -100,7 +100,7 @@ class ProjectStore implements IProjectStore {
let groupByColumns = ['projects.id'];
if (userId && this.flagResolver.isEnabled('favorites')) {
if (userId) {
projects = projects.leftJoin(`favorite_projects`, function () {
this.on('favorite_projects.project', 'projects.id').andOnVal(
'favorite_projects.user_id',

View File

@ -27,7 +27,6 @@ import PatController from './user/pat';
import { PublicSignupController } from './public-signup';
import InstanceAdminController from './instance-admin';
import FavoritesController from './favorites';
import { conditionalMiddleware } from '../../middleware';
import MaintenanceController from './maintenance';
class AdminApi extends Controller {
@ -120,10 +119,7 @@ class AdminApi extends Controller {
);
this.app.use(
`/projects`,
conditionalMiddleware(
() => config.flagResolver.isEnabled('favorites'),
new FavoritesController(config, services).router,
),
new FavoritesController(config, services).router,
);
this.app.use(

View File

@ -35,10 +35,6 @@ const flags = {
process.env.UNLEASH_EXPERIMENTAL_VARIANTS_PER_ENVIRONMENT,
false,
),
favorites: parseEnvVarBoolean(
process.env.UNLEASH_EXPERIMENTAL_FAVORITES,
false,
),
networkView: parseEnvVarBoolean(
process.env.UNLEASH_EXPERIMENTAL_NETWORK_VIEW,
false,

View File

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

View File

@ -29,7 +29,6 @@ export function createTestConfig(config?: IUnleashOptions): IUnleashConfig {
batchMetrics: true,
changeRequests: true,
variantsPerEnvironment: true,
favorites: true,
},
},
};

View File

@ -5333,6 +5333,50 @@ If the provided project does not exist, the list of events will be empty.",
],
},
},
"/api/admin/projects/{projectId}/favorites": {
"delete": {
"operationId": "removeFavoriteProject",
"parameters": [
{
"in": "path",
"name": "projectId",
"required": true,
"schema": {
"type": "string",
},
},
],
"responses": {
"200": {
"description": "This response has no body.",
},
},
"tags": [
"Features",
],
},
"post": {
"operationId": "addFavoriteProject",
"parameters": [
{
"in": "path",
"name": "projectId",
"required": true,
"schema": {
"type": "string",
},
},
],
"responses": {
"200": {
"description": "This response has no body.",
},
},
"tags": [
"Features",
],
},
},
"/api/admin/projects/{projectId}/features": {
"get": {
"operationId": "getFeatures",
@ -6304,6 +6348,66 @@ If the provided project does not exist, the list of events will be empty.",
],
},
},
"/api/admin/projects/{projectId}/features/{featureName}/favorites": {
"delete": {
"operationId": "removeFavoriteFeature",
"parameters": [
{
"in": "path",
"name": "projectId",
"required": true,
"schema": {
"type": "string",
},
},
{
"in": "path",
"name": "featureName",
"required": true,
"schema": {
"type": "string",
},
},
],
"responses": {
"200": {
"description": "This response has no body.",
},
},
"tags": [
"Features",
],
},
"post": {
"operationId": "addFavoriteFeature",
"parameters": [
{
"in": "path",
"name": "projectId",
"required": true,
"schema": {
"type": "string",
},
},
{
"in": "path",
"name": "featureName",
"required": true,
"schema": {
"type": "string",
},
},
],
"responses": {
"200": {
"description": "This response has no body.",
},
},
"tags": [
"Features",
],
},
},
"/api/admin/projects/{projectId}/features/{featureName}/variants": {
"get": {
"operationId": "getFeatureVariants",