Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
| Comment: | Diff context chunk loader UI controls now show a load-pending message and any error messages directly next to the controls, rather than via toasts, per forum feedback. |
|---|---|
| Downloads: | Tarball | ZIP archive |
| Timelines: | family | ancestors | descendants | both | trunk |
| Files: | files | file ages | folders |
| SHA3-256: |
ba400826919f8d68b42d1ad9a76eb582 |
| User & Date: | stephan 2021-09-21 18:17:29.563 |
Context
|
2021-09-21
| ||
| 19:45 | Tweaked the /chat config options layout so that the entries start at the bottom of the view to put them in easier reach on tall screens, and moved the presumably most common options to the bottom so that they start out scrolled into view on smaller screens. ... (check-in: 3524f72e6b user: stephan tags: trunk) | |
| 18:17 | Diff context chunk loader UI controls now show a load-pending message and any error messages directly next to the controls, rather than via toasts, per forum feedback. ... (check-in: ba40082691 user: stephan tags: trunk) | |
| 16:28 | Removed some extraneous console debug output. ... (check-in: 8663dde1df user: stephan tags: trunk) | |
Changes
Changes to src/builtin.c.
| ︙ | ︙ | |||
702 703 704 705 706 707 708 |
** entries: all known deps of this one. Each
** REQUIRES an EXPLICIT trailing \0, including
** the final one! */
} fjs[] = {
/* This list ordering isn't strictly important. */
{"confirmer", 0, 0},
{"copybutton", 0, "dom\0"},
| | | 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 |
** entries: all known deps of this one. Each
** REQUIRES an EXPLICIT trailing \0, including
** the final one! */
} fjs[] = {
/* This list ordering isn't strictly important. */
{"confirmer", 0, 0},
{"copybutton", 0, "dom\0"},
{"diff", 0, "dom\0fetch\0"},
{"dom", 0, 0},
{"fetch", 0, 0},
{"numbered-lines", 0, "popupwidget\0copybutton\0"},
{"pikchr", 0, "dom\0"},
{"popupwidget", 0, "dom\0"},
{"storage", 0, 0},
{"tabs", 0, "dom\0"}
|
| ︙ | ︙ |
Changes to src/default.css.
| ︙ | ︙ | |||
600 601 602 603 604 605 606 |
cursor: pointer;*/
}
tr.diffskip > td.chunkctrl {
text-align: left;
font-family: monospace;
}
tr.diffskip > td.chunkctrl > div {
| | > > > > > | 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 |
cursor: pointer;*/
}
tr.diffskip > td.chunkctrl {
text-align: left;
font-family: monospace;
}
tr.diffskip > td.chunkctrl > div {
display: flex;
align-items: center;
}
tr.diffskip > td.chunkctrl > div > span.error {
padding: 0.25em 0.5em;
border-radius: 0.5em;
}
tr.diffskip > td.chunkctrl .jcbutton
/* class name .button breaks w/ some skins! */ {
min-width: 3.5ex;
max-width: 3.5ex;
text-align: center;
display: inline-block;
|
| ︙ | ︙ |
Changes to src/fossil.diff.js.
| ︙ | ︙ | |||
31 32 33 34 35 36 37 |
) || 20,
chunkFetch: {
/* Default callack handlers for Diff.fetchArtifactChunk(),
unless overridden by options passeed to that function. */
beforesend: function(){},
aftersend: function(){},
onerror: function(e){
| | | 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
) || 20,
chunkFetch: {
/* Default callack handlers for Diff.fetchArtifactChunk(),
unless overridden by options passeed to that function. */
beforesend: function(){},
aftersend: function(){},
onerror: function(e){
console.error("XHR error: ",e);
}
}
}
};
/**
Uses the /jchunk AJAX route to fetch specific lines of a given
artifact. The argument must be an Object suitable for passing as
|
| ︙ | ︙ | |||
136 137 138 139 140 141 142 143 144 145 146 147 148 149 |
};
D.clearElement(tr);
this.e.td = D.addClass(
/* Holder for our UI controls */
D.attr(D.td(tr), 'colspan', this.isSplit ? 5 : 4),
'chunkctrl'
);
this.e.btnWrapper = D.div();
D.append(this.e.td, this.e.btnWrapper);
/**
Depending on various factors, we need one or more of:
- A single button to load the initial chunk incrementally
| > | 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 |
};
D.clearElement(tr);
this.e.td = D.addClass(
/* Holder for our UI controls */
D.attr(D.td(tr), 'colspan', this.isSplit ? 5 : 4),
'chunkctrl'
);
this.e.msgWidget = D.addClass(D.span(), 'hidden');
this.e.btnWrapper = D.div();
D.append(this.e.td, this.e.btnWrapper);
/**
Depending on various factors, we need one or more of:
- A single button to load the initial chunk incrementally
|
| ︙ | ︙ | |||
186 187 188 189 190 191 192 193 194 195 196 197 198 199 |
btnUp = this.createButton(this.FetchType.NextUp);
}
}
//this.e.btnUp = btnUp;
//this.e.btnDown = btnDown;
if(btnDown) D.append(this.e.btnWrapper, btnDown);
if(btnUp) D.append(this.e.btnWrapper, btnUp);
/* For debugging only... */
this.e.posState = D.span();
D.append(this.e.btnWrapper, this.e.posState);
this.updatePosDebug();
};
ChunkLoadControls.prototype = {
| > | 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 |
btnUp = this.createButton(this.FetchType.NextUp);
}
}
//this.e.btnUp = btnUp;
//this.e.btnDown = btnDown;
if(btnDown) D.append(this.e.btnWrapper, btnDown);
if(btnUp) D.append(this.e.btnWrapper, btnUp);
D.append(this.e.btnWrapper, this.e.msgWidget);
/* For debugging only... */
this.e.posState = D.span();
D.append(this.e.btnWrapper, this.e.posState);
this.updatePosDebug();
};
ChunkLoadControls.prototype = {
|
| ︙ | ︙ | |||
293 294 295 296 297 298 299 300 301 302 303 304 305 306 |
urlParam/*from fetchChunk()*/,
lines/*response lines*/){
if(!lines.length){
/* No more data to load */
this.destroy();
return this;
}
//console.debug("Loaded line range ",
//urlParam.from,"-",urlParam.to, "fetchType ",fetchType);
const lineno = [],
trPrev = this.e.tr.previousElementSibling,
trNext = this.e.tr.nextElementSibling,
doAppend = (
!!trPrev && fetchType>=this.FetchType.FillGap
| > | 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 |
urlParam/*from fetchChunk()*/,
lines/*response lines*/){
if(!lines.length){
/* No more data to load */
this.destroy();
return this;
}
this.msg(false);
//console.debug("Loaded line range ",
//urlParam.from,"-",urlParam.to, "fetchType ",fetchType);
const lineno = [],
trPrev = this.e.tr.previousElementSibling,
trNext = this.e.tr.nextElementSibling,
doAppend = (
!!trPrev && fetchType>=this.FetchType.FillGap
|
| ︙ | ︙ | |||
452 453 454 455 456 457 458 459 460 461 462 463 464 465 |
}
Diff.checkTableWidth(true);
return this;
}else{
throw new Error("Unexpected 'fetchType' value.");
}
},
/**
Fetches and inserts a line chunk. fetchType is:
this.FetchType.NextUp = upwards from next chunk (this.pos.next)
this.FetchType.FillGap = the whole gap between this.pos.prev
| > > > > > > > > > > > > > > > > > > | 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 |
}
Diff.checkTableWidth(true);
return this;
}else{
throw new Error("Unexpected 'fetchType' value.");
}
},
/**
Sets this widget's message to the given text. If the message
represents an error, the first argument must be truthy, else it
must be falsy. Returns this object.
*/
msg: function(isError,txt){
if(txt){
if(isError) D.addClass(this.e.msgWidget, 'error');
else D.removeClass(this.e.msgWidget, 'error');
D.append(
D.removeClass(D.clearElement(this.e.msgWidget), 'hidden'),
txt);
}else{
D.addClass(D.clearElement(this.e.msgWidget), 'hidden');
}
return this;
},
/**
Fetches and inserts a line chunk. fetchType is:
this.FetchType.NextUp = upwards from next chunk (this.pos.next)
this.FetchType.FillGap = the whole gap between this.pos.prev
|
| ︙ | ︙ | |||
478 479 480 481 482 483 484 |
a warning. Returns this object.
*/
fetchChunk: function(fetchType){
/* Forewarning, this is a bit confusing: when fetching the
previous lines, we're doing so on behalf of the *next* diff
chunk (this.pos.next), and vice versa. */
if(this.$isFetching){
| | < > | 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 |
a warning. Returns this object.
*/
fetchChunk: function(fetchType){
/* Forewarning, this is a bit confusing: when fetching the
previous lines, we're doing so on behalf of the *next* diff
chunk (this.pos.next), and vice versa. */
if(this.$isFetching){
return this.msg(true,"Cannot load chunk while a load is pending.");
}
if(fetchType===this.FetchType.NextUp && !this.pos.next
|| fetchType===this.FetchType.PrevDown && !this.pos.prev){
console.error("Attempt to fetch diff lines but don't have any.");
return this;
}
this.msg(false,"Fetching diff chunk...");
const fOpt = {
urlParams:{
name: this.fileHash, from: 0, to: 0
},
aftersend: ()=>delete this.$isFetching,
onload: (list)=>this.injectResponse(fetchType,up,list)
};
|
| ︙ | ︙ | |||
526 527 528 529 530 531 532 533 534 535 536 537 538 539 |
if( this.pos.prev && this.pos.prev.endLhs >= up.from ){
up.from = this.pos.prev.endLhs + 1;
fetchType = this.FetchType.FillGap;
}
}
this.$isFetching = true;
//console.debug("fetchChunk(",fetchType,")",up);
Diff.fetchArtifactChunk(fOpt);
return this;
}
};
/**
Adds context-loading buttons to one or more tables. The argument
| > | 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 |
if( this.pos.prev && this.pos.prev.endLhs >= up.from ){
up.from = this.pos.prev.endLhs + 1;
fetchType = this.FetchType.FillGap;
}
}
this.$isFetching = true;
//console.debug("fetchChunk(",fetchType,")",up);
fOpt.onerror = (err)=>this.msg(true,err.message);
Diff.fetchArtifactChunk(fOpt);
return this;
}
};
/**
Adds context-loading buttons to one or more tables. The argument
|
| ︙ | ︙ |