1
1
mirror of https://github.com/Eugeny/tabby.git synced 2024-11-23 05:03:36 +03:00

settings: added release notes

This commit is contained in:
Eugene Pankov 2021-07-18 16:48:13 +02:00
parent 439e407595
commit ff49b9e38a
No known key found for this signature in database
GPG Key ID: 5896FCBBDD1CF4F4
15 changed files with 135 additions and 30 deletions

View File

@ -22,6 +22,7 @@
"@typescript-eslint/eslint-plugin": "^4.28.3",
"@typescript-eslint/parser": "^4.28.3",
"apply-loader": "2.0.0",
"axios": "^0.21.1",
"clone-deep": "^4.0.1",
"compare-versions": "^3.6.0",
"core-js": "^3.15.2",
@ -55,6 +56,7 @@
"pug-static-loader": "2.0.0",
"raw-loader": "4.0.2",
"sass-loader": "^12.1.0",
"shell-quote": "^1.7.2",
"shelljs": "0.8.4",
"slugify": "^1.5.3",
"sortablejs": "^1.14.0",
@ -67,7 +69,6 @@
"ts-loader": "^9.2.3",
"tslib": "^2.3.0",
"typedoc": "^0.21.4",
"shell-quote": "^1.7.2",
"typescript": "^4.3.5",
"url-loader": "^4.1.1",
"val-loader": "4.0.0",

View File

@ -6,9 +6,6 @@ import { BaseTabComponent } from '../components/baseTab.component'
@Component({
selector: 'tab-body',
template: `
<!--perfect-scrollbar [config]="{ suppressScrollX: true }" *ngIf="scrollable">
<ng-template #scrollablePlaceholder></ng-template>
</perfect-scrollbar-->
<ng-template #placeholder></ng-template>
`,
styles: [

View File

@ -20,7 +20,6 @@
"@angular/core": "^9.1.9"
},
"devDependencies": {
"axios": "^0.21.1",
"winston": "^3.3.3",
"electron-promise-ipc": "^2.2.4"
}

View File

@ -16,13 +16,6 @@ async@^3.1.0:
resolved "https://registry.yarnpkg.com/async/-/async-3.2.0.tgz#b3a2685c5ebb641d3de02d161002c60fc9f85720"
integrity sha512-TR2mEZFVOj2pLStYxLht7TyfuRzaydfpxr3k9RpHIzMgw7A64dzsdqCxH1WJyQdoe8T10nDXd9wnEigmiuHIZw==
axios@^0.21.1:
version "0.21.1"
resolved "https://registry.yarnpkg.com/axios/-/axios-0.21.1.tgz#22563481962f4d6bde9a76d516ef0e5d3c09b2b8"
integrity sha512-dKQiRHxGD9PPRIUNIWvZhPTPpl1rf/OxTYKsqKUDjBwYylTvV7SjSHJb9ratfyzM6wCdLCOYLzs73qpg5c4iGA==
dependencies:
follow-redirects "^1.10.0"
call-bind@^1.0.0, call-bind@^1.0.2:
version "1.0.2"
resolved "https://registry.yarnpkg.com/call-bind/-/call-bind-1.0.2.tgz#b1d4e89e688119c3c9a903ad30abb2f6a919be3c"
@ -150,11 +143,6 @@ fn.name@1.x.x:
resolved "https://registry.yarnpkg.com/fn.name/-/fn.name-1.1.0.tgz#26cad8017967aea8731bc42961d04a3d5988accc"
integrity sha512-GRnmB5gPyJpAhTQdSZTSp9uaPSvl09KoYcMQtsB9rQoOmzs9dH6ffeccH+Z+cv6P68Hu5bC6JjRh4Ah/mHSNRw==
follow-redirects@^1.10.0:
version "1.14.1"
resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.14.1.tgz#d9114ded0a1cfdd334e164e6662ad02bfd91ff43"
integrity sha512-HWqDgT7ZEkqRzBvc2s64vSZ/hfOceEol3ac/7tKwzuvEyWx3/4UegXh5oBOIotkGsObyk3xznnSRVADBgWSQVg==
function-bind@^1.1.1:
version "1.1.1"
resolved "https://registry.yarnpkg.com/function-bind/-/function-bind-1.1.1.tgz#a56899d3ea3c9bab874bb9773b7c5ede92f4895d"

View File

@ -18,7 +18,6 @@
"license": "MIT",
"devDependencies": {
"@types/semver": "^7.1.0",
"axios": "^0.21.1",
"semver": "^7.1.1"
},
"peerDependencies": {

View File

@ -7,18 +7,6 @@
resolved "https://registry.yarnpkg.com/@types/semver/-/semver-7.3.7.tgz#b9eb89d7dfa70d5d1ce525bc1411a35347f533a3"
integrity sha512-4g1jrL98mdOIwSOUh6LTlB0Cs9I0dQPwINUhBg7C6pN4HLr8GS8xsksJxilW6S6dQHVi2K/o+lQuQcg7LroCnw==
axios@^0.21.1:
version "0.21.1"
resolved "https://registry.yarnpkg.com/axios/-/axios-0.21.1.tgz#22563481962f4d6bde9a76d516ef0e5d3c09b2b8"
integrity sha512-dKQiRHxGD9PPRIUNIWvZhPTPpl1rf/OxTYKsqKUDjBwYylTvV7SjSHJb9ratfyzM6wCdLCOYLzs73qpg5c4iGA==
dependencies:
follow-redirects "^1.10.0"
follow-redirects@^1.10.0:
version "1.13.1"
resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.13.1.tgz#5f69b813376cee4fd0474a3aba835df04ab763b7"
integrity sha512-SSG5xmZh1mkPGyKzjZP8zLjltIfpW32Y5QpdNJyjcfGxK3qo3NDDkZOZSFiGn1A6SclQxY9GzEwAHQ3dmYRWpg==
lru-cache@^6.0.0:
version "6.0.0"
resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-6.0.0.tgz#6d6fe6570ebd96aaf90fcad1dafa3b2566db3a94"

View File

@ -18,6 +18,8 @@
"license": "MIT",
"devDependencies": {
"@types/deep-equal": "1.0.1",
"marked": "^2.1.3",
"ngx-infinite-scroll": "^10.0.1",
"utils-decorators": "^1.8.0"
},
"peerDependencies": {

View File

@ -0,0 +1,12 @@
.container(
infiniteScroll,
[infiniteScrollDistance]='2',
[infiniteScrollThrottle]='50',
infiniteScrollContainer='release-notes-tab',
[fromRoot]='true',
(scrolled)='onScrolled()'
)
div(*ngFor='let release of releases')
h1 {{release.name}}
.text-muted {{release.version}} / {{release.date|date:'mediumDate'}}
section([fastHtmlBind]='release.content')

View File

@ -0,0 +1,17 @@
:host {
overflow-y: scroll;
width: 100%;
padding: 30px;
}
::ng-deep img {
max-width: 100%;
}
h1 {
margin: 0;
}
section {
margin: 20px 0;
}

View File

@ -0,0 +1,47 @@
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
import axios from 'axios'
import marked from 'marked'
import { Component } from '@angular/core'
import { BaseTabComponent } from 'tabby-core'
export interface Release {
name: string
version: string
content: string
date: Date
}
/** @hidden */
@Component({
selector: 'release-notes-tab',
template: require('./releaseNotesTab.component.pug'),
styles: [require('./releaseNotesTab.component.scss')],
})
export class ReleaseNotesComponent extends BaseTabComponent {
releases: Release[] = []
lastPage = 1
constructor () {
super()
this.setTitle('Release notes')
this.loadReleases(1)
}
async loadReleases (page) {
console.log('Loading releases page', page)
const response = await axios.get(`https://api.github.com/repos/eugeny/tabby/releases?page=${page}`, {
headers: { Accept: 'application/vnd.github.v3+json' },
})
this.releases = this.releases.concat(response.data.map(r => ({
name: r.name,
version: r.tag_name,
content: marked(r.body),
date: new Date(r.created_at),
})))
this.lastPage = page
}
onScrolled () {
this.loadReleases(this.lastPage + 1)
}
}

View File

@ -23,6 +23,12 @@ button.btn.btn-warning.btn-block(*ngIf='config.restartRequested', '(click)'='res
i.fas.fa-bug
span Report a problem
button.btn.btn-secondary.mr-3(
(click)='showReleaseNotes()',
)
i.fas.fa-book
span What's new
button.btn.btn-secondary(
*ngIf='!updateAvailable && hostApp.platform !== Platform.Web',
(click)='checkForUpdates()',

View File

@ -11,9 +11,11 @@ import {
UpdaterService,
PlatformService,
HostWindowService,
AppService,
} from 'tabby-core'
import { SettingsTabProvider } from '../api'
import { ReleaseNotesComponent } from './releaseNotesTab.component'
/** @hidden */
@Component({
@ -42,6 +44,7 @@ export class SettingsTabComponent extends BaseTabComponent {
public platform: PlatformService,
public zone: NgZone,
private updater: UpdaterService,
private app: AppService,
@Inject(SettingsTabProvider) public settingsProviders: SettingsTabProvider[],
) {
super()
@ -115,4 +118,10 @@ export class SettingsTabComponent extends BaseTabComponent {
this.updateAvailable = await this.updater.check()
this.checkingForUpdate = false
}
showReleaseNotes () {
this.app.openNewTabRaw({
type: ReleaseNotesComponent,
})
}
}

View File

@ -2,6 +2,7 @@ import { NgModule } from '@angular/core'
import { BrowserModule } from '@angular/platform-browser'
import { FormsModule } from '@angular/forms'
import { NgbModule } from '@ng-bootstrap/ng-bootstrap'
import { InfiniteScrollModule } from 'ngx-infinite-scroll'
import TabbyCorePlugin, { ToolbarButtonProvider, HotkeyProvider, ConfigProvider } from 'tabby-core'
@ -15,6 +16,7 @@ import { WindowSettingsTabComponent } from './components/windowSettingsTab.compo
import { VaultSettingsTabComponent } from './components/vaultSettingsTab.component'
import { SetVaultPassphraseModalComponent } from './components/setVaultPassphraseModal.component'
import { ProfilesSettingsTabComponent } from './components/profilesSettingsTab.component'
import { ReleaseNotesComponent } from './components/releaseNotesTab.component'
import { SettingsTabProvider } from './api'
import { ButtonProvider } from './buttonProvider'
@ -29,6 +31,7 @@ import { HotkeySettingsTabProvider, WindowSettingsTabProvider, VaultSettingsTabP
FormsModule,
NgbModule,
TabbyCorePlugin,
InfiniteScrollModule,
],
providers: [
{ provide: ToolbarButtonProvider, useClass: ButtonProvider, multi: true },
@ -48,6 +51,7 @@ import { HotkeySettingsTabProvider, WindowSettingsTabProvider, VaultSettingsTabP
SetVaultPassphraseModalComponent,
VaultSettingsTabComponent,
WindowSettingsTabComponent,
ReleaseNotesComponent,
],
declarations: [
EditProfileModalComponent,
@ -60,6 +64,7 @@ import { HotkeySettingsTabProvider, WindowSettingsTabProvider, VaultSettingsTabP
SetVaultPassphraseModalComponent,
VaultSettingsTabComponent,
WindowSettingsTabComponent,
ReleaseNotesComponent,
],
})
export default class SettingsModule { } // eslint-disable-line @typescript-eslint/no-extraneous-class

View File

@ -2,11 +2,34 @@
# yarn lockfile v1
"@scarf/scarf@^1.1.0":
version "1.1.1"
resolved "https://registry.yarnpkg.com/@scarf/scarf/-/scarf-1.1.1.tgz#d8b9f20037b3a37dbf8dcdc4b3b72f9285bfce35"
integrity sha512-VGbKDbk1RFIaSmdVb0cNjjWJoRWRI/Weo23AjRCC2nryO0iAS8pzsToJfPVPtVs74WHw4L1UTADNdIYRLkirZQ==
"@types/deep-equal@1.0.1":
version "1.0.1"
resolved "https://registry.yarnpkg.com/@types/deep-equal/-/deep-equal-1.0.1.tgz#71cfabb247c22bcc16d536111f50c0ed12476b03"
integrity sha512-mMUu4nWHLBlHtxXY17Fg6+ucS/MnndyOWyOe7MmwkoMYxvfQU2ajtRaEvqSUv+aVkMqH/C0NCI8UoVfRNQ10yg==
marked@^2.1.3:
version "2.1.3"
resolved "https://registry.yarnpkg.com/marked/-/marked-2.1.3.tgz#bd017cef6431724fd4b27e0657f5ceb14bff3753"
integrity sha512-/Q+7MGzaETqifOMWYEA7HVMaZb4XbcRfaOzcSsHZEith83KGlvaSG33u0SKu89Mj5h+T8V2hM+8O45Qc5XTgwA==
ngx-infinite-scroll@^10.0.1:
version "10.0.1"
resolved "https://registry.yarnpkg.com/ngx-infinite-scroll/-/ngx-infinite-scroll-10.0.1.tgz#6f51f2f8775a7c50d1dd8bad125d4e748abbe880"
integrity sha512-7is0eJZ9kJPsaHohRmMhJ/QFHAW9jp9twO5HcHRvFM/Yl/R8QCiokgjwmH0/CR3MuxUanxfHZMfO3PbYTwlBEg==
dependencies:
"@scarf/scarf" "^1.1.0"
opencollective-postinstall "^2.0.2"
opencollective-postinstall@^2.0.2:
version "2.0.3"
resolved "https://registry.yarnpkg.com/opencollective-postinstall/-/opencollective-postinstall-2.0.3.tgz#7a0fff978f6dbfa4d006238fbac98ed4198c3259"
integrity sha512-8AV/sCtuzUeTo8gQK5qDZzARrulB3egtLzFgteqB2tcT4Mw7B8Kt7JcDHmltjz6FOAHsvTevk70gZEbhM4ZS9Q==
tinyqueue@^2.0.3:
version "2.0.3"
resolved "https://registry.yarnpkg.com/tinyqueue/-/tinyqueue-2.0.3.tgz#64d8492ebf39e7801d7bd34062e29b45b2035f08"

View File

@ -1159,6 +1159,13 @@ aws4@^1.2.1, aws4@^1.8.0:
resolved "https://registry.npmjs.org/aws4/-/aws4-1.11.0.tgz"
integrity sha512-xh1Rl34h6Fi1DC2WWKfxUTVqRsNnr6LsKz2+hfwDxQJWmrx8+c7ylaqBMcHfl1U1r2dsifOvKX3LQuLNZ+XSvA==
axios@^0.21.1:
version "0.21.1"
resolved "https://registry.yarnpkg.com/axios/-/axios-0.21.1.tgz#22563481962f4d6bde9a76d516ef0e5d3c09b2b8"
integrity sha512-dKQiRHxGD9PPRIUNIWvZhPTPpl1rf/OxTYKsqKUDjBwYylTvV7SjSHJb9ratfyzM6wCdLCOYLzs73qpg5c4iGA==
dependencies:
follow-redirects "^1.10.0"
babel-runtime@^6.26.0:
version "6.26.0"
resolved "https://registry.yarnpkg.com/babel-runtime/-/babel-runtime-6.26.0.tgz#965c7058668e82b55d7bfe04ff2337bc8b5647fe"
@ -3109,6 +3116,11 @@ flush-write-stream@^1.0.0:
inherits "^2.0.1"
readable-stream "^2.0.4"
follow-redirects@^1.10.0:
version "1.14.1"
resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.14.1.tgz#d9114ded0a1cfdd334e164e6662ad02bfd91ff43"
integrity sha512-HWqDgT7ZEkqRzBvc2s64vSZ/hfOceEol3ac/7tKwzuvEyWx3/4UegXh5oBOIotkGsObyk3xznnSRVADBgWSQVg==
forever-agent@~0.6.1:
version "0.6.1"
resolved "https://registry.yarnpkg.com/forever-agent/-/forever-agent-0.6.1.tgz#fbc71f0c41adeb37f96c577ad1ed42d8fdacca91"