Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 0 additions & 2 deletions frontend/common/dispatcher/action-constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ const Actions = Object.assign({}, require('./base/_action-constants'), {
'ENABLE_TWO_FACTOR': 'ENABLE_TWO_FACTOR',
'GET_CHANGE_REQUEST': 'GET_CHANGE_REQUEST',
'GET_ENVIRONMENT': 'GET_ENVIRONMENT',
'GET_FLAGS': 'GET_FLAGS',
'GET_IDENTITY': 'GET_IDENTITY',
'GET_ORGANISATION': 'GET_ORGANISATION',
'GET_PROJECT': 'GET_PROJECT',
Expand All @@ -37,7 +36,6 @@ const Actions = Object.assign({}, require('./base/_action-constants'), {
'REMOVE_FLAG': 'REMOVE_FLAG',
'REMOVE_USER_FLAG': 'REMOVE_USER_FLAG',
'RESEND_INVITE': 'RESEND_INVITE',
'SEARCH_FLAGS': 'SEARCH_FLAGS',
'SELECT_ENVIRONMENT': 'SELECT_ENVIRONMENT',
'SELECT_ORGANISATION': 'SELECT_ORGANISATION',
'TOGGLE_USER_FLAG': 'TOGGLE_USER_FLAG',
Expand Down
42 changes: 0 additions & 42 deletions frontend/common/dispatcher/app-actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -199,28 +199,6 @@ const AppActions = Object.assign({}, require('./base/_app-actions'), {
projectId,
})
},
getFeatures(
projectId,
environmentId,
force,
search,
sort,
page,
filter,
pageSize,
) {
Dispatcher.handleViewAction({
actionType: Actions.GET_FLAGS,
environmentId,
filter,
force,
page,
pageSize,
projectId,
search,
sort,
})
},
getIdentity(envId, id) {
Dispatcher.handleViewAction({
actionType: Actions.GET_IDENTITY,
Expand Down Expand Up @@ -306,26 +284,6 @@ const AppActions = Object.assign({}, require('./base/_app-actions'), {
name,
})
},
searchFeatures(
projectId,
environmentId,
force,
search,
sort,
filter,
pageSize,
) {
Dispatcher.handleViewAction({
actionType: Actions.SEARCH_FLAGS,
environmentId,
filter,
force,
pageSize,
projectId,
search,
sort,
})
},
selectOrganisation(id) {
Dispatcher.handleViewAction({
actionType: Actions.SELECT_ORGANISATION,
Expand Down
32 changes: 1 addition & 31 deletions frontend/common/stores/feature-list-store.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import Constants from 'common/constants'
import { getIsWidget } from 'components/pages/WidgetPage'
import ProjectStore from './project-store'
import {
createAndSetFeatureVersion,
Expand Down Expand Up @@ -935,9 +934,7 @@ const controller = {
store.loaded()
})
.catch((e) => {
if (!getIsWidget()) {
document.location.href = '/404?entity=environment'
}
document.location.href = '/404?entity=environment'
API.ajaxHandler(store, e)
})
},
Expand Down Expand Up @@ -1020,33 +1017,6 @@ store.dispatcherIndex = Dispatcher.register(store, (payload) => {
const action = payload.action // this is our action from handleViewAction
const projectId = parseInt(action.projectId)
switch (action.actionType) {
case Actions.SEARCH_FLAGS: {
if (action.sort) {
store.sort = action.sort
}
controller.searchFeatures(
action.search,
action.environmentId,
projectId,
action.filter,
action.pageSize,
)
break
}
case Actions.GET_FLAGS:
store.search = encodeURIComponent(action.search || '')
if (action.sort) {
store.sort = action.sort
}
controller.getFeatures(
projectId,
action.environmentId,
action.force,
action.page,
action.filter,
action.pageSize,
)
break
case Actions.REFRESH_FEATURES:
if (
projectId === store.projectId &&
Expand Down
100 changes: 32 additions & 68 deletions frontend/common/stores/project-store.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { getIsWidget } from 'components/pages/WidgetPage'
import OrganisationStore from './organisation-store'

import Constants from 'common/constants'
Expand Down Expand Up @@ -130,76 +129,41 @@ const controller = {
},
getProject: (id, cb, force) => {
if (!id) {
if (!getIsWidget()) {
!force && AsyncStorage.removeItem('lastEnv')
document.location.href = '/404'
}
} else if (force) {
store.loading()
!force && AsyncStorage.removeItem('lastEnv')
document.location.href = '/404'
return
}

return Promise.all([
data.get(`${Project.api}projects/${id}/`),
data.get(`${Project.api}environments/?project=${id}`).catch(() => []),
])
.then(([project, environments]) => {
project.max_segments_allowed = project.max_segments_allowed
project.max_features_allowed = project.max_features_allowed
project.max_segment_overrides_allowed =
project.max_segment_overrides_allowed
project.total_features = project.total_features || 0
project.total_segments = project.total_segments || 0
store.model = Object.assign(project, {
environments: _.sortBy(environments.results, 'name'),
})
if (project.organisation !== OrganisationStore.id) {
AppActions.selectOrganisation(project.organisation)
AppActions.getOrganisation(project.organisation)
}
store.id = id
store.loaded()
if (cb) {
cb()
}
})
.catch(() => {
if (!getIsWidget()) {
document.location.href = '/404?entity=project'
}
})
} else if (!store.model || !store.model.environments || store.id !== id) {
store.loading()
if (!force && store.model && store.model.environments && store.id === id) {
return
}

Promise.all([
data.get(`${Project.api}projects/${id}/`),
data.get(`${Project.api}environments/?project=${id}`).catch(() => []),
])
.then(([project, environments]) => {
project.max_segments_allowed = project.max_segments_allowed
project.max_features_allowed = project.max_features_allowed
project.max_segment_overrides_allowed =
project.max_segment_overrides_allowed
project.total_features = project.total_features || 0
project.total_segments = project.total_segments || 0
store.model = Object.assign(project, {
environments: _.sortBy(environments.results, 'name'),
})
if (project.organisation !== OrganisationStore.id) {
AppActions.selectOrganisation(project.organisation)
AppActions.getOrganisation(project.organisation)
}
store.id = id
store.loaded()
if (cb) {
cb()
}
})
.catch(() => {
if (!getIsWidget()) {
AsyncStorage.removeItem('lastEnv')
document.location.href = '/404?entity=project'
}
store.loading()

return Promise.all([
data.get(`${Project.api}projects/${id}/`),
data.get(`${Project.api}environments/?project=${id}`).catch(() => []),
])
.then(([project, environments]) => {
project.total_features = project.total_features || 0
project.total_segments = project.total_segments || 0
store.model = Object.assign(project, {
environments: _.sortBy(environments.results, 'name'),
})
}
if (project.organisation !== OrganisationStore.id) {
AppActions.selectOrganisation(project.organisation)
AppActions.getOrganisation(project.organisation)
}
store.id = id
store.loaded()
if (cb) {
cb()
}
})
.catch(() => {
AsyncStorage.removeItem('lastEnv')
document.location.href = '/404?entity=project'
})
},
migrateProject: (id) => {
store.loading()
Expand Down
1 change: 1 addition & 0 deletions frontend/common/types/requests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -868,6 +868,7 @@ export type Req = {
tag_strategy?: TagStrategy
sort_field?: string
sort_direction?: 'ASC' | 'DESC'
identity?: string
}
updateFeatureState: {
environmentId: string
Expand Down
27 changes: 0 additions & 27 deletions frontend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,6 @@
"@babel/preset-react": "^7.12.1",
"@babel/preset-typescript": "^7.18.6",
"@babel/register": "^7.12.1",
"@datadog/ui-extensions-react": "0.32.0",
"@datadog/ui-extensions-sdk": "0.32.0",
"@dnd-kit/abstract": "^0.3.2",
"@dnd-kit/helpers": "^0.3.2",
"@dnd-kit/react": "^0.3.2",
Expand Down
8 changes: 0 additions & 8 deletions frontend/web/components/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import AccountSettingsPage from './pages/AccountSettingsPage'
import ProjectStore from 'common/stores/project-store'
import { Provider } from 'react-redux'
import { getStore } from 'common/store'
import { resolveAuthFlow } from '@datadog/ui-extensions-sdk'
import ConfigProvider from 'common/providers/ConfigProvider'
import AccountStore from 'common/stores/account-store'
import OrganisationLimit from './OrganisationLimit'
Expand Down Expand Up @@ -117,10 +116,6 @@ const App = class extends Component {
}

onLogin = () => {
resolveAuthFlow({
isAuthenticated: true,
})

let redirect = API.getRedirect()
const invite = API.getInvite()
if (invite) {
Expand Down Expand Up @@ -209,9 +204,6 @@ const App = class extends Component {
}

onLogout = () => {
resolveAuthFlow({
isAuthenticated: false,
})
if (document.location.href.includes('saml?')) {
return
}
Expand Down
Loading
Loading