Fix swagger authorization prompt hiding.

Add missing swagger documentation for action.
This commit is contained in:
Mustafa Leithy 2018-03-13 12:10:32 +02:00
Родитель 2a7eb9eed2
Коммит 7c84a1cf69
6 изменённых файлов: 12 добавлений и 7 удалений

1
Backend/.gitignore поставляемый
Просмотреть файл

@ -282,4 +282,5 @@ __pycache__/
PublishProfiles/
src/Trackable.Web/wwwroot/dist/**
!src/Trackable.Web/wwwroot/dist/swagger/
!src/Trackable.Web/wwwroot/dist/swagger/swagger.css
!src/Trackable.Web/wwwroot/dist/swagger/swagger.js

Просмотреть файл

@ -205,7 +205,7 @@ namespace Trackable.Web.Controllers
}
/// <summary>
/// Register TrackingPoints related to device, check geofences
/// Register TrackingPoints related to device and check geofences
/// </summary>
/// <param name="id">The device id</param>
/// <param name="points">List of TrackingPoints</param>

Просмотреть файл

@ -155,6 +155,11 @@ namespace Trackable.Web.Controllers
return this.dtoMapper.Map<LocationDto>(result);
}
/// <summary>
/// Delete location
/// </summary>
/// <param name="id">The location id</param>
/// <returns>Ok response</returns>
// DELETE api/locations/5
[HttpDelete("{id}")]
[Authorize(UserRoles.Administrator)]

Просмотреть файл

@ -169,7 +169,6 @@ namespace Trackable.Web
return description.RelativePath.StartsWith("api");
});
var filePath = Path.Combine(System.AppDomain.CurrentDomain.BaseDirectory, "Trackable.Web.xml");
c.IncludeXmlComments(filePath);
});
@ -246,7 +245,7 @@ namespace Trackable.Web
app.UseSwaggerUI(c =>
{
c.SwaggerEndpoint("/swagger/v1/swagger.json", "BMFT APIs V1");
c.HeadContent = "<script type=\"application/javascript\" src=\"/swagger/swagger.js\"></script>";
c.HeadContent = "<script type=\"application/javascript\" src=\"/swagger/swagger.js\"></script><link rel=\"stylesheet\" href=\"/swagger/swagger.css\">";
c.DocumentTitle = "BMFT Swagger";
});
}

3
Backend/src/Trackable.Web/wwwroot/dist/swagger/swagger.css поставляемый Normal file
Просмотреть файл

@ -0,0 +1,3 @@
.swagger-ui .scheme-container {
display: none;
}

Просмотреть файл

@ -7,9 +7,6 @@ xhttp.onreadystatechange = function () {
if (this.readyState == 4 && this.status != 200) {
window.location.href = "../api/users/login?redirectUri=" + window.location.href;
}
if (document.getElementsByClassName('auth-wrapper')) {
document.getElementsByClassName('auth-wrapper')[0].parentNode.parentNode.style.display = 'none';
}
};
xhttp.open("GET", "../api/users/me", true);
xhttp.send();
xhttp.send();