支持多网站缓存
This commit is contained in:
parent
4a2e2046aa
commit
eb568b1490
|
@ -43,6 +43,7 @@
|
|||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<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.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" />
|
||||
|
|
|
@ -163,13 +163,28 @@
|
|||
}
|
||||
|
||||
.ui-sortable > li {
|
||||
padding-left: 35px !important;
|
||||
padding-left: 35px;
|
||||
position: relative;
|
||||
background: #f5f6f8;
|
||||
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 {
|
||||
border-left: 3px solid #41CAC0;
|
||||
}
|
||||
|
|
|
@ -1,18 +1,38 @@
|
|||
using Bootstrap.DataAccess;
|
||||
using Longbow.Caching.Configuration;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web.Http;
|
||||
|
||||
|
||||
namespace Bootstrap.Admin.Controllers
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public class ProfilesController : ApiController
|
||||
{
|
||||
// POST api/<controller>
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="value"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public bool Post([FromBody]JObject value)
|
||||
{
|
||||
//保存个性化设置
|
||||
dynamic json = value;
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -57,16 +57,40 @@
|
|||
}
|
||||
});
|
||||
|
||||
function listCache(options) {
|
||||
options = $.extend({ url: '../../CacheList.axd' }, options);
|
||||
var $sortable = $('#sortable');
|
||||
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({
|
||||
url: options.url,
|
||||
swal: false,
|
||||
callback: function (result) {
|
||||
if (result) {
|
||||
if (result && options.key == '') {
|
||||
result = $.parseJSON(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) {
|
||||
return x.Key > y.Key ? 1 : -1;
|
||||
}).map(function (ele) {
|
||||
|
@ -106,19 +130,22 @@
|
|||
default:
|
||||
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('');
|
||||
$('#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();
|
||||
$('#sortable .btn').click(function () {
|
||||
listCache({ url: $.format('../../CacheList.axd?cacheKey={0}', $(this).attr('data-key')) });
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
listCache();
|
||||
$('#refreshCache').click(function () { listCache(); });
|
||||
$('#clearCache').click(function () { listCache({ url: '../../CacheList.axd?clear=clear' }); });
|
||||
$('#refreshCache').click(function () { listCacheUrl(); }).trigger('click');
|
||||
$('#clearCache').click(function () { listCacheUrl({ clear: true }); });
|
||||
$sortable.on('click', '.btn', function () {
|
||||
console.log($(this).attr('data-key'));
|
||||
listCache({ key: $(this).attr('data-key'), url: $(this).attr('data-url') });
|
||||
listCacheUrl();
|
||||
});
|
||||
})
|
|
@ -54,6 +54,7 @@
|
|||
|
||||
<cacheManagerList>
|
||||
<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>
|
||||
|
||||
<exceptionManagement>
|
||||
|
|
Loading…
Reference in New Issue