-
Notifications
You must be signed in to change notification settings - Fork 247
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding search and replace to datadocs (#30)
* Adding search and replace to datadocs * Generalize search and replace into a provider component, add feature to adhoc query
- Loading branch information
Showing
41 changed files
with
1,858 additions
and
144 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import { replaceStringIndices } from 'lib/data-doc/search'; | ||
|
||
const testString = 'the quick brown fox jumps over the lazy dog'; | ||
|
||
test('Replace empty case', () => { | ||
expect(replaceStringIndices(testString, [], 'ze')).toBe( | ||
'the quick brown fox jumps over the lazy dog' | ||
); | ||
}); | ||
|
||
test('Replace simple case', () => { | ||
expect(replaceStringIndices(testString, [[0, 3]], 'ze')).toBe( | ||
'ze quick brown fox jumps over the lazy dog' | ||
); | ||
}); | ||
|
||
test('Replace multiple case', () => { | ||
expect( | ||
replaceStringIndices( | ||
testString, | ||
[ | ||
[0, 3], | ||
[31, 34], | ||
], | ||
'le' | ||
) | ||
).toBe('le quick brown fox jumps over le lazy dog'); | ||
expect( | ||
replaceStringIndices( | ||
testString, | ||
[ | ||
[16, 19], | ||
[40, 43], | ||
], | ||
'tiger' | ||
) | ||
).toBe('the quick brown tiger jumps over the lazy tiger'); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -207,4 +207,10 @@ | |
} | ||
} | ||
} | ||
|
||
.SearchAndReplaceBar { | ||
position: fixed; | ||
right: 60px; | ||
z-index: 10; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import React from 'react'; | ||
import { sample } from 'lodash'; | ||
import { Title } from 'ui/Title/Title'; | ||
|
||
const loadingHints: string[] = require('config/loading_hints.yaml').hints; | ||
|
||
export const DataDocLoading: React.FC = () => { | ||
const hint = sample(loadingHints); | ||
|
||
return ( | ||
<div className="datadoc-loading"> | ||
<div className="datadoc-loading-message"> | ||
<Title> | ||
<i className="fa fa-spinner fa-pulse" /> | ||
Loading DataDoc | ||
</Title> | ||
|
||
<br /> | ||
<p className="subtitle"> | ||
<i className="far fa-lightbulb" /> | ||
Did you know: {hint} | ||
</p> | ||
</div> | ||
</div> | ||
); | ||
}; |
Oops, something went wrong.