10000 feat: html->http · githubocto/flat-vscode@0b8a072 · GitHub
[go: up one dir, main page]

Skip to content
This repository was archived by the owner on Apr 23, 2021. It is now read-only.

Commit 0b8a072

Browse files
author
Matt Rothenberg
committed
feat: html->http
1 parent 23269fc commit 0b8a072

File tree

7 files changed

+24
-24
lines changed

7 files changed

+24
-24
lines changed

src/commands/save-and-commit.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ export const saveAndCommit = async (params: Params) => {
3636

3737
// Make YAML, given params
3838
const action = makeActionYaml({
39-
type: "html",
39+
type: "http",
4040
...params,
4141
});
4242

src/lib.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { ConnectionString } from "connection-string";
33
import { createConnection } from "typeorm";
44

55
interface ActionParams {
6-
type?: string;
6+
type: "sql" | "http";
77
name?: string;
88
cron?: string;
99
source?: string;
@@ -33,8 +33,8 @@ jobs:
3333
uses: githubocto/flat@v1
3434
with:
3535
type: ${type}
36-
${type === "html" ? `url: '${source}'` : ""}
37-
${type === "html" ? `outfile: ${outfile}` : ""}
36+
${type === "http" ? `url: '${source}'` : ""}
37+
${type === "http" ? `outfile: ${outfile}` : ""}
3838
${type === "sql" ? `format: ${format}` : ""}
3939
${
4040
type === "sql"
@@ -47,8 +47,8 @@ jobs:
4747
${
4848
type === "sql"
4949
? `
50-
# After hitting "Save and Commit Action", you'll be prompted to write your SQL query.
51-
queryfile: query.sql`
50+
# After hitting "Save and Commit Action", you'll be prompted to write your SQL query.
51+
queryfile: query.sql`
5252
: "\n"
5353
}
5454
`.replace(/^\s*[\r\n]/gm, "");

src/providers/sidebar.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,16 +65,16 @@ export class SidebarProvider implements vscode.WebviewViewProvider {
6565
});
6666
}
6767
break;
68-
case "create-html-workflow":
68+
case "create-http-workflow":
6969
try {
7070
await vscode.commands.executeCommand(
7171
"flat.saveAndCommit",
7272
data.payload
7373
);
74-
webviewView.webview.postMessage({ command: "create-html-success" });
74+
webviewView.webview.postMessage({ command: "create-http-success" });
7575
} catch (e) {
7676
webviewView.webview.postMessage({
77-
command: "create-html-error",
77+
command: "create-http-error",
7878
payload: e,
7979
});
8080
}

src/webview/components/create-workflow.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ import React from "react";
22
import { BrowserRouter as Router, Switch, Route, Link } from "react-router-dom";
33

44
import { CreateSQLWorkflow } from "../pages/create-sql-workflow";
5-
import { CreateHTMLWorkflow } from "../pages/create-html-workflow";
6-
import { CreateHTMLSuccess } from "../pages/create-html-success";
5+
import { CreateHTTPWorkflow } from "../pages/create-http-workflow";
6+
import { CreateHTTPSuccess } from "../pages/create-http-success";
77
import { CreateSQLSuccess } from "../pages/create-sql-success";
88

99
function Home() {
@@ -15,7 +15,7 @@ function Home() {
1515
<p className="text-xs opacity-50">
1616
I can read the data I want from a URL
1717
</p>
18-
<Link className="btn btn-primary w-full" to="/html">
18+
<Link className="btn btn-primary w-full" to="/http">
1919
Create HTTP Action
2020
</Link>
2121
</div>
@@ -42,11 +42,11 @@ export function CreateWorkflow() {
4242
<CreateSQLSuccess />
4343
</Route>
4444
{/* TODO: Fix me to be HTTP */}
45-
<Route path="/html">
46-
<CreateHTMLWorkflow />
45+
<Route path="/http">
46+
<CreateHTTPWorkflow />
4747
</Route>
48-
<Route path="/html-success">
49-
<CreateHTMLSuccess />
48+
<Route path="/http-success">
49+
<CreateHTTPSuccess />
5050
</Route>
5151
<Route path="/">
5252
<Home />

src/webview/components/html-formik.js renamed to src/webview/components/http-formik.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,9 @@ function FormComponent({ status, isSubmitting }) {
7878
);
7979
}
8080

81-
export function HTMLFormik({ onSubmit, status }) {
81+
export function HTTPFormik({ onSubmit, status }) {
8282
if (status === "success") {
83-
return <Redirect to="/html-success" />;
83+
return <Redirect to="/http-success" />;
8484
} else {
8585
return (
8686
<Formik

src/webview/pages/create-html-success.js renamed to src/webview/pages/create-http-success.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React from "react";
22

3-
export function CreateHTMLSuccess() {
3+
export function CreateHTTPSuccess() {
44
return (
55
<div className="alert alert-success">
66
Created and committed flat.yml 🎊! Push to GitHub to trigger the action.

src/webview/pages/create-html-workflow.js renamed to src/webview/pages/create-http-workflow.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,16 @@ import React from "react";
22
import { Link } from "react-router-dom";
33
import { useEvent } from "react-use";
44

5-
import { HTMLFormik } from "../components/html-formik";
5+
import { HTTPFormik } from "../components/http-formik";
66
import { vscode } from "../lib";
77

8-
export function CreateHTMLWorkflow() {
8+
export function CreateHTTPWorkflow() {
99
const [status, setStatus] = React.useState("idle");
1010

1111
const handleMessage = (e) => {
1212
const message = e.data;
1313
switch (message.command) {
14-
case "create-html-success":
14+
case "create-http-success":
1515
setStatus("success");
1616
}
1717
};
@@ -20,7 +20,7 @@ export function CreateHTMLWorkflow() {
2020

2121
const handleSubmit = async (values) => {
2222
await vscode.postMessage({
23-
command: "create-html-workflow",
23+
command: "create-http-workflow",
2424
payload: values,
2525
});
2626

@@ -39,7 +39,7 @@ export function CreateHTMLWorkflow() {
3939
</div>
4040
</header>
4141
<div className="my-4">
42-
<HTMLFormik status={status} onSubmit={handleSubmit} />
42+
<HTTPFormik status={status} onSubmit={handleSubmit} />
4343
</div>
4444
</div>
4545
);

0 commit comments

Comments
 (0)