diff options
author | Sam Wilkins <samwilkins333@gmail.com> | 2020-01-10 14:34:22 -0500 |
---|---|---|
committer | Sam Wilkins <samwilkins333@gmail.com> | 2020-01-10 14:34:22 -0500 |
commit | 7741fd9cc135f94fbc1b68d89d68e38c93648f33 (patch) | |
tree | 6835b149857ea16454a81673e3b39af6e89ca0de /src | |
parent | cfba84bdfee74407b9dcbe80505f527ddb4b0433 (diff) |
created multicolumn view file, made recipient parameter optional in sessionmanager
Diffstat (limited to 'src')
-rw-r--r-- | src/client/views/CollectionMulticolumnView.tsx | 25 | ||||
-rw-r--r-- | src/server/ApiManagers/SessionManager.ts | 6 | ||||
-rw-r--r-- | src/server/DashSession/DashSessionAgent.ts | 25 |
3 files changed, 45 insertions, 11 deletions
diff --git a/src/client/views/CollectionMulticolumnView.tsx b/src/client/views/CollectionMulticolumnView.tsx new file mode 100644 index 000000000..8f0ffd3d0 --- /dev/null +++ b/src/client/views/CollectionMulticolumnView.tsx @@ -0,0 +1,25 @@ +import { observer } from 'mobx-react'; +import { makeInterface } from '../../new_fields/Schema'; +import { documentSchema } from '../../new_fields/documentSchemas'; +import { CollectionSubView } from './collections/CollectionSubView'; +import { DragManager } from '../util/DragManager'; + +type MulticolumnDocument = makeInterface<[typeof documentSchema]>; +const MulticolumnDocument = makeInterface(documentSchema); + +@observer +export default class CollectionMulticolumnView extends CollectionSubView(MulticolumnDocument) { + + private _dropDisposer?: DragManager.DragDropDisposer; + protected createDropTarget = (ele: HTMLDivElement) => { //used for stacking and masonry view + this._dropDisposer && this._dropDisposer(); + if (ele) { + this._dropDisposer = DragManager.MakeDropTarget(ele, this.drop.bind(this)); + } + } + + render() { + return null; + } + +}
\ No newline at end of file diff --git a/src/server/ApiManagers/SessionManager.ts b/src/server/ApiManagers/SessionManager.ts index 6782643bc..21103fdd5 100644 --- a/src/server/ApiManagers/SessionManager.ts +++ b/src/server/ApiManagers/SessionManager.ts @@ -2,6 +2,7 @@ import ApiManager, { Registration } from "./ApiManager"; import { Method, _permission_denied, AuthorizedCore, SecureHandler } from "../RouteManager"; import RouteSubscriber from "../RouteSubscriber"; import { sessionAgent } from ".."; +import { DashSessionAgent } from "../DashSession/DashSessionAgent"; const permissionError = "You are not authorized!"; @@ -27,10 +28,11 @@ export default class SessionManager extends ApiManager { register({ method: Method.GET, - subscription: this.secureSubscriber("debug", "mode", "recipient"), + subscription: this.secureSubscriber("debug", "mode", "recipient?"), secureHandler: this.authorizedAction(async ({ req, res }) => { - const { mode, recipient } = req.params; + const { mode } = req.params; if (["passive", "active"].includes(mode)) { + const recipient = req.params.recipient || DashSessionAgent.notificationRecipient; const response = await sessionAgent.serverWorker.sendMonitorAction("debug", { mode, recipient }, true); if (response instanceof Error) { res.send(response); diff --git a/src/server/DashSession/DashSessionAgent.ts b/src/server/DashSession/DashSessionAgent.ts index 8061da1ca..f3f0a3c3d 100644 --- a/src/server/DashSession/DashSessionAgent.ts +++ b/src/server/DashSession/DashSessionAgent.ts @@ -19,7 +19,6 @@ import { ServerWorker } from "../session/agents/server_worker"; */ export class DashSessionAgent extends AppliedSessionAgent { - private readonly notificationRecipients = ["brownptcdash@gmail.com"]; private readonly signature = "-Dash Server Session Manager"; private readonly releaseDesktop = pathFromRoot("../../Desktop"); @@ -83,14 +82,15 @@ export class DashSessionAgent extends AppliedSessionAgent { */ private dispatchSessionPassword = async (key: string) => { const { mainLog } = this.sessionMonitor; + const { notificationRecipient } = DashSessionAgent; mainLog(green("dispatching session key...")); - const failures = await Email.dispatchAll({ - to: this.notificationRecipients, + const error = await Email.dispatch({ + to: notificationRecipient, subject: "Dash Release Session Admin Authentication Key", content: `The key for this session (started @ ${new Date().toUTCString()}) is ${key}.\n\n${this.signature}` }); - if (failures) { - failures.map(({ recipient, error: { message } }) => this.sessionMonitor.mainLog(red(`dispatch failure @ ${recipient} (${yellow(message)})`))); + if (error) { + this.sessionMonitor.mainLog(red(`dispatch failure @ ${notificationRecipient} (${yellow(error.message)})`)); mainLog(red("distribution of session key experienced errors")); } else { mainLog(green("successfully distributed session key to recipients")); @@ -102,13 +102,14 @@ export class DashSessionAgent extends AppliedSessionAgent { */ private dispatchCrashReport = async (crashCause: Error) => { const { mainLog } = this.sessionMonitor; - const failures = await Email.dispatchAll({ - to: this.notificationRecipients, + const { notificationRecipient } = DashSessionAgent; + const error = await Email.dispatch({ + to: notificationRecipient, subject: "Dash Web Server Crash", content: this.generateCrashInstructions(crashCause) }); - if (failures) { - failures.map(({ recipient, error: { message } }) => this.sessionMonitor.mainLog(red(`dispatch failure @ ${recipient} (${yellow(message)})`))); + if (error) { + this.sessionMonitor.mainLog(red(`dispatch failure @ ${notificationRecipient} (${yellow(error.message)})`)); mainLog(red("distribution of crash notification experienced errors")); } else { mainLog(green("successfully distributed crash notification to recipients")); @@ -210,4 +211,10 @@ export class DashSessionAgent extends AppliedSessionAgent { } } +} + +export namespace DashSessionAgent { + + export const notificationRecipient = "brownptcdash@gmail.com"; + }
\ No newline at end of file |