diff --git a/CHANGELOG.md b/CHANGELOG.md index 33d8b65ca..cca7cadad 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,13 +3,15 @@ All notable changes to this project will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org/). Use the following format for additions: ` - VERSION: [feature/patch (if applicable)] Short description of change. Links to relevant issues/PRs.` +- Unreleased: + - Updated Octicons - 1.4.48: fix the width value of the header logo [#1221](https://github.com/FredrikNoren/ungit/pull/1221) -- 1.4.47: make diff2html line numbers and +/- prefixes unnselectable [#1214](https://github.com/FredrikNoren/ungit/issues/1214), [#1215](https://github.com/FredrikNoren/ungit/pull/1215) +- 1.4.47: make diff2html line numbers and +/- prefixes unselectable [#1214](https://github.com/FredrikNoren/ungit/issues/1214), [#1215](https://github.com/FredrikNoren/ungit/pull/1215) - 1.4.46: force git out put to be in English within ungit [#1208](https://github.com/FredrikNoren/ungit/pull/1208) -- 1.4.45: Improve styling of .gitignore edit dialog +- 1.4.45: Improve styling of .gitignore edit dialog [#1205](https://github.com/FredrikNoren/ungit/pull/1205) - 1.4.44: add config to disable numstat in staged diff to better performance [#1193](https://github.com/FredrikNoren/ungit/issues/1193) - 1.4.43: - - fix gitignore manual edit not being saved [644](https://github.com/FredrikNoren/ungit/issues/644) + - fix gitignore manual edit not being saved [#644](https://github.com/FredrikNoren/ungit/issues/644) - fix issue with detached git processes on some OS and timeout not being enforced. - simplify `maxSearchIteration` enforcement for git.log() - change `alwaysLoadActiveBranch` boolean config to `maxActiveBranchSearchIteration` numeric config @@ -38,13 +40,13 @@ Use the following format for additions: ` - VERSION: [feature/patch (if applicab - 1.4.29: - Add `--no-optional-locks` if git version is appropriate [#1105](https://github.com/FredrikNoren/ungit/issues/1105) - Ensure ungit server to bind to `127.0.0.1` [#988](https://github.com/FredrikNoren/ungit/issues/988) - - Add node highlight on mouse hover on relationsip path [#1093](https://github.com/FredrikNoren/ungit/issues/1093) + - Add node highlight on mouse hover on relationship path [#1093](https://github.com/FredrikNoren/ungit/issues/1093) - 1.4.28: adding raven locally for offline access. [#1107](https://github.com/FredrikNoren/ungit/pull/1107) - 1.4.27: logic change for the merge conflict resolution - 1.4.26: add a way to preconfigure repo lists [#1106](https://github.com/FredrikNoren/ungit/issues/1106) - 1.4.25: add git pgp signing docs and code [#740](https://github.com/FredrikNoren/ungit/issues/740) - 1.4.24: - - change `/api/log` -> `/api/gitlog` as soem ad blockers really hates This + - change `/api/log` -> `/api/gitlog` as some ad blockers really hates This - Fix excessive error messaging when disconnected from internet - Fix Raven initialization error when disconnected from internet - 1.4.23: diff --git a/Gruntfile.js b/Gruntfile.js index 283c189f9..066f9b3e4 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -12,9 +12,9 @@ const maxConcurrency = 5; module.exports = (grunt) => { const packageJson = grunt.file.readJSON('package.json'); const lessFiles = { - "public/css/styles.css": ["public/less/styles.less", "public/vendor/css/animate.css", "public/less/d2h.less"] - } - fs.readdirSync("./components").map((component) => `components/${component}/${component}`) + 'public/css/styles.css': ['public/less/styles.less', 'public/vendor/css/animate.css', 'public/less/d2h.less'] + }; + fs.readdirSync('./components').map((component) => `components/${component}/${component}`) .forEach((str) => lessFiles[`${str}.css`] = `${str}.less`); grunt.initConfig({ @@ -104,10 +104,10 @@ module.exports = (grunt) => { imageEmbed: { default: { files: { - "public/css/styles.css": [ "public/css/styles.css" ], - "components/graph/graph.css": ["components/graph/graph.css"], - "components/header/header.css": ["components/header/header.css"], - "components/staging/staging.css": ["components/staging/staging.css"], + 'public/css/styles.css': [ 'public/css/styles.css' ], + 'components/graph/graph.css': ['components/graph/graph.css'], + 'components/header/header.css': ['components/header/header.css'], + 'components/staging/staging.css': ['components/staging/staging.css'], }, options: { deleteAfterEncoding: false @@ -184,8 +184,6 @@ module.exports = (grunt) => { main: { files: [ // includes files within path - { expand: true, flatten: true, src: ['node_modules/octicons/octicons/octicons.ttf'], dest: 'public/css/' }, - { expand: true, flatten: true, src: ['node_modules/octicons/octicons/octicons.woff'], dest: 'public/css/' }, { expand: true, flatten: true, src: ['node_modules/nprogress/nprogress.css'], dest: 'public/css/' }, { expand: true, flatten: true, src: ['node_modules/jquery-ui-bundle/jquery-ui.min.css'], dest: 'public/css/'}, { expand: true, flatten: true, src: ['node_modules/raven-js/dist/raven.min.js'], dest: 'public/js/' } @@ -300,6 +298,7 @@ module.exports = (grunt) => { b.require('nprogress', { expose: 'nprogress' }); b.require('jquery', { expose: 'jquery' }); b.require('dnd-page-scroll', { expose: 'dnd-page-scroll' }); + b.require('@primer/octicons', { expose: 'octicons' }); const outFile = fs.createWriteStream('./public/js/ungit.js'); outFile.on('close', () => done()); b.bundle().pipe(outFile); @@ -341,7 +340,7 @@ module.exports = (grunt) => { const bumpDependency = (packageJson, packageName) => { return new Bluebird((resolve, reject) => { - const dependencyType = packageJson['dependencies'][packageName] ? 'dependencies' : 'devDependencies' + const dependencyType = packageJson['dependencies'][packageName] ? 'dependencies' : 'devDependencies'; let currentVersion = packageJson[dependencyType][packageName]; if (currentVersion[0] == '~' || currentVersion[0] == '^') currentVersion = currentVersion.slice(1); npm.commands.show([packageName, 'versions'], true, (err, data) => { @@ -356,24 +355,24 @@ module.exports = (grunt) => { resolve(); }); }); - } + }; const updatePackageJsonBuildVersion = (commitHash) => { const packageJson = JSON.parse(fs.readFileSync('package.json')); packageJson.version += `+${commitHash}`; fs.writeFileSync('package.json', `${JSON.stringify(packageJson, null, 2)}\n`); - } + }; grunt.registerTask('travisnpmpublish', 'Automatically publish to NPM via travis.', function() { const done = this.async(); if (process.env.TRAVIS_BRANCH != 'master' || (process.env.TRAVIS_PULL_REQUEST && process.env.TRAVIS_PULL_REQUEST != 'false')) { console.log('Skipping travis npm publish'); return done(); } - childProcess.exec("git rev-parse --short HEAD", (err, stdout, stderr) => { + childProcess.exec('git rev-parse --short HEAD', (err, stdout, stderr) => { const hash = stdout.trim(); updatePackageJsonBuildVersion(hash); fs.writeFileSync('.npmrc', '//registry.npmjs.org/:_authToken=' + process.env.NPM_TOKEN); - childProcess.exec("npm publish", (err) => { done(err); }); + childProcess.exec('npm publish', (err) => { done(err); }); }); }); @@ -388,9 +387,9 @@ module.exports = (grunt) => { const done = this.async(); fs.readdirAsync('./nmclicktests') - .then((files) => files.filter((file) => file.startsWith("spec."))) + .then((files) => files.filter((file) => file.startsWith('spec.'))) .then((tests) => { - const genericIndx = tests.indexOf("spec.generic.js") + const genericIndx = tests.indexOf('spec.generic.js'); if (genericIndx > -1) { tests.splice(0, 0, tests.splice(genericIndx, 1)[0]); } @@ -398,8 +397,8 @@ module.exports = (grunt) => { }).then((tests) => { grunt.log.writeln('Running click tests in parallel... (this will take a while...)'); return Bluebird.map(tests, (file) => { - let output = ""; - const outStream = (data) => output += data + let output = ''; + const outStream = (data) => output += data; grunt.log.writeln(cliColor.set(`Clicktest started! \t${file}`, 'blue')); return new Bluebird((resolve, reject) => { @@ -422,9 +421,9 @@ module.exports = (grunt) => { let isSuccess = true; results.forEach((result) => { if (!result.isSuccess) { - grunt.log.writeln(`---- start of ${result.name} log ----`) + grunt.log.writeln(`---- start of ${result.name} log ----`); grunt.log.writeln(result.output); - grunt.log.writeln(`----- end of ${result.name} log -----`) + grunt.log.writeln(`----- end of ${result.name} log -----`); isSuccess = false; } }); @@ -437,15 +436,13 @@ module.exports = (grunt) => { grunt.log.writeln('Bumping dependencies...'); npm.load(() => { const tempPackageJson = JSON.parse(JSON.stringify(packageJson)); - const keys = Object.keys(tempPackageJson.dependencies).concat(Object.keys(tempPackageJson.devDependencies)) + const keys = Object.keys(tempPackageJson.dependencies).concat(Object.keys(tempPackageJson.devDependencies)); const bumps = Bluebird.map(keys, (dep) => { // winston 3.x has different API if (dep == 'winston') return; // babel 7.x.x has alot of changes.... :( if (dep.indexOf('babel') > -1) return; - // Octicon moved to SCSS instead of less - if (dep == 'octicons') return; return bumpDependency(tempPackageJson, dep); }); diff --git a/components/branches/branches.html b/components/branches/branches.html index b761c3f40..015b2741e 100644 --- a/components/branches/branches.html +++ b/components/branches/branches.html @@ -1,6 +1,6 @@
diff --git a/components/commit/commit.js b/components/commit/commit.js index ba66ecde9..eb74785d2 100644 --- a/components/commit/commit.js +++ b/components/commit/commit.js @@ -1,10 +1,8 @@ - const ko = require('knockout'); -const components = require('ungit-components'); -const navigation = require('ungit-navigation'); -const programEvents = require('ungit-program-events'); const md5 = require('blueimp-md5'); const moment = require('moment'); +const octicons = require('octicons'); +const components = require('ungit-components'); components.register('commit', args => new CommitViewModel(args)); @@ -17,6 +15,7 @@ class CommitViewModel { this.nodeIsMousehover = gitNode.nodeIsMousehover; this.selected = gitNode.selected; this.pgpVerifiedString = gitNode.pgpVerifiedString; + this.pgpIcon = octicons.verified.toSVG({ 'height': 18 }); this.element = ko.observable(); this.commitTime = ko.observable(); this.authorTime = ko.observable(); @@ -30,13 +29,13 @@ class CommitViewModel { this.fileLineDiffs = ko.observable(); this.numberOfAddedLines = ko.observable(); this.numberOfRemovedLines = ko.observable(); - this.authorGravatar = ko.computed(() => md5((this.authorEmail() || "").trim().toLowerCase())); + this.authorGravatar = ko.computed(() => md5((this.authorEmail() || '').trim().toLowerCase())); this.showCommitDiff = ko.computed(() => this.fileLineDiffs() && this.fileLineDiffs().length > 0); this.diffStyle = ko.computed(() => { const marginLeft = Math.min((gitNode.branchOrder() * 70), 450) * -1; - if (this.selected() && this.element()) return { "margin-left": `${marginLeft}px`, width: `${window.innerWidth - 220}px` }; + if (this.selected() && this.element()) return { 'margin-left': `${marginLeft}px`, width: `${window.innerWidth - 220}px` }; else return {}; }); } diff --git a/components/commit/commit.less b/components/commit/commit.less index 360ab65b8..14706a66e 100644 --- a/components/commit/commit.less +++ b/components/commit/commit.less @@ -1,12 +1,7 @@ - @import "public/less/variables.less"; .commit { position: relative; - .octicon-key { - color: #428bca; - margin-left: 5px; - } &.highlighted { z-index: 2; diff --git a/components/graph/git-node.js b/components/graph/git-node.js index 3e470b716..0941c9d5a 100644 --- a/components/graph/git-node.js +++ b/components/graph/git-node.js @@ -1,9 +1,8 @@ const $ = require('jquery'); const ko = require('knockout'); const components = require('ungit-components'); -const Selectable = require('./selectable'); -const Animateable = require('./animateable'); const programEvents = require('ungit-program-events'); +const Animateable = require('./animateable'); const GraphActions = require('./git-graph-actions'); const maxBranchesToDisplay = parseInt(ungit.config.numRefsToShow / 5 * 3); // 3/5 of refs to show to branches @@ -27,7 +26,7 @@ class GitNodeViewModel extends Animateable { this.signatureMade = ko.observable(); this.pgpVerifiedString = ko.computed(() => { if (this.signatureMade()) { - return `PGP by: ${this.signatureMade()} at ${this.signatureDate()}` + return `PGP by: ${this.signatureMade()} at ${this.signatureDate()}`; } }); @@ -169,7 +168,7 @@ class GitNodeViewModel extends Animateable { showRefSearchForm(obj, event) { this.refSearchFormVisible(true); - const textBox = event.target.nextElementSibling.firstElementChild; // this may not be the best idea... + const textBox = event.currentTarget.nextElementSibling.firstElementChild; // this may not be the best idea... $(textBox).autocomplete({ source: this.refs().filter(ref => !ref.isHEAD), minLength: 0, @@ -188,19 +187,19 @@ class GitNodeViewModel extends Animateable { } }).focus(() => { $(this).autocomplete('search', $(this).val()); - }).data("ui-autocomplete")._renderItem = (ul, item) => $("
  • ") + }).data('ui-autocomplete')._renderItem = (ul, item) => $('
  • ') .append(`${item.dom}`) - .appendTo(ul) + .appendTo(ul); $(textBox).autocomplete('search', ''); } createBranch() { if (!this.canCreateRef()) return; - this.graph.server.postPromise("/branches", { path: this.graph.repoPath(), name: this.newBranchName(), sha1: this.sha1 }) + this.graph.server.postPromise('/branches', { path: this.graph.repoPath(), name: this.newBranchName(), sha1: this.sha1 }) .then(() => { - this.graph.getRef(`refs/heads/${this.newBranchName()}`).node(this) + this.graph.getRef(`refs/heads/${this.newBranchName()}`).node(this); if (ungit.config.autoCheckoutOnBranchCreate) { - return this.graph.server.postPromise("/checkout", { path: this.graph.repoPath(), name: this.newBranchName() }) + return this.graph.server.postPromise('/checkout', { path: this.graph.repoPath(), name: this.newBranchName() }); } }).catch((e) => this.graph.server.unhandledRejection(e)) .finally(() => { diff --git a/components/graph/git-ref.js b/components/graph/git-ref.js index 2c263b5ea..ebc0edabb 100644 --- a/components/graph/git-ref.js +++ b/components/graph/git-ref.js @@ -1,9 +1,10 @@ const ko = require('knockout'); const md5 = require('blueimp-md5'); -const Selectable = require('./selectable'); +const promise = require('bluebird'); +const octicons = require('octicons'); const programEvents = require('ungit-program-events'); const components = require('ungit-components'); -const promise = require('bluebird'); +const Selectable = require('./selectable'); class RefViewModel extends Selectable { constructor(fullRefName, graph) { @@ -40,7 +41,7 @@ class RefViewModel extends Selectable { if (this.isRemoteTag) { this.localRefName = this.name.slice('remote-tag: '.length); } - const splitedName = this.localRefName.split('/') + const splitedName = this.localRefName.split('/'); if (this.isRemote) { // get rid of the origin/ part of origin/branchname this.remote = splitedName[0]; @@ -54,29 +55,29 @@ class RefViewModel extends Selectable { this.node.subscribe(oldNode => { if (oldNode) oldNode.removeRef(this); - }, null, "beforeChange"); + }, null, 'beforeChange'); this.node.subscribe(newNode => { if (newNode) newNode.pushRef(this); }); // This optimization is for autocomplete display - this.value = splitedName[splitedName.length - 1] - this.label = this.localRefName - this.dom = `${this.localRefName}` - this.displayName = ko.computed(() => { + this.value = splitedName[splitedName.length - 1]; + this.label = this.localRefName; + this.dom = `${this.localRefName}${octicons[(this.isTag ? 'tag': 'git-branch')].toSVG({ 'height': 18 })}`; + + this.displayHtml = (largeCurrent) => { + const size = (largeCurrent && this.current()) ? 26 : 18; let prefix = ''; if (this.isRemote) { - prefix = ' '; + prefix = `${octicons.globe.toSVG({ 'height': size })} `; } if (this.isBranch) { - prefix += ' '; - } else if (this.current()) { - prefix += ' '; + prefix += `${octicons['git-branch'].toSVG({ 'height': size })} `; } else if (this.isTag) { - prefix += ' '; + prefix += `${octicons.tag.toSVG({ 'height': size })} `; } return prefix + this.localRefName; - }); + }; } _colorFromHashOfString(string) { diff --git a/components/graph/graph.html b/components/graph/graph.html index 4f187e042..616836673 100644 --- a/components/graph/graph.html +++ b/components/graph/graph.html @@ -14,22 +14,18 @@ - - - + dragStart: dragStart, dragEnd: dragEnd, attr: { 'data-ta-name': localRefName, 'data-ta-local': isLocal }"> - - - @@ -43,7 +39,7 @@ - +
    @@ -56,12 +52,10 @@ - - -
    + +
    - diff --git a/components/graph/graph.js b/components/graph/graph.js index e8b9c1c33..e0618a93d 100644 --- a/components/graph/graph.js +++ b/components/graph/graph.js @@ -1,10 +1,11 @@ const ko = require('knockout'); +const _ = require('lodash'); +const moment = require('moment'); +const octicons = require('octicons'); const components = require('ungit-components'); const programEvents = require('ungit-program-events'); const GitNodeViewModel = require('./git-node'); const GitRefViewModel = require('./git-ref'); -const _ = require('lodash'); -const moment = require('moment'); const EdgeViewModel = require('./edge'); const numberOfNodesPerLoad = ungit.config.numberOfNodesPerLoad; @@ -67,6 +68,8 @@ class GraphViewModel { this.updateBranches(); this.graphWidth = ko.observable(); this.graphHeight = ko.observable(800); + this.searchIcon = octicons.search.toSVG({ 'height': 18 }); + this.plusIcon = octicons.plus.toSVG({ 'height': 18 }); } updateNode(parentElement) { @@ -164,7 +167,7 @@ class GraphViewModel { // First occurrence of the branch, find an empty slot for the branch if (ideologicalBranch.lastSlottedTimeStamp != updateTimeStamp) { ideologicalBranch.lastSlottedTimeStamp = updateTimeStamp; - ideologicalBranch.branchOrder = branchSlotCounter++ + ideologicalBranch.branchOrder = branchSlotCounter++; } node.branchOrder(ideologicalBranch.branchOrder); @@ -267,7 +270,7 @@ class GraphViewModel { .then(res => { this.checkedOutBranch(res); }) .catch(err => { if (err.errorCode != 'not-a-repository') this.server.unhandledRejection(err); - }) + }); } setRemoteTags(remoteTags) { @@ -278,10 +281,10 @@ class GraphViewModel { if (tag.name.includes('^{}')) { // This tag is a dereference tag, use this sha1. const tagRef = tag.name.slice(0, tag.name.length - '^{}'.length); - sha1Map[tagRef] = tag.sha1 + sha1Map[tagRef] = tag.sha1; } else if (!sha1Map[tag.name]) { // If sha1 wasn't previously set, use this sha1 - sha1Map[tag.name] = tag.sha1 + sha1Map[tag.name] = tag.sha1; } }); diff --git a/components/graph/graph.less b/components/graph/graph.less index 10af42911..f7b4f963e 100644 --- a/components/graph/graph.less +++ b/components/graph/graph.less @@ -71,9 +71,6 @@ font-size: 20px; margin-top: 2px; margin-bottom: -2px; - .octicon { - font-size: 20px; - } } &.remote { color: #5DB4FF; diff --git a/components/header/header.html b/components/header/header.html index af094c03a..3056c4cf8 100644 --- a/components/header/header.html +++ b/components/header/header.html @@ -1,6 +1,4 @@ -