Skip to content

Commit

Permalink
ULT-1 beautify update
Browse files Browse the repository at this point in the history
Took 2 hours 5 minutes
  • Loading branch information
DanielTerletzkiy committed Feb 16, 2023
1 parent f232aa2 commit 61e51ac
Show file tree
Hide file tree
Showing 14 changed files with 484 additions and 374 deletions.
5 changes: 3 additions & 2 deletions electron/controller/ProjectScraper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,9 @@ module.exports = class ProjectScraper {
//in project

const masterBranch = await GitShell.getMasterBranch(path);
const [prefix, master] = masterBranch.split("/");
console.log("change project: ", master, issue, path, !!event);
console.log({ masterBranch })
const master = masterBranch === 'none' ? 'master' : masterBranch.split("/").pop();
console.log("change project: ", { master }, { issue }, { path });

//update master and stash
changeStep({ step: 2, state: ChangeState.Started });
Expand Down
29 changes: 18 additions & 11 deletions electron/types/Jira.ts
Original file line number Diff line number Diff line change
@@ -1,23 +1,30 @@
import { ChangeState } from "./ChangeState";
import { ApplicationType } from "./ApplicationType";

export type IDE = {
id: string;
path: string;
name: string;
};

export type Project = {
path: string,
project: string,
branch: string,
changes: Array<Array<string>>,
}
path: string;
project: string;
branch: string;
defaultBranch?: string;
changes: Array<Array<string>>;
ideId?: IDE["id"];
};

export type ChangeStep = {
step: number,
state: ChangeState,
path: string,
}
step: number;
state: ChangeState;
path: string;
};

export type JiraConfig = {
id: string;
url: string;
name: string;
applicationType: ApplicationType;
}

};
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ultira",
"version": "0.0.7",
"version": "0.0.8",
"private": true,
"description": "ultimate jira tool",
"author": {
Expand Down
21 changes: 14 additions & 7 deletions src/components/JiraBranchView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,20 @@
:key="option"
height="40px"
style="font-size: 1.2rem"
>{{ option }}
>{{ option }}
</d-list-item>
</d-tab-list>
<JiraProjectBranchRefreshButton />
</template>
<d-card block background-color="transparent" style="
<d-card
block
background-color="transparent"
style="
max-height: calc(500px - 50px - 8px);
overflow: overlay;
overflow-x: hidden;
">
"
>
<d-column
key="content"
v-if="
Expand All @@ -55,7 +59,7 @@
{{ repository.name }}
</d-card-title>
<d-card-subtitle
>Repository
>Repository
<JiraLinkIconButton
v-if="repository.url"
:url="repository.url"
Expand All @@ -73,9 +77,12 @@
<d-card-subtitle> Commits</d-card-subtitle>
</d-column>
<d-spacer />
<JiraPRButton
:repository="repository"
/>
<d-tooltip>
<JiraPRButton :repository="repository" />
<template v-slot:tooltip>
Create PR
</template>
</d-tooltip>
<JiraProjectButton
:repository="
repository.name.match(new RegExp('.*(/|^)(.*)')).pop()
Expand Down
33 changes: 23 additions & 10 deletions src/components/JiraButtonConfirm.vue
Original file line number Diff line number Diff line change
@@ -1,8 +1,24 @@
<template>
<OnClickOutside @trigger="onReset">
<d-icon-button v-if="icon" :color="currentColor" :active="state" @click="onClick" :name="icon"
:outlined="state" :outline-color="color" outline-offset="2px" outline-width="4px" />
<d-button v-else :color="currentColor" :filled="state" @click="onClick">
<d-icon-button
v-if="icon"
:color="currentColor"
:active="state"
@click="onClick"
:disabled="disabled"
:name="icon"
:outlined="state"
:outline-color="color"
outline-offset="2px"
outline-width="4px"
/>
<d-button
v-else
:color="currentColor"
:filled="state"
@click="onClick"
:disabled="disabled"
>
<template v-slot:prefix>
<slot name="prefix" />
</template>
Expand All @@ -21,8 +37,9 @@ import { OnClickOutside } from "@vueuse/components";
const emit = defineEmits(["click", "confirm", "cancel"]);
const props = defineProps({
color: { type: String, default: "primary" },
askColor: { type: String, default: "info" },
icon: { type: String }
askColor: { type: String, default: "primary" },
icon: { type: String },
disabled: { type: Boolean },
});
const state = ref(false);
Expand All @@ -45,10 +62,6 @@ function onReset() {
emit("cancel");
state.value = false;
}
</script>

<style scoped>
</style>
<style scoped></style>
47 changes: 25 additions & 22 deletions src/components/JiraChangeStep.vue
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
<template>
<d-row gap>
<d-tooltip v-for="step in steps" :key="step.description">
<d-column glow :color="step.color">
<d-icon :name="step.icon" :size="40" />
</d-column>
<template v-slot:tooltip>
{{ step.description }}
</template>
</d-tooltip>
<d-icon-button name="times" @click="onClear" :size="30" color="inherit"/>
</d-row>
<d-column no-padding v-ripple @click="onClear">
<d-row gap>
<d-tooltip v-for="step in steps" :key="step.description">
<d-column glow :color="step.color">
<d-icon :name="step.icon" :size="40" />
</d-column>
<template v-slot:tooltip>
{{ step.description }}
</template>
</d-tooltip>
</d-row>
</d-column>
</template>

<script setup lang="ts">
Expand All @@ -21,13 +22,10 @@ import ProjectController from "../controller/ProjectController";
import { ChangeState } from "../../types/ChangeState";
const steps = computed(() => {
const stepGroup = groupBy(changeSteps.value, (n) => n.step);
console.log(stepGroup, typeof stepGroup);
const stepGroup = getGroup();
if (!Object.keys(stepGroup)) {
return changeStepsInfo;
}
const clone = cloneDeep(changeStepsInfo);
for (const [i, stepInfo] of clone.entries()) {
Expand All @@ -38,24 +36,29 @@ const steps = computed(() => {
if (!currentGroup) {
continue;
}
console.log("cr:", currentGroup);
const currentStep = currentGroup.at(-1);
if (!currentStep) {
continue;
}
stepInfo.color =
currentStep.state === ChangeState.Started ? "warning" :
currentStep.state === ChangeState.Finished ? "success" :
currentStep.state === ChangeState.Failed ? "error" : "";
currentStep.state === ChangeState.Started
? "warning"
: currentStep.state === ChangeState.Finished
? "success"
: currentStep.state === ChangeState.Failed
? "error"
: "inherit";
}
return clone;
});
function getGroup() {
return groupBy(changeSteps.value, (n) => n.step);
}
function onClear() {
ProjectController.clearChangeSteps();
}
</script>

<style scoped>
</style>
<style scoped></style>
4 changes: 2 additions & 2 deletions src/components/JiraInfoView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
<d-row class="px-1" gap :wrap="false">
<d-tooltip position="right" filled color="primary">
<JiraImage
:url="currentIssue.task.fields.project.avatarUrls['48x48']"
:key="currentIssue.task.fields.project.key"
:url="currentIssue?.task.fields.project.avatarUrls['48x48']"
:key="currentIssue?.task.fields.project.key"
>
<template v-slot:default="{ base64 }">
<d-card width="64px" height="64px" elevation-light>
Expand Down
72 changes: 50 additions & 22 deletions src/components/JiraProjectButton.vue
Original file line number Diff line number Diff line change
@@ -1,43 +1,66 @@
<template>
<d-tooltip :position="tooltipPosition" color="primary" filled :key="hasChangeSteps" :popover="hasChangeSteps">
<d-card :outlined="hasChanges" background-color="transparent" outline-width="2px">
<JiraButtonConfirm icon="folder-open" color="primary" askColor="primary" :disabled="!project"
@confirm="onClick" />
<d-tooltip
:position="tooltipPosition"
color="primary"
filled
:key="hasChangeSteps"
:popover="hasChangeSteps"
>
<d-card
:outlined="hasChanges"
background-color="transparent"
outline-width="2px"
>
<JiraButtonConfirm
icon="folder-open"
color="primary"
askColor="primary"
:disabled="!project"
@confirm="onClick"
/>
</d-card>
<template v-slot:tooltip-wrapper>
<d-card>
<d-column gap>
<d-column>
<d-row gap>
<d-icon
class="ml-4"
name="corner-down-right"
:size="20"
style="transform: rotate(45deg)"
/>
<d-row gap style="max-width: max-content">
<d-column>
<d-card-subtitle>
<strong v-if="project">{{ project.branch.toUpperCase() }}</strong>
<strong v-if="project">{{
project.branch.toUpperCase()
}}</strong>
<span v-else>Project not installed</span>
</d-card-subtitle>
<d-divider color="primary" :tint="-40" />
<d-divider />
<d-card-subtitle>
<strong>{{ currentIssueKey }}</strong>
</d-card-subtitle>
</d-column>
<d-divider color="primary" :tint="-40" vertical block class="my-3" v-if="hasChanges" />
<d-divider vertical block class="my-3" size="4px" v-if="hasChanges" />
<d-column v-if="hasChanges">
<d-card-subtitle>
<strong>{{ project.changes.length }}</strong> Files
</d-card-subtitle>
<d-divider color="primary" :tint="-40" />
<d-card-subtitle color="inherit" class="font-weight-bold">
<d-divider />
<d-card-subtitle>
<d-icon name="file-edit-alt" :size="18" />
Changes
</d-card-subtitle>
</d-column>
</d-row>
</d-row>
<d-card v-if="hasChangeSteps" class="ma-2 pa-2" outlined elevation="2">
<d-card
v-if="hasChangeSteps"
class="ma-2 pa-2"
outlined
elevation="2"
>
<JiraChangeStep />
</d-card>
</d-column>
Expand All @@ -57,24 +80,29 @@ import JiraButtonConfirm from "./JiraButtonConfirm.vue";
const props = defineProps({
repository: { type: String, required: true },
tooltipPosition: { type: String as PropType<Position>, default: "left" }
tooltipPosition: { type: String as PropType<Position>, default: "left" },
});
const project = computed<Project>(
() =>
projects.value.find(
(project) => {
try {
return project.project.toLowerCase() === props.repository.toLowerCase();
} catch (e) {
return "error";
}
projects.value.find((project) => {
try {
return project.project.toLowerCase() === props.repository.toLowerCase();
} catch (e) {
return "error";
}
) as Project);
}) as Project
);
const hasChanges = computed<boolean>(() => project.value && project.value?.changes?.length > 0);
const hasChanges = computed<boolean>(
() => project.value && project.value?.changes?.length > 0
);
const hasChangeSteps = computed<boolean>(() => project.value && changeSteps.value.findIndex((step) => step.path === project.value.path) >= 0);
const hasChangeSteps = computed<boolean>(
() =>
project.value &&
changeSteps.value.findIndex((step) => step.path === project.value.path) >= 0
);
function onClick() {
ProjectController.clearChangeSteps();
Expand Down
Loading

0 comments on commit 61e51ac

Please sign in to comment.