Convert to new viewmodel declaration
We've been supporting the new object based view model declaration format since 1.3.0, time to move the bundled view models towards actually using it.
This commit is contained in:
parent
f1518e6fe6
commit
65753a0539
27 changed files with 146 additions and 158 deletions
|
|
@ -338,10 +338,9 @@ $(function() {
|
|||
|
||||
}
|
||||
|
||||
// view model class, parameters for constructor, container to bind to
|
||||
ADDITIONAL_VIEWMODELS.push([
|
||||
AnnouncementsViewModel,
|
||||
["loginStateViewModel", "settingsViewModel"],
|
||||
["#plugin_announcements_dialog", "#settings_plugin_announcements", "#navbar_plugin_announcements"]
|
||||
]);
|
||||
OCTOPRINT_VIEWMODELS.push({
|
||||
construct: AnnouncementsViewModel,
|
||||
dependencies: ["loginStateViewModel", "settingsViewModel"],
|
||||
elements: ["#plugin_announcements_dialog", "#settings_plugin_announcements", "#navbar_plugin_announcements"]
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -321,29 +321,29 @@ $(function() {
|
|||
};
|
||||
}
|
||||
|
||||
OCTOPRINT_VIEWMODELS.push([
|
||||
CoreWizardAclViewModel,
|
||||
["loginStateViewModel"],
|
||||
"#wizard_plugin_corewizard_acl"
|
||||
], [
|
||||
CoreWizardWebcamViewModel,
|
||||
["settingsViewModel"],
|
||||
"#wizard_plugin_corewizard_webcam"
|
||||
], [
|
||||
CoreWizardServerCommandsViewModel,
|
||||
["settingsViewModel"],
|
||||
"#wizard_plugin_corewizard_servercommands"
|
||||
], [
|
||||
CoreWizardOnlineCheckViewModel,
|
||||
["settingsViewModel"],
|
||||
"#wizard_plugin_corewizard_onlinecheck"
|
||||
], [
|
||||
CoreWizardPluginBlacklistViewModel,
|
||||
["settingsViewModel"],
|
||||
"#wizard_plugin_corewizard_pluginblacklist"
|
||||
], [
|
||||
CoreWizardPrinterProfileViewModel,
|
||||
["printerProfilesViewModel"],
|
||||
"#wizard_plugin_corewizard_printerprofile"
|
||||
]);
|
||||
OCTOPRINT_VIEWMODELS.push({
|
||||
construct: CoreWizardAclViewModel,
|
||||
dependencies: ["loginStateViewModel"],
|
||||
elements: ["#wizard_plugin_corewizard_acl"]
|
||||
}, {
|
||||
construct: CoreWizardWebcamViewModel,
|
||||
dependencies: ["settingsViewModel"],
|
||||
elements: ["#wizard_plugin_corewizard_webcam"]
|
||||
}, {
|
||||
construct: CoreWizardServerCommandsViewModel,
|
||||
dependencies: ["settingsViewModel"],
|
||||
elements: ["#wizard_plugin_corewizard_servercommands"]
|
||||
}, {
|
||||
construct: CoreWizardOnlineCheckViewModel,
|
||||
dependencies: ["settingsViewModel"],
|
||||
elements: ["#wizard_plugin_corewizard_onlinecheck"]
|
||||
}, {
|
||||
construct: CoreWizardPluginBlacklistViewModel,
|
||||
dependencies: ["settingsViewModel"],
|
||||
elements: ["#wizard_plugin_corewizard_pluginblacklist"]
|
||||
}, {
|
||||
construct: CoreWizardPrinterProfileViewModel,
|
||||
dependencies: ["printerProfilesViewModel"],
|
||||
elements: ["#wizard_plugin_corewizard_printerprofile"]
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -311,10 +311,9 @@ $(function() {
|
|||
};
|
||||
}
|
||||
|
||||
// view model class, parameters for constructor, container to bind to
|
||||
OCTOPRINT_VIEWMODELS.push([
|
||||
CuraViewModel,
|
||||
["loginStateViewModel", "settingsViewModel", "slicingViewModel"],
|
||||
["#settings_plugin_cura", "#wizard_plugin_cura"]
|
||||
]);
|
||||
OCTOPRINT_VIEWMODELS.push({
|
||||
construct: CuraViewModel,
|
||||
dependencies: ["loginStateViewModel", "settingsViewModel", "slicingViewModel"],
|
||||
elements: ["#settings_plugin_cura", "#wizard_plugin_cura"]
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -44,10 +44,7 @@ $(function() {
|
|||
};
|
||||
}
|
||||
|
||||
// view model class, parameters for constructor, container to bind to
|
||||
ADDITIONAL_VIEWMODELS.push([
|
||||
OctoPiSupportViewModel,
|
||||
[],
|
||||
[]
|
||||
]);
|
||||
OCTOPRINT_VIEWMODELS.push({
|
||||
construct: OctoPiSupportViewModel
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1265,17 +1265,16 @@ $(function() {
|
|||
|
||||
self._forcedStdoutLine = /You are using pip version .*?, however version .*? is available\.|You should consider upgrading via the '.*?' command\./;
|
||||
self._preprocessLine = function(line) {
|
||||
if (line.stream == "stderr" && line.line.match(self._forcedStdoutLine)) {
|
||||
if (line.stream === "stderr" && line.line.match(self._forcedStdoutLine)) {
|
||||
line.stream = "stdout";
|
||||
}
|
||||
return line;
|
||||
}
|
||||
}
|
||||
|
||||
// view model class, parameters for constructor, container to bind to
|
||||
ADDITIONAL_VIEWMODELS.push([
|
||||
PluginManagerViewModel,
|
||||
["loginStateViewModel", "settingsViewModel", "printerStateViewModel", "systemViewModel"],
|
||||
"#settings_plugin_pluginmanager"
|
||||
]);
|
||||
OCTOPRINT_VIEWMODELS.push({
|
||||
construct: PluginManagerViewModel,
|
||||
dependencies: ["loginStateViewModel", "settingsViewModel", "printerStateViewModel", "systemViewModel"],
|
||||
elements: ["#settings_plugin_pluginmanager"]
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -837,10 +837,9 @@ $(function() {
|
|||
}
|
||||
}
|
||||
|
||||
// view model class, parameters for constructor, container to bind to
|
||||
ADDITIONAL_VIEWMODELS.push([
|
||||
SoftwareUpdateViewModel,
|
||||
["loginStateViewModel", "printerStateViewModel", "settingsViewModel"],
|
||||
["#settings_plugin_softwareupdate", "#softwareupdate_confirmation_dialog", "#wizard_plugin_softwareupdate"]
|
||||
]);
|
||||
OCTOPRINT_VIEWMODELS.push({
|
||||
construct: SoftwareUpdateViewModel,
|
||||
dependencies: ["loginStateViewModel", "printerStateViewModel", "settingsViewModel"],
|
||||
elements: ["#settings_plugin_softwareupdate", "#softwareupdate_confirmation_dialog", "#wizard_plugin_softwareupdate"]
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -322,11 +322,14 @@ $(function() {
|
|||
// no alternative names? empty array
|
||||
viewModel.additionalNames = viewModel.additionalNames || [];
|
||||
|
||||
// make sure all value's are in an array
|
||||
viewModel.dependencies = (_.isArray(viewModel.dependencies)) ? viewModel.dependencies : [viewModel.dependencies];
|
||||
viewModel.elements = (_.isArray(viewModel.elements)) ? viewModel.elements : [viewModel.elements];
|
||||
viewModel.optional = (_.isArray(viewModel.optional)) ? viewModel.optional : [viewModel.optional];
|
||||
viewModel.additionalNames = (_.isArray(viewModel.additionalNames)) ? viewModel.additionalNames : [viewModel.additionalNames];
|
||||
// make sure all value's are set and in an array
|
||||
_.each(["dependencies", "elements", "optional", "additionalNames"], function(key) {
|
||||
if (viewModel[key] === undefined) {
|
||||
viewModel[key] = [];
|
||||
} else {
|
||||
viewModel[key] = (_.isArray(viewModel[key])) ? viewModel[key] : [viewModel[key]];
|
||||
}
|
||||
});
|
||||
|
||||
// make sure that we don't have two view models going by the same name
|
||||
if (_.has(viewModelMap, viewModel.name)) {
|
||||
|
|
|
|||
|
|
@ -37,9 +37,8 @@ $(function() {
|
|||
};
|
||||
}
|
||||
|
||||
OCTOPRINT_VIEWMODELS.push([
|
||||
AboutViewModel,
|
||||
[],
|
||||
["#about_dialog", "#footer_about"]
|
||||
]);
|
||||
OCTOPRINT_VIEWMODELS.push({
|
||||
construct: AboutViewModel,
|
||||
elements: ["#about_dialog", "#footer_about"]
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -28,9 +28,9 @@ $(function() {
|
|||
});
|
||||
}
|
||||
|
||||
OCTOPRINT_VIEWMODELS.push([
|
||||
AppearanceViewModel,
|
||||
["settingsViewModel"],
|
||||
"head"
|
||||
]);
|
||||
OCTOPRINT_VIEWMODELS.push({
|
||||
construct: AppearanceViewModel,
|
||||
dependencies: ["settingsViewModel"],
|
||||
elements: ["head"]
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -143,9 +143,9 @@ $(function() {
|
|||
};
|
||||
}
|
||||
|
||||
OCTOPRINT_VIEWMODELS.push([
|
||||
ConnectionViewModel,
|
||||
["loginStateViewModel", "settingsViewModel", "printerProfilesViewModel"],
|
||||
"#connection_wrapper"
|
||||
]);
|
||||
OCTOPRINT_VIEWMODELS.push({
|
||||
construct: ConnectionViewModel,
|
||||
dependencies: ["loginStateViewModel", "settingsViewModel", "printerProfilesViewModel"],
|
||||
elements: ["#connection_wrapper"]
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -554,9 +554,9 @@ $(function() {
|
|||
|
||||
}
|
||||
|
||||
OCTOPRINT_VIEWMODELS.push([
|
||||
ControlViewModel,
|
||||
["loginStateViewModel", "settingsViewModel"],
|
||||
"#control"
|
||||
]);
|
||||
OCTOPRINT_VIEWMODELS.push({
|
||||
construct: ControlViewModel,
|
||||
dependencies: ["loginStateViewModel", "settingsViewModel"],
|
||||
elements: ["#control"]
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1171,6 +1171,6 @@ $(function() {
|
|||
name: "filesViewModel",
|
||||
additionalNames: ["gcodeFilesViewModel"],
|
||||
dependencies: ["settingsViewModel", "loginStateViewModel", "printerStateViewModel", "slicingViewModel", "printerProfilesViewModel"],
|
||||
elements: ["#files_wrapper", "#add_folder_dialog"],
|
||||
elements: ["#files_wrapper", "#add_folder_dialog"]
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -742,9 +742,9 @@ $(function() {
|
|||
};
|
||||
}
|
||||
|
||||
OCTOPRINT_VIEWMODELS.push([
|
||||
GcodeViewModel,
|
||||
["loginStateViewModel", "settingsViewModel"],
|
||||
"#gcode"
|
||||
]);
|
||||
OCTOPRINT_VIEWMODELS.push({
|
||||
construct: GcodeViewModel,
|
||||
dependencies: ["loginStateViewModel", "settingsViewModel"],
|
||||
elements: ["#gcode"]
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -58,9 +58,9 @@ $(function() {
|
|||
};
|
||||
}
|
||||
|
||||
OCTOPRINT_VIEWMODELS.push([
|
||||
LogViewModel,
|
||||
["loginStateViewModel"],
|
||||
"#logs"
|
||||
]);
|
||||
OCTOPRINT_VIEWMODELS.push({
|
||||
construct: LogViewModel,
|
||||
dependencies: ["loginStateViewModel"],
|
||||
elements: ["#logs"]
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -200,9 +200,7 @@ $(function() {
|
|||
};
|
||||
}
|
||||
|
||||
OCTOPRINT_VIEWMODELS.push([
|
||||
LoginStateViewModel,
|
||||
[],
|
||||
[]
|
||||
]);
|
||||
OCTOPRINT_VIEWMODELS.push({
|
||||
construct: LoginStateViewModel
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -18,9 +18,9 @@ $(function() {
|
|||
|
||||
}
|
||||
|
||||
OCTOPRINT_VIEWMODELS.push([
|
||||
NavigationViewModel,
|
||||
["loginStateViewModel", "appearanceViewModel", "settingsViewModel", "userSettingsViewModel", "systemViewModel"],
|
||||
"#navbar"
|
||||
]);
|
||||
OCTOPRINT_VIEWMODELS.push({
|
||||
construct: NavigationViewModel,
|
||||
dependencies: ["loginStateViewModel", "appearanceViewModel", "settingsViewModel", "userSettingsViewModel", "systemViewModel"],
|
||||
elements: ["#navbar"]
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -597,9 +597,7 @@ $(function() {
|
|||
self.onStartup = self.requestData;
|
||||
}
|
||||
|
||||
OCTOPRINT_VIEWMODELS.push([
|
||||
PrinterProfilesViewModel,
|
||||
[],
|
||||
[]
|
||||
]);
|
||||
OCTOPRINT_VIEWMODELS.push({
|
||||
construct: PrinterProfilesViewModel
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -309,9 +309,9 @@ $(function() {
|
|||
};
|
||||
}
|
||||
|
||||
OCTOPRINT_VIEWMODELS.push([
|
||||
PrinterStateViewModel,
|
||||
["loginStateViewModel", "settingsViewModel"],
|
||||
["#state_wrapper", "#drop_overlay"]
|
||||
]);
|
||||
OCTOPRINT_VIEWMODELS.push({
|
||||
construct: PrinterStateViewModel,
|
||||
dependencies: ["loginStateViewModel", "settingsViewModel"],
|
||||
elements: ["#state_wrapper", "#drop_overlay"]
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -948,9 +948,9 @@ $(function() {
|
|||
}
|
||||
}
|
||||
|
||||
OCTOPRINT_VIEWMODELS.push([
|
||||
SettingsViewModel,
|
||||
["loginStateViewModel", "usersViewModel", "printerProfilesViewModel", "aboutViewModel"],
|
||||
["#settings_dialog", "#navbar_settings"]
|
||||
]);
|
||||
OCTOPRINT_VIEWMODELS.push({
|
||||
construct: SettingsViewModel,
|
||||
dependencies: ["loginStateViewModel", "usersViewModel", "printerProfilesViewModel", "aboutViewModel"],
|
||||
elements: ["#settings_dialog", "#navbar_settings"]
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -313,9 +313,9 @@ $(function() {
|
|||
};
|
||||
}
|
||||
|
||||
OCTOPRINT_VIEWMODELS.push([
|
||||
SlicingViewModel,
|
||||
["loginStateViewModel", "printerProfilesViewModel", "printerStateViewModel"],
|
||||
"#slicing_configuration_dialog"
|
||||
]);
|
||||
OCTOPRINT_VIEWMODELS.push({
|
||||
construct: SlicingViewModel,
|
||||
dependencies: ["loginStateViewModel", "printerProfilesViewModel", "printerStateViewModel"],
|
||||
elements: ["#slicing_configuration_dialog"]
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -110,10 +110,8 @@ $(function() {
|
|||
};
|
||||
}
|
||||
|
||||
// view model class, parameters for constructor, container to bind to
|
||||
ADDITIONAL_VIEWMODELS.push([
|
||||
SystemViewModel,
|
||||
["loginStateViewModel"],
|
||||
[]
|
||||
]);
|
||||
OCTOPRINT_VIEWMODELS.push({
|
||||
construct: SystemViewModel,
|
||||
dependencies: ["loginStateViewModel"]
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -773,9 +773,9 @@ $(function() {
|
|||
|
||||
}
|
||||
|
||||
OCTOPRINT_VIEWMODELS.push([
|
||||
TemperatureViewModel,
|
||||
["loginStateViewModel", "settingsViewModel"],
|
||||
["#temp", "#change_offset_dialog"]
|
||||
]);
|
||||
OCTOPRINT_VIEWMODELS.push({
|
||||
construct: TemperatureViewModel,
|
||||
dependencies: ["loginStateViewModel", "settingsViewModel"],
|
||||
elements: ["#temp", "#change_offset_dialog"]
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -393,9 +393,9 @@ $(function() {
|
|||
|
||||
}
|
||||
|
||||
OCTOPRINT_VIEWMODELS.push([
|
||||
TerminalViewModel,
|
||||
["loginStateViewModel", "settingsViewModel"],
|
||||
"#term"
|
||||
]);
|
||||
OCTOPRINT_VIEWMODELS.push({
|
||||
construct: TerminalViewModel,
|
||||
dependencies: ["loginStateViewModel", "settingsViewModel"],
|
||||
elements: ["#term"]
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -533,9 +533,9 @@ $(function() {
|
|||
};
|
||||
}
|
||||
|
||||
OCTOPRINT_VIEWMODELS.push([
|
||||
TimelapseViewModel,
|
||||
["loginStateViewModel"],
|
||||
"#timelapse"
|
||||
]);
|
||||
OCTOPRINT_VIEWMODELS.push({
|
||||
construct: TimelapseViewModel,
|
||||
dependencies: ["loginStateViewModel"],
|
||||
elements: ["#timelapse"]
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -227,9 +227,8 @@ $(function() {
|
|||
}
|
||||
}
|
||||
|
||||
OCTOPRINT_VIEWMODELS.push([
|
||||
UsersViewModel,
|
||||
["loginStateViewModel"],
|
||||
[]
|
||||
]);
|
||||
OCTOPRINT_VIEWMODELS.push({
|
||||
construct: UsersViewModel,
|
||||
dependencies: ["loginStateViewModel"]
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -126,9 +126,9 @@ $(function() {
|
|||
|
||||
}
|
||||
|
||||
OCTOPRINT_VIEWMODELS.push([
|
||||
UserSettingsViewModel,
|
||||
["loginStateViewModel", "usersViewModel"],
|
||||
["#usersettings_dialog"]
|
||||
]);
|
||||
OCTOPRINT_VIEWMODELS.push({
|
||||
construct: UserSettingsViewModel,
|
||||
dependencies: ["loginStateViewModel", "usersViewModel"],
|
||||
elements: ["#usersettings_dialog"]
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -220,9 +220,9 @@ $(function() {
|
|||
}
|
||||
}
|
||||
|
||||
OCTOPRINT_VIEWMODELS.push([
|
||||
WizardViewModel,
|
||||
["loginStateViewModel", "settingsViewModel"],
|
||||
"#wizard_dialog"
|
||||
]);
|
||||
OCTOPRINT_VIEWMODELS.push({
|
||||
construct: WizardViewModel,
|
||||
dependencies: ["loginStateViewModel", "settingsViewModel"],
|
||||
elements: ["#wizard_dialog"]
|
||||
});
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in a new issue