kopia lustrzana https://github.com/FacilMap/facilmap
Add button to settings dialog to remove a map (#66)
rodzic
ff1d6e9e6b
commit
df1fd8cfcc
|
@ -55,6 +55,11 @@ _Type:_ boolean
|
|||
|
||||
_Type:_ number
|
||||
|
||||
|
||||
### `deleted`
|
||||
|
||||
`true` if the map was deleted while this client was connected to it.
|
||||
|
||||
### `padData`
|
||||
|
||||
The current settings of the map. `writeId` and/or `adminId` is null if if has been opened using another ID than the admin ID.
|
||||
|
@ -129,6 +134,10 @@ property is updated automatically.
|
|||
|
||||
_Type:_ [padData](#paddata-2)
|
||||
|
||||
### `deletePad`
|
||||
|
||||
The map has been deleted.
|
||||
|
||||
### `marker`
|
||||
|
||||
An existing marker is retrieved for the first time, has been modified, or a new marker has been created in the current bbox.
|
||||
|
@ -285,10 +294,18 @@ Creates a new collaborative map.
|
|||
|
||||
### `editPad(data)`
|
||||
|
||||
Update the metadata of the current map.
|
||||
|
||||
* `data` ([padData](#paddata-2)): The data of the map that should be modified. Fields that are not defined will not be
|
||||
modified. To change the default view, set the `defaultViewId` property. The `defaultView` property is ignored.
|
||||
* _returns_ (Promise): The new padData.
|
||||
|
||||
### `deletePad()`
|
||||
|
||||
Delete the current map irrevocably.
|
||||
|
||||
* _returns_ (Promise): An empty promise that resolves when the map has been deleted.
|
||||
|
||||
### `listenToHistory()`
|
||||
|
||||
Start listening to the modification history of the map. Calling this will cause multiple `history` objects to be
|
||||
|
|
|
@ -17,6 +17,7 @@ class Socket {
|
|||
this.padData = null;
|
||||
this.readonly = null;
|
||||
this.writable = null;
|
||||
this.deleted = false;
|
||||
this.markers = { };
|
||||
this.lines = { };
|
||||
this.views = { };
|
||||
|
@ -103,6 +104,10 @@ class Socket {
|
|||
return this._emit("editPad", data);
|
||||
}
|
||||
|
||||
deletePad() {
|
||||
return this._emit("deletePad");
|
||||
}
|
||||
|
||||
listenToHistory() {
|
||||
return this._emit("listenToHistory").then((obj) => {
|
||||
this._listeningToHistory = true;
|
||||
|
@ -290,6 +295,12 @@ Socket.prototype._handlers = {
|
|||
this.padId = id;
|
||||
},
|
||||
|
||||
deletePad() {
|
||||
this.readonly = true;
|
||||
this.writable = 0;
|
||||
this.deleted = true;
|
||||
},
|
||||
|
||||
marker(data) {
|
||||
if(this.markers[data.id] == null)
|
||||
this.markers[data.id] = { };
|
||||
|
|
|
@ -3832,7 +3832,8 @@
|
|||
},
|
||||
"minimist": {
|
||||
"version": "1.2.0",
|
||||
"resolved": "",
|
||||
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz",
|
||||
"integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=",
|
||||
"dev": true
|
||||
},
|
||||
"mississippi": {
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
<fm-search></fm-search>
|
||||
<fm-legend></fm-legend>
|
||||
</div>
|
||||
<div class="fm-map-disabled-cover" ng-show="client.padId && (client.disconnected || client.serverError)"></div>
|
||||
<div class="fm-map-disabled-cover" ng-show="client.padId && (client.disconnected || client.serverError || client.deleted)"></div>
|
||||
<div class="fm-map-loading" ng-hide="loaded || client.serverError">
|
||||
Loading...
|
||||
</div>
|
|
@ -453,6 +453,12 @@ fm.app.directive("facilmap", function(fmUtils, fmMapMessages, fmMapMarkers, $com
|
|||
errorMessage = this.messages.showMessage("danger", serverError);
|
||||
});
|
||||
|
||||
this.client.on("deletePad", () => {
|
||||
this.messages.showMessage("danger", "This map has been deleted.", [
|
||||
{ url: fm.URL_PREFIX, label: "Close map" }
|
||||
]);
|
||||
});
|
||||
|
||||
let updateBbox = () => {
|
||||
$scope.client.updateBbox(fmUtils.leafletToFmBbox(this.map.getBounds(), this.map.getZoom()));
|
||||
};
|
||||
|
|
|
@ -91,6 +91,23 @@
|
|||
|
||||
<button type="submit" class="hidden"></button>
|
||||
</form>
|
||||
|
||||
<hr />
|
||||
|
||||
<form class="form-horizontal" ng-submit="state.deleteConfirmation == 'DELETE' && confirm('Are you sure you want to delete the map “' + padData.name +'”? Deleted maps cannot be restored!') && deletePad()">
|
||||
<div class="form-group" ng-if="!create">
|
||||
<label for="delete-input" class="col-sm-3 control-label">Delete map</label>
|
||||
<div class="col-sm-9">
|
||||
<div class="input-group">
|
||||
<input id="delete-input" ng-model="state.deleteConfirmation" class="form-control" />
|
||||
<span class="input-group-btn">
|
||||
<button type="submit" class="btn btn-danger" ng-disabled="state.deleteConfirmation != 'DELETE'">Delete map</button>
|
||||
</span>
|
||||
</div>
|
||||
<p class="help-block">To delete this map, type <code>DELETE</code> into the field.</p>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button ng-if="!noCancel" type="button" class="btn btn-default" ng-click="$dismiss()" ng-disabled="saving">{{create || isModified ? 'Cancel' : 'Close'}}</button>
|
||||
|
|
|
@ -50,6 +50,9 @@ fm.app.controller("fmMapPadSettingsCtrl", function($scope, map, create, proposed
|
|||
$scope.urlPrefix = fm.URL_PREFIX;
|
||||
$scope.create = create;
|
||||
$scope.noCancel = noCancel;
|
||||
$scope.state = {
|
||||
deleteConfirmation: ""
|
||||
};
|
||||
|
||||
if(create) {
|
||||
$scope.padData = {
|
||||
|
@ -119,5 +122,17 @@ fm.app.controller("fmMapPadSettingsCtrl", function($scope, map, create, proposed
|
|||
|
||||
$scope.copy = function(text) {
|
||||
fmUtils.copyToClipboard(text);
|
||||
}
|
||||
};
|
||||
|
||||
$scope.deletePad = function() {
|
||||
$scope.saving = true;
|
||||
$scope.error = null;
|
||||
|
||||
map.client.deletePad().then(() => {
|
||||
$scope.$close();
|
||||
}).catch((err) => {
|
||||
$scope.error = err;
|
||||
$scope.saving = false;
|
||||
});
|
||||
};
|
||||
});
|
||||
|
|
|
@ -1725,11 +1725,6 @@
|
|||
"integrity": "sha512-wdlPY2tm/9XBr7QkKlq0WQVgiuGTX6YWPyRyBviSoScBuLfTVQhvwg6wJ369GJ/1nPfTLMfnrFIfjqVg6d+jQQ==",
|
||||
"dev": true
|
||||
},
|
||||
"after": {
|
||||
"version": "0.8.2",
|
||||
"resolved": "https://registry.npmjs.org/after/-/after-0.8.2.tgz",
|
||||
"integrity": "sha1-/ts5T58OAqqXaOcCvaI7UF+ufh8="
|
||||
},
|
||||
"ajv": {
|
||||
"version": "6.10.2",
|
||||
"resolved": "https://registry.npmjs.org/ajv/-/ajv-6.10.2.tgz",
|
||||
|
@ -2039,11 +2034,6 @@
|
|||
"integrity": "sha1-qJS3XUvE9s1nnvMkSp/Y9Gri1Cg=",
|
||||
"dev": true
|
||||
},
|
||||
"arraybuffer.slice": {
|
||||
"version": "0.0.6",
|
||||
"resolved": "https://registry.npmjs.org/arraybuffer.slice/-/arraybuffer.slice-0.0.6.tgz",
|
||||
"integrity": "sha1-8zshWfBTKj8xB6JywMz70a0peco="
|
||||
},
|
||||
"asn1": {
|
||||
"version": "0.2.4",
|
||||
"resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.4.tgz",
|
||||
|
@ -2323,11 +2313,6 @@
|
|||
"now-and-later": "^2.0.0"
|
||||
}
|
||||
},
|
||||
"backo2": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/backo2/-/backo2-1.0.2.tgz",
|
||||
"integrity": "sha1-MasayLEpNjRj41s+u2n038+6eUc="
|
||||
},
|
||||
"balanced-match": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz",
|
||||
|
@ -2389,11 +2374,6 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"base64-arraybuffer": {
|
||||
"version": "0.1.5",
|
||||
"resolved": "https://registry.npmjs.org/base64-arraybuffer/-/base64-arraybuffer-0.1.5.tgz",
|
||||
"integrity": "sha1-c5JncZI7Whl0etZmqlzUv5xunOg="
|
||||
},
|
||||
"base64-js": {
|
||||
"version": "1.3.1",
|
||||
"resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.3.1.tgz",
|
||||
|
@ -2415,14 +2395,6 @@
|
|||
"integrity": "sha1-5tXqjF2tABMEpwsiY4RH9pyy+Ak=",
|
||||
"dev": true
|
||||
},
|
||||
"better-assert": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/better-assert/-/better-assert-1.0.2.tgz",
|
||||
"integrity": "sha1-QIZrnhueC1W0gYlDEeaPr/rrxSI=",
|
||||
"requires": {
|
||||
"callsite": "1.0.0"
|
||||
}
|
||||
},
|
||||
"bfj": {
|
||||
"version": "6.1.2",
|
||||
"resolved": "https://registry.npmjs.org/bfj/-/bfj-6.1.2.tgz",
|
||||
|
@ -2762,11 +2734,6 @@
|
|||
"unset-value": "^1.0.0"
|
||||
}
|
||||
},
|
||||
"callsite": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/callsite/-/callsite-1.0.0.tgz",
|
||||
"integrity": "sha1-KAOY5dZkvXQDi28JBRU+borxvCA="
|
||||
},
|
||||
"camel-case": {
|
||||
"version": "4.1.1",
|
||||
"resolved": "https://registry.npmjs.org/camel-case/-/camel-case-4.1.1.tgz",
|
||||
|
@ -3212,20 +3179,11 @@
|
|||
"integrity": "sha1-3dgA2gxmEnOTzKWVDqloo6rxJTs=",
|
||||
"dev": true
|
||||
},
|
||||
"component-bind": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/component-bind/-/component-bind-1.0.0.tgz",
|
||||
"integrity": "sha1-AMYIq33Nk4l8AAllGx06jh5zu9E="
|
||||
},
|
||||
"component-emitter": {
|
||||
"version": "1.2.1",
|
||||
"resolved": "https://registry.npmjs.org/component-emitter/-/component-emitter-1.2.1.tgz",
|
||||
"integrity": "sha1-E3kY1teCg/ffemt8WmPhQOaUJeY="
|
||||
},
|
||||
"component-inherit": {
|
||||
"version": "0.0.3",
|
||||
"resolved": "https://registry.npmjs.org/component-inherit/-/component-inherit-0.0.3.tgz",
|
||||
"integrity": "sha1-ZF/ErfWLcrZJ1crmUTVhnbJv8UM="
|
||||
"integrity": "sha1-E3kY1teCg/ffemt8WmPhQOaUJeY=",
|
||||
"dev": true
|
||||
},
|
||||
"concat-map": {
|
||||
"version": "0.0.1",
|
||||
|
@ -4322,69 +4280,6 @@
|
|||
"once": "^1.4.0"
|
||||
}
|
||||
},
|
||||
"engine.io-client": {
|
||||
"version": "1.8.5",
|
||||
"resolved": "https://registry.npmjs.org/engine.io-client/-/engine.io-client-1.8.5.tgz",
|
||||
"integrity": "sha512-AYTgHyeVUPitsseqjoedjhYJapNVoSPShbZ+tEUX9/73jgZ/Z3sUlJf9oYgdEBBdVhupUpUqSxH0kBCXlQnmZg==",
|
||||
"requires": {
|
||||
"component-emitter": "1.2.1",
|
||||
"component-inherit": "0.0.3",
|
||||
"debug": "2.3.3",
|
||||
"engine.io-parser": "1.3.2",
|
||||
"has-cors": "1.1.0",
|
||||
"indexof": "0.0.1",
|
||||
"parsejson": "0.0.3",
|
||||
"parseqs": "0.0.5",
|
||||
"parseuri": "0.0.5",
|
||||
"ws": "~1.1.5",
|
||||
"xmlhttprequest-ssl": "1.5.3",
|
||||
"yeast": "0.1.2"
|
||||
},
|
||||
"dependencies": {
|
||||
"debug": {
|
||||
"version": "2.3.3",
|
||||
"resolved": "https://registry.npmjs.org/debug/-/debug-2.3.3.tgz",
|
||||
"integrity": "sha1-QMRT5n5uE8kB3ewxeviYbNqe/4w=",
|
||||
"requires": {
|
||||
"ms": "0.7.2"
|
||||
}
|
||||
},
|
||||
"ms": {
|
||||
"version": "0.7.2",
|
||||
"resolved": "https://registry.npmjs.org/ms/-/ms-0.7.2.tgz",
|
||||
"integrity": "sha1-riXPJRKziFodldfwN4aNhDESR2U="
|
||||
},
|
||||
"ws": {
|
||||
"version": "1.1.5",
|
||||
"resolved": "https://registry.npmjs.org/ws/-/ws-1.1.5.tgz",
|
||||
"integrity": "sha512-o3KqipXNUdS7wpQzBHSe180lBGO60SoK0yVo3CYJgb2MkobuWuBX6dhkYP5ORCLd55y+SaflMOV5fqAB53ux4w==",
|
||||
"requires": {
|
||||
"options": ">=0.0.5",
|
||||
"ultron": "1.0.x"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"engine.io-parser": {
|
||||
"version": "1.3.2",
|
||||
"resolved": "https://registry.npmjs.org/engine.io-parser/-/engine.io-parser-1.3.2.tgz",
|
||||
"integrity": "sha1-k3sHnwAH0Ik+xW1GyyILjLQ1Igo=",
|
||||
"requires": {
|
||||
"after": "0.8.2",
|
||||
"arraybuffer.slice": "0.0.6",
|
||||
"base64-arraybuffer": "0.1.5",
|
||||
"blob": "0.0.4",
|
||||
"has-binary": "0.1.7",
|
||||
"wtf-8": "1.0.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"blob": {
|
||||
"version": "0.0.4",
|
||||
"resolved": "https://registry.npmjs.org/blob/-/blob-0.0.4.tgz",
|
||||
"integrity": "sha1-vPEwUspURj8w+fx+lbmkdjCpSSE="
|
||||
}
|
||||
}
|
||||
},
|
||||
"enhanced-resolve": {
|
||||
"version": "4.1.1",
|
||||
"resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-4.1.1.tgz",
|
||||
|
@ -4482,11 +4377,6 @@
|
|||
"es6-symbol": "^3.1.1"
|
||||
}
|
||||
},
|
||||
"es6-promise": {
|
||||
"version": "4.2.8",
|
||||
"resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-4.2.8.tgz",
|
||||
"integrity": "sha512-HJDGx5daxeIvxdBxvG2cb9g4tEvwIk3i8+nhX0yGrYmZUzbkdg8QbDevheDB8gd0//uPj4c1EQua8Q+MViT0/w=="
|
||||
},
|
||||
"es6-symbol": {
|
||||
"version": "3.1.3",
|
||||
"resolved": "https://registry.npmjs.org/es6-symbol/-/es6-symbol-3.1.3.tgz",
|
||||
|
@ -4852,15 +4742,6 @@
|
|||
"integrity": "sha1-lpGEQOMEGnpBT4xS48V06zw+HgU=",
|
||||
"dev": true
|
||||
},
|
||||
"facilmap-client": {
|
||||
"version": "2.7.0",
|
||||
"resolved": "https://registry.npmjs.org/facilmap-client/-/facilmap-client-2.7.0.tgz",
|
||||
"integrity": "sha512-LheN4yhDwYaTZJBe8KJgLCQ9tBJmWmjCkhFUq2qTvZLFuCRkcI2Bi0MHZ4hGZtPV9bnl7FevCL7RhvN0ec1MZw==",
|
||||
"requires": {
|
||||
"es6-promise": "^4.0.5",
|
||||
"socket.io-client": "^1.7.3"
|
||||
}
|
||||
},
|
||||
"fancy-log": {
|
||||
"version": "1.3.3",
|
||||
"resolved": "https://registry.npmjs.org/fancy-log/-/fancy-log-1.3.3.tgz",
|
||||
|
@ -6418,26 +6299,6 @@
|
|||
"ansi-regex": "^2.0.0"
|
||||
}
|
||||
},
|
||||
"has-binary": {
|
||||
"version": "0.1.7",
|
||||
"resolved": "https://registry.npmjs.org/has-binary/-/has-binary-0.1.7.tgz",
|
||||
"integrity": "sha1-aOYesWIQyVRaClzOBqhzkS/h5ow=",
|
||||
"requires": {
|
||||
"isarray": "0.0.1"
|
||||
},
|
||||
"dependencies": {
|
||||
"isarray": {
|
||||
"version": "0.0.1",
|
||||
"resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz",
|
||||
"integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8="
|
||||
}
|
||||
}
|
||||
},
|
||||
"has-cors": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/has-cors/-/has-cors-1.1.0.tgz",
|
||||
"integrity": "sha1-XkdHk/fqmEPRu5nCPu9J/xJv/zk="
|
||||
},
|
||||
"has-flag": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz",
|
||||
|
@ -6852,11 +6713,6 @@
|
|||
"integrity": "sha1-8w9xbI4r00bHtn0985FVZqfAVgc=",
|
||||
"dev": true
|
||||
},
|
||||
"indexof": {
|
||||
"version": "0.0.1",
|
||||
"resolved": "https://registry.npmjs.org/indexof/-/indexof-0.0.1.tgz",
|
||||
"integrity": "sha1-gtwzbSMrkGIXnQWrMpOmYFn9Q10="
|
||||
},
|
||||
"infer-owner": {
|
||||
"version": "1.0.4",
|
||||
"resolved": "https://registry.npmjs.org/infer-owner/-/infer-owner-1.0.4.tgz",
|
||||
|
@ -7266,11 +7122,6 @@
|
|||
"integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=",
|
||||
"dev": true
|
||||
},
|
||||
"json3": {
|
||||
"version": "3.3.2",
|
||||
"resolved": "https://registry.npmjs.org/json3/-/json3-3.3.2.tgz",
|
||||
"integrity": "sha1-PAQ0dD35Pi9cQq7nsZvLSDV19OE="
|
||||
},
|
||||
"json5": {
|
||||
"version": "2.1.3",
|
||||
"resolved": "https://registry.npmjs.org/json5/-/json5-2.1.3.tgz",
|
||||
|
@ -8390,11 +8241,6 @@
|
|||
"integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=",
|
||||
"dev": true
|
||||
},
|
||||
"object-component": {
|
||||
"version": "0.0.3",
|
||||
"resolved": "https://registry.npmjs.org/object-component/-/object-component-0.0.3.tgz",
|
||||
"integrity": "sha1-8MaapQ78lbhmwYb0AKM3acsvEpE="
|
||||
},
|
||||
"object-copy": {
|
||||
"version": "0.1.0",
|
||||
"resolved": "https://registry.npmjs.org/object-copy/-/object-copy-0.1.0.tgz",
|
||||
|
@ -8554,11 +8400,6 @@
|
|||
"wordwrap": "~0.0.2"
|
||||
}
|
||||
},
|
||||
"options": {
|
||||
"version": "0.0.6",
|
||||
"resolved": "https://registry.npmjs.org/options/-/options-0.0.6.tgz",
|
||||
"integrity": "sha1-7CLTEoBrtT5zF3Pnza788cZDEo8="
|
||||
},
|
||||
"ordered-read-streams": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/ordered-read-streams/-/ordered-read-streams-1.0.1.tgz",
|
||||
|
@ -8831,30 +8672,6 @@
|
|||
"@types/node": "*"
|
||||
}
|
||||
},
|
||||
"parsejson": {
|
||||
"version": "0.0.3",
|
||||
"resolved": "https://registry.npmjs.org/parsejson/-/parsejson-0.0.3.tgz",
|
||||
"integrity": "sha1-q343WfIJ7OmUN5c/fQ8fZK4OZKs=",
|
||||
"requires": {
|
||||
"better-assert": "~1.0.0"
|
||||
}
|
||||
},
|
||||
"parseqs": {
|
||||
"version": "0.0.5",
|
||||
"resolved": "https://registry.npmjs.org/parseqs/-/parseqs-0.0.5.tgz",
|
||||
"integrity": "sha1-1SCKNzjkZ2bikbouoXNoSSGouJ0=",
|
||||
"requires": {
|
||||
"better-assert": "~1.0.0"
|
||||
}
|
||||
},
|
||||
"parseuri": {
|
||||
"version": "0.0.5",
|
||||
"resolved": "https://registry.npmjs.org/parseuri/-/parseuri-0.0.5.tgz",
|
||||
"integrity": "sha1-gCBKUNTbt3m/3G6+J3jZDkvOMgo=",
|
||||
"requires": {
|
||||
"better-assert": "~1.0.0"
|
||||
}
|
||||
},
|
||||
"parseurl": {
|
||||
"version": "1.3.3",
|
||||
"resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz",
|
||||
|
@ -10349,75 +10166,6 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"socket.io-client": {
|
||||
"version": "1.7.4",
|
||||
"resolved": "https://registry.npmjs.org/socket.io-client/-/socket.io-client-1.7.4.tgz",
|
||||
"integrity": "sha1-7J+CA1btme9tNX8HVtZIcXvdQoE=",
|
||||
"requires": {
|
||||
"backo2": "1.0.2",
|
||||
"component-bind": "1.0.0",
|
||||
"component-emitter": "1.2.1",
|
||||
"debug": "2.3.3",
|
||||
"engine.io-client": "~1.8.4",
|
||||
"has-binary": "0.1.7",
|
||||
"indexof": "0.0.1",
|
||||
"object-component": "0.0.3",
|
||||
"parseuri": "0.0.5",
|
||||
"socket.io-parser": "2.3.1",
|
||||
"to-array": "0.1.4"
|
||||
},
|
||||
"dependencies": {
|
||||
"debug": {
|
||||
"version": "2.3.3",
|
||||
"resolved": "https://registry.npmjs.org/debug/-/debug-2.3.3.tgz",
|
||||
"integrity": "sha1-QMRT5n5uE8kB3ewxeviYbNqe/4w=",
|
||||
"requires": {
|
||||
"ms": "0.7.2"
|
||||
}
|
||||
},
|
||||
"ms": {
|
||||
"version": "0.7.2",
|
||||
"resolved": "https://registry.npmjs.org/ms/-/ms-0.7.2.tgz",
|
||||
"integrity": "sha1-riXPJRKziFodldfwN4aNhDESR2U="
|
||||
}
|
||||
}
|
||||
},
|
||||
"socket.io-parser": {
|
||||
"version": "2.3.1",
|
||||
"resolved": "https://registry.npmjs.org/socket.io-parser/-/socket.io-parser-2.3.1.tgz",
|
||||
"integrity": "sha1-3VMgJRA85Clpcya+/WQAX8/ltKA=",
|
||||
"requires": {
|
||||
"component-emitter": "1.1.2",
|
||||
"debug": "2.2.0",
|
||||
"isarray": "0.0.1",
|
||||
"json3": "3.3.2"
|
||||
},
|
||||
"dependencies": {
|
||||
"component-emitter": {
|
||||
"version": "1.1.2",
|
||||
"resolved": "https://registry.npmjs.org/component-emitter/-/component-emitter-1.1.2.tgz",
|
||||
"integrity": "sha1-KWWU8nU9qmOZbSrwjRWpURbJrsM="
|
||||
},
|
||||
"debug": {
|
||||
"version": "2.2.0",
|
||||
"resolved": "https://registry.npmjs.org/debug/-/debug-2.2.0.tgz",
|
||||
"integrity": "sha1-+HBX6ZWxofauaklgZkE3vFbwOdo=",
|
||||
"requires": {
|
||||
"ms": "0.7.1"
|
||||
}
|
||||
},
|
||||
"isarray": {
|
||||
"version": "0.0.1",
|
||||
"resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz",
|
||||
"integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8="
|
||||
},
|
||||
"ms": {
|
||||
"version": "0.7.1",
|
||||
"resolved": "https://registry.npmjs.org/ms/-/ms-0.7.1.tgz",
|
||||
"integrity": "sha1-nNE8A62/8ltl7/3nzoZO6VIBcJg="
|
||||
}
|
||||
}
|
||||
},
|
||||
"source-list-map": {
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmjs.org/source-list-map/-/source-list-map-2.0.1.tgz",
|
||||
|
@ -11106,11 +10854,6 @@
|
|||
"is-negated-glob": "^1.0.0"
|
||||
}
|
||||
},
|
||||
"to-array": {
|
||||
"version": "0.1.4",
|
||||
"resolved": "https://registry.npmjs.org/to-array/-/to-array-0.1.4.tgz",
|
||||
"integrity": "sha1-F+bBH3PdTz10zaek/zI46a2b+JA="
|
||||
},
|
||||
"to-arraybuffer": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/to-arraybuffer/-/to-arraybuffer-1.0.1.tgz",
|
||||
|
@ -11327,11 +11070,6 @@
|
|||
"integrity": "sha1-S1v/+Rhu/7qoiOTJ6UvZ/EyUkp0=",
|
||||
"dev": true
|
||||
},
|
||||
"ultron": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/ultron/-/ultron-1.0.2.tgz",
|
||||
"integrity": "sha1-rOEWq1V80Zc4ak6I9GhTeMiy5Po="
|
||||
},
|
||||
"unc-path-regex": {
|
||||
"version": "0.1.2",
|
||||
"resolved": "https://registry.npmjs.org/unc-path-regex/-/unc-path-regex-0.1.2.tgz",
|
||||
|
@ -12311,21 +12049,11 @@
|
|||
"async-limiter": "~1.0.0"
|
||||
}
|
||||
},
|
||||
"wtf-8": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/wtf-8/-/wtf-8-1.0.0.tgz",
|
||||
"integrity": "sha1-OS2LotDxw00e4tYw8V0O+2jhBIo="
|
||||
},
|
||||
"xmldom": {
|
||||
"version": "0.1.27",
|
||||
"resolved": "https://registry.npmjs.org/xmldom/-/xmldom-0.1.27.tgz",
|
||||
"integrity": "sha1-1QH5ezvbQDr4757MIFcxh6rawOk="
|
||||
},
|
||||
"xmlhttprequest-ssl": {
|
||||
"version": "1.5.3",
|
||||
"resolved": "https://registry.npmjs.org/xmlhttprequest-ssl/-/xmlhttprequest-ssl-1.5.3.tgz",
|
||||
"integrity": "sha1-GFqIjATspGw+QHDZn3tJ3jUomS0="
|
||||
},
|
||||
"xtend": {
|
||||
"version": "4.0.2",
|
||||
"resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz",
|
||||
|
@ -12381,11 +12109,6 @@
|
|||
"requires": {
|
||||
"camelcase": "^3.0.0"
|
||||
}
|
||||
},
|
||||
"yeast": {
|
||||
"version": "0.1.2",
|
||||
"resolved": "https://registry.npmjs.org/yeast/-/yeast-0.1.2.tgz",
|
||||
"integrity": "sha1-AI4G2AlDIMNy28L47XagymyKxBk="
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -123,6 +123,10 @@ module.exports = function(Database) {
|
|||
}
|
||||
}).then(res => null);
|
||||
});
|
||||
},
|
||||
|
||||
async clearHistory(padId) {
|
||||
await this._conn.model("History").destroy({ where: { padId: padId } });
|
||||
}
|
||||
});
|
||||
};
|
|
@ -161,6 +161,36 @@ module.exports = function(Database) {
|
|||
|
||||
return res.newData;
|
||||
});
|
||||
},
|
||||
|
||||
async deletePad(padId) {
|
||||
const padData = await this.getPadDataByAnyId(padId);
|
||||
|
||||
if (padData.defaultViewId) {
|
||||
await this.updatePadData(padData.id, { defaultViewId: null });
|
||||
}
|
||||
|
||||
await utils.streamEachPromise(this.getPadMarkers(padData.id, null), async (marker) => {
|
||||
await this.deleteMarker(padData.id, marker.id);
|
||||
});
|
||||
|
||||
await utils.streamEachPromise(this.getPadLines(padData.id, ['id']), async (line) => {
|
||||
await this.deleteLine(padData.id, line.id);
|
||||
});
|
||||
|
||||
await utils.streamEachPromise(this.getTypes(padData.id), async (type) => {
|
||||
await this.deleteType(padData.id, type.id);
|
||||
});
|
||||
|
||||
await utils.streamEachPromise(this.getViews(padData.id), async (view) => {
|
||||
await this.deleteView(padData.id, view.id);
|
||||
});
|
||||
|
||||
await this.clearHistory(padData.id);
|
||||
|
||||
await this._conn.model("Pad").destroy({ where: { id: padData.id } });
|
||||
|
||||
this.emit("deletePad", padId);
|
||||
}
|
||||
|
||||
/*function copyPad(fromPadId, toPadId, callback) {
|
||||
|
|
|
@ -241,6 +241,13 @@ utils.extend(SocketConnection.prototype, {
|
|||
});
|
||||
},
|
||||
|
||||
async deletePad() {
|
||||
if (this.writable != 2)
|
||||
throw new Error("Map can only be delete in admin mode.");
|
||||
|
||||
await this.database.deletePad(this.padId);
|
||||
},
|
||||
|
||||
async getMarker(data) {
|
||||
if(!utils.stripObject(data, { id: "number" } ))
|
||||
throw new Error("Invalid parameters.");
|
||||
|
@ -750,6 +757,13 @@ utils.extend(SocketConnection.prototype, {
|
|||
}
|
||||
},
|
||||
|
||||
deletePad: function(padId) {
|
||||
if (padId == this.padId) {
|
||||
this.socket.emit("deletePad");
|
||||
this.writable = 0;
|
||||
}
|
||||
},
|
||||
|
||||
view: function(padId, data) {
|
||||
if(padId == this.padId)
|
||||
this.socket.emit("view", data);
|
||||
|
|
Ładowanie…
Reference in New Issue