ktmud commented on a change in pull request #15699:
URL: https://github.com/apache/superset/pull/15699#discussion_r670078905
##########
File path: superset-frontend/src/dashboard/actions/datasources.ts
##########
@@ -16,26 +16,44 @@
* specific language governing permissions and limitations
* under the License.
*/
+import { Dispatch } from 'redux';
import { SupersetClient } from '@superset-ui/core';
-import { getClientErrorObject } from '../../utils/getClientErrorObject';
+import { Datasource, RootState } from 'src/dashboard/types';
-export const SET_DATASOURCE = 'SET_DATASOURCE';
-export function setDatasource(datasource, key) {
- return { type: SET_DATASOURCE, datasource, key };
+// update datasources index for Dashboard
+export enum DatasourcesAction {
+ SET_DATASOURCES = 'SET_DATASOURCES',
+ SET_DATASOURCE = 'SET_DATASOURCE',
}
-export const FETCH_DATASOURCE_STARTED = 'FETCH_DATASOURCE_STARTED';
-export function fetchDatasourceStarted(key) {
- return { type: FETCH_DATASOURCE_STARTED, key };
+export type DatasourcesActionPayload =
+ | {
+ type: DatasourcesAction.SET_DATASOURCES;
+ datasources: Datasource[] | null;
+ }
+ | {
+ type: DatasourcesAction.SET_DATASOURCE;
+ key: Datasource['uid'];
+ datasource: Datasource;
+ };
+
+export function setDatasources(datasources: Datasource[] | null) {
+ return {
+ type: DatasourcesAction.SET_DATASOURCES,
+ datasources,
+ };
}
-export const FETCH_DATASOURCE_FAILED = 'FETCH_DATASOURCE_FAILED';
-export function fetchDatasourceFailed(error, key) {
- return { type: FETCH_DATASOURCE_FAILED, error, key };
Review comment:
Cleaned up `FETCH_DATASOURCE_STARTED` and `FETCH_DATASOURCE_FAILED`
because there is no corresponding reducers for them.
##########
File path: superset-frontend/src/dashboard/actions/datasources.ts
##########
@@ -16,26 +16,44 @@
* specific language governing permissions and limitations
* under the License.
*/
+import { Dispatch } from 'redux';
import { SupersetClient } from '@superset-ui/core';
-import { getClientErrorObject } from '../../utils/getClientErrorObject';
+import { Datasource, RootState } from 'src/dashboard/types';
-export const SET_DATASOURCE = 'SET_DATASOURCE';
-export function setDatasource(datasource, key) {
- return { type: SET_DATASOURCE, datasource, key };
+// update datasources index for Dashboard
+export enum DatasourcesAction {
+ SET_DATASOURCES = 'SET_DATASOURCES',
+ SET_DATASOURCE = 'SET_DATASOURCE',
}
-export const FETCH_DATASOURCE_STARTED = 'FETCH_DATASOURCE_STARTED';
-export function fetchDatasourceStarted(key) {
- return { type: FETCH_DATASOURCE_STARTED, key };
+export type DatasourcesActionPayload =
+ | {
+ type: DatasourcesAction.SET_DATASOURCES;
+ datasources: Datasource[] | null;
+ }
+ | {
+ type: DatasourcesAction.SET_DATASOURCE;
+ key: Datasource['uid'];
+ datasource: Datasource;
+ };
+
+export function setDatasources(datasources: Datasource[] | null) {
+ return {
+ type: DatasourcesAction.SET_DATASOURCES,
+ datasources,
+ };
}
-export const FETCH_DATASOURCE_FAILED = 'FETCH_DATASOURCE_FAILED';
-export function fetchDatasourceFailed(error, key) {
- return { type: FETCH_DATASOURCE_FAILED, error, key };
Review comment:
Cleaned up `FETCH_DATASOURCE_STARTED` and `FETCH_DATASOURCE_FAILED`
because there are no corresponding reducers for them.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]