Skip to content

Commit 56b93d6

Browse files
committed
Merge branch 'update-v4-dirs'
* update-v4-dirs: put url in the title until board info is fully loaded change log message hide .Trash-1000 as a system file replace ".board_locked #file_list" with "#file_list.dir_locked" start reading writable property per directory
2 parents 41f6bae + f1a62b3 commit 56b93d6

File tree

6 files changed

+31
-6
lines changed

6 files changed

+31
-6
lines changed

assets/backends/web.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ import * as tools from "../lib/tools.js"
99
import * as mdns from "../lib/mdns.js"
1010

1111
class WebResponse extends WorkflowResponse {
12-
constructor(response, content, ok=null) {
12+
constructor(response, content, ok=null, properties=null) {
1313
if(ok===null) ok = response.ok
14-
super(ok, content, response.status, response.statusText)
14+
super(ok, content, response.status, response.statusText, properties)
1515
}
1616
}
1717

@@ -172,13 +172,15 @@ class WebWorkflow extends WorkflowWithCredentials {
172172
)
173173
try {
174174
var data = await response.json()
175+
var properties = {}
175176
if(this.api_version > 3 && "files" in data ) {
176177
var files = data["files"]
177178
var file_list = files.map((d) => new WebWorkflowFile(d))
179+
properties = data
178180
} else {
179181
var file_list = data.map((d) => new WebWorkflowFile(d))
180182
}
181-
return new WebResponse(response, file_list)
183+
return new WebResponse(response, file_list, null, properties)
182184
} catch {
183185
return new WebResponse(response, [], false)
184186
}

assets/backends/workflow_base.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,16 @@ SPDX-License-Identifier: MIT
44
*/
55

66
class WorkflowResponse {
7-
constructor(ok, content, status=200, statusText="OK") {
7+
constructor(ok, content, status=200, statusText="OK", properties=null) {
88
this.ok = ok
99
this.status = status
1010
this.statusText = statusText
1111
this.content = content
12+
if(properties) {
13+
this.properties = properties
14+
} else {
15+
this.properties = {}
16+
}
1217
// have text and json ?
1318
// rename json to array/dict ?
1419
}

assets/main/board_page.css

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,12 +247,20 @@ tr.odd { background: var(--color-pair1); }
247247
#file_list td .view { display: none; }
248248
#file_list td .pencil { display: none; }
249249
#file_list td:hover .pencil { display: inline; }
250+
251+
/*
250252
.board_locked #file_list td:hover .view { display: inline; }
251253
.board_locked #file_list td .pencil { display: none; }
252-
253254
.board_locked #file_list .icon_locked { display: inline; }
254255
.board_locked #file_list td .delete { display: none; }
255256
.board_locked #file_list td .rename { display: none; }
257+
*/
258+
259+
#file_list.dir_locked td:hover .view { display: inline; }
260+
#file_list.dir_locked td .pencil { display: none; }
261+
#file_list.dir_locked .icon_locked { display: inline; }
262+
#file_list.dir_locked td .delete { display: none; }
263+
#file_list.dir_locked td .rename { display: none; }
256264

257265
#file_list .triangle {
258266
cursor: pointer;

assets/main/board_page.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ async function start_circup() {
4141
console.log("No CP version found, assume latest ?")
4242
cpver = [8, 0, 0]
4343
}
44-
console.log("CP version found is ", cpver)
44+
console.log("Using CP version:", cpver)
4545
// 2 - setup the library bundle with the version from the board
4646
// init circup with the CP version
4747
if(common.is_electron) {
@@ -472,6 +472,7 @@ async function init_page() {
472472
board_control = common.board_control
473473
await board_control.start()
474474
window.board_url = await board_control.get_board_url()
475+
$("title").html(`${window.board_url}`)
475476
var vinfo = await board_control.device_info()
476477
var workflow_type = board_control.type
477478
is_editable = await board_control.is_editable()

assets/main/common.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ export const DEFAULT_SYSTEM_FILES = [
1212
".fseventsd",
1313
".metadata_never_index",
1414
".Trashes",
15+
".Trash-1000",
1516
".TemporaryItems",
1617
"System Volume Information",
1718
]

assets/main/list_directory.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,14 @@ async function insert_files_list(current_list_path, list_depth="") {
8989
var new_children = []
9090
var template = $('#file_list_template')
9191

92+
if("writable" in response.properties) {
93+
if(! response.properties["writable"]) {
94+
$("#file_list").addClass("dir_locked")
95+
}
96+
} else if($("body").hasClass("board_locked")) {
97+
$("#file_list").addClass("dir_locked")
98+
}
99+
92100
var link = $("#file_list .go_back_up")
93101
if (current_list_path != "/") {
94102
if(list_depth == "") {

0 commit comments

Comments
 (0)