-
-
Notifications
You must be signed in to change notification settings - Fork 551
/
contents.ts
192 lines (171 loc) Β· 4.34 KB
/
contents.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
// Local modules
import * as actionTypes from "../actionTypes";
export const toggleHeaderEditor = (
payload: actionTypes.ToggleHeaderEditor["payload"]
): actionTypes.ToggleHeaderEditor => ({
type: actionTypes.TOGGLE_HEADER_EDITOR,
payload
});
export const changeContentName = (
payload: actionTypes.ChangeContentName["payload"]
): actionTypes.ChangeContentName => ({
type: actionTypes.CHANGE_CONTENT_NAME,
payload
});
export const changeContentNameFulfilled = (
payload: actionTypes.ChangeContentNameFulfilled["payload"]
): actionTypes.ChangeContentNameFulfilled => ({
type: actionTypes.CHANGE_CONTENT_NAME_FULFILLED,
payload
});
export const changeContentNameFailed = (
payload: actionTypes.ChangeContentNameFailed["payload"]
): actionTypes.ChangeContentNameFailed => ({
type: actionTypes.CHANGE_CONTENT_NAME_FAILED,
payload
});
export const fetchContent = (
payload: actionTypes.FetchContent["payload"]
): actionTypes.FetchContent => ({
type: actionTypes.FETCH_CONTENT,
payload
});
export const fetchContentFulfilled = (
payload: actionTypes.FetchContentFulfilled["payload"]
): actionTypes.FetchContentFulfilled => ({
type: actionTypes.FETCH_CONTENT_FULFILLED,
payload
});
export const fetchContentFailed = (
payload: actionTypes.FetchContentFailed["payload"]
): actionTypes.FetchContentFailed => ({
type: actionTypes.FETCH_CONTENT_FAILED,
payload,
error: true
});
export function changeFilename(
payload: actionTypes.ChangeFilenameAction["payload"]
): actionTypes.ChangeFilenameAction {
return {
type: actionTypes.CHANGE_FILENAME,
payload
};
}
export function downloadContent(
payload: actionTypes.DownloadContent["payload"]
): actionTypes.DownloadContent {
return {
type: actionTypes.DOWNLOAD_CONTENT,
payload
};
}
export function downloadContentFailed(
payload: actionTypes.DownloadContentFailed["payload"]
): actionTypes.DownloadContentFailed {
return {
type: actionTypes.DOWNLOAD_CONTENT_FAILED,
payload
};
}
export function downloadContentFulfilled(
payload: actionTypes.DownloadContentFulfilled["payload"]
): actionTypes.DownloadContentFulfilled {
return {
type: actionTypes.DOWNLOAD_CONTENT_FULFILLED,
payload
};
}
export function save(payload: actionTypes.Save["payload"]): actionTypes.Save {
return {
type: actionTypes.SAVE,
payload
};
}
export function saveAs(
payload: actionTypes.SaveAs["payload"]
): actionTypes.SaveAs {
return {
type: actionTypes.SAVE_AS,
payload
};
}
export function saveFailed(
payload: actionTypes.SaveFailed["payload"]
): actionTypes.SaveFailed {
return {
type: actionTypes.SAVE_FAILED,
payload,
error: true
};
}
export function saveFulfilled(
payload: actionTypes.SaveFulfilled["payload"]
): actionTypes.SaveFulfilled {
return {
type: actionTypes.SAVE_FULFILLED,
payload
};
}
export function saveAsFailed(
payload: actionTypes.SaveAsFailed["payload"]
): actionTypes.SaveAsFailed {
return {
type: actionTypes.SAVE_AS_FAILED,
payload,
error: true
};
}
export function saveAsFulfilled(
payload: actionTypes.SaveAsFulfilled["payload"]
): actionTypes.SaveAsFulfilled {
return {
type: actionTypes.SAVE_AS_FULFILLED,
payload
};
}
// TODO: New Notebook action should use a kernel spec type
export function newNotebook(
payload: actionTypes.NewNotebook["payload"]
): actionTypes.NewNotebook {
return {
type: actionTypes.NEW_NOTEBOOK,
payload: {
filepath: payload.filepath,
kernelSpec: payload.kernelSpec,
cwd: payload.cwd || process.cwd(), // Desktop should be passing in the cwd
kernelRef: payload.kernelRef,
contentRef: payload.contentRef
}
};
}
export function updateFileText(
payload: actionTypes.UpdateFileText["payload"]
): actionTypes.UpdateFileText {
return {
type: actionTypes.UPDATE_FILE_TEXT,
payload: {
contentRef: payload.contentRef,
text: payload.text
}
};
}
export function closeNotebook(
payload: actionTypes.DisposeContent["payload"]
): actionTypes.CloseNotebook {
return {
type: actionTypes.CLOSE_NOTEBOOK,
payload: {
contentRef: payload.contentRef
}
};
}
export function disposeContent(
payload: actionTypes.DisposeContent["payload"]
): actionTypes.DisposeContent {
return {
type: actionTypes.DISPOSE_CONTENT,
payload: {
contentRef: payload.contentRef
}
};
}