Add basic view

This commit is contained in:
Adrian Woźniak 2020-03-30 14:26:25 +02:00
parent 2583bd1b9e
commit cddae87b00
59 changed files with 38443 additions and 83 deletions

6
.env
View File

@ -1,2 +1,8 @@
DATABASE_URL=postgres://postgres@localhost:5432/jirs
RUST_LOG=actix_web=info,diesel=info
JIRS_CLIENT_PORT=7000
JIRS_CLIENT_BIND=0.0.0.0
JIRS_SERVER_PORT=5000
JIRS_SERVER_BIND=0.0.0.0
NODE_ENV=development
DEBUG=true

33
Cargo.lock generated
View File

@ -13,7 +13,7 @@ dependencies = [
"bytes",
"crossbeam-channel",
"derive_more",
"futures",
"futures 0.3.4",
"lazy_static",
"log 0.4.8",
"parking_lot",
@ -52,7 +52,7 @@ dependencies = [
"actix-utils",
"derive_more",
"either",
"futures",
"futures 0.3.4",
"http",
"log 0.4.8",
"trust-dns-proto",
@ -68,7 +68,7 @@ dependencies = [
"actix-service",
"actix-web",
"derive_more",
"futures",
"futures 0.3.4",
]
[[package]]
@ -150,7 +150,7 @@ dependencies = [
"actix-macros",
"actix-threadpool",
"copyless",
"futures",
"futures 0.3.4",
"tokio",
]
@ -164,7 +164,7 @@ dependencies = [
"actix-rt",
"actix-service",
"actix-utils",
"futures",
"futures 0.3.4",
"log 0.4.8",
"mio",
"mio-uds",
@ -193,7 +193,7 @@ dependencies = [
"actix-rt",
"actix-server",
"actix-service",
"futures",
"futures 0.3.4",
"log 0.4.8",
"net2",
]
@ -225,7 +225,7 @@ dependencies = [
"actix-utils",
"derive_more",
"either",
"futures",
"futures 0.3.4",
"log 0.4.8",
]
@ -241,7 +241,7 @@ dependencies = [
"bitflags",
"bytes",
"either",
"futures",
"futures 0.3.4",
"log 0.4.8",
"pin-project",
"slab",
@ -269,7 +269,7 @@ dependencies = [
"bytes",
"derive_more",
"encoding_rs",
"futures",
"futures 0.3.4",
"fxhash",
"log 0.4.8",
"mime",
@ -752,6 +752,12 @@ version = "0.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3dcaa9ae7725d12cdb85b3ad99a434db70b468c09ded17e012d86b5c1010f7a7"
[[package]]
name = "futures"
version = "0.1.29"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1b980f2816d6ee8673b6517b52cb0e808a180efc92e5c19d02cdda79066703ef"
[[package]]
name = "futures"
version = "0.3.4"
@ -1033,6 +1039,7 @@ name = "jirs-client"
version = "0.1.0"
dependencies = [
"chrono",
"futures 0.1.29",
"jirs-data",
"js-sys",
"seed",
@ -1069,7 +1076,7 @@ dependencies = [
"diesel",
"dotenv",
"env_logger 0.7.1",
"futures",
"futures 0.3.4",
"ipnetwork",
"jirs-data",
"libc",
@ -1638,7 +1645,7 @@ dependencies = [
"cookie",
"dbg",
"enclose",
"futures",
"futures 0.3.4",
"gloo-timers",
"indexmap",
"js-sys",
@ -1858,7 +1865,7 @@ dependencies = [
"async-trait",
"enum-as-inner",
"failure",
"futures",
"futures 0.3.4",
"idna 0.2.0",
"lazy_static",
"log 0.4.8",
@ -1877,7 +1884,7 @@ checksum = "6f90b1502b226f8b2514c6d5b37bafa8c200d7ca4102d57dc36ee0f3b7a04a2f"
dependencies = [
"cfg-if",
"failure",
"futures",
"futures 0.3.4",
"ipconfig",
"lazy_static",
"log 0.4.8",

1
jirs-client/.env Symbolic link
View File

@ -0,0 +1 @@
../.env

View File

@ -17,5 +17,11 @@ serde_json = "*"
chrono = { version = "*", features = [ "serde" ] }
uuid = { version = "*", features = [ "serde" ] }
wasm-bindgen = "*"
web-sys = "*"
js-sys = "*"
futures = "^0.1.26"
[dependencies.web-sys]
version = "*"
features = [
"Window"
]

BIN
jirs-client/dev/favicon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 97 KiB

Binary file not shown.

Binary file not shown.

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 384 KiB

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

File diff suppressed because it is too large Load Diff

After

Width:  |  Height:  |  Size: 433 KiB

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

File diff suppressed because it is too large Load Diff

After

Width:  |  Height:  |  Size: 341 KiB

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

File diff suppressed because it is too large Load Diff

After

Width:  |  Height:  |  Size: 432 KiB

Binary file not shown.

Binary file not shown.

Binary file not shown.

42
jirs-client/dev/fonts/jira.svg Executable file

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 29 KiB

BIN
jirs-client/dev/fonts/jira.ttf Executable file

Binary file not shown.

BIN
jirs-client/dev/fonts/jira.woff Executable file

Binary file not shown.

View File

@ -0,0 +1 @@

View File

@ -0,0 +1,22 @@
:host, html, body {
width: 100%;
display: block;
height: 100%;
}
main {
width: 100%;
display: block;
min-height: 100%;
}
article#inner-layout {
width: 100%;
}
@media (min-width: 1240px) {
article#inner-layout {
display: flex;
justify-content: start;
}
}

View File

@ -0,0 +1,39 @@
@font-face {
font-family: 'CircularStdBlack';
src: url('/fonts/CircularStd-Black.woff2') format('woff2'),
url('/fonts/CircularStd-Black.woff') format('woff');
font-weight: normal;
font-style: normal;
}
@font-face {
font-family: 'CircularStdBold';
src: url('/fonts/CircularStd-Bold.woff2') format('woff2'),
url('/fonts/CircularStd-Bold.woff') format('woff');
font-weight: normal;
font-style: normal;
}
@font-face {
font-family: 'CircularStdMedium';
src: url('/fonts/CircularStd-Medium.woff2') format('woff2'),
url('/fonts/CircularStd-Medium.woff') format('woff');
font-weight: normal;
font-style: normal;
}
@font-face {
font-family: 'CircularStdBook';
src: url('/fonts/CircularStd-Book.woff2') format('woff2'),
url('/fonts/CircularStd-Book.woff') format('woff');
font-weight: normal;
font-style: normal;
}
@font-face {
font-family: 'jira';
src: url('/fonts/jira.woff') format('truetype'),
url('/fonts/jira.ttf') format('woff'), url('/fonts/jira.svg#jira') format('svg');
font-weight: normal;
font-style: normal;
}

View File

@ -0,0 +1,115 @@
html, body, #root {
height: 100%;
min-height: 100%;
min-width: 768px;
}
body {
font-weight: normal;
color: var(--textDark);
-webkit-tap-highlight-color: transparent;
line-height: 1.2;
font-size: 16px;
font-family: var(--font-regular);
}
#app {
display: flex;
flex-direction: column;
}
button,
input,
optgroup,
select,
textarea {
font-family: var(--font-regular);
font-weight: normal;
}
*, *:after, *:before, input[type="search"] {
box-sizing: border-box;
}
a {
color: inherit;
text-decoration: none;
}
ul {
list-style: none;
}
ul, li, ol, dd, h1, h2, h3, h4, h5, h6, p {
padding: 0;
margin: 0;
}
h1, h2, h3, h4, h5, h6, strong {
font-family: var(--font-bold);
}
button {
background: none;
border: none;
}
/* Workaround for IE11 focus highlighting for select elements */
select::-ms-value {
background: none;
color: #42413d;
}
[role="button"], button, input, select, textarea {
outline: none;
}
[role="button"]:disabled, button:disabled, input:disabled, select:disabled, textarea:disabled {
opacity: 1;
}
[role="button"], button, input, textarea {
appearance: none;
}
select:-moz-focusring {
color: transparent;
text-shadow: 0 0 0 #000;
}
select::-ms-expand {
display: none;
}
select option {
color: var(--textDark)
}
p {
line-height: 1.4285;
}
p a::-webkit-input-placeholder {
color: var(--textLight);
opacity: 1 !important;
}
p a:-moz-placeholder {
color: var(--textLight);
opacity: 1 !important;
}
p a::-moz-placeholder {
color: var(--textLight);
opacity: 1 !important;
}
p a:-ms-input-placeholder {
color: var(--textLight);
opacity: 1 !important;
}
textarea {
line-height: 1.4285;
}
body, select {
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
html {
touch-action: manipulation;
}

153
jirs-client/js/css/icon.css Normal file
View File

@ -0,0 +1,153 @@
i.styledIcon {
color: var(--primary);
display: inline-block;
font-size: 16px;
}
i.styledIcon.left {
transform: translate(0, 0);
}
i.styledIcon.top {
transform: translate(0, 0);
}
i.styledIcon:before {
font-family: "jira";
speak: none;
font-style: normal;
font-weight: normal;
font-variant: normal;
text-transform: none;
line-height: 1;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
i.styledIcon.bug:before {
content: "\e90f";
}
i.styledIcon.stopwatch:before {
content: "\e914";
}
i.styledIcon.task:before {
content: "\e910";
}
i.styledIcon.story:before {
content: "\e911";
}
i.styledIcon.arrowDown:before {
content: "\e90a";
}
i.styledIcon.arrowLeftCircle:before {
content: "\e917";
}
i.styledIcon.arrowUp:before {
content: "\e90b";
}
i.styledIcon.chevronDown:before {
content: "\e900";
}
i.styledIcon.chevronLeft:before {
content: "\e901";
}
i.styledIcon.chevronRight:before {
content: "\e902";
}
i.styledIcon.chevronUp:before {
content: "\e903";
}
i.styledIcon.board:before {
content: "\e904";
}
i.styledIcon.help:before {
content: "\e905";
}
i.styledIcon.link:before {
content: "\e90c";
}
i.styledIcon.menu:before {
content: "\e916";
}
i.styledIcon.more:before {
content: "\e90e";
}
i.styledIcon.attach:before {
content: "\e90d";
}
i.styledIcon.plus:before {
content: "\e906";
}
i.styledIcon.search:before {
content: "\e907";
}
i.styledIcon.issues:before {
content: "\e908";
}
i.styledIcon.settings:before {
content: "\e909";
}
i.styledIcon.close:before {
content: "\e913";
}
i.styledIcon.feedback:before {
content: "\e918";
}
i.styledIcon.trash:before {
content: "\e912";
}
i.styledIcon.github:before {
content: "\e915";
}
i.styledIcon.shipping:before {
content: "\e91c";
}
i.styledIcon.component:before {
content: "\e91a";
}
i.styledIcon.reports:before {
content: "\e91b";
}
i.styledIcon.page:before {
content: "\e919";
}
i.styledIcon.calendar:before {
content: "\e91d";
}
i.styledIcon.arrowLeft:before {
content: "\e91e";
}
i.styledIcon.arrowRight:before {
content: "\e91f";
}

349
jirs-client/js/css/normalize.css vendored Normal file
View File

@ -0,0 +1,349 @@
/*! normalize.css v8.0.1 | MIT License | github.com/necolas/normalize.css */
/* Document
========================================================================== */
/**
* 1. Correct the line height in all browsers.
* 2. Prevent adjustments of font size after orientation changes in iOS.
*/
html {
line-height: 1.15; /* 1 */
-webkit-text-size-adjust: 100%; /* 2 */
}
/* Sections
========================================================================== */
/**
* Remove the margin in all browsers.
*/
body {
margin: 0;
}
/**
* Render the `main` element consistently in IE.
*/
main {
display: block;
}
/**
* Correct the font size and margin on `h1` elements within `section` and
* `article` contexts in Chrome, Firefox, and Safari.
*/
h1 {
font-size: 2em;
margin: 0.67em 0;
}
/* Grouping content
========================================================================== */
/**
* 1. Add the correct box sizing in Firefox.
* 2. Show the overflow in Edge and IE.
*/
hr {
box-sizing: content-box; /* 1 */
height: 0; /* 1 */
overflow: visible; /* 2 */
}
/**
* 1. Correct the inheritance and scaling of font size in all browsers.
* 2. Correct the odd `em` font sizing in all browsers.
*/
pre {
font-family: monospace, monospace; /* 1 */
font-size: 1em; /* 2 */
}
/* Text-level semantics
========================================================================== */
/**
* Remove the gray background on active links in IE 10.
*/
a {
background-color: transparent;
}
/**
* 1. Remove the bottom border in Chrome 57-
* 2. Add the correct text decoration in Chrome, Edge, IE, Opera, and Safari.
*/
abbr[title] {
border-bottom: none; /* 1 */
text-decoration: underline; /* 2 */
text-decoration: underline dotted; /* 2 */
}
/**
* Add the correct font weight in Chrome, Edge, and Safari.
*/
b,
strong {
font-weight: bolder;
}
/**
* 1. Correct the inheritance and scaling of font size in all browsers.
* 2. Correct the odd `em` font sizing in all browsers.
*/
code,
kbd,
samp {
font-family: monospace, monospace; /* 1 */
font-size: 1em; /* 2 */
}
/**
* Add the correct font size in all browsers.
*/
small {
font-size: 80%;
}
/**
* Prevent `sub` and `sup` elements from affecting the line height in
* all browsers.
*/
sub,
sup {
font-size: 75%;
line-height: 0;
position: relative;
vertical-align: baseline;
}
sub {
bottom: -0.25em;
}
sup {
top: -0.5em;
}
/* Embedded content
========================================================================== */
/**
* Remove the border on images inside links in IE 10.
*/
img {
border-style: none;
}
/* Forms
========================================================================== */
/**
* 1. Change the font styles in all browsers.
* 2. Remove the margin in Firefox and Safari.
*/
button,
input,
optgroup,
select,
textarea {
font-family: inherit; /* 1 */
font-size: 100%; /* 1 */
line-height: 1.15; /* 1 */
margin: 0; /* 2 */
}
/**
* Show the overflow in IE.
* 1. Show the overflow in Edge.
*/
button,
input { /* 1 */
overflow: visible;
}
/**
* Remove the inheritance of text transform in Edge, Firefox, and IE.
* 1. Remove the inheritance of text transform in Firefox.
*/
button,
select { /* 1 */
text-transform: none;
}
/**
* Correct the inability to style clickable types in iOS and Safari.
*/
button,
[type="button"],
[type="reset"],
[type="submit"] {
-webkit-appearance: button;
}
/**
* Remove the inner border and padding in Firefox.
*/
button::-moz-focus-inner,
[type="button"]::-moz-focus-inner,
[type="reset"]::-moz-focus-inner,
[type="submit"]::-moz-focus-inner {
border-style: none;
padding: 0;
}
/**
* Restore the focus styles unset by the previous rule.
*/
button:-moz-focusring,
[type="button"]:-moz-focusring,
[type="reset"]:-moz-focusring,
[type="submit"]:-moz-focusring {
outline: 1px dotted ButtonText;
}
/**
* Correct the padding in Firefox.
*/
fieldset {
padding: 0.35em 0.75em 0.625em;
}
/**
* 1. Correct the text wrapping in Edge and IE.
* 2. Correct the color inheritance from `fieldset` elements in IE.
* 3. Remove the padding so developers are not caught out when they zero out
* `fieldset` elements in all browsers.
*/
legend {
box-sizing: border-box; /* 1 */
color: inherit; /* 2 */
display: table; /* 1 */
max-width: 100%; /* 1 */
padding: 0; /* 3 */
white-space: normal; /* 1 */
}
/**
* Add the correct vertical alignment in Chrome, Firefox, and Opera.
*/
progress {
vertical-align: baseline;
}
/**
* Remove the default vertical scrollbar in IE 10+.
*/
textarea {
overflow: auto;
}
/**
* 1. Add the correct box sizing in IE 10.
* 2. Remove the padding in IE 10.
*/
[type="checkbox"],
[type="radio"] {
box-sizing: border-box; /* 1 */
padding: 0; /* 2 */
}
/**
* Correct the cursor style of increment and decrement buttons in Chrome.
*/
[type="number"]::-webkit-inner-spin-button,
[type="number"]::-webkit-outer-spin-button {
height: auto;
}
/**
* 1. Correct the odd appearance in Chrome and Safari.
* 2. Correct the outline style in Safari.
*/
[type="search"] {
-webkit-appearance: textfield; /* 1 */
outline-offset: -2px; /* 2 */
}
/**
* Remove the inner padding in Chrome and Safari on macOS.
*/
[type="search"]::-webkit-search-decoration {
-webkit-appearance: none;
}
/**
* 1. Correct the inability to style clickable types in iOS and Safari.
* 2. Change font properties to `inherit` in Safari.
*/
::-webkit-file-upload-button {
-webkit-appearance: button; /* 1 */
font: inherit; /* 2 */
}
/* Interactive
========================================================================== */
/*
* Add the correct display in Edge, IE 10+, and Firefox.
*/
details {
display: block;
}
/*
* Add the correct display in all browsers.
*/
summary {
display: list-item;
}
/* Misc
========================================================================== */
/**
* Add the correct display in IE 10+.
*/
template {
display: none;
}
/**
* Add the correct display in IE 10.
*/
[hidden] {
display: none;
}

View File

@ -0,0 +1,5 @@
.divider {
margin-top: 17px;
padding-top: 18px;
border-top: 1px solid var(--borderLight);
}

View File

@ -0,0 +1,91 @@
nav#sidebar {
position: fixed;
z-index: calc(var(--navLeft) - 1);
top: 0;
left: var(--appNavBarLeftWidth);
height: 100vh;
width: var(--secondarySideBarWidth);
padding: 0 16px 24px;
background: var(--backgroundLightest);
border-right: 1px solid var(--borderLightest);
overflow-x: hidden;
overflow-y: auto;
-webkit-overflow-scrolling: touch;
}
nav#sidebar::-webkit-scrollbar {
width: 8px;
}
nav#sidebar::-webkit-scrollbar-track {
background: none;
}
nav#sidebar::-webkit-scrollbar-thumb {
border-radius: 99px;
background: var(--backgroundMedium);
}
@media (max-width: 1100px) {
nav#sidebar {
width: calc(var(--secondarySideBarWidth) - 10px);
}
}
@media (max-width: 999px) {
nav#sidebar {
display: none;
}
}
nav#sidebar #projectInfo {
display: flex;
padding: 24px 4px;
}
nav#sidebar #projectInfo > .projectTexts {
padding: 3px 0 0 10px;
}
nav#sidebar #projectInfo > .projectTexts > .projectName {
color: var(--textDark);
font-size: 15px;
font-family: var(--font-medium);
}
nav#sidebar #projectInfo > .projectTexts > .projectCategory {
color: var(--textMedium);
font-size: 13px;
}
nav#sidebar .linkItem {
position: relative;
display: flex;
padding: 8px 12px;
border-radius: 3px;
cursor: pointer;
user-select: none;
}
nav#sidebar .linkItem.notAllowed {
cursor: not-allowed;
}
nav#sidebar .linkItem:hover {
background: var(--backgroundLight);
}
nav#sidebar .linkItem > i.styledIcon {
margin-right: 15px;
font-size: 20px;
}
nav#sidebar .linkItem.active {
color: var(--primary);
background: var(--backgroundLight);
}
nav#sidebar .linkItem > .linkText {
padding-top: 2px;
font-size: 14.7px;
}

View File

@ -0,0 +1,65 @@
:root {
--primary: #0052cc; /* Blue */
--success: #0B875B; /* green */
--danger: #E13C3C; /* red */
--warning: #F89C1C; /* orange */
--secondary: #F4F5F7; /* light grey */
--textDarkest: #172b4d;
--textDark: #42526E;
--textMedium: #5E6C84;
--textLight: #8993a4;
--textLink: #0052cc;
--backgroundDarkPrimary: #0747A6;
--backgroundMedium: #dfe1e6;
--backgroundLight: #ebecf0;
--backgroundLightest: #F4F5F7;
--backgroundLightPrimary: #D2E5FE;
--backgroundLightSuccess: #E4FCEF;
--borderLightest: #dfe1e6;
--borderLight: #C1C7D0;
--borderInputFocus: #4c9aff;
}
:root {
--task: #4FADE6; /* blue */
--bug: #E44D42; /* red */
--story: #65BA43; /* green */
}
:root {
--highest: #CD1317; /* red */
--high: #E9494A; /* orange */
--medium: #E97F33; /* orange */
--low: #2D8738; /* green */
--lowest: #57A55A; /* green */
}
:root {
--issue-color-backlog: var(--textDark);
--issue-color-inprogress: #fff;
--issue-color-selected: var(--textDark);
--issue-color-done: #fff;
--issue-background-backlog: var(--backgroundMedium);
--issue-background-inprogress: var(--primary);
--issue-background-selected: var(--backgroundMedium);
--issue-background-done: var(--success);
}
:root /* sizes */ {
--appNavBarLeftWidth: 64;
--secondarySideBarWidth: 230;
--minViewportWidth: 1000;
}
:root /* z-index */ {
--modal: 20;
--dropdown: 11;
--navLeft: 10;
}
:root /* font */ {
--font-regular: "CircularStdBook";
--font-medium: "CircularStdMedium";
--font-bold: "CircularStdBold";
--font-black: "CircularStdBlack";
}

View File

@ -1,4 +1,7 @@
import "./styles.css";
import("../pkg/index.js").then(module => {
console.log(module)
// module.main();
const host_url = `${location.protocol}//${process.env.JIRS_SERVER_BIND}:${process.env.JIRS_SERVER_PORT}`;
module.set_host_url(host_url);
module.render();
});

View File

@ -0,0 +1,8 @@
@import "css/normalize.css";
@import "css/fonts.css";
@import "css/variables.css";
@import "css/global.css";
@import "css/sidebar.css";
@import "css/icon.css";
@import "css/shared.css";
@import "css/app.css";

View File

@ -3,10 +3,8 @@
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="icon" href="/favicon.png">
<title>JIRS</title>
<link href="/styles.css" rel="stylesheet">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/todomvc-common@1.0.5/base.css"/ >
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/todomvc-app-css@2.1.2/index.css" />
</head>
<body>
<main id="app"></main>

View File

@ -2,10 +2,16 @@
"devDependencies": {
"@swc/core": "^1.1.37",
"@wasm-tool/wasm-pack-plugin": "^1.2.0",
"css-loader": "^3.4.2",
"dotenv": "^8.2.0",
"html-webpack-plugin": "^4.0.3",
"style-loader": "^1.1.3",
"swc-loader": "^0.1.8",
"webpack": "^4.42.1",
"webpack-cli": "^3.3.11",
"webpack-dev-server": "^3.10.3"
},
"scripts": {
"start": "webpack-dev-server"
}
}

16
jirs-client/src/api.rs Normal file
View File

@ -0,0 +1,16 @@
use crate::shared::host_client;
use crate::Msg;
pub async fn fetch_current_project(host_url: String) -> Result<Msg, Msg> {
match host_client(host_url, "/project") {
Ok(client) => client.fetch_string(Msg::CurrentProjectResult).await,
Err(e) => Err(Msg::InternalFailure(e)),
}
}
pub async fn fetch_current_user(host_url: String) -> Result<Msg, Msg> {
match host_client(host_url, "/currentUser") {
Ok(client) => client.fetch_string(Msg::CurrentUserResult).await,
Err(e) => Err(Msg::InternalFailure(e)),
}
}

View File

@ -1,45 +1,78 @@
use crate::model::Page;
use seed::fetch::FetchObject;
use seed::{prelude::*, *};
mod api;
mod login;
mod model;
mod project;
mod project_settings;
mod register;
mod shared;
type Model = i32;
enum Msg {
Increment,
ChangeGuidePage(i32),
ChangePage(i32),
#[derive(Clone, Debug)]
pub enum Msg {
ChangePage(model::Page),
CurrentProjectResult(FetchObject<String>),
CurrentUserResult(FetchObject<String>),
InternalFailure(String),
}
fn update(msg: Msg, model: &mut Model, _: &mut impl Orders<Msg>) {
fn update(msg: Msg, model: &mut model::Model, orders: &mut impl Orders<Msg>) {
if cfg!(debug_assertions) {
log!(msg);
}
match msg {
Msg::Increment => *model += 1,
Msg::ChangePage(page) => {
model.page = page;
}
_ => (),
}
crate::shared::update(&msg, model, orders);
match model.page {
Page::Project => project::update(msg, model, orders),
Page::ProjectSettings => project_settings::update(msg, model, orders),
Page::Login => login::update(msg, model, orders),
Page::Register => register::update(msg, model, orders),
}
if cfg!(debug_assertions) {
log!(model);
}
}
fn view(model: &Model) -> Node<Msg> {
div![
"This is a counter: ",
class!["counter"],
button![model.to_string(), ev(Ev::Click, |_| Msg::Increment),],
]
fn view(model: &model::Model) -> Node<Msg> {
match model.page {
Page::Project => project::view(model),
Page::ProjectSettings => project_settings::view(model),
Page::Login => login::view(model),
Page::Register => register::view(model),
}
}
fn routes(url: Url) -> Option<Msg> {
if url.path.is_empty() {
return Some(Msg::ChangePage(0));
return Some(Msg::ChangePage(model::Page::Project));
}
match url.path[0].as_ref() {
"guide" => match url.path.get(1).as_ref() {
Some(page) => Some(Msg::ChangeGuidePage(page.parse::<usize>().unwrap())),
None => Some(Msg::ChangePage(0)),
},
"changelog" => Some(Msg::ChangePage(1)),
_ => Some(Msg::ChangePage(0)),
"board" => Some(Msg::ChangePage(model::Page::Project)),
"project-settings" => Some(Msg::ChangePage(model::Page::ProjectSettings)),
"login" => Some(Msg::ChangePage(model::Page::Login)),
"register" => Some(Msg::ChangePage(model::Page::Register)),
_ => Some(Msg::ChangePage(model::Page::Project)),
}
}
#[wasm_bindgen(start)]
pub static mut HOST_URL: String = String::new();
#[wasm_bindgen]
pub fn set_host_url(url: String) {
unsafe {
HOST_URL = url;
}
}
#[wasm_bindgen]
pub fn render() {
App::builder(update, view).routes(routes).build_and_start();
}

8
jirs-client/src/login.rs Normal file
View File

@ -0,0 +1,8 @@
use crate::{model, Msg};
use seed::{prelude::*, *};
pub fn update(_msg: Msg, _model: &mut model::Model, _orders: &mut impl Orders<Msg>) {}
pub fn view(_model: &model::Model) -> Node<Msg> {
div![]
}

View File

@ -3,40 +3,53 @@ use std::collections::hash_map::HashMap;
use serde::{Deserialize, Serialize};
use uuid::Uuid;
use crate::HOST_URL;
use jirs_data::*;
type ProjectId = i32;
pub type ProjectId = i32;
pub type StatusCode = u32;
#[derive(Serialize, Deserialize)]
#[derive(Serialize, Deserialize, Copy, Clone, Debug)]
pub enum Page {
Project,
ProjectSettings,
Login,
Register,
}
#[derive(Serialize, Deserialize, Debug)]
pub struct CreateCommentForm {
fields: CreateCommentPayload,
pub fields: CreateCommentPayload,
}
#[derive(Serialize, Deserialize)]
#[derive(Serialize, Deserialize, Debug)]
pub struct CreateIssueForm {
fields: CreateIssuePayload,
pub fields: CreateIssuePayload,
}
#[derive(Serialize, Deserialize)]
#[derive(Serialize, Deserialize, Debug)]
pub struct UpdateProjectForm {
id: ProjectId,
fields: UpdateProjectPayload,
pub id: ProjectId,
pub fields: UpdateProjectPayload,
}
#[derive(Serialize, Deserialize)]
#[derive(Serialize, Deserialize, Debug)]
pub struct Model {
access_token: Option<Uuid>,
user: Option<User>,
project: Option<Project>,
project_form: Option<UpdateProjectForm>,
issue_form: Option<CreateIssueForm>,
comment_form: Option<CreateCommentForm>,
issues: Vec<Issue>,
comments_by_project_id: HashMap<ProjectId, Vec<Comment>>,
pub access_token: Option<Uuid>,
pub user: Option<User>,
pub project: Option<FullProject>,
pub project_form: Option<UpdateProjectForm>,
pub issue_form: Option<CreateIssueForm>,
pub comment_form: Option<CreateCommentForm>,
pub issues: Vec<Issue>,
pub comments_by_project_id: HashMap<ProjectId, Vec<Comment>>,
pub page: Page,
pub host_url: String,
}
impl Default for Model {
fn default() -> Self {
let host_url = unsafe { HOST_URL.clone() };
Self {
access_token: None,
project: None,
@ -46,6 +59,84 @@ impl Default for Model {
comment_form: None,
issues: vec![],
comments_by_project_id: Default::default(),
page: Page::Project,
host_url,
}
}
}
#[derive(Copy, Clone, Debug)]
pub enum Icon {
Bug,
Stopwatch,
Task,
Story,
ArrowDown,
ArrowLeftCircle,
ArrowUp,
ChevronDown,
ChevronLeft,
ChevronRight,
ChevronUp,
Board,
Help,
Link,
Menu,
More,
Attach,
Plus,
Search,
Issues,
Settings,
Close,
Feedback,
Trash,
Github,
Shipping,
Component,
Reports,
Page,
Calendar,
ArrowLeft,
ArrowRight,
}
impl std::fmt::Display for Icon {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
let code = match self {
Icon::Bug => "bug",
Icon::Stopwatch => "stopwatch",
Icon::Task => "task",
Icon::Story => "story",
Icon::ArrowDown => "arrowDown",
Icon::ArrowLeftCircle => "arrowLeftCircle",
Icon::ArrowUp => "arrowUp",
Icon::ChevronDown => "chevronDown",
Icon::ChevronLeft => "chevronLeft",
Icon::ChevronRight => "chevronRight",
Icon::ChevronUp => "chevronUp",
Icon::Board => "board",
Icon::Help => "help",
Icon::Link => "link",
Icon::Menu => "menu",
Icon::More => "more",
Icon::Attach => "attach",
Icon::Plus => "plus",
Icon::Search => "search",
Icon::Issues => "issues",
Icon::Settings => "settings",
Icon::Close => "close",
Icon::Feedback => "feedback",
Icon::Trash => "trash",
Icon::Github => "github",
Icon::Shipping => "shipping",
Icon::Component => "component",
Icon::Reports => "reports",
Icon::Page => "page",
Icon::Calendar => "calendar",
Icon::ArrowLeft => "arrowLeft",
Icon::ArrowRight => "arrowRight",
};
f.write_str(code)
}
}

View File

@ -0,0 +1,24 @@
use crate::model::Page;
use crate::shared::{host_client, inner_layout};
use crate::Msg;
use seed::{prelude::*, *};
pub fn update(msg: Msg, model: &mut crate::model::Model, orders: &mut impl Orders<Msg>) {
match msg {
Msg::ChangePage(Page::Project) => {
orders
.skip()
.perform_cmd(crate::api::fetch_current_project(model.host_url.clone()));
orders
.skip()
.perform_cmd(crate::api::fetch_current_user(model.host_url.clone()));
}
_ => (),
}
}
pub fn view(model: &crate::model::Model) -> Node<Msg> {
let project_section = section![id!["project-section"],];
inner_layout(model, project_section)
}

View File

@ -0,0 +1,11 @@
use crate::shared::inner_layout;
use crate::{model, Msg};
use seed::{prelude::*, *};
pub fn update(_msg: Msg, _model: &mut model::Model, _orders: &mut impl Orders<Msg>) {}
pub fn view(model: &model::Model) -> Node<Msg> {
let project_section = section![id!["project-settings-section"],];
inner_layout(model, project_section)
}

View File

@ -0,0 +1,8 @@
use crate::{model, Msg};
use seed::{prelude::*, *};
pub fn update(_msg: Msg, _model: &mut model::Model, _orders: &mut impl Orders<Msg>) {}
pub fn view(_model: &model::Model) -> Node<Msg> {
div![]
}

112
jirs-client/src/shared.rs Normal file
View File

@ -0,0 +1,112 @@
use crate::model::{Icon, Model};
use crate::Msg;
use jirs_data::FullProjectResponse;
use seed::fetch::{FetchObject, FetchResult, ResponseWithDataResult};
use seed::{prelude::*, *};
use serde::Deserialize;
pub fn sidebar(model: &Model) -> Node<Msg> {
let project_info = match model.project.as_ref() {
Some(project) => li![
id!["projectInfo"],
div![
attrs![At::Class => ".projectTexts";],
div![attrs![At::Class => ".projectName";], project.name],
div![attrs![At::Class => ".projectCategory";], project.category]
],
],
_ => li![
id!["projectInfo"],
div![
attrs![At::Class => ".projectTexts";],
div![attrs![At::Class => ".projectName";], ""],
div![attrs![At::Class => ".projectCategory";], ""]
],
],
};
nav![
id!["sidebar"],
ul![
project_info,
sidebar_link_item(model, "Kanban Board", Icon::Board, "/board"),
sidebar_link_item(
model,
"Project settings",
Icon::Settings,
"/project-settings"
),
li![divider()]
]
]
}
fn sidebar_link_item(_model: &Model, name: &str, icon: Icon, path: &str) -> Node<Msg> {
let item_class = match path {
"" => format!("linkItem notAllowed {}", icon),
_ => format!("linkItem {}", icon),
};
li![
attrs![At::Class => item_class],
a![
attrs![At::Href => path],
i![attrs![At::Class => format!("styledIcon {}", icon)], ""],
div![attrs![At::Class => "linkText"], name],
]
]
}
pub fn divider() -> Node<Msg> {
div![attrs![At::Class => "divider"], ""]
}
pub fn inner_layout(model: &Model, children: Node<Msg>) -> Node<Msg> {
article![id!["inner-layout"], sidebar(model), children,]
}
pub fn host_client(host_url: String, path: &str) -> Result<Request, String> {
let url = format!("{}{}", host_url, path);
let w = window();
let store = match w.local_storage() {
Ok(Some(store)) => store,
_ => return Err("Local storage is not available".to_string()),
};
let token = match store.get_item("authToken") {
Ok(Some(s)) => s,
_ => "".to_string(),
};
Ok(Request::new(url).header("Authorization", format!("Bearer {}", token).as_str()))
}
pub fn update(msg: &Msg, model: &mut crate::model::Model, _orders: &mut impl Orders<Msg>) {
match msg {
Msg::CurrentProjectResult(FetchObject {
result:
Ok(ResponseWithDataResult {
data: Ok(body),
status,
..
}),
..
}) if status.is_ok() => match serde_json::from_str::<'_, FullProjectResponse>(body) {
Ok(project_response) => {
model.project = Some(project_response.project);
}
_ => (),
},
Msg::CurrentUserResult(FetchObject {
result:
Ok(ResponseWithDataResult {
data: Ok(body),
status,
..
}),
..
}) if status.is_ok() => match serde_json::from_str::<'_, jirs_data::User>(body) {
Ok(user) => {
model.user = Some(user);
}
_ => (),
},
_ => (),
}
}

View File

@ -1,37 +1,55 @@
const path = require("path");
const WasmPackPlugin = require("@wasm-tool/wasm-pack-plugin");
const HtmlWebpackPlugin = require('html-webpack-plugin');
const dotenv = require('dotenv');
const webpack = require('webpack');
dotenv.config();
module.exports = {
entry: path.resolve(__dirname, 'js', 'index.js'),
output: {
filename: '[name].js',
path: path.resolve(__dirname, 'dev'),
entry: path.resolve(__dirname, 'js', 'index.js'),
output: {
filename: '[name].js',
path: path.resolve(__dirname, 'dev'),
publicPath: '/',
},
devtool: 'source-map',
devtool: 'source-map',
devServer: {
contentBase: path.join(__dirname, 'dev'),
contentBase: path.join(__dirname, 'dev'),
historyApiFallback: true,
hot: true,
port: 4000,
host: '0.0.0.0',
allowedHosts: [
'localhost:4000',
hot: true,
port: process.env.JIRS_CLIENT_PORT || 6000,
host: process.env.JIRS_CLIENT_BIND || '0.0.0.0',
allowedHosts: [
'localhost:6000',
'localhost:8000',
],
headers: {
headers: {
'Access-Control-Allow-Origin': '*',
}
},
plugins: [
module: {
rules: [
{
test: /\.css$/i,
use: ['style-loader', 'css-loader'],
},
],
},
plugins: [
new WasmPackPlugin({
crateDirectory: path.resolve(__dirname),
args: "--log-level warn",
extraArgs: "--no-typescript",
}),
new HtmlWebpackPlugin({
template: path.resolve(__dirname, "js", "template.ejs"),
}),
new webpack.EnvironmentPlugin([
'NODE_ENV',
'DEBUG',
'JIRS_CLIENT_PORT',
'JIRS_CLIENT_BIND',
'JIRS_SERVER_PORT',
'JIRS_SERVER_BIND',
]),
]
};

View File

@ -271,7 +271,7 @@ ajv-keywords@^3.1.0, ajv-keywords@^3.4.1:
resolved "https://registry.yarnpkg.com/ajv-keywords/-/ajv-keywords-3.4.1.tgz#ef916e271c64ac12171fd8384eaae6b2345854da"
integrity sha512-RO1ibKvd27e6FEShVFfPALuHI3WjSVNeK5FIsmme/LYRNxjKuNj+Dt7bucLa6NdSv3JcVTyMlm9kGR84z1XpaQ==
ajv@^6.1.0, ajv@^6.10.2:
ajv@^6.1.0, ajv@^6.10.2, ajv@^6.12.0:
version "6.12.0"
resolved "https://registry.yarnpkg.com/ajv/-/ajv-6.12.0.tgz#06d60b96d87b8454a5adaba86e7854da629db4b7"
integrity sha512-D6gFiFA0RRLyUbvijN74DWAjXSFxWKaWP7mldxkVhyhAV3+SWA9HEJPHQ2c9soIeTFJqcSdFDGFgdqs1iUU2Hw==
@ -671,12 +671,12 @@ camel-case@^4.1.1:
pascal-case "^3.1.1"
tslib "^1.10.0"
camelcase@^5.0.0:
camelcase@^5.0.0, camelcase@^5.3.1:
version "5.3.1"
resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-5.3.1.tgz#e3c9b31569e106811df242f715725a1f4c494320"
integrity sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==
chalk@2.4.2, chalk@^2.4.1:
chalk@2.4.2, chalk@^2.4.1, chalk@^2.4.2:
version "2.4.2"
resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.4.2.tgz#cd42541677a54333cf541a49108c1432b44c9424"
integrity sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==
@ -962,6 +962,24 @@ crypto-browserify@^3.11.0:
randombytes "^2.0.0"
randomfill "^1.0.3"
css-loader@^3.4.2:
version "3.4.2"
resolved "https://registry.yarnpkg.com/css-loader/-/css-loader-3.4.2.tgz#d3fdb3358b43f233b78501c5ed7b1c6da6133202"
integrity sha512-jYq4zdZT0oS0Iykt+fqnzVLRIeiPWhka+7BqPn+oSIpWJAHak5tmB/WZrJ2a21JhCeFyNnnlroSl8c+MtVndzA==
dependencies:
camelcase "^5.3.1"
cssesc "^3.0.0"
icss-utils "^4.1.1"
loader-utils "^1.2.3"
normalize-path "^3.0.0"
postcss "^7.0.23"
postcss-modules-extract-imports "^2.0.0"
postcss-modules-local-by-default "^3.0.2"
postcss-modules-scope "^2.1.1"
postcss-modules-values "^3.0.0"
postcss-value-parser "^4.0.2"
schema-utils "^2.6.0"
css-select@^1.1.0:
version "1.2.0"
resolved "https://registry.yarnpkg.com/css-select/-/css-select-1.2.0.tgz#2b3a110539c5355f1cd8d314623e870b121ec858"
@ -977,6 +995,11 @@ css-what@2.1:
resolved "https://registry.yarnpkg.com/css-what/-/css-what-2.1.3.tgz#a6d7604573365fe74686c3f311c56513d88285f2"
integrity sha512-a+EPoD+uZiNfh+5fxw2nO9QwFa6nJe2Or35fGY6Ipw1R3R4AGz1d1TEZrCegvw2YTmZ0jXirGYlzxxpYSHwpEg==
cssesc@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/cssesc/-/cssesc-3.0.0.tgz#37741919903b868565e1c09ea747445cd18983ee"
integrity sha512-/Tb/JcjK111nNScGob5MNtsntNM1aCNUDipB/TkwZFhyDrrE47SOx/18wF2bbjgc3ZzCSKW1T5nt5EbFoAz/Vg==
cyclist@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/cyclist/-/cyclist-1.0.1.tgz#596e9698fd0c80e12038c2b82d6eb1b35b6224d9"
@ -1193,6 +1216,11 @@ dot-case@^3.0.3:
no-case "^3.0.3"
tslib "^1.10.0"
dotenv@^8.2.0:
version "8.2.0"
resolved "https://registry.yarnpkg.com/dotenv/-/dotenv-8.2.0.tgz#97e619259ada750eea3e4ea3e26bceea5424b16a"
integrity sha512-8sJ78ElpbDJBHNeBzUbUVLsqKdccaa/BXF1uPTw3GrvQTBgrQrtObr2mUrE38vzYd8cEv+m/JBfDLioYcfXoaw==
duplexify@^3.4.2, duplexify@^3.6.0:
version "3.7.1"
resolved "https://registry.yarnpkg.com/duplexify/-/duplexify-3.7.1.tgz#2a4df5317f6ccfd91f86d6fd25d8d8a103b88309"
@ -1935,6 +1963,13 @@ iconv-lite@0.4.24:
dependencies:
safer-buffer ">= 2.1.2 < 3"
icss-utils@^4.0.0, icss-utils@^4.1.1:
version "4.1.1"
resolved "https://registry.yarnpkg.com/icss-utils/-/icss-utils-4.1.1.tgz#21170b53789ee27447c2f47dd683081403f9a467"
integrity sha512-4aFq7wvWyMHKgxsH8QQtGpvbASCf+eM3wPRLI6R+MgAnTCZ6STYsRvttLvRWK0Nfif5piF394St3HeJDaljGPA==
dependencies:
postcss "^7.0.14"
ieee754@^1.1.4:
version "1.1.13"
resolved "https://registry.yarnpkg.com/ieee754/-/ieee754-1.1.13.tgz#ec168558e95aa181fd87d37f55c32bbcb6708b84"
@ -1958,6 +1993,11 @@ imurmurhash@^0.1.4:
resolved "https://registry.yarnpkg.com/imurmurhash/-/imurmurhash-0.1.4.tgz#9218b9b2b928a238b13dc4fb6b6d576f231453ea"
integrity sha1-khi5srkoojixPcT7a21XbyMUU+o=
indexes-of@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/indexes-of/-/indexes-of-1.0.1.tgz#f30f716c8e2bd346c7b67d3df3915566a7c05607"
integrity sha1-8w9xbI4r00bHtn0985FVZqfAVgc=
infer-owner@^1.0.3:
version "1.0.4"
resolved "https://registry.yarnpkg.com/infer-owner/-/infer-owner-1.0.4.tgz#c4cefcaa8e51051c2a40ba2ce8a3d27295af9467"
@ -2985,6 +3025,62 @@ posix-character-classes@^0.1.0:
resolved "https://registry.yarnpkg.com/posix-character-classes/-/posix-character-classes-0.1.1.tgz#01eac0fe3b5af71a2a6c02feabb8c1fef7e00eab"
integrity sha1-AerA/jta9xoqbAL+q7jB/vfgDqs=
postcss-modules-extract-imports@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/postcss-modules-extract-imports/-/postcss-modules-extract-imports-2.0.0.tgz#818719a1ae1da325f9832446b01136eeb493cd7e"
integrity sha512-LaYLDNS4SG8Q5WAWqIJgdHPJrDDr/Lv775rMBFUbgjTz6j34lUznACHcdRWroPvXANP2Vj7yNK57vp9eFqzLWQ==
dependencies:
postcss "^7.0.5"
postcss-modules-local-by-default@^3.0.2:
version "3.0.2"
resolved "https://registry.yarnpkg.com/postcss-modules-local-by-default/-/postcss-modules-local-by-default-3.0.2.tgz#e8a6561be914aaf3c052876377524ca90dbb7915"
integrity sha512-jM/V8eqM4oJ/22j0gx4jrp63GSvDH6v86OqyTHHUvk4/k1vceipZsaymiZ5PvocqZOl5SFHiFJqjs3la0wnfIQ==
dependencies:
icss-utils "^4.1.1"
postcss "^7.0.16"
postcss-selector-parser "^6.0.2"
postcss-value-parser "^4.0.0"
postcss-modules-scope@^2.1.1:
version "2.2.0"
resolved "https://registry.yarnpkg.com/postcss-modules-scope/-/postcss-modules-scope-2.2.0.tgz#385cae013cc7743f5a7d7602d1073a89eaae62ee"
integrity sha512-YyEgsTMRpNd+HmyC7H/mh3y+MeFWevy7V1evVhJWewmMbjDHIbZbOXICC2y+m1xI1UVfIT1HMW/O04Hxyu9oXQ==
dependencies:
postcss "^7.0.6"
postcss-selector-parser "^6.0.0"
postcss-modules-values@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/postcss-modules-values/-/postcss-modules-values-3.0.0.tgz#5b5000d6ebae29b4255301b4a3a54574423e7f10"
integrity sha512-1//E5jCBrZ9DmRX+zCtmQtRSV6PV42Ix7Bzj9GbwJceduuf7IqP8MgeTXuRDHOWj2m0VzZD5+roFWDuU8RQjcg==
dependencies:
icss-utils "^4.0.0"
postcss "^7.0.6"
postcss-selector-parser@^6.0.0, postcss-selector-parser@^6.0.2:
version "6.0.2"
resolved "https://registry.yarnpkg.com/postcss-selector-parser/-/postcss-selector-parser-6.0.2.tgz#934cf799d016c83411859e09dcecade01286ec5c"
integrity sha512-36P2QR59jDTOAiIkqEprfJDsoNrvwFei3eCqKd1Y0tUsBimsq39BLp7RD+JWny3WgB1zGhJX8XVePwm9k4wdBg==
dependencies:
cssesc "^3.0.0"
indexes-of "^1.0.1"
uniq "^1.0.1"
postcss-value-parser@^4.0.0, postcss-value-parser@^4.0.2:
version "4.0.3"
resolved "https://registry.yarnpkg.com/postcss-value-parser/-/postcss-value-parser-4.0.3.tgz#651ff4593aa9eda8d5d0d66593a2417aeaeb325d"
integrity sha512-N7h4pG+Nnu5BEIzyeaaIYWs0LI5XC40OrRh5L60z0QjFsqGWcHcbkBvpe1WYpcIS9yQ8sOi/vIPt1ejQCrMVrg==
postcss@^7.0.14, postcss@^7.0.16, postcss@^7.0.23, postcss@^7.0.5, postcss@^7.0.6:
version "7.0.27"
resolved "https://registry.yarnpkg.com/postcss/-/postcss-7.0.27.tgz#cc67cdc6b0daa375105b7c424a85567345fc54d9"
integrity sha512-WuQETPMcW9Uf1/22HWUWP9lgsIC+KEHg2kozMflKjbeUtw9ujvFX6QmIfozaErDkmLWS9WEnEdEe6Uo9/BNTdQ==
dependencies:
chalk "^2.4.2"
source-map "^0.6.1"
supports-color "^6.1.0"
pretty-error@^2.1.1:
version "2.1.1"
resolved "https://registry.yarnpkg.com/pretty-error/-/pretty-error-2.1.1.tgz#5f4f87c8f91e5ae3f3ba87ab4cf5e03b1a17f1a3"
@ -3314,6 +3410,14 @@ schema-utils@^1.0.0:
ajv-errors "^1.0.0"
ajv-keywords "^3.1.0"
schema-utils@^2.6.0, schema-utils@^2.6.4:
version "2.6.5"
resolved "https://registry.yarnpkg.com/schema-utils/-/schema-utils-2.6.5.tgz#c758f0a7e624263073d396e29cd40aa101152d8a"
integrity sha512-5KXuwKziQrTVHh8j/Uxz+QUbxkaLW9X/86NBlx/gnKgtsZA2GIVMUn17qWhRFwF8jdYb3Dig5hRO/W5mZqy6SQ==
dependencies:
ajv "^6.12.0"
ajv-keywords "^3.4.1"
select-hose@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/select-hose/-/select-hose-2.0.0.tgz#625d8658f865af43ec962bfc376a37359a4994ca"
@ -3691,6 +3795,14 @@ strip-eof@^1.0.0:
resolved "https://registry.yarnpkg.com/strip-eof/-/strip-eof-1.0.0.tgz#bb43ff5598a6eb05d89b59fcd129c983313606bf"
integrity sha1-u0P/VZim6wXYm1n80SnJgzE2Br8=
style-loader@^1.1.3:
version "1.1.3"
resolved "https://registry.yarnpkg.com/style-loader/-/style-loader-1.1.3.tgz#9e826e69c683c4d9bf9db924f85e9abb30d5e200"
integrity sha512-rlkH7X/22yuwFYK357fMN/BxYOorfnfq0eD7+vqlemSK4wEcejFF1dg4zxP0euBW8NrYx2WZzZ8PPFevr7D+Kw==
dependencies:
loader-utils "^1.2.3"
schema-utils "^2.6.4"
supports-color@6.1.0, supports-color@^6.1.0:
version "6.1.0"
resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-6.1.0.tgz#0764abc69c63d5ac842dd4867e8d025e880df8f3"
@ -3836,6 +3948,11 @@ union-value@^1.0.0:
is-extendable "^0.1.1"
set-value "^2.0.1"
uniq@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/uniq/-/uniq-1.0.1.tgz#b31c5ae8254844a3a8281541ce2b04b865a734ff"
integrity sha1-sxxa6CVIRKOoKBVBzisEuGWnNP8=
unique-filename@^1.1.1:
version "1.1.1"
resolved "https://registry.yarnpkg.com/unique-filename/-/unique-filename-1.1.1.tgz#1d69769369ada0583103a1e6ae87681b56573230"

View File

@ -8,7 +8,7 @@ pub trait ResponseData {
fn into_response(self) -> Self::Response;
}
#[derive(Clone, Serialize)]
#[derive(Clone, Serialize, Debug)]
#[serde(rename_all = "camelCase")]
pub struct ErrorResponse {
pub errors: Vec<String>,
@ -186,7 +186,7 @@ pub struct UpdateCommentPayload {
pub body: String,
}
#[derive(Serialize, Deserialize)]
#[derive(Serialize, Deserialize, Debug)]
#[serde(rename_all = "camelCase")]
pub struct CreateIssuePayload {
pub title: String,
@ -203,7 +203,7 @@ pub struct CreateIssuePayload {
pub user_ids: Vec<i32>,
}
#[derive(Serialize, Deserialize)]
#[derive(Serialize, Deserialize, Debug)]
#[serde(rename_all = "camelCase")]
pub struct UpdateProjectPayload {
pub name: Option<String>,

View File

@ -17,6 +17,10 @@ async fn main() -> Result<(), String> {
env_logger::init();
dotenv::dotenv().ok();
let port = std::env::var("JIRS_SERVER_PORT").unwrap_or_else(|_| "3000".to_string());
let bind = std::env::var("JIRS_SERVER_BIND").unwrap_or_else(|_| "0.0.0.0".to_string());
let addr = format!("{}:{}", bind, port);
let db_addr = actix::SyncArbiter::start(4, || crate::db::DbExecutor::new());
HttpServer::new(move || {
@ -46,7 +50,7 @@ async fn main() -> Result<(), String> {
.service(crate::routes::projects::update),
)
})
.bind("127.0.0.1:3000")
.bind(addr)
.map_err(|e| format!("{}", e))?
.run()
.await

View File

@ -1 +1,2 @@
node_modules
tmp

View File

@ -9,20 +9,17 @@ export const color = {
danger: '#E13C3C', // red
warning: '#F89C1C', // orange
secondary: '#F4F5F7', // light grey
textDarkest: '#172b4d',
textDark: '#42526E',
textMedium: '#5E6C84',
textLight: '#8993a4',
textLink: '#0052cc',
backgroundDarkPrimary: '#0747A6',
backgroundMedium: '#dfe1e6',
backgroundLight: '#ebecf0',
backgroundLightest: '#F4F5F7',
backgroundLightPrimary: '#D2E5FE',
backgroundLightSuccess: '#E4FCEF',
borderLightest: '#dfe1e6',
borderLight: '#C1C7D0',
borderInputFocus: '#4c9aff',