1/** 2 * Copyright (c) 2006-2017, JGraph Ltd 3 * Copyright (c) 2006-2017, Gaudenz Alder 4 */ 5GitLabFile = function(ui, data, meta) 6{ 7 GitHubFile.call(this, ui, data, meta); 8 9 this.peer = this.ui.gitLab; 10}; 11 12//Extends mxEventSource 13mxUtils.extend(GitLabFile, GitHubFile); 14 15/** 16 * Translates this point by the given vector. 17 * 18 * @param {number} dx X-coordinate of the translation. 19 * @param {number} dy Y-coordinate of the translation. 20 */ 21GitLabFile.prototype.share = function() 22{ 23 this.ui.editor.graph.openLink(DRAWIO_GITLAB_URL + '/' + 24 encodeURIComponent(this.meta.org) + '/' + 25 encodeURIComponent(this.meta.repo) +'/-/project_members'); 26}; 27 28/** 29 * Translates this point by the given vector. 30 * 31 * @param {number} dx X-coordinate of the translation. 32 * @param {number} dy Y-coordinate of the translation. 33 */ 34GitLabFile.prototype.getId = function() 35{ 36 return this.meta.org + '/' + 37 ((this.meta.repo != null) ? encodeURIComponent(this.meta.repo) + '/' + 38 ((this.meta.ref != null) ? this.meta.ref + 39 ((this.meta.path != null) ? '/' + this.meta.path : '') : '') : ''); 40}; 41 42/** 43 * Translates this point by the given vector. 44 * 45 * @param {number} dx X-coordinate of the translation. 46 * @param {number} dy Y-coordinate of the translation. 47 */ 48GitLabFile.prototype.getHash = function() 49{ 50 return encodeURIComponent('A' + this.getId()); 51}; 52 53/** 54 * Adds the listener for automatically saving the diagram for local changes. 55 */ 56GitLabFile.prototype.isConflict = function(err) 57{ 58 return err != null && err.status == 400; 59}; 60 61/** 62 * Translates this point by the given vector. 63 * 64 * @param {number} dx X-coordinate of the translation. 65 * @param {number} dy Y-coordinate of the translation. 66 */ 67GitLabFile.prototype.getMode = function() 68{ 69 return App.MODE_GITLAB; 70}; 71 72/** 73 * Adds all listeners. 74 */ 75GitLabFile.prototype.getDescriptorEtag = function(desc) 76{ 77 return desc.last_commit_id; 78}; 79 80/** 81 * Adds the listener for automatically saving the diagram for local changes. 82 */ 83GitLabFile.prototype.setDescriptorEtag = function(desc, etag) 84{ 85 desc.last_commit_id = etag; 86}; 87