ui(admin): add "working" React admin ui
This commit is contained in:
parent
d1c7494933
commit
5402584508
199 changed files with 13387 additions and 151 deletions
29
resources/scripts/state/admin/nodes.ts
Normal file
29
resources/scripts/state/admin/nodes.ts
Normal file
|
@ -0,0 +1,29 @@
|
|||
import type { Action } from 'easy-peasy';
|
||||
import { action } from 'easy-peasy';
|
||||
|
||||
interface AdminNodeStore {
|
||||
selectedNodes: number[];
|
||||
|
||||
setSelectedNodes: Action<AdminNodeStore, number[]>;
|
||||
appendSelectedNode: Action<AdminNodeStore, number>;
|
||||
removeSelectedNode: Action<AdminNodeStore, number>;
|
||||
}
|
||||
|
||||
const nodes: AdminNodeStore = {
|
||||
selectedNodes: [],
|
||||
|
||||
setSelectedNodes: action((state, payload) => {
|
||||
state.selectedNodes = payload;
|
||||
}),
|
||||
|
||||
appendSelectedNode: action((state, payload) => {
|
||||
state.selectedNodes = state.selectedNodes.filter(id => id !== payload).concat(payload);
|
||||
}),
|
||||
|
||||
removeSelectedNode: action((state, payload) => {
|
||||
state.selectedNodes = state.selectedNodes.filter(id => id !== payload);
|
||||
}),
|
||||
};
|
||||
|
||||
export type { AdminNodeStore };
|
||||
export default nodes;
|
Loading…
Add table
Add a link
Reference in a new issue