Skip to content

Commit

Permalink
Merge branch 'master' into stable
Browse files Browse the repository at this point in the history
  • Loading branch information
jrtcppv committed Jan 22, 2022
2 parents 67cd56b + 08479d9 commit e77916e
Show file tree
Hide file tree
Showing 11 changed files with 406 additions and 227 deletions.
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,7 @@ FILES = \
organizations/organization-summary.js \
organizations/new-organization.js \
organizations/organizations-dashboard.js \
organizations/new-organization-dialog.js \
account-profile/account-profile.js \
token/token-page.js \
new-project/new-project-close.js \
Expand Down
4 changes: 2 additions & 2 deletions containers/tator/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ RUN pip3 --no-cache-dir --timeout=1000 install \
djangorestframework==3.11.0 pygments==2.4.2 \
django-extensions==2.2.5 pygraphviz==1.5 \
pyparsing==2.4.5 pydot==1.4.1 markdown==3.1.1 \
hiredis==1.0.0 redis==3.3.11 greenlet==1.1.0 \
hiredis==1.0.0 redis==3.3.11 greenlet==1.1.2 \
gunicorn==20.1.0 django_admin_json_editor==0.2.0 django-ltree==0.4 \
requests==2.22.0 python-dateutil==2.8.1 ujson==1.35 slackclient==2.3.1 \
google-auth==1.28.0 elasticsearch==7.1.0 progressbar2==3.47.0 \
gevent==21.1.2 uritemplate==3.0.1 pylint pylint-django \
gevent==21.12.0 uritemplate==3.0.1 pylint pylint-django \
django-cognito-jwt==0.0.3 boto3==1.17.84 \
google-cloud-storage==1.37.1 datadog==0.41.0 \
kubernetes==21.7.0
Expand Down
160 changes: 160 additions & 0 deletions main/static/js/organizations/new-organization-dialog.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,160 @@
class NewOrganizationDialog extends ModalDialog {
constructor() {
super();

this._title.nodeValue = "Create new organization";
this._main.style.marginBottom = "0";
this._main.style.paddingBottom = "0";

this._name = document.createElement("text-input");
this._name.setAttribute("name", "Name");
this._name.setAttribute("type", "string");
this._main.appendChild(this._name);

this._summary = document.createElement("text-input");
// this._summary.setAttribute("name", "Summary");
// this._summary.setAttribute("type", "string");
// this._main.appendChild(this._summary);

// this._organization = document.createElement("enum-input");
// this._organization.setAttribute("name", "Organization");
// this._organization.setAttribute("permission", "Ready Only");
// this._main.appendChild(this._organization);

this._preset = document.createElement("enum-input");
// this._preset.setAttribute("name", "Preset");
// this._preset.choices = [{
// value: "imageClassification",
// label: "Image classification",
// }, {
// value: "objectDetection",
// label: "Object detection",
// }, {
// value: "multiObjectTracking",
// label: "Multi-object tracking",
// }, {
// value: "activityRecognition",
// label: "Activity recognition",
// }, {
// value: "none",
// label: "None (no preset)",
// }];
// this._main.appendChild(this._preset);

const messages = document.createElement("div");
messages.setAttribute("class", "main__header d-flex flex-items-center flex-justify-center");
this._main.appendChild(messages);

this._messageList = document.createElement("ul");
this._messageList.setAttribute("class", "form-errors");
messages.appendChild(this._messageList);

const li = document.createElement("li");
this._messageList.appendChild(li);

this._nameWarning = document.createElement("h3");
this._nameWarning.setAttribute("class", "h3 text-red");
this._nameWarning.setAttribute("style", "text-align:center;width:400px");
this._nameWarning.textContent = "Project with this name exists!";
this._nameWarning.style.display = "none";
li.appendChild(this._nameWarning);

this._accept = document.createElement("button");
this._accept.setAttribute("class", "btn btn-clear btn-purple");
this._accept.setAttribute("disabled", "");
this._accept.textContent = "Create organzation";
this._footer.appendChild(this._accept);

// Indicates whether project was created.
this._confirm = false;

const cancel = document.createElement("button");
cancel.setAttribute("class", "btn btn-clear btn-charcoal");
cancel.textContent = "Cancel";
this._footer.appendChild(cancel);

cancel.addEventListener("click", this._closeCallback);

this._accept.addEventListener("click", evt => {
this._confirm = true;
this._closeCallback();
});

this._name.addEventListener("input", this._validateName.bind(this));
}

set organizations(organizations) {
// let choices = [];
// for (const organization of organizations) {
// choices.push({
// label: organization.name,
// value: organization.id,
// });
// }
// this._organization.choices = choices;
this._existingNames = organizations.map(organization => organization.name.toLowerCase());
}

// set projects(projects) {
// this._existingNames = projects.map(project => project.name.toLowerCase());
// }

static get observedAttributes() {
return ModalDialog.observedAttributes;
}

attributeChangedCallback(name, oldValue, newValue) {
ModalDialog.prototype.attributeChangedCallback.call(this, name, oldValue, newValue);
switch (name) {
case "is-open":
break;
}
}

init() {
this._name.setValue("");
this._confirm = false;
}

removeProject(projectName) {
// Removes project from existing names.
const index = this._existingNames.indexOf(projectName.toLowerCase());
if (index > -1) {
this._existingNames.splice(index, 1);
}
}

getOrganizationSpec() {
return {
name: this._name.getValue(),
// summary: this._summary.getValue(),
// organization: Number(this._organization.getValue()),
};
}

// getOrganizationPreset() {
// return this._preset.getValue();
// }

_validateName() {
let valid = true;
const name = this._name.getValue();
this._nameWarning.style.display = "none";
if (name.length == 0) {
valid = false;
} else {
if (this._existingNames.includes(name.toLowerCase())) {
valid = false;
this._nameWarning.style.display = "block";
}
}
if (valid) {
this._accept.removeAttribute("disabled");
} else {
this._accept.setAttribute("disabled", "");
}
}
}

customElements.define("new-organization-dialog", NewOrganizationDialog);

Loading

0 comments on commit e77916e

Please sign in to comment.