Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
Metabase
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Engineering Digital Service
Metabase
Commits
b6acb3c0
Commit
b6acb3c0
authored
8 years ago
by
Tom Robinson
Browse files
Options
Downloads
Patches
Plain Diff
Remove old Angular hacks
parent
734861e7
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
frontend/src/metabase/lib/createAngularHistory.js
+0
-47
0 additions, 47 deletions
frontend/src/metabase/lib/createAngularHistory.js
frontend/src/metabase/lib/redux.js
+10
-26
10 additions, 26 deletions
frontend/src/metabase/lib/redux.js
with
10 additions
and
73 deletions
frontend/src/metabase/lib/createAngularHistory.js
deleted
100644 → 0
+
0
−
47
View file @
734861e7
import
{
createHistory
}
from
'
history
'
;
// An (incomplete) version of history (https://github.com/mjackson/history)
// that listens for Angular's locationChange events.
export
const
createAngularHistory
=
(
$scope
,
$location
)
=>
{
let
history
=
createHistory
();
let
angularHistory
=
{};
// just copy the original methods with a warning
Object
.
keys
(
history
).
forEach
(
key
=>
{
let
warned
=
false
;
angularHistory
[
key
]
=
(...
args
)
=>
{
if
(
!
warned
)
{
warned
=
true
;
console
.
warn
(
"
createAngularHistory doesn't implement
"
,
key
);
}
return
history
[
key
](...
args
);
};
});
angularHistory
.
createHref
=
(...
args
)
=>
{
return
history
.
createHref
(...
args
);
}
angularHistory
.
replaceState
=
(...
args
)
=>
{
return
history
.
replaceState
(...
args
);
}
angularHistory
.
listen
=
(
listener
)
=>
{
const
handler
=
()
=>
{
listener
({
action
:
"
POP
"
,
hash
:
$location
.
hash
(),
// window.location.hash
key
:
history
.
createKey
(),
pathname
:
$location
.
path
(),
// window.location.pathname
query
:
$location
.
search
(),
search
:
window
.
location
.
search
,
state
:
null
});
};
handler
();
return
$scope
.
$on
(
"
$locationChangeSuccess
"
,
handler
);
}
return
angularHistory
;
}
This diff is collapsed.
Click to expand it.
frontend/src/metabase/lib/redux.js
+
10
−
26
View file @
b6acb3c0
...
...
@@ -8,7 +8,6 @@ import thunk from "redux-thunk";
import
createLogger
from
"
redux-logger
"
;
import
{
createHistory
}
from
'
history
'
;
import
{
createAngularHistory
}
from
"
./createAngularHistory
"
;
import
{
reduxReactRouter
}
from
'
redux-router
'
;
...
...
@@ -32,21 +31,6 @@ export const createStore = compose(
window
.
devToolsExtension
?
window
.
devToolsExtension
()
:
f
=>
f
)(
originalCreateStore
);
export
const
createStoreWithAngularScope
=
(
$scope
,
$location
,
...
args
)
=>
{
let
store
=
compose
(
applyMiddleware
(...
middleware
),
reduxReactRouter
({
createHistory
:
createAngularHistory
.
bind
(
null
,
$scope
,
$location
)
}),
window
.
devToolsExtension
?
window
.
devToolsExtension
()
:
f
=>
f
)(
originalCreateStore
)(...
args
);
// HACK: ugh, we have mismatched versions of redux-router and history.
// this allows hot reloading to work.
store
.
history
.
replace
=
({
state
,
pathname
,
query
})
=>
store
.
history
.
replaceState
(
state
,
pathname
,
query
);
return
store
;
}
// HACK: just use our Angular resources for now
export
function
AngularResourceProxy
(
serviceName
,
methods
)
{
methods
.
forEach
((
methodName
)
=>
{
...
...
@@ -108,11 +92,11 @@ export const cleanResource = (resource) => Object.keys(resource)
.
reduce
((
map
,
key
)
=>
Object
.
assign
({},
map
,
{[
key
]:
resource
[
key
]}),
{});
export
const
fetchData
=
async
({
dispatch
,
getState
,
requestStatePath
,
existingStatePath
,
getData
,
dispatch
,
getState
,
requestStatePath
,
existingStatePath
,
getData
,
reload
})
=>
{
const
existingData
=
i
.
getIn
(
getState
(),
existingStatePath
);
...
...
@@ -137,11 +121,11 @@ export const fetchData = async ({
}
export
const
updateData
=
async
({
dispatch
,
getState
,
requestStatePath
,
dispatch
,
getState
,
requestStatePath
,
existingStatePath
,
// specify any request paths that need to be invalidated after this update
// specify any request paths that need to be invalidated after this update
dependentRequestStatePaths
,
putData
})
=>
{
...
...
@@ -162,4 +146,4 @@ export const updateData = async ({
console
.
error
(
error
);
return
existingData
;
}
}
\ No newline at end of file
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment