provide total pages on new group task creation to auto adjust the total pages on the web table
parent
e77194741d
commit
b8795e2615
|
@ -113,27 +113,31 @@ func ReloadCategoryGroups(category string) {
|
|||
}
|
||||
|
||||
if len(categoryGroups) > 0 {
|
||||
socketclients.BroadcastMessage(structs.SendSocketMessage{
|
||||
Cmd: utils.SentCmdGroupTasksReloaded,
|
||||
Body: struct {
|
||||
Category string
|
||||
CategoryGroups []structs.Group
|
||||
}{
|
||||
Category: category,
|
||||
CategoryGroups: categoryGroups,
|
||||
},
|
||||
})
|
||||
socketclients.BroadcastMessageToTopic(
|
||||
utils.SubscribedDynamicTopicGroupTasks+category,
|
||||
structs.SendSocketMessage{
|
||||
Cmd: utils.SentCmdGroupTasksReloaded,
|
||||
Body: struct {
|
||||
Category string
|
||||
CategoryGroups []structs.Group
|
||||
}{
|
||||
Category: category,
|
||||
CategoryGroups: categoryGroups,
|
||||
},
|
||||
})
|
||||
} else { // category was removed
|
||||
socketclients.BroadcastMessage(structs.SendSocketMessage{
|
||||
Cmd: utils.SentCmdGroupTasksReloaded,
|
||||
Body: struct {
|
||||
RemovedCategory string
|
||||
RemovedPermissions []string
|
||||
}{
|
||||
RemovedCategory: category,
|
||||
RemovedPermissions: systempermissions.RemoveDynamicGroupTasksPermissionsByCategory(category),
|
||||
},
|
||||
})
|
||||
socketclients.BroadcastMessageToTopic(
|
||||
utils.SubscribedDynamicTopicGroupTasks+category,
|
||||
structs.SendSocketMessage{
|
||||
Cmd: utils.SentCmdGroupTasksReloaded,
|
||||
Body: struct {
|
||||
RemovedCategory string
|
||||
RemovedPermissions []string
|
||||
}{
|
||||
RemovedCategory: category,
|
||||
RemovedPermissions: systempermissions.RemoveDynamicGroupTasksPermissionsByCategory(category),
|
||||
},
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -949,8 +953,14 @@ func StartGroupTask(userId string, groupTask structs.GroupTasks) {
|
|||
socketclients.BroadcastMessageToTopic(
|
||||
utils.SubscribedDynamicTopicGroupTasks+groupTask.Category,
|
||||
structs.SendSocketMessage{
|
||||
Cmd: utils.SentCmdNewGroupTaskStarted,
|
||||
Body: groupTask,
|
||||
Cmd: utils.SentCmdNewGroupTaskStarted,
|
||||
Body: struct {
|
||||
GroupTask structs.GroupTasks
|
||||
TotalPages int
|
||||
}{
|
||||
GroupTask: groupTask,
|
||||
TotalPages: utils.GetTotalPages([]structs.GroupTasks{}, "category = ?", groupTask.Category),
|
||||
},
|
||||
})
|
||||
|
||||
go RunGroupTask(RunGroupTaskArgs{
|
||||
|
|
|
@ -100,9 +100,10 @@ type GroupTaskStepFile struct {
|
|||
|
||||
// swagger:model ApiGroupTaskRequest
|
||||
type ApiGroupTaskRequest struct {
|
||||
Category string
|
||||
GroupId string
|
||||
Description string
|
||||
Category string
|
||||
GroupId string
|
||||
Description string
|
||||
// this format is needed [{"description": "bla"}]
|
||||
GlobalInputs json.RawMessage
|
||||
}
|
||||
|
||||
|
|
|
@ -41,50 +41,55 @@ const (
|
|||
)
|
||||
|
||||
var (
|
||||
AcceptedAvatarFileTypes = []string{"image/png", "image/jpeg", "image/jpg", "image/gif"}
|
||||
AcceptedAvatarFileTypes = []string{
|
||||
"image/png",
|
||||
"image/jpeg",
|
||||
"image/jpg",
|
||||
"image/gif"}
|
||||
)
|
||||
|
||||
// commands sent to web clients
|
||||
const (
|
||||
SentCmdInitUserSocketConnection = 1
|
||||
SentCmdUpdateConnectedUsers = 2
|
||||
SentCmdNewGroupTaskStarted = 3
|
||||
SentCmdNewGroupTaskStep = 4
|
||||
SentCmdUpdateGroupTaskStep = 5
|
||||
SentCmdUpdateGroupTask = 6
|
||||
SentCmdReloadingGroupTasks = 7
|
||||
SentCmdGroupTasksReloaded = 8
|
||||
SentCmdUpdateUserSessions = 9
|
||||
SentCmdUpdateAllUsersUserAvatar = 10
|
||||
SentCmdNewScanner = 11
|
||||
SentCmdDeleteScanner = 12
|
||||
SentCmdUpdateScannerUsedBy = 13
|
||||
SentCmdScanResult = 14
|
||||
SentCmdUpdateScannerLastUsed = 15
|
||||
SentCmdTaskLocked = 16
|
||||
SentCmdTaskUnlocked = 17
|
||||
SentCmdUserProfileUpdated = 18
|
||||
SentCmdAdminAreaNewRoleCreated = 19
|
||||
SentCmdAdminAreaRoleUpdated = 20
|
||||
SentCmdAdminAreaUpdateRoleSortingOrder = 21
|
||||
SentCmdAdminAreaRoleDeleted = 22
|
||||
SentCmdAllUsersUserRoleUpdated = 23
|
||||
SentCmdRolePermissionsUpdated = 24
|
||||
SentCmdErrorNoPermissions = 25
|
||||
SentCmdAllUsersNewUserCreated = 26
|
||||
SentCmdAllUsersUserDeleted = 27
|
||||
SentCmdAllUsersUserDeactivation = 28
|
||||
SentCmdGroupTasksCategoryGroupChanges = 29
|
||||
SentCmdNewUserApiKeyCreated = 30
|
||||
SentCmdDeletedUserApiKey = 31
|
||||
SentCmdNewApiKeyUsageCount = 32
|
||||
SentCmdInstallingPythonPackages = 33
|
||||
SentCmdInstallingPythonPackagesFailed = 34
|
||||
SentCmdInstallingPythonPackagesFinished = 35
|
||||
SentCmdInstallingGlobalPythonPackages = 36
|
||||
SentCmdInstallingGlobalPythonPackagesFailed = 37
|
||||
SentCmdInstallingGlobalPythonPackagesFinished = 38
|
||||
SentCmdUpdateUsers = 39
|
||||
SentCmdInitUserSocketConnection = 1
|
||||
SentCmdUpdateConnectedUsers = 2
|
||||
SentCmdNewGroupTaskStarted = 3
|
||||
SentCmdNewGroupTaskStep = 4
|
||||
SentCmdUpdateGroupTaskStep = 5
|
||||
SentCmdUpdateGroupTask = 6
|
||||
SentCmdReloadingGroupTasks = 7
|
||||
SentCmdGroupTasksReloaded = 8
|
||||
SentCmdUpdateUserSessions = 9
|
||||
SentCmdUpdateAllUsersUserAvatar = 10
|
||||
SentCmdNewScanner = 11
|
||||
SentCmdDeleteScanner = 12
|
||||
SentCmdUpdateScannerUsedBy = 13
|
||||
SentCmdScanResult = 14
|
||||
SentCmdUpdateScannerLastUsed = 15
|
||||
SentCmdTaskLocked = 16
|
||||
SentCmdTaskUnlocked = 17
|
||||
SentCmdUserProfileUpdated = 18
|
||||
SentCmdAdminAreaNewRoleCreated = 19
|
||||
SentCmdAdminAreaRoleUpdated = 20
|
||||
SentCmdAdminAreaUpdateRoleSortingOrder = 21
|
||||
SentCmdAdminAreaRoleDeleted = 22
|
||||
SentCmdAllUsersUserRoleUpdated = 23
|
||||
SentCmdRolePermissionsUpdated = 24
|
||||
SentCmdErrorNoPermissions = 25
|
||||
SentCmdAllUsersNewUserCreated = 26
|
||||
SentCmdAllUsersUserDeleted = 27
|
||||
SentCmdAllUsersUserDeactivation = 28
|
||||
SentCmdGroupTasksCategoryGroupChanges = 29
|
||||
SentCmdNewUserApiKeyCreated = 30
|
||||
SentCmdDeletedUserApiKey = 31
|
||||
SentCmdNewApiKeyUsageCount = 32
|
||||
SentCmdInstallingPythonPackages = 33
|
||||
SentCmdInstallingPythonPackagesFailed = 34
|
||||
SentCmdInstallingPythonPackagesFinished = 35
|
||||
SentCmdInstallingGlobalPythonPackages = 36
|
||||
SentCmdInstallingGlobalPythonPackagesFailed = 37
|
||||
SentCmdInstallingGlobalPythonPackagesFinished = 38
|
||||
SentCmdUpdateUsers = 39
|
||||
SentCmdCheckingForGroupTasksCategoryGroupChanges = 40
|
||||
)
|
||||
|
||||
// commands received from web clients
|
||||
|
|
|
@ -216,6 +216,11 @@
|
|||
"name": "stockItemId",
|
||||
"in": "path",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"description": "Page number",
|
||||
"name": "page",
|
||||
"in": "query"
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
|
@ -738,6 +743,7 @@
|
|||
"type": "string"
|
||||
},
|
||||
"GlobalInputs": {
|
||||
"description": "this format is needed [{\"description\": \"bla\"}]",
|
||||
"type": "object"
|
||||
},
|
||||
"GroupId": {
|
||||
|
@ -862,6 +868,21 @@
|
|||
},
|
||||
"x-go-package": "jannex/admin-dashboard-backend/modules/structs"
|
||||
},
|
||||
"GetGroupTaskStepsResponse": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"GroupTask": {
|
||||
"$ref": "#/definitions/GroupTasks"
|
||||
},
|
||||
"GroupTaskSteps": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/GroupTaskSteps"
|
||||
}
|
||||
}
|
||||
},
|
||||
"x-go-package": "jannex/admin-dashboard-backend/modules/structs"
|
||||
},
|
||||
"GlobalInputs": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
|
|
|
@ -155,8 +155,9 @@ func RunHub() {
|
|||
break
|
||||
}
|
||||
|
||||
socketclients.BroadcastMessageToUsersWithPermission(
|
||||
socketclients.BroadcastMessageToUsersWithPermissionAndTopic(
|
||||
systempermissions.ConvertXYPermission(utils.PermissionGroupTasksOverviewXYView, category),
|
||||
utils.SubscribedDynamicTopicGroupTasks+category,
|
||||
structs.SendSocketMessage{
|
||||
Cmd: utils.SentCmdReloadingGroupTasks,
|
||||
Body: category,
|
||||
|
@ -312,6 +313,12 @@ func RunHub() {
|
|||
break
|
||||
}
|
||||
|
||||
socketclients.BroadcastMessageToTopic(
|
||||
utils.SubscribedDynamicTopicGroupTasks,
|
||||
structs.SendSocketMessage{
|
||||
Cmd: utils.SentCmdCheckingForGroupTasksCategoryGroupChanges,
|
||||
})
|
||||
|
||||
grouptasks.LookingForCategoryGroupChanges(data.Conn.Locals("userId").(string))
|
||||
break
|
||||
case utils.ReceivedCmdHandleUserActionTaskStep:
|
||||
|
|
Loading…
Reference in New Issue