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

New style permissions #899

Merged
merged 48 commits into from
Aug 21, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
9b77227
OrgView: provide the app width
bpierre Jul 29, 2019
a9b55a1
Permissions: add permissionsByRole()
bpierre Jul 29, 2019
677c524
Add usePermissions() and usePermissionsPerRole()
bpierre Jul 29, 2019
38d15fd
LocalIdentityBadge: coding style
bpierre Jul 29, 2019
e529371
Permissions new style - initial version
bpierre Jul 29, 2019
d73ce4b
Permissions: manage role + filter by action
bpierre Aug 5, 2019
d6aedb3
Fix syntax
bpierre Aug 5, 2019
4471abb
Permissions: remove dead code since we don't have the entity view any…
sohkai Aug 18, 2019
6394c73
Permissions: prefer 'appAddress' over 'proxyAddress' and remove redun…
sohkai Aug 18, 2019
969cad9
Permissions: fix lint
sohkai Aug 18, 2019
ba6ef62
Merge branch 'newstyle' into newstyle-permissions
sohkai Aug 18, 2019
f132e23
OrgView: add proptypes
sohkai Aug 18, 2019
26cc9bc
useAppWidth: refactor into its own hook inside apps/
sohkai Aug 18, 2019
8c514fc
Permissions: remove more assumptions about selecting by entity
sohkai Aug 18, 2019
5310385
Permissions: clarify how scroll to top works
sohkai Aug 18, 2019
013958b
Permissions: update to new Button API
sohkai Aug 18, 2019
e8b98b9
Permissions: remove unused components
sohkai Aug 18, 2019
424968e
AppCard: use Tag and adjust styles
sohkai Aug 18, 2019
0021a2d
Permissions: search by app name and role name
sohkai Aug 18, 2019
e70826b
Permissions: align entity type dropdown with other apps
sohkai Aug 18, 2019
054b5e7
Permissions: small AppPermissions tweaks and fixes
sohkai Aug 18, 2019
123e90c
Permissions: don't add extra left padding to permissions table if no …
sohkai Aug 18, 2019
6af5797
Permissions: avoid showing permissions table heading in smaller layouts
sohkai Aug 18, 2019
d09c1b1
Permissions: update assign and manage panels to new DropDown
sohkai Aug 18, 2019
2491f84
Permissions: add empty filtered state
sohkai Aug 18, 2019
878ea11
Permissions: prefer 'appAddress' over 'proxyAddress' when referring t…
sohkai Aug 18, 2019
e957fe1
Permissions: remove more dead code
sohkai Aug 18, 2019
bc71a61
Permissions: update Tag API to prefer 'label' prop over children
sohkai Aug 18, 2019
5393bc9
Permissions: update text styles
sohkai Aug 18, 2019
8c5c0c7
Permissions: add PermissionsIdentityBadge to handle any and burned en…
sohkai Aug 18, 2019
6db3923
cosmetic: alphabetize definitions in prop-types
sohkai Aug 18, 2019
8a605f0
AppCard: remove custom CSS on Tag
bpierre Aug 20, 2019
f15c5e2
Permissions header: fix text wrap / overflow
bpierre Aug 20, 2019
efd370c
Move AppCard to its own component
bpierre Aug 20, 2019
6d7ac94
Permissions search: debounce updates
bpierre Aug 20, 2019
e8736c1
PermissionsIdentityBadge: extend LocalIdentityBadge proptypes
bpierre Aug 21, 2019
53d1de8
Memoize PermissionsView
bpierre Aug 21, 2019
16796f0
Move the tabs state one level up to keep it between screens
bpierre Aug 21, 2019
25365b0
Routing: add a local path for apps
bpierre Aug 21, 2019
60b9314
Permissions: use a local path
bpierre Aug 21, 2019
88435a4
Merge branch 'newstyle' into newstyle-permissions
bpierre Aug 21, 2019
93a63e8
Remove direct window.location.hash manipulations
bpierre Aug 21, 2019
9cff7b6
Missing hook dependency
bpierre Aug 21, 2019
c23294a
Remove one more window.location.hash
bpierre Aug 21, 2019
1f84578
Merge branch 'newstyle' into newstyle-permissions
bpierre Aug 21, 2019
ddc5835
ESLint
bpierre Aug 21, 2019
294d46a
ESLint
bpierre Aug 21, 2019
a320208
Routing: remove spurious trailing slashes on navigation
sohkai Aug 21, 2019
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
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
"eth-provider": "^0.2.0",
"file-saver": "^2.0.1",
"history": "^4.9.0",
"lodash.debounce": "^4.0.8",
"lodash.memoize": "^4.1.2",
"lodash.throttle": "^4.1.1",
"lodash.uniqby": "^4.7.0",
Expand Down
48 changes: 31 additions & 17 deletions src/Wrapper.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import {
EthereumAddressType,
RepoType,
} from './prop-types'
import { getAppPath, GLOBAL_PREFERENCES_QUERY_PARAM } from './routing'
import { getAppPath, getPreferencesSearch } from './routing'
import { APPS_STATUS_LOADING, DAO_STATUS_LOADING } from './symbols'
import { addressesEqual } from './web3-utils'

Expand Down Expand Up @@ -104,13 +104,25 @@ class Wrapper extends React.PureComponent {
}
}

openApp = (instanceId, params) => {
openApp = (instanceId, { params, localPath } = {}) => {
if (this.props.autoClosingPanel) {
// this.handleMenuPanelClose()
}

const { historyPush, locator } = this.props
historyPush(getAppPath({ dao: locator.dao, instanceId, params }))
historyPush(getAppPath({ dao: locator.dao, instanceId, params, localPath }))
}

closePreferences = () => {
const { historyPush, locator } = this.props
historyPush(getAppPath(locator))
}

openPreferences = (screen, data) => {
const { historyPush, locator } = this.props
historyPush(
getAppPath({ ...locator, search: getPreferencesSearch(screen, data) })
)
}

handleAppIFrameRef = appIFrame => {
Expand Down Expand Up @@ -155,16 +167,14 @@ class Wrapper extends React.PureComponent {
this.setState({ appLoading: false })
}

handleClosePreferences = () => {
window.location.hash = getAppPath(this.props.locator)
}
handleOpenPreferences = path => {
const appPath = getAppPath(this.props.locator)
window.location.hash = `${appPath}${GLOBAL_PREFERENCES_QUERY_PARAM}${path}`
}
// params need to be a string
handleParamsRequest = params => {
this.openApp(this.props.locator.instanceId, params)
this.openApp(this.props.locator.instanceId, { params })
}

// Update the local path of the current instance
handlePathRequest = localPath => {
this.openApp(this.props.locator.instanceId, { localPath })
}

getAppInstancesGroups = memoize(apps =>
Expand Down Expand Up @@ -270,7 +280,7 @@ class Wrapper extends React.PureComponent {
daoAddress={daoAddress}
daoStatus={daoStatus}
onOpenApp={this.openApp}
onOpenPreferences={this.handleOpenPreferences}
onOpenPreferences={this.openPreferences}
onRequestAppsReload={onRequestAppsReload}
onRequestEnable={onRequestEnable}
>
Expand All @@ -281,7 +291,10 @@ class Wrapper extends React.PureComponent {
daoLoading={daoStatus === DAO_STATUS_LOADING}
instanceId={locator.instanceId}
>
{this.renderApp(locator.instanceId, locator.params)}
{this.renderApp(locator.instanceId, {
params: locator.params,
localPath: locator.localPath,
})}
</AppLoader>

<SignerPanel
Expand Down Expand Up @@ -311,12 +324,13 @@ class Wrapper extends React.PureComponent {
<GlobalPreferences
locator={locator}
wrapper={wrapper}
onClose={this.handleClosePreferences}
onScreenChange={this.openPreferences}
onClose={this.closePreferences}
/>
</div>
)
}
renderApp(instanceId, params) {
renderApp(instanceId, { params, localPath }) {
const {
account,
apps,
Expand Down Expand Up @@ -353,9 +367,9 @@ class Wrapper extends React.PureComponent {
apps={apps}
appsLoading={appsLoading}
permissionsLoading={permissionsLoading}
params={params}
localPath={localPath}
onMessage={this.handleAppMessage}
onParamsRequest={this.handleParamsRequest}
onPathRequest={this.handlePathRequest}
wrapper={wrapper}
/>
)
Expand Down
100 changes: 0 additions & 100 deletions src/apps/Permissions/AppCard.js

This file was deleted.

Loading