Optimize and reorganize code

This commit is contained in:
Adrian Woźniak 2020-06-10 22:11:51 +02:00
parent 2c173669d3
commit a37fb19d7f
14 changed files with 35 additions and 29 deletions

View File

@ -2,14 +2,14 @@
<html lang="en"> <html lang="en">
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta content="width=device-width, initial-scale=1.0" name="viewport">
<link rel="icon" href="/favicon.png"> <link href="/favicon.png" rel="icon">
<link href="/logo2.svg" rel="icon"> <link href="/logo2.svg" rel="icon">
<title>JIRS</title> <title>JIRS</title>
<link rel="stylesheet" type="text/css" href="/styles.css"> <link href="/styles.css" rel="stylesheet" type="text/css">
</head> </head>
<body> <body>
<main id="app"></main> <main id="app"></main>
<script type="module" src="/index.js"></script> <script src="/index.js" type="module"></script>
</body> </body>
</html> </html>

View File

@ -1,5 +1,5 @@
mod update;
mod view;
pub use update::update; pub use update::update;
pub use view::view; pub use view::view;
mod update;
mod view;

View File

@ -1,5 +1,5 @@
mod update;
mod view;
pub use update::*; pub use update::*;
pub use view::*; pub use view::*;
mod update;
mod view;

View File

@ -1,5 +1,5 @@
mod update;
mod view;
pub use update::update; pub use update::update;
pub use view::view; pub use view::view;
mod update;
mod view;

View File

@ -1,12 +1,15 @@
use std::collections::HashSet;
use seed::error;
use seed::prelude::Orders;
use jirs_data::{IssueStatus, IssueStatusId, ProjectFieldId, UpdateProjectPayload, WsMsg};
use crate::model::{Model, Page, PageContent, ProjectSettingsPage}; use crate::model::{Model, Page, PageContent, ProjectSettingsPage};
use crate::shared::styled_select::StyledSelectChange; use crate::shared::styled_select::StyledSelectChange;
use crate::ws::{enqueue_ws_msg, send_ws_msg}; use crate::ws::{enqueue_ws_msg, send_ws_msg};
use crate::FieldChange::TabChanged; use crate::FieldChange::TabChanged;
use crate::{FieldId, Msg, PageChanged, ProjectPageChange, WebSocketChanged}; use crate::{FieldId, Msg, PageChanged, ProjectPageChange, WebSocketChanged};
use jirs_data::{IssueStatus, IssueStatusId, ProjectFieldId, UpdateProjectPayload, WsMsg};
use seed::error;
use seed::prelude::Orders;
use std::collections::HashSet;
pub fn update(msg: Msg, model: &mut Model, orders: &mut impl Orders<Msg>) { pub fn update(msg: Msg, model: &mut Model, orders: &mut impl Orders<Msg>) {
if model.page != Page::ProjectSettings { if model.page != Page::ProjectSettings {

View File

@ -1,9 +1,10 @@
use seed::{prelude::*, *};
use crate::shared::styled_button::StyledButton; use crate::shared::styled_button::StyledButton;
use crate::shared::styled_icon::{Icon, StyledIcon}; use crate::shared::styled_icon::{Icon, StyledIcon};
use crate::shared::styled_tooltip::StyledTooltip; use crate::shared::styled_tooltip::StyledTooltip;
use crate::shared::ToNode; use crate::shared::ToNode;
use crate::{FieldId, Msg}; use crate::{FieldId, Msg};
use seed::{prelude::*, *};
#[derive(Debug, Clone, Copy)] #[derive(Debug, Clone, Copy)]
pub enum HeadingSize { pub enum HeadingSize {

View File

@ -1,4 +1,5 @@
extern crate wasm_bindgen_test; extern crate wasm_bindgen_test;
use wasm_bindgen_test::*; use wasm_bindgen_test::*;
use jirs_client::validations::*; use jirs_client::validations::*;

View File

@ -139,7 +139,7 @@ impl ParseToken<ColorProperty> for CssParser {
let a = self.parse_token()?; let a = self.parse_token()?;
match a { match a {
PropertyValue::Other(f) if -0.001f64 > f || f > 1.001f64 => { PropertyValue::Other(f) if -0.001f64 > f || f > 1.001f64 => {
return Err(format!("out of range hsl alpha value {:?}", a)) return Err(format!("out of range hsl alpha value {:?}", a));
} }
_ => (), _ => (),
}; };

View File

@ -1,4 +1,5 @@
.foo {} .foo {
}
.bar { .bar {
} }

View File

@ -123,7 +123,7 @@ impl Handler<CreateMessage> for DbExecutor {
_ => { _ => {
return Err(ServiceErrors::RecordNotFound( return Err(ServiceErrors::RecordNotFound(
"No matching user found".to_string(), "No matching user found".to_string(),
)) ));
} }
}; };

View File

@ -1,4 +1,5 @@
use actix::{Handler, Message}; use actix::{Handler, Message};
use diesel::connection::TransactionManager;
use diesel::pg::Pg; use diesel::pg::Pg;
use diesel::prelude::*; use diesel::prelude::*;
@ -6,7 +7,6 @@ use jirs_data::{ProjectId, UserId, UserProject, UserProjectId, UserRole};
use crate::db::DbExecutor; use crate::db::DbExecutor;
use crate::errors::ServiceErrors; use crate::errors::ServiceErrors;
use diesel::connection::TransactionManager;
pub struct CurrentUserProject { pub struct CurrentUserProject {
pub user_id: UserId, pub user_id: UserId,

View File

@ -73,7 +73,7 @@ impl WsHandler<CheckAuthToken> for WebSocketActor {
Ok(Err(_)) => { Ok(Err(_)) => {
return Ok(Some(WsMsg::AuthorizeLoaded(Err( return Ok(Some(WsMsg::AuthorizeLoaded(Err(
"Invalid auth token".to_string() "Invalid auth token".to_string()
)))) ))));
} }
_ => return Ok(Some(WsMsg::AuthorizeExpired)), _ => return Ok(Some(WsMsg::AuthorizeExpired)),
}; };