支持多网站缓存

This commit is contained in:
Argo-Lenovo 2016-11-25 16:52:52 +08:00
parent 4a2e2046aa
commit eb568b1490
5 changed files with 80 additions and 16 deletions

View File

@ -43,6 +43,7 @@
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Reference Include="Longbow, Version=3.0.0.0, Culture=neutral, PublicKeyToken=c20f2177a7066899, processorArchitecture=MSIL" />
<Reference Include="Longbow.ExceptionManagement, Version=3.0.0.0, Culture=neutral, PublicKeyToken=c20f2177a7066899, processorArchitecture=MSIL" /> <Reference Include="Longbow.ExceptionManagement, Version=3.0.0.0, Culture=neutral, PublicKeyToken=c20f2177a7066899, processorArchitecture=MSIL" />
<Reference Include="Longbow.V4, Version=4.0.0.0, Culture=neutral, PublicKeyToken=c20f2177a7066899, processorArchitecture=MSIL" /> <Reference Include="Longbow.V4, Version=4.0.0.0, Culture=neutral, PublicKeyToken=c20f2177a7066899, processorArchitecture=MSIL" />
<Reference Include="Longbow.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=c20f2177a7066899, processorArchitecture=MSIL" /> <Reference Include="Longbow.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=c20f2177a7066899, processorArchitecture=MSIL" />

View File

@ -163,11 +163,26 @@
} }
.ui-sortable > li { .ui-sortable > li {
padding-left: 35px !important; padding-left: 35px;
position: relative; position: relative;
background: #f5f6f8; background: #f5f6f8;
margin-bottom: 2px; margin-bottom: 2px;
border-bottom: none !important; border-bottom: none;
}
.ui-sortable li.title {
font-size: 14px;
color: #0077de;
background-color: #b5f1b6;
padding: 10px 15px;
}
.ui-sortable li.title:hover {
background-color: #b5f1b6;
}
.ui-sortable li.title:first-child {
border-radius: 4px 4px 0 0;
} }
.ui-sortable li.list-primary { .ui-sortable li.list-primary {

View File

@ -1,18 +1,38 @@
using Bootstrap.DataAccess; using Bootstrap.DataAccess;
using Longbow.Caching.Configuration;
using Newtonsoft.Json.Linq; using Newtonsoft.Json.Linq;
using System.Collections.Generic;
using System.Linq;
using System.Web.Http; using System.Web.Http;
namespace Bootstrap.Admin.Controllers namespace Bootstrap.Admin.Controllers
{ {
/// <summary>
///
/// </summary>
public class ProfilesController : ApiController public class ProfilesController : ApiController
{ {
// POST api/<controller> /// <summary>
///
/// </summary>
/// <param name="value"></param>
/// <returns></returns>
[HttpPost]
public bool Post([FromBody]JObject value) public bool Post([FromBody]JObject value)
{ {
//保存个性化设置 //保存个性化设置
dynamic json = value; dynamic json = value;
return DictHelper.SaveProfiles((string)json.name, (string)json.code, (string)json.category); return DictHelper.SaveProfiles((string)json.name, (string)json.code, (string)json.category);
} }
/// <summary>
///
/// </summary>
/// <param name="value"></param>
[HttpGet]
public IEnumerable<CacheListElement> Get([FromUri]JObject value)
{
var section = CacheListSection.GetSection();
return section.Items.Where(item => item.Enabled);
}
} }
} }

View File

@ -57,16 +57,40 @@
} }
}); });
function listCache(options) { var $sortable = $('#sortable');
options = $.extend({ url: '../../CacheList.axd' }, options); var listCacheUrl = function (options) {
options = $.extend({ clear: false }, options);
$sortable.html('');
$.bc({
url: Profiles.url,
method: 'GET',
swal: false,
callback: function (result) {
if (result && $.isArray(result)) {
$.each(result, function (index, item) {
listCache($.extend({ item: item, url: item.Url }, options));
});
}
}
});
}
var listCache = function (options) {
options = $.extend({ clear: false, key: '' }, options);
if (options.key != '') {
options.url = $.format(options.url, options.key);
}
if (options.clear) {
options.url += '&clear=clear';
}
$.bc({ $.bc({
url: options.url, url: options.url,
swal: false, swal: false,
callback: function (result) { callback: function (result) {
if (result) { if (result && options.key == '') {
result = $.parseJSON(result); result = $.parseJSON(result);
if ($.isArray(result)) { if ($.isArray(result)) {
var html = '<li class="{4}"><i class="fa fa-ellipsis-v"></i><div class="task-title"><span class="task-title-sp tooltips" data-placement="right" title="{1}">{2}</span><span class="badge badge-sm label-success">{0}</span><span class="task-value tooltips" data-placement="top" data-original-title="{3}">{3}</span><div class="pull-right hidden-phone"><button class="btn btn-danger btn-xs fa fa-trash-o" data-key="{1}"></button></div></div></li>'; var html = '<li class="{4}"><i class="fa fa-ellipsis-v"></i><div class="task-title"><span class="task-title-sp tooltips" data-placement="right" title="{1}">{2}</span><span class="badge badge-sm label-success">{0}</span><span class="task-value tooltips" data-placement="top" data-original-title="{3}">{3}</span><div class="pull-right hidden-phone"><button class="btn btn-danger btn-xs fa fa-trash-o" data-key="{1}" data-url="{5}"></button></div></div></li>';
var content = result.sort(function (x, y) { var content = result.sort(function (x, y) {
return x.Key > y.Key ? 1 : -1; return x.Key > y.Key ? 1 : -1;
}).map(function (ele) { }).map(function (ele) {
@ -106,19 +130,22 @@
default: default:
break; break;
} }
return $.format(html, ele.Interval, ele.Key, ele.Desc, ele.Value, css); return $.format(html, ele.Interval, ele.Key, ele.Desc, ele.Value, css, options.url);
}).join(''); }).join('');
$('#sortable').html(content); $sortable.append($.format('<li class="title">{0}-{1}</li>', options.item.Desc, options.item.Key));
$sortable.append(content);
$('.tooltips').tooltip('destroy');
$('.tooltips').tooltip(); $('.tooltips').tooltip();
$('#sortable .btn').click(function () {
listCache({ url: $.format('../../CacheList.axd?cacheKey={0}', $(this).attr('data-key')) });
});
} }
} }
} }
}); });
} }
listCache(); $('#refreshCache').click(function () { listCacheUrl(); }).trigger('click');
$('#refreshCache').click(function () { listCache(); }); $('#clearCache').click(function () { listCacheUrl({ clear: true }); });
$('#clearCache').click(function () { listCache({ url: '../../CacheList.axd?clear=clear' }); }); $sortable.on('click', '.btn', function () {
console.log($(this).attr('data-key'));
listCache({ key: $(this).attr('data-key'), url: $(this).attr('data-url') });
listCacheUrl();
});
}) })

View File

@ -54,6 +54,7 @@
<cacheManagerList> <cacheManagerList>
<add key="bd" url="http://localhost:53233/CacheList.axd?cacheKey={0}" desc="系统缓存模块"/> <add key="bd" url="http://localhost:53233/CacheList.axd?cacheKey={0}" desc="系统缓存模块"/>
<add key="bccs" url="http://localhost:3609/CacheList.axd?cacheKey={0}" desc="集控系统缓存模块"/>
</cacheManagerList> </cacheManagerList>
<exceptionManagement> <exceptionManagement>