Allow to delete a project csv uuid

stable
Daniel García 2018-09-12 12:44:46 +02:00 committed by Alex Hermida
parent d501d53fae
commit 4b67893e79
5 changed files with 50 additions and 4 deletions

View File

@ -438,6 +438,19 @@ class CsvExporterController extends taiga.Controller
response.finish() if response
return promise
_deleteUuid: (response=null) =>
promise = @rs.projects["delete_#{@.type}_csv_uuid"](@scope.projectId)
promise.then (data) =>
@scope.csvUuid = data.data?.uuid
promise.then null, =>
@confirm.notify("error")
promise.finally ->
response.finish() if response
return promise
regenerateUuid: ->
if @scope.csvUuid
title = @translate.instant("ADMIN.REPORTS.REGENERATE_TITLE")
@ -447,6 +460,15 @@ class CsvExporterController extends taiga.Controller
else
@._generateUuid()
deleteUuid: ->
if @scope.csvUuid
title = @translate.instant("ADMIN.REPORTS.DELETE_TITLE")
subtitle = @translate.instant("ADMIN.REPORTS.DELETE_SUBTITLE")
@confirm.ask(title, subtitle).then @._deleteUuid
else
@._deleteUuid()
class CsvExporterEpicsController extends CsvExporterController
type: "epics"

View File

@ -79,6 +79,22 @@ resourceProvider = ($config, $repo, $http, $urls, $auth, $q, $translate) ->
url = "#{$urls.resolve("projects")}/#{projectId}/regenerate_issues_csv_uuid"
return $http.post(url)
service.delete_epics_csv_uuid = (projectId) ->
url = "#{$urls.resolve("projects")}/#{projectId}/delete_epics_csv_uuid"
return $http.post(url)
service.delete_userstories_csv_uuid = (projectId) ->
url = "#{$urls.resolve("projects")}/#{projectId}/delete_userstories_csv_uuid"
return $http.post(url)
service.delete_tasks_csv_uuid = (projectId) ->
url = "#{$urls.resolve("projects")}/#{projectId}/delete_tasks_csv_uuid"
return $http.post(url)
service.delete_issues_csv_uuid = (projectId) ->
url = "#{$urls.resolve("projects")}/#{projectId}/delete_issues_csv_uuid"
return $http.post(url)
service.leave = (projectId) ->
url = "#{$urls.resolve("projects")}/#{projectId}/leave"
return $http.post(url)

View File

@ -537,7 +537,9 @@
"DESCRIPTION": "Download a CSV file or copy the generated URL and open it in your favourite text editor or spreadsheet to make your own project data reports. You will be able to visualize and analyze all your data easily.",
"HELP": "How to use this on my own spreadsheet?",
"REGENERATE_TITLE": "Change URL",
"REGENERATE_SUBTITLE": "You going to change the CSV data access url. The previous url will be disabled. Are you sure?"
"REGENERATE_SUBTITLE": "You are going to change the CSV data access url. The previous url will be disabled. Are you sure?",
"DELETE_TITLE": "Delete URL",
"DELETE_SUBTITLE": "You are going to delete the current CSV data access url. Are you sure?"
},
"CSV": {
"SECTION_TITLE_EPIC": "epics reports",
@ -548,7 +550,9 @@
"URL_FIELD_PLACEHOLDER": "Please regenerate CSV url",
"TITLE_REGENERATE_URL": "Regenerate CSV url",
"ACTION_GENERATE_URL": "Generate Url",
"ACTION_REGENERATE": "Regenerate"
"ACTION_REGENERATE": "Regenerate",
"TITLE_DELETE_URL": "Delete CSV url",
"ACTION_DELETE_URL": "Delete"
},
"CUSTOM_FIELDS": {
"TITLE": "Custom Fields",

View File

@ -18,3 +18,7 @@ section.project-csv(tg-select-input-text)
tg-svg(svg-icon="icon-reload", ng-show="csvUrl")
span(ng-Show="csvUrl", translate="ADMIN.CSV.ACTION_REGENERATE")
a(href="", ng-show="csvUrl" title="{{'ADMIN.CSV.TITLE_DELETE_URL' | translate}}", ng-click="ctrl.deleteUuid()")
tg-svg(svg-icon="icon-trash", ng-show="csvUrl")
span(ng-Show="csvUrl", translate="ADMIN.CSV.ACTION_DELETE_URL")

View File

@ -11,7 +11,8 @@
margin-bottom: 1rem;
a {
@include font-size(small);
min-width: 110px;
margin-left: 1em;
white-space: nowrap;
}
.icon:not(.icon-clipboard) {
fill: currentColor;
@ -23,7 +24,6 @@
}
.field-with-options {
display: flex;
margin-right: 1rem;
width: 100%;
input {
flex-grow: 1;