# Redux
Для управления данными в клиентском приложении используется паттерн управления состоянием, обеспечивающий изменение данных на основе определённых правил. В веб-приложении на Redux используется единое дерево состояний – когда один объект содержит всё глобальное состояние приложения и служит «единственным источником истины». Это также означает, что в приложении содержится только одно такое хранилище - контейнер, в котором хранится состояние веб-приложения.
В компонентах происходит запуск действий, которые могут произвоидить вызовы клиент-серверных запросов или других асинхронных операций, которые, в свою очередь, отправляются редьюсерам, синхронно обновляющие хранилище данных.

Ниже описывается объекты данных, которые относятся к состоянию Redux. Термин "... object" (e.g. "simulation object") относится к обычному объекту, который вы бы получили от конечной точки Girder.
# Auth
auth: {
pending: false,
user: {},
},
pendingdetermines if there is an async auth action in progress.useris the user object we use throughout the application.
# Network
network: {
pending: {
[id] : { id, name, progress },
},
success: {},
error: {},
backlog: [ {contents of outdated pending, success, and errors} ],
progress: { [fileId]: {current: number, total: number}, ... }
progressReset: bool
},
pendingkeeps track of network calls that are still in progress, once they are complete they are moved into eithersuccessorerrorsuccessis a store of successfull network callserroris a store of failed network callsprogressis an object keeping track of file uploadsprogressResetis a boolean which controls the opacity and progress of the progress bar.
# Preferences
preferences: {
clusters: {
active: 0,
list: [
{ name, config, status }
],
mapById: {
[_id]: { name,
config,
status,
log: []
},
}
pending: false,
presets: {
[name]: { prop: value, ... }
}
},
aws: {
active: 0,
list: [],
mapById: {
[_id]: { },
}
pending: false,
},
statuses: {
ec2: [ {...} ],
clusters: [ {...} ],
}
},
Each property is self explanatory for what the data contains, they have some common properties too.
mapByIdThis is the main container for the parent property categorized by their id.pendingif there are any pending network calls, we use this to make sure we don't poll the endpoints more than necessary.listThis is the source for the item list in theActiveListpanel.activedetermines which item in the list is active, -1 if none are active.
Under clusters there's presets this is a list of preset machines so you don't have to enter them everytime. We have some preset machines at Kitware setup, if you'd like to add your own machines you can edit the source file for the presets at dist/clusters-presets.json.
# Taskflows
taskflows: {
pending: false,
mapById: {
[id]: {
flow: { taskflow... },
taskMapById: {
[id] : { task... }
},
jobMapById: {
[id] : { job... }
},
log: [ ...log entries ],
simulation: id,
primaryJob: 'pyfr_run',
stepName: 'Simulation',
actions: [ 'rerun', 'terminate' ],
allComplete: false,
outputDirectory: '/opt/hpccloud-jobs/23452345234',
}
},
taskflowMapByTaskId: {
[taskId]: ${taskflowId},
},
taskflowMapByJobId: {
[jobId]: ${taskflowId},
},
updateLogs: [ taskflowId, ... ],
},
The taskflow store is the most complicated store because of the amount of relations a single taskflow can have to other objects.
mapByIdis similar to mapById in clusters however it contains some extra information and the actual taskflow object is stored inflow, all other properties are effectively metadata.taskMayByIdcontains full task objects by id for the taskflow.jobMayByIdcontains full job objects by id for the taskflow.logis the taskflow's log, we display this as "Workflow log" in the JobMonitor component.simulationis the simulation id the taskflow belongs toprimaryJobis the primary job for the taskflowactionscontains button objects for the button bar on the simulation view page, they are updated in StateTransitionBehavior.allCompleteis a bool which helps StateTransitionBehavior determine actions.
taskflowMapByTaskIdandtaskflowMapByJobIdare maps of tasks and job id's which correspond to taskflows. These are used for connecting status and log events to the right objects.updateLogsused by StateTransitionBehavior to know if it should update.
# Projects
projects: {
workflowNames: [{ label: 'Saturn', value: 'saturn' }, ...],
list: [ '2345', '3456345' ],
active: '2345', // or null
mapById: {
'2345' : {
_id: 2345,
name: 'sdfsdf',
description: '',
}
},
simulations: {
[project id]: {
list: ['2345', '567657'],
active: '2345',
}
}
},
workflowNamesnames of avalable workflows, used for project creation.listlist of projects by name.activethe name of the active project.mapByIda map of projects by id.simulationsproject id's which correspond to list of simulations that belong to that project.
# Simulations
simulations: {
mapById: {
[simId]: { ...full simulation object }
}
},
mapByIdmap of simulation objects by id.
# Files
fs: {
folderMapById: {
[id]: {
open: false,
folder: { full folder... },
folderChildren: [ id's... ],
itemChildren: [ id's... ],
}
},
itemMapById: {
[id]: { fullItem },
}
}
folderMapByIdfolders by id, which contains:opena bool for if the folder is open.folderthe folder object.folderChildrenid's of folders inside the folder.itemChildrenid's of items inside the folder.
itemMapByIda map of item id's and to which folder othey belong.
← Панели Инструменты →