Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tab views #181

Merged
merged 110 commits into from
May 15, 2017
Merged
Show file tree
Hide file tree
Changes from 61 commits
Commits
Show all changes
110 commits
Select commit Hold shift + click to select a range
2d3e6e1
testing must move some more things to make it work and probably is no…
45kb Feb 24, 2017
967324e
going on must move some more things
45kb Feb 24, 2017
d2a11dc
some more pieces
45kb Feb 25, 2017
ddfe7d8
fixed keyboard
45kb Feb 25, 2017
5f0b705
some more pieces
45kb Feb 25, 2017
6e1a94b
Merge branch 'master' into tab-views
45kb Mar 7, 2017
a4576fd
merging master
45kb Mar 7, 2017
e9cf441
merging with master
45kb Mar 7, 2017
95a0627
merging master
45kb Mar 7, 2017
79d1197
merging master
45kb Mar 7, 2017
becb544
merging master
45kb Mar 7, 2017
9cde1e8
merging master
45kb Mar 7, 2017
355c37d
merging master
45kb Mar 7, 2017
41b2b38
merging master
45kb Mar 7, 2017
a905885
tried apply and without but evalAsync is the only way atm
45kb Mar 7, 2017
b5d2b62
isolate ng tag input
45kb Mar 7, 2017
2f83d74
new widths
45kb Mar 8, 2017
07158c4
new widths
45kb Mar 8, 2017
65f2015
new widths
45kb Mar 8, 2017
8e4e943
new widths
45kb Mar 8, 2017
d9ff11e
new widths
45kb Mar 8, 2017
5b3cbe9
going on
45kb Mar 8, 2017
4dfcc63
going on
45kb Mar 8, 2017
cebf9f5
tabs style and deletion
45kb Mar 8, 2017
f33ca26
tabs style
45kb Mar 8, 2017
94428cb
tabs style
45kb Mar 8, 2017
2abe67b
css fixs
45kb Mar 8, 2017
ed0e2e3
going on
45kb Mar 8, 2017
d47e749
going on
45kb Mar 8, 2017
9891f89
fix for installation prompt
45kb Mar 9, 2017
53a7801
some more style
45kb Mar 10, 2017
7e7dfc8
some more style
45kb Mar 10, 2017
b2a0f0a
fix for layout
45kb Mar 10, 2017
d2c0072
fix for layout nad style
45kb Mar 10, 2017
f073796
fix for layout nad style
45kb Mar 10, 2017
67bdcdf
fix for layout nad style and new filter to return last dirname in pat…
45kb Mar 10, 2017
fcb070d
fix for layout
45kb Mar 10, 2017
16df067
fix for tabs
45kb Mar 11, 2017
78abe11
fix for tab buttons
45kb Mar 11, 2017
0ebc1a4
some layout fix
45kb Mar 11, 2017
fbc05e9
fixing
45kb Mar 11, 2017
b80e14d
moving things
45kb Mar 11, 2017
efccbcf
fixing layout
45kb Mar 11, 2017
a4e7611
fixing layout
45kb Mar 11, 2017
1425212
explicit text button
45kb Mar 11, 2017
1c8e003
delete tab on project deletion
45kb Mar 11, 2017
7dbfca4
no need for forEach loop damn me
45kb Mar 11, 2017
37f0c09
layout fixing
45kb Mar 12, 2017
0fc6b4c
is now selecting globals
45kb Mar 12, 2017
f44fa4c
layout fixing
45kb Mar 12, 2017
2f007f4
little fix
45kb Mar 12, 2017
6ce222a
little fix for layout
45kb Mar 12, 2017
3f8c09c
moving actions inside each directive
45kb Mar 12, 2017
1fee448
flags
45kb Mar 12, 2017
f7787d6
things start to work
45kb Mar 12, 2017
2fa469c
concurrent installations and actions won't work
45kb Mar 12, 2017
a3364e4
npm into spawned processes
45kb Apr 23, 2017
ae0f2be
npm into spawned processes
wouldgo Apr 23, 2017
b3a0acd
Merge branch 'tab-views' of https://github.com/720kb/ndm into tab-views
45kb Apr 23, 2017
97a6f24
@wouldgo this seems to fix the error for 'cannot read on. of null' :P
45kb Apr 24, 2017
3cc7168
stdout to string atm
45kb Apr 24, 2017
f863064
send also command name
45kb Apr 24, 2017
6dc3a3c
Merge branch 'master' into tab-views
45kb Apr 24, 2017
bbfbac7
automatically open the added project if no multiple projects are added
45kb Apr 24, 2017
6ab8b92
making a better prompt
45kb Apr 24, 2017
de1597a
fix for prompt
45kb Apr 26, 2017
046836e
Merge branch 'master' of https://github.com/720kb/ndm into tab-views
45kb Apr 28, 2017
71dcf5b
fix for prompt
45kb Apr 28, 2017
4ce5c1e
Merge branch 'master' of https://github.com/720kb/ndm into tab-views
45kb Apr 28, 2017
b3d39d9
tab-views
wouldgo Apr 28, 2017
a14b2f1
updated view issue now
wouldgo Apr 28, 2017
71f0745
wrong project identifier, needed absolute path
45kb Apr 29, 2017
2a32227
css layout of prompt fix
45kb Apr 29, 2017
86dce9a
no bind but simply currying
wouldgo Apr 29, 2017
a722bdc
fetch inside npm operations wasn't defined
wouldgo Apr 29, 2017
eb32e35
seems to fix the error alert is showing now, does this makes sense @w…
45kb Apr 30, 2017
0475203
button type to avoid form submit on close
45kb Apr 30, 2017
ab15482
no need for this actually
45kb Apr 30, 2017
738ba38
fixing prompt css only
45kb Apr 30, 2017
0b318c1
color fix for search
45kb Apr 30, 2017
561be54
Path must be a string error on new package installation
45kb Apr 30, 2017
acca8f5
removed old things
wouldgo May 1, 2017
d4903ed
ping using the embedded lib. changed the function name for checking i…
wouldgo May 1, 2017
4aed8d6
fixed a visual bug
45kb May 2, 2017
9f6937d
fix for when outdated list gets emptied
45kb May 3, 2017
ac14999
Merge branch 'master' of https://github.com/720kb/ndm into tab-views
45kb May 7, 2017
38069b1
fixes #200
wouldgo May 7, 2017
25bf7e9
removed globally exec npm
wouldgo May 7, 2017
352e45c
closes #204 closes #205
45kb May 8, 2017
9352fbf
closes #206
45kb May 8, 2017
d0054fe
closes #207
45kb May 8, 2017
f921af3
closes #210
45kb May 8, 2017
fe5f27b
closes #215
45kb May 8, 2017
5c608ab
empty selection on listOutdated
45kb May 8, 2017
9f55d86
restored some flag, closes #217
45kb May 9, 2017
ce7e14b
closes #218
45kb May 9, 2017
4ee3ef5
it was empty outdated array because i have the latest npm version ins…
45kb May 9, 2017
24f4d86
fix for button
45kb May 9, 2017
9fb7113
restored npm update logs, closes #211
45kb May 9, 2017
371450b
cleanup
45kb May 10, 2017
cfe9f67
fixed restore npm update logs
45kb May 10, 2017
d5793a0
prefix folder otherwise the commands are placed in the parent pwd
wouldgo May 14, 2017
e6f7bc0
closes #214 and #216.
wouldgo May 14, 2017
ccdee50
fix for progress bars
45kb May 15, 2017
cc9eead
fix for layout
45kb May 15, 2017
802316b
some fix for ui
45kb May 15, 2017
963f184
some ui fix
45kb May 15, 2017
18dc0fc
fix for linux selectbox
45kb May 15, 2017
f537932
fixing #219
45kb May 15, 2017
db41f23
fixing some #219
45kb May 15, 2017
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions conf/tasks/es6-build.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,34 @@ gulp.task('es6-build', done => {
'front-end',
'ndm',
'ndm-updater',
'npm-runner',
done);
});

gulp.task('npm-runner', () => {

return rollup({
'entry': `${paths.lib}js/npm/npm-runner.js`,
'plugins': [
rollupJSON(),
rollupBabel({
'presets': [
'es2015-rollup'
]
})
]
}).then(bundle => {

return bundle.write({
'format': 'iife',
'moduleId': 'npm-ui-ng',
'moduleName': 'npm-ui-ng',
'sourceMap': true,
'dest': `${paths.tmp}/npm-runner.js`
});
});
});

gulp.task('ndm', () => {

return rollup({
Expand Down
120 changes: 64 additions & 56 deletions lib/content.pug
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
include ./top.pug
.content(ng-controller='ContentController as content')
.row.home.bg-ultralight(ng-hide="content.loading || content.packageInformations", ng-show="content.goBackHome")
.content(ng-controller="ContentController as content")
span(npm-loading)
include ./npm-doctor-log.pug
.row.home.bg-ultralight(ng-show="content.tabs.length <= 0")
div
.separator10
small.color-black
Expand All @@ -9,59 +10,66 @@ include ./top.pug
.separator10
button.home-button(ng-click="shell.openChooser()")
| Add projects
.row.table-loader.bg-lighter(ng-show="content.loading", ng-hide='!content.loading || content.loaded')
img(src='img/loading.svg', width='22')
| Loading ...
.separator10
.color-black
small May take some time
div(ng-show='content.loaded && !content.goBackHome')
.row.table-header
.col-xs-4.clickable(ng-click="content.sortTableBy('name')")
| Package
i(class="fa", ng-class="{'fa-sort': !content.tableOrderBy.includes('-name') || !content.tableOrderBy.includes('name'), 'fa-sort-down': content.tableOrderBy.includes('-name'), 'fa-sort-up': content.tableOrderBy.includes('name')}")
.col-xs-2
| Current
.col-xs-2
| Wanted
.col-xs-2
| Latest
.col-xs-2.clickable(ng-click="content.sortTableBy('kind')")
| Env
i(class="fa", ng-class="{'fa-sort': !content.tableOrderBy.includes('-kind') || !content.tableOrderBy.includes('kind'), 'fa-sort-down': content.tableOrderBy.includes('-kind'), 'fa-sort-up': content.tableOrderBy.includes('kind')}")
.table-body(ng-table-keyboard)
<!-- show disabled npm global row if in globals-->
.row.table-row.disabled(ng-repeat='aPackage in content.packageInformations', ng-if="content.isGlobalProject && aPackage.name === 'npm'", title="Do not perform npm global actions from here")
.col-xs-4 {{ aPackage.name }}
.tab(npm-tabs, ng-repeat="tab in content.tabs", npm-tab-id="{{tab}}", ng-show="content.activeTab === tab && tab")
.tab-menu
span.tab-button(ng-repeat="tab in content.tabs", ng-class="{'active': content.activeTab === tab}", ng-click="content.activeTab = tab")
spanner(ng-if="tab === '<global>'")
img(src="img/npm-logo-cube.svg", width="16")
| Globals
spanner(ng-if="tab !== '<global>'")
| {{ tab | lastNameInPath}}
a(ng-click="content.closeProjectTab(tab)")
i(class="fa fa-remove")
include ./top.pug
div(ng-show="tab")
.row.table-header
.col-xs-4.clickable(ng-click="sortTableBy('name')")
| Package
i(class="fa", ng-class="{'fa-sort': !tableOrderBy.includes('-name') || !tableOrderBy.includes('name'), 'fa-sort-down': tableOrderBy.includes('-name'), 'fa-sort-up': tableOrderBy.includes('name')}")
.col-xs-2
span(ng-class="{'color-positive font-light': !aPackage.wanted && !aPackage.latest}")
| {{ aPackage.current }}
| Current
.col-xs-2
i(class="fa fa-check", ng-if="!aPackage.wanted && !aPackage.latest")
| {{ aPackage.wanted }}
| Wanted
.col-xs-2
b(ng-if="aPackage.latest")
| {{ aPackage.latest }}
i(class="fa fa-check color-positive", ng-if="!aPackage.wanted && !aPackage.latest")
.col-xs-2
| {{ aPackage.kind }}
<!-- show all packages except for npm global-->
.row.table-row(ng-repeat='aPackage in content.packageInformations | orderBy: content.tableOrderBy', id="table-item-{{$index}}", ng-table-keyboard-selected-items="content.selectedPackages", ng-if="!content.isGlobalProject || content.isGlobalProject && aPackage.name !== 'npm'", selection-model, selection-model-mode="'multiple'", selection-model-selected-items="content.selectedPackages", ng-click="shell.selectPackages(content.selectedPackages)", ng-class="{'active': content.selectedPackages.includes(aPackage), 'table-row-loading': shell.currentSelectedPackages.includes(aPackage) && content.showLoadingSelectedRow}")
.col-xs-4 {{ aPackage.name }}
.col-xs-2
span(ng-class="{'color-positive font-light': !aPackage.wanted && !aPackage.latest}")
| {{ aPackage.current }}
.col-xs-2
i(class="fa fa-check", ng-if="!aPackage.wanted && !aPackage.latest")
| {{ aPackage.wanted }}
.col-xs-2
b(ng-if="aPackage.latest")
| {{ aPackage.latest }}
i(class="fa fa-check color-positive", ng-if="!aPackage.wanted && !aPackage.latest")
.col-xs-2
| {{ aPackage.kind }}
div(ng-show="content.packageInformations && content.packageInformations.length > 0")
h6
| Packages informations
div.table-infos
include ./package-informations.pug
| Latest
.col-xs-2.clickable(ng-click="sortTableBy('kind')")
| Env
i(class="fa", ng-class="{'fa-sort': !tableOrderBy.includes('-kind') || !tableOrderBy.includes('kind'), 'fa-sort-down': tableOrderBy.includes('-kind'), 'fa-sort-up': tableOrderBy.includes('kind')}")
.table-body(ng-table-keyboard)
.table-loader(ng-show="loading && !loaded")
.table-loader-content
img(src='img/loading.svg')
| Loading packages...
<!-- show disabled npm global row if in globals-->
.row.table-row.disabled(ng-repeat='aPackage in packageInformations', ng-if="isGlobalProject && aPackage.name === 'npm'", title="Do not perform npm global actions from here")
.col-xs-4 {{ aPackage.name }}
.col-xs-2
span(ng-class="{'color-positive font-light': !aPackage.wanted && !aPackage.latest}")
| {{ aPackage.current }}
.col-xs-2
i(class="fa fa-check", ng-if="!aPackage.wanted && !aPackage.latest")
| {{ aPackage.wanted }}
.col-xs-2
b(ng-if="aPackage.latest")
| {{ aPackage.latest }}
i(class="fa fa-check color-positive", ng-if="!aPackage.wanted && !aPackage.latest")
.col-xs-2
| {{ aPackage.kind }}
<!-- show all packages except for npm global-->
.row.table-row(ng-repeat='aPackage in packageInformations | orderBy: tableOrderBy', id="table-item-{{$index}}", ng-table-keyboard-selected-items="selectedPackages", ng-if="!isGlobalProject || isGlobalProject && aPackage.name !== 'npm'", selection-model, selection-model-mode="'multiple'", selection-model-selected-items="selectedPackages", ng-click="selectPackages(selectedPackages)", ng-class="{'active': selectedPackages.includes(aPackage), 'table-row-loading': currentSelectedPackages.includes(aPackage) && showLoadingSelectedRow}")
.col-xs-4 {{ aPackage.name }}
.col-xs-2
span(ng-class="{'color-positive font-light': !aPackage.wanted && !aPackage.latest}")
| {{ aPackage.current }}
.col-xs-2
i(class="fa fa-check", ng-if="!aPackage.wanted && !aPackage.latest")
| {{ aPackage.wanted }}
.col-xs-2
b(ng-if="aPackage.latest")
| {{ aPackage.latest }}
i(class="fa fa-check color-positive", ng-if="!aPackage.wanted && !aPackage.latest")
.col-xs-2
| {{ aPackage.kind }}
div
div.table-infos
include ./package-informations.pug
13 changes: 7 additions & 6 deletions lib/footer.pug
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,18 @@
| v{{shell.npmCurrentVersionBadge}}
button.button-global(type="button", title="Enable ndm in global folder", ng-show="shell.globalDisabled", ng-click="shell.enableGlobal()")
i.fa.fa-globe.color-primary
| Enable
| Enable globals
button.button-update(type="button", ng-show="!shell.globalDisabled && shell.npmCurrentVersionBadge", title="Update npm", ng-click="shell.activeClickedLink('update'); shell.updateNpm()")
i.fa.fa-history
| Update
button.button-update(type="button", title="Run doctor", ng-click="shell.activeClickedLink('doctor'); shell.runDoctor()")
i.fa.fa-doctor
| Doctor
span(class="npm-status", ng-mouseenter="shell.checkRegistryStatus()")
| Update npm
span(class="npm-status pull-right", ng-mouseenter="shell.checkRegistryStatus()")
i.fa.fa-disk(title="npm registry is available", ng-show="!shell.loadingRegistryStatus && shell.registryStatus")
i.fa.fa-disk(title="npm registry checking ...", ng-show="shell.loadingRegistryStatus")
i.fa.fa-disk(title="npm registry is unavailable", ng-show="!shell.loadingRegistryStatus && !shell.registryStatus")
div.loader(ng-class="{'loading': shell.loadingRegistryStatus}")
i.fa.fa-circle(ng-class="{'available': !shell.loadingRegistryStatus && shell.registryStatus}")
i.fa.fa-circle(ng-class="{'unavailable': !shell.loadingRegistryStatus && !shell.registryStatus}")
span(class="pull-right")
button.button-doctor(type="button", title="Run doctor", ng-click="shell.activeClickedLink('doctor'); shell.runDoctor()")
i.fa.fa-doctor
| Doctor
4 changes: 2 additions & 2 deletions lib/index.pug
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ html
link(rel='stylesheet', href='css/index.css', media='screen', charset='utf-8')

script(type='text/javascript', src='../node_modules/angular/angular.min.js')
script(type='text/javascript', src='../node_modules/angular-ui-router/release/angular-ui-router.min.js')
script(type='text/javascript', src='../node_modules/selection-model/dist/selection-model.min.js')
script(type='text/javascript', src='../node_modules/ace-builds/src-min-noconflict/ace.js')

Expand All @@ -20,6 +19,7 @@ html
| Loading
.page
include ./left.pug
.right-column(ui-view)
.right-column
include ./content.pug
<!-- do not touch indentation-->
include ./footer.pug
22 changes: 11 additions & 11 deletions lib/install-new-package-version.pug
Original file line number Diff line number Diff line change
@@ -1,29 +1,29 @@
div.dialog.prompt(ng-if="shell.activeLink === '4'", ng-init="topMenu.versionPackageVersion = undefined")
form(ng-submit='topMenu.installVersionPackage(shell.currentSelectedPackages[0], topMenu.versionPackageVersion)')
div.dialog.prompt(ng-show="showSpecificVersionPrompt", ng-init="versionPackageVersion = undefined")
form(ng-submit='installVersionPackage(currentSelectedPackages[0], versionPackageVersion)')
input(placeholder='Package name',
type='text',
readonly,
disabled,
ng-value="shell.currentSelectedPackages[0].name")
ng-value="currentSelectedPackages[0].name")
= " "
input(class="hide",
placeholder='@version',
ng-autofocus,
type='text',
ng-model='topMenu.versionPackageVersion',
ng-value="topMenu.versionPackageVersion")
ng-model='versionPackageVersion',
ng-value="versionPackageVersion")
= " "
span(class="prompt-kind")
select(name="packageVersionSelect", ng-model="topMenu.pkgVersionModel", ng-change="topMenu.versionPackageVersion = topMenu.pkgVersionModel")
select(name="packageVersionSelect", ng-model="pkgVersionModel", ng-change="versionPackageVersion = pkgVersionModel")
option(value="", selected)
| -
option(ng-repeat="pkgVersion in shell.selectedPackageViewInfos.versions | orderBy : pkgVersion : 'reverse' track by $index", ng-value="pkgVersion")
option(ng-repeat="pkgVersion in selectedPackageViewInfos.versions | orderBy : pkgVersion : 'reverse' track by $index", ng-value="pkgVersion")
| {{pkgVersion}}
button
span(ng-show="!topMenu.installingPackageVersion")
button(ng-disabled="installingPackageVersion")
span(ng-show="!installingPackageVersion")
| Install
span(ng-show="topMenu.installingPackageVersion")
span(ng-show="installingPackageVersion")
img(src="img/loading.svg", width="13")
= " "
= " "
i(class="fa fa-times-circle-o button-close-prompt", ng-click="shell.activeLink = undefined;")
i(class="fa fa-times-circle-o button-close-prompt", ng-click="hideInstallVersionPrompt();")
24 changes: 12 additions & 12 deletions lib/install-new-package.pug
Original file line number Diff line number Diff line change
@@ -1,32 +1,32 @@
div.dialog.prompt(ng-if="shell.activeLink === '1'")
form(ng-submit='topMenu.installPackage(topMenu.packageName, topMenu.newPackageKind)')
div.dialog.prompt(ng-show="showInstallPrompt")
form(ng-submit='installPackage(packageName, newPackageKind)')
<!--do not remove placeholder even if it's not an input-->
div(class="tags-input", ng-tag-input, ng-autofocus, ng-model="topMenu.packageName", ng-keyup="topMenu.search(topMenu.packageName[topMenu.packageName.length - 1].name)", contenteditable="true", ng-attr-disabled="{{topMenu.installingPackage ? 'disabled' : ''}}" placeholder="package<@version> ...")
div(class="tags-input", ng-tag-input, tab-path-id="{{tab}}" ng-autofocus, ng-model="packageName", ng-keyup="search(packageName[packageName.length - 1].name)", contenteditable="true", ng-attr-disabled="{{installingPackage ? 'disabled' : ''}}" placeholder="package<@version> ...")
<!-- this input holds search keywords, do not remove it -->
input(ng-hide="true", ng-model="topMenu.searchKeywords", ng-bind="topMenu.packageName")
input(ng-hide="true", ng-model="searchKeywords", ng-bind="packageName")
= " "
span(class="prompt-kind")
input(type="checkbox", ng-model='topMenu.newPackageKind', ng-disabled='shell.globalSelected')
input(type="checkbox", ng-model='newPackageKind', ng-disabled='shell.globalSelected')
= " "
= " "
| dev
= " "
<!--do not remove id="" from the button-->
button(id="install-new-packages-button", ng-class="{'disabled': topMenu.installingPackage || !topMenu.packageName}")
span(ng-show="!topMenu.installingPackage")
button(id="install-new-packages-button", ng-disabled="installingPackage || !packageName")
span(ng-show="!installingPackage")
| Install
span(ng-show="topMenu.installingPackage")
span(ng-show="installingPackage")
img(src="img/loading.svg", width="13")
= " "
= " "
i(class="fa fa-times-circle-o button-close-prompt", ng-click="shell.activeLink = undefined")
.prompt-search
i(class="fa fa-times-circle-o button-close-prompt", ng-click="hideInstallPrompt();")
.prompt-search(ng-hide="installingPackage")
.prompt-search-content
.prompt-search-item(ng-repeat="item in topMenu.searchResults.objects", ng-click="topMenu.searchChoosePackage(item.package.name)")
.prompt-search-item(ng-repeat="item in searchResults.objects", ng-click="searchChoosePackage(item.package.name)")
h5
| {{item.package.name}}
div
| {{item.package.description}}
.prompt-search-loader(ng-show="topMenu.searchingNpm")
.prompt-search-loader(ng-show="searchingNpm")
img(src="img/loading.svg")
| Loading results ...
2 changes: 1 addition & 1 deletion lib/js/directives/ng-table-keyboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ angular.module(moduleName, [])
return (scope, element) => {

const onArrowDown = () => {
let tableRows = element[0].querySelectorAll('.table-row:not(.disabled)')
let tableRows = element[0].querySelectorAll('.tab:not(.ng-hide) .table-row:not(.disabled)')
, clickedElement;

if (tableRows && tableRows.length > 0) {
Expand Down
33 changes: 20 additions & 13 deletions lib/js/directives/ng-tag-input.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ angular.module(moduleName, [])
return {
'require': '?ngModel',
'link': (scope, element, attrs, ngModel) => {
let documentRange
let ngTagInputIdentifier = attrs.tabPathId
, documentRange
, windowSelection
, focusTheEnd = () => {
try {
Expand Down Expand Up @@ -117,20 +118,26 @@ angular.module(moduleName, [])
return event.preventDefault();
}
, updateOnSearchChoosenPackage = $rootScope.$on('top-menu:search-choosen-package', (eventInformation, data) => {
let newInputValue = '';
if (data &&
data.data &&
data.tabPath &&
data.tabPath === ngTagInputIdentifier) { //if search input is showing on this specific tab

data.forEach(pkg => {
newInputValue += pkg.name;
if (pkg.version &&
pkg.version.length > 0) {
newInputValue += `@${pkg.version}`;
}
newInputValue += ' '; //leave a blank space at the end of the string to split into tags again
});
let newInputValue = '';

element[0].innerText = newInputValue;
createTags();
updateModel();
data.data.forEach(pkg => {
newInputValue += pkg.name;
if (pkg.version &&
pkg.version.length > 0) {
newInputValue += `@${pkg.version}`;
}
newInputValue += ' '; //leave a blank space at the end of the string to split into tags again
});

element[0].innerText = newInputValue;
createTags();
updateModel();
}
});

element.on('mousedown', onTrigger);
Expand Down
19 changes: 19 additions & 0 deletions lib/js/filters.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,25 @@ angular.module(moduleName, [])
return string => {
return string.replace(/<\/?[^>]+(>|$)/g, '');
};
})
.filter('lastNameInPath', () => {
return string => {
let toReturn
, split;

if (string.includes('\\')) {
//on windows
split = string.split('\\');
toReturn = split[split.length - 1];
}

if (string.includes('/')) {
//on linux and mac
split = string.split('/');
toReturn = split[split.length - 1];
}
return toReturn ? toReturn : string;
};
});

export default moduleName;
Loading