Upgrade to Mithril 2.0
This commit is contained in:
1 parent
3485bb8d1b
commit
ae870c3155
6 files changed
+29
-21
No files matched your search
Generated
+5
-6
@@ -599,9 +599,8 @@
|
|||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"@types/mithril": {
|
"@types/mithril": {
|
||||||
"version": "1.1.16",
|
"version": "github:MithrilJS/mithril.d.ts#fa4408680aec957d87140a5c4f25bd5902b58136",
|
||||||
"resolved": "https://registry.npmjs.org/@types/mithril/-/mithril-1.1.16.tgz",
|
"from": "github:MithrilJS/mithril.d.ts#next",
|
||||||
"integrity": "sha512-+HlRvSpKwXP8RXh1hrIcgSHQ/Fh+5O9nYfG7fgNN7PGr2K03G+hLoiA+HXzmUJCsQfPEuNiBQ+TwRl6n7kerSw==",
|
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"@types/mongodb": {
|
"@types/mongodb": {
|
||||||
@@ -5775,9 +5774,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"mithril": {
|
"mithril": {
|
||||||
"version": "1.1.6",
|
"version": "2.0.0-rc.8",
|
||||||
"resolved": "https://registry.npmjs.org/mithril/-/mithril-1.1.6.tgz",
|
"resolved": "https://registry.npmjs.org/mithril/-/mithril-2.0.0-rc.8.tgz",
|
||||||
"integrity": "sha512-fWcUrQTCqu8M916rj1MFGlHaPh65rznPu6U/N2U9g81H89klDCIptSK5bnkNkC+jyi3sJIXjyGhSQjUnR8jzZA==",
|
"integrity": "sha512-7XvrXBW/b/NfSAP6VdMW+g9qq6tc2Pq+DPesVXsbo25W3EBfHFFDHIMk3mQV8UcBpA2qV4xXYplel4JClB7BXA==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"mixin-deep": {
|
"mixin-deep": {
|
||||||
|
|||||||
+2
-2
@@ -43,7 +43,7 @@
|
|||||||
"@types/koa-router": "^7.0.40",
|
"@types/koa-router": "^7.0.40",
|
||||||
"@types/koa-static": "^4.0.1",
|
"@types/koa-static": "^4.0.1",
|
||||||
"@types/libxmljs": "^0.18.3",
|
"@types/libxmljs": "^0.18.3",
|
||||||
"@types/mithril": "^1.1.16",
|
"@types/mithril": "github:MithrilJS/mithril.d.ts#next",
|
||||||
"@types/mongodb": "^3.1.28",
|
"@types/mongodb": "^3.1.28",
|
||||||
"@types/parsimmon": "^1.10.0",
|
"@types/parsimmon": "^1.10.0",
|
||||||
"@types/seedrandom": "^2.4.28",
|
"@types/seedrandom": "^2.4.28",
|
||||||
@@ -54,7 +54,7 @@
|
|||||||
"eslint": "^5.16.0",
|
"eslint": "^5.16.0",
|
||||||
"eslint-config-prettier": "^4.3.0",
|
"eslint-config-prettier": "^4.3.0",
|
||||||
"esm": "^3.2.25",
|
"esm": "^3.2.25",
|
||||||
"mithril": "^1.1.6",
|
"mithril": "^2.0.0-rc.8",
|
||||||
"postcss": "^7.0.16",
|
"postcss": "^7.0.16",
|
||||||
"postcss-cssnext": "^3.1.0",
|
"postcss-cssnext": "^3.1.0",
|
||||||
"postcss-import": "^12.0.1",
|
"postcss-import": "^12.0.1",
|
||||||
|
|||||||
@@ -40,7 +40,9 @@ const component: ClosureComponent = (): Component => {
|
|||||||
type: "text",
|
type: "text",
|
||||||
value: vnode.state["username"],
|
value: vnode.state["username"],
|
||||||
disabled: !!username,
|
disabled: !!username,
|
||||||
oninput: m.withAttr("value", v => (vnode.state["username"] = v)),
|
oninput: e => {
|
||||||
|
vnode.state["username"] = e.target.value;
|
||||||
|
},
|
||||||
oncreate: _vnode => {
|
oncreate: _vnode => {
|
||||||
(_vnode.dom as HTMLSelectElement).focus();
|
(_vnode.dom as HTMLSelectElement).focus();
|
||||||
}
|
}
|
||||||
@@ -64,7 +66,9 @@ const component: ClosureComponent = (): Component => {
|
|||||||
name: f,
|
name: f,
|
||||||
type: "password",
|
type: "password",
|
||||||
value: vnode.state[f],
|
value: vnode.state[f],
|
||||||
oninput: m.withAttr("value", v => (vnode.state[f] = v))
|
oninput: e => {
|
||||||
|
vnode.state[f] = e.target.value;
|
||||||
|
}
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|||||||
+3
-2
@@ -104,12 +104,13 @@ function putActionHandler(action, _object): Promise<ValidationErrors> {
|
|||||||
object
|
object
|
||||||
);
|
);
|
||||||
|
|
||||||
m.request({
|
store
|
||||||
|
.xhrRequest({
|
||||||
method: "PUT",
|
method: "PUT",
|
||||||
headers: headers,
|
headers: headers,
|
||||||
url: `/api/files/${encodeURIComponent(id)}`,
|
url: `/api/files/${encodeURIComponent(id)}`,
|
||||||
serialize: body => body, // Identity function to prevent JSON.parse on blob data
|
serialize: body => body, // Identity function to prevent JSON.parse on blob data
|
||||||
data: file
|
body: file
|
||||||
})
|
})
|
||||||
.then(() => {
|
.then(() => {
|
||||||
notifications.push(
|
notifications.push(
|
||||||
|
|||||||
+6
-2
@@ -48,7 +48,9 @@ export const component: ClosureComponent = (): Component => {
|
|||||||
oncreate: vnode2 => {
|
oncreate: vnode2 => {
|
||||||
(vnode2.dom as HTMLInputElement).focus();
|
(vnode2.dom as HTMLInputElement).focus();
|
||||||
},
|
},
|
||||||
oninput: m.withAttr("value", v => (vnode.state["username"] = v))
|
oninput: e => {
|
||||||
|
vnode.state["username"] = e.target.value;
|
||||||
|
}
|
||||||
})
|
})
|
||||||
),
|
),
|
||||||
m(
|
m(
|
||||||
@@ -58,7 +60,9 @@ export const component: ClosureComponent = (): Component => {
|
|||||||
name: "password",
|
name: "password",
|
||||||
type: "password",
|
type: "password",
|
||||||
value: vnode.state["password"],
|
value: vnode.state["password"],
|
||||||
oninput: m.withAttr("value", v => (vnode.state["password"] = v))
|
oninput: e => {
|
||||||
|
vnode.state["password"] = e.target.value;
|
||||||
|
}
|
||||||
})
|
})
|
||||||
),
|
),
|
||||||
m(
|
m(
|
||||||
|
|||||||
+7
-7
@@ -555,7 +555,7 @@ export function postTasks(deviceId, tasks): Promise<string> {
|
|||||||
return xhrRequest({
|
return xhrRequest({
|
||||||
method: "POST",
|
method: "POST",
|
||||||
url: `/api/devices/${encodeURIComponent(deviceId)}/tasks`,
|
url: `/api/devices/${encodeURIComponent(deviceId)}/tasks`,
|
||||||
data: tasks,
|
body: tasks,
|
||||||
extract: xhr => {
|
extract: xhr => {
|
||||||
if (xhr.status !== 200) throw new Error(xhr.response);
|
if (xhr.status !== 200) throw new Error(xhr.response);
|
||||||
const connectionRequestStatus = xhr.getResponseHeader(
|
const connectionRequestStatus = xhr.getResponseHeader(
|
||||||
@@ -576,7 +576,7 @@ export function updateTags(deviceId, tags): Promise<void> {
|
|||||||
return xhrRequest({
|
return xhrRequest({
|
||||||
method: "POST",
|
method: "POST",
|
||||||
url: `/api/devices/${encodeURIComponent(deviceId)}/tags`,
|
url: `/api/devices/${encodeURIComponent(deviceId)}/tags`,
|
||||||
data: tags
|
body: tags
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -593,7 +593,7 @@ export function putResource(resourceType, id, object): Promise<void> {
|
|||||||
return xhrRequest({
|
return xhrRequest({
|
||||||
method: "PUT",
|
method: "PUT",
|
||||||
url: `/api/${resourceType}/${encodeURIComponent(id)}`,
|
url: `/api/${resourceType}/${encodeURIComponent(id)}`,
|
||||||
data: object
|
body: object
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -631,13 +631,13 @@ export function changePassword(
|
|||||||
newPassword,
|
newPassword,
|
||||||
authPassword?
|
authPassword?
|
||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
const data = { newPassword };
|
const body = { newPassword };
|
||||||
if (authPassword) data["authPassword"] = authPassword;
|
if (authPassword) body["authPassword"] = authPassword;
|
||||||
return xhrRequest({
|
return xhrRequest({
|
||||||
method: "PUT",
|
method: "PUT",
|
||||||
url: `/api/users/${username}/password`,
|
url: `/api/users/${username}/password`,
|
||||||
background: true,
|
background: true,
|
||||||
data
|
body
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -646,7 +646,7 @@ export function logIn(username, password): Promise<void> {
|
|||||||
method: "POST",
|
method: "POST",
|
||||||
url: "/login",
|
url: "/login",
|
||||||
background: true,
|
background: true,
|
||||||
data: { username, password }
|
body: { username, password }
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user