parent
735ef7fa7b
commit
1833a5e3c1
@ -40551,10 +40551,10 @@ exports.decompress = decompress;
|
|||||||
|
|
||||||
var _types = require('./types');
|
var _types = require('./types');
|
||||||
|
|
||||||
function compress(file) {
|
function compress(file, name) {
|
||||||
return {
|
return {
|
||||||
type: _types.COMPRESS,
|
type: _types.COMPRESS,
|
||||||
file: file
|
file: file, name: name
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -42394,6 +42394,9 @@ var CreateDialog = (0, _reactRedux.connect)(function (state) {
|
|||||||
var SearchDialog = (0, _reactRedux.connect)(function (state) {
|
var SearchDialog = (0, _reactRedux.connect)(function (state) {
|
||||||
return state.get('searchDialog');
|
return state.get('searchDialog');
|
||||||
})(_componentsDialog2['default']);
|
})(_componentsDialog2['default']);
|
||||||
|
var CompressDialog = (0, _reactRedux.connect)(function (state) {
|
||||||
|
return state.get('compressDialog');
|
||||||
|
})(_componentsDialog2['default']);
|
||||||
|
|
||||||
var Root = (function (_Component) {
|
var Root = (function (_Component) {
|
||||||
_inherits(Root, _Component);
|
_inherits(Root, _Component);
|
||||||
@ -42423,6 +42426,7 @@ var Root = (function (_Component) {
|
|||||||
_react2['default'].createElement(ErrorDialog, null),
|
_react2['default'].createElement(ErrorDialog, null),
|
||||||
_react2['default'].createElement(CreateDialog, null),
|
_react2['default'].createElement(CreateDialog, null),
|
||||||
_react2['default'].createElement(SearchDialog, null),
|
_react2['default'].createElement(SearchDialog, null),
|
||||||
|
_react2['default'].createElement(CompressDialog, null),
|
||||||
_react2['default'].createElement(_componentsSpinner2['default'], null),
|
_react2['default'].createElement(_componentsSpinner2['default'], null),
|
||||||
_react2['default'].createElement('div', { className: 'swipe-instruction tour-item' }),
|
_react2['default'].createElement('div', { className: 'swipe-instruction tour-item' }),
|
||||||
_react2['default'].createElement(
|
_react2['default'].createElement(
|
||||||
@ -42691,6 +42695,8 @@ var _actionsFile = require('actions/file');
|
|||||||
|
|
||||||
var _actionsFilesView = require('actions/files-view');
|
var _actionsFilesView = require('actions/files-view');
|
||||||
|
|
||||||
|
var _actionsCompress = require('actions/compress');
|
||||||
|
|
||||||
var _store = require('store');
|
var _store = require('store');
|
||||||
|
|
||||||
var _store2 = _interopRequireDefault(_store);
|
var _store2 = _interopRequireDefault(_store);
|
||||||
@ -42838,11 +42844,43 @@ exports['default'] = {
|
|||||||
},
|
},
|
||||||
className: 'success'
|
className: 'success'
|
||||||
}]
|
}]
|
||||||
|
},
|
||||||
|
compressDialog: {
|
||||||
|
title: 'Archive',
|
||||||
|
description: 'Enter your desired archive name',
|
||||||
|
input: true,
|
||||||
|
buttons: [{
|
||||||
|
text: 'Cancel',
|
||||||
|
action: function action() {
|
||||||
|
var input = _react2['default'].findDOMNode(this.refs.input);
|
||||||
|
this.props.dispatch((0, _actionsDialog.hideAll)());
|
||||||
|
input.value = '';
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
text: 'Create',
|
||||||
|
action: function action() {
|
||||||
|
var input = _react2['default'].findDOMNode(this.refs.input);
|
||||||
|
|
||||||
|
if (!input.value) {
|
||||||
|
this.props.dispatch((0, _actionsDialog.hideAll)());
|
||||||
|
this.props.dispatch((0, _actionsFile.active)());
|
||||||
|
this.props.dispatch((0, _actionsDialog.show)('errorDialog', { description: INVALID_NAME }));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var activeFile = _store2['default'].getState().get('activeFile');
|
||||||
|
this.props.dispatch((0, _actionsCompress.compress)(activeFile, input.value));
|
||||||
|
this.props.dispatch((0, _actionsDialog.hideAll)());
|
||||||
|
this.props.dispatch((0, _actionsFile.active)());
|
||||||
|
input.value = '';
|
||||||
|
},
|
||||||
|
className: 'success'
|
||||||
|
}]
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
module.exports = exports['default'];
|
module.exports = exports['default'];
|
||||||
|
|
||||||
},{"actions/dialog":262,"actions/file":263,"actions/files-view":264,"react":250,"store":"store"}],286:[function(require,module,exports){
|
},{"actions/compress":261,"actions/dialog":262,"actions/file":263,"actions/files-view":264,"react":250,"store":"store"}],286:[function(require,module,exports){
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
||||||
@ -42966,9 +43004,8 @@ var entryMenu = {
|
|||||||
}, {
|
}, {
|
||||||
name: 'Archive',
|
name: 'Archive',
|
||||||
action: function action() {
|
action: function action() {
|
||||||
var active = _store2['default'].getState().get('activeFile');
|
_store2['default'].dispatch((0, _actionsMenu.hideAll)());
|
||||||
|
_store2['default'].dispatch((0, _actionsDialog.show)('compressDialog'));
|
||||||
_store2['default'].dispatch((0, _actionsCompress.compress)(active));
|
|
||||||
}
|
}
|
||||||
}]
|
}]
|
||||||
};
|
};
|
||||||
@ -43044,9 +43081,8 @@ var moreMenu = {
|
|||||||
}, {
|
}, {
|
||||||
name: 'Archive',
|
name: 'Archive',
|
||||||
action: function action() {
|
action: function action() {
|
||||||
var active = _store2['default'].getState().get('activeFile');
|
_store2['default'].dispatch((0, _actionsMenu.hideAll)());
|
||||||
|
_store2['default'].dispatch((0, _actionsDialog.show)('compressDialog'));
|
||||||
_store2['default'].dispatch((0, _actionsCompress.compress)(active));
|
|
||||||
}
|
}
|
||||||
}]
|
}]
|
||||||
};
|
};
|
||||||
@ -43162,7 +43198,8 @@ exports['default'] = function (state, action) {
|
|||||||
deleteDialog: (0, _dialog2['default'])(state, action, 'deleteDialog'),
|
deleteDialog: (0, _dialog2['default'])(state, action, 'deleteDialog'),
|
||||||
errorDialog: (0, _dialog2['default'])(state, action, 'errorDialog'),
|
errorDialog: (0, _dialog2['default'])(state, action, 'errorDialog'),
|
||||||
createDialog: (0, _dialog2['default'])(state, action, 'createDialog'),
|
createDialog: (0, _dialog2['default'])(state, action, 'createDialog'),
|
||||||
searchDialog: (0, _dialog2['default'])(state, action, 'searchDialog')
|
searchDialog: (0, _dialog2['default'])(state, action, 'searchDialog'),
|
||||||
|
compressDialog: (0, _dialog2['default'])(state, action, 'compressDialog')
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -43408,7 +43445,7 @@ exports['default'] = function (state, action) {
|
|||||||
var blob = new Blob([buffer], { type: 'application/zip' });
|
var blob = new Blob([buffer], { type: 'application/zip' });
|
||||||
|
|
||||||
var cwd = _store2['default'].getState().get('cwd');
|
var cwd = _store2['default'].getState().get('cwd');
|
||||||
var path = (0, _utils.normalize)(cwd + '/archive.zip');
|
var path = (0, _utils.normalize)(cwd + '/' + action.name);
|
||||||
return (0, _apiFiles.writeFile)(path, blob);
|
return (0, _apiFiles.writeFile)(path, blob);
|
||||||
}).then(boundRefresh)['catch'](_utils.reportError);
|
}).then(boundRefresh)['catch'](_utils.reportError);
|
||||||
|
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
import { COMPRESS, DECOMPRESS } from './types';
|
import { COMPRESS, DECOMPRESS } from './types';
|
||||||
|
|
||||||
export function compress(file) {
|
export function compress(file, name) {
|
||||||
return {
|
return {
|
||||||
type: COMPRESS,
|
type: COMPRESS,
|
||||||
file
|
file, name
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -27,6 +27,7 @@ let DeleteDialog = connect(state => state.get('deleteDialog'))(Dialog);
|
|||||||
let ErrorDialog = connect(state => state.get('errorDialog'))(Dialog);
|
let ErrorDialog = connect(state => state.get('errorDialog'))(Dialog);
|
||||||
let CreateDialog = connect(state => state.get('createDialog'))(Dialog);
|
let CreateDialog = connect(state => state.get('createDialog'))(Dialog);
|
||||||
let SearchDialog = connect(state => state.get('searchDialog'))(Dialog);
|
let SearchDialog = connect(state => state.get('searchDialog'))(Dialog);
|
||||||
|
let CompressDialog = connect(state => state.get('compressDialog'))(Dialog);
|
||||||
|
|
||||||
export default class Root extends Component {
|
export default class Root extends Component {
|
||||||
render() {
|
render() {
|
||||||
@ -47,6 +48,7 @@ export default class Root extends Component {
|
|||||||
<ErrorDialog />
|
<ErrorDialog />
|
||||||
<CreateDialog />
|
<CreateDialog />
|
||||||
<SearchDialog />
|
<SearchDialog />
|
||||||
|
<CompressDialog />
|
||||||
|
|
||||||
<Spinner />
|
<Spinner />
|
||||||
|
|
||||||
|
@ -2,6 +2,7 @@ import React from 'react';
|
|||||||
import { hide, hideAll, show } from 'actions/dialog';
|
import { hide, hideAll, show } from 'actions/dialog';
|
||||||
import { rename, remove, create, active } from 'actions/file';
|
import { rename, remove, create, active } from 'actions/file';
|
||||||
import { search } from 'actions/files-view';
|
import { search } from 'actions/files-view';
|
||||||
|
import { compress } from 'actions/compress';
|
||||||
import store, { bind } from 'store';
|
import store, { bind } from 'store';
|
||||||
|
|
||||||
const INVALID_NAME = 'Please enter a valid name.';
|
const INVALID_NAME = 'Please enter a valid name.';
|
||||||
@ -148,7 +149,8 @@ export default {
|
|||||||
if (!input.value) {
|
if (!input.value) {
|
||||||
this.props.dispatch(hideAll());
|
this.props.dispatch(hideAll());
|
||||||
this.props.dispatch(active());
|
this.props.dispatch(active());
|
||||||
this.props.dispatch(show('errorDialog', {description: INVALID_SEARCH}));
|
this.props.dispatch(show('errorDialog',
|
||||||
|
{description: INVALID_SEARCH}));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -160,5 +162,41 @@ export default {
|
|||||||
className: 'success'
|
className: 'success'
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
},
|
||||||
|
compressDialog: {
|
||||||
|
title: 'Archive',
|
||||||
|
description: 'Enter your desired archive name',
|
||||||
|
input: true,
|
||||||
|
buttons: [
|
||||||
|
{
|
||||||
|
text: 'Cancel',
|
||||||
|
action() {
|
||||||
|
let input = React.findDOMNode(this.refs.input);
|
||||||
|
this.props.dispatch(hideAll());
|
||||||
|
input.value = '';
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
text: 'Create',
|
||||||
|
action() {
|
||||||
|
let input = React.findDOMNode(this.refs.input);
|
||||||
|
|
||||||
|
if (!input.value) {
|
||||||
|
this.props.dispatch(hideAll());
|
||||||
|
this.props.dispatch(active());
|
||||||
|
this.props.dispatch(show('errorDialog',
|
||||||
|
{description: INVALID_NAME}));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
let activeFile = store.getState().get('activeFile');
|
||||||
|
this.props.dispatch(compress(activeFile, input.value))
|
||||||
|
this.props.dispatch(hideAll());
|
||||||
|
this.props.dispatch(active());
|
||||||
|
input.value = '';
|
||||||
|
},
|
||||||
|
className: 'success'
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -83,9 +83,8 @@ const entryMenu = {
|
|||||||
{
|
{
|
||||||
name: 'Archive',
|
name: 'Archive',
|
||||||
action() {
|
action() {
|
||||||
let active = store.getState().get('activeFile');
|
store.dispatch(hideAll());
|
||||||
|
store.dispatch(show('compressDialog'));
|
||||||
store.dispatch(compress(active));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
@ -168,9 +167,8 @@ const moreMenu = {
|
|||||||
{
|
{
|
||||||
name: 'Archive',
|
name: 'Archive',
|
||||||
action() {
|
action() {
|
||||||
let active = store.getState().get('activeFile');
|
store.dispatch(hideAll());
|
||||||
|
store.dispatch(show('compressDialog'));
|
||||||
store.dispatch(compress(active));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
@ -32,6 +32,7 @@ export default function(state = new Immutable.Map(), action) {
|
|||||||
deleteDialog: dialog(state, action, 'deleteDialog'),
|
deleteDialog: dialog(state, action, 'deleteDialog'),
|
||||||
errorDialog: dialog(state, action, 'errorDialog'),
|
errorDialog: dialog(state, action, 'errorDialog'),
|
||||||
createDialog: dialog(state, action, 'createDialog'),
|
createDialog: dialog(state, action, 'createDialog'),
|
||||||
searchDialog: dialog(state, action, 'searchDialog')
|
searchDialog: dialog(state, action, 'searchDialog'),
|
||||||
|
compressDialog: dialog(state, action, 'compressDialog')
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -118,7 +118,7 @@ export default function(state = [], action) {
|
|||||||
let blob = new Blob([buffer], { type: 'application/zip' });
|
let blob = new Blob([buffer], { type: 'application/zip' });
|
||||||
|
|
||||||
let cwd = store.getState().get('cwd');
|
let cwd = store.getState().get('cwd');
|
||||||
let path = normalize(cwd + '/archive.zip');
|
let path = normalize(cwd + '/' + action.name);
|
||||||
return writeFile(path, blob);
|
return writeFile(path, blob);
|
||||||
}).then(boundRefresh).catch(reportError);
|
}).then(boundRefresh).catch(reportError);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user