Skip to content

Commit

Permalink
Redirecting to view mode of datasource after authorization (#5758)
Browse files Browse the repository at this point in the history
* view mode true

* removed new query btn from view mode for google sheet datasource

Co-authored-by: Pranav Kanade <pranav@appsmith.com>
  • Loading branch information
nidhi-nair and pranavkanade authored Jul 9, 2021
1 parent 45198c7 commit 193f20a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 50 deletions.
49 changes: 1 addition & 48 deletions app/client/src/pages/Editor/SaaSEditor/DatasourceForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import {
redirectAuthorizationCode,
updateDatasource,
} from "actions/datasourceActions";
import { createNewQueryName } from "utils/AppsmithUtils";
import { createActionRequest } from "actions/actionActions";
import { ActionDataState } from "reducers/entityReducers/actionsReducer";
import {
Expand Down Expand Up @@ -92,18 +91,6 @@ const EditDatasourceButton = styled(AdsButton)`
}
`;

const NewQueryBtn = styled(AdsButton)`
padding: 10px 20px;
&&&& {
height: 36px;
//max-width: 120px;
width: auto;
}
span > svg > path {
stroke: white;
}
`;

class DatasourceSaaSEditor extends JSONtoForm<Props> {
componentDidMount() {
super.componentDidMount();
Expand Down Expand Up @@ -142,33 +129,6 @@ class DatasourceSaaSEditor extends JSONtoForm<Props> {
return this.renderForm(content);
}

createQueryAction = () => {
const {
actions,
datasource,
match: {
params: { pageId },
},
} = this.props;
const newQueryName = createNewQueryName(actions, pageId || "");

const payload = {
name: newQueryName,
pageId: pageId,
pluginId: datasource?.pluginId,
datasource: {
id: datasource?.id,
},
actionConfiguration: {},
eventData: {
actionType: "Query",
from: "datasource-pane",
},
} as Partial<Action>;

this.props.createAction(payload);
};

renderDataSourceConfigForm = (sections: any) => {
const {
deleteDatasource,
Expand All @@ -192,7 +152,7 @@ class DatasourceSaaSEditor extends JSONtoForm<Props> {
<PluginImage alt="Datasource" src={this.props.pluginImage} />
<FormTitle focusOnMount={this.props.isNewDatasource} />
</FormTitleContainer>
{viewMode ? (
{viewMode && (
<EditDatasourceButton
category={Category.tertiary}
className="t--edit-datasource"
Expand All @@ -211,13 +171,6 @@ class DatasourceSaaSEditor extends JSONtoForm<Props> {
}}
text="EDIT"
/>
) : (
<NewQueryBtn
className="t--create-query"
icon="plus"
onClick={this.createQueryAction}
text={"New Query"}
/>
)}
</Header>
{!viewMode ? (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -276,11 +276,13 @@ private Mono<String> getPageRedirectUrl(String state, String error) {
"edit" + Entity.SLASH +
Entity.DATASOURCES + Entity.SLASH +
datasourceId +
"?response_status=" + responseStatus)
"?response_status=" + responseStatus +
"&view_mode=true")
.onErrorResume(e -> Mono.just(
redirectOrigin + Entity.SLASH +
Entity.APPLICATIONS +
"?response_status=" + responseStatus));
"?response_status=" + responseStatus +
"&view_mode=true"));
}

public Mono<String> getAppsmithToken(String datasourceId, String pageId, ServerHttpRequest request) {
Expand Down

0 comments on commit 193f20a

Please sign in to comment.