10 Commits

Author SHA1 Message Date
174f69f84d 0.7.0 2018-01-03 19:36:29 +00:00
9f5d8bfb93 Delete all documents in current directory
Adds a new button to the top right for deleting all documents in a
directory.
2018-01-03 13:34:04 +00:00
f9b4444763 Use published widget again
The necessary changes have been released in 1.2.0
2018-01-02 13:11:01 +00:00
bdb0671171 0.6.1 2017-12-31 18:40:35 +00:00
14c39d292f Prevent error alert for discovery errors
They're handled by the widget
2017-12-31 18:40:08 +00:00
8f7b861347 0.6.0 2017-12-31 18:29:29 +00:00
ab9ad2f354 Handle invalid RS auth tokens 2017-12-31 13:35:25 +01:00
ab637deb33 Add delete button 2017-12-30 20:24:40 +01:00
220888a7c5 Move header to route templates, remove obsolete code 2017-12-30 20:05:41 +01:00
f681524599 Update package lockfile 2017-12-30 20:05:27 +01:00
13 changed files with 1136 additions and 27 deletions

View File

@@ -1,9 +1,10 @@
import Controller from '@ember/controller';
import { inject as controller } from '@ember/controller';
import { observer } from '@ember/object';
import { inject as service } from '@ember/service';
import { computed, observer } from '@ember/object';
import { alias } from '@ember/object/computed';
import { isPresent } from '@ember/utils';
import { isPresent, isEmpty } from '@ember/utils';
import { all } from 'rsvp';
export default Controller.extend({
@@ -16,7 +17,7 @@ export default Controller.extend({
queryParams: ['path'],
currentListing: function() {
currentListing: function () {
if (isPresent(this.get('model.currentListing'))) {
return this.get('model.currentListing').sortBy('name');
} else {
@@ -24,7 +25,32 @@ export default Controller.extend({
}
}.property('rootListing.[]', 'model.[]'),
connectedChange: observer('connected', function() {
documents: computed('currentListing.[]', function () {
return this.get('currentListing')
.reject(item => item.path.substr(-1) === '/');
}),
currentListingContainsDocuments: computed('documents.[]', function () {
return isPresent(this.get('documents'));
}),
documentCount: computed('documents.[]', function () {
if (isPresent(this.get('documents'))) {
return this.get('documents').length;
} else {
return 0;
}
}),
parentDir: computed('currentDirPath', function () {
const dirs = this.get('currentDirPath')
.split('/')
.reject(p => isEmpty(p));
return dirs.splice(0, dirs.length - 1).join('/') + '/';
}),
connectedChange: observer('connected', function () {
if (this.get('connected')) {
// console.debug('connectedChange connected');
} else {
@@ -33,4 +59,27 @@ export default Controller.extend({
}
}),
actions: {
deleteDocuments () {
const documentCount = this.get('documentCount');
const msg = `This will delete all ${documentCount} documents/files in the current directory. Are you sure?`;
if (! window.confirm(msg)) { return false; }
const client = this.get('storage.client');
let promises = this.get('documents').map(item => {
console.debug('removing ' + item.path);
return client.remove(item.path);
});
all(promises).then(() => {
this.transitionToRoute('index', {
queryParams: { path: this.get('parentDir') }
});
});
}
}
});

View File

@@ -12,4 +12,21 @@ export default Controller.extend({
queryParams: ['path'],
actions: {
deleteItem () {
if (window.confirm('Sure?')) {
this.get('storage.client')
.remove(this.get('path')).then(() => {
this.transitionToRoute('index', {
queryParams: {
path: this.get('currentDirPath')
}
});
});
}
}
}
});

View File

@@ -1,5 +1,38 @@
import Route from '@ember/routing/route';
import { inject as service } from '@ember/service';
import BodyClassMixin from 'ember-body-class/mixins/body-class';
export default Route.extend(BodyClassMixin, {
storage: service(),
beforeModel () {
this.get('storage.rs').on('error', (error) => {
console.debug('rs.on error', error);
if (error.name === 'Unauthorized') {
this.handleUnauthorized();
} else if (error.name === 'DiscoveryError') {
// Do nothing, because the widget will handle it
} else {
alert('An unknown error occured. Please check the browser console for details.');
}
});
},
// We need to handle this here, so we can transitionTo
// the connect route
handleUnauthorized () {
// Ignore additional unauthorized events after the
// first one
if (this.get('storage.unauthorized')) { return; }
this.get('storage').setProperties({
unauthorized: true,
connecting: false,
connected: false
});
this.transitionTo('connect');
}
});

View File

@@ -44,6 +44,12 @@ export default Route.extend({
if (isPresent(model)) {
controller.set('currentDirPath', model.currentDirPath);
if (isEmpty(model.currentListing)) {
this.transitionTo('index', {
queryParams: { path: controller.get('parentDir') }
});
}
}
},

View File

@@ -1,6 +1,7 @@
import EmberObject from '@ember/object';
import { computed, observer } from '@ember/object';
import Service from '@ember/service';
import { computed, observer } from '@ember/object';
import { isEmpty } from '@ember/utils';
import RemoteStorage from 'npm:remotestoragejs';
import Widget from 'npm:remotestorage-widget';
import simpleContentType from 'inspektor/utils/simple-content-type';
@@ -11,6 +12,7 @@ export default Service.extend({
widget: null,
connecting: true,
connected: false,
unauthorized: false,
userAddress: null,
disconnected: computed.not('connected'),
client: null,
@@ -101,6 +103,8 @@ export default Service.extend({
let items = [];
return this.get('client').getListing(path).then(listing => {
if (isEmpty(listing)) { return []; }
Object.keys(listing).forEach(name => {
let item = listing[name];
let type = item['Content-Type'] || 'folder';

View File

@@ -68,6 +68,17 @@
> header {
height: 4rem;
display: flex;
flex-direction: row;
nav.breadcrumb-nav {
flex: 1;
}
nav.actions {
flex: 1;
text-align: right;
}
}
}
}

View File

@@ -6,18 +6,6 @@
{{/if}}
</aside>
<main>
<header>
{{#if connecting}}
<!-- Connecting... -->
{{else}}
{{#if connected}}
{{breadcrumb-nav currentDirPath=currentDirPath}}
{{else}}
<!-- Please connect. -->
{{/if}}
{{/if}}
</header>
{{outlet}}
</main>
</div>

View File

@@ -1 +0,0 @@
{{outlet}}

View File

@@ -1,3 +1,12 @@
<header>
{{breadcrumb-nav currentDirPath=currentDirPath}}
<nav class="actions">
{{#if currentListingContainsDocuments}}
<button class="delete-all" {{action "deleteDocuments"}}>delete all</button>
{{/if}}
</nav>
</header>
{{#if currentListing}}
{{directory-listing items=currentListing}}
{{/if}}

View File

@@ -1,3 +1,10 @@
<header>
{{breadcrumb-nav currentDirPath=currentDirPath}}
<nav class="actions">
<button class="delete" {{action "deleteItem"}}>delete</button>
</nav>
</header>
<div class="inspect-details">
<section class="content">
{{file-preview metaData=model.documentMetaData

913
package-lock.json generated
View File

@@ -1,6 +1,6 @@
{
"name": "inspektor",
"version": "0.5.1",
"version": "0.7.0",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
@@ -2529,6 +2529,7 @@
"requires": {
"anymatch": "1.3.2",
"async-each": "1.0.1",
"fsevents": "1.1.3",
"glob-parent": "2.0.0",
"inherits": "2.0.3",
"is-binary-path": "1.0.1",
@@ -6016,6 +6017,910 @@
"integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=",
"dev": true
},
"fsevents": {
"version": "1.1.3",
"resolved": "https://registry.npmjs.org/fsevents/-/fsevents-1.1.3.tgz",
"integrity": "sha512-WIr7iDkdmdbxu/Gh6eKEZJL6KPE74/5MEsf2whTOFNxbIoIixogroLdKYqB6FDav4Wavh/lZdzzd3b2KxIXC5Q==",
"dev": true,
"optional": true,
"requires": {
"nan": "2.7.0",
"node-pre-gyp": "0.6.39"
},
"dependencies": {
"abbrev": {
"version": "1.1.0",
"bundled": true,
"dev": true,
"optional": true
},
"ajv": {
"version": "4.11.8",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"co": "4.6.0",
"json-stable-stringify": "1.0.1"
}
},
"ansi-regex": {
"version": "2.1.1",
"bundled": true,
"dev": true
},
"aproba": {
"version": "1.1.1",
"bundled": true,
"dev": true,
"optional": true
},
"are-we-there-yet": {
"version": "1.1.4",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"delegates": "1.0.0",
"readable-stream": "2.2.9"
}
},
"asn1": {
"version": "0.2.3",
"bundled": true,
"dev": true,
"optional": true
},
"assert-plus": {
"version": "0.2.0",
"bundled": true,
"dev": true,
"optional": true
},
"asynckit": {
"version": "0.4.0",
"bundled": true,
"dev": true,
"optional": true
},
"aws-sign2": {
"version": "0.6.0",
"bundled": true,
"dev": true,
"optional": true
},
"aws4": {
"version": "1.6.0",
"bundled": true,
"dev": true,
"optional": true
},
"balanced-match": {
"version": "0.4.2",
"bundled": true,
"dev": true
},
"bcrypt-pbkdf": {
"version": "1.0.1",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"tweetnacl": "0.14.5"
}
},
"block-stream": {
"version": "0.0.9",
"bundled": true,
"dev": true,
"requires": {
"inherits": "2.0.3"
}
},
"boom": {
"version": "2.10.1",
"bundled": true,
"dev": true,
"requires": {
"hoek": "2.16.3"
}
},
"brace-expansion": {
"version": "1.1.7",
"bundled": true,
"dev": true,
"requires": {
"balanced-match": "0.4.2",
"concat-map": "0.0.1"
}
},
"buffer-shims": {
"version": "1.0.0",
"bundled": true,
"dev": true
},
"caseless": {
"version": "0.12.0",
"bundled": true,
"dev": true,
"optional": true
},
"co": {
"version": "4.6.0",
"bundled": true,
"dev": true,
"optional": true
},
"code-point-at": {
"version": "1.1.0",
"bundled": true,
"dev": true
},
"combined-stream": {
"version": "1.0.5",
"bundled": true,
"dev": true,
"requires": {
"delayed-stream": "1.0.0"
}
},
"concat-map": {
"version": "0.0.1",
"bundled": true,
"dev": true
},
"console-control-strings": {
"version": "1.1.0",
"bundled": true,
"dev": true
},
"core-util-is": {
"version": "1.0.2",
"bundled": true,
"dev": true
},
"cryptiles": {
"version": "2.0.5",
"bundled": true,
"dev": true,
"requires": {
"boom": "2.10.1"
}
},
"dashdash": {
"version": "1.14.1",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"assert-plus": "1.0.0"
},
"dependencies": {
"assert-plus": {
"version": "1.0.0",
"bundled": true,
"dev": true,
"optional": true
}
}
},
"debug": {
"version": "2.6.8",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"ms": "2.0.0"
}
},
"deep-extend": {
"version": "0.4.2",
"bundled": true,
"dev": true,
"optional": true
},
"delayed-stream": {
"version": "1.0.0",
"bundled": true,
"dev": true
},
"delegates": {
"version": "1.0.0",
"bundled": true,
"dev": true,
"optional": true
},
"detect-libc": {
"version": "1.0.2",
"bundled": true,
"dev": true,
"optional": true
},
"ecc-jsbn": {
"version": "0.1.1",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"jsbn": "0.1.1"
}
},
"extend": {
"version": "3.0.1",
"bundled": true,
"dev": true,
"optional": true
},
"extsprintf": {
"version": "1.0.2",
"bundled": true,
"dev": true
},
"forever-agent": {
"version": "0.6.1",
"bundled": true,
"dev": true,
"optional": true
},
"form-data": {
"version": "2.1.4",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"asynckit": "0.4.0",
"combined-stream": "1.0.5",
"mime-types": "2.1.15"
}
},
"fs.realpath": {
"version": "1.0.0",
"bundled": true,
"dev": true
},
"fstream": {
"version": "1.0.11",
"bundled": true,
"dev": true,
"requires": {
"graceful-fs": "4.1.11",
"inherits": "2.0.3",
"mkdirp": "0.5.1",
"rimraf": "2.6.1"
}
},
"fstream-ignore": {
"version": "1.0.5",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"fstream": "1.0.11",
"inherits": "2.0.3",
"minimatch": "3.0.4"
}
},
"gauge": {
"version": "2.7.4",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"aproba": "1.1.1",
"console-control-strings": "1.1.0",
"has-unicode": "2.0.1",
"object-assign": "4.1.1",
"signal-exit": "3.0.2",
"string-width": "1.0.2",
"strip-ansi": "3.0.1",
"wide-align": "1.1.2"
}
},
"getpass": {
"version": "0.1.7",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"assert-plus": "1.0.0"
},
"dependencies": {
"assert-plus": {
"version": "1.0.0",
"bundled": true,
"dev": true,
"optional": true
}
}
},
"glob": {
"version": "7.1.2",
"bundled": true,
"dev": true,
"requires": {
"fs.realpath": "1.0.0",
"inflight": "1.0.6",
"inherits": "2.0.3",
"minimatch": "3.0.4",
"once": "1.4.0",
"path-is-absolute": "1.0.1"
}
},
"graceful-fs": {
"version": "4.1.11",
"bundled": true,
"dev": true
},
"har-schema": {
"version": "1.0.5",
"bundled": true,
"dev": true,
"optional": true
},
"har-validator": {
"version": "4.2.1",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"ajv": "4.11.8",
"har-schema": "1.0.5"
}
},
"has-unicode": {
"version": "2.0.1",
"bundled": true,
"dev": true,
"optional": true
},
"hawk": {
"version": "3.1.3",
"bundled": true,
"dev": true,
"requires": {
"boom": "2.10.1",
"cryptiles": "2.0.5",
"hoek": "2.16.3",
"sntp": "1.0.9"
}
},
"hoek": {
"version": "2.16.3",
"bundled": true,
"dev": true
},
"http-signature": {
"version": "1.1.1",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"assert-plus": "0.2.0",
"jsprim": "1.4.0",
"sshpk": "1.13.0"
}
},
"inflight": {
"version": "1.0.6",
"bundled": true,
"dev": true,
"requires": {
"once": "1.4.0",
"wrappy": "1.0.2"
}
},
"inherits": {
"version": "2.0.3",
"bundled": true,
"dev": true
},
"ini": {
"version": "1.3.4",
"bundled": true,
"dev": true,
"optional": true
},
"is-fullwidth-code-point": {
"version": "1.0.0",
"bundled": true,
"dev": true,
"requires": {
"number-is-nan": "1.0.1"
}
},
"is-typedarray": {
"version": "1.0.0",
"bundled": true,
"dev": true,
"optional": true
},
"isarray": {
"version": "1.0.0",
"bundled": true,
"dev": true
},
"isstream": {
"version": "0.1.2",
"bundled": true,
"dev": true,
"optional": true
},
"jodid25519": {
"version": "1.0.2",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"jsbn": "0.1.1"
}
},
"jsbn": {
"version": "0.1.1",
"bundled": true,
"dev": true,
"optional": true
},
"json-schema": {
"version": "0.2.3",
"bundled": true,
"dev": true,
"optional": true
},
"json-stable-stringify": {
"version": "1.0.1",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"jsonify": "0.0.0"
}
},
"json-stringify-safe": {
"version": "5.0.1",
"bundled": true,
"dev": true,
"optional": true
},
"jsonify": {
"version": "0.0.0",
"bundled": true,
"dev": true,
"optional": true
},
"jsprim": {
"version": "1.4.0",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"assert-plus": "1.0.0",
"extsprintf": "1.0.2",
"json-schema": "0.2.3",
"verror": "1.3.6"
},
"dependencies": {
"assert-plus": {
"version": "1.0.0",
"bundled": true,
"dev": true,
"optional": true
}
}
},
"mime-db": {
"version": "1.27.0",
"bundled": true,
"dev": true
},
"mime-types": {
"version": "2.1.15",
"bundled": true,
"dev": true,
"requires": {
"mime-db": "1.27.0"
}
},
"minimatch": {
"version": "3.0.4",
"bundled": true,
"dev": true,
"requires": {
"brace-expansion": "1.1.7"
}
},
"minimist": {
"version": "0.0.8",
"bundled": true,
"dev": true
},
"mkdirp": {
"version": "0.5.1",
"bundled": true,
"dev": true,
"requires": {
"minimist": "0.0.8"
}
},
"ms": {
"version": "2.0.0",
"bundled": true,
"dev": true,
"optional": true
},
"node-pre-gyp": {
"version": "0.6.39",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"detect-libc": "1.0.2",
"hawk": "3.1.3",
"mkdirp": "0.5.1",
"nopt": "4.0.1",
"npmlog": "4.1.0",
"rc": "1.2.1",
"request": "2.81.0",
"rimraf": "2.6.1",
"semver": "5.3.0",
"tar": "2.2.1",
"tar-pack": "3.4.0"
}
},
"nopt": {
"version": "4.0.1",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"abbrev": "1.1.0",
"osenv": "0.1.4"
}
},
"npmlog": {
"version": "4.1.0",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"are-we-there-yet": "1.1.4",
"console-control-strings": "1.1.0",
"gauge": "2.7.4",
"set-blocking": "2.0.0"
}
},
"number-is-nan": {
"version": "1.0.1",
"bundled": true,
"dev": true
},
"oauth-sign": {
"version": "0.8.2",
"bundled": true,
"dev": true,
"optional": true
},
"object-assign": {
"version": "4.1.1",
"bundled": true,
"dev": true,
"optional": true
},
"once": {
"version": "1.4.0",
"bundled": true,
"dev": true,
"requires": {
"wrappy": "1.0.2"
}
},
"os-homedir": {
"version": "1.0.2",
"bundled": true,
"dev": true,
"optional": true
},
"os-tmpdir": {
"version": "1.0.2",
"bundled": true,
"dev": true,
"optional": true
},
"osenv": {
"version": "0.1.4",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"os-homedir": "1.0.2",
"os-tmpdir": "1.0.2"
}
},
"path-is-absolute": {
"version": "1.0.1",
"bundled": true,
"dev": true
},
"performance-now": {
"version": "0.2.0",
"bundled": true,
"dev": true,
"optional": true
},
"process-nextick-args": {
"version": "1.0.7",
"bundled": true,
"dev": true
},
"punycode": {
"version": "1.4.1",
"bundled": true,
"dev": true,
"optional": true
},
"qs": {
"version": "6.4.0",
"bundled": true,
"dev": true,
"optional": true
},
"rc": {
"version": "1.2.1",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"deep-extend": "0.4.2",
"ini": "1.3.4",
"minimist": "1.2.0",
"strip-json-comments": "2.0.1"
},
"dependencies": {
"minimist": {
"version": "1.2.0",
"bundled": true,
"dev": true,
"optional": true
}
}
},
"readable-stream": {
"version": "2.2.9",
"bundled": true,
"dev": true,
"requires": {
"buffer-shims": "1.0.0",
"core-util-is": "1.0.2",
"inherits": "2.0.3",
"isarray": "1.0.0",
"process-nextick-args": "1.0.7",
"string_decoder": "1.0.1",
"util-deprecate": "1.0.2"
}
},
"request": {
"version": "2.81.0",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"aws-sign2": "0.6.0",
"aws4": "1.6.0",
"caseless": "0.12.0",
"combined-stream": "1.0.5",
"extend": "3.0.1",
"forever-agent": "0.6.1",
"form-data": "2.1.4",
"har-validator": "4.2.1",
"hawk": "3.1.3",
"http-signature": "1.1.1",
"is-typedarray": "1.0.0",
"isstream": "0.1.2",
"json-stringify-safe": "5.0.1",
"mime-types": "2.1.15",
"oauth-sign": "0.8.2",
"performance-now": "0.2.0",
"qs": "6.4.0",
"safe-buffer": "5.0.1",
"stringstream": "0.0.5",
"tough-cookie": "2.3.2",
"tunnel-agent": "0.6.0",
"uuid": "3.0.1"
}
},
"rimraf": {
"version": "2.6.1",
"bundled": true,
"dev": true,
"requires": {
"glob": "7.1.2"
}
},
"safe-buffer": {
"version": "5.0.1",
"bundled": true,
"dev": true
},
"semver": {
"version": "5.3.0",
"bundled": true,
"dev": true,
"optional": true
},
"set-blocking": {
"version": "2.0.0",
"bundled": true,
"dev": true,
"optional": true
},
"signal-exit": {
"version": "3.0.2",
"bundled": true,
"dev": true,
"optional": true
},
"sntp": {
"version": "1.0.9",
"bundled": true,
"dev": true,
"requires": {
"hoek": "2.16.3"
}
},
"sshpk": {
"version": "1.13.0",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"asn1": "0.2.3",
"assert-plus": "1.0.0",
"bcrypt-pbkdf": "1.0.1",
"dashdash": "1.14.1",
"ecc-jsbn": "0.1.1",
"getpass": "0.1.7",
"jodid25519": "1.0.2",
"jsbn": "0.1.1",
"tweetnacl": "0.14.5"
},
"dependencies": {
"assert-plus": {
"version": "1.0.0",
"bundled": true,
"dev": true,
"optional": true
}
}
},
"string-width": {
"version": "1.0.2",
"bundled": true,
"dev": true,
"requires": {
"code-point-at": "1.1.0",
"is-fullwidth-code-point": "1.0.0",
"strip-ansi": "3.0.1"
}
},
"string_decoder": {
"version": "1.0.1",
"bundled": true,
"dev": true,
"requires": {
"safe-buffer": "5.0.1"
}
},
"stringstream": {
"version": "0.0.5",
"bundled": true,
"dev": true,
"optional": true
},
"strip-ansi": {
"version": "3.0.1",
"bundled": true,
"dev": true,
"requires": {
"ansi-regex": "2.1.1"
}
},
"strip-json-comments": {
"version": "2.0.1",
"bundled": true,
"dev": true,
"optional": true
},
"tar": {
"version": "2.2.1",
"bundled": true,
"dev": true,
"requires": {
"block-stream": "0.0.9",
"fstream": "1.0.11",
"inherits": "2.0.3"
}
},
"tar-pack": {
"version": "3.4.0",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"debug": "2.6.8",
"fstream": "1.0.11",
"fstream-ignore": "1.0.5",
"once": "1.4.0",
"readable-stream": "2.2.9",
"rimraf": "2.6.1",
"tar": "2.2.1",
"uid-number": "0.0.6"
}
},
"tough-cookie": {
"version": "2.3.2",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"punycode": "1.4.1"
}
},
"tunnel-agent": {
"version": "0.6.0",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"safe-buffer": "5.0.1"
}
},
"tweetnacl": {
"version": "0.14.5",
"bundled": true,
"dev": true,
"optional": true
},
"uid-number": {
"version": "0.0.6",
"bundled": true,
"dev": true,
"optional": true
},
"util-deprecate": {
"version": "1.0.2",
"bundled": true,
"dev": true
},
"uuid": {
"version": "3.0.1",
"bundled": true,
"dev": true,
"optional": true
},
"verror": {
"version": "1.3.6",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"extsprintf": "1.0.2"
}
},
"wide-align": {
"version": "1.1.2",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"string-width": "1.0.2"
}
},
"wrappy": {
"version": "1.0.2",
"bundled": true,
"dev": true
}
}
},
"fstream": {
"version": "1.0.11",
"resolved": "https://registry.npmjs.org/fstream/-/fstream-1.0.11.tgz",
@@ -9403,9 +10308,9 @@
}
},
"remotestorage-widget": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/remotestorage-widget/-/remotestorage-widget-1.0.0.tgz",
"integrity": "sha512-m1zbsjvDHveJIqETzF3oaQwr4m5I7jg4vLETa7eKrXpgV7HBC5nyYv8GBclBoKrhONY4ZWzUX+3GRLyUNDdIcA==",
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/remotestorage-widget/-/remotestorage-widget-1.2.0.tgz",
"integrity": "sha512-6SEJ87UiEew43iO53O9ZuJAjg9mPgpSNbehtflm3I7LO5FpQ6RnJZiiHpQzGOgozUFyK8g3UnnOBAzFwJ6jRcA==",
"dev": true
},
"remotestoragejs": {

View File

@@ -1,6 +1,6 @@
{
"name": "inspektor",
"version": "0.5.1",
"version": "0.7.0",
"private": true,
"description": "Inspect the contents of your remote storage",
"license": "MIT",
@@ -43,7 +43,7 @@
"ember-resolver": "^4.0.0",
"ember-source": "~2.16.0",
"loader.js": "^4.2.3",
"remotestorage-widget": "^1.0.0",
"remotestorage-widget": "^1.2.0",
"remotestoragejs": "^1.0.0"
},
"engines": {

View File

@@ -4,8 +4,89 @@ moduleFor('controller:index', 'Unit | Controller | index', {
needs: ['controller:application', 'service:storage']
});
// Replace this with your real tests.
test('it exists', function(assert) {
test('#parentDir', function(assert) {
let controller = this.subject();
assert.ok(controller);
controller.set('currentDirPath', 'islands/spain/canaries/tenerife/');
assert.equal(controller.get('parentDir'), 'islands/spain/canaries/');
});
test('#currentListingContainsDocuments', function(assert) {
let controller = this.subject();
controller.set('currentListing', [
{
"name": "spain/",
"type": "folder",
"isBinary": false,
"isFolder": true,
"size": null,
"path": "/islands/spain/",
"etag": "885098000"
}
]);
assert.notOk(controller.get('currentListingContainsDocuments'),
'returns false when no documents are present');
controller.set('currentListing', [
{
"name": "spain/",
"type": "folder",
"isBinary": false,
"isFolder": true,
"size": null,
"path": "/islands/spain/",
"etag": "885098000"
},
{
"name": "lamu",
"type": "application/json",
"isBinary": false,
"isFolder": false,
"size": 202,
"path": "/islands/lamu",
"etag": "478058546"
}
]);
assert.ok(controller.get('currentListingContainsDocuments'),
'returns true when no documents are present');
});
test('#documentCount', function(assert) {
let controller = this.subject();
controller.set('currentListing', [
{
"name": "spain/",
"type": "folder",
"isBinary": false,
"isFolder": true,
"size": null,
"path": "/islands/spain/",
"etag": "885098000"
},
{
"name": "lamu",
"type": "application/json",
"isBinary": false,
"isFolder": false,
"size": 202,
"path": "/islands/lamu",
"etag": "478058546"
},
{
"name": "dominica",
"type": "application/json",
"isBinary": false,
"isFolder": false,
"size": 202,
"path": "/islands/dominica",
"etag": "929838541"
}
]);
assert.equal(controller.get('documentCount'), 2,
'returns the number of documents in the current listing');
});