From dfca9ac587dad272fbce412da30bf8ef20edf17a Mon Sep 17 00:00:00 2001 From: huangxingguang <591269@gmail.com> Date: Sat, 3 Apr 2021 20:26:59 +0800 Subject: [PATCH 1/3] view btn --- package.json | 2 +- src/settingsTab.component.pug | 26 ++++++++++++++++++-------- src/settingsTab.component.ts | 11 +++++++++-- 3 files changed, 28 insertions(+), 11 deletions(-) diff --git a/package.json b/package.json index 4db1608..aebd5b4 100755 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "terminus-sync-config", - "version": "1.0.0", + "version": "1.0.1", "description": "Sync configuration files to GitHub Gist or Gitee Gist", "keywords": [ "terminus-plugin" diff --git a/src/settingsTab.component.pug b/src/settingsTab.component.pug index cd70e2d..39d684e 100644 --- a/src/settingsTab.component.pug +++ b/src/settingsTab.component.pug @@ -22,14 +22,23 @@ h3 Sync Config [(ngModel)]='config.store.syncConfig.token', (ngModelChange)='config.save()', ) - .form-group - label Gist - input.form-control( - type='text', - placeholder="use existing gist id or automatic generation gist id", - [(ngModel)]='config.store.syncConfig.gist', - (ngModelChange)='config.save()', - ) + .form-row + .form-group.col-md-9 + label Gist + input.form-control( + type='text', + placeholder="use existing gist id or automatic generation gist id", + [(ngModel)]='config.store.syncConfig.gist', + (ngModelChange)='config.save()', + ) + .form-group.col-md-3.d-none.d-md-block + label    + button.btn.btn-outline-secondary.form-control( + [disabled]='config.store.syncConfig.gist === "" || config.store.syncConfig.type !== "GitHub"', + (click)='viewGist(config.store.syncConfig.type,config.store.syncConfig.gist)' + ) + div.fa.fa-fw.fa-eye + span.ml-2 View .form-group button.btn.btn-outline-primary.mr-3( (click)='sync(true)', @@ -38,6 +47,7 @@ h3 Sync Config div.fa.fa-fw.fa-upload(*ngIf='!isUploading') div.fa.fa-cog.fa-spin(*ngIf='isUploading') span.ml-2 Upload config + .mt-3.d-sm-none button.btn.btn-outline-warning( (click)='sync(false)', style={'margin-right':'10px'}, diff --git a/src/settingsTab.component.ts b/src/settingsTab.component.ts index 072f195..d879d77 100644 --- a/src/settingsTab.component.ts +++ b/src/settingsTab.component.ts @@ -1,6 +1,5 @@ -/* eslint-disable @typescript-eslint/explicit-module-boundary-types */ import { Component, OnInit } from '@angular/core' -import { ConfigService, } from 'terminus-core' +import { ConfigService, ElectronService, } from 'terminus-core' import { ToastrService } from 'ngx-toastr' import { getGist, syncGist } from 'api'; @@ -15,6 +14,7 @@ export class SyncConfigSettingsTabComponent implements OnInit { constructor( public config: ConfigService, private toastr: ToastrService, + private electron: ElectronService, ) { } @@ -86,4 +86,11 @@ export class SyncConfigSettingsTabComponent implements OnInit { } + viewGist(type: string, gist: string): void { + if (type === 'GitHub') { + this.electron.shell.openExternal('https://gist.github.com/' + gist) + } + + } + } From 44c6d733c8b079e6ec6873fedc5d7c0b34c9827d Mon Sep 17 00:00:00 2001 From: huangxingguang <591269@gmail.com> Date: Tue, 6 Apr 2021 00:03:08 +0800 Subject: [PATCH 2/3] devtoolModuleFilenameTemplate --- webpack.config.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/webpack.config.js b/webpack.config.js index a5a69ae..31e343c 100755 --- a/webpack.config.js +++ b/webpack.config.js @@ -11,7 +11,7 @@ module.exports = { filename: 'index.js', pathinfo: true, libraryTarget: 'umd', - devtoolModuleFilenameTemplate: 'webpack-terminus-save-output:///[resource-path]', + devtoolModuleFilenameTemplate: 'webpack-terminus-sync-config:///[resource-path]', }, resolve: { modules: ['.', 'src', 'node_modules'].map(x => path.join(__dirname, x)), From 407be3cc99cd51f77b0c328507ae513a5b03500a Mon Sep 17 00:00:00 2001 From: huangxingguang <591269@gmail.com> Date: Tue, 6 Apr 2021 00:51:44 +0800 Subject: [PATCH 3/3] 1.0.1 --- package.json | 3 +-- yarn.lock | 23 ++--------------------- 2 files changed, 3 insertions(+), 23 deletions(-) diff --git a/package.json b/package.json index aebd5b4..063a091 100755 --- a/package.json +++ b/package.json @@ -8,7 +8,7 @@ "main": "dist/index.js", "typings": "dist/index.d.ts", "scripts": { - "build": "webpack --progress --color", + "build": "webpack --progress --color --mode=production", "watch": "webpack --progress --color --watch", "prepublishOnly": "npm run build" }, @@ -34,7 +34,6 @@ "pug": "^2.0.3", "pug-loader": "^2.4.0", "rxjs": "^6.2.1", - "sanitize-filename": "^1.6.3", "sass-loader": "^11.0.1", "strip-ansi": "^5.0.0", "style-loader": "^2.0.0", diff --git a/yarn.lock b/yarn.lock index 26c50fd..916b041 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3042,8 +3042,8 @@ run-script-os@^1.1.3: rxjs@^6.2.1: version "6.6.7" - resolved "https://registry.npm.taobao.org/rxjs/download/rxjs-6.6.7.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Frxjs%2Fdownload%2Frxjs-6.6.7.tgz#90ac018acabf491bf65044235d5863c4dab804c9" - integrity sha1-kKwBisq/SRv2UEQjXVhjxNq4BMk= + resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-6.6.7.tgz#90ac018acabf491bf65044235d5863c4dab804c9" + integrity sha512-hTdwr+7yYNIT5n4AMYp85KA6yw2Va0FLa3Rguvbpa4W3I5xynaBZo41cM3XM+4Q6fRMj3sBYIR1VAmZMXYJvRQ== dependencies: tslib "^1.9.0" @@ -3069,13 +3069,6 @@ safer-buffer@^2.0.2, safer-buffer@^2.1.0, safer-buffer@~2.1.0: resolved "https://registry.npm.taobao.org/safer-buffer/download/safer-buffer-2.1.2.tgz#44fa161b0187b9549dd84bb91802f9bd8385cd6a" integrity sha1-RPoWGwGHuVSd2Eu5GAL5vYOFzWo= -sanitize-filename@^1.6.3: - version "1.6.3" - resolved "https://registry.npm.taobao.org/sanitize-filename/download/sanitize-filename-1.6.3.tgz#755ebd752045931977e30b2025d340d7c9090378" - integrity sha1-dV69dSBFkxl34wsgJdNA18kJA3g= - dependencies: - truncate-utf8-bytes "^1.0.0" - sass-graph@2.2.5: version "2.2.5" resolved "https://registry.npm.taobao.org/sass-graph/download/sass-graph-2.2.5.tgz#a981c87446b8319d96dce0671e487879bd24c2e8" @@ -3585,13 +3578,6 @@ trim-newlines@^1.0.0: dependencies: glob "^7.1.2" -truncate-utf8-bytes@^1.0.0: - version "1.0.2" - resolved "https://registry.npm.taobao.org/truncate-utf8-bytes/download/truncate-utf8-bytes-1.0.2.tgz#405923909592d56f78a5818434b0b78489ca5f2b" - integrity sha1-QFkjkJWS1W94pYGENLC3hInKXys= - dependencies: - utf8-byte-length "^1.0.1" - tslib@^1.9.0: version "1.14.1" resolved "https://registry.npm.taobao.org/tslib/download/tslib-1.14.1.tgz?cache=0&sync_timestamp=1609887438976&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Ftslib%2Fdownload%2Ftslib-1.14.1.tgz#cf2d38bdc34a134bcaf1091c41f6619e2f672d00" @@ -3706,11 +3692,6 @@ use@^3.1.0: resolved "https://registry.npm.taobao.org/use/download/use-3.1.1.tgz#d50c8cac79a19fbc20f2911f56eb973f4e10070f" integrity sha1-1QyMrHmhn7wg8pEfVuuXP04QBw8= -utf8-byte-length@^1.0.1: - version "1.0.4" - resolved "https://registry.npm.taobao.org/utf8-byte-length/download/utf8-byte-length-1.0.4.tgz#f45f150c4c66eee968186505ab93fcbb8ad6bf61" - integrity sha1-9F8VDExm7uloGGUFq5P8u4rWv2E= - util-deprecate@^1.0.2, util-deprecate@~1.0.1: version "1.0.2" resolved "https://registry.npm.taobao.org/util-deprecate/download/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf"