mirror of
https://github.com/documize/community.git
synced 2025-08-09 07:25:23 +02:00
save valid token to js meta
This commit is contained in:
parent
ede91fa58a
commit
19df71685f
2 changed files with 433 additions and 431 deletions
|
@ -15,434 +15,436 @@ import TooltipMixin from '../../../mixins/tooltip';
|
||||||
import SectionMixin from '../../../mixins/section';
|
import SectionMixin from '../../../mixins/section';
|
||||||
|
|
||||||
export default Ember.Component.extend(SectionMixin, NotifierMixin, TooltipMixin, {
|
export default Ember.Component.extend(SectionMixin, NotifierMixin, TooltipMixin, {
|
||||||
sectionService: Ember.inject.service('section'),
|
sectionService: Ember.inject.service('section'),
|
||||||
isDirty: false,
|
isDirty: false,
|
||||||
busy: false,
|
busy: false,
|
||||||
authenticated: false,
|
authenticated: false,
|
||||||
config: {},
|
config: {},
|
||||||
owners: null,
|
owners: null,
|
||||||
repos: null,
|
repos: null,
|
||||||
noRepos: false,
|
noRepos: false,
|
||||||
showCommits: false,
|
showCommits: false,
|
||||||
showIssueNum: false,
|
showIssueNum: false,
|
||||||
showLabels: false,
|
showLabels: false,
|
||||||
|
|
||||||
didReceiveAttrs() {
|
didReceiveAttrs() {
|
||||||
let self = this;
|
let self = this;
|
||||||
let page = this.get('page');
|
let page = this.get('page');
|
||||||
|
|
||||||
if (is.undefined(this.get('config.clientId')) || is.undefined(this.get('config.callbackUrl'))) {
|
if (is.undefined(this.get('config.clientId')) || is.undefined(this.get('config.callbackUrl'))) {
|
||||||
self.get('sectionService').fetch(page, "config", {})
|
self.get('sectionService').fetch(page, "config", {})
|
||||||
.then(function (cfg) {
|
.then(function (cfg) {
|
||||||
let config = {};
|
let config = {};
|
||||||
|
|
||||||
config = {
|
config = {
|
||||||
clientId: cfg.clientID,
|
clientId: cfg.clientID,
|
||||||
callbackUrl: cfg.authorizationCallbackURL,
|
callbackUrl: cfg.authorizationCallbackURL,
|
||||||
token: "",
|
token: "",
|
||||||
owner: null,
|
owner: null,
|
||||||
owner_name: "",
|
owner_name: "",
|
||||||
repo: null,
|
repo: null,
|
||||||
repo_name: "",
|
repo_name: "",
|
||||||
report: null,
|
report: null,
|
||||||
lists: [],
|
lists: [],
|
||||||
branch: "",
|
branch: "",
|
||||||
branchURL: "",
|
branchURL: "",
|
||||||
branchSince: "",
|
branchSince: "",
|
||||||
branchLines: "30",
|
branchLines: "30",
|
||||||
state: null,
|
state: null,
|
||||||
issues: "",
|
issues: "",
|
||||||
};
|
};
|
||||||
|
|
||||||
try {
|
try {
|
||||||
let metaConfig = JSON.parse(self.get('meta.config'));
|
let metaConfig = JSON.parse(self.get('meta.config'));
|
||||||
config.owner = metaConfig.owner;
|
config.owner = metaConfig.owner;
|
||||||
config.repo = metaConfig.repo;
|
config.repo = metaConfig.repo;
|
||||||
config.report = metaConfig.report;
|
config.report = metaConfig.report;
|
||||||
config.lists = metaConfig.lists;
|
config.lists = metaConfig.lists;
|
||||||
config.branchSince = metaConfig.branchSince;
|
config.branchSince = metaConfig.branchSince;
|
||||||
config.branchLines = metaConfig.branchLines;
|
config.branchLines = metaConfig.branchLines;
|
||||||
config.state = metaConfig.state;
|
config.state = metaConfig.state;
|
||||||
config.issues = metaConfig.issues;
|
config.issues = metaConfig.issues;
|
||||||
} catch (e) {}
|
config.token = metaConfig.token;
|
||||||
|
} catch (e) {}
|
||||||
self.set('config', config);
|
|
||||||
|
self.set('config', config);
|
||||||
// On auth callback capture code
|
|
||||||
let code = window.location.search;
|
// On auth callback capture code
|
||||||
|
let code = window.location.search;
|
||||||
if (is.not.undefined(code) && is.not.null(code) && is.not.empty(code) && code !== "") {
|
|
||||||
let tok = code.replace("?code=", "");
|
if (is.not.undefined(code) && is.not.null(code) && is.not.empty(code) && code !== "") {
|
||||||
self.set('config.token', tok);
|
let tok = code.replace("?code=", "");
|
||||||
self.get('sectionService').fetch(page, "set_token", self.get('config'))
|
self.set('config.token', tok);
|
||||||
.then(function () {
|
self.get('sectionService').fetch(page, "set_token", self.get('config'))
|
||||||
console.log("github auth code saved to db");
|
.then(function () {
|
||||||
self.send('authStage2');
|
console.log("github auth code saved to db");
|
||||||
}, function (error) { //jshint ignore: line
|
self.send('authStage2');
|
||||||
console.log(error);
|
}, function (error) { //jshint ignore: line
|
||||||
self.send('auth');
|
console.log(error);
|
||||||
});
|
self.send('auth');
|
||||||
} else {
|
});
|
||||||
self.get('sectionService').fetch(page, "check_token", self.get('config'))
|
} else {
|
||||||
.then(function () {
|
self.get('sectionService').fetch(page, "check_token", self.get('config'))
|
||||||
console.log("github auth code valid");
|
.then(function (cfg) {
|
||||||
self.send('authStage2');
|
self.set('config.token', cfg.token);
|
||||||
}, function (error) { //jshint ignore: line
|
console.log("github auth code valid");
|
||||||
console.log(error);
|
self.send('authStage2');
|
||||||
self.send('auth'); // only require auth if the db does not already know the token
|
}, function (error) { //jshint ignore: line
|
||||||
});
|
console.log(error);
|
||||||
}
|
self.send('auth'); // only require auth if the db does not already know the token
|
||||||
}, function (error) { //jshint ignore: line
|
});
|
||||||
console.log(error);
|
}
|
||||||
});
|
}, function (error) { //jshint ignore: line
|
||||||
}
|
console.log(error);
|
||||||
},
|
});
|
||||||
|
}
|
||||||
willDestroyElement() {
|
},
|
||||||
this.destroyTooltips();
|
|
||||||
},
|
willDestroyElement() {
|
||||||
|
this.destroyTooltips();
|
||||||
getOwnerLists() {
|
},
|
||||||
this.set('busy', true);
|
|
||||||
|
getOwnerLists() {
|
||||||
let self = this;
|
this.set('busy', true);
|
||||||
let owners = this.get('owners');
|
|
||||||
let thisOwner = this.get('config.owner');
|
let self = this;
|
||||||
let page = this.get('page');
|
let owners = this.get('owners');
|
||||||
|
let thisOwner = this.get('config.owner');
|
||||||
if (is.null(thisOwner) || is.undefined(thisOwner)) {
|
let page = this.get('page');
|
||||||
if (owners.length) {
|
|
||||||
thisOwner = owners[0];
|
if (is.null(thisOwner) || is.undefined(thisOwner)) {
|
||||||
this.set('config.owner', thisOwner);
|
if (owners.length) {
|
||||||
}
|
thisOwner = owners[0];
|
||||||
} else {
|
this.set('config.owner', thisOwner);
|
||||||
this.set('config.owner', owners.findBy('id', thisOwner.id));
|
}
|
||||||
}
|
} else {
|
||||||
|
this.set('config.owner', owners.findBy('id', thisOwner.id));
|
||||||
this.set('owner', thisOwner);
|
}
|
||||||
|
|
||||||
this.get('sectionService').fetch(page, "repos", self.get('config'))
|
this.set('owner', thisOwner);
|
||||||
.then(function (lists) {
|
|
||||||
self.set('busy', false);
|
this.get('sectionService').fetch(page, "repos", self.get('config'))
|
||||||
self.set('repos', lists);
|
.then(function (lists) {
|
||||||
self.getRepoLists();
|
self.set('busy', false);
|
||||||
}, function (error) { //jshint ignore: line
|
self.set('repos', lists);
|
||||||
self.set('busy', false);
|
self.getRepoLists();
|
||||||
self.set('authenticated', false);
|
}, function (error) { //jshint ignore: line
|
||||||
self.showNotification("Unable to fetch repositories");
|
self.set('busy', false);
|
||||||
console.log(error);
|
self.set('authenticated', false);
|
||||||
});
|
self.showNotification("Unable to fetch repositories");
|
||||||
},
|
console.log(error);
|
||||||
|
});
|
||||||
getRepoLists() {
|
},
|
||||||
this.set('busy', true);
|
|
||||||
|
getRepoLists() {
|
||||||
let repos = this.get('repos');
|
this.set('busy', true);
|
||||||
let thisRepo = this.get('config.repo');
|
|
||||||
|
let repos = this.get('repos');
|
||||||
if (is.null(repos) || is.undefined(repos) || repos.length === 0) {
|
let thisRepo = this.get('config.repo');
|
||||||
this.set('noRepos', true);
|
|
||||||
return;
|
if (is.null(repos) || is.undefined(repos) || repos.length === 0) {
|
||||||
}
|
this.set('noRepos', true);
|
||||||
|
return;
|
||||||
this.set('noRepos', false);
|
}
|
||||||
|
|
||||||
if (is.null(thisRepo) || is.undefined(thisRepo) || thisRepo.owner !== this.get('config.owner').name) {
|
this.set('noRepos', false);
|
||||||
if (repos.length) {
|
|
||||||
thisRepo = repos[0];
|
if (is.null(thisRepo) || is.undefined(thisRepo) || thisRepo.owner !== this.get('config.owner').name) {
|
||||||
this.set('config.repo', thisRepo);
|
if (repos.length) {
|
||||||
}
|
thisRepo = repos[0];
|
||||||
} else {
|
this.set('config.repo', thisRepo);
|
||||||
this.set('config.repo', repos.findBy('id', thisRepo.id));
|
}
|
||||||
}
|
} else {
|
||||||
|
this.set('config.repo', repos.findBy('id', thisRepo.id));
|
||||||
this.set('repo', thisRepo);
|
}
|
||||||
|
|
||||||
this.getReportLists();
|
this.set('repo', thisRepo);
|
||||||
},
|
|
||||||
|
this.getReportLists();
|
||||||
getReportLists() {
|
},
|
||||||
let reports = [];
|
|
||||||
reports[0] = {
|
getReportLists() {
|
||||||
id: "commits_data", // used as method for fetching Go data
|
let reports = [];
|
||||||
name: "Commits on a branch"
|
reports[0] = {
|
||||||
};
|
id: "commits_data", // used as method for fetching Go data
|
||||||
reports[1] = {
|
name: "Commits on a branch"
|
||||||
id: "issues_data", // used as method for fetching Go data
|
};
|
||||||
name: "Issues"
|
reports[1] = {
|
||||||
};
|
id: "issues_data", // used as method for fetching Go data
|
||||||
|
name: "Issues"
|
||||||
this.set("reports", reports);
|
};
|
||||||
|
|
||||||
let thisReport = this.get('config.report');
|
this.set("reports", reports);
|
||||||
|
|
||||||
if (is.null(thisReport) || is.undefined(thisReport)) {
|
let thisReport = this.get('config.report');
|
||||||
thisReport = reports[0];
|
|
||||||
this.set('config.report', thisReport);
|
if (is.null(thisReport) || is.undefined(thisReport)) {
|
||||||
} else {
|
thisReport = reports[0];
|
||||||
this.set('config.report', reports.findBy('id', thisReport.id));
|
this.set('config.report', thisReport);
|
||||||
}
|
} else {
|
||||||
|
this.set('config.report', reports.findBy('id', thisReport.id));
|
||||||
this.set('report', thisReport);
|
}
|
||||||
|
|
||||||
this.renderSwitch(thisReport);
|
this.set('report', thisReport);
|
||||||
|
|
||||||
},
|
this.renderSwitch(thisReport);
|
||||||
|
|
||||||
renderSwitch(thisReport) {
|
},
|
||||||
|
|
||||||
if (is.undefined(this.get('initDateTimePicker'))) {
|
renderSwitch(thisReport) {
|
||||||
$.datetimepicker.setLocale('en');
|
|
||||||
$('#branch-since').datetimepicker();
|
if (is.undefined(this.get('initDateTimePicker'))) {
|
||||||
this.set('initDateTimePicker', "Done");
|
$.datetimepicker.setLocale('en');
|
||||||
}
|
$('#branch-since').datetimepicker();
|
||||||
|
this.set('initDateTimePicker', "Done");
|
||||||
let bl = this.get('config.branchLines');
|
}
|
||||||
if (is.undefined(bl) || bl === "" || bl <= 0) {
|
|
||||||
this.set('config.branchLines', "30");
|
let bl = this.get('config.branchLines');
|
||||||
}
|
if (is.undefined(bl) || bl === "" || bl <= 0) {
|
||||||
|
this.set('config.branchLines', "30");
|
||||||
this.set('showCommits', false);
|
}
|
||||||
this.set('showLabels', false);
|
|
||||||
switch (thisReport.id) {
|
this.set('showCommits', false);
|
||||||
case 'commits_data':
|
this.set('showLabels', false);
|
||||||
this.set('showCommits', true);
|
switch (thisReport.id) {
|
||||||
this.getBranchLists();
|
case 'commits_data':
|
||||||
break;
|
this.set('showCommits', true);
|
||||||
case "issues_data":
|
this.getBranchLists();
|
||||||
this.set('showLabels', true);
|
break;
|
||||||
this.getLabelLists();
|
case "issues_data":
|
||||||
break;
|
this.set('showLabels', true);
|
||||||
}
|
this.getLabelLists();
|
||||||
},
|
break;
|
||||||
|
}
|
||||||
getBranchLists() {
|
},
|
||||||
this.set('busy', true);
|
|
||||||
|
getBranchLists() {
|
||||||
let self = this;
|
this.set('busy', true);
|
||||||
let page = this.get('page');
|
|
||||||
|
let self = this;
|
||||||
this.get('sectionService').fetch(page, "branches", self.get('config'))
|
let page = this.get('page');
|
||||||
.then(function (lists) {
|
|
||||||
let savedLists = self.get('config.lists');
|
this.get('sectionService').fetch(page, "branches", self.get('config'))
|
||||||
if (savedLists === null) {
|
.then(function (lists) {
|
||||||
savedLists = [];
|
let savedLists = self.get('config.lists');
|
||||||
}
|
if (savedLists === null) {
|
||||||
|
savedLists = [];
|
||||||
if (lists.length > 0) {
|
}
|
||||||
let noIncluded = true;
|
|
||||||
|
if (lists.length > 0) {
|
||||||
lists.forEach(function (list) {
|
let noIncluded = true;
|
||||||
let included = false;
|
|
||||||
var saved;
|
lists.forEach(function (list) {
|
||||||
if (is.not.undefined(savedLists)) {
|
let included = false;
|
||||||
saved = savedLists.findBy("id", list.id);
|
var saved;
|
||||||
}
|
if (is.not.undefined(savedLists)) {
|
||||||
if (is.not.undefined(saved)) {
|
saved = savedLists.findBy("id", list.id);
|
||||||
included = saved.included;
|
}
|
||||||
noIncluded = false;
|
if (is.not.undefined(saved)) {
|
||||||
}
|
included = saved.included;
|
||||||
list.included = included;
|
noIncluded = false;
|
||||||
});
|
}
|
||||||
|
list.included = included;
|
||||||
if (noIncluded) {
|
});
|
||||||
lists[0].included = true; // make the first entry the default
|
|
||||||
}
|
if (noIncluded) {
|
||||||
}
|
lists[0].included = true; // make the first entry the default
|
||||||
|
}
|
||||||
self.set('config.lists', lists);
|
}
|
||||||
self.set('busy', false);
|
|
||||||
}, function (error) { //jshint ignore: line
|
self.set('config.lists', lists);
|
||||||
self.set('busy', false);
|
self.set('busy', false);
|
||||||
self.set('authenticated', false);
|
}, function (error) { //jshint ignore: line
|
||||||
self.showNotification("Unable to fetch repository branches");
|
self.set('busy', false);
|
||||||
console.log(error);
|
self.set('authenticated', false);
|
||||||
});
|
self.showNotification("Unable to fetch repository branches");
|
||||||
},
|
console.log(error);
|
||||||
|
});
|
||||||
getLabelLists() {
|
},
|
||||||
this.set('busy', true);
|
|
||||||
|
getLabelLists() {
|
||||||
let self = this;
|
this.set('busy', true);
|
||||||
let page = this.get('page');
|
|
||||||
|
let self = this;
|
||||||
let states = [];
|
let page = this.get('page');
|
||||||
states[0] = {
|
|
||||||
id: "open",
|
let states = [];
|
||||||
name: "Show Open Issues"
|
states[0] = {
|
||||||
};
|
id: "open",
|
||||||
states[1] = {
|
name: "Show Open Issues"
|
||||||
id: "closed",
|
};
|
||||||
name: "Show Closed Issues"
|
states[1] = {
|
||||||
};
|
id: "closed",
|
||||||
states[2] = {
|
name: "Show Closed Issues"
|
||||||
id: "all",
|
};
|
||||||
name: "Show All Issues"
|
states[2] = {
|
||||||
};
|
id: "all",
|
||||||
|
name: "Show All Issues"
|
||||||
this.set("states", states);
|
};
|
||||||
|
|
||||||
let thisState = this.get('config.state');
|
this.set("states", states);
|
||||||
|
|
||||||
if (is.null(thisState) || is.undefined(thisState)) {
|
let thisState = this.get('config.state');
|
||||||
thisState = states[0];
|
|
||||||
this.set('config.state', thisState);
|
if (is.null(thisState) || is.undefined(thisState)) {
|
||||||
} else {
|
thisState = states[0];
|
||||||
this.set('config.state', states.findBy('id', thisState.id));
|
this.set('config.state', thisState);
|
||||||
}
|
} else {
|
||||||
|
this.set('config.state', states.findBy('id', thisState.id));
|
||||||
this.set('state', thisState);
|
}
|
||||||
|
|
||||||
this.get('sectionService').fetch(page, "labels", self.get('config'))
|
this.set('state', thisState);
|
||||||
.then(function (lists) {
|
|
||||||
let savedLists = self.get('config.lists');
|
this.get('sectionService').fetch(page, "labels", self.get('config'))
|
||||||
if (savedLists === null) {
|
.then(function (lists) {
|
||||||
savedLists = [];
|
let savedLists = self.get('config.lists');
|
||||||
}
|
if (savedLists === null) {
|
||||||
|
savedLists = [];
|
||||||
if (lists.length > 0) {
|
}
|
||||||
lists.forEach(function (list) {
|
|
||||||
var saved;
|
if (lists.length > 0) {
|
||||||
if (is.not.undefined(savedLists)) {
|
lists.forEach(function (list) {
|
||||||
saved = savedLists.findBy("id", list.id);
|
var saved;
|
||||||
}
|
if (is.not.undefined(savedLists)) {
|
||||||
let included = false;
|
saved = savedLists.findBy("id", list.id);
|
||||||
if (is.not.undefined(saved)) {
|
}
|
||||||
included = saved.included;
|
let included = false;
|
||||||
}
|
if (is.not.undefined(saved)) {
|
||||||
list.included = included;
|
included = saved.included;
|
||||||
});
|
}
|
||||||
}
|
list.included = included;
|
||||||
|
});
|
||||||
self.set('config.lists', lists);
|
}
|
||||||
self.set('busy', false);
|
|
||||||
}, function (error) { //jshint ignore: line
|
self.set('config.lists', lists);
|
||||||
self.set('busy', false);
|
self.set('busy', false);
|
||||||
self.set('authenticated', false);
|
}, function (error) { //jshint ignore: line
|
||||||
self.showNotification("Unable to fetch repository labels");
|
self.set('busy', false);
|
||||||
console.log(error);
|
self.set('authenticated', false);
|
||||||
});
|
self.showNotification("Unable to fetch repository labels");
|
||||||
},
|
console.log(error);
|
||||||
|
});
|
||||||
actions: {
|
},
|
||||||
isDirty() {
|
|
||||||
return this.get('isDirty');
|
actions: {
|
||||||
},
|
isDirty() {
|
||||||
|
return this.get('isDirty');
|
||||||
onListCheckbox(id) {
|
},
|
||||||
let lists = this.get('config.lists');
|
|
||||||
let list = lists.findBy('id', id);
|
onListCheckbox(id) {
|
||||||
|
let lists = this.get('config.lists');
|
||||||
// restore the list of branches to the default state
|
let list = lists.findBy('id', id);
|
||||||
lists.forEach(function (lst) {
|
|
||||||
Ember.set(lst, 'included', false);
|
// restore the list of branches to the default state
|
||||||
});
|
lists.forEach(function (lst) {
|
||||||
|
Ember.set(lst, 'included', false);
|
||||||
if (list !== null) {
|
});
|
||||||
Ember.set(list, 'included', !list.included);
|
|
||||||
}
|
if (list !== null) {
|
||||||
},
|
Ember.set(list, 'included', !list.included);
|
||||||
|
}
|
||||||
onLabelCheckbox(id) {
|
},
|
||||||
let lists = this.get('config.lists');
|
|
||||||
let list = lists.findBy('id', id);
|
onLabelCheckbox(id) {
|
||||||
|
let lists = this.get('config.lists');
|
||||||
if (list !== null) {
|
let list = lists.findBy('id', id);
|
||||||
Ember.set(list, 'included', !list.included);
|
|
||||||
}
|
if (list !== null) {
|
||||||
},
|
Ember.set(list, 'included', !list.included);
|
||||||
|
}
|
||||||
authStage2() {
|
},
|
||||||
let self = this;
|
|
||||||
self.set('authenticated', true);
|
authStage2() {
|
||||||
self.set('busy', true);
|
let self = this;
|
||||||
let page = this.get('page');
|
self.set('authenticated', true);
|
||||||
|
self.set('busy', true);
|
||||||
self.get('sectionService').fetch(page, "owners", self.get('config'))
|
let page = this.get('page');
|
||||||
.then(function (owners) {
|
|
||||||
self.set('busy', false);
|
self.get('sectionService').fetch(page, "owners", self.get('config'))
|
||||||
self.set('owners', owners);
|
.then(function (owners) {
|
||||||
self.getOwnerLists();
|
self.set('busy', false);
|
||||||
}, function (error) { //jshint ignore: line
|
self.set('owners', owners);
|
||||||
self.set('busy', false);
|
self.getOwnerLists();
|
||||||
self.set('authenticated', false);
|
}, function (error) { //jshint ignore: line
|
||||||
self.showNotification("Unable to fetch owners");
|
self.set('busy', false);
|
||||||
console.log(error);
|
self.set('authenticated', false);
|
||||||
});
|
self.showNotification("Unable to fetch owners");
|
||||||
|
console.log(error);
|
||||||
},
|
});
|
||||||
|
|
||||||
auth() {
|
},
|
||||||
|
|
||||||
let self = this;
|
auth() {
|
||||||
self.set('busy', true);
|
|
||||||
self.set('authenticated', false);
|
let self = this;
|
||||||
let target = "https://github.com/login/oauth/authorize?client_id=" + self.get('config.clientId') +
|
self.set('busy', true);
|
||||||
"&scope=repo&redirect_uri=" + encodeURIComponent(self.get('config.callbackUrl')) +
|
self.set('authenticated', false);
|
||||||
"&state=" + encodeURIComponent(window.location.href);
|
let target = "https://github.com/login/oauth/authorize?client_id=" + self.get('config.clientId') +
|
||||||
window.location.href = target;
|
"&scope=repo&redirect_uri=" + encodeURIComponent(self.get('config.callbackUrl')) +
|
||||||
|
"&state=" + encodeURIComponent(window.location.href);
|
||||||
},
|
window.location.href = target;
|
||||||
|
|
||||||
onOwnerChange(thisOwner) {
|
},
|
||||||
this.set('isDirty', true);
|
|
||||||
this.set('config.owner', thisOwner);
|
onOwnerChange(thisOwner) {
|
||||||
this.set('config.repos', []);
|
this.set('isDirty', true);
|
||||||
this.set('config.lists', []);
|
this.set('config.owner', thisOwner);
|
||||||
this.getOwnerLists();
|
this.set('config.repos', []);
|
||||||
},
|
this.set('config.lists', []);
|
||||||
|
this.getOwnerLists();
|
||||||
onRepoChange(thisRepo) {
|
},
|
||||||
this.set('isDirty', true);
|
|
||||||
this.set('config.repo', thisRepo);
|
onRepoChange(thisRepo) {
|
||||||
this.set('config.lists', []);
|
this.set('isDirty', true);
|
||||||
this.getRepoLists();
|
this.set('config.repo', thisRepo);
|
||||||
},
|
this.set('config.lists', []);
|
||||||
|
this.getRepoLists();
|
||||||
onReportChange(thisReport) {
|
},
|
||||||
this.set('isDirty', true);
|
|
||||||
this.set('config.report', thisReport);
|
onReportChange(thisReport) {
|
||||||
this.getReportLists();
|
this.set('isDirty', true);
|
||||||
},
|
this.set('config.report', thisReport);
|
||||||
|
this.getReportLists();
|
||||||
onStateChange(thisState) {
|
},
|
||||||
this.set('config.state', thisState);
|
|
||||||
},
|
onStateChange(thisState) {
|
||||||
|
this.set('config.state', thisState);
|
||||||
onCancel() {
|
},
|
||||||
this.attrs.onCancel();
|
|
||||||
},
|
onCancel() {
|
||||||
|
this.attrs.onCancel();
|
||||||
onAction(title) {
|
},
|
||||||
this.set('busy', true);
|
|
||||||
|
onAction(title) {
|
||||||
let thisLines = this.get('config.branchLines');
|
this.set('busy', true);
|
||||||
if (is.undefined(thisLines) || thisLines === "") {
|
|
||||||
this.set('config.branchLines', 30);
|
let thisLines = this.get('config.branchLines');
|
||||||
} else if (thisLines < 1) {
|
if (is.undefined(thisLines) || thisLines === "") {
|
||||||
this.set('config.branchLines', 1);
|
this.set('config.branchLines', 30);
|
||||||
} else if (thisLines > 100) {
|
} else if (thisLines < 1) {
|
||||||
this.set('config.branchLines', 100);
|
this.set('config.branchLines', 1);
|
||||||
}
|
} else if (thisLines > 100) {
|
||||||
|
this.set('config.branchLines', 100);
|
||||||
let self = this;
|
}
|
||||||
let page = this.get('page');
|
|
||||||
let meta = this.get('meta');
|
let self = this;
|
||||||
page.set('title', title);
|
let page = this.get('page');
|
||||||
meta.set('rawBody', '');
|
let meta = this.get('meta');
|
||||||
meta.set('config', JSON.stringify(this.get('config')));
|
page.set('title', title);
|
||||||
meta.set('externalSource', true);
|
meta.set('rawBody', '');
|
||||||
|
meta.set('config', JSON.stringify(this.get('config')));
|
||||||
let thisReport = this.get('config.report');
|
meta.set('externalSource', true);
|
||||||
this.get('sectionService').fetch(page, thisReport.id, this.get('config'))
|
|
||||||
.then(function (response) {
|
let thisReport = this.get('config.report');
|
||||||
meta.set('rawBody', JSON.stringify(response));
|
this.get('sectionService').fetch(page, thisReport.id, this.get('config'))
|
||||||
self.set('busy', false);
|
.then(function (response) {
|
||||||
self.attrs.onAction(page, meta);
|
meta.set('rawBody', JSON.stringify(response));
|
||||||
}, function (reason) { //jshint ignore: line
|
self.set('busy', false);
|
||||||
self.set('busy', false);
|
self.attrs.onAction(page, meta);
|
||||||
self.attrs.onAction(page, meta);
|
}, function (reason) { //jshint ignore: line
|
||||||
});
|
self.set('busy', false);
|
||||||
}
|
self.attrs.onAction(page, meta);
|
||||||
}
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
});
|
});
|
|
@ -136,7 +136,7 @@ func (p *Provider) Command(w http.ResponseWriter, r *http.Request) {
|
||||||
provider.WriteError(w, "github", err)
|
provider.WriteError(w, "github", err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
provider.WriteEmpty(w)
|
provider.WriteJSON(w, config)
|
||||||
return
|
return
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue