Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gqlmerge #459

Merged
merged 65 commits into from
Oct 15, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
65 commits
Select commit Hold shift + click to select a range
3ae8bd6
Merge pull request #416 from mintproject/dev
hvarg Aug 5, 2020
c4ecfdd
Fixed duplicated variable
hvarg Aug 5, 2020
8d02ff4
Google Analitics and UI changes (#420)
hvarg Aug 6, 2020
b46912b
Hotfix: typo and size of video
hvarg Aug 6, 2020
8fb92b4
Merge pull request #421 from hvarg/master
hvarg Aug 6, 2020
de969c5
Hotfix: typo
hvarg Aug 6, 2020
2807ff7
Hotfix: Do no show setups for main regions
hvarg Aug 7, 2020
5a46515
Merge pull request #422 from hvarg/master
hvarg Aug 7, 2020
fdf6971
Updating emulators page (#429)
hvarg Aug 17, 2020
5d57b27
Emulators update (#430)
hvarg Aug 17, 2020
3cf28dd
Changes for graphql
IKCAP Aug 22, 2020
cf0cbbf
Added emulator-tabs using graphql
IKCAP Aug 22, 2020
566e330
Added emulator-tabs using graphql
IKCAP Aug 22, 2020
20c46c4
Adding initial support for GraphQL : Emulators
IKCAP Aug 23, 2020
c0e7ad1
Merge branch 'master' of https://github.com/mintproject/mint-ui-lit i…
hvarg Aug 26, 2020
a2c1f19
yarn.lock
hvarg Aug 26, 2020
a635d0d
Diferent config file and example
hvarg Aug 27, 2020
523c136
removing old code
hvarg Aug 27, 2020
83e581e
Updated npm -> yarn and changes on the config file
hvarg Aug 27, 2020
212a8e9
build-dev
hvarg Aug 27, 2020
7d6a1be
Merge pull request #436 from hvarg/enviroments
hvarg Aug 27, 2020
3f1c0e8
GraphQL conversion continued + Refactoring
IKCAP Aug 29, 2020
f911a19
Bug fixes and initial region integration
IKCAP Aug 30, 2020
b40095e
Get region browsing to work. Add/Delete TODO
IKCAP Aug 30, 2020
dbdd75c
Refactoring task/thread editors out of problem-statement ui
IKCAP Aug 30, 2020
d9af0ae
deletion query fix
IKCAP Aug 30, 2020
1848c55
Improvements to adding thread/task + New table for execution summary
IKCAP Aug 31, 2020
4027116
Work with new GraphQL schema
IKCAP Sep 3, 2020
ff471ce
Changes for Backward compatibility
IKCAP Sep 8, 2020
0ab28f7
Style fixes
IKCAP Sep 9, 2020
5fa87a5
Refactoring Dataset to Dataslice + Dataset
IKCAP Sep 9, 2020
c5cc59d
Env2 (#439)
hvarg Sep 9, 2020
6882b48
Env fix (#440)
hvarg Sep 9, 2020
a3e01dc
Webpack build script
hvarg Sep 9, 2020
7fb07d9
travis node
hvarg Sep 9, 2020
4ce52ef
Fix: build location
hvarg Sep 10, 2020
398ebc1
Fix: change build directory name
hvarg Sep 10, 2020
760e2b4
Added different keys
hvarg Sep 10, 2020
9f090a4
added code url + added Hernan to contributors
IKCAP Sep 10, 2020
092112c
Updates for changes to backend
IKCAP Sep 12, 2020
2aee845
Merge
IKCAP Sep 13, 2020
7a842c4
Merge branch 'enviroments' into apollo-gql
IKCAP Sep 13, 2020
e71340e
Bugfixes with emulator
IKCAP Sep 13, 2020
22276ef
Fix for event-based task status
IKCAP Sep 13, 2020
0ad73c0
DEV AUTH DOMAIN
hvarg Sep 14, 2020
ea95a7b
Pass variable through webpack
hvarg Sep 14, 2020
562cb3d
Update README.md
hvarg Sep 14, 2020
5320464
Deleting old stuff
hvarg Sep 14, 2020
9f645c9
Merge branch 'enviroments' of github.com:mintproject/mint-ui-lit into…
hvarg Sep 14, 2020
b1073da
Fix for model query for region
IKCAP Sep 15, 2020
735e7b7
Merge pull request #442 from mintproject/enviroments
mosoriob Sep 15, 2020
7538dca
fix: add yarn.lock
mosoriob Sep 15, 2020
dbfc7b0
Initial: Adding permissions + minor updates
IKCAP Sep 24, 2020
710ac22
Merge branch 'apollo-gql' of https://github.com/mintproject/mint-ui-l…
IKCAP Sep 24, 2020
80a1c2c
Check Permissions within the thread
IKCAP Sep 24, 2020
c6f1aca
Initial permissions + Some fixes for ensemble manager interface
IKCAP Sep 27, 2020
45470b9
Efficient Loading of executions in threads
IKCAP Sep 29, 2020
37b4450
bugfix
IKCAP Sep 29, 2020
661fb63
Bugfixes
IKCAP Oct 1, 2020
4d5f9b4
Simple permissions UI
IKCAP Oct 3, 2020
79ba54c
Bugfix
IKCAP Oct 3, 2020
9f9488c
Emulator Search Draft
IKCAP Oct 8, 2020
20ce0b0
Load executions as well as total in emulator search
IKCAP Oct 9, 2020
022376c
Next/Previous for runs in emulator page
IKCAP Oct 10, 2020
13743bb
Merge branch 'apollo-gql' of github.com:mintproject/mint-ui-lit into …
hvarg Oct 15, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
74 changes: 74 additions & 0 deletions src/components/permissions-editor.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
import { customElement, LitElement, property, html, css } from "lit-element";
import { SharedStyles } from '../styles/shared-styles';

import "weightless/icon";
import { MintPermission } from "screens/modeling/reducers";
import { getAllUsersPermission } from "util/permission_utils";

@customElement('permissions-editor')
export class PermissionsEditor extends LitElement {
@property({type: Object})
public permissions: MintPermission[];

@property({type: Object})
private _permission: MintPermission;

static get styles() {
return [SharedStyles, css`
fieldset {
margin: 10px 0px;
padding: 5px 10px;
border: 1px solid #D9D9D9;
border-radius: 5px;
}
fieldset legend {
font-size: 10px;
}
`];
}

private _changedPublicPermission(e) {
this._permission.read = !this._permission.read;
if(!this._permission.read)
this._permission.write = false;
this.requestUpdate();
}

private _changedWritePermission(e) {
this._permission.write = !this._permission.write;
this.requestUpdate();
}

public setPermissions(permissions: MintPermission[]) {
this._permission = Object.assign({}, getAllUsersPermission(permissions ?? []));
this.permissions = [this._permission];
this.requestUpdate();
}

protected render() {
if(!this._permission) {
return html``;
}
console.log(this._permission);
return html`
<div class="input_full">
<label>Sharing</label>
</div>
<div class="formRow" style="justify-content: start">
<div style="width: 200px">
<input type="checkbox" name="public" id="public"
@click="${this._changedPublicPermission}"
.checked="${this._permission.read}">
<label for="public">Publicly Visible</label>
</div>
<div style="width: 200px">
<input type="checkbox" name="writable" id="writable"
.disabled="${!this._permission.read}"
@click="${this._changedWritePermission}"
.checked="${this._permission.read && this._permission.write}">
<label for="writable">Publicly Writable</label>
</div>
</div>
`;
}
}
14 changes: 12 additions & 2 deletions src/components/task-editor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ import { IdMap } from "app/reducers";
import { getCategorizedRegions } from "util/state_functions";
import { goToPage } from "app/actions";

import "./permissions-editor";
import { PermissionsEditor } from "./permissions-editor";

@customElement('task-editor')
export class TaskEditor extends connect(store)(LitElement) {
@property({type: Object})
Expand Down Expand Up @@ -112,6 +115,7 @@ export class TaskEditor extends connect(store)(LitElement) {
<div slot="content">
<form id="taskForm">
${this._renderTaskForm()}
<permissions-editor id="task_permissions"></permissions-editor>
</form>
</div>
<div slot="footer">
Expand Down Expand Up @@ -220,6 +224,7 @@ export class TaskEditor extends connect(store)(LitElement) {
(form.elements["task_region"] as HTMLSelectElement).value = ""; //this.problem_statement.regionid!;
(form.elements["task_from"] as HTMLInputElement).value = toDateString(dates?.start_date);
(form.elements["task_to"] as HTMLInputElement).value = toDateString(dates?.end_date);
(form.querySelector("#task_permissions") as PermissionsEditor).setPermissions([]);

this._selectedIntervention = null;
}
Expand Down Expand Up @@ -247,6 +252,7 @@ export class TaskEditor extends connect(store)(LitElement) {
(form.elements["task_to"] as HTMLInputElement).value = toDateString(dates.end_date);
(form.elements["response_variable"] as HTMLInputElement).value = response_variable;
(form.elements["driving_variable"] as HTMLInputElement).value = driving_variable;
(form.querySelector("#task_permissions") as PermissionsEditor).setPermissions(task.permissions);

this._selectedIntervention = getVariableIntervention(driving_variable);
}
Expand Down Expand Up @@ -291,6 +297,7 @@ export class TaskEditor extends connect(store)(LitElement) {
let task_region = (form.elements["task_region"] as HTMLInputElement).value;
if(!task_region)
task_region = this._regionid;
let task_permissions = (form.querySelector("#task_permissions") as PermissionsEditor).permissions;

showNotification("saveNotification", this.shadowRoot!);
// If no taskid then this is a new task
Expand All @@ -309,6 +316,7 @@ export class TaskEditor extends connect(store)(LitElement) {
this.task.driving_variables = driving_variable ? [driving_variable] : [],
this.task.response_variables = response_variable ? [response_variable] : [],
this.task.events.push(getUpdateEvent(task_name) as TaskEvent);
this.task.permissions = task_permissions;
// End of Temporary Addition

// Update the task
Expand Down Expand Up @@ -340,7 +348,8 @@ export class TaskEditor extends connect(store)(LitElement) {
end_date: new Date(task_to)
},
threads: {},
events: [getCreateEvent(task_name) as TaskEvent]
events: [getCreateEvent(task_name) as TaskEvent],
permissions: task_permissions
} as Task;

// Create a default thread for this task
Expand All @@ -355,7 +364,8 @@ export class TaskEditor extends connect(store)(LitElement) {
data: {},
model_ensembles: {},
execution_summary: {},
events: [getCreateEvent("Default Thread Created") as ThreadEvent]
events: [getCreateEvent("Default Thread Created") as ThreadEvent],
permissions: task_permissions
} as Thread

// Create the Task along with default thread
Expand Down
17 changes: 13 additions & 4 deletions src/components/thread-editor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ import { getUpdateEvent, getCreateEvent } from "util/graphql_adapter";
import { updateThreadInformation, addThread } from "screens/modeling/actions";
import { toDateString } from "util/date-utils";
import { getLatestEventOfType } from "util/event_utils";
import { PermissionsEditor } from "./permissions-editor";

import "./permissions-editor";

@customElement('thread-editor')
export class ThreadEditor extends LitElement {
Expand Down Expand Up @@ -116,6 +119,7 @@ export class ThreadEditor extends LitElement {
</div>
</div>
<br />
<permissions-editor id="thread_permissions"></permissions-editor>
</form>
</div>
<div slot="footer">
Expand All @@ -128,12 +132,13 @@ export class ThreadEditor extends LitElement {

_onEditThreadSubmit() {
let form:HTMLFormElement = this.shadowRoot!.querySelector<HTMLFormElement>("#threadForm")!;
if(formElementsComplete(form, ["thread_name"])) {
//if(formElementsComplete(form, ["thread_name"])) {
let threadid = (form.elements["threadid"] as HTMLInputElement).value;
let thread_name = (form.elements["thread_name"] as HTMLInputElement).value;
let thread_from = (form.elements["thread_from"] as HTMLInputElement).value;
let thread_to = (form.elements["thread_to"] as HTMLInputElement).value;
let thread_notes = (form.elements["thread_notes"] as HTMLInputElement).value;
let thread_permissions = (form.querySelector("#thread_permissions") as PermissionsEditor).permissions;

showNotification("saveNotification", this.shadowRoot!);

Expand All @@ -147,6 +152,7 @@ export class ThreadEditor extends LitElement {
end_date: new Date(thread_to)
};
thread.events = [getUpdateEvent(thread_notes) as ThreadEvent];
thread.permissions = thread_permissions;
updateThreadInformation(thread);
}
else {
Expand All @@ -164,16 +170,17 @@ export class ThreadEditor extends LitElement {
datasets: {},
model_ensembles: {},
execution_summary: {},
events: [getCreateEvent(thread_notes)]
events: [getCreateEvent(thread_notes)],
permissions: thread_permissions
} as ThreadInfo;

addThread(this.task, thread);
}
hideDialog("threadDialog", this.shadowRoot!);
}
/*}
else {
showNotification("formValuesIncompleteNotification", this.shadowRoot!);
}
}*/
}

_onEditThreadCancel() {
Expand All @@ -198,6 +205,7 @@ export class ThreadEditor extends LitElement {
(form.elements["thread_from"] as HTMLInputElement).value = toDateString(dates.start_date);
(form.elements["thread_to"] as HTMLInputElement).value = toDateString(dates.end_date);
(form.elements["thread_notes"] as HTMLInputElement).value = "";
(form.querySelector("#thread_permissions") as PermissionsEditor).setPermissions([]);
}

setThread(thread: ThreadInfo) {
Expand All @@ -214,6 +222,7 @@ export class ThreadEditor extends LitElement {
(form.elements["thread_from"] as HTMLInputElement).value = toDateString(dates.start_date);
(form.elements["thread_to"] as HTMLInputElement).value = toDateString(dates.end_date);
(form.elements["thread_notes"] as HTMLInputElement).value = notes;
(form.querySelector("#thread_permissions") as PermissionsEditor).setPermissions(thread.permissions);
}
}
}
10 changes: 10 additions & 0 deletions src/queries/emulator/get-model-config-inputs.graphql
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
query model_inputs_for_model_config($regionId: String!, $modelConfiguration: String!) {
model_parameter(distinct_on: name, where: {model: {model_configuration: {_eq: $modelConfiguration}, thread_models: {thread: {_or: [{region_id: {_eq: $regionId}}, {region: {parent_region_id: {_eq: $regionId}}}]}}}}) {
name
datatype
}
model_io(distinct_on: name, where: {model_inputs: {model: {model_configuration: {_eq: $modelConfiguration}, thread_models: {thread: {_or: [{region_id: {_eq: $regionId}}, {region: {parent_region_id: {_eq: $regionId}}}]}}}}}) {
name
type
}
}
25 changes: 25 additions & 0 deletions src/queries/emulator/get-model-input-values.graphql
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
query model_inputs_for_model($regionId: String!, $inputName: String!, $modelType: String!) {
model_io(where: {name: {_eq: $inputName}, model_inputs: {model: {model_name: {_eq: $modelType}, thread_models: {thread: {_or: [{region_id: {_eq: $regionId}}, {region: {parent_region_id: {_eq: $regionId}}}]}}}}}) {
fixed_bindings {
resource {
id
name
url
}
}
execution_data_bindings(
where: {
execution: {
status: {_eq: "SUCCESS"}
model: {model_name: {_eq: $modelType}, thread_models: {thread: {_or: [{region_id: {_eq: $regionId}}, {region: {parent_region_id: {_eq: $regionId}}}]}}}
}
}
distinct_on: resource_id) {
resource {
id
name
url
}
}
}
}
16 changes: 16 additions & 0 deletions src/queries/emulator/get-model-parameter-values.graphql
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
query model_parameters_for_model($regionId: String!, $inputName: String!, $modelType: String!) {
model_parameter(where: {name: {_eq: $inputName}, model: {model_name: {_eq: $modelType}, thread_models: {thread: {_or: [{region_id: {_eq: $regionId}}, {region: {parent_region_id: {_eq: $regionId}}}]}}}}) {
datatype
fixed_value
execution_parameter_bindings(
where: {
execution: {
status: {_eq: "SUCCESS"}
model: {model_name: {_eq: $modelType}, thread_models: {thread: {_or: [{region_id: {_eq: $regionId}}, {region: {parent_region_id: {_eq: $regionId}}}]}}}
}
},
distinct_on: parameter_value) {
parameter_value
}
}
}
7 changes: 7 additions & 0 deletions src/queries/emulator/get-model-type-configs.graphql
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
query model_configurations_for_model($regionId: String!, $modelType: String!) {
model(distinct_on:model_configuration where: {model_name: {_eq: $modelType}, thread_models: {thread: {_or: [{region_id: {_eq: $regionId}}, {region: {parent_region_id: {_eq: $regionId}}}]}}}) {
name
description
model_configuration
}
}
14 changes: 14 additions & 0 deletions src/queries/emulator/get-model-type-io.graphql
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
query model_inputs_for_model($regionId: String!, $modelType: String!) {
model_parameter(distinct_on: name, where: {model: {model_name: {_eq: $modelType}, thread_models: {thread: {_or: [{region_id: {_eq: $regionId}}, {region: {parent_region_id: {_eq: $regionId}}}]}}}}) {
name
datatype
}
model_inputs: model_io(distinct_on: name, where: {model_inputs: {model: {model_name: {_eq: $modelType}, thread_models: {thread: {_or: [{region_id: {_eq: $regionId}}, {region: {parent_region_id: {_eq: $regionId}}}]}}}}}) {
name
type
}
model_outputs: model_io(distinct_on: name, where: {model_outputs: {model: {model_name: {_eq: $modelType}, thread_models: {thread: {_or: [{region_id: {_eq: $regionId}}, {region: {parent_region_id: {_eq: $regionId}}}]}}}}}) {
name
type
}
}
2 changes: 1 addition & 1 deletion src/queries/emulator/model-executions.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ query model_executions($modelTypes: [String!], $regionId: String!) {
parameter_value
}
}
executions_aggregate {
executions_aggregate(where: {execution: {status: {_eq: "SUCCESS"}}}) {
aggregate {
count
}
Expand Down
18 changes: 18 additions & 0 deletions src/queries/execution/executions-for-thread-model.graphql
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#import "../fragments/execution-info.graphql"

query executions_for_thread_model(
$threadModelId: uuid!,
$start: Int!,
$limit: Int!,
$orderBy: [execution_order_by!]) {
execution (
offset:$start, limit:$limit, order_by:$orderBy,
where: {
thread_model_executions: {
thread_model_id:{_eq: $threadModelId}
}
}
) {
...execution_info
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#import "../fragments/execution-summary-info.graphql"

subscription execution_summary(
$threadModelId: uuid!) {
thread_model_execution_summary (
where: {
thread_model_id:{_eq: $threadModelId}
}
) {
...execution_summary_info
}
}
36 changes: 36 additions & 0 deletions src/queries/fragments/emulator-execution-info.graphql
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
fragment emulator_execution_info on execution {
id
start_time
end_time
status
run_progress
run_id
execution_engine
model_id
parameter_bindings {
model_parameter {
name
}
parameter_value
}
data_bindings {
model_io {
name
}
resource {
id
name
url
}
}
results {
model_output {
name
}
resource {
id
name
url
}
}
}
10 changes: 10 additions & 0 deletions src/queries/fragments/execution-status-info.graphql
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
fragment execution_info on execution {
id
start_time
end_time
status
run_progress
run_id
execution_engine
model_id
}
Loading