Skip to content

Commit

Permalink
Merge pull request #280 from projectcaluma/packages-upgrade
Browse files Browse the repository at this point in the history
upgrade to latest caluma ecosystem
  • Loading branch information
MitanOmar authored Sep 5, 2023
2 parents 4188108 + bfaccae commit 2996ec1
Show file tree
Hide file tree
Showing 40 changed files with 6,330 additions and 5,989 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/test-ember.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: 14
node-version: 18

- name: Install Dependencies
run: yarn install
Expand All @@ -44,7 +44,7 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: 14
node-version: 18

- name: Install dependencies (no lockfile)
run: yarn install --no-lockfile
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/.vscode/
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"nuxt.isNuxtApp": false
}
6 changes: 3 additions & 3 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ services:
- dbdata:/var/lib/postgresql/data

emeis:
image: ghcr.io/projectcaluma/emeis:1.0.5
image: ghcr.io/projectcaluma/emeis:1.2.2
depends_on:
- db
environment:
Expand All @@ -37,7 +37,7 @@ services:
- PERMISSION_CLASSES=

alexandria:
image: projectcaluma/alexandria:version-0.2.1
image: ghcr.io/projectcaluma/alexandria:2.2.0
volumes:
- "./config/alexandria/initial_data.json:/app/initial_data.json"
depends_on:
Expand Down Expand Up @@ -85,7 +85,7 @@ services:
- minio

caluma:
image: ghcr.io/projectcaluma/caluma:7.15.2
image: ghcr.io/projectcaluma/caluma:9.3.0
depends_on:
- db
environment:
Expand Down
7 changes: 6 additions & 1 deletion ember/.ember-cli
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,10 @@
Setting `disableAnalytics` to true will prevent any data from being sent.
*/
"disableAnalytics": false,
"usePods": true

/**
Setting `isTypeScriptProject` to true will force the blueprint generators to generate TypeScript
rather than JavaScript by default, when a TypeScript version of a given blueprint is available.
*/
"isTypeScriptProject": false
}
3 changes: 3 additions & 0 deletions ember/.eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,7 @@
# ember-try
/.node_modules.ember-try/
/bower.json.ember-try
/npm-shrinkwrap.json.ember-try
/package.json.ember-try
/package-lock.json.ember-try
/yarn.lock.ember-try
2 changes: 1 addition & 1 deletion ember/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"use strict";

module.exports = {
extends: ["@adfinis-sygroup/eslint-config/ember-app"],
extends: "@adfinis/eslint-config/ember-app",
};
7 changes: 7 additions & 0 deletions ember/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,11 @@
# ember-try
/.node_modules.ember-try/
/bower.json.ember-try
/npm-shrinkwrap.json.ember-try
/package.json.ember-try
/package-lock.json.ember-try
/yarn.lock.ember-try

# broccoli-debug
/DEBUG/
/ember-emeis/
25 changes: 25 additions & 0 deletions ember/.prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# unconventional js
/blueprints/*/files/
/vendor/

# compiled output
/dist/
/tmp/

# dependencies
/bower_components/
/node_modules/

# misc
/coverage/
!.*
.eslintcache
.lint-todo/

# ember-try
/.node_modules.ember-try/
/bower.json.ember-try
/npm-shrinkwrap.json.ember-try
/package.json.ember-try
/package-lock.json.ember-try
/yarn.lock.ember-try
12 changes: 12 additions & 0 deletions ember/.prettierrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
"use strict";

module.exports = {
overrides: [
{
files: "*.{js,ts}",
options: {
singleQuote: false,
},
},
],
};
8 changes: 8 additions & 0 deletions ember/.stylelintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# unconventional files
/blueprints/*/files/

# compiled output
/dist/

# addons
/.node_modules.ember-try/
5 changes: 5 additions & 0 deletions ember/.stylelintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
"use strict";

module.exports = {
extends: ["stylelint-config-standard-scss", "stylelint-prettier/recommended"],
};
5 changes: 4 additions & 1 deletion ember/.template-lintrc.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
"use strict";

module.exports = {
extends: "octane",
extends: "recommended",
rules: {
"no-invalid-link-text": false,
},
};
4 changes: 3 additions & 1 deletion ember/app/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,16 @@ export default class App extends Application {
"intl",
"notification",
"router",
{ "host-router": "router" },
"emeis-options",
],
},
},
emberAlexandria: {
"ember-alexandria": {
dependencies: {
services: [
{ store: "alexandria-store" },
"session",
"intl",
"notification",
"router",
Expand Down
7 changes: 2 additions & 5 deletions ember/app/cases/detail/controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,8 @@ import Controller from "@ember/controller";
import getCaseQuery from "caluma-portal-demo/gql/queries/get-case";
import { queryManager } from "ember-apollo-client";
import { task, lastValue } from "ember-concurrency";
import QueryParams from "ember-parachute";

export default class CasesDetailController extends Controller.extend(
new QueryParams().Mixin
) {
export default class CasesDetailController extends Controller {
@queryManager apollo;

setup() {
Expand All @@ -27,7 +24,7 @@ export default class CasesDetailController extends Controller.extend(
query: getCaseQuery,
variables: { caseId: this.model },
},
"allCases.edges"
"allCases.edges",
);
return caseNode.map(({ node }) => node)[0];
}
Expand Down
2 changes: 1 addition & 1 deletion ember/app/cases/detail/index/route.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export default class CasesDetailRoute extends Route {
query: getCaseQuery,
variables: { caseId: model },
},
"allCases.edges"
"allCases.edges",
);
return caseRecord.map(({ node }) => node)[0];
}
Expand Down
6 changes: 6 additions & 0 deletions ember/app/cases/index/route.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
import Route from "@ember/routing/route";

export default class CasesRoute extends Route {
queryParams = {
order: {
refreshModel: true,
replace: true,
},
};
model() {
return [
{
Expand Down
33 changes: 6 additions & 27 deletions ember/app/cases/new/controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,48 +7,27 @@ import getRootFormsQuery from "caluma-portal-demo/gql/queries/get-root-forms";
import getWorkflowQuery from "caluma-portal-demo/gql/queries/get-workflow";
import { queryManager } from "ember-apollo-client";
import { task, lastValue } from "ember-concurrency";
import QueryParams from "ember-parachute";

const queryParams = new QueryParams({
selectedForm: {
defaultValue: "",
replace: true,
},
});

export default class CaseNewController extends Controller.extend(
queryParams.Mixin
) {
export default class CaseNewController extends Controller {
queryParams = ["selectedForm"];
@queryManager apollo;
@service router;
@tracked selectedForm;

setup() {
this.fetchForms.perform();
}

reset() {
this.resetQueryParams();
this.selectedForm = null;

this.fetchForms.cancelAll({ reset: true });
this.createCase.cancelAll({ reset: true });
}
@tracked selectedForm = "";

@lastValue("fetchForms") forms;
@task
*fetchForms() {
return (yield this.apollo.query(
{ query: getRootFormsQuery, fetchPolicy: "network-only" },
"allForms.edges"
"allForms.edges",
)).map(({ node }) => node);
}

@task
*createCase() {
const workflow = (yield this.apollo.query(
{ query: getWorkflowQuery },
"allWorkflows.edges"
"allWorkflows.edges",
)).map(({ node }) => node)[0];

const newCase = yield this.apollo.mutate({
Expand All @@ -57,7 +36,7 @@ export default class CaseNewController extends Controller.extend(
});
this.router.transitionTo(
"cases.detail.index",
decodeId(newCase.saveCase.case.id)
decodeId(newCase.saveCase.case.id),
);
}
}
12 changes: 11 additions & 1 deletion ember/app/cases/new/route.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
import Route from "@ember/routing/route";

export default class CasesNewRoute extends Route {}
export default class CasesNewRoute extends Route {
setupController(controller) {
controller.fetchForms.perform();
}

resetController(controller) {
controller.selectedForm = "";
controller.fetchForms.cancelAll({ reset: true });
controller.createCase.cancelAll({ reset: true });
}
}
15 changes: 7 additions & 8 deletions ember/app/components/cases-table/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ export default class CasesTableComponent extends Component {

@tracked cases = [];
@tracked types = [];
@tracked order;

get pageInfo() {
return this.fetchCases.lastSuccessful?.value.pageInfo;
Expand All @@ -28,11 +27,6 @@ export default class CasesTableComponent extends Component {
);
}

constructor(...args) {
super(...args);
this.order = this.args.order || ENV.APP.casesTable.defaultOrder;
}

@action
setup() {
this.cases = [];
Expand All @@ -41,18 +35,23 @@ export default class CasesTableComponent extends Component {

@restartableTask
*fetchCases(cursor = null) {
const order = (this.args.order || ENV.APP.casesTable.defaultOrder).split(
"_",
);
const direction = order.pop().toUpperCase();
const attribute = order.join("_").toUpperCase();
try {
const raw = yield this.apollo.query(
{
query: getCasesQuery,
variables: {
cursor,
orderBy: this.order,
order: [{ attribute, direction }],
},

fetchPolicy: "network-only",
},
"allCases"
"allCases",
);
const cases = raw.edges.map(({ node }) => node);

Expand Down
2 changes: 1 addition & 1 deletion ember/app/components/dynamic-table/table-data/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export default class DynamicTableTableDataComponent extends Component {
get linkToModel() {
return get(
this.args.value,
this.args.tdDefinition.linkToModelField || "id"
this.args.tdDefinition.linkToModelField || "id",
);
}
}
4 changes: 2 additions & 2 deletions ember/app/gql/queries/get-cases.graphql
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
query GetCases($cursor: String, $forms: [String], $orderBy: [CaseOrdering]!) {
query GetCases($cursor: String, $forms: [String], $order: [CaseOrderSetType]!) {
allCases(
first: 15
after: $cursor
orderBy: $orderBy
order: $order
filter: [{ documentForms: $forms }]
) {
pageInfo {
Expand Down
4 changes: 2 additions & 2 deletions ember/app/gql/queries/get-root-forms.graphql
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
query GetRootForms($slug: String) {
allForms(orderBy: NAME_ASC, slug: $slug) {
query GetRootForms {
allForms(order: []) {
edges {
node {
slug
Expand Down
4 changes: 2 additions & 2 deletions ember/app/gql/queries/get-workflow.graphql
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
query($slug: String) {
allWorkflows(slug: $slug) {
query {
allWorkflows {
edges {
node {
id
Expand Down
9 changes: 4 additions & 5 deletions ember/app/index.html
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<title>EmberCalumaBuildingPermitDemo</title>
<meta name="description" content="" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta charset="utf-8">
<title>CalumaPortalDemo</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">

{{content-for "head"}}

Expand Down
1 change: 1 addition & 0 deletions ember/app/services/alexandria-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ import Service from "@ember/service";
export default class AlexandriaConfigService extends Service {
modelMetaFilters = {};
defaultModelMeta = {};
namespace = "/alexandria/api/v1";
}
Loading

0 comments on commit 2996ec1

Please sign in to comment.