reduce the JSON size needed to store the field settings by storing only what it's not assumed by default #7
This commit is contained in:
Родитель
6ac1684e61
Коммит
5404276522
25
app.js
25
app.js
|
@ -292,7 +292,12 @@
|
|||
|
||||
if (!this.vm.isAppLoadedOk) {
|
||||
//Initialize global data
|
||||
this.vm.fieldSettings = JSON.parse(this.setting('vso_field_settings') || DEFAULT_FIELD_SETTINGS);
|
||||
try {
|
||||
this.vm.fieldSettings = JSON.parse(this.setting('vso_field_settings') || DEFAULT_FIELD_SETTINGS);
|
||||
} catch (ex) {
|
||||
services.notify(this.I18n.t('errorReadingFieldSettings'), 'alert');
|
||||
this.vm.fieldSettings = JSON.parse(DEFAULT_FIELD_SETTINGS);
|
||||
}
|
||||
this.when(
|
||||
this.ajax('getVsoProjects'),
|
||||
this.ajax('getVsoFields')
|
||||
|
@ -439,10 +444,20 @@
|
|||
var fieldSettings = {};
|
||||
this.$('tr').each(function () {
|
||||
var line = self.$(this);
|
||||
fieldSettings[line.attr('data-refName')] = {
|
||||
summary: line.find('.summary').is(':checked'),
|
||||
details: line.find('.details').is(':checked')
|
||||
};
|
||||
var fieldName = line.attr('data-refName');
|
||||
if (!fieldName) return true; //continue
|
||||
|
||||
var inSummary = line.find('.summary').is(':checked');
|
||||
var inDetails = line.find('.details').is(':checked');
|
||||
|
||||
if (inSummary || inDetails) {
|
||||
fieldSettings[fieldName] = {
|
||||
summary: inSummary,
|
||||
details: inDetails
|
||||
};
|
||||
} else if (fieldSettings[fieldName]) {
|
||||
delete fieldName[fieldName];
|
||||
}
|
||||
});
|
||||
this.vm.fieldSettings = fieldSettings;
|
||||
this.ajax('saveSettings', { vso_field_settings: JSON.stringify(fieldSettings) })
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
"defaultLocale": "en",
|
||||
"singleInstall": true,
|
||||
"frameworkVersion": "1.0",
|
||||
"version": "0.3",
|
||||
"version": "0.3.1",
|
||||
"parameters": [
|
||||
{
|
||||
"name": "vso_account",
|
||||
|
|
|
@ -120,5 +120,6 @@
|
|||
"errorLoadingApp": "Something went wrong while loading the app. Confirm that your Visual Studio Online alternate credentials are correct by clicking in the user icon.",
|
||||
"errorInvalidAccount": "The Visual Studio Online account '{{accountName}}' doesn't exist or you don't have access to it. Contact your Zendesk account Administrator to check and review the app settings.",
|
||||
"errorLoadingWorkItems": "Something went wrong while loading working items. Click the refresh icon to try again.",
|
||||
"errorOoops" : "Ooops!"
|
||||
"errorOoops": "Ooops!",
|
||||
"errorReadingFieldSettings": "There was an error while reading field settings. Applying default settings."
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче