Skip to content

Commit

Permalink
Merge branch 'release/0.2.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
GaelGirodon committed Oct 28, 2018
2 parents ff4969d + 5506561 commit d764222
Show file tree
Hide file tree
Showing 7 changed files with 51 additions and 32 deletions.
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ where your disk space has gone to help you to clean it up.
1. Download the [latest release](https://github.com/GaelGirodon/dir-stat/releases)
2. Start **DirStat**
3. Set the path of the directory to scan
4. Click on the 🔍 **Scan** button
4. Click on the <kbd>**Scan**</kbd> button (or press <kbd>Enter</kbd>)
5. Navigate in the treemap to show where your disk space has gone

### CLI usage
Expand All @@ -30,8 +30,11 @@ dirstat --port 8000
Install global dependencies:

- Node.js >= 8
- NPM >= 5
- Go >= 1.11
- [Dep](https://github.com/golang/dep) >= 0.5.0
- [Packr](https://github.com/gobuffalo/packr) >= 1.15
- PowerShell

Then, install project dependencies:

Expand All @@ -48,7 +51,7 @@ npm run build
### Package

```shell
./scripts/package.ps1
npm run package
```

### Release
Expand Down
14 changes: 10 additions & 4 deletions assets/js/dirstat.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,12 @@ var app = new Vue({
this.$http.get('stat?path=' + this.dir).then(function (data) {
var entry = data.body;
this.path = [entry];
document.getElementById('treemap-container').innerHTML = '';
this.graph = new d3plus.Treemap()
.select('#treemap')
.select('#treemap-container')
.detectResize(true)
.detectResizeDelay(250)
.height(640)
.data(this.entries)
.groupBy('name').sum(this.mode)
.tooltipConfig({
Expand All @@ -61,13 +65,15 @@ var app = new Vue({
this.processing = false;
}).catch(function (err) {
this.processing = false;
this.error = 'Unable to analyse the given directory: ' + err.body.message;
this.error = 'Unable to scan the given directory'
+ (err.body.message ? ': ' + err.body.message : '') + '.';
});
},
// Map entry stats to a string
mapStats: function (d) {
return Math.round(d.size / (1024 * 1024)) + ' MB'
+ ' / ' + d.count + ' entries / depth ' + d.depth
return '<strong>Size:</strong> ' + Math.round(d.size / (1024 * 1024)) + ' MB<br>'
+ '<strong>Count:</strong> ' + d.count + ' entries<br>'
+ '<strong>Depth:</strong> ' + d.depth
},
// Render the tree map
renderTreemap: function () {
Expand Down
13 changes: 12 additions & 1 deletion assets/sass/dirstat.scss
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,15 @@

[v-cloak] {
display: none;
}
}

body {
background: #f5f5f5;
}

.breadcrumb {
background: #ffffff;
border: solid 1px #ced4da;
padding-top: 0.4rem !important;
padding-bottom: 0.4rem !important;
}
1 change: 1 addition & 0 deletions dirstat.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ func statHandler(res http.ResponseWriter, req *http.Request) {

// Send a success response with a body content
func sendSuccess(res http.ResponseWriter, body []byte) {
log.Println("OK")
res.Header().Set("Content-Type", "application/json")
res.WriteHeader(http.StatusOK)
res.Write(body)
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
{
"name": "dir-stat",
"version": "0.1.0",
"version": "0.2.0",
"description": "Simple directory statistics",
"scripts": {
"build:assets": "gulp",
"build": "npm run build:assets && packr build -i -o dirstat.exe .",
"ensure": "npm install && dep ensure",
"start": "dirstat"
"start": "dirstat",
"package": "powershell.exe ./scripts/package.ps1"
},
"repository": {
"type": "git",
Expand Down
41 changes: 19 additions & 22 deletions web/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,38 +12,37 @@
<div id="app" class="container">
<!-- Header -->
<header class="d-flex justify-content-between my-4">
<h1 class="display-4">&#x1F5C3; DirStat</h1>
<p class="align-self-end text-muted small text-right ml-4">
DirStat is a simple graphical web application to show<br>
<h1 class="display-5 m-0">&#x1F5C3; DirStat</h1>
<div class="align-self-center small text-muted text-right d-none d-sm-none d-md-block">
<strong>DirStat</strong> is a simple graphical web application to show<br>
where your disk space has gone to help you to clean it up.
</p>
</div>
</header>
<!-- Directory selection -->
<div>
<section>
<!-- Directory path input -->
<div class="input-group">
<input type="text" class="form-control" id="dir" placeholder="C:\path\to\dir\"
v-model="dir" :disabled="processing" :class="{'is-invalid': error}">
<div class="input-group-append">
<button type="button" class="btn btn-block btn-primary"
@click="scan" :disabled="processing">
&#x1F50D; Scan
</button>
</div>
<div class="d-flex">
<input class="form-control flex-grow-1" id="dir" :class="{'is-invalid': error}"
placeholder="Type here the path to the folder to analyse and click on the 'Scan' button or press Enter"
v-model="dir" :disabled="processing" @keyup.enter="scan">
<button type="button" class="btn btn-primary ml-2 px-3"
@click="scan" :disabled="processing">
&#x1F50D; Scan
</button>
</div>
<!-- Error message -->
<div class="text-danger" v-if="error">{{ error }}</div>
<div class="text-danger" v-cloak v-if="error">{{ error }}</div>
<!-- Progress bar -->
<div class="progress mt-3" v-cloak v-if="processing">
<div class="progress-bar progress-bar-striped progress-bar-animated" role="progressbar"
aria-valuenow="100" aria-valuemin="0" aria-valuemax="100" style="width: 100%"></div>
</div>
</div>
</section>
<!-- Navigation controls -->
<form class="form-inline my-3" v-cloak v-show="graph">
<section class="form-inline my-3" v-cloak v-show="graph">
<!-- Back to the previous level -->
<div class="form-group">
<button type="button" class="btn btn-dark" @click="back" :disabled="path.length <= 1">🡨</button>
<button type="button" class="btn btn-secondary" @click="back" :disabled="path.length <= 1">🡨</button>
</div>
<!-- Path -->
<div class="form-group ml-2">
Expand All @@ -64,11 +63,9 @@ <h1 class="display-4">&#x1F5C3; DirStat</h1>
</select>
</div>
</div>
</form>
</section>
<!-- Tree map -->
<div v-cloak>
<svg id="treemap" width="100%" height="600px"></svg>
</div>
<section v-cloak id="treemap-container"></section>
</div>
<!-- Scripts -->
<script src="dirstat.min.js"></script>
Expand Down

0 comments on commit d764222

Please sign in to comment.