-
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.
Rewrite frontend using Vite and vanilla JavaScript
This commit rewrites the frontend using Vite and vanilla JavaScript. We were using an old version of Parcel that had more than 50 associated vulns, but moved to Vite instead since that's our standard build tool these days. - Use Goa client converted to es6 with amdtoes6. - Use Vite instead of Parcel to build the frontend. - Use NPM instead of Yarn to manage dependencies. - Rewrite the frontend using vanilla JavaScript instead of jQuery. - Embed assets from web/dist directly (root public dir is removed).
- Loading branch information
Showing
23 changed files
with
1,236 additions
and
6,648 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 |
---|---|---|
@@ -1,8 +1,3 @@ | ||
/dist | ||
/public/web | ||
/web/.cache | ||
/web/.parcel-cache | ||
/web/node_modules | ||
|
||
*.swp | ||
*.log |
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
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,25 @@ | ||
# Logs | ||
logs | ||
*.log | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
pnpm-debug.log* | ||
lerna-debug.log* | ||
|
||
node_modules | ||
dist | ||
dist/.keep | ||
dist-ssr | ||
*.local | ||
|
||
# Editor directories and files | ||
.vscode/* | ||
!.vscode/extensions.json | ||
.idea | ||
.DS_Store | ||
*.suo | ||
*.ntvs* | ||
*.njsproj | ||
*.sln | ||
*.sw? |
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 |
---|---|---|
@@ -1,8 +1,8 @@ | ||
package public | ||
package web | ||
|
||
import ( | ||
"embed" | ||
) | ||
|
||
//go:embed web/* | ||
//go:embed dist/* | ||
var Assets embed.FS |
File renamed without changes.
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,96 @@ | ||
// This module exports functions that give access to the amflow API hosted at localhost. | ||
// It uses the axios javascript library for making the actual HTTP requests. | ||
import axios from 'axios'; | ||
function merge(obj1, obj2) { | ||
var obj3 = {}; | ||
for (var attrname in obj1) { obj3[attrname] = obj1[attrname]; } | ||
for (var attrname in obj2) { obj3[attrname] = obj2[attrname]; } | ||
return obj3; | ||
} | ||
|
||
export default function (scheme, host, timeout) { | ||
scheme = scheme || 'http'; | ||
host = host || 'localhost'; | ||
timeout = timeout || 20000; | ||
|
||
// Client is the object returned by this module. | ||
var client = axios; | ||
|
||
// URL prefix for all API requests. | ||
var urlPrefix = scheme + '://' + host; | ||
|
||
// Add link | ||
// path is the request path, the format is "/workflow/:workflowID/links" | ||
// config is an optional object to be merged into the config built by the function prior to making the request. | ||
// The content of the config object is described here: https://github.com/mzabriskie/axios#request-api | ||
// This function returns a promise which raises an error if the HTTP response is a 4xx or 5xx. | ||
client.addLinkWorkflow = function (path, config) { | ||
var cfg = { | ||
timeout: timeout, | ||
url: urlPrefix + path, | ||
method: 'patch', | ||
responseType: 'json' | ||
}; | ||
if (config) { | ||
cfg = merge(cfg, config); | ||
} | ||
return client(cfg); | ||
} | ||
|
||
// Delete link | ||
// path is the request path, the format is "/workflow/:workflowID/links/:linkID" | ||
// config is an optional object to be merged into the config built by the function prior to making the request. | ||
// The content of the config object is described here: https://github.com/mzabriskie/axios#request-api | ||
// This function returns a promise which raises an error if the HTTP response is a 4xx or 5xx. | ||
client.deleteLinkWorkflow = function (path, config) { | ||
var cfg = { | ||
timeout: timeout, | ||
url: urlPrefix + path, | ||
method: 'delete', | ||
responseType: 'json' | ||
}; | ||
if (config) { | ||
cfg = merge(cfg, config); | ||
} | ||
return client(cfg); | ||
} | ||
|
||
// Move link | ||
// path is the request path, the format is "/workflow/:workflowID/links/:linkID" | ||
// config is an optional object to be merged into the config built by the function prior to making the request. | ||
// The content of the config object is described here: https://github.com/mzabriskie/axios#request-api | ||
// This function returns a promise which raises an error if the HTTP response is a 4xx or 5xx. | ||
client.moveLinkWorkflow = function (path, config) { | ||
var cfg = { | ||
timeout: timeout, | ||
url: urlPrefix + path, | ||
method: 'patch', | ||
responseType: 'json' | ||
}; | ||
if (config) { | ||
cfg = merge(cfg, config); | ||
} | ||
return client(cfg); | ||
} | ||
|
||
// Read workflow | ||
// path is the request path, the format is "/workflow/:workflowID" | ||
// config is an optional object to be merged into the config built by the function prior to making the request. | ||
// The content of the config object is described here: https://github.com/mzabriskie/axios#request-api | ||
// This function returns a promise which raises an error if the HTTP response is a 4xx or 5xx. | ||
client.showWorkflow = function (path, config) { | ||
var cfg = { | ||
timeout: timeout, | ||
url: urlPrefix + path, | ||
method: 'get', | ||
responseType: 'json' | ||
}; | ||
if (config) { | ||
cfg = merge(cfg, config); | ||
} | ||
return client(cfg); | ||
} | ||
return client; | ||
}; | ||
|
||
|
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,20 +1,12 @@ | ||
<!doctype html> | ||
<html> | ||
<head> | ||
<meta charset="utf-8"> | ||
<title>Test</title> | ||
<base href="/"> | ||
<script src="./js/app.js"></script> | ||
<link rel="stylesheet" type="text/css" href="./css/style.css"> | ||
</head> | ||
<body> | ||
<div class="wrapper"> | ||
<div class="box sidebar"> | ||
<button class="reload-btn">Reload</button> | ||
</div> | ||
<div class="box content"> | ||
<div class="viewport"></div> | ||
</div> | ||
</div> | ||
</body> | ||
</html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
<title>amflow</title> | ||
</head> | ||
<body> | ||
<div id="app"></div> | ||
<script type="module" src="/main.js"></script> | ||
</body> | ||
</html> |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.