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

style: Navigation improvements #3864

Merged
merged 54 commits into from
May 9, 2024
Merged
Show file tree
Hide file tree
Changes from 33 commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
63c7de9
Nav poc
kyle-ssg May 1, 2024
1191c15
Nav poc
kyle-ssg May 1, 2024
56a1b77
Nav poc
kyle-ssg May 1, 2024
38f5c82
Nav poc
kyle-ssg May 1, 2024
8dbbff8
Nav poc
kyle-ssg May 1, 2024
5c44c5d
Nav poc
kyle-ssg May 1, 2024
cd8295a
Nav poc
kyle-ssg May 1, 2024
d5ef88b
Fix page title line height
kyle-ssg May 1, 2024
6bd20e8
Adjust breadcrumb
kyle-ssg May 1, 2024
104c4c0
Tidy gh logo
kyle-ssg May 1, 2024
368ee34
Improvements
kyle-ssg May 1, 2024
06f3542
Organisations page
kyle-ssg May 1, 2024
7216afd
Fix org navigation
kyle-ssg May 1, 2024
d121862
Fix Org caching
kyle-ssg May 1, 2024
c2aa3af
neaten breadcrumb
kyle-ssg May 1, 2024
d4cb892
Add org filtering
kyle-ssg May 1, 2024
d22158a
Add org filtering
kyle-ssg May 1, 2024
215d661
Merge branch 'main' into style/nav-poc
kyle-ssg May 1, 2024
1292003
Add permissions
kyle-ssg May 1, 2024
e731d83
Add Project homepage
kyle-ssg May 1, 2024
9733099
Fix project link
kyle-ssg May 1, 2024
7fe9b62
Keyed nav in BreadcrumbSeparator
kyle-ssg May 1, 2024
f6d1ee8
Follow keyboard
kyle-ssg May 1, 2024
83167df
prevent cache misses
kyle-ssg May 1, 2024
23e9d37
prevent cache misses
kyle-ssg May 1, 2024
8933cbe
Fix tests
kyle-ssg May 1, 2024
340f62c
Lint
kyle-ssg May 2, 2024
3d98845
Lint
kyle-ssg May 3, 2024
eb20a9a
Handle navigating to /organisation-settings when user has no organisa…
kyle-ssg May 3, 2024
67860aa
Remove unused page
kyle-ssg May 3, 2024
e79e72d
Move CSS for aside
kyle-ssg May 3, 2024
fba873b
Remove images
kyle-ssg May 3, 2024
4d45f1a
Remove unused styles
kyle-ssg May 3, 2024
a7d8e6d
Remove unused styles
kyle-ssg May 3, 2024
86e08a4
Remove unused styles
kyle-ssg May 3, 2024
f849921
chore: Remove unused styles (#3882)
kyle-ssg May 3, 2024
5c7ba3e
Merge branch 'chore/remove-unused-styles' into style/nav-poc
kyle-ssg May 7, 2024
3fed438
Merge branch 'main' into style/nav-poc
kyle-ssg May 7, 2024
bc1183e
Merge branch 'main' into style/nav-poc
kyle-ssg May 7, 2024
f9a3f91
Fix project access message
kyle-ssg May 7, 2024
decfd1c
Fix segment environment id context
kyle-ssg May 7, 2024
052c34c
Improve environment nav
kyle-ssg May 7, 2024
dd9401e
Improve environment nav
kyle-ssg May 7, 2024
d359142
Fix tests
kyle-ssg May 7, 2024
fb79352
Add create links to top nav
kyle-ssg May 7, 2024
6668798
Add create links to top nav
kyle-ssg May 7, 2024
b759768
Improve styles, fix no projects message
kyle-ssg May 8, 2024
a7bf185
Move SDK keys
kyle-ssg May 8, 2024
44ceb9d
Add settings labels
kyle-ssg May 8, 2024
ddffda4
Update settings icon, add settings labels
kyle-ssg May 8, 2024
cdac097
Tidy up sdk keys icon, fix change requests number not showing
kyle-ssg May 8, 2024
be76434
Fix signup responsiveness
kyle-ssg May 8, 2024
60e269a
Merge branch 'style/fix-signup-responsiveness' into style/nav-poc
kyle-ssg May 8, 2024
4eb64ac
Escape tag tooltips
kyle-ssg May 9, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 0 additions & 1 deletion frontend/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ module.exports = {
'Radio': true,
'React': true,
'ReactDOM': true,
'RemoveIcon': true,
'RequiredElement': true,
'RequiredFunc': true,
'RequiredObject': true,
Expand Down
1 change: 1 addition & 0 deletions frontend/common/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -522,4 +522,5 @@ export default {
'#DE3163',
],
untaggedTag: { color: '#dedede', label: 'Untagged' },
upgradeURL: '/organisation-settings?tab=billing',
}
6 changes: 4 additions & 2 deletions frontend/common/providers/OrganisationProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,21 @@ import { useGetGroupsQuery } from 'common/services/useGroup'
type OrganisationProviderType = {
onRemoveProject?: () => void
onSave?: (data: { environmentId: number; projectId: number }) => void
id?: number
id?: number | string
children: (props: {
createProject: typeof AppActions.createProject
invalidateInviteLink: typeof AppActions.invalidateInviteLink
inviteLinks: InviteLink[] | null
invites: Invite[] | null
error: any
isLoading: boolean
isSaving: boolean
name: string
project: Project | null
groups: UserGroupSummary[] | null
projects: Project[] | null
subscriptionMeta: SubscriptionMeta | null
users: User[] | null
users: User[]
}) => ReactNode
}

Expand Down Expand Up @@ -76,6 +77,7 @@ const OrganisationProvider: FC<OrganisationProviderType> = ({
<>
{children({
createProject: AppActions.createProject,
error: AccountStore.error,
groups: groups?.results || [],
invalidateInviteLink: AppActions.invalidateInviteLink,
inviteLinks: OrganisationStore.getInviteLinks(),
Expand Down
2 changes: 1 addition & 1 deletion frontend/common/providers/Permission.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ const Permission: FC<PermissionType> = ({
{children({
isLoading,
permission: hasPermission || AccountStore.isAdmin(),
}) || <div />}
}) || null}
</>
)
}
Expand Down
5 changes: 1 addition & 4 deletions frontend/common/services/useEnvironment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,9 @@ export async function getEnvironments(
typeof environmentService.endpoints.getEnvironments.initiate
>[1],
) {
store.dispatch(
return store.dispatch(
environmentService.endpoints.getEnvironments.initiate(data, options),
)
return Promise.all(
store.dispatch(environmentService.util.getRunningQueriesThunk()),
)
}
export async function getEnvironment(
store: any,
Expand Down
15 changes: 12 additions & 3 deletions frontend/common/stores/account-store.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { matchPath } from 'react-router'

const Dispatcher = require('../dispatcher/dispatcher')
const BaseStore = require('./base/_store')
const data = require('../data/base/_data')
Expand Down Expand Up @@ -52,7 +54,7 @@ const controller = {

store.saved()
if (isLoginPage) {
window.location.href = `/organisation-settings`
window.location.href = `/organisations`
}
})
.catch((e) => {
Expand Down Expand Up @@ -277,6 +279,7 @@ const controller = {
},

selectOrganisation: (id) => {
API.setCookie('organisation', `${id}`)
store.organisation = _.find(store.model.organisations, { id })
store.changed()
},
Expand All @@ -299,12 +302,18 @@ const controller = {
if (user && user.organisations) {
store.organisation = user.organisations[0]
const cookiedID = API.getCookie('organisation')
if (cookiedID) {
const pathID = matchPath(document.location.pathname, {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prioritises url based organisation over last visited

path: '/organisation/:organisationId',
strict: false,
})?.params?.organisationId
const orgId = pathID || cookiedID
if (orgId) {
const foundOrganisation = user.organisations.find(
(v) => `${v.id}` === cookiedID,
(v) => `${v.id}` === orgId,
)
if (foundOrganisation) {
store.organisation = foundOrganisation
AppActions.getOrganisation(orgId)
}
}
}
Expand Down
5 changes: 3 additions & 2 deletions frontend/common/stores/organisation-store.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ const controller = {
environmentId: res[0].api_key,
projectId: project.id,
}
AppActions.refreshOrganisation()
store.saved()
})
})
Expand Down Expand Up @@ -125,7 +126,7 @@ const controller = {
})
},
getOrganisation: (id, force) => {
if (id !== store.id || force) {
if (`${id}` !== `${store.id}` || force) {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Protects against refetching organisation where the only difference was id vs "id"

store.id = id
store.loading()

Expand All @@ -146,7 +147,7 @@ const controller = {
: [],
),
).then((res) => {
if (id === store.id) {
if (`${id}` === `${store.id}`) {
// eslint-disable-next-line prefer-const
let [_projects, users, invites, subscriptionMeta] = res
let projects = _.sortBy(_projects, 'name')
Expand Down
1 change: 1 addition & 0 deletions frontend/common/stores/project-store.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ const controller = {
data.put(`${Project.api}projects/${project.id}/`, project).then((res) => {
store.model = Object.assign(store.model, res)
getStore().dispatch(projectService.util.invalidateTags(['Project']))
AppActions.refreshOrganisation()
store.saved()
})
},
Expand Down
2 changes: 2 additions & 0 deletions frontend/common/types/responses.ts
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,7 @@ export type githubIntegration = {
export type User = {
id: number
email: string
last_login?: string
first_name: string
last_name: string
role: 'ADMIN' | 'USER'
Expand Down Expand Up @@ -547,6 +548,7 @@ export type Invite = {
email: string
date_created: string
invited_by: User
link: string
permission_groups: number[]
}

Expand Down
8 changes: 8 additions & 0 deletions frontend/common/utils/utils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -384,6 +384,14 @@ const Utils = Object.assign({}, require('./base/_utils'), {
return Constants.projectColors[index % (Constants.projectColors.length - 1)]
},

getOrganisationHomePage(id?: string) {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reusable function to go to the most relevant homepage

const orgId = id || AccountStore.getOrganisation()?.id
if (!orgId) {
return `/organisations`
}
return `/organisation/${orgId}/projects`
},

getSDKEndpoint(_project: ProjectType) {
const project = _project || ProjectStore.model

Expand Down
3 changes: 3 additions & 0 deletions frontend/e2e/helpers.cafe.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ export const getLogger = () =>
})

export const gotoTraits = async () => {
await click('#features-link')
await click('#users-link')
await click(byId('user-item-0'))
await waitForElementVisible('#add-trait')
Expand Down Expand Up @@ -219,6 +220,7 @@ export const saveFeatureSegments = async () => {
}

export const goToUser = async (index: number) => {
await click('#features-link')
await click('#users-link')
await click(byId(`user-item-${index}`))
}
Expand Down Expand Up @@ -331,6 +333,7 @@ export const createRemoteConfig = async (

export const createOrganisationAndProject = async (organisationName:string,projectName:string) =>{
log('Create Organisation')
await click(byId('home-link'))
await click(byId('create-organisation-btn'))
await setText('[name="orgName"]', organisationName)
await click('#create-org-btn')
Expand Down
1 change: 1 addition & 0 deletions frontend/e2e/tests/initialise-tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ export default async function () {
await waitForElementVisible(byId('features-page'))

log('Hide disabled flags')
await click('#project-link')
await click('#project-settings-link')
await click(byId('js-sdk-settings'))
await click(byId('js-hide-disabled-flags'))
Expand Down
1 change: 1 addition & 0 deletions frontend/e2e/tests/invite-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export default async function () {
log('Get Invite url')
await t.navigateTo('http://localhost:3000/organisation-settings')
await Selector(byId('organisation-name')).value
await click(byId('users-and-permissions'))
const inviteLink = await Selector(byId('invite-link')).value
log('Accept invite')
await t.navigateTo(inviteLink)
Expand Down
7 changes: 5 additions & 2 deletions frontend/e2e/tests/project-test.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,23 @@
import {
assertTextContent,
byId,
click,
log,
login,
setText,
waitForElementVisible,
} from '../helpers.cafe'
} from '../helpers.cafe';
import { E2E_USER, PASSWORD } from '../config'

export default async function () {
log('Login')
await login(E2E_USER, PASSWORD)
await click('#project-select-0')
log('Edit Project')
await click('#project-link')
await click('#project-settings-link')
await setText("[name='proj-name']", 'Test Project')
await click('#save-proj-btn')
await waitForElementVisible(byId('switch-project-test-project'))
await assertTextContent(`#project-link`, 'Test Project')

}
1 change: 0 additions & 1 deletion frontend/e2e/tests/versioning-tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import {
editRemoteConfig,
log,
login, refreshUntilElementVisible,
waitAndRefresh,
waitForElementVisible
} from "../helpers.cafe";
import { E2E_USER, PASSWORD } from '../config';
Expand Down
1 change: 0 additions & 1 deletion frontend/global.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ declare global {
const FormGroup: typeof Component
const Select: typeof _Select
const Column: typeof Component
const RemoveIcon: typeof Component
const Loader: typeof Component
const E2E: boolean
const DYNATRACE_URL: string | undefined
Expand Down
34 changes: 0 additions & 34 deletions frontend/web/components/AlertBar.js

This file was deleted.