Browse Source

Adds defaultTimeFormat setting

main
Eric Amodio 3 years ago
parent
commit
bfd8d78ced
14 changed files with 93 additions and 5 deletions
  1. +9
    -0
      package.json
  2. +1
    -0
      src/config.ts
  3. +2
    -0
      src/views/branchesView.ts
  4. +3
    -1
      src/views/commitsView.ts
  5. +3
    -1
      src/views/contributorsView.ts
  6. +2
    -0
      src/views/fileHistoryView.ts
  7. +3
    -1
      src/views/lineHistoryView.ts
  8. +2
    -0
      src/views/remotesView.ts
  9. +2
    -0
      src/views/repositoriesView.ts
  10. +3
    -1
      src/views/searchAndCompareView.ts
  11. +3
    -1
      src/views/stashesView.ts
  12. +2
    -0
      src/views/tagsView.ts
  13. +29
    -0
      src/webviews/apps/settings/partials/dates.html
  14. +29
    -0
      src/webviews/apps/welcome/welcome.html

+ 9
- 0
package.json View File

@ -615,6 +615,15 @@
"markdownDescription": "Specifies the style of the gravatar default (fallback) images",
"scope": "window"
},
"gitlens.defaultTimeFormat": {
"type": [
"string",
"null"
],
"default": null,
"markdownDescription": "Specifies how times will be formatted by default. See the [Moment.js docs](https://momentjs.com/docs/#/displaying/format/) for valid formats",
"scope": "window"
},
"gitlens.fileAnnotations.command": {
"type": [
"string",

+ 1
- 0
src/config.ts View File

@ -46,6 +46,7 @@ export interface Config {
defaultDateSource: DateSource;
defaultDateStyle: DateStyle;
defaultGravatarsStyle: GravatarDefaultStyle;
defaultTimeFormat: string | null;
fileAnnotations: {
command: string | null;
};

+ 2
- 0
src/views/branchesView.ts View File

@ -192,9 +192,11 @@ export class BranchesView extends ViewBase
if (
!changed &&
!configuration.changed(e, 'defaultDateFormat') &&
!configuration.changed(e, 'defaultDateShortFormat') &&
!configuration.changed(e, 'defaultDateSource') &&
!configuration.changed(e, 'defaultDateStyle') &&
!configuration.changed(e, 'defaultGravatarsStyle') &&
!configuration.changed(e, 'defaultTimeFormat') &&
!configuration.changed(e, 'sortBranchesBy')
) {
return false;

+ 3
- 1
src/views/commitsView.ts View File

@ -325,9 +325,11 @@ export class CommitsView extends ViewBase {
if (
!changed &&
!configuration.changed(e, 'defaultDateFormat') &&
!configuration.changed(e, 'defaultDateShortFormat') &&
!configuration.changed(e, 'defaultDateSource') &&
!configuration.changed(e, 'defaultDateStyle') &&
!configuration.changed(e, 'defaultGravatarsStyle')
!configuration.changed(e, 'defaultGravatarsStyle') &&
!configuration.changed(e, 'defaultTimeFormat')
) {
return false;
}

+ 3
- 1
src/views/contributorsView.ts View File

@ -142,9 +142,11 @@ export class ContributorsView extends ViewBase
if (
!changed &&
!configuration.changed(e, 'defaultDateFormat') &&
!configuration.changed(e, 'defaultDateShortFormat') &&
!configuration.changed(e, 'defaultDateSource') &&
!configuration.changed(e, 'defaultDateStyle') &&
!configuration.changed(e, 'defaultGravatarsStyle')
!configuration.changed(e, 'defaultGravatarsStyle') &&
!configuration.changed(e, 'defaultTimeFormat')
) {
return false;
}

+ 2
- 0
src/views/fileHistoryView.ts View File

@ -89,9 +89,11 @@ export class FileHistoryView extends ViewBase
if (
!changed &&
!configuration.changed(e, 'defaultDateFormat') &&
!configuration.changed(e, 'defaultDateShortFormat') &&
!configuration.changed(e, 'defaultDateSource') &&
!configuration.changed(e, 'defaultDateStyle') &&
!configuration.changed(e, 'defaultGravatarsStyle') &&
!configuration.changed(e, 'defaultTimeFormat') &&
!configuration.changed(e, 'advanced', 'fileHistoryFollowsRenames') &&
!configuration.changed(e, 'advanced', 'fileHistoryShowAllBranches')
) {

+ 3
- 1
src/views/lineHistoryView.ts View File

@ -52,9 +52,11 @@ export class LineHistoryView extends ViewBase
if (
!changed &&
!configuration.changed(e, 'defaultDateFormat') &&
!configuration.changed(e, 'defaultDateShortFormat') &&
!configuration.changed(e, 'defaultDateSource') &&
!configuration.changed(e, 'defaultDateStyle') &&
!configuration.changed(e, 'defaultGravatarsStyle')
!configuration.changed(e, 'defaultGravatarsStyle') &&
!configuration.changed(e, 'defaultTimeFormat')
) {
return false;
}

+ 2
- 0
src/views/remotesView.ts View File

@ -178,9 +178,11 @@ export class RemotesView extends ViewBase {
if (
!changed &&
!configuration.changed(e, 'defaultDateFormat') &&
!configuration.changed(e, 'defaultDateShortFormat') &&
!configuration.changed(e, 'defaultDateSource') &&
!configuration.changed(e, 'defaultDateStyle') &&
!configuration.changed(e, 'defaultGravatarsStyle') &&
!configuration.changed(e, 'defaultTimeFormat') &&
!configuration.changed(e, 'integrations', 'enabled') &&
!configuration.changed(e, 'sortBranchesBy')
) {

+ 2
- 0
src/views/repositoriesView.ts View File

@ -104,9 +104,11 @@ export class RepositoriesView extends ViewBase
if (
!changed &&
!configuration.changed(e, 'defaultDateFormat') &&
!configuration.changed(e, 'defaultDateShortFormat') &&
!configuration.changed(e, 'defaultDateSource') &&
!configuration.changed(e, 'defaultDateStyle') &&
!configuration.changed(e, 'defaultGravatarsStyle') &&
!configuration.changed(e, 'defaultTimeFormat') &&
!configuration.changed(e, 'sortBranchesBy') &&
!configuration.changed(e, 'sortTagsBy')
) {

+ 3
- 1
src/views/searchAndCompareView.ts View File

@ -316,9 +316,11 @@ export class SearchAndCompareView extends ViewBase
if (
!changed &&
!configuration.changed(e, 'defaultDateFormat') &&
!configuration.changed(e, 'defaultDateShortFormat') &&
!configuration.changed(e, 'defaultDateSource') &&
!configuration.changed(e, 'defaultDateStyle') &&
!configuration.changed(e, 'defaultGravatarsStyle')
!configuration.changed(e, 'defaultGravatarsStyle') &&
!configuration.changed(e, 'defaultTimeFormat')
) {
return false;
}

+ 3
- 1
src/views/stashesView.ts View File

@ -138,9 +138,11 @@ export class StashesView extends ViewBase {
if (
!changed &&
!configuration.changed(e, 'defaultDateFormat') &&
!configuration.changed(e, 'defaultDateShortFormat') &&
!configuration.changed(e, 'defaultDateSource') &&
!configuration.changed(e, 'defaultDateStyle') &&
!configuration.changed(e, 'defaultGravatarsStyle')
!configuration.changed(e, 'defaultGravatarsStyle') &&
!configuration.changed(e, 'defaultTimeFormat')
) {
return false;
}

+ 2
- 0
src/views/tagsView.ts View File

@ -151,9 +151,11 @@ export class TagsView extends ViewBase {
if (
!changed &&
!configuration.changed(e, 'defaultDateFormat') &&
!configuration.changed(e, 'defaultDateShortFormat') &&
!configuration.changed(e, 'defaultDateSource') &&
!configuration.changed(e, 'defaultDateStyle') &&
!configuration.changed(e, 'defaultGravatarsStyle') &&
!configuration.changed(e, 'defaultTimeFormat') &&
!configuration.changed(e, 'sortTagsBy')
) {
return false;

+ 29
- 0
src/webviews/apps/settings/partials/dates.html View File

@ -89,6 +89,35 @@
></span>
</span>
</div>
<div class="setting">
<div class="setting__input">
<label for="defaultTimeFormat">Time&nbsp;format</label>
<input
id="defaultTimeFormat"
name="defaultTimeFormat"
type="text"
placeholder="defaults to h:mma"
data-setting
data-setting-preview
/>
<a
class="link__learn-more"
title="See Moment.js docs for valid date formats"
href="https://momentjs.com/docs/#/displaying/format/"
>
<i class="icon icon__info"></i>
</a>
</div>
<span class="setting__hint"
>Example date:
<span
data-setting-preview="defaultTimeFormat"
data-setting-preview-type="date"
data-setting-preview-default="h:mma"
></span>
</span>
</div>
</div>
</div>
</div>

+ 29
- 0
src/webviews/apps/welcome/welcome.html View File

@ -394,6 +394,35 @@
></span>
</span>
</div>
<div class="setting">
<div class="setting__input">
<label for="defaultTimeFormat">Time&nbsp;format</label>
<input
id="defaultTimeFormat"
name="defaultTimeFormat"
type="text"
placeholder="defaults to h:mma"
data-setting
data-setting-preview
/>
<a
class="link__learn-more"
title="See Moment.js docs for valid date formats"
href="https://momentjs.com/docs/#/displaying/format/"
>
<i class="icon icon__info"></i>
</a>
</div>
<span class="setting__hint"
>Example date:
<span
data-setting-preview="defaultTimeFormat"
data-setting-preview-type="date"
data-setting-preview-default="h:mma"
></span>
</span>
</div>
</div>
</div>
</section>

Loading…
Cancel
Save