Commit ce831f7f authored by Medicean's avatar Medicean

数据管理定制隐藏列

parent ffe4f1f7
......@@ -55,6 +55,10 @@ class Menubar {
label: LANG['main']['aproxy'],
accelerator: 'Shift+CmdOrCtrl+A',
click: event.sender.send.bind(event.sender, 'menubar', 'settings-aproxy')
}, {
label: LANG['main']['display'],
accelerator: 'Shift+CmdOrCtrl+D',
click: event.sender.send.bind(event.sender, 'menubar', 'settings-display')
}, {
type: 'separator'
}, {
......
......@@ -16,6 +16,7 @@ module.exports = {
settings: 'System setting',
language: 'Language setting',
aproxy: 'Proxy setting',
display: 'Display setting',
update: 'Check update',
quit: 'Quit'
},
......@@ -486,39 +487,32 @@ module.exports = {
success: 'Connect to proxy server successfully',
error: 'Failed to connect to the proxy server'
}
}
},
aproxy: {
title: 'Proxy Configuration',
toolbar: {
save: 'Save',
test: 'Test Connection'
},
form: {
label: 'Configuring proxy access to the Internet',
mode:{
noproxy: 'No Proxy',
manualproxy: 'Set the proxy manually'
display: {
title: 'Display setting',
success: 'Save display settings successfully!',
error: 'Failed to save the display settings!',
confirm: {
content: 'Restart the application to take effect, whether to restart?',
title: 'Change display settings'
},
proxy: {
protocol: 'Protocol',
server: 'Server',
port: 'Port',
username: 'Username',
password: 'Password',
authtip: 'Leave blank if no authentication'
toolbar: {
save: 'Save'
},
form:{
shellmanager: {
title: 'Shell Lists',
hiddencolumns: {
title: 'Hide selected columns',
url: 'URL',
ip: 'IP',
addr: 'ADDR',
note: 'NOTE',
ctime: 'CTIME',
utime: 'UTIME'
}
}
}
},
success: 'Successfully save the Proxy Configuration!',
error: 'Failed to save the Proxy Configuration!',
confirm: {
content: 'Restart the application?',
title: 'Proxy Configuration'
},
prompt:{
title: 'Input the target URL',
success: 'Successfully connect to the proxy server',
error: 'Failed to connect to the proxy server'
}
},
plugin: {
......
......@@ -17,6 +17,7 @@ module.exports = {
settings: '系统设置',
language: '语言设置',
aproxy: '代理设置',
display: '显示设置',
update: '检查更新',
quit: '退出程序'
},
......@@ -487,6 +488,32 @@ module.exports = {
success: '连接到代理服务器成功',
error: '连接到代理服务器失败'
}
},
display: {
title: '显示设置',
success: '保存显示设置成功!',
error: '保存显示设置失败!',
confirm: {
content: '重启应用生效,是否重启?',
title: '更改显示设置'
},
toolbar: {
save: '保存'
},
form:{
shellmanager: {
title: '数据管理',
hiddencolumns: {
title: '隐藏选中列',
url: 'URL地址',
ip: 'IP地址',
addr: '物理位置',
note: '网站备注',
ctime: '创建时间',
utime: '更新时间'
}
}
}
}
},
plugin: {
......
/**
* 设置中心::界面
*/
const LANG = antSword['language']['settings']['display'];
const LANG_T = antSword['language']['toastr'];
class Display {
constructor(sidebar) {
sidebar.addItem({
id: 'display',
text: `<i class="fa fa-television"></i> ${LANG['title']}`
});
const cell = sidebar.cells('display');
const display_shellmanager_hiddencolumns = localStorage.hasOwnProperty('display_shellmanager_hiddencolumns') ? JSON.parse(localStorage.display_shellmanager_hiddencolumns):[];
const toolbar = cell.attachToolbar();
toolbar.loadStruct([
{ id: 'save', type: 'button', text: LANG['toolbar']['save'], icon: 'save' }
]);
// 表单
const form = cell.attachForm([{
type: 'block', name: 'shellmanager', list: [
{type: "label", label: LANG['form']['shellmanager']['title']}
]}
]);
const LANG_HC = LANG['form']['shellmanager']['hiddencolumns'];
// 数据管理隐藏列
form.addItem(
'shellmanager',
{
type: "fieldset", label: LANG_HC['title'], list:[
{ type: "block", list: [
{
type: "checkbox", label: LANG_HC['url'], name: 'hidden_columns[0]', checked: display_shellmanager_hiddencolumns.indexOf(0) != -1 , position: "label-right", value: 1, disabled: true
},
{type: 'newcolumn', offset:20},
{
type: "checkbox", label: LANG_HC['ip'], name: 'hidden_columns[1]', checked: display_shellmanager_hiddencolumns.indexOf(1) != -1 , position: "label-right", value: 2
},
{type: 'newcolumn', offset:20},
{
type: "checkbox", label: LANG_HC['addr'], name: 'hidden_columns[2]', checked: display_shellmanager_hiddencolumns.indexOf(2) != -1 , position: "label-right", value: 3
},
{type: 'newcolumn', offset:20},
{
type: "checkbox", label: LANG_HC['note'], name: 'hidden_columns[3]', checked: display_shellmanager_hiddencolumns.indexOf(3) != -1 , position: "label-right", value: 4
},
{type: 'newcolumn', offset:20},
{
type: "checkbox", label: LANG_HC['ctime'], name: 'hidden_columns[4]', checked: display_shellmanager_hiddencolumns.indexOf(4) != -1 , position: "label-right", value: 5
},
{type: 'newcolumn', offset:20},
{
type: "checkbox", label: LANG_HC['utime'], name: 'hidden_columns[5]', checked: display_shellmanager_hiddencolumns.indexOf(5) != -1 , position: "label-right", value: 6
}
]}
]
}
);
// 保存
toolbar.attachEvent('onClick', (id) => {
switch(id){
case 'save':
var _formvals = form.getValues();
var _display_shellmanager_hiddencolumns = [];
for (var i = 0; i < 6; i++) {
var data = _formvals['hidden_columns['+i+']'];
if (data) {
_display_shellmanager_hiddencolumns.push(data-1);
}
}
localStorage.setItem('display_shellmanager_hiddencolumns', JSON.stringify(_display_shellmanager_hiddencolumns));
toastr.success(LANG['success'], LANG_T['success']);
// 重启应用
layer.confirm(LANG['confirm']['content'], {
icon: 2, shift: 6,
title: LANG['confirm']['title']
}, (_) => {
location.reload();
});
break;
}
});
}
}
module.exports = Display;
......@@ -10,12 +10,13 @@ const About = require('./about');
// const Update = require('./update');
const Language = require('./language');
const AProxy = require('./aproxy');
const Display = require('./display');
class Settings {
constructor() {
antSword['menubar'].reg('settings', this.open.bind(this));
['about', 'update', 'language', 'aproxy'].map((_) => {
['about', 'update', 'language', 'aproxy', 'display'].map((_) => {
antSword['menubar'].reg(`settings-${_}`, this.setActive.bind(this, _));
});
return this;
......@@ -42,6 +43,7 @@ class Settings {
this.language = new Language(sidebar);
// this.update = new Update(sidebar);
this.aproxy = new AProxy(sidebar);
this.display = new Display(sidebar);
this.cell = cell;
this.sidebar = sidebar;
......
......@@ -31,6 +31,9 @@ class Grid {
grid.setInitWidths("200,120,*,*,140,140");
grid.setColAlign("left,left,left,left,center,center");
grid.enableMultiselect(true);
// 根据设置隐藏相应的列
const dis_smhc = localStorage.hasOwnProperty('display_shellmanager_hiddencolumns') ? JSON.parse(localStorage.display_shellmanager_hiddencolumns):[];
dis_smhc.map((_)=>{grid.setColumnHidden(_,true)});
// 隐藏右键菜单
grid.attachEvent('onRowSelect', bmenu.hide);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment