forked from amundsen-io/amundsen
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Reorganize table owners & table tags state (#30)
* Un-nest owners and tags state: Move from state.tableMetadata.tableData to state.tableMetadata * Create a nested reducer for owners * Rename ducks/tags -> ducks/allTags to reduce confusion with table tags * Create a nested reducer for table tags * Some code cleanup * Added table data defaults + utilMethods
- Loading branch information
Showing
24 changed files
with
391 additions
and
187 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
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
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
6 changes: 3 additions & 3 deletions
6
frontend/amundsen_application/static/js/containers/BrowsePage/index.tsx
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
2 changes: 1 addition & 1 deletion
2
...nd/amundsen_application/static/js/containers/TableDetail/TableOwnerEditableList/index.tsx
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
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
12 changes: 12 additions & 0 deletions
12
frontend/amundsen_application/static/js/ducks/allTags/api/v0.ts
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,12 @@ | ||
import axios from 'axios'; | ||
|
||
import { sortTagsAlphabetical } from '../../utilMethods'; | ||
|
||
export function metadataAllTags() { | ||
return axios.get('/api/metadata/v0/tags').then((response) => { | ||
return response.data.tags.sort(sortTagsAlphabetical); | ||
}) | ||
.catch((error) => { | ||
return error.response.data.tags.sort(sortTagsAlphabetical); | ||
}); | ||
} |
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
10 changes: 10 additions & 0 deletions
10
frontend/amundsen_application/static/js/ducks/popularTables/api/v0.ts
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,10 @@ | ||
import axios from 'axios'; | ||
|
||
export function metadataPopularTables() { | ||
return axios.get('/api/metadata/v0/popular_tables').then((response) => { | ||
return response.data.results; | ||
}) | ||
.catch((error) => { | ||
return error.response.data.results; | ||
}); | ||
} |
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
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
32 changes: 32 additions & 0 deletions
32
frontend/amundsen_application/static/js/ducks/tableMetadata/api/helpers.ts
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,32 @@ | ||
/** TODO: We will introduce better typing for function parameters return types */ | ||
|
||
import { filterFromObj, sortTagsAlphabetical } from '../../utilMethods'; | ||
|
||
/** | ||
* Generates the query string parameters needed for requests that act on a particular table resource. | ||
*/ | ||
export function getTableParams(tableDataObject) { | ||
const { cluster, database, schema, table_name } = tableDataObject; | ||
return `db=${database}&cluster=${cluster}&schema=${schema}&table=${table_name}`; | ||
} | ||
|
||
/** | ||
* Parses the response for table metadata to create a TableMetadata object | ||
*/ | ||
export function getTableDataFromResponseData(responseData) { | ||
return filterFromObj(responseData, ['owners', 'tags']); | ||
} | ||
|
||
/** | ||
* Parses the response for table metadata to return the array of table owners | ||
*/ | ||
export function getTableOwnersFromResponseData(responseData) { | ||
return responseData.owners; | ||
} | ||
|
||
/** | ||
* Parses the response for table metadata to return an array of sorted table tags | ||
*/ | ||
export function getTableTagsFromResponseData(responseData) { | ||
return responseData.tags.sort(sortTagsAlphabetical); | ||
} |
Oops, something went wrong.