Skip to content

Commit

Permalink
chore: type panels (#5139)
Browse files Browse the repository at this point in the history
  • Loading branch information
kyle-ssg authored Feb 26, 2025
1 parent 4657071 commit 7b4a1a5
Show file tree
Hide file tree
Showing 45 changed files with 688 additions and 680 deletions.
2 changes: 1 addition & 1 deletion frontend/common/providers/OrganisationProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { useGetGroupsQuery } from 'common/services/useGroup'
type OrganisationProviderType = {
onRemoveProject?: () => void
onSave?: (data: { environmentId: number; projectId: number }) => void
id?: number | string
id?: number | string | null
children: (props: {
createProject: typeof AppActions.createProject
invalidateInviteLink: typeof AppActions.invalidateInviteLink
Expand Down
9 changes: 5 additions & 4 deletions frontend/common/types/responses.ts
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ export type Organisation = {
restrict_project_create_to_admin: boolean
}
export type Identity = {
id?: string
id: string
identifier: string
identity_uuid?: string
dashboard_alias?: string
Expand Down Expand Up @@ -391,6 +391,8 @@ export type IdentityFeatureState = {
name: string
type: FeatureType
}
identity?: string
identity_uuid?: string
enabled: boolean
feature_state_value: FlagsmithValue
segment: null
Expand All @@ -407,7 +409,6 @@ export type FeatureState = {
id: number
feature_state_value: FlagsmithValue
multivariate_feature_state_values: MultivariateFeatureStateValue[]
identity?: string
uuid: string
enabled: boolean
created_at: string
Expand Down Expand Up @@ -715,7 +716,7 @@ export type Res = {
account: Account
userEmail: {}
groupAdmin: { id: string }
groups: PagedResponse<UserGroupSummary>
groups: PagedResponse<UserGroup>
group: UserGroup
myGroups: PagedResponse<UserGroupSummary>
createSegmentOverride: {
Expand Down Expand Up @@ -790,7 +791,7 @@ export type Res = {
featureImports: PagedResponse<FeatureImport>
serversideEnvironmentKeys: APIKey[]
userGroupPermissions: GroupPermission[]
identityFeatureStates: PagedResponse<FeatureState>
identityFeatureStates: IdentityFeatureState[]
cloneidentityFeatureStates: IdentityFeatureState
featureStates: PagedResponse<FeatureState>
samlConfiguration: SAMLConfiguration
Expand Down
12 changes: 12 additions & 0 deletions frontend/package-lock.json

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

1 change: 1 addition & 0 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@
"@types/react-router": "^4.4.5",
"@types/react-router-dom": "^4.3.1",
"@types/react-select": "^2.0.3",
"@types/react-virtualized": "^9.22.0",
"@types/react-window-infinite-loader": "^1.0.9",
"@typescript-eslint/eslint-plugin": "5.4.0",
"@typescript-eslint/parser": "5.4.0",
Expand Down
2 changes: 1 addition & 1 deletion frontend/web/components/AuditLog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ const AuditLog: FC<AuditLogType> = (props) => {
filter={envFilter}
search={searchInput}
searchPanel={props.searchPanel}
onChange={(e: InputEvent) => {
onChange={(e) => {
setSearchInput(Utils.safeParseEventValue(e))
}}
paging={{
Expand Down
10 changes: 5 additions & 5 deletions frontend/web/components/CompareIdentities.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ import IdentitySelect, { IdentitySelectType } from './IdentitySelect'
import Utils from 'common/utils/utils'
import EnvironmentSelect from './EnvironmentSelect'
import {
useGetIdentityFeatureStatesAllQuery,
useCreateCloneIdentityFeatureStatesMutation,
useGetIdentityFeatureStatesAllQuery,
} from 'common/services/useIdentityFeatureState'
import { useGetProjectFlagsQuery } from 'common/services/useProjectFlag'
import Tag from './tags/Tag'
import PanelSearch from './PanelSearch'
import { ProjectFlag, Res } from 'common/types/responses'
import { IdentityFeatureState } from 'common/types/responses'
import Icon from './Icon'
import Switch from './Switch'
import FeatureValue from './FeatureValue'
Expand All @@ -32,8 +32,8 @@ const featureNameWidth = 300

const calculateFeatureDifference = (
projectFlagId: number,
leftUser: Res['identityFeatureStates'] | undefined,
rightUser: Res['identityFeatureStates'] | undefined,
leftUser: IdentityFeatureState[] | undefined,
rightUser: IdentityFeatureState[] | undefined,
) => {
const featureStateLeft = leftUser?.find((v) => v.feature.id === projectFlagId)
const featureStateRight = rightUser?.find(
Expand Down Expand Up @@ -271,7 +271,7 @@ const CompareIdentities: FC<CompareIdentitiesType> = ({
</Row>
}
items={filteredItems}
renderRow={(data: ProjectFlag) => {
renderRow={(data) => {
const { description, id, name } = data
const {
enabledDifferent,
Expand Down
2 changes: 1 addition & 1 deletion frontend/web/components/EditHealthProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ const EditHealthProvider: FC<EditHealthProviderType> = ({
<Flex className='table-column'>Webhook URL</Flex>
</Row>
}
renderRow={(provider: HealthProvider) => {
renderRow={(provider) => {
const { name, webhook_url: webhook } = provider
const matchingPermissions = {
admin: true,
Expand Down
6 changes: 3 additions & 3 deletions frontend/web/components/EditPermissions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -855,7 +855,7 @@ const _EditPermissionsModal: FC<EditPermissionModalType> = withAdminPermissions(
title='Permissions'
className='no-pad mb-2 overflow-visible'
items={permissions}
renderRow={(p: AvailablePermission, index: number) => {
renderRow={(p) => {
const levelUpperCase = level.toUpperCase()
const disabled =
level !== 'organisation' &&
Expand Down Expand Up @@ -1146,7 +1146,7 @@ const EditPermissions: FC<EditPermissionsType> = (props) => {
</div>
</Row>
}
renderRow={(user: User) => {
renderRow={(user) => {
const { email, first_name, id, last_name, role } =
user
const onClick = () => {
Expand Down Expand Up @@ -1277,7 +1277,7 @@ const EditPermissions: FC<EditPermissionsType> = (props) => {
</div>
</Row>
}
renderRow={(role: Role) => (
renderRow={(role) => (
<Row
className='list-item clickable cursor-pointer'
key={role.id}
Expand Down
2 changes: 1 addition & 1 deletion frontend/web/components/ExternalResourcesTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ const ExternalResourcesTable: FC<ExternalResourcesTableType> = ({
</div>
</Row>
}
renderRow={(v: ExternalResource) => (
renderRow={(v) => (
<ExternalResourceRow
key={v.id}
featureId={featureId}
Expand Down
2 changes: 1 addition & 1 deletion frontend/web/components/FeatureHistory.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ const FeatureHistory: FC<FeatureHistoryPageType> = ({
prevPage={() => setPage(page + 1)}
goToPage={setPage}
dateProperty={'live_from'}
renderRow={(v: TFeatureVersion, i: number) => {
renderRow={(v, i) => {
const user = users?.find((user) => v.published_by === user.id)

return (
Expand Down
2 changes: 1 addition & 1 deletion frontend/web/components/GithubRepositoriesTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ const GithubRepositoriesTable: FC<GithubRepositoriesTableType> = ({
</div>
</Row>
}
renderRow={(repo: GithubRepository) => (
renderRow={(repo) => (
<TableRow
repo={repo}
githubId={githubId}
Expand Down
5 changes: 2 additions & 3 deletions frontend/web/components/OrgEnvironmentSelect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const OrgEnvironmentSelect: FC<OrgProjectSelectType> = ({
projectId,
useApiKey,
}) => {
const [search, setSearch] = useState()
const [search, setSearch] = useState<string>()

const { data: organisations, isLoading: organisationsLoading } =
useGetOrganisationsQuery({})
Expand Down Expand Up @@ -154,7 +154,6 @@ const OrgEnvironmentSelect: FC<OrgProjectSelectType> = ({
organisationsLoading || projectsLoading || environmentsLoading
}
id='segment-list'
icon='ion-ios-globe'
title={`${Format.camelCase(level)} Search`}
items={sortBy(items, (v) => {
return v.name
Expand All @@ -164,7 +163,7 @@ const OrgEnvironmentSelect: FC<OrgProjectSelectType> = ({
}
onChange={setSearch}
search={search}
renderRow={({ api_key, id, name }: Environment) => (
renderRow={({ api_key, id, name }) => (
<a
className='list-item clickable flex flex-1 flex-row px-4'
onClick={() => {
Expand Down
Loading

0 comments on commit 7b4a1a5

Please sign in to comment.