-
-
Notifications
You must be signed in to change notification settings - Fork 413
web: many improvements for 2.0 #2671
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 91 commits
e2b1c4a
2c076c2
195254c
c57b701
8f1bd37
06e9fd9
7c02195
e35df57
5da601c
347570f
079e80e
fb4abb1
bf04fce
8a34d6c
ec5cb9d
941f99f
16f8be4
53a43b9
7041217
2071d26
36e4137
4898b83
8f1bb2e
ca07a4c
37ece61
a61e588
63e5863
4d664f1
e3602f0
882dcfa
cb38ce7
45a138c
f9146c7
d91e27d
4e4390f
df0015c
cb8c2f5
159b304
92ad93a
981b286
d1c648d
5f0ab2f
96779c5
5912cc4
eb68a13
21cd607
3c18d34
0b5cf43
0d1d8a2
fb2afe9
2f21f87
3e8302a
ad94db9
5ec4f0b
f405fb6
6ab0d0f
877c7bf
3fe4508
b686271
cb75129
eddb89c
6ee26ee
c7ba9a7
8ca64ca
c2970d0
0d1cdf8
a95ebf9
471f9e7
05226b2
1d9471b
99e2fd5
837f3f2
7f7bf29
a03c2cf
84bd5fa
d5932f5
9f104ab
dcdf066
6fb5b3e
3bc3328
32073e8
c7e7252
5922e74
48ba2de
aaf98e1
bf4580d
50c67e9
d218e02
0be4193
7da5fb7
ff1e279
dfe27f0
578d938
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -18,7 +18,6 @@ _* | |
| .shake | ||
| .stack* | ||
| .tmp | ||
| .vscode | ||
| tags | ||
| TAGS | ||
| .obsidian | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| { | ||
| "version": "0.2.0", | ||
| "configurations": [ | ||
| { | ||
| "name": "Build hledger-web", | ||
| "type": "node", | ||
| "request": "launch", | ||
| "runtimeExecutable": "stack", | ||
| "runtimeArgs": ["install", "hledger-web"], | ||
| "console": "integratedTerminal", | ||
| "skipFiles": ["<node_internals>/**"], | ||
| "internalConsoleOptions": "neverOpen" | ||
| }, | ||
| { | ||
| "name": "Run hledger-web", | ||
| "type": "node", | ||
| "request": "launch", | ||
| "runtimeExecutable": "hledger-web", | ||
| "console": "integratedTerminal", | ||
| "skipFiles": ["<node_internals>/**"], | ||
| "internalConsoleOptions": "neverOpen" | ||
| } | ||
| ] | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| { | ||
| "terminal.integrated.enableansi": true, | ||
| "haskell.debug.auto": false | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| { | ||
| "version": "2.0.0", | ||
| "tasks": [ | ||
| { | ||
| "label": "Build hledger-web", | ||
| "type": "shell", | ||
| "command": "stack", | ||
| "args": ["install", "hledger-web"], | ||
| "group": "build", | ||
| "problemMatcher": [] | ||
| }, | ||
| { | ||
| "label": "Run hledger-web", | ||
| "type": "shell", | ||
| "command": "hledger-web", | ||
| "group": "build", | ||
| "problemMatcher": [] | ||
| }, | ||
| { | ||
| "label": "Check Stack Installation", | ||
| "type": "shell", | ||
| "command": "stack", | ||
| "args": ["--version"], | ||
| "group": "build", | ||
| "problemMatcher": [] | ||
| } | ||
| ] | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| @echo off | ||
| setlocal enabledelayedexpansion | ||
| set "LOCAL_IP=" | ||
|
|
||
| REM Filter for IPv4 Address lines | ||
| for /f "tokens=2 delims=:" %%i in ('ipconfig ^| findstr "IPv4"') do ( | ||
| set "IP=%%i" | ||
| REM Trim spaces | ||
| set "IP=!IP: =!" | ||
|
|
||
| echo %IP% | ||
| REM Check if the IP starts with 192.168 | ||
| if "!IP:~0,8!"=="192.168." ( | ||
| set "LOCAL_IP=!IP!" | ||
| goto :Found | ||
| ) | ||
| ) | ||
| :Found | ||
|
|
||
| hledger-web.exe -f "C:/Users/Aiden Hu/.hledger.journal" --host %IP% --port=5000 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1 @@ | ||
| 1.99 | ||
| 2.0 | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. my assumption is that incrementing the version bump would be outside of a pull request and part of the release process, but I haven't looked into . |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,2 +1,2 @@ | ||
| m4_dnl Version number to show in manuals. Updated by "Shake setversion" | ||
| m4_define({{_version_}}, {{1.99}})m4_dnl | ||
| m4_define({{_version_}}, {{2.0}})m4_dnl |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -159,30 +159,22 @@ instance Yesod App where | |
| sideShowsm = if showSidebar then "col-sm-4" else "" :: Text | ||
| mainShowmd = if showSidebar then "col-md-8" else "col-md-12" :: Text | ||
| mainShowsm = if showSidebar then "col-sm-8" else "col-sm-12" :: Text | ||
| isJournalPage = here == JournalR | ||
|
|
||
| -- We break up the default layout into two components: | ||
| -- default-layout is the contents of the body tag, and | ||
| -- default-layout-wrapper is the entire page. Since the final | ||
| -- value passed to hamletToRepHtml cannot be a widget, this allows | ||
| -- you to use normal widget features in default-layout. | ||
| pc <- widgetToPageContent $ do | ||
| -- Bootstrap 5 CSS | ||
| addStylesheet $ StaticR css_bootstrap_min_css | ||
| addStylesheet $ StaticR css_bootstrap_datepicker_standalone_min_css | ||
| addStylesheet $ StaticR css_bootstrap_icons_css | ||
| -- load these things early, in HEAD: | ||
| toWidgetHead [hamlet| | ||
| <script type="text/javascript" src="@{StaticR js_jquery_min_js}"> | ||
| <script type="text/javascript" src="@{StaticR js_typeahead_bundle_min_js}"> | ||
| <script type="text/javascript" src="@{StaticR js_bootstrap_bundle_min_js}"> | ||
| <script type="text/javascript" src="https://cdn.jsdelivr.net/npm/typeahead.js@0.11.1/dist/typeahead.bundle.min.js"> | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we're in conflict here. I propose replacing typeahead with a native I welcome your feedback. |
||
| |] | ||
| addScript $ StaticR js_bootstrap_min_js | ||
| addScript $ StaticR js_bootstrap_datepicker_min_js | ||
| addScript $ StaticR js_jquery_url_js | ||
| addScript $ StaticR js_jquery_cookie_js | ||
| addScript $ StaticR js_jquery_hotkeys_js | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Looks like we may be in conflict here. Could merge? In any event, I'll look into it. |
||
| addScript $ StaticR js_jquery_flot_min_js | ||
| addScript $ StaticR js_jquery_flot_selection_min_js | ||
| addScript $ StaticR js_jquery_flot_time_min_js | ||
| addScript $ StaticR js_jquery_flot_tooltip_min_js | ||
| toWidget [hamlet| \<!--[if lte IE 8]> <script type="text/javascript" src="@{StaticR js_excanvas_min_js}"></script> <![endif]--> |] | ||
| addStylesheet $ StaticR hledger_css | ||
| addScript $ StaticR hledger_js | ||
| $(widgetFile "default-layout") | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -12,7 +12,6 @@ module Hledger.Web.Handler.RegisterR where | |
| import Data.List (intersperse, nub, partition) | ||
| import Data.Text qualified as T | ||
| import Safe (tailSafe) | ||
| import Text.Hamlet (hamletFile) | ||
|
|
||
| import Hledger | ||
| import Hledger.Cli.CliOptions | ||
|
|
@@ -49,6 +48,7 @@ getRegisterR = do | |
| items = | ||
| styleAmounts (journalCommodityStylesWith HardRounding j) $ | ||
| accountTransactionsReport rspec{_rsQuery=q} j acctQuery | ||
| balancelabel :: String | ||
| balancelabel | ||
| | isJust (inAccount qopts), balanceaccum_ (_rsReportOpts rspec) == Historical = "Historical Total" | ||
| | isJust (inAccount qopts) = "Period Total" | ||
|
|
@@ -99,10 +99,10 @@ decorateLinks :: [(acct, ([char], [char]))] -> [(Maybe acct, char)] | |
| decorateLinks = concatMap $ \(acct, (name, comma)) -> | ||
| map (Just acct,) name ++ map (Nothing,) comma | ||
|
|
||
| -- | Generate javascript/html for a register balance line chart based on | ||
| --- | Generate javascript/html for a register balance line chart based on | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. was this intentional? |
||
| -- the provided "AccountTransactionsReportItem"s. | ||
| registerChartHtml :: Text -> String -> [(CommoditySymbol, [AccountTransactionsReportItem])] -> HtmlUrl AppRoute | ||
| registerChartHtml q title percommoditytxnreports = $(hamletFile "templates/chart.hamlet") | ||
| registerChartHtml :: Text -> String -> [(CommoditySymbol, [AccountTransactionsReportItem])] -> Widget | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I see that it is formatting for the chart, can you help me understand why you decided to change it? I think we want to think about the chart. It presents a number of problems: jquery, its old, ugly, and presents a large surface area :). My thinking is that we should just touch it as little as possible and instead weigh some modern alternatives. My medium term hope is that once we have cleaned up the status quo, we will be able to add some charts and graphs that would take advantage of hledger's current investment reporting as well as the 2.0 lot reporting potential. It's worth thinking about and getting right.
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I tried removing jQuery completely from the code base, but the charts required me to put it back in. I even tried upgrading to the latest version of chart.js, but couldn't get it to work and so backed out. I made the minimum number of changes to get the existing charts working. Fixing the charts properly as you say should be a different issue and PR. I for one would like a checkbox to allow the user to hide the charts if they don't want to see it, but again, that's a different issue and PR. |
||
| registerChartHtml q title percommoditytxnreports = $(whamletFile "templates/chart.hamlet") | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| -- have to make sure plot is not called when our container (maincontent) | ||
| -- is hidden, eg with add form toggled | ||
| where | ||
|
|
@@ -113,6 +113,12 @@ registerChartHtml q title percommoditytxnreports = $(hamletFile "templates/chart | |
| showZeroCommodity = wbUnpack . showMixedAmountB oneLineNoCostFmt{displayCost=False,displayZeroCommodity=True} | ||
| shownull c = if null c then " " else c | ||
| nodatelink = (RegisterR, [("q", T.unwords $ removeDates q)]) | ||
| triDate (_,tacct,_,_,_,_) = tdate tacct | ||
| triAmount (_,_,_,_,a,_) = a | ||
| triBalance (_,_,_,_,_,a) = a | ||
| triOrigTransaction (torig,_,_,_,_,_) = torig | ||
| triCommodityAmount c = filterMixedAmountByCommodity c . triAmount | ||
| triCommodityBalance c = filterMixedAmountByCommodity c . triBalance | ||
|
|
||
| -- | Makes a unix timestamp (milliseconds since epoch) corresponding to noon on the given date in UTC. | ||
| dayToUtcNoonTimestamp :: Day -> Integer | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -28,4 +28,6 @@ staticSite = | |
| -- putStrLn "Using built-in web files" >> hFlush stdout | ||
| return $(embed staticDir)) | ||
|
|
||
| -- In development mode, staticDevel serves all files from static dir including subdirectories | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you help me understand this change? If you had to dig here and leave a comment, I'm curious. |
||
| -- tmp directory is created at runtime for Julius-generated JS files | ||
| $(publicFiles staticDir) | ||
This file was deleted.

There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you meant to delete these from the repository, but they are still here. If you now have
.vscodein your.gitignoreyou will need to turn that off, and then make a commit to delete all of this from the repo. Once that's done, you can add vscode back into your ignore.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It was accidentally removed from the gitignore for a time. For users who use Visual Studio Code, it is useful to keep. For those who don't, it's easily ignorable and poses no harm.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I disagree.
hledger is pushing twenty years old. It has 178 contributors who have opened almost 1,000 pull requests over 60 releases.
Developer tooling has changed alot in that time, and the various contributors probably use a pretty good mix of environments. If even a small percent checked in their own developer tooling, there'd be alot of it in the repo. There's no documentation or test coverage, so really no guarantee it'll even work for any one other than you.