From 3f2c57394a50f7edd1fcac4c98a4ae0abf30d653 Mon Sep 17 00:00:00 2001 From: Simone Gotti Date: Wed, 23 Feb 2022 16:13:44 +0100 Subject: [PATCH] *: Format with prettier Use latest prettier as devDependency so tools will use (or can be configured to use) the npm provided version. The unique config change is to use single quotes instead of double quotes. --- .prettierrc.js | 3 + babel.config.js | 6 +- jsconfig.json | 20 +- package-lock.json | 16 +- package.json | 1 + postcss.config.js | 7 +- src/App.vue | 67 +-- src/components/createorganization.vue | 31 +- src/components/createproject.vue | 84 ++-- src/components/createprojectbutton.vue | 40 +- src/components/createprojectgroup.vue | 41 +- src/components/createsourceform.vue | 81 ++-- src/components/log.vue | 54 +-- src/components/loginform.vue | 29 +- src/components/orgmembers.vue | 27 +- src/components/projbreadcrumbs.vue | 46 +- src/components/projectgroupsettings.vue | 103 +++-- src/components/projects.vue | 52 ++- src/components/projectsecrets.vue | 27 +- src/components/projectsettings.vue | 118 ++--- src/components/projectvars.vue | 26 +- src/components/registerform.vue | 26 +- src/components/remoterepos.vue | 19 +- src/components/rundetail.vue | 105 +++-- src/components/runs.vue | 101 +++-- src/components/runsummary.vue | 60 +-- src/components/secrets.vue | 18 +- src/components/step.vue | 65 +-- src/components/tabarrow.vue | 10 +- src/components/tasks.vue | 51 ++- src/components/tasksgraph.vue | 70 +-- src/components/tasksummary.vue | 55 ++- src/components/usersettings.vue | 69 +-- src/components/vars.vue | 42 +- src/css/tailwind.scss | 4 +- src/main.js | 26 +- src/router.js | 557 ++++++++++++++++-------- src/store.js | 87 ++-- src/util/auth.js | 30 +- src/util/data.js | 233 +++++----- src/util/link.js | 167 ++++--- src/util/run.js | 37 +- src/views/AddLinkedAccount.vue | 42 +- src/views/CreateSource.vue | 63 +-- src/views/Home.vue | 32 +- src/views/Login.vue | 47 +- src/views/Logout.vue | 12 +- src/views/Oauth2.vue | 37 +- src/views/Org.vue | 57 ++- src/views/Project.vue | 145 ++++-- src/views/ProjectGroup.vue | 71 ++- src/views/Register.vue | 58 ++- src/views/User.vue | 106 +++-- tailwind.js | 75 ++-- vue.config.js | 6 +- 55 files changed, 2001 insertions(+), 1461 deletions(-) create mode 100644 .prettierrc.js diff --git a/.prettierrc.js b/.prettierrc.js new file mode 100644 index 0000000..e340799 --- /dev/null +++ b/.prettierrc.js @@ -0,0 +1,3 @@ +module.exports = { + singleQuote: true, +}; diff --git a/babel.config.js b/babel.config.js index e955840..078c005 100644 --- a/babel.config.js +++ b/babel.config.js @@ -1,5 +1,3 @@ module.exports = { - presets: [ - '@vue/cli-plugin-babel/preset' - ] -} + presets: ['@vue/cli-plugin-babel/preset'], +}; diff --git a/jsconfig.json b/jsconfig.json index 1b38ae7..b5c7ae1 100644 --- a/jsconfig.json +++ b/jsconfig.json @@ -1,13 +1,9 @@ { - "compilerOptions": { - "baseUrl": ".", - "paths": { - "*": [ - "types/*" - ] - } - }, - "include": [ - "./src/**/*" - ] -} \ No newline at end of file + "compilerOptions": { + "baseUrl": ".", + "paths": { + "*": ["types/*"] + } + }, + "include": ["./src/**/*"] +} diff --git a/package-lock.json b/package-lock.json index d58e9cb..3cee00f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1977,6 +1977,13 @@ "yallist": "^2.1.2" } }, + "prettier": { + "version": "1.19.1", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-1.19.1.tgz", + "integrity": "sha512-s7PoyDv/II1ObgQunCbB9PdLmUcBZcnWOcxDh7O0N/UwDEsHyqkW+Qh28jW+mVuCdx7gLB0BotYI1Y6uI9iyew==", + "dev": true, + "optional": true + }, "source-map": { "version": "0.6.1", "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", @@ -9849,11 +9856,10 @@ "dev": true }, "prettier": { - "version": "1.19.1", - "resolved": "https://registry.npmjs.org/prettier/-/prettier-1.19.1.tgz", - "integrity": "sha512-s7PoyDv/II1ObgQunCbB9PdLmUcBZcnWOcxDh7O0N/UwDEsHyqkW+Qh28jW+mVuCdx7gLB0BotYI1Y6uI9iyew==", - "dev": true, - "optional": true + "version": "2.5.1", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.5.1.tgz", + "integrity": "sha512-vBZcPRUR5MZJwoyi3ZoyQlc1rXeEck8KgeC9AwwOn+exuxLxq5toTRDTSaVrXHxelDMHy9zlicw8u66yxoSUFg==", + "dev": true }, "pretty-error": { "version": "2.1.2", diff --git a/package.json b/package.json index 25afabd..f9cb2bc 100644 --- a/package.json +++ b/package.json @@ -29,6 +29,7 @@ "eslint": "^6.7.2", "eslint-plugin-vue": "^6.2.2", "node-sass": "^4.14.1", + "prettier": "2.5.1", "sass-loader": "^8.0.2", "tailwindcss": "^1.9.6", "vue-template-compiler": "^2.6.12" diff --git a/postcss.config.js b/postcss.config.js index cf0d1fc..b404b57 100644 --- a/postcss.config.js +++ b/postcss.config.js @@ -1,6 +1,3 @@ module.exports = { - "plugins": [ - require('tailwindcss')('tailwind.js'), - require('autoprefixer')(), - ] -} + plugins: [require('tailwindcss')('tailwind.js'), require('autoprefixer')()], +}; diff --git a/src/App.vue b/src/App.vue index fe48af6..1482c34 100644 --- a/src/App.vue +++ b/src/App.vue @@ -1,7 +1,9 @@ - - \ No newline at end of file + diff --git a/src/components/createorganization.vue b/src/components/createorganization.vue index b0f082f..0ad89f8 100644 --- a/src/components/createorganization.vue +++ b/src/components/createorganization.vue @@ -8,19 +8,21 @@ type="text" placeholder="Organization name" v-model="orgName" - > + />
+ > + Create Organization +
- - - + diff --git a/src/components/createproject.vue b/src/components/createproject.vue index 9994847..a9cd1eb 100644 --- a/src/components/createproject.vue +++ b/src/components/createproject.vue @@ -7,17 +7,18 @@ type="text" placeholder="Project Name" v-model="projectName" - > + />
@@ -31,31 +32,48 @@ v-for="(rs, index) in remoteSources" v-bind:key="rs.id" :value="index" - >{{ rs.name }} + > + {{ rs.name }} + -
- - +
+ +
+ > + Fetch remote repositories +

Available remote repositories

- + + > + Create Project +
- - + diff --git a/src/components/createprojectbutton.vue b/src/components/createprojectbutton.vue index 0f58da4..462bdc5 100644 --- a/src/components/createprojectbutton.vue +++ b/src/components/createprojectbutton.vue @@ -5,9 +5,11 @@ + > + {{ buttonValue }} +
@@ -40,28 +44,28 @@ - - + diff --git a/src/components/createprojectgroup.vue b/src/components/createprojectgroup.vue index 182a28d..d9a1976 100644 --- a/src/components/createprojectgroup.vue +++ b/src/components/createprojectgroup.vue @@ -7,20 +7,22 @@ type="text" placeholder="Project Group Name" v-model="projectGroupName" - > + />
+ > + Create ProjectGroup +
- - - + diff --git a/src/components/createsourceform.vue b/src/components/createsourceform.vue index 3e27d64..a9e0ad8 100644 --- a/src/components/createsourceform.vue +++ b/src/components/createsourceform.vue @@ -2,7 +2,7 @@ - - - diff --git a/src/components/log.vue b/src/components/log.vue index 00c2ad7..8932e96 100644 --- a/src/components/log.vue +++ b/src/components/log.vue @@ -43,18 +43,18 @@ diff --git a/src/components/loginform.vue b/src/components/loginform.vue index 0385937..0ce9aff 100644 --- a/src/components/loginform.vue +++ b/src/components/loginform.vue @@ -5,50 +5,53 @@ @submit.prevent="$emit('login', { username, password })" >
- + + />
- + + />
+ > + {{ action }} with {{ name }} +
- - - diff --git a/src/components/orgmembers.vue b/src/components/orgmembers.vue index 74f3f2b..cc69833 100644 --- a/src/components/orgmembers.vue +++ b/src/components/orgmembers.vue @@ -3,8 +3,8 @@

Organization Members

  • - {{member.user.username}} - {{member.role}} + {{ member.user.username }} + {{ member.role }}
No Members
@@ -12,39 +12,38 @@ - + diff --git a/src/components/projbreadcrumbs.vue b/src/components/projbreadcrumbs.vue index 06a3944..a2dbc76 100644 --- a/src/components/projbreadcrumbs.vue +++ b/src/components/projbreadcrumbs.vue @@ -2,57 +2,67 @@
- - - \ No newline at end of file + diff --git a/src/components/projectgroupsettings.vue b/src/components/projectgroupsettings.vue index c5353f7..3ed2962 100644 --- a/src/components/projectgroupsettings.vue +++ b/src/components/projectgroupsettings.vue @@ -20,7 +20,9 @@ Private
- +

Secrets

- +

Variables

- +
@@ -56,16 +66,13 @@ >

This operation - CANNOT be undone. - This operation will remove - {{projectGroupPath}} + CANNOT be undone. This operation will remove + {{ projectGroupPath }}

Delete Project Group + > + Delete Project Group +
- - + diff --git a/src/components/projects.vue b/src/components/projects.vue index 531f6e0..7873b9c 100644 --- a/src/components/projects.vue +++ b/src/components/projects.vue @@ -2,13 +2,20 @@

Projects

-
+
    -
  • +
  • - - {{project.name}} + + {{ project.name }}
  • @@ -19,7 +26,7 @@

    Project Groups

    -
    +
    • - {{projectgroup.name}} + {{ projectgroup.name }}
@@ -44,18 +51,18 @@ - \ No newline at end of file + diff --git a/src/components/projectsecrets.vue b/src/components/projectsecrets.vue index d7e0087..480ccc0 100644 --- a/src/components/projectsecrets.vue +++ b/src/components/projectsecrets.vue @@ -7,33 +7,34 @@
All secrets (local and inherited)
- + No secrets
- - - + diff --git a/src/components/projectsettings.vue b/src/components/projectsettings.vue index e2c4dfe..ea96684 100644 --- a/src/components/projectsettings.vue +++ b/src/components/projectsettings.vue @@ -21,7 +21,8 @@
@@ -38,14 +39,22 @@

Secrets

- +

Variables

- +
@@ -59,16 +68,13 @@ >

This operation - CANNOT be undone. - This operation will remove - {{projectPath}} + CANNOT be undone. This operation will remove + {{ projectPath }}

Delete Project + > + Delete Project +
-

Change remote repository linked account

+

+ Change remote repository linked account +

- +
@@ -121,21 +138,21 @@ import { fetchVariables, updateProject, deleteProject, - projectUpdateRepoLinkedAccount -} from "@/util/data.js"; + projectUpdateRepoLinkedAccount, +} from '@/util/data.js'; -import { projectGroupLink } from "@/util/link.js"; +import { projectGroupLink } from '@/util/link.js'; -import projectsecrets from "@/components/projectsecrets"; -import projectvars from "@/components/projectvars"; +import projectsecrets from '@/components/projectsecrets'; +import projectvars from '@/components/projectvars'; export default { components: { projectsecrets, projectvars }, - name: "projectsettings", + name: 'projectsettings', props: { ownertype: String, ownername: String, - projectref: Array + projectref: Array, }, data() { return { @@ -148,19 +165,19 @@ export default { allsecrets: [], variables: [], allvariables: [], - projectNameToDelete: "" + projectNameToDelete: '', }; }, computed: { - projectName: function() { + projectName: function () { return this.projectref[this.projectref.length - 1]; }, - projectPath: function() { - return ["", this.ownertype, this.ownername, ...this.projectref].join("/"); + projectPath: function () { + return ['', this.ownertype, this.ownername, ...this.projectref].join('/'); }, - deleteButtonEnabled: function() { + deleteButtonEnabled: function () { return this.projectNameToDelete == this.projectName; - } + }, }, methods: { resetErrors() { @@ -174,12 +191,12 @@ export default { let projectref = [ this.ownertype, this.ownername, - ...this.projectref - ].join("/"); + ...this.projectref, + ].join('/'); - let visibility = "public"; + let visibility = 'public'; if (this.projectIsPrivate) { - visibility = "private"; + visibility = 'private'; } let { error } = await updateProject( projectref, @@ -198,8 +215,8 @@ export default { let projectref = [ this.ownertype, this.ownername, - ...this.projectref - ].join("/"); + ...this.projectref, + ].join('/'); if (this.projectNameToDelete == this.projectName) { let { error } = await deleteProject(projectref); @@ -222,60 +239,59 @@ export default { let projectref = [ this.ownertype, this.ownername, - ...this.projectref - ].join("/"); + ...this.projectref, + ].join('/'); let { error } = await projectUpdateRepoLinkedAccount(projectref); if (error) { this.updateRepoLinkedAccountError = error; return; } - } + }, }, - created: async function() { + created: async function () { let projectref = [this.ownertype, this.ownername, ...this.projectref].join( - "/" + '/' ); let { data, error } = await fetchProject(projectref); if (error) { - this.$store.dispatch("setError", error); + this.$store.dispatch('setError', error); return; } this.project = data; - this.projectIsPrivate = this.project.visibility == "private"; + this.projectIsPrivate = this.project.visibility == 'private'; - ({ data, error } = await fetchSecrets("project", projectref, false)); + ({ data, error } = await fetchSecrets('project', projectref, false)); if (error) { - this.$store.dispatch("setError", error); + this.$store.dispatch('setError', error); return; } this.secrets = data; - ({ data, error } = await fetchSecrets("project", projectref, true)); + ({ data, error } = await fetchSecrets('project', projectref, true)); if (error) { - this.$store.dispatch("setError", error); + this.$store.dispatch('setError', error); return; } this.allsecrets = data; - ({ data, error } = await fetchVariables("project", projectref, false)); + ({ data, error } = await fetchVariables('project', projectref, false)); if (error) { - this.$store.dispatch("setError", error); + this.$store.dispatch('setError', error); return; } this.variables = data; - ({ data, error } = await fetchVariables("project", projectref, true)); + ({ data, error } = await fetchVariables('project', projectref, true)); if (error) { - this.$store.dispatch("setError", error); + this.$store.dispatch('setError', error); return; } this.allvariables = data; - } + }, }; - + diff --git a/src/components/projectvars.vue b/src/components/projectvars.vue index 3eb0aed..e590632 100644 --- a/src/components/projectvars.vue +++ b/src/components/projectvars.vue @@ -7,32 +7,34 @@
All variables (local and inherited)
- + No variables - - + diff --git a/src/components/registerform.vue b/src/components/registerform.vue index 566314e..cd919c2 100644 --- a/src/components/registerform.vue +++ b/src/components/registerform.vue @@ -5,7 +5,9 @@ @submit.prevent="$emit('login', { username })" >
- + + />
- + + />
+ > + Register +
- - - - diff --git a/src/components/remoterepos.vue b/src/components/remoterepos.vue index 5b85d45..18b0b93 100644 --- a/src/components/remoterepos.vue +++ b/src/components/remoterepos.vue @@ -7,8 +7,8 @@ v-bind:key="repo.id" @click="select(index)" > - - {{repo.path}} + + {{ repo.path }}
No remote repositories
@@ -18,23 +18,22 @@ - + diff --git a/src/components/rundetail.vue b/src/components/rundetail.vue index e426589..c7cb6b0 100644 --- a/src/components/rundetail.vue +++ b/src/components/rundetail.vue @@ -27,21 +27,29 @@
-

{{run.name}}

+

{{ run.name }}

{{ runStatus(run) | capitalize }} + >{{ runStatus(run) | capitalize }} Still running + >Still running +
+
+ {{ run.annotations.message.split(/\r?\n/)[0] }}
-
{{run.annotations.message.split(/\r?\n/)[0]}}
@@ -85,12 +93,18 @@
- @@ -107,14 +121,16 @@ v-if="run.can_restart_from_scratch" class="block px-4 py-2 hover:bg-blue-500 hover:text-white cursor-pointer" @click="restartRun(run.id, true)" - >From start + >From start
  • From failed tasks + >From failed tasks
  • @@ -122,13 +138,17 @@ class="btn btn-red" v-if="run.phase == 'queued'" @click="cancelRun(run.id)" - >Cancel + > + Cancel + + > + Stop +
    @@ -138,27 +158,27 @@ - + diff --git a/src/components/runs.vue b/src/components/runs.vue index 1c8f918..de5aa50 100644 --- a/src/components/runs.vue +++ b/src/components/runs.vue @@ -9,7 +9,7 @@
    -
    +
      @@ -27,21 +27,21 @@ class="whitespace-no-wrap overflow-x-hidden" > - {{run.annotations.branch}} + {{ run.annotations.branch }}
    - {{run.annotations.tag}} + {{ run.annotations.tag }}
    - PR #{{run.annotations.pull_request_id}} + PR #{{ run.annotations.pull_request_id }}
    @@ -53,30 +53,36 @@ class="w-5/12 pl-3 mr-auto whitespace-no-wrap overflow-hidden" :to="projectRunLink(ownertype, ownername, projectref, run.id)" > - {{run.name}} -
    {{run.annotations.message.split(/\r?\n/)[0]}}
    + {{ run.name }} +
    {{ run.annotations.message.split(/\r?\n/)[0] }}
    - {{run.name}} -
    {{run.annotations.message.split(/\r?\n/)[0]}}
    + {{ run.name }} +
    {{ run.annotations.message.split(/\r?\n/)[0] }}
    Waiting Approval + >Waiting Approval Still running + >Still running
    @@ -97,7 +103,9 @@ v-if="hasMoreRuns" class="bg-transparent hover:bg-blue-500 text-blue-700 font-semibold hover:text-white py-2 px-4 border border-blue-500 hover:border-transparent rounded" @click="loadMoreRuns()" - >Load more... + > + Load more... +
    No runs
    @@ -105,22 +113,22 @@ - + diff --git a/src/components/runsummary.vue b/src/components/runsummary.vue index fe3dab8..be5c9af 100644 --- a/src/components/runsummary.vue +++ b/src/components/runsummary.vue @@ -7,7 +7,12 @@ >
    {{ fetchRunError }}
    - +
    @@ -17,7 +22,7 @@ @@ -42,7 +47,8 @@ class="font-mono leading-snug text-xs" v-for="(error, i) in run.setup_errors" v-bind:key="i" - >{{error}} + >{{ error }}
    @@ -50,21 +56,21 @@ - \ No newline at end of file + diff --git a/src/components/secrets.vue b/src/components/secrets.vue index 8c97545..7fa1fd7 100644 --- a/src/components/secrets.vue +++ b/src/components/secrets.vue @@ -5,8 +5,10 @@
    - {{secret.name}} -
    from {{secret.parent_path}}
    + {{ secret.name }} +
    + from {{ secret.parent_path }} +
    @@ -15,16 +17,12 @@ - - - - + diff --git a/src/components/step.vue b/src/components/step.vue index 7defc7e..da8168a 100644 --- a/src/components/step.vue +++ b/src/components/step.vue @@ -12,7 +12,7 @@ class="inline-block mr-1 mdi mdi-arrow-right" :class="{ 'arrow-down': active, 'arrow-right': !active }" >
    - {{step.name}} + {{ step.name }} {{ duration }} @@ -20,18 +20,24 @@
    - Shell + Shell {{ step.shell}} + >{{ step.shell }} Exit Status + >Exit Status {{ step.exit_status}} + >{{ step.exit_status }}
    Command
    -
    {{ step.command}}
    +
    {{ step.command }}
    -
    Log
    +
    + Log +
    @@ -144,4 +155,4 @@ export default { transition: transform 0.2s ease-in-out; transform: rotate(90deg); } - \ No newline at end of file + diff --git a/src/components/tabarrow.vue b/src/components/tabarrow.vue index 5eb0c7b..137a97b 100644 --- a/src/components/tabarrow.vue +++ b/src/components/tabarrow.vue @@ -1,14 +1,18 @@ @@ -20,4 +24,4 @@ export default { position: relative; top: 0.1rem; } - \ No newline at end of file + diff --git a/src/components/tasks.vue b/src/components/tasks.vue index 5105669..473d072 100644 --- a/src/components/tasks.vue +++ b/src/components/tasks.vue @@ -2,24 +2,31 @@
    • -
      +
      - {{task.name}} + {{ task.name }}
      Waiting Approval + >Waiting Approval
      - depends on:   + depends on:  
      • {{dep}}
      • + > + {{ dep }} +
      {{ task.duration }} @@ -30,21 +37,21 @@ \ No newline at end of file + diff --git a/src/components/tasksgraph.vue b/src/components/tasksgraph.vue index 2f93b24..cec8570 100644 --- a/src/components/tasksgraph.vue +++ b/src/components/tasksgraph.vue @@ -64,13 +64,13 @@ diff --git a/src/components/tasksummary.vue b/src/components/tasksummary.vue index d624c74..04ca83a 100644 --- a/src/components/tasksummary.vue +++ b/src/components/tasksummary.vue @@ -8,22 +8,30 @@
      Error fetching Run: {{ fetchRunError }}
      Error fetching Task: {{ fetchTaskError }}
      - +
      - {{task.name}} + {{ task.name }} {{ task.status | capitalize }} + >{{ task.status | capitalize }}
      + > + Approve +
      - \ No newline at end of file + diff --git a/src/components/usersettings.vue b/src/components/usersettings.vue index 402fe9c..c63b96a 100644 --- a/src/components/usersettings.vue +++ b/src/components/usersettings.vue @@ -7,7 +7,10 @@ class="mb-4 bg-red-100 border-l-4 border-red-500 text-red-700 p-4 rounded" role="alert" > -

      Removing a Linked Account will also block all the projects that uses this Linked Account to access their remote repository

      +

      + Removing a Linked Account will also block all the projects that uses + this Linked Account to access their remote repository +

      • - {{la.remote_user_name}} - (on remote source {{laRemoteSourceName(la)}}) + {{ la.remote_user_name }} + (on remote source {{ laRemoteSourceName(la) }})
        - +
      • - + -
        +
        - +
        @@ -69,8 +82,10 @@ v-for="token in user.tokens" v-bind:key="token" > - {{token}} - + {{ token }} +
        -

        User token created. Copy it now since it won't be showed again

        -

        {{token}}

        +

        + User token created. Copy it now since it won't be showed again +

        +

        {{ token }}

      - + /> +
      - - + diff --git a/src/components/vars.vue b/src/components/vars.vue index 06c9f35..87e7593 100644 --- a/src/components/vars.vue +++ b/src/components/vars.vue @@ -18,21 +18,22 @@
      - {{variable.name}} -
      from {{variable.parent_path}}
      + {{ variable.name }} +
      + from {{ variable.parent_path }} +
      - {{val.secret_name}} -
      using secret from {{val.matching_secret_parent_path}}
      + {{ val.secret_name }} +
      + using secret from {{ val.matching_secret_parent_path }} +
      no matching secret
      - {{val.secret_var}} + {{ val.secret_var }}
      @@ -43,13 +44,19 @@ {{ type }}
      -
      -
      {{include.match}}
      +
      +
      {{ include.match }}
      -
      -
      {{exclude.match}}
      +
      +
      {{ exclude.match }}
      @@ -66,15 +73,12 @@ - - - + diff --git a/src/css/tailwind.scss b/src/css/tailwind.scss index 6e2bb37..2529e29 100644 --- a/src/css/tailwind.scss +++ b/src/css/tailwind.scss @@ -1,7 +1,7 @@ @tailwind base; @tailwind components; -@import "@/css/_ansi.scss"; +@import '@/css/_ansi.scss'; .btn { @apply font-bold py-2 px-4 rounded; @@ -119,7 +119,7 @@ border-radius: 290486px; border-right-color: transparent; border-top-color: transparent; - content: ""; + content: ''; display: block; width: 1em; height: 1em; diff --git a/src/main.js b/src/main.js index 6b89bf4..3a4849a 100644 --- a/src/main.js +++ b/src/main.js @@ -1,11 +1,11 @@ -import "@/css/tailwind.scss"; -import { getUser } from "@/util/auth"; -import "@mdi/font/css/materialdesignicons.css"; -import Vue from "vue"; -import Vue2Filters from "vue2-filters"; -import App from "./App.vue"; -import router from "./router"; -import store from "./store"; +import '@/css/tailwind.scss'; +import { getUser } from '@/util/auth'; +import '@mdi/font/css/materialdesignicons.css'; +import Vue from 'vue'; +import Vue2Filters from 'vue2-filters'; +import App from './App.vue'; +import router from './router'; +import store from './store'; Vue.use(Vue2Filters); @@ -13,12 +13,12 @@ Vue.use(Vue2Filters); new Vue({ router, store, - created: function() { + created: function () { let user = getUser(); if (user) { - store.dispatch("setUser", user); + store.dispatch('setUser', user); } - store.dispatch("setRegisterUser", null); + store.dispatch('setRegisterUser', null); }, - render: h => h(App) -}).$mount("#app"); + render: (h) => h(App), +}).$mount('#app'); diff --git a/src/router.js b/src/router.js index 1afa28e..a8e48f9 100644 --- a/src/router.js +++ b/src/router.js @@ -1,249 +1,348 @@ -import Vue from "vue"; -import VueRouter from "vue-router"; -import Home from "./views/Home.vue"; -import User from "./views/User.vue"; -import Org from "./views/Org.vue"; -import Project from "./views/Project.vue"; -import ProjectGroup from "./views/ProjectGroup.vue"; -import AddLinkedAccount from "./views/AddLinkedAccount.vue"; -import usersettings from "./components/usersettings.vue"; -import projects from "./components/projects.vue"; -import projectsettings from "./components/projectsettings.vue"; -import projectgroupsettings from "./components/projectgroupsettings.vue"; -import createproject from "./components/createproject.vue"; -import createprojectgroup from "./components/createprojectgroup.vue"; -import createorganization from "./components/createorganization.vue"; -import orgmembers from "./components/orgmembers.vue"; -import runs from "./components/runs.vue"; -import runsummary from "./components/runsummary.vue"; -import tasksummary from "./components/tasksummary.vue"; -import Oauth2 from "./views/Oauth2.vue"; -import Register from "./views/Register.vue"; -import Login from "./views/Login.vue"; -import Logout from "./views/Logout.vue"; -import CreateSource from "./views/CreateSource.vue"; +import Vue from 'vue'; +import VueRouter from 'vue-router'; +import Home from './views/Home.vue'; +import User from './views/User.vue'; +import Org from './views/Org.vue'; +import Project from './views/Project.vue'; +import ProjectGroup from './views/ProjectGroup.vue'; +import AddLinkedAccount from './views/AddLinkedAccount.vue'; +import usersettings from './components/usersettings.vue'; +import projects from './components/projects.vue'; +import projectsettings from './components/projectsettings.vue'; +import projectgroupsettings from './components/projectgroupsettings.vue'; +import createproject from './components/createproject.vue'; +import createprojectgroup from './components/createprojectgroup.vue'; +import createorganization from './components/createorganization.vue'; +import orgmembers from './components/orgmembers.vue'; +import runs from './components/runs.vue'; +import runsummary from './components/runsummary.vue'; +import tasksummary from './components/tasksummary.vue'; +import Oauth2 from './views/Oauth2.vue'; +import Register from './views/Register.vue'; +import Login from './views/Login.vue'; +import Logout from './views/Logout.vue'; +import CreateSource from './views/CreateSource.vue'; -import { parseRef, projectRunLink } from "@/util/link.js"; -import { fetchProject } from "@/util/data.js"; +import { parseRef, projectRunLink } from '@/util/link.js'; +import { fetchProject } from '@/util/data.js'; -import store from "./store"; +import store from './store'; Vue.use(VueRouter); const router = new VueRouter({ - mode: "history", + mode: 'history', routes: [ { - path: "/register", - name: "register", + path: '/register', + name: 'register', component: Register, }, { - path: "/newsource", - name: "newsource", + path: '/newsource', + name: 'newsource', component: CreateSource, }, { - path: "/login", - name: "login", - component: Login + path: '/login', + name: 'login', + component: Login, }, { - path: "/logout", - name: "logout", - component: Logout + path: '/logout', + name: 'logout', + component: Logout, }, { - path: "/oauth2/callback", - name: "oauth2callback", - component: Oauth2 + path: '/oauth2/callback', + name: 'oauth2callback', + component: Oauth2, }, { - path: "/", - name: "home", - component: Home + path: '/', + name: 'home', + component: Home, }, { - path: "/neworganization", + path: '/neworganization', component: createorganization, }, { - path: "/user/:username", + path: '/user/:username', component: User, props: (route) => ({ username: route.params.username }), children: [ { - path: "", - name: "user", + path: '', + name: 'user', component: projects, - props: (route) => ({ ownertype: "user", ownername: route.params.username }) + props: (route) => ({ + ownertype: 'user', + ownername: route.params.username, + }), }, { - path: "projects", - name: "user projects", + path: 'projects', + name: 'user projects', component: projects, - props: (route) => ({ ownertype: "user", ownername: route.params.username }) + props: (route) => ({ + ownertype: 'user', + ownername: route.params.username, + }), }, { - path: "runs", - name: "user direct runs", + path: 'runs', + name: 'user direct runs', component: runs, - props: (route) => ({ ownertype: "user", ownername: route.params.username }) + props: (route) => ({ + ownertype: 'user', + ownername: route.params.username, + }), }, { - path: "runs/:runid", - name: "user direct run", + path: 'runs/:runid', + name: 'user direct run', component: runsummary, - props: (route) => ({ ownertype: "user", ownername: route.params.username, runid: route.params.runid }) + props: (route) => ({ + ownertype: 'user', + ownername: route.params.username, + runid: route.params.runid, + }), }, { - path: "runs/:runid/tasks/:taskid", - name: "user direct run task", + path: 'runs/:runid/tasks/:taskid', + name: 'user direct run task', component: tasksummary, - props: (route) => ({ ownertype: "user", ownername: route.params.username, runid: route.params.runid, taskid: route.params.taskid }) + props: (route) => ({ + ownertype: 'user', + ownername: route.params.username, + runid: route.params.runid, + taskid: route.params.taskid, + }), }, { - path: "settings", - name: "user settings", + path: 'settings', + name: 'user settings', component: usersettings, props: (route) => ({ username: route.params.username }), }, { - path: "linkedaccounts/add/:remotesource", - name: "user add linked account", + path: 'linkedaccounts/add/:remotesource', + name: 'user add linked account', component: AddLinkedAccount, - props: (route) => ({ username: route.params.username, remoteSourceName: route.params.remotesource }) + props: (route) => ({ + username: route.params.username, + remoteSourceName: route.params.remotesource, + }), }, { - path: "createprojectgroup", - name: "user create project group", + path: 'createprojectgroup', + name: 'user create project group', component: createprojectgroup, - props: (route) => ({ ownertype: "user", ownername: route.params.username }) + props: (route) => ({ + ownertype: 'user', + ownername: route.params.username, + }), }, { - path: "createproject", - name: "user create project", + path: 'createproject', + name: 'user create project', component: createproject, - props: (route) => ({ ownertype: "user", ownername: route.params.username }) + props: (route) => ({ + ownertype: 'user', + ownername: route.params.username, + }), }, - ] + ], }, { - path: "/user/:username/projects/:projectref(.*\\.proj)", + path: '/user/:username/projects/:projectref(.*\\.proj)', component: Project, - props: (route) => ({ ownertype: "user", ownername: route.params.username, projectref: parseRef(route.params.projectref) }), + props: (route) => ({ + ownertype: 'user', + ownername: route.params.username, + projectref: parseRef(route.params.projectref), + }), children: [ { - path: "", - name: "user project", + path: '', + name: 'user project', component: runs, - props: (route) => ({ ownertype: "user", ownername: route.params.username, projectref: parseRef(route.params.projectref) }) + props: (route) => ({ + ownertype: 'user', + ownername: route.params.username, + projectref: parseRef(route.params.projectref), + }), }, { - path: "runs", - name: "user project runs", + path: 'runs', + name: 'user project runs', component: runs, - props: (route) => ({ ownertype: "user", ownername: route.params.username, projectref: parseRef(route.params.projectref) }) + props: (route) => ({ + ownertype: 'user', + ownername: route.params.username, + projectref: parseRef(route.params.projectref), + }), }, { - path: "branches", - name: "user project branches runs", + path: 'branches', + name: 'user project branches runs', component: runs, - props: (route) => ({ ownertype: "user", ownername: route.params.username, projectref: parseRef(route.params.projectref), query: "branches" }) + props: (route) => ({ + ownertype: 'user', + ownername: route.params.username, + projectref: parseRef(route.params.projectref), + query: 'branches', + }), }, { - path: "tags", - name: "user project tags runs", + path: 'tags', + name: 'user project tags runs', component: runs, - props: (route) => ({ ownertype: "user", ownername: route.params.username, projectref: parseRef(route.params.projectref), query: "tags" }) + props: (route) => ({ + ownertype: 'user', + ownername: route.params.username, + projectref: parseRef(route.params.projectref), + query: 'tags', + }), }, { - path: "pullrequests", - name: "user project pull requests runs", + path: 'pullrequests', + name: 'user project pull requests runs', component: runs, - props: (route) => ({ ownertype: "user", ownername: route.params.username, projectref: parseRef(route.params.projectref), query: "pullrequests" }) + props: (route) => ({ + ownertype: 'user', + ownername: route.params.username, + projectref: parseRef(route.params.projectref), + query: 'pullrequests', + }), }, { - path: "runs/:runid", - name: "user project run", + path: 'runs/:runid', + name: 'user project run', component: runsummary, - props: (route) => ({ ownertype: "user", ownername: route.params.username, projectref: parseRef(route.params.projectref), runid: route.params.runid }) + props: (route) => ({ + ownertype: 'user', + ownername: route.params.username, + projectref: parseRef(route.params.projectref), + runid: route.params.runid, + }), }, { - path: "runs/:runid/tasks/:taskid", - name: "user project run task", + path: 'runs/:runid/tasks/:taskid', + name: 'user project run task', component: tasksummary, - props: (route) => ({ ownertype: "user", ownername: route.params.username, projectref: parseRef(route.params.projectref), runid: route.params.runid, taskid: route.params.taskid }) + props: (route) => ({ + ownertype: 'user', + ownername: route.params.username, + projectref: parseRef(route.params.projectref), + runid: route.params.runid, + taskid: route.params.taskid, + }), }, { - path: "settings", - name: "user project settings", + path: 'settings', + name: 'user project settings', component: projectsettings, - props: (route) => ({ ownertype: "user", ownername: route.params.username, projectref: parseRef(route.params.projectref) }) + props: (route) => ({ + ownertype: 'user', + ownername: route.params.username, + projectref: parseRef(route.params.projectref), + }), }, - ] + ], }, { - path: "/user/:username/projectgroups/:projectgroupref(.*\\.proj)", + path: '/user/:username/projectgroups/:projectgroupref(.*\\.proj)', component: ProjectGroup, - props: (route) => ({ ownertype: "user", ownername: route.params.username, projectgroupref: parseRef(route.params.projectgroupref) }), + props: (route) => ({ + ownertype: 'user', + ownername: route.params.username, + projectgroupref: parseRef(route.params.projectgroupref), + }), children: [ { - path: "", - name: "user project group", + path: '', + name: 'user project group', component: projects, - props: (route) => ({ ownertype: "user", ownername: route.params.username, projectgroupref: parseRef(route.params.projectgroupref) }), + props: (route) => ({ + ownertype: 'user', + ownername: route.params.username, + projectgroupref: parseRef(route.params.projectgroupref), + }), }, { - path: "projects", - name: "user project group projects", + path: 'projects', + name: 'user project group projects', component: projects, - props: (route) => ({ ownertype: "user", ownername: route.params.username, projectgroupref: parseRef(route.params.projectgroupref) }) + props: (route) => ({ + ownertype: 'user', + ownername: route.params.username, + projectgroupref: parseRef(route.params.projectgroupref), + }), }, { - path: "settings", - name: "user project group settings", + path: 'settings', + name: 'user project group settings', component: projectgroupsettings, - props: (route) => ({ ownertype: "user", ownername: route.params.username, projectgroupref: parseRef(route.params.projectgroupref) }) + props: (route) => ({ + ownertype: 'user', + ownername: route.params.username, + projectgroupref: parseRef(route.params.projectgroupref), + }), }, { - path: "createprojectgroup", - name: "user project group create project group", + path: 'createprojectgroup', + name: 'user project group create project group', component: createprojectgroup, - props: (route) => ({ ownertype: "user", ownername: route.params.username, projectgroupref: parseRef(route.params.projectgroupref) }) + props: (route) => ({ + ownertype: 'user', + ownername: route.params.username, + projectgroupref: parseRef(route.params.projectgroupref), + }), }, { - path: "createproject", - name: "user project group create project", + path: 'createproject', + name: 'user project group create project', component: createproject, - props: (route) => ({ ownertype: "user", ownername: route.params.username, projectgroupref: parseRef(route.params.projectgroupref) }) + props: (route) => ({ + ownertype: 'user', + ownername: route.params.username, + projectgroupref: parseRef(route.params.projectgroupref), + }), }, - ] + ], }, { - path: "/org/:orgname", + path: '/org/:orgname', component: Org, props: (route) => ({ orgname: route.params.orgname }), children: [ { - path: "", - name: "org", + path: '', + name: 'org', component: projects, - props: (route) => ({ ownertype: "org", ownername: route.params.orgname }) + props: (route) => ({ + ownertype: 'org', + ownername: route.params.orgname, + }), }, { - path: "projects", - name: "org projects", + path: 'projects', + name: 'org projects', component: projects, - props: (route) => ({ ownertype: "org", ownername: route.params.orgname }) + props: (route) => ({ + ownertype: 'org', + ownername: route.params.orgname, + }), }, { - path: "members", - name: "org members", + path: 'members', + name: 'org members', component: orgmembers, - props: (route) => ({ orgname: route.params.orgname }) + props: (route) => ({ orgname: route.params.orgname }), }, /* { path: "settings", @@ -252,141 +351,213 @@ const router = new VueRouter({ props: (route) => ({ username: route.params.username }), }, */ { - path: "createprojectgroup", - name: "org create project group", + path: 'createprojectgroup', + name: 'org create project group', component: createprojectgroup, - props: (route) => ({ ownertype: "org", ownername: route.params.orgname }) + props: (route) => ({ + ownertype: 'org', + ownername: route.params.orgname, + }), }, { - path: "createproject", - name: "org create project", + path: 'createproject', + name: 'org create project', component: createproject, - props: (route) => ({ ownertype: "org", ownername: route.params.orgname }) + props: (route) => ({ + ownertype: 'org', + ownername: route.params.orgname, + }), }, - ] + ], }, { - path: "/org/:orgname/projects/:projectref(.*\\.proj)", + path: '/org/:orgname/projects/:projectref(.*\\.proj)', component: Project, - props: (route) => ({ ownertype: "org", ownername: route.params.orgname, projectref: parseRef(route.params.projectref) }), + props: (route) => ({ + ownertype: 'org', + ownername: route.params.orgname, + projectref: parseRef(route.params.projectref), + }), children: [ { - path: "", - name: "org project", + path: '', + name: 'org project', component: runs, - props: (route) => ({ ownertype: "org", ownername: route.params.orgname, projectref: parseRef(route.params.projectref) }) + props: (route) => ({ + ownertype: 'org', + ownername: route.params.orgname, + projectref: parseRef(route.params.projectref), + }), }, { - path: "runs", - name: "org project runs", + path: 'runs', + name: 'org project runs', component: runs, - props: (route) => ({ ownertype: "org", ownername: route.params.orgname, projectref: parseRef(route.params.projectref) }) + props: (route) => ({ + ownertype: 'org', + ownername: route.params.orgname, + projectref: parseRef(route.params.projectref), + }), }, { - path: "branches", - name: "org project branches runs", + path: 'branches', + name: 'org project branches runs', component: runs, - props: (route) => ({ ownertype: "org", ownername: route.params.orgname, projectref: parseRef(route.params.projectref), query: "branches" }) + props: (route) => ({ + ownertype: 'org', + ownername: route.params.orgname, + projectref: parseRef(route.params.projectref), + query: 'branches', + }), }, { - path: "tags", - name: "org project tags runs", + path: 'tags', + name: 'org project tags runs', component: runs, - props: (route) => ({ ownertype: "org", ownername: route.params.orgname, projectref: parseRef(route.params.projectref), query: "tags" }) + props: (route) => ({ + ownertype: 'org', + ownername: route.params.orgname, + projectref: parseRef(route.params.projectref), + query: 'tags', + }), }, { - path: "pullrequests", - name: "org project pull requests runs", + path: 'pullrequests', + name: 'org project pull requests runs', component: runs, - props: (route) => ({ ownertype: "org", ownername: route.params.orgname, projectref: parseRef(route.params.projectref), query: "pullrequests" }) + props: (route) => ({ + ownertype: 'org', + ownername: route.params.orgname, + projectref: parseRef(route.params.projectref), + query: 'pullrequests', + }), }, { - path: "runs/:runid", - name: "org project run", + path: 'runs/:runid', + name: 'org project run', component: runsummary, - props: (route) => ({ ownertype: "org", ownername: route.params.orgname, projectref: parseRef(route.params.projectref), runid: route.params.runid }) + props: (route) => ({ + ownertype: 'org', + ownername: route.params.orgname, + projectref: parseRef(route.params.projectref), + runid: route.params.runid, + }), }, { - path: "runs/:runid/tasks/:taskid", - name: "org project run task", + path: 'runs/:runid/tasks/:taskid', + name: 'org project run task', component: tasksummary, - props: (route) => ({ ownertype: "org", ownername: route.params.orgname, projectref: parseRef(route.params.projectref), runid: route.params.runid, taskid: route.params.taskid }) + props: (route) => ({ + ownertype: 'org', + ownername: route.params.orgname, + projectref: parseRef(route.params.projectref), + runid: route.params.runid, + taskid: route.params.taskid, + }), }, { - path: "settings", - name: "org project settings", + path: 'settings', + name: 'org project settings', component: projectsettings, - props: (route) => ({ ownertype: "org", ownername: route.params.orgname, projectref: parseRef(route.params.projectref) }) + props: (route) => ({ + ownertype: 'org', + ownername: route.params.orgname, + projectref: parseRef(route.params.projectref), + }), }, - ] + ], }, { - path: "/org/:orgname/projectgroups/:projectgroupref(.*\\.proj)", + path: '/org/:orgname/projectgroups/:projectgroupref(.*\\.proj)', component: ProjectGroup, - props: (route) => ({ ownertype: "org", ownername: route.params.orgname, projectgroupref: parseRef(route.params.projectgroupref) }), + props: (route) => ({ + ownertype: 'org', + ownername: route.params.orgname, + projectgroupref: parseRef(route.params.projectgroupref), + }), children: [ { - path: "", - name: "org project group", + path: '', + name: 'org project group', component: projects, - props: (route) => ({ ownertype: "org", ownername: route.params.orgname, projectgroupref: parseRef(route.params.projectgroupref) }), + props: (route) => ({ + ownertype: 'org', + ownername: route.params.orgname, + projectgroupref: parseRef(route.params.projectgroupref), + }), }, { - path: "projects", - name: "org project group projects", + path: 'projects', + name: 'org project group projects', component: projects, - props: (route) => ({ ownertype: "org", ownername: route.params.orgname, projectgroupref: parseRef(route.params.projectgroupref) }) + props: (route) => ({ + ownertype: 'org', + ownername: route.params.orgname, + projectgroupref: parseRef(route.params.projectgroupref), + }), }, { - path: "settings", - name: "org project group settings", + path: 'settings', + name: 'org project group settings', component: projectgroupsettings, - props: (route) => ({ ownertype: "org", ownername: route.params.orgname, projectgroupref: parseRef(route.params.projectgroupref) }) + props: (route) => ({ + ownertype: 'org', + ownername: route.params.orgname, + projectgroupref: parseRef(route.params.projectgroupref), + }), }, { - path: "createprojectgroup", - name: "org project group create project group", + path: 'createprojectgroup', + name: 'org project group create project group', component: createprojectgroup, - props: (route) => ({ ownertype: "org", ownername: route.params.orgname, projectgroupref: parseRef(route.params.projectgroupref) }) + props: (route) => ({ + ownertype: 'org', + ownername: route.params.orgname, + projectgroupref: parseRef(route.params.projectgroupref), + }), }, { - path: "createproject", - name: "org project group create project", + path: 'createproject', + name: 'org project group create project', component: createproject, - props: (route) => ({ ownertype: "org", ownername: route.params.orgname, projectgroupref: parseRef(route.params.projectgroupref) }) + props: (route) => ({ + ownertype: 'org', + ownername: route.params.orgname, + projectgroupref: parseRef(route.params.projectgroupref), + }), }, - ] + ], }, - ] + ], }); router.beforeEach(async (to, from, next) => { - store.dispatch("setError", null); + store.dispatch('setError', null); - const { path, query } = to + const { path, query } = to; - if (path == "/run") { + if (path == '/run') { // generic run handler by projectref and runid - let projectref = query.projectref - let runid = query.runid + let projectref = query.projectref; + let runid = query.runid; let { data, error } = await fetchProject(projectref); if (error) { - this.$store.dispatch("setError", error); + this.$store.dispatch('setError', error); return; } let project = data; - let parts = project.path.split("/") - let nextPath = projectRunLink(parts[0], parts[1], parts.slice(2), runid) + let parts = project.path.split('/'); + let nextPath = projectRunLink(parts[0], parts[1], parts.slice(2), runid); - next({ path: nextPath.path, replace: true }) + next({ path: nextPath.path, replace: true }); } - next() -}) + next(); +}); -export default router +export default router; diff --git a/src/store.js b/src/store.js index 3369abf..46ff83f 100644 --- a/src/store.js +++ b/src/store.js @@ -1,55 +1,54 @@ -import Vue from 'vue' -import Vuex from 'vuex' +import Vue from 'vue'; +import Vuex from 'vuex'; -Vue.use(Vuex) +Vue.use(Vuex); const state = { - error: null, - user: null, - registeruser: null, -} + error: null, + user: null, + registeruser: null, +}; const getters = { - // global error - error: state => { - return state.error - }, - user: state => { - return state.user - }, - registeruser: state => { - return state.registeruser - } -} + // global error + error: (state) => { + return state.error; + }, + user: (state) => { + return state.user; + }, + registeruser: (state) => { + return state.registeruser; + }, +}; const mutations = { - setError(state, error) { - state.error = error - }, - setUser(state, user) { - state.user = user - }, - setRegisterUser(state, user) { - state.registeruser = user - } -} + setError(state, error) { + state.error = error; + }, + setUser(state, user) { + state.user = user; + }, + setRegisterUser(state, user) { + state.registeruser = user; + }, +}; const actions = { - setError({ commit }, error) { - commit('setError', error) - }, - setUser({ commit }, user) { - commit('setUser', user) - }, - setRegisterUser({ commit }, user) { - commit('setRegisterUser', user) - } -} - + setError({ commit }, error) { + commit('setError', error); + }, + setUser({ commit }, user) { + commit('setUser', user); + }, + setRegisterUser({ commit }, user) { + commit('setRegisterUser', user); + }, +}; export default new Vuex.Store({ - state, - getters, - actions, - mutations, -}) + state, + getters, + actions, + mutations, +}); diff --git a/src/util/auth.js b/src/util/auth.js index 1ffe81e..1e795f4 100644 --- a/src/util/auth.js +++ b/src/util/auth.js @@ -1,8 +1,8 @@ -import store from "@/store"; +import store from '@/store'; -const ID_TOKEN_KEY = "id_token"; -const USER_KEY = "user"; -const LOGIN_REDIRECT_KEY = "login_redirect"; +const ID_TOKEN_KEY = 'id_token'; +const USER_KEY = 'user'; +const LOGIN_REDIRECT_KEY = 'login_redirect'; let API_URL = window.CONFIG.API_URL; let API_BASE_PATH = window.CONFIG.API_BASE_PATH; @@ -10,20 +10,20 @@ let API_BASE_PATH = window.CONFIG.API_BASE_PATH; export function setLoggedUser(token, user) { setIdToken(token); setUser(user); - store.dispatch("setUser", user); + store.dispatch('setUser', user); } export function doLogout() { unsetIdToken(); unsetUser(); - store.dispatch("setUser", null); + store.dispatch('setUser', null); } export function apiurlwithtoken(path) { let u = new URL(API_URL + API_BASE_PATH + path); let idToken = getIdToken(); if (idToken) { - u.searchParams.append("access_token", idToken); + u.searchParams.append('access_token', idToken); } return u; } @@ -33,19 +33,19 @@ export function apiurl(path) { } export function loginurl() { - return apiurl("/auth/login"); + return apiurl('/auth/login'); } export function authorizeurl() { - return apiurl("/auth/authorize"); + return apiurl('/auth/authorize'); } export function registerurl() { - return new apiurl("/auth/register"); + return new apiurl('/auth/register'); } export function oauth2callbackurl() { - return new apiurl("/auth/oauth2/callback"); + return new apiurl('/auth/oauth2/callback'); } export async function loginapi(init) { @@ -64,19 +64,19 @@ export async function registerapi(init) { return await window.fetch(registerurl(), init); } -export async function fetch(url, init, signal, token, tokenType = "bearer") { +export async function fetch(url, init, signal, token, tokenType = 'bearer') { if (!init) { init = {}; } if (init.headers === undefined) { - init["headers"] = {}; + init['headers'] = {}; } if (signal) { - init["signal"] = signal; + init['signal'] = signal; } let idToken = token || getIdToken(); if (idToken) { - init.headers["Authorization"] = tokenType + " " + idToken; + init.headers['Authorization'] = tokenType + ' ' + idToken; } return await window.fetch(url, init); diff --git a/src/util/data.js b/src/util/data.js index d006e39..7b4260e 100644 --- a/src/util/data.js +++ b/src/util/data.js @@ -1,8 +1,9 @@ -import router from "@/router"; -import { apiurl, fetch as authfetch, loginapi, registerapi } from "@/util/auth"; +import router from '@/router'; +import { apiurl, fetch as authfetch, loginapi, registerapi } from '@/util/auth'; -export const GITHUB_API_URL = "https://api.github.com"; -export const GITHUB_SSH_KEY = "github.com ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGmdnm9tUDbO9IDSwBK6TbQa+PXYPCPy6rbTrTtw7PHkccKrpp0yVhp5HdEIcKr6pLlVDBfOLX9QUsyCOV0wzfjIJNlGEYsdlLJizHhbn2mUjvSAHQqZETYP81eFzLQNnPHt4EVVUh7VfDESU84KezmD5QlWpXLmvU31/yMf+Se8xhHTvKSCZIFImWwoG6mbUoWf9nzpIoaSjB+weqqUUmpaaasXVal72J+UX2B+2RPW3RcT0eOzQgqlJL3RKrTJvdsjE3JEAvGq3lGHSZXy28G3skua2SmVi/w4yCE6gbODqnTWlg7+wC604ydGXA8VJiS5ap43JXiUFFAaQ=="; +export const GITHUB_API_URL = 'https://api.github.com'; +export const GITHUB_SSH_KEY = + 'github.com ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGmdnm9tUDbO9IDSwBK6TbQa+PXYPCPy6rbTrTtw7PHkccKrpp0yVhp5HdEIcKr6pLlVDBfOLX9QUsyCOV0wzfjIJNlGEYsdlLJizHhbn2mUjvSAHQqZETYP81eFzLQNnPHt4EVVUh7VfDESU84KezmD5QlWpXLmvU31/yMf+Se8xhHTvKSCZIFImWwoG6mbUoWf9nzpIoaSjB+weqqUUmpaaasXVal72J+UX2B+2RPW3RcT0eOzQgqlJL3RKrTJvdsjE3JEAvGq3lGHSZXy28G3skua2SmVi/w4yCE6gbODqnTWlg7+wC604ydGXA8VJiS5ap43JXiUFFAaQ=='; export async function fetch(url, init, signal, token, tokenType) { try { @@ -10,8 +11,8 @@ export async function fetch(url, init, signal, token, tokenType) { if (!res.ok) { if (res.status === 401) { router.push({ - name: "login", - query: { redirect: router.currentRoute.fullPath } + name: 'login', + query: { redirect: router.currentRoute.fullPath }, }); // if we return a response containing an error what happens is // that router.push mounts the login view before the calling @@ -36,21 +37,21 @@ export async function fetch(url, init, signal, token, tokenType) { return { data: await res.json(), error: null }; } } catch (e) { - if (e.name == "AbortError") { + if (e.name == 'AbortError') { return { data: null, error: null, aborted: true }; } - return { data: null, error: "api call failed: " + e.message }; + return { data: null, error: 'api call failed: ' + e.message }; } } export async function login(username, password, remotesourcename) { let init = { - method: "POST", + method: 'POST', body: JSON.stringify({ remote_source_name: remotesourcename, login_name: username, - password: password - }) + password: password, + }), }; try { @@ -62,7 +63,7 @@ export async function login(username, password, remotesourcename) { return { data: await res.json(), error: null }; } } catch (e) { - return { data: null, error: "api call failed: " + e.message }; + return { data: null, error: 'api call failed: ' + e.message }; } } @@ -73,13 +74,13 @@ export async function register( remotepassword ) { let init = { - method: "POST", + method: 'POST', body: JSON.stringify({ username: username, remote_source_name: remotesourcename, remote_source_login_name: remoteloginname, - remote_source_login_password: remotepassword - }) + remote_source_login_password: remotepassword, + }), }; try { @@ -91,111 +92,122 @@ export async function register( return { data: await res.json(), error: null }; } } catch (e) { - return { data: null, error: "api call failed: " + e.message }; + return { data: null, error: 'api call failed: ' + e.message }; } } export async function fetchCurrentUser(signal) { - let path = "/user"; + let path = '/user'; return await fetch(apiurl(path), null, signal); } export async function fetchOrgMembers(orgref, signal) { - let path = "/orgs/" + orgref + "/members"; + let path = '/orgs/' + orgref + '/members'; return await fetch(apiurl(path), null, signal); } export async function fetchRuns(group, startRunID, lastrun, signal) { - let u = apiurl("/runs"); + let u = apiurl('/runs'); if (group) { - u.searchParams.append("group", group); + u.searchParams.append('group', group); } if (lastrun) { - u.searchParams.append("lastrun", true); + u.searchParams.append('lastrun', true); } if (startRunID) { - u.searchParams.append("start", startRunID); + u.searchParams.append('start', startRunID); } return await fetch(u, null, signal); } export async function fetchRun(runid, signal) { - return await fetch(apiurl("/runs/" + runid), null, signal); + return await fetch(apiurl('/runs/' + runid), null, signal); } export async function fetchTask(runid, taskid, signal) { - return await fetch(apiurl("/runs/" + runid + "/tasks/" + taskid), signal); + return await fetch(apiurl('/runs/' + runid + '/tasks/' + taskid), signal); } export async function fetchUser(username, signal) { - let path = "/users/" + username; + let path = '/users/' + username; return await fetch(apiurl(path), null, signal); } export async function fetchProjectGroup(projectgroupref, signal) { - let path = "/projectgroups/" + encodeURIComponent(projectgroupref); + let path = '/projectgroups/' + encodeURIComponent(projectgroupref); return await fetch(apiurl(path), null, signal); } export async function fetchProjectGroupSubgroups(projectgroupref, signal) { - let path = "/projectgroups/" + encodeURIComponent(projectgroupref); - path += "/subgroups"; + let path = '/projectgroups/' + encodeURIComponent(projectgroupref); + path += '/subgroups'; return await fetch(apiurl(path), null, signal); } export async function fetchProjectGroupProjects(projectgroupref, signal) { - let path = "/projectgroups/" + encodeURIComponent(projectgroupref); - path += "/projects"; + let path = '/projectgroups/' + encodeURIComponent(projectgroupref); + path += '/projects'; return await fetch(apiurl(path), null, signal); } export async function fetchProject(ref, signal) { - let path = "/projects/" + encodeURIComponent(ref); + let path = '/projects/' + encodeURIComponent(ref); return await fetch(apiurl(path), null, signal); } export async function fetchSecrets(ownertype, ref, all, signal) { let path; - if (ownertype == "project") { - path = "/projects/"; - } else if (ownertype == "projectgroup") { - path = "/projectgroups/"; + if (ownertype == 'project') { + path = '/projects/'; + } else if (ownertype == 'projectgroup') { + path = '/projectgroups/'; } path += encodeURIComponent(ref); - path += "/secrets"; + path += '/secrets'; if (all) { - path += "?tree&removeoverridden"; + path += '?tree&removeoverridden'; } return await fetch(apiurl(path), null, signal); } export async function fetchVariables(ownertype, ref, all, signal) { let path; - if (ownertype == "project") { - path = "/projects/"; - } else if (ownertype == "projectgroup") { - path = "/projectgroups/"; + if (ownertype == 'project') { + path = '/projects/'; + } else if (ownertype == 'projectgroup') { + path = '/projectgroups/'; } path += encodeURIComponent(ref); - path += "/variables"; + path += '/variables'; if (all) { - path += "?tree&removeoverridden"; + path += '?tree&removeoverridden'; } return await fetch(apiurl(path), null, signal); } export async function createRemoteSource( - token, type, name, clientID, clientSecret, apiURL, authType, skipVerify, - sshHostKey, skipSshHostKeyCheck, registrationEnabled, loginEnabled, signal, + token, + type, + name, + clientID, + clientSecret, + apiURL, + authType, + skipVerify, + sshHostKey, + skipSshHostKeyCheck, + registrationEnabled, + loginEnabled, + signal ) { - let path = "/remotesources"; + let path = '/remotesources'; let init = { - method: "POST", + method: 'POST', body: JSON.stringify({ name, apiurl: apiURL, @@ -208,38 +220,38 @@ export async function createRemoteSource( oauth_2_client_secret: clientSecret, registration_enabled: registrationEnabled, login_enabled: loginEnabled, - }) + }), }; - return await fetch(apiurl(path), init, signal, token, "token"); + return await fetch(apiurl(path), init, signal, token, 'token'); } export async function createOrganization(orgname, visibility, signal) { - let path = "/orgs"; + let path = '/orgs'; let init = { - method: "POST", + method: 'POST', body: JSON.stringify({ name: orgname, - visibility: visibility - }) + visibility: visibility, + }), }; return await fetch(apiurl(path), init, signal); } export async function createUserToken(username, tokenname, signal) { - let path = "/users/" + username + "/tokens"; + let path = '/users/' + username + '/tokens'; let init = { - method: "POST", + method: 'POST', body: JSON.stringify({ - token_name: tokenname - }) + token_name: tokenname, + }), }; return await fetch(apiurl(path), init, signal); } export async function deleteUserToken(username, tokenname, signal) { - let path = "/users/" + username + "/tokens/" + tokenname; + let path = '/users/' + username + '/tokens/' + tokenname; let init = { - method: "DELETE" + method: 'DELETE', }; return await fetch(apiurl(path), init, signal); } @@ -251,90 +263,90 @@ export async function createUserLinkedAccount( password, signal ) { - let path = "/users/" + username + "/linkedaccounts"; + let path = '/users/' + username + '/linkedaccounts'; let init = { - method: "POST", + method: 'POST', body: JSON.stringify({ remote_source_name: remotesourcename, remote_source_login_name: loginname, - remote_source_login_password: password - }) + remote_source_login_password: password, + }), }; return await fetch(apiurl(path), init, signal); } export async function deleteLinkedAccount(username, laid, signal) { - let path = "/users/" + username + "/linkedaccounts/" + laid; + let path = '/users/' + username + '/linkedaccounts/' + laid; let init = { - method: "DELETE" + method: 'DELETE', }; return await fetch(apiurl(path), init, signal); } export async function restartRun(runid, fromStart, signal) { - let path = "/runs/" + runid + "/actions"; + let path = '/runs/' + runid + '/actions'; let init = { - method: "PUT", + method: 'PUT', body: JSON.stringify({ - action_type: "restart", - from_start: fromStart - }) + action_type: 'restart', + from_start: fromStart, + }), }; return await fetch(apiurl(path), init, signal); } export async function cancelRun(runid, signal) { - let path = "/runs/" + runid + "/actions"; + let path = '/runs/' + runid + '/actions'; let init = { - method: "PUT", + method: 'PUT', body: JSON.stringify({ - action_type: "cancel" - }) + action_type: 'cancel', + }), }; return await fetch(apiurl(path), init, signal); } export async function stopRun(runid, signal) { - let path = "/runs/" + runid + "/actions"; + let path = '/runs/' + runid + '/actions'; let init = { - method: "PUT", + method: 'PUT', body: JSON.stringify({ - action_type: "stop" - }) + action_type: 'stop', + }), }; return await fetch(apiurl(path), init, signal); } export async function approveTask(runid, taskid, signal) { - let path = "/runs/" + runid + "/tasks/" + taskid + "/actions"; + let path = '/runs/' + runid + '/tasks/' + taskid + '/actions'; let init = { - method: "PUT", + method: 'PUT', body: JSON.stringify({ - action_type: "approve" - }) + action_type: 'approve', + }), }; return await fetch(apiurl(path), init, signal); } export async function fetchRemoteSources(signal) { - let path = "/remotesources"; + let path = '/remotesources'; return await fetch(apiurl(path), null, signal); } export async function userRemoteRepos(remotesourceid, signal) { - let path = "/user/remoterepos/" + remotesourceid; + let path = '/user/remoterepos/' + remotesourceid; return await fetch(apiurl(path, null, signal)); } export async function createProjectGroup(parentref, name, visibility, signal) { - let path = "/projectgroups"; + let path = '/projectgroups'; let init = { - method: "POST", + method: 'POST', body: JSON.stringify({ name: name, parent_ref: parentref, - visibility: visibility - }) + visibility: visibility, + }), }; return await fetch(apiurl(path), init, signal); } @@ -345,13 +357,13 @@ export async function updateProjectGroup( visibility, signal ) { - let path = "/projectgroups/" + encodeURIComponent(projectgroupref); + let path = '/projectgroups/' + encodeURIComponent(projectgroupref); let init = { - method: "PUT", + method: 'PUT', body: JSON.stringify({ name: name, - visibility: visibility - }) + visibility: visibility, + }), }; return await fetch(apiurl(path), init, signal); } @@ -365,56 +377,61 @@ export async function createProject( passvarstoforkedpr, signal ) { - let path = "/projects"; + let path = '/projects'; let init = { - method: "POST", + method: 'POST', body: JSON.stringify({ name: name, parent_ref: parentref, visibility: visibility, remote_source_name: remotesourcename, repo_path: remoterepopath, - pass_vars_to_forked_pr: passvarstoforkedpr - }) + pass_vars_to_forked_pr: passvarstoforkedpr, + }), }; return await fetch(apiurl(path), init, signal); } -export async function updateProject(projectref, name, visibility, passvarstoforkedpr, signal) { - let path = "/projects/" + encodeURIComponent(projectref); +export async function updateProject( + projectref, + name, + visibility, + passvarstoforkedpr, + signal +) { + let path = '/projects/' + encodeURIComponent(projectref); let init = { - method: "PUT", + method: 'PUT', body: JSON.stringify({ name: name, visibility: visibility, - pass_vars_to_forked_pr: passvarstoforkedpr - }) + pass_vars_to_forked_pr: passvarstoforkedpr, + }), }; return await fetch(apiurl(path), init, signal); } export async function deleteProject(projectref, signal) { - let path = "/projects/" + encodeURIComponent(projectref); + let path = '/projects/' + encodeURIComponent(projectref); let init = { - method: "DELETE" + method: 'DELETE', }; return await fetch(apiurl(path), init, signal); } export async function projectUpdateRepoLinkedAccount(projectref, signal) { let path = - "/projects/" + encodeURIComponent(projectref) + "/updaterepolinkedaccount"; + '/projects/' + encodeURIComponent(projectref) + '/updaterepolinkedaccount'; let init = { - method: "PUT" + method: 'PUT', }; return await fetch(apiurl(path), init, signal); } export async function deleteProjectGroup(projectgroupref, signal) { - let path = "/projectgroups/" + encodeURIComponent(projectgroupref); + let path = '/projectgroups/' + encodeURIComponent(projectgroupref); let init = { - method: "DELETE" + method: 'DELETE', }; return await fetch(apiurl(path), init, signal); } - diff --git a/src/util/link.js b/src/util/link.js index 35734f8..78289d3 100644 --- a/src/util/link.js +++ b/src/util/link.js @@ -1,130 +1,173 @@ export function parseRef(ref) { - ref = ref.replace(/\.proj/, "") - // return empty array or split return an array with the empty element - if (!ref) { - return [] - } - return ref.split("/") + ref = ref.replace(/\.proj/, ''); + // return empty array or split return an array with the empty element + if (!ref) { + return []; + } + return ref.split('/'); } export function ownerLink(ownertype, ownername) { - if (ownertype == "user") { - return { name: ownertype, params: { username: ownername } } - } else if (ownertype == "org") { - return { name: ownertype, params: { orgname: ownername } } - } + if (ownertype == 'user') { + return { name: ownertype, params: { username: ownername } }; + } else if (ownertype == 'org') { + return { name: ownertype, params: { orgname: ownername } }; + } } export function ownerProjectsLink(ownertype, ownername) { - return { name: ownertype + " projects", params: { ownername: ownername } } + return { name: ownertype + ' projects', params: { ownername: ownername } }; } export function ownerSettingsLink(ownertype, ownername) { - if (ownertype == "user") { - return { name: ownertype + " settings", params: { username: ownername } } - } else if (ownertype == "org") { - return { name: ownertype + " settings", params: { orgname: ownername } } - } + if (ownertype == 'user') { + return { name: ownertype + ' settings', params: { username: ownername } }; + } else if (ownertype == 'org') { + return { name: ownertype + ' settings', params: { orgname: ownername } }; + } } export function userDirectRunsLink(username) { - return { name: "user direct runs", params: { username: username } } + return { name: 'user direct runs', params: { username: username } }; } export function userDirectRunLink(username, runid) { - return { name: "user direct run", params: { username: username, runid: runid } } + return { + name: 'user direct run', + params: { username: username, runid: runid }, + }; } export function userDirectRunTaskLink(username, runid, taskid) { - return { name: "user direct run task", params: { username: username, runid: runid, taskid: taskid } } + return { + name: 'user direct run task', + params: { username: username, runid: runid, taskid: taskid }, + }; } export function userAddLinkedAccountLink(username, remotesourcename) { - return { name: "user add linked account", params: { username: username, remotesource: remotesourcename } } + return { + name: 'user add linked account', + params: { username: username, remotesource: remotesourcename }, + }; } export function orgMembersLink(orgname) { - return { name: "org members", params: { orgname: orgname } } + return { name: 'org members', params: { orgname: orgname } }; } // Note, when creating a router link containing a project/projectgroup ref (a // path), unfortunately, we cannot use route name and params since it will path // escape it export function projectGroupPath(ownertype, ownername, projectgroupref) { - let path = `/${ownertype}/${ownername}` - // root project group will have a .proj without a name - let projectgrouppath = (projectgroupref.join("/") + ".proj") - path = `${path}/projectgroups/${projectgrouppath}` - return path + let path = `/${ownertype}/${ownername}`; + // root project group will have a .proj without a name + let projectgrouppath = projectgroupref.join('/') + '.proj'; + path = `${path}/projectgroups/${projectgrouppath}`; + return path; } export function projectPath(ownertype, ownername, projectref) { - let path = `/${ownertype}/${ownername}` - let projectpath = (projectref.join("/") + ".proj") - path = `${path}/projects/${projectpath}` - return path + let path = `/${ownertype}/${ownername}`; + let projectpath = projectref.join('/') + '.proj'; + path = `${path}/projects/${projectpath}`; + return path; } export function projectGroupLink(ownertype, ownername, projectgroupref) { - return { path: projectGroupPath(ownertype, ownername, projectgroupref) } + return { path: projectGroupPath(ownertype, ownername, projectgroupref) }; } -export function projectGroupProjectsLink(ownertype, ownername, projectgroupref) { - let projectgrouppath = (projectgroupref.join("/") + ".proj") - return { path: `/${ownertype}/${ownername}/projectgroups/${projectgrouppath}/projects` } +export function projectGroupProjectsLink( + ownertype, + ownername, + projectgroupref +) { + let projectgrouppath = projectgroupref.join('/') + '.proj'; + return { + path: `/${ownertype}/${ownername}/projectgroups/${projectgrouppath}/projects`, + }; } export function projectLink(ownertype, ownername, projectref) { - let projectpath = (projectref.join("/") + ".proj") - return { path: `/${ownertype}/${ownername}/projects/${projectpath}` } + let projectpath = projectref.join('/') + '.proj'; + return { path: `/${ownertype}/${ownername}/projects/${projectpath}` }; } export function projectRunsLink(ownertype, ownername, projectref) { - let projectpath = (projectref.join("/") + ".proj") - return { path: `/${ownertype}/${ownername}/projects/${projectpath}/runs` } + let projectpath = projectref.join('/') + '.proj'; + return { path: `/${ownertype}/${ownername}/projects/${projectpath}/runs` }; } export function projectBranchesRunsLink(ownertype, ownername, projectref) { - let projectpath = (projectref.join("/") + ".proj") - return { path: `/${ownertype}/${ownername}/projects/${projectpath}/branches` } + let projectpath = projectref.join('/') + '.proj'; + return { + path: `/${ownertype}/${ownername}/projects/${projectpath}/branches`, + }; } export function projectTagsRunsLink(ownertype, ownername, projectref) { - let projectpath = (projectref.join("/") + ".proj") - return { path: `/${ownertype}/${ownername}/projects/${projectpath}/tags` } + let projectpath = projectref.join('/') + '.proj'; + return { path: `/${ownertype}/${ownername}/projects/${projectpath}/tags` }; } export function projectPRsRunsLink(ownertype, ownername, projectref) { - let projectpath = (projectref.join("/") + ".proj") - return { path: `/${ownertype}/${ownername}/projects/${projectpath}/pullrequests` } + let projectpath = projectref.join('/') + '.proj'; + return { + path: `/${ownertype}/${ownername}/projects/${projectpath}/pullrequests`, + }; } export function projectRunLink(ownertype, ownername, projectref, runid) { - let projectpath = (projectref.join("/") + ".proj") - return { path: `/${ownertype}/${ownername}/projects/${projectpath}/runs/${runid}` } + let projectpath = projectref.join('/') + '.proj'; + return { + path: `/${ownertype}/${ownername}/projects/${projectpath}/runs/${runid}`, + }; } -export function projectRunTaskLink(ownertype, ownername, projectref, runid, taskid) { - let projectpath = (projectref.join("/") + ".proj") - return { path: `/${ownertype}/${ownername}/projects/${projectpath}/runs/${runid}/tasks/${taskid}` } +export function projectRunTaskLink( + ownertype, + ownername, + projectref, + runid, + taskid +) { + let projectpath = projectref.join('/') + '.proj'; + return { + path: `/${ownertype}/${ownername}/projects/${projectpath}/runs/${runid}/tasks/${taskid}`, + }; } -export function projectGroupSettingsLink(ownertype, ownername, projectgroupref) { - let path = projectGroupPath(ownertype, ownername, projectgroupref) - return { path: `${path}/settings` } +export function projectGroupSettingsLink( + ownertype, + ownername, + projectgroupref +) { + let path = projectGroupPath(ownertype, ownername, projectgroupref); + return { path: `${path}/settings` }; } export function projectSettingsLink(ownertype, ownername, projectref) { - let projectpath = (projectref.join("/") + ".proj") - return { path: `/${ownertype}/${ownername}/projects/${projectpath}/settings` } + let projectpath = projectref.join('/') + '.proj'; + return { + path: `/${ownertype}/${ownername}/projects/${projectpath}/settings`, + }; } -export function projectGroupCreateProjectGroupLink(ownertype, ownername, projectgroupref) { - let path = projectGroupPath(ownertype, ownername, projectgroupref) - return { path: `${path}/createprojectgroup` } +export function projectGroupCreateProjectGroupLink( + ownertype, + ownername, + projectgroupref +) { + let path = projectGroupPath(ownertype, ownername, projectgroupref); + return { path: `${path}/createprojectgroup` }; } -export function projectGroupCreateProjectLink(ownertype, ownername, projectgroupref) { - let path = projectGroupPath(ownertype, ownername, projectgroupref) - return { path: `${path}/createproject` } -} \ No newline at end of file +export function projectGroupCreateProjectLink( + ownertype, + ownername, + projectgroupref +) { + let path = projectGroupPath(ownertype, ownername, projectgroupref); + return { path: `${path}/createproject` }; +} diff --git a/src/util/run.js b/src/util/run.js index 79d0c98..b442c0a 100644 --- a/src/util/run.js +++ b/src/util/run.js @@ -1,25 +1,24 @@ - export function runStatus(run) { - // * if the run has a result then return the result - // * if stopping return "stopping" - // * return the phase - if (run.result != "unknown") return run.result; - if (run.stopping) return "stopping"; - if (run.phase != "finished") return run.phase; + // * if the run has a result then return the result + // * if stopping return "stopping" + // * return the phase + if (run.result != 'unknown') return run.result; + if (run.stopping) return 'stopping'; + if (run.phase != 'finished') return run.phase; - return run.result; + return run.result; } export function runResultClass(run) { - let status = runStatus(run); + let status = runStatus(run); - if (status == "setuperror") return "setuperror"; - if (status == "queued") return "unknown"; - if (status == "cancelled") return "failed"; - if (status == "running") return "running"; - if (status == "stopping") return "failed"; - if (status == "stopped") return "failed"; - if (status == "success") return "success"; - if (status == "failed") return "failed"; - return "unknown"; -} \ No newline at end of file + if (status == 'setuperror') return 'setuperror'; + if (status == 'queued') return 'unknown'; + if (status == 'cancelled') return 'failed'; + if (status == 'running') return 'running'; + if (status == 'stopping') return 'failed'; + if (status == 'stopped') return 'failed'; + if (status == 'success') return 'success'; + if (status == 'failed') return 'failed'; + return 'unknown'; +} diff --git a/src/views/AddLinkedAccount.vue b/src/views/AddLinkedAccount.vue index 5d2bc22..a45e513 100644 --- a/src/views/AddLinkedAccount.vue +++ b/src/views/AddLinkedAccount.vue @@ -13,36 +13,44 @@ v-if="remotesource.auth_type == 'password'" action="Add Linked Account" :name="remotesource.name" - v-on:login="doAddLinkedAccount(remotesource.name, $event.username, $event.password)" + v-on:login=" + doAddLinkedAccount( + remotesource.name, + $event.username, + $event.password + ) + " /> + > + Add Linked Account with {{ remotesource.name }} +
      - - - - diff --git a/src/views/CreateSource.vue b/src/views/CreateSource.vue index 68b8572..ce267e4 100644 --- a/src/views/CreateSource.vue +++ b/src/views/CreateSource.vue @@ -8,13 +8,9 @@ {{ error }}
      -
      -
      - +
      +
      +
      @@ -22,40 +18,53 @@ - - diff --git a/src/views/Home.vue b/src/views/Home.vue index 23d943a..0b9d54d 100644 --- a/src/views/Home.vue +++ b/src/views/Home.vue @@ -1,25 +1,15 @@ diff --git a/src/views/Login.vue b/src/views/Login.vue index c857fe4..13afe53 100644 --- a/src/views/Login.vue +++ b/src/views/Login.vue @@ -13,14 +13,9 @@ class="mb-10 bg-red-100 border border-red-400 text-red-700 px-4 py-3 rounded relative" > No remote sources defined - - - + + +
      - - diff --git a/src/views/Logout.vue b/src/views/Logout.vue index 921b5b5..de7f18e 100644 --- a/src/views/Logout.vue +++ b/src/views/Logout.vue @@ -1,13 +1,11 @@ - - diff --git a/src/views/Oauth2.vue b/src/views/Oauth2.vue index c468eda..37bb96c 100644 --- a/src/views/Oauth2.vue +++ b/src/views/Oauth2.vue @@ -11,32 +11,32 @@ - diff --git a/src/views/Org.vue b/src/views/Org.vue index 595de9a..21a3541 100644 --- a/src/views/Org.vue +++ b/src/views/Org.vue @@ -9,13 +9,15 @@ /
    • - {{orgname}} + {{ + orgname + }}
    • - {{orgname}} + {{ orgname }}
      @@ -23,7 +25,12 @@
      • @@ -42,7 +49,13 @@
      • @@ -52,7 +65,9 @@
      • @@ -65,7 +80,7 @@
        + +
        - - - diff --git a/src/views/User.vue b/src/views/User.vue index 4f9b5bb..369e28c 100644 --- a/src/views/User.vue +++ b/src/views/User.vue @@ -9,13 +9,15 @@ /
      • - {{username}} + {{ + username + }}
      • - {{username}} + {{ username }}
        @@ -23,7 +25,12 @@
        • @@ -32,7 +39,9 @@
        • @@ -40,19 +49,29 @@
        • Run - #{{run.counter}} + #{{ run.counter }}
        • @@ -62,21 +81,35 @@
        • Task - {{run.tasks[$route.params.taskid].name}} + {{ run.tasks[$route.params.taskid].name }}
        • @@ -86,7 +119,9 @@
        • @@ -99,7 +134,7 @@