Skip to content

Commit

Permalink
style: replace double equals with triple equals
Browse files Browse the repository at this point in the history
  • Loading branch information
annehaley committed Oct 10, 2024
1 parent 754d1be commit 245871b
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 40 deletions.
34 changes: 18 additions & 16 deletions web/src/components/AccessControl.vue
Original file line number Diff line number Diff line change
Expand Up @@ -25,36 +25,36 @@ function savePermissions() {
};
if (userToRemove.value) {
newPermissions.collaborator_ids = newPermissions.collaborator_ids.filter(
(uid: number) => uid != userToRemove.value?.id
(uid: number) => uid !== userToRemove.value?.id
);
newPermissions.follower_ids = newPermissions.follower_ids.filter(
(uid: number) => uid != userToRemove.value?.id
(uid: number) => uid !== userToRemove.value?.id
);
} else if (
["transfer", "claim"].includes(userSelectDialogMode.value) &&
selectedUsers.value.length == 1
selectedUsers.value.length === 1
) {
if (!newPermissions.collaborator_ids.includes(newPermissions.owner_id)) {
newPermissions.collaborator_ids.push(newPermissions.owner_id);
}
if (newPermissions.collaborator_ids.includes(selectedUsers.value[0].id)) {
newPermissions.collaborator_ids = newPermissions.collaborator_ids.filter(
(uid: number) => uid != selectedUsers.value[0].id
(uid: number) => uid !== selectedUsers.value[0].id
);
}
if (newPermissions.follower_ids.includes(selectedUsers.value[0].id)) {
newPermissions.follower_ids = newPermissions.follower_ids.filter(
(uid: number) => uid != selectedUsers.value[0].id
(uid: number) => uid !== selectedUsers.value[0].id
);
}
newPermissions.owner_id = selectedUsers.value[0].id;
} else if (selectedPermissionLevel.value == "collaborator") {
} else if (selectedPermissionLevel.value === "collaborator") {
selectedUsers.value.forEach((u: User) => {
if (!newPermissions.collaborator_ids.includes(u.id)) {
newPermissions.collaborator_ids.push(u.id);
}
});
} else if (selectedPermissionLevel.value == "follower") {
} else if (selectedPermissionLevel.value === "follower") {
selectedUsers.value.forEach((u: User) => {
if (!newPermissions.follower_ids.includes(u.id)) {
newPermissions.follower_ids.push(u.id);
Expand Down Expand Up @@ -114,7 +114,7 @@ onMounted(() => {
</template>
<template v-slot:append>
<v-icon
v-if="permissions[project.id] == 'own'"
v-if="permissions[project.id] === 'own'"
icon="mdi-pencil"
@click="
showUserSelectDialog = true;
Expand All @@ -126,7 +126,7 @@ onMounted(() => {
<v-list-item v-else class="mx-4" subtitle="No owner">
<template v-slot:append>
<v-icon
v-if="permissions[project.id] == 'own'"
v-if="permissions[project.id] === 'own'"
icon="mdi-pencil"
@click="
showUserSelectDialog = true;
Expand Down Expand Up @@ -170,7 +170,7 @@ onMounted(() => {
</template>
<template v-slot:append>
<v-icon
v-if="permissions[project.id] == 'own'"
v-if="permissions[project.id] === 'own'"
icon="mdi-trash-can"
@click="userToRemove = collaborator"
/>
Expand Down Expand Up @@ -216,7 +216,7 @@ onMounted(() => {
</template>
<template v-slot:append>
<v-icon
v-if="permissions[project.id] == 'own'"
v-if="permissions[project.id] === 'own'"
icon="mdi-trash-can"
@click="userToRemove = follower"
/>
Expand All @@ -229,7 +229,7 @@ onMounted(() => {
/>
</v-list>
<v-btn
v-if="permissions[project.id] == 'own'"
v-if="permissions[project.id] === 'own'"
color="primary"
@click="
showUserSelectDialog = true;
Expand All @@ -241,7 +241,9 @@ onMounted(() => {
<v-dialog v-model="showUserSelectDialog" width="500">
<v-card>
<v-card-title class="pa-3 bg-grey-lighten-2 text-grey-darken-2">
{{ userSelectDialogMode == "add" ? "Add Users" : "Select New Owner" }}
{{
userSelectDialogMode === "add" ? "Add Users" : "Select New Owner"
}}
<v-btn
class="close-button transparent"
variant="flat"
Expand All @@ -253,7 +255,7 @@ onMounted(() => {
</v-card-title>
<v-messages
color="red"
:active="userSelectDialogMode == 'transfer'"
:active="userSelectDialogMode === 'transfer'"
:messages="[
'Warning: After transferring ownership to another user, you will no \
longer be able to make changes to permissions or delete the project. \
Expand All @@ -266,7 +268,7 @@ onMounted(() => {
v-model="selectedUsers"
:items="allUsers"
:label="
userSelectDialogMode == 'add'
userSelectDialogMode === 'add'
? 'Users to add'
: 'New project owner'
"
Expand Down Expand Up @@ -297,7 +299,7 @@ onMounted(() => {
</template>
</v-select>
<v-select
v-if="userSelectDialogMode == 'add'"
v-if="userSelectDialogMode === 'add'"
v-model="selectedPermissionLevel"
:items="permissionLevels"
label="Permission Level"
Expand Down
6 changes: 3 additions & 3 deletions web/src/components/MainDrawerContents.vue
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ function saveProjectMapLocation(project: Project) {
default_map_zoom: zoom,
}).then((project) => {
availableProjects.value = availableProjects.value.map((p) => {
if (p.id == project.id) {
if (p.id === project.id) {
p.default_map_center = project.default_map_center;
p.default_map_zoom = project.default_map_zoom;
}
Expand Down Expand Up @@ -138,7 +138,7 @@ function saveProjectMapLocation(project: Project) {
<v-list-item @click="saveProjectMapLocation(project)">
Set current map position as project default
<v-icon
v-if="saving == 'done'"
v-if="saving === 'done'"
icon="mdi-check"
color="green"
style="float: right"
Expand All @@ -158,7 +158,7 @@ function saveProjectMapLocation(project: Project) {
<v-expansion-panel-text class="pa-0">
<v-card rounded="0" flat color="grey-lighten-2" class="pa-2">
<project-contents
v-if="project == currentProject"
v-if="project === currentProject"
:project="project"
/>
</v-card>
Expand Down
24 changes: 12 additions & 12 deletions web/src/components/ProjectConfig.vue
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,11 @@ const permissions = computed(() => {
const ret = Object.fromEntries(
availableProjects.value.map((p) => {
let perm = "view";
if (p.id == selectedProject.value?.id) {
if (p.id === selectedProject.value?.id) {
p = selectedProject.value;
}
if (
p.owner?.id == currentUser.value?.id ||
p.owner?.id === currentUser.value?.id ||
currentUser.value?.is_superuser
) {
perm = "own";
Expand Down Expand Up @@ -80,7 +80,7 @@ function del() {
if (projectToDelete.value) {
deleteProject(projectToDelete.value.id).then(() => {
loadProjects();
if (selectedProject.value?.id == projectToDelete.value?.id) {
if (selectedProject.value?.id === projectToDelete.value?.id) {
selectedProject.value = undefined;
}
projectToDelete.value = undefined;
Expand All @@ -107,11 +107,11 @@ function saveProjectName() {
}
function selectProject(v: Record<string, unknown>) {
if (selectedProject.value?.id != v.id) {
if (selectedProject.value?.id !== v.id) {
getProjectDatasets(v.id as number).then((data) => {
projDatasets.value = data;
});
selectedProject.value = availableProjects.value.find((p) => p.id == v.id);
selectedProject.value = availableProjects.value.find((p) => p.id === v.id);
}
}
Expand All @@ -132,7 +132,7 @@ function toggleOtherDatasetSelection({
otherSelectedDatasetIds.value.push(dataset.id);
} else if (!show && otherSelectedDatasetIds.value.includes(dataset.id)) {
otherSelectedDatasetIds.value = otherSelectedDatasetIds.value.filter(
(id) => id != dataset.id
(id) => id !== dataset.id
);
}
});
Expand All @@ -150,7 +150,7 @@ function toggleProjDatasetSelection({
projSelectedDatasetIds.value.push(dataset.id);
} else if (!show && projSelectedDatasetIds.value.includes(dataset.id)) {
projSelectedDatasetIds.value = projSelectedDatasetIds.value.filter(
(id) => id != dataset.id
(id) => id !== dataset.id
);
}
});
Expand Down Expand Up @@ -260,7 +260,7 @@ function handleEditFocus(focused: boolean) {
>
<template v-slot:title="{ title, item }">
<v-text-field
v-if="projectToEdit?.id == item.id"
v-if="projectToEdit?.id === item.id"
v-model="newProjectName"
:placeholder="item.name"
label="Project Name"
Expand All @@ -285,7 +285,7 @@ function handleEditFocus(focused: boolean) {
@click.stop="projectToEdit = item"
/>
<v-btn
v-else-if="projectToEdit?.id == item.id"
v-else-if="projectToEdit?.id === item.id"
color="primary"
variant="flat"
style="min-width: 40px; min-height: 40px"
Expand All @@ -307,7 +307,7 @@ function handleEditFocus(focused: boolean) {
</div>
</template>
</v-list>
<div class="pa-2 d-flex" v-if="projectConfigMode == 'new'">
<div class="pa-2 d-flex" v-if="projectConfigMode === 'new'">
<v-text-field
v-model="newProjectName"
label="Project Name"
Expand Down Expand Up @@ -349,7 +349,7 @@ function handleEditFocus(focused: boolean) {
<v-tab value="users" class="text-grey">Access Control</v-tab>
</v-tabs>
<div
v-if="currentTab == 'datasets' && projDatasets"
v-if="currentTab === 'datasets' && projDatasets"
class="py-3 px-6 d-flex"
>
<div style="width: 30%">
Expand Down Expand Up @@ -405,7 +405,7 @@ function handleEditFocus(focused: boolean) {
</v-btn>
</div>
</div>
<div v-if="currentTab == 'users'" class="py-3 px-6">
<div v-if="currentTab === 'users'" class="py-3 px-6">
<access-control
:project="selectedProject"
:permissions="permissions"
Expand Down
10 changes: 5 additions & 5 deletions web/src/components/ProjectContents.vue
Original file line number Diff line number Diff line change
Expand Up @@ -76,13 +76,13 @@ function selectItem(
panelLabel: string,
item: Dataset | DerivedRegion | Chart | SimulationType
) {
if (panelLabel == "Regions") {
if (panelLabel === "Regions") {
getDatasetLayerForDataObject(item as DerivedRegion).then((layer) => {
toggleDatasetLayer(layer);
});
} else if (panelLabel == "Charts") {
} else if (panelLabel === "Charts") {
currentChart.value = item as Chart;
} else if (panelLabel == "Simulations") {
} else if (panelLabel === "Simulations") {
currentSimulationType.value = item as SimulationType;
}
}
Expand Down Expand Up @@ -114,7 +114,7 @@ function toggleDatasets({
currentDataset.value = undefined;
}
selectedDatasets.value = selectedDatasets.value.filter((d) => {
d.id != dataset.id;
d.id !== dataset.id;
});
}
// Toggle dataset layer. This *must* be called after the above code,
Expand Down Expand Up @@ -170,7 +170,7 @@ watch(openPanels, () => {
No Available {{ panel.label }}.
</div>
<dataset-list
v-else-if="panel.label == 'Datasets' && projectContents['Datasets']"
v-else-if="panel.label === 'Datasets' && projectContents['Datasets']"
:datasets="projectContents['Datasets']"
:selected-ids="selectedDatasetIds"
:eye-icon="true"
Expand Down
6 changes: 3 additions & 3 deletions web/src/components/SimulationsPanel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export default {
availableResults.value = results;
if (activeResult.value) {
activeResult.value = availableResults.value.find(
(r) => r.id == activeResult.value?.id
(r) => r.id === activeResult.value?.id
);
}
});
Expand Down Expand Up @@ -126,7 +126,7 @@ export default {
}
const targetResult: SimulationResult | undefined =
availableResults.value.find(
(r: { id: number }) => r.id == activeResult.value?.id
(r: { id: number }) => r.id === activeResult.value?.id
);
if (
targetResult &&
Expand Down Expand Up @@ -276,7 +276,7 @@ export default {
<div v-else-if="result.output_data">
<v-card-title>Results</v-card-title>
<div
v-if="currentSimulationType.output_type == 'node_animation'"
v-if="currentSimulationType.output_type === 'node_animation'"
class="pa-5"
>
<div v-if="result.output_data.node_failures?.length === 0">
Expand Down
2 changes: 1 addition & 1 deletion web/src/layers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -520,7 +520,7 @@ export function styleRasterDatasetLayer(
if (colormapPalette) {
tileParams.palette = colormapPalette;
}
if (Array.isArray(colormapRange) && colormapRange?.length == 2) {
if (Array.isArray(colormapRange) && colormapRange?.length === 2) {
tileParams.min = colormapRange[0];
tileParams.max = colormapRange[1];
}
Expand Down

0 comments on commit 245871b

Please sign in to comment.