Skip to content

Commit

Permalink
Merge pull request #789 from puzzle/feature/768-update-frontend-depen…
Browse files Browse the repository at this point in the history
…dencies

Update Frontend
  • Loading branch information
mtnstar authored Jun 26, 2024
2 parents 95aff12 + bef38a4 commit 5de3ea6
Show file tree
Hide file tree
Showing 37 changed files with 4,047 additions and 3,532 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ jobs:
- name: Use Node.js
uses: actions/setup-node@v1
with:
node-version: '18.17.0'
node-version: '20.14.0'

# Npm global packages caching
- name: Cache global npm modules
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
5.3.5
5.4
26 changes: 26 additions & 0 deletions bin/watch-assets.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/bin/bash

filename="frontend/dist/assets/frontend.js"

watchFile() {
local filename="$1"
local m1=$(md5sum "$filename")

while true; do
sleep 10
local m2=$(md5sum "$filename")
echo ""
echo "$m1"
echo "$m2"
if [ "$m1" != "$m2" ] ; then
m1=$m2
rm -f public/frontend-index-test.html
cp -rf frontend/dist/* public/
cp public/{index,frontend-index-test}.html
cp public/{index,frontend-index-development}.html
echo "Refreshed frontend"
fi
done
}

watchFile "$filename"
2 changes: 1 addition & 1 deletion config/docker/development/Ember.dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM danlynn/ember-cli:5.2.1-node_18.17
FROM danlynn/ember-cli:5.9.0

RUN chown 1000:1000 /myapp

Expand Down
36 changes: 18 additions & 18 deletions db/migrate/002_group_and_team_changes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ def up
rename_column :teams, :groupname, :name
add_column :teams, :visible, :boolean, default: true, null: false
add_column :teams, :private, :boolean, default: false, null: false
Team.find_each do |team|
teammember = Teammember.first(conditions: ["user_id = ? and team_id = ?", team.user_id, team.id])
teammember.team_admin = true
teammember.save
end
#Team.find_each do |team|
#teammember = Teammember.first(conditions: ["user_id = ? and team_id = ?", team.user_id, team.id])
#teammember.team_admin = true
#teammember.save
#end
remove_column :teams, :user_id

# Add the new admin flag to the users table
Expand All @@ -33,19 +33,19 @@ def up
end

# create a default group for every team with accounts
Team.find_each do |team|
group = Group.new()
group.name = "Default"
group.description = "Default group, created for migration"
group.team_id = team.id
group.save
#Team.find_each do |team|
#group = Group.new()
#group.name = "Default"
#group.description = "Default group, created for migration"
#group.team_id = team.id
#group.save

# Accounts are now linked to their groups and not directly to the team
Account.where("group_id = ?", team.id).find_each do |account|
account.group_id = group.id
account.save
end
end
## Accounts are now linked to their groups and not directly to the team
#Account.where("group_id = ?", team.id).find_each do |account|
#account.group_id = group.id
#account.save
#end
#end

end

Expand Down Expand Up @@ -81,4 +81,4 @@ def down
remove_column :grouppasswords, :team_admin

end
end
end
10 changes: 5 additions & 5 deletions db/migrate/004_add_no_root_flag_to_teams.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ class AddNoRootFlagToTeams < ActiveRecord::Migration[4.2]
def change
add_column :teams, :noroot, :boolean, default: 0, null: false

Team.reset_column_information
Team.find_each do |team|
team.noroot = false
team.save
end
#Team.reset_column_information
#Team.find_each do |team|
#team.noroot = false
#team.save
#end
end
end
12 changes: 6 additions & 6 deletions db/migrate/20190604054153_sqlite_boolean_values.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ class SqliteBooleanValues < ActiveRecord::Migration[5.2]
def up
return unless sqlite?

User.where("locked = 't'").update_all(locked: 1)
User.where("locked = 'f'").update_all(locked: 0)
#User.where("locked = 't'").update_all(locked: 1)
#User.where("locked = 'f'").update_all(locked: 0)

Team.where("visible = 't'").update_all(visible: 1)
Team.where("visible = 'f'").update_all(visible: 0)
#Team.where("visible = 't'").update_all(visible: 1)
#Team.where("visible = 'f'").update_all(visible: 0)

Team.where("private = 't'").update_all(private: 1)
Team.where("private = 'f'").update_all(private: 0)
#Team.where("private = 't'").update_all(private: 1)
#Team.where("private = 'f'").update_all(private: 0)
end

private
Expand Down
4 changes: 2 additions & 2 deletions db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
#
# It's strongly recommended that you check this file into your version control system.

ActiveRecord::Schema[7.0].define(version: 2022_07_19_120958) do
ActiveRecord::Schema[7.1].define(version: 2022_07_19_120958) do
create_table "encryptables", force: :cascade do |t|
t.string "name", limit: 255, default: "", null: false
t.string "name", limit: 255
t.integer "folder_id"
t.text "description"
t.datetime "created_at", precision: nil, null: false
Expand Down
8 changes: 3 additions & 5 deletions frontend/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
module.exports = {
root: true,
parser: "babel-eslint",
parser: "@babel/eslint-parser",
parserOptions: {
ecmaVersion: 2018,
ecmaVersion: 2023,
sourceType: "module",
ecmaFeatures: {
legacyDecorators: true
}
requireConfigFile: false
},
plugins: ["ember"],
extends: [
Expand Down
54 changes: 54 additions & 0 deletions frontend/.npmcheckrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
{
"depcheck": {
"ignoreMatches": [
"frontend",
"tracked-built-ins",
"sass",
"loader.js",

"eslint-plugin-ember",
"eslint-plugin-prettier",
"eslint-plugin-ember",

"@ember/optional-features",
"webpack",
"bootstrap",
"text-security",
"minimist",
"@babel/runtime",

"@ember/application",
"@ember/service",
"@ember/utils",
"@ember/routing",
"@ember/array",
"@ember/object",
"@ember/component",
"@ember/controller",

"ember-toggle",
"ember-moment",
"ember-in-viewport",
"ember-file-upload",
"ember-fetch",
"ember-cli-terser",
"ember-basic-dropdown",
"ember-cli-sass",
"ember-cli-app-version",
"ember-auto-import",
"ember-cli-app-version",
"ember-auto-import",
"ember-power-select-with-create",
"ember-cli-string-helpers",
"ember-cli-moment-shim",
"ember-cli-inject-live-reload",
"ember-bootstrap-power-select",
"ember-cli-babel",

"@ember-data/serializer",
"@ember-data/model",
"@ember-data/adapter",
"ember-inflector"
]
}
}
15 changes: 6 additions & 9 deletions frontend/app/adapters/application.js
Original file line number Diff line number Diff line change
@@ -1,22 +1,19 @@
import JSONAPIAdapter from "@ember-data/adapter/json-api";
import { computed } from "@ember/object";
import { pluralize } from "ember-inflector";
import { underscore } from "@ember/string";
import ENV from "../config/environment";

export default JSONAPIAdapter.extend({
namespace: "api",
export default class ApplicationAdapter extends JSONAPIAdapter {
namespace = "api";

pathForType(type) {
return pluralize(underscore(type));
},
}

headers: computed(function () {
/* eslint-disable no-undef */
get headers() {
return {
"X-CSRF-Token": ENV.CSRFToken,
"content-type": "application/json"
};
/* eslint-enable no-undef */
})
});
}
}
4 changes: 2 additions & 2 deletions frontend/app/adapters/encryptable-credential.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import ApplicationAdapter from "./application";

export default ApplicationAdapter.extend({
export default class EncryptableCredentialAdapter extends ApplicationAdapter{
pathForType() {
return "encryptables";
}
});
};
4 changes: 2 additions & 2 deletions frontend/app/adapters/encryptable-file.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import ApplicationAdapter from "./application";

export default ApplicationAdapter.extend({
export default class EncryptableFileAdapter extends ApplicationAdapter{
pathForType() {
return "encryptables";
}
});
};
18 changes: 9 additions & 9 deletions frontend/app/adapters/folder.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import ApplicationAdapter from "./application";

export default ApplicationAdapter.extend({
namespace: "api/teams",
export default class FolderAdapter extends ApplicationAdapter {
namespace = "api/teams";

urlForQuery(query, modelName) {
if (query.teamId) {
Expand All @@ -11,7 +11,7 @@ export default ApplicationAdapter.extend({
return url;
}
return super.urlForQuery(query, modelName);
},
}

urlForQueryRecord(query, modelName) {
if (query.teamId) {
Expand All @@ -22,27 +22,27 @@ export default ApplicationAdapter.extend({
return url;
}
return super.urlForQueryRecord(query, modelName);
},
}

urlForCreateRecord(modelName, snapshot) {
return `/${this.namespace}/${snapshot.belongsTo("team", {
id: true
})}/${this.pathForType()}`;
},
}

urlForUpdateRecord(id, modelName, snapshot) {
return `/${this.namespace}/${snapshot.belongsTo("team", {
id: true
})}/${this.pathForType()}/${id}`;
},
}

urlForDeleteRecord(id, modelName, snapshot) {
return `/${this.namespace}/${snapshot.belongsTo("team", {
id: true
})}/${this.pathForType()}/${id}`;
},
}

pathForType: function () {
pathForType() {
return "folders";
}
});
}
6 changes: 3 additions & 3 deletions frontend/app/adapters/team-api-user.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import ApplicationAdapter from "./application";
import { pluralize } from "ember-inflector";

export default ApplicationAdapter.extend({
export default class TeamApiUserAdapter extends ApplicationAdapter {
pathForType(modelName) {
let snakeCased = modelName.replace("-", "_");
return pluralize(snakeCased);
},
}

urlForQuery(query, modelName) {
let teamId = query.teamId;
Expand All @@ -15,4 +15,4 @@ export default ApplicationAdapter.extend({
}
return super.urlForQuery(query, modelName);
}
});
}
12 changes: 6 additions & 6 deletions frontend/app/adapters/teammember.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import ApplicationAdapter from "./application";

export default ApplicationAdapter.extend({
namespace: "api/teams",
export default class TeammemberAdapter extends ApplicationAdapter {
namespace = "api/teams";

urlForQuery(query, modelName) {
if (query.teamId) {
Expand All @@ -18,21 +18,21 @@ export default ApplicationAdapter.extend({
return url;
}
return super.urlForQuery(query, modelName);
},
}

pathForType() {
return "members";
},
}

urlForCreateRecord(modelName, snapshot) {
return `/${this.namespace}/${snapshot.belongsTo("team", {
id: true
})}/${this.pathForType()}`;
},
}

urlForDeleteRecord(id, modelName, snapshot) {
return `/${this.namespace}/${snapshot.belongsTo("team", {
id: true
})}/${this.pathForType()}/${id}`;
}
});
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export default class SettingMultiselectWithCreateComponent extends Component {
if (!this.args.selectedOptions) {
this.store.findAll(this.args.settingModel).then((settings) => {
const setting = settings.firstObject;
if (this.args.options && this.args.options.length) {
if (this.args.options && this.args.options?.length) {
this.selectedOptions = this.args.options.filter((option) => {
return setting.value.includes(option.value);
});
Expand Down
Loading

0 comments on commit 5de3ea6

Please sign in to comment.