fix(cloudcmd) different title

This commit is contained in:
coderaiser 2019-05-04 21:22:58 +03:00
parent 632abeef87
commit cde38e3bb0
17 changed files with 47 additions and 73 deletions

View file

@ -430,7 +430,7 @@ function CloudCmdProto(DOM) {
} = Info;
if (error)
return Dialog.alert(TITLE, error.responseText);
return Dialog.alert(error.responseText);
const {childNodes} = panel;
let i = childNodes.length;

View file

@ -15,8 +15,6 @@ function BufferProto() {
const CLASS = 'cut-file';
const COPY = 'copy';
const CUT = 'cut';
const TITLE = 'Buffer';
const Buffer = {
cut : callIfEnabled.bind(null, cut),
copy : callIfEnabled.bind(null, copy),
@ -25,7 +23,7 @@ function BufferProto() {
};
function showMessage(msg) {
DOM.Dialog.alert(TITLE, msg);
DOM.Dialog.alert(msg);
}
function getNames() {

View file

@ -5,15 +5,17 @@ const {
alert,
prompt,
confirm,
progress,
}= require('smalltalk');
module.exports = {
alert,
prompt,
confirm,
};
const title = 'Cloud Commander';
module.exports.alert.noFiles = (title) => {
module.exports.alert = (...a) => alert(title, ...a);
module.exports.prompt = (...a) => prompt(title, ...a);
module.exports.confirm = (...a) => confirm(title, ...a);
module.exports.progress = (...a) => progress(title, ...a);
module.exports.alert.noFiles = () => {
return alert(title, 'No files selected!', {
cancel: false,
});

View file

@ -44,7 +44,6 @@ function CmdProto() {
const Cmd = this;
const SELECTED_FILE = 'selected-file';
const TITLE = 'Cloud Commander';
const TabPanel = {
'js-left' : null,
'js-right' : null,
@ -97,7 +96,7 @@ function CmdProto() {
const name = getName();
const cancel = false;
Dialog.prompt(TITLE, msg, name, {cancel}).then((name) => {
Dialog.prompt(msg, name, {cancel}).then((name) => {
if (!name)
return;
@ -342,7 +341,7 @@ function CmdProto() {
};
if (Info.name === '..') {
Dialog.alert.noFiles(TITLE);
Dialog.alert.noFiles();
return callback(Error('No files selected!'));
}
@ -756,11 +755,11 @@ function CmdProto() {
const from = DOM.getCurrentName(current);
if (from === '..')
return Dialog.alert.noFiles(TITLE);
return Dialog.alert.noFiles();
const cancel = false;
Dialog.prompt(TITLE, 'Rename', from, {cancel}).then((to) => {
Dialog.prompt('Rename', from, {cancel}).then((to) => {
const isExist = !!DOM.getCurrentByName(to);
const dirPath = DOM.getCurrentDirPath();
@ -872,7 +871,7 @@ function CmdProto() {
path,
});
Dialog.prompt(TITLE, msg, path, {cancel})
Dialog.prompt(msg, path, {cancel})
.then(setPath)
.then(CloudCmd.loadDir);
},

View file

@ -206,7 +206,7 @@ function RESTful() {
Images.show.error(encoded);
setTimeout(() => {
DOM.Dialog.alert(CloudCmd.TITLE, encoded);
DOM.Dialog.alert(encoded);
}, 100);
p.callback(Error(text));

View file

@ -3,7 +3,6 @@
/* global DOM */
let SelectType = '*.*';
const TITLE = 'Cloud Commander';
const {getRegExp} = require('../../common/util');
@ -12,7 +11,7 @@ module.exports = (msg, files) => {
const cancel = false;
const {Dialog} = DOM;
Dialog.prompt(TITLE, allMsg, SelectType, {cancel}).then((type) => {
Dialog.prompt(allMsg, SelectType, {cancel}).then((type) => {
SelectType = type;
const regExp = getRegExp(type);

View file

@ -12,8 +12,6 @@ const {alert} = require('./dialog');
const {FS} = require('../../common/cloudfunc');
const {TITLE} = CloudCmd;
const onEnd = wraptile(_onEnd);
const loadFile = wraptile(_loadFile);
@ -71,6 +69,6 @@ function _loadFile(dir, n, file, callback) {
}
function showError({message}) {
alert(TITLE, message);
alert(message);
}

View file

@ -15,8 +15,6 @@ const {
findPrevious,
} = require('./find');
const TITLE = 'Cloud Commander';
const stopVisual = () => {
visual(false);
};
@ -117,7 +115,7 @@ module.exports = (key, event) => {
if (key === '/') {
event.preventDefault();
Dialog.prompt(TITLE, 'Find', '', {cancel: false})
Dialog.prompt('Find', '', {cancel: false})
.then(find);
return end();

View file

@ -22,7 +22,6 @@ const {Dialog, setTitle} = DOM;
const Name = 'Config';
CloudCmd[Name] = module.exports;
const alert = currify(Dialog.alert, Name);
const loadSocket = promisify(DOM.loadSocket);
@ -116,12 +115,12 @@ function initSocket() {
Config.save = saveHttp;
});
socket.on('err', alert);
socket.on('err', Dialog.alert);
}
function authCheck(socket) {
socket.emit('auth', config('username'), config('password'));
socket.on('reject', wraptile(alert, 'Wrong credentials!'));
socket.on('reject', wraptile(Dialog.alert, 'Wrong credentials!'));
}
Config.save = saveHttp;
@ -138,7 +137,7 @@ function show() {
function fillTemplate() {
Files.get('config', (error, config) => {
if (error)
return alert('Could not load config!');
return Dialog.alert('Could not load config!');
const {
editor,

View file

@ -19,10 +19,8 @@ const {
const {config} = CloudCmd;
let Menu;
const TITLE = 'Edit';
let MSG_CHANGED;
const isLoading = fullstore();
const ConfigView = {
@ -111,7 +109,7 @@ function setListeners(editor) {
function authCheck(spawn) {
spawn.emit('auth', config('username'), config('password'));
spawn.on('reject', () => {
Dialog.alert(TITLE, 'Wrong credentials!');
Dialog.alert('Wrong credentials!');
});
}
@ -190,7 +188,7 @@ function isChanged() {
return;
const cancel = false;
Dialog.confirm(TITLE, MSG_CHANGED, {cancel})
Dialog.confirm(MSG_CHANGED, {cancel})
.then(() => {
editor.save();
});

View file

@ -7,7 +7,6 @@ CloudCmd.EditNames = exports;
const currify = require('currify/legacy');
const exec = require('execon');
const supermenu = require('supermenu');
const smalltalk = require('smalltalk');
const multiRename = require('multi-rename');
const reject = Promise.reject.bind(Promise);
@ -15,8 +14,6 @@ const reject = Promise.reject.bind(Promise);
const Info = DOM.CurrentInfo;
const {Dialog} = DOM;
const TITLE = 'Edit Names';
const alert = currify(Dialog.alert, TITLE);
const refresh = currify(_refresh);
const rename = currify(_rename);
@ -46,7 +43,7 @@ module.exports.show = (options) => {
};
if (Info.name === '..' && names.length === 1)
return Dialog.alert.noFiles(TITLE);
return Dialog.alert.noFiles();
DOM.Events.addKey(keyListener);
@ -72,8 +69,8 @@ function keyListener(event) {
EditNames.hide();
else if (ctrlMeta && event.keyCode === Key.P)
smalltalk
.prompt(TITLE, 'Apply pattern:', '[n][e]', {cancel: false})
Dialog
.prompt('Apply pattern:', '[n][e]', {cancel: false})
.then(applyPattern);
event.preventDefault();
@ -217,7 +214,7 @@ function isChanged() {
if (!editor.isChanged())
return;
Dialog.confirm(TITLE, msg, {cancel: false})
Dialog.confirm(msg, {cancel: false})
.then(applyNames);
}

View file

@ -28,7 +28,6 @@ const {config} = CloudCmd;
const cd = currify((fn, dir) => fn(`cd ${rmLastSlash(dir)}`));
const Name = 'Konsole';
const TITLE = 'Console';
let Element;
let Loaded;
@ -119,7 +118,7 @@ function authCheck(konsole) {
konsole.emit('auth', config('username'), config('password'));
konsole.on('reject', () => {
Dialog.alert(TITLE, 'Wrong credentials!');
Dialog.alert('Wrong credentials!');
});
}
@ -149,7 +148,7 @@ const load = async () => {
Util.timeEnd(Name + ' load');
if (error)
return Dialog.alert(TITLE, error.message, {
return Dialog.alert(error.message, {
cancel: false,
});
};

View file

@ -7,8 +7,6 @@ const tryToCatch = require('try-to-catch/legacy');
CloudCmd.Markdown = exports;
const TITLE = 'Cloud Commander';
const createElement = require('@cloudcmd/create-element');
const Images = require('../dom/images');
@ -44,12 +42,11 @@ async function show(name, options = {}) {
Images.hide();
if (error)
return alert(TITLE, error.message, {
return alert(error.message, {
cancel: false,
});
const className = 'help';
const div = createElement('div', {
className,
innerHTML,

View file

@ -24,8 +24,7 @@ const {
} = DOM;
const Info = DOM.CurrentInfo;
const TITLE = 'Cloud Commander';
const alertNoFiles = wrap(Dialog.alert.noFiles)(TITLE);
const alertNoFiles = Dialog.alert.noFiles;
const uploadTo = wrap(_uploadTo);
let MenuShowedName;

View file

@ -23,10 +23,7 @@ const removeQuery = (a) => a.replace(/\?.*/, '');
const Name = 'Operation';
CloudCmd[Name] = exports;
const {
TITLE,
config,
} = CloudCmd;
const {config} = CloudCmd;
const {Dialog, Images} = DOM;
const initOperations = wraptile(_initOperations);
const authCheck = wraptile(_authCheck);
@ -55,7 +52,7 @@ const noFilesCheck = () => {
const is = Boolean(!length);
if (is)
return Dialog.alert.noFiles(TITLE);
return Dialog.alert.noFiles();
return is;
};
@ -88,7 +85,7 @@ function _authCheck(spawn, ok) {
const alertDialog = wraptile(Dialog.alert);
spawn.on('accept', accept(spawn));
spawn.on('reject', alertDialog (TITLE, 'Wrong credentials!'));
spawn.on('reject', alertDialog ('Wrong credentials!'));
spawn.emit('auth', config('username'), config('password'));
}
@ -298,7 +295,7 @@ function promptDelete() {
const cancel = false;
Dialog.confirm(TITLE, msg, {cancel}).then(() => {
Dialog.confirm(msg, {cancel}).then(() => {
deleteSilent(files);
});
}
@ -400,7 +397,7 @@ function _processFiles(options, data) {
const str = `"${ name }" already exist. Overwrite?`;
const cancel = false;
Dialog.confirm(TITLE, str, {cancel}).then(go);
Dialog.confirm(str, {cancel}).then(go);
function go() {
showLoad();
@ -457,7 +454,7 @@ function twopack(operation, type) {
checkEmpty('operation', operation);
if (!names.length)
return Dialog.alert.noFiles(TITLE);
return Dialog.alert.noFiles();
switch(operation) {
case 'extract':
@ -512,7 +509,7 @@ function message(msg, to, names) {
const cancel = false;
return Dialog.prompt(TITLE, msg, to, {cancel});
return Dialog.prompt(msg, to, {cancel});
}
function load(callback) {
@ -521,7 +518,7 @@ function load(callback) {
loadJS(file, (error) => {
if (error) {
Dialog.alert(TITLE, error.message);
Dialog.alert(error.message);
return exec(callback);
}

View file

@ -3,8 +3,6 @@
/* global DOM */
/* global CloudCmd */
const smalltalk = require('smalltalk');
const {
Dialog,
Images,
@ -12,7 +10,6 @@ const {
const forEachKey = require('for-each-key/legacy');
const wraptile = require('wraptile/legacy');
const {TITLE} = CloudCmd;
const format = require('./format');
@ -34,7 +31,7 @@ module.exports = (options) => (emitter) => {
const msg = `${operation} aborted`;
lastError = true;
Dialog.alert(TITLE, msg, {
Dialog.alert(msg, {
noCancel: true,
});
});
@ -43,8 +40,7 @@ module.exports = (options) => (emitter) => {
const on = emitter.on.bind(emitter);
const message = format(operation, from, to);
const progress = smalltalk.progress(TITLE, message);
const progress = Dialog.progress(message);
progress.catch(onAbort({
emitter,
@ -70,11 +66,11 @@ module.exports = (options) => (emitter) => {
if (noContinue) {
listeners.end(error);
Dialog.alert(TITLE, error);
Dialog.alert(error);
return;
}
Dialog.confirm(TITLE, error + '\n Continue?')
Dialog.confirm(error + '\n Continue?')
.then(() => {
emitter.continue();
}, () => {

View file

@ -14,8 +14,6 @@ const Images = require('../dom/images');
const loadParallel = promisify(load.parallel);
const TITLE = 'Terminal';
const {Dialog} = DOM;
const {
Key,
@ -38,7 +36,7 @@ const loadAll = async () => {
if (e) {
const src = e.target.src.replace(window.location.href, '');
return Dialog.alert(TITLE, `file ${src} could not be loaded`);
return Dialog.alert(`file ${src} could not be loaded`);
}
Loaded = true;
@ -103,7 +101,7 @@ function authCheck(spawn) {
spawn.emit('auth', config('username'), config('password'));
spawn.on('reject', () => {
Dialog.alert(TITLE, 'Wrong credentials!');
Dialog.alert('Wrong credentials!');
});
}