prettier --write

This commit is contained in:
RainLoop Team 2019-07-04 22:19:24 +03:00
parent 450528ff00
commit 8a0be3212d
164 changed files with 7053 additions and 9008 deletions

View file

@ -1,23 +1,21 @@
import _ from '_';
import ko from 'ko';
import key from 'key';
import {KeyState, Magics, StorageResultType, Notification} from 'Common/Enums';
import {isNonEmptyArray, delegateRun} from 'Common/Utils';
import {getNotification, i18n} from 'Common/Translator';
import { KeyState, Magics, StorageResultType, Notification } from 'Common/Enums';
import { isNonEmptyArray, delegateRun } from 'Common/Utils';
import { getNotification, i18n } from 'Common/Translator';
import Remote from 'Remote/Admin/Ajax';
import {popup, command, isPopupVisible, showScreenPopup} from 'Knoin/Knoin';
import {AbstractViewNext} from 'Knoin/AbstractViewNext';
import { popup, command, isPopupVisible, showScreenPopup } from 'Knoin/Knoin';
import { AbstractViewNext } from 'Knoin/AbstractViewNext';
@popup({
name: 'View/Popup/Plugin',
templateID: 'PopupsPlugin'
})
class PluginPopupView extends AbstractViewNext
{
class PluginPopupView extends AbstractViewNext {
constructor() {
super();
@ -50,14 +48,12 @@ class PluginPopupView extends AbstractViewNext
@command((self) => self.hasConfiguration())
saveCommand() {
const list = {};
list.Name = this.name();
_.each(this.configures(), (oItem) => {
let value = oItem.value();
if (false === value || true === value)
{
if (false === value || true === value) {
value = value ? '1' : '0';
}
list['_' + oItem.Name] = value;
@ -68,19 +64,13 @@ class PluginPopupView extends AbstractViewNext
}
onPluginSettingsUpdateResponse(result, data) {
if (StorageResultType.Success === result && data && data.Result)
{
if (StorageResultType.Success === result && data && data.Result) {
this.cancelCommand();
}
else
{
} else {
this.saveError('');
if (data && data.ErrorCode)
{
if (data && data.ErrorCode) {
this.saveError(getNotification(data.ErrorCode));
}
else
{
} else {
this.saveError(getNotification(Notification.CantSavePluginSettings));
}
}
@ -91,44 +81,44 @@ class PluginPopupView extends AbstractViewNext
this.readme();
this.configures([]);
if (oPlugin)
{
if (oPlugin) {
this.name(oPlugin.Name);
this.readme(oPlugin.Readme);
const config = oPlugin.Config;
if (isNonEmptyArray(config))
{
this.configures(_.map(config, (item) => ({
'value': ko.observable(item[0]),
'placeholder': ko.observable(item[6]),
'Name': item[1],
'Type': item[2],
'Label': item[3],
'Default': item[4],
'Desc': item[5]
})));
if (isNonEmptyArray(config)) {
this.configures(
_.map(config, (item) => ({
'value': ko.observable(item[0]),
'placeholder': ko.observable(item[6]),
'Name': item[1],
'Type': item[2],
'Label': item[3],
'Default': item[4],
'Desc': item[5]
}))
);
}
}
}
tryToClosePopup() {
const PopupsAskViewModel = require('View/Popup/Ask');
if (!isPopupVisible(PopupsAskViewModel))
{
showScreenPopup(PopupsAskViewModel, [i18n('POPUPS_ASK/DESC_WANT_CLOSE_THIS_WINDOW'), () => {
if (this.modalVisibility())
{
delegateRun(this, 'cancelCommand');
if (!isPopupVisible(PopupsAskViewModel)) {
showScreenPopup(PopupsAskViewModel, [
i18n('POPUPS_ASK/DESC_WANT_CLOSE_THIS_WINDOW'),
() => {
if (this.modalVisibility()) {
delegateRun(this, 'cancelCommand');
}
}
}]);
]);
}
}
onBuild() {
key('esc', KeyState.All, () => {
if (this.modalVisibility())
{
if (this.modalVisibility()) {
this.tryToClosePopup();
}
@ -137,4 +127,4 @@ class PluginPopupView extends AbstractViewNext
}
}
export {PluginPopupView, PluginPopupView as default};
export { PluginPopupView, PluginPopupView as default };