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