forked from mozilla/gecko-dev
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bug 999417 - Land the new App Manager UI. r=jryans r=mshal
- Loading branch information
Paul Rouget
committed
May 12, 2014
1 parent
a5f6ffe
commit a33bf3b
Showing
30 changed files
with
2,560 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# This Source Code Form is subject to the terms of the Mozilla Public | ||
# License, v. 2.0. If a copy of the MPL was not distributed with this | ||
# file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||
|
||
PREF_JS_EXPORTS = $(srcdir)/webide-prefs.js | ||
|
||
include $(topsrcdir)/config/rules.mk | ||
|
||
libs:: | ||
$(NSINSTALL) $(srcdir)/modules/*.js $(FINAL_TARGET)/modules/devtools |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,122 @@ | ||
/* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ | ||
|
||
const Cu = Components.utils; | ||
Cu.import("resource:///modules/devtools/gDevTools.jsm"); | ||
const {Services} = Cu.import("resource://gre/modules/Services.jsm"); | ||
const {require} = Cu.import("resource://gre/modules/devtools/Loader.jsm", {}).devtools; | ||
const {AppProjects} = require("devtools/app-manager/app-projects"); | ||
const {AppValidator} = require("devtools/app-manager/app-validator"); | ||
const {AppManager} = require("devtools/app-manager"); | ||
|
||
window.addEventListener("load", function onLoad() { | ||
window.removeEventListener("load", onLoad); | ||
document.addEventListener("visibilitychange", updateUI, true); | ||
AppManager.on("app-manager-update", onAppManagerUpdate); | ||
updateUI(); | ||
}, true); | ||
|
||
window.addEventListener("unload", function onUnload() { | ||
window.removeEventListener("unload", onUnload); | ||
AppManager.off("app-manager-update", onAppManagerUpdate); | ||
}, true); | ||
|
||
function onAppManagerUpdate(event, what, details) { | ||
if (what == "project" || | ||
what == "project-validated") { | ||
updateUI(); | ||
} | ||
} | ||
|
||
function resetUI() { | ||
document.querySelector("#toolbar").classList.add("hidden"); | ||
document.querySelector("#type").classList.add("hidden"); | ||
document.querySelector("#descriptionHeader").classList.add("hidden"); | ||
document.querySelector("#manifestURLHeader").classList.add("hidden"); | ||
document.querySelector("#locationHeader").classList.add("hidden"); | ||
|
||
document.body.className = ""; | ||
document.querySelector("#icon").src = ""; | ||
document.querySelector("h1").textContent = ""; | ||
document.querySelector("#description").textContent = ""; | ||
document.querySelector("#type").textContent = ""; | ||
document.querySelector("#manifestURL").textContent = ""; | ||
document.querySelector("#location").textContent = ""; | ||
|
||
document.querySelector("#errorslist").innerHTML = ""; | ||
document.querySelector("#warningslist").innerHTML = ""; | ||
|
||
} | ||
|
||
function updateUI() { | ||
resetUI(); | ||
|
||
let project = AppManager.selectedProject; | ||
if (!project) { | ||
return; | ||
} | ||
|
||
if (project.type != "runtimeApp") { | ||
document.querySelector("#toolbar").classList.remove("hidden"); | ||
document.querySelector("#locationHeader").classList.remove("hidden"); | ||
document.querySelector("#location").textContent = project.location; | ||
} | ||
|
||
document.body.className = project.validationStatus; | ||
document.querySelector("#icon").src = project.icon; | ||
document.querySelector("h1").textContent = project.name; | ||
|
||
let manifest; | ||
if (project.type == "runtimeApp") { | ||
manifest = project.app.manifest; | ||
} else { | ||
manifest = project.manifest; | ||
} | ||
|
||
if (manifest) { | ||
if (manifest.description) { | ||
document.querySelector("#descriptionHeader").classList.remove("hidden"); | ||
document.querySelector("#description").textContent = manifest.description; | ||
} | ||
|
||
document.querySelector("#type").classList.remove("hidden"); | ||
|
||
if (project.type == "runtimeApp") { | ||
document.querySelector("#type").textContent = manifest.type || "web"; | ||
} else { | ||
document.querySelector("#type").textContent = project.type + " " + (manifest.type || "web"); | ||
} | ||
|
||
if (project.type == "packaged") { | ||
let manifest = AppManager.getProjectManifestURL(project); | ||
if (manifest) { | ||
document.querySelector("#manifestURLHeader").classList.remove("hidden"); | ||
document.querySelector("#manifestURL").textContent = manifest; | ||
} | ||
} | ||
} | ||
|
||
let errorsNode = document.querySelector("#errorslist"); | ||
let warningsNode = document.querySelector("#warningslist"); | ||
|
||
if (project.errors) { | ||
for (let e of project.errors) { | ||
let li = document.createElement("li"); | ||
li.textContent = e; | ||
errorsNode.appendChild(li); | ||
} | ||
} | ||
|
||
if (project.warnings) { | ||
for (let w of project.warnings) { | ||
let li = document.createElement("li"); | ||
li.textContent = w; | ||
warningsNode.appendChild(li); | ||
} | ||
} | ||
} | ||
|
||
function removeProject() { | ||
AppManager.removeSelectedProject(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
|
||
<!-- This Source Code Form is subject to the terms of the Mozilla Public | ||
- License, v. 2.0. If a copy of the MPL was not distributed with this | ||
- file, You can obtain one at http://mozilla.org/MPL/2.0/. --> | ||
|
||
<!DOCTYPE html [ | ||
<!ENTITY % webideDTD SYSTEM "chrome://webide/locale/webide.dtd" > | ||
%webideDTD; | ||
]> | ||
|
||
<html xmlns="http://www.w3.org/1999/xhtml"> | ||
<head> | ||
<meta charset="utf8"/> | ||
<link rel="stylesheet" href="chrome://webide/skin/details.css" type="text/css"/> | ||
<script type="application/javascript;version=1.8" src="chrome://webide/content/details.js"></script> | ||
</head> | ||
<body> | ||
|
||
<div id="toolbar"> | ||
<button onclick="removeProject()">&details_removeProject_button;</button> | ||
<p id="validation_status"> | ||
<span class="valid">&details_valid_header;</span> | ||
<span class="warning">&details_warning_header;</span> | ||
<span class="error">&details_error_header;</span> | ||
</p> | ||
</div> | ||
|
||
<header> | ||
<img id="icon"></img> | ||
<div> | ||
<h1></h1> | ||
<p id="type"></p> | ||
</div> | ||
</header> | ||
|
||
<main> | ||
<h3 id="descriptionHeader">&details_description;</h3> | ||
<p id="description"></p> | ||
|
||
<h3 id="locationHeader">&details_location;</h3> | ||
<p id="location"></p> | ||
|
||
<h3 id="manifestURLHeader">&details_manifestURL;</h3> | ||
<p id="manifestURL"></p> | ||
</main> | ||
|
||
<ul class="validation_messages" id="errorslist"></ul> | ||
<ul class="validation_messages" id="warningslist"></ul> | ||
|
||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# This Source Code Form is subject to the terms of the Mozilla Public | ||
# License, v. 2.0. If a copy of the MPL was not distributed with this | ||
# file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||
|
||
webide.jar: | ||
% content webide %content/ | ||
content/webide.xul (webide.xul) | ||
content/webide.js (webide.js) | ||
content/newapp.xul (newapp.xul) | ||
content/newapp.js (newapp.js) | ||
content/details.xhtml (details.xhtml) | ||
content/details.js (details.js) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*- | ||
# vim: set filetype=python: | ||
# This Source Code Form is subject to the terms of the Mozilla Public | ||
# License, v. 2.0. If a copy of the MPL was not distributed with this | ||
# file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||
|
||
JAR_MANIFESTS += ['jar.mn'] |
Oops, something went wrong.